Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland #110

Closed
wants to merge 3 commits into from
Closed

Wayland #110

wants to merge 3 commits into from

Conversation

tomeuv
Copy link

@tomeuv tomeuv commented Oct 25, 2013

While waiting, I have fixed a couple of bugs regarding resource deallocation, making it more correct and perhaps more robust. Support has been already merged into Weston and people are waiting for this to be available in Raspbian to test. Thanks!

@Paul-Winwood
Copy link

FWIW, I have built the raspberry pi userland Tomeu's pull request and then the latest Weston/Wayland from their repository on my Raspberry Pi and conducted some tests. Everthing seems to be working fine. Looking forward for this to be available in Raspbian. If there is anything I can do please ask. Thanks!.

@popcornmix
Copy link
Contributor

Currenlty building userland (from the buildme script) both as a cross compile or natively is much more complicated.
I'd prefer this PR to be "opt-in" - i.e. with a make variable to enable Wayland suport, until the raspbian images include the required libraryies to build.

Currently most users will do:

./buildme
...
-- checking for module 'wayland-client'
--   package 'wayland-client' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  CMakeLists.txt:123 (pkg_check_modules)


-- checking for module 'wayland-server'
--   package 'wayland-server' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  CMakeLists.txt:124 (pkg_check_modules)

which will generate complaints from people just wanting to rebuild raspicam.

Dom Cobley and others added 3 commits November 8, 2013 15:15
This patch adds provisions in userland to
let apps callers set the next rendereing dispmanx resource.
It's useful for implementing, say, a buffer carousel.
* Adds EGL_WL_bind_wayland_display extension
* Adds wayland-egl library
* Adds wl_dispmanx_buffer protocol extension

TODO: Check that platform_get_dimensions() returning swapchain_count == 1 is correct

TODO: Remove the requirement of passing a valid DispmanX element handle to
the SwapBuffers and CreateSurface RPC calls. This will remove the need to open
a DispmanX display from the clients.

TODO: wl_dispmanx_server_buffer should probably be defined in a
private header that can be included from EGL and vc_* instead of in
vc_vchi_dispmanx.h
@tomeuv
Copy link
Author

tomeuv commented Nov 8, 2013

Have made the new code disabled by default and updated the README with instructions to enable it.

@popcornmix
Copy link
Contributor

Thanks, will take a look.

@ReubenM
Copy link

ReubenM commented Dec 22, 2013

I'm putting this here since it hasn't been pulled yet...

I very well may doing something incorrectly, as this is the first time I've tried to mess with this DispmanX accelerated version of weston.

[04:33:20.335] weston 1.3.1
               http://wayland.freedesktop.org/
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=1.3.1
               Build:  
[04:33:20.336] OS: Linux, 3.10.24+, #3 PREEMPT Sat Dec 21 13:07:43 CST 2013, armv6l
[04:33:20.339] Starting with no config file.
[04:33:20.344] Loading module '/usr/lib/weston/rpi-backend.so'
[04:33:20.360] initializing Raspberry Pi backend
[04:33:20.365] Dispmanx planes are double buffered.
[04:33:20.370] Initializing the DispmanX compositing renderer
[04:33:20.373] Raspberry Pi HDMI output 1920x1080 px
               guessing 60 Hz and 96 dpi
               orientation: normal
[04:33:20.373] launching '/usr/libexec/weston-keyboard'
[04:33:20.712] input device HID 0566:3108, /dev/input/event0 is a keyboard
[04:33:20.714] input device HID 0566:3108, /dev/input/event1 is a keyboard
[04:33:20.716] input device Elan USB Audio, /dev/input/event2 is a keyboard
[04:33:20.719] Loading module '/usr/lib/weston/desktop-shell.so'
[04:33:20.725] Compositor capabilities:
               arbitrary surface rotation: no
               screen capture uses y-flip: no
[04:33:20.725] libwayland: using socket /run/user/0/wayland-0
[04:33:20.727] launching '/usr/libexec/weston-desktop-shell'
assertion failure:/usr/src/userland/interface/vmcs_host/vc_vchi_dispmanx.c:1229:dispmanx_notify_func():dispmanx_client.pending_update_handle == (DISPMANX_UPDATE_HANDLE_T) dispmanx_client.notify_buffer[1]
[04:33:20.730] caught signal: 6
Failed to process Wayland connection: Connection reset by peer
failed to create display: Connection reset by peer
assertion failure:/usr/src/userland/interface/vmcs_host/vc_vchi_dispmanx.c:84:lock_obtain():dispmanx_client.initialised

@popcornmix
Copy link
Contributor

@ReubenM It appears dispmanx functions are being called without vc_vchi_dispmanx_init being called.
Not sure why.

@joshzana
Copy link

I patched this down onto my buildroot based system that has weston, the various weston samples, hello_dispmax, and the hello_pi GL samples running. For some reason, running hello_wayland from the weston terminal crashes with "failed to get wl_dispmanx" in init_process_wayland(). my guess is that process->wl_dispamax is null and that it has something to do with registry_handle_global where that gets set.
Before I do further debugging, should this work as is?

Here's my weston startup log:

# weston --tty=1
Date: 1970-01-02 UTC
[05:22:31.935] weston 1.3.91
               http://wayland.freedesktop.org/
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=1.3.91
               Build:  
[05:22:31.941] OS: Linux, 3.10.25, #1 PREEMPT Thu Jan 9 12:51:20 PST 2014, armv6l
[05:22:31.943] Starting with no config file.
[05:22:31.946] Loading module '/usr/lib/weston/rpi-backend.so'
[05:22:31.959] initializing Raspberry Pi backend
[05:22:31.963] Dispmanx planes are double buffered.
[05:22:31.968] launching '/usr/libexec/weston-keyboard'
[05:22:31.972] input device Microsoft Microsoft�� 2.4GHz Transceiver v5.0, /dev/input/event0 is a pointer caps = relative-motion button
[05:22:32.104] input device Logitech USB Keyboard, /dev/input/event1 is a keyboard
[05:22:32.107] input device Logitech USB Keyboard, /dev/input/event2 is a keyboard
[05:22:32.110] input device libcec-daemon, /dev/input/event3 is a keyboard
[05:22:32.115] Initializing the DispmanX compositing renderer
[05:22:32.116] Raspberry Pi HDMI output 1920x1080 px
               guessing 60 Hz and 96 dpi
               orientation: normal
[05:22:32.125] Loading module '/usr/lib/weston/desktop-shell.so'
[05:22:32.130] Compositor capabilities:
               arbitrary surface rotation: no
               screen capture uses y-flip: no
[05:22:32.135] libwayland: using socket /run/shm/wayland/wayland-0
[05:22:32.138] launching '/usr/libexec/weston-desktop-shell'

@tomeuv
Copy link
Author

tomeuv commented Jan 19, 2014

@joshzana Looks like your Weston doesn't have wl_dispmanx support.

@joshzana
Copy link

I assumed that this line:
Initializing the DispmanX compositing renderer
Meant that I did have this correctly configured. Is there a build flag or patch I am missing in weston?

@ReubenM
Copy link

ReubenM commented Jan 20, 2014

For what it's worth, I still haven't been able to get it to work either. I rebuild latest wayland / weston from git now and then to see if anything changed, but still doesn't seem to work.

Wayland tests all pass. The first 2 tests for Weston pass, but the rest fail.

Mine is a bootstrapped gentoo build using systemd init. Built on a binfmt chroot image that is then duplicated to the SD card.

@ghost
Copy link

ghost commented Jan 20, 2014

For the record, I ended up getting it to work a few months ago under Raspbian, and I'm still running Wayland/Weston with @tomeuv 's fork.

I'm using the very latest Weston and Wayland from their respective official git repos, using the Raspberry Pi build guide but with the flags --enable-wayland-compositor --enable-simple-egl-clients and --enable-egl instead of their --disable counterparts when building Weston.

I also added /opt/vc/lib/pkgconfig/ to the PKG_CONFIG_PATH when setting up the environment variables for Wayland/Weston, thanks to @tomeuv 's help.

Finally, I had to add -lrt to my LDFLAGS and -I/opt/vc/include/interface/vcos/pthreads, -I/opt/vc/include/interface/vmcs_host/linux and -I/opt/vc/include to my CFLAGS before building anything.

There was also a specific sequence to which these projects had to be built and installed. I think it was Wayland first, then @tomeuv 's fork of the Broadcom Userland drivers, then Weston. I could be wrong on that, let me know if that's the case.

Whew.

@ghost
Copy link

ghost commented Jan 20, 2014

One last bit, and this was recently updated in the Raspberry Pi build guide last month, is that I can only run Weston from the root user, or as user pi with weston-launch. The permissions you need to get that up and running are listed under "Weston and demo applications".

@ReubenM
Copy link

ReubenM commented Jan 20, 2014

Yes, I've done all that. I've set up a weston group, created pc files for the bits and pieces that don't have them. Build flags and environment variables. I haven't added -lrt to LDFLAGS, but I assume the build would fail if it couldn't find the lib to link to. The main difference is that I'm building from this official code base with the patch applied, rather than from the tomeuv fork. Perhaps changes since the fork are causing runtime problems without causing compile problems.

I've also been wondering if perhaps there is some issue with read/write access to various system files/devices/sockets that would have been dealt with in Raspbian that wouldn't be present by default in a Gentoo base that I'm not yet aware of.

@ppaalanen
Copy link

@ReubenM Could it be that you are building the userland.git with assertions enabled? IIRC we had similar mysterious problems no-one else had before, and the fix was to just disable the assertions. Are the asserts still your problem?

I think Raspbian does have some permission configurations that might be missing from other distros, but nothing you have said points the problem being in that direction.

@fooishbar
Copy link

@ReubenM Also, are you talking about 'make check' in the Weston tree? If so, this has quite a lot of known issues upstream, and is very, er, picky, especially relating to input. I'd still assume it's a permissions issue from your Gentoo+systemd setup, though it's hard to see without any further detail than 'something fails'.

@ReubenM
Copy link

ReubenM commented Jan 20, 2014

@ppaalanen Where is it that assertions are disabled? I saw no such option available from cmake. (At least no such option was exposed when setting flags/options in interactive mode)

@fooishbar Sorry, yes I was speaking in reference to the 'make check' tests. I can get more details on the test failures in a few days if that would help. I had just assumed the QC tests probably weren't updated to work with the RPi environment yet.

@joshzana
Copy link

@tomeuv - OK I got my wayland building with --enable-egl and that fixed the hello_weston so it displays under weston compositor. I do see an odd artifact in that it appears to draw a single frame and then go blank, and come back if I move the mouse.
It appears that someone needs to improve the weston packaging in buildroot to conditionally include egl and fix resulting pkg config issues that I had to work around. I realize that that's an issue for the buildroot maintainers to fix, but it would be nice to have end to end rpi+buildroot+wayland+egl support without so many hacks.

@ReubenM
Copy link

ReubenM commented Jan 20, 2014

@ppaalanen Ah, I realize that I had not set the build type to release, so the DNDEBUG flag was not being set. I'll see if that fixes it when my RPi boxes get back. (There are on a truck somewhere coming back from a show I used them on)

@ReubenM
Copy link

ReubenM commented Jan 28, 2014

First, my root partition is formated in F2FS and I realized that the mainline raspberry pi kernel 3.10.y is not able to mount F2FS with user_caps functionality enabled. So I bumped my kernel version to the 3.12.y branch to get caps working.

I then rebuilt userland with assertions disabled and updated wayland / weston to latest git (1.4+)

Here's the terminal output now from weston:

[18:33:45.534] OS: Linux, 3.12.7+, #1 PREEMPT Sun Jan 26 20:34:19 CST 2014, armv6l
[18:33:45.535] Starting with no config file.
[18:33:45.535] Loading module '/usr/lib/weston/rpi-backend.so'
[18:33:45.579] initializing Raspberry Pi backend
[18:33:45.583] logind: session not running on a VT
[18:33:45.583] logind: cannot setup systemd-logind helper (-22), using legacy fallback
[18:33:45.584] Failed to initialize tty.
[18:33:45.584] fatal: failed to create compositor

This may have to do with my lack of understanding of the new logind session devices. Can anyone provide any insight into what I might need to check to make sure weston can work in conjunction with logind?

@ppaalanen
Copy link

@ReubenM Are you sure you are running weston from a local login, and not via remote login? Also not from an X terminal, but a bare VT session? I'm not familiar with the logind integration, but I think those are required.

@ReubenM
Copy link

ReubenM commented Jan 29, 2014

X is not installed, and I was attempting to launch it logged into VT1. (So naturally I'm wondering what is behind the "session not running on a VT" message.)

@ReubenM
Copy link

ReubenM commented Feb 1, 2014

I may have found what is causing the problem:

From this email: https://www.mail-archive.com/wayland-devel@lists.freedesktop.org/msg11056.html

"(4) Reading VTNR from systemd is now supported (requires systemd-207,
actually without the unreleased systemd-209 it will segfault due to a bug
in the implementation of sd_session_get_vt())"

I'm using systemd-208. Maybe that is this issue.

@cedricp
Copy link

cedricp commented Feb 6, 2014

Hi, I've applied the patch, that seems to work flawlessly, but I get an error message when using qt5 with wayland-egl backend, the application reports "can't find eglconfig returning null config". Just wondering if it's normal. (Maybe I forgot something)
Thank you

@cedricp
Copy link

cedricp commented Feb 7, 2014

My fault, some lines of the patches were skipped...

@ReubenM
Copy link

ReubenM commented Feb 8, 2014

just FYI, I was able to get weston-1.4 to load with this version of userland after patching weston with the recent commit in weston trunk to fix the input output device init order. (very fragile though)

@ajlennon
Copy link

@tomeuv Hi, I'm trying to build your wayland branch but get this error

interface/vmcs_host/vc_vchi_dispmanx.h:72:66: fatal error: interface/vmcs_host/wayland-dispmanx-server-protocol.h: No such file or directory
| #include "interface/vmcs_host/wayland-dispmanx-server-protocol.h"

I can't see the file in there. Could you perhaps let me know where this is? Thanks!

@tomeuv
Copy link
Author

tomeuv commented Jun 16, 2014

@ajlennon Seems to me that there was some problem generating that file. It should be generated by wayland-scanner and you should have gotten an earlier error about it.

@ajlennon
Copy link

Thanks Tom. I'm trying to create a recipe to build this within Yocto so there may well be. I'll take a look around wayland-scanner then. Thanks again.

@evgenyz
Copy link

evgenyz commented Apr 6, 2015

Is this initiative got abandoned (or I'm missing it's reincarnation somewhere)?

@ReubenM
Copy link

ReubenM commented Apr 6, 2015

There are proper kernel and mesa drivers being developed that will render
this hack obsolete.

http://dri.freedesktop.org/wiki/VC4/
On Apr 6, 2015 3:16 AM, "EK" notifications@github.com wrote:

Is this initiative got abandoned (or I'm missing it's reincarnation
somewhere)?


Reply to this email directly or view it on GitHub
#110 (comment).

@fooishbar
Copy link

Right. The decision was to not work further on the old drivers, and wait for the new drivers (Mesa + KMS) to be developed. This is underway, as it has been for some time, and when they are complete, we should have native Wayland support. There is no currently-published ETA for this happening however.

naguirre added a commit to naguirre/meta-raspberrypi that referenced this pull request Aug 5, 2015
…: raspberrypi/userland#110

Patches have been rewrite to let the code building with the latest version of userland.
naguirre added a commit to naguirre/meta-raspberrypi that referenced this pull request Sep 25, 2015
…: raspberrypi/userland#110

Patches have been rewrite to let the code building with the latest version of userland.
naguirre added a commit to naguirre/meta-raspberrypi that referenced this pull request Sep 25, 2015
This commit add the Pull request agherzan#110 to userland recipe
raspberrypi/userland#110
Patches habe been rewrited to let the code build with the latest revision of userland.
naguirre added a commit to naguirre/meta-raspberrypi that referenced this pull request Sep 25, 2015
This commit add the Pull request agherzan#110 to userland recipe
raspberrypi/userland#110
Patches have been rewrited to let the code build with the latest revision of userland.
@agherzan
Copy link

agherzan commented Oct 3, 2015

Hi @tomeuv there is a problem I encounter after I apply tomeuv@c22c00f .

The

add_library(EGL ${SHARED} ${EGL_SOURCE})

in git/interface/khronos/CMakeLists.txt gets to run before the header is
generated. No dependency configured for that. And in the sources of EGL there
is egl_wayland.c which includes the generated header by the call:

wayland_add_protocol_server(
       EGL_SOURCE
       ../../interface/wayland/dispmanx.xml
       dispmanx
)

This leads me to the same error @ajlennon had pointed above.

Any hints on how to fix this?

@agherzan
Copy link

Ping?

@rzr
Copy link

rzr commented Jan 16, 2016

This PR needs to be refreshed isnt it ?

For the record I noticed couple of work in process :

agherzan/meta-raspberrypi#1

agherzan/meta-raspberrypi@2a84a6a

Seems this be backported to dizzy , is there someone maintaining a such branch ?

rzr pushed a commit to TizenTeam/meta-raspberrypi that referenced this pull request Jan 16, 2016
This commit add the Pull request #110 to userland recipe
raspberrypi/userland#110
Patches have been rewrited to let the code build with the latest revision of userland.

Change-Id: I82e85ff7a4c6fb1c6c80986f74042fbd1d562809
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
@fooishbar
Copy link

@rzr We have no plans to update this branch. The open-source Mesa 'vc4' driver for Raspberry Pi is a much better option to use, though you do need quite a new kernel. The driver this patches still has a number of issues when running under Wayland, which are not easily fixable.

@ppaalanen
Copy link

If you use Weston's rpi-backend, please see this and spread the word:
https://lists.freedesktop.org/archives/wayland-devel/2016-May/028764.html

@rzr
Copy link

rzr commented May 11, 2016

Yea DRM support will be far better

@fooishbar
Copy link

@rzr Right, and that is very much our long-term plan. However, while KMS support is not enabled by default, we want to get an idea of how many people this would affect.

@Ruffio
Copy link

Ruffio commented Dec 6, 2016

@tomeuv is this PR still relevant? If it is, the conflicts should be resolved...

@fooishbar
Copy link

@Ruffio No, the vc4 Mesa/KMS drivers resolve this for us.

@Ruffio
Copy link

Ruffio commented Dec 6, 2016

Then please close the PR

@Ruffio
Copy link

Ruffio commented Dec 30, 2016

@fooishbar as this has been resolved, please close/reject this PR...

@fooishbar
Copy link

@Ruffio I don't have permission to do so.

@Ruffio
Copy link

Ruffio commented Dec 30, 2016

@popcornmix can you close/reject this PR?

@JamesH65
Copy link
Collaborator

Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant.

@JamesH65 JamesH65 closed this Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.