Re: Compile kwin using yocto for embedded systems (opengles)

2018-03-13 Thread Jörn M
Thanks for your reply Martin.

I see the following possibilities to address this error:
>  * forward declare Display (struct Display should be sufficent)
>  * disable building of the EglOnXBackend
> Given that epoxy seems to not have X11 support I would say the second
> option is the proper one. But it would mean no compositing support on X11
> in this build. This makes only sense if you want to use Wayland. If you
> want to use KWin on X11 you need to get epoxy to support X11.


I followed your second suggestion and disabled EglOnXBackend backend since
I don't want to use X11.
Following patch works and I could compile kwin.

https://paste.kde.org/p2rvhzgmc

Nevertheless, in this state I was not able to start kwin at all. Kwin told
me that no backend is available.
Below the full story how I got kwin working, maybe it's useful for someone
else out there.


For fast comparison I enabled weston in my yocto configuration.
Weston only found fbdev as  backend. No egl accelerated backend was
available.

It seems that there are currently two ways to get hardware accelerated
rendering with a wayland compositor on raspberry pi:

1. raspberrypi specific userand driver (proprietary)
  - qtbase with raspberrypi specific eglfs backend
 - qtwayland with raspberrypi specific eglfs backend
2. raspberrypi specific drm driver (open source vc4)
  - qtbase with drm, kms and eglfsdevice
 - weston using drm with egl
 - kwin using drm with egl

At this point I was on the first track. But there is no backend available
for kwin and also not for weston.
Raspberry pi specific backend was dropped from weston because of
maintenance:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/commit/?h=rocko=a1cfeb3324c458a73507e34ffcf28c25591b8052

I changed my yocto configuration to the second approach:

remove:
#IMAGE_INSTALL_append = " userland"
add:
MACHINE_FEATURES_append = " vc4graphics"

qtbase configuration also needs adjustment (enable kms and gbm)
https://paste.kde.org/povjpohkv

Weston runs nicely at this point with following commands:

export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
weston --backend=drm-backend.so --tty=4

Nevertheless weston is complaining about logind issue:

[15:38:26.505] logind: failed to get session seat
[15:38:26.505] logind: cannot setup systemd-logind helper (-61), using
legacy fallback

Trying kwin:

export $(dbus-launch)
kwin_wayland --drm

Kwin runs without any output message. It seems to hang. After a bit of
debugging with GDB it turns out that kwin waits for a logind session.
This could also be made visible by:

export QT_LOGGING_RULES="kwin_core.debug=true;kwin_wayland_drm.debug=true"

To shorten this up here, it was not enough to enable logind and pam support
in systemd.
It is needed to enable pam support in yocto distro features. Otherwise
login does not create a logind session with pam.

DISTRO_FEATURES_append = " systemd wayland x11 wifi pam"

Now running kwin_wayland --drm results in following output executed from
ssh:

kwin_core: Platform does not support input, enforcing libinput support
kwin_core: KGlobalAcceld inited
kwin_core: Session path: "/org/freedesktop/login1/session/c1"
kwin_core: "logind"  seat: "" / "/"
kwin_core: "logind"  seat: "" / "/"
kwin_core: Gained session control
kwin_core: Could not take device /dev/input/event0 , cause:  "Operation not
permitted"
kwin_core: Could not take device /dev/dri/card0 , cause:  "Operation not
permitted"

Running the same on the terminal from raspberry pi (hdmi terminal) results
in a working kwin :-D

Any ideas how to start kwin properly from ssh?

Regards,
Jörn


2018-03-01 21:29 GMT+01:00 Martin Flöser :

> Am 2018-03-01 20:56, schrieb Jörn M:
>
>> I simply did the same as above for kdeclarative and applied the few
>> lines from kwin's kwinglutils_funcs.h
>> on all places where the error occurs:
>>
>> https://paste.kde.org/pgtkzf5yu
>>
>
> see also https://phabricator.kde.org/D10762
>
>
>> This leads me to the final error I'm not able to solve:
>>
>> eglonxbackend.h:36:27: error: expected ')' before '*' token
>> |  EglOnXBackend(Display *display);
>> |^
>> |
>> /home/joern/yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-
>> gnueabi/kwin/5.12.1-r0/git/plugins/platforms/x11/common/
>> eglonxbackend.h:37:58:
>> error: 'Display' has not been declared
>>
>> https://paste.kde.org/pimqgxedi
>>
>> Which component normally declares "Display"?
>>
>
> Display is the XLib Display. It comes in with anything pulling in XLib. So
> most likely the reason for the compile error is that this gets pulled in
> through epoxy normally, but on yocto epoxy is probably built without X11
> support (which might be questionably, but so what).
>
> I see the following possibilities to address this error:
>  * forward declare Display (struct Display should be sufficent)
>  * disable building of the EglOnXBackend
>
> 

Re: Compile kwin using yocto for embedded systems (opengles)

2018-03-01 Thread Martin Flöser

Am 2018-03-01 20:56, schrieb Jörn M:

I simply did the same as above for kdeclarative and applied the few
lines from kwin's kwinglutils_funcs.h
on all places where the error occurs:

https://paste.kde.org/pgtkzf5yu


see also https://phabricator.kde.org/D10762



This leads me to the final error I'm not able to solve:

eglonxbackend.h:36:27: error: expected ')' before '*' token
|  EglOnXBackend(Display *display);
|^
|
/home/joern/yocto/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/kwin/5.12.1-r0/git/plugins/platforms/x11/common/eglonxbackend.h:37:58:
error: 'Display' has not been declared

https://paste.kde.org/pimqgxedi

Which component normally declares "Display"?


Display is the XLib Display. It comes in with anything pulling in XLib. 
So most likely the reason for the compile error is that this gets pulled 
in through epoxy normally, but on yocto epoxy is probably built without 
X11 support (which might be questionably, but so what).


I see the following possibilities to address this error:
 * forward declare Display (struct Display should be sufficent)
 * disable building of the EglOnXBackend

Given that epoxy seems to not have X11 support I would say the second 
option is the proper one. But it would mean no compositing support on 
X11 in this build. This makes only sense if you want to use Wayland. If 
you want to use KWin on X11 you need to get epoxy to support X11.


Cheers
Martin