Bug 313599 - kwin_gles freezes with gallium egl driver
Summary: kwin_gles freezes with gallium egl driver
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 4.10.0
Platform: Ubuntu Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-21 01:22 UTC by Eugene
Modified: 2013-03-24 17:35 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
kwin_gles backtrace (30.83 KB, text/plain)
2013-01-21 01:23 UTC, Eugene
Details
KWin switcher window (111.62 KB, image/png)
2013-01-21 13:55 UTC, Eugene
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene 2013-01-21 01:22:25 UTC
Using kwin_gles instead of kwin causes freeze after entering KDE.

Reproducible: Always




I'm using git-drivers from oibaf ppa and in backtrace it seems nothing special that needs to be writed to freedesktop.org
Comment 1 Eugene 2013-01-21 01:23:56 UTC
Created attachment 76590 [details]
kwin_gles backtrace
Comment 2 Thomas Lübking 2013-01-21 04:14:38 UTC
the backtrace is caused by a sigint, ie. you halted the process.
is it really stuck (not "no visual upsates") at that position or is this just a random stack?

what happens is you suspend the compositor, ie. press "shift+alft+f12"?
also please provide the output of "qdbus org.kde.KWin /KWin supportInformation" (ideally while using gles, obtain it from vt1 and don't forget to export DISPLAY=:0 ;-)

also please check what happens if you do not use some development drivers from some ppa, but sth. more official (stock ubuntu)
Comment 3 Eugene 2013-01-21 12:27:47 UTC
>is it really stuck (not "no visual upsates") at that position or is this just a random stack?
Yes, it was really stuck.

>what happens is you suspend the compositor, ie. press "shift+alft+f12"?
Nothing happens.

>also please provide the output of "qdbus org.kde.KWin /KWin supportInformation" (ideally while using gles, obtain it from vt1 and don't forget to export DISPLAY=:0 ;-)
sorry, but on my:

DISPLAY=:0 qdbus org.kde.KWin /KWin supportInformation > info.txt
or
DISPLAY=:0 qdbus org.kde.KWin_gles /KWin_gles supportInformation > info.txt

I'm getting the same:

service 'org.kde.Kwin' does not exist
or
service 'org.kde.Kwin_gles' does not exist

>also please check what happens if you do not use some development drivers from some ppa, but sth. more official (stock ubuntu)
With Ubuntu repository drivers there is a problem with artifacts using kwin_gles. Thats why I'm using development drivers that till yesterday worked good.
Comment 4 Martin Flöser 2013-01-21 12:42:26 UTC
(In reply to comment #3)
> >also please check what happens if you do not use some development drivers from some ppa, but sth. more official (stock ubuntu)
> With Ubuntu repository drivers there is a problem with artifacts using
> kwin_gles. Thats why I'm using development drivers that till yesterday
> worked good.
in that case you are reporting at the wrong end. Please report to driver devs.
Comment 5 Thomas Lübking 2013-01-21 12:52:59 UTC
What struck me about the stacktrace is that for some reason (induced by the oxygen deco attempting to get a property, but that's unlikely relevant) it attempts to query the GLX extension (and apparently the server does not reply) what sounds like either a bug somewhere in X11 or you managed to run some mix-up of GLX and EGL code.
I doubt it's intended to query GLX from EGL.

Any 3rd party effect plugins in use?
Otherwise the most recent driver/X11 update is broken either in lib or during installation (buggy symlink resolution)

(dbus won't reply if the process is really locked)
Comment 6 Eugene 2013-01-21 13:14:39 UTC
>Any 3rd party effect plugins in use?
I'm using kwin-gles-auto (it switches between kwin and kwin_gles in System Settings > Effects settings > Advanced > Compositor type) from Blue Leaf Linux ppa (ppa:blueleaflinux/ppa).
Comment 7 Thomas Lübking 2013-01-21 13:21:52 UTC
Please try to explicitly invoke kwin_gles eg. by exporting it as KDEWM before "startkde" (xdm user environment) or running it directly.
Comment 8 Martin Flöser 2013-01-21 13:35:24 UTC
(In reply to comment #6)
> >Any 3rd party effect plugins in use?
> I'm using kwin-gles-auto (it switches between kwin and kwin_gles in System
> Settings > Effects settings > Advanced > Compositor type) from Blue Leaf
> Linux ppa (ppa:blueleaflinux/ppa).
wtf is that? I don't mind some third party ideas, but at least asking whether something makes sense would not be a bad idea and if it is a good idea it should be integrated directly in KWin *sigh*
Comment 9 Thomas Lübking 2013-01-21 13:44:43 UTC
Looks like it's merely a desktop file that installs a desktop service to apps/ksmserver/windowmanagers (ie. makes kwin_gles an option in the list)
Comment 10 Eugene 2013-01-21 13:54:57 UTC
(In reply to comment #9)
> Looks like it's merely a desktop file that installs a desktop service to
> apps/ksmserver/windowmanagers (ie. makes kwin_gles an option in the list)

You can see it on attached screenshot.
(sources: https://launchpad.net/~blueleaflinux/+archive/ppa/+sourcepub/2767584/+listing-archive-extra)
Comment 11 Eugene 2013-01-21 13:55:41 UTC
Created attachment 76602 [details]
KWin switcher window
Comment 12 Martin Flöser 2013-01-21 14:20:54 UTC
oh well that's relatively reasonable to add it there. At least if done correctly it sets the KDEWM variable.
Comment 13 Eugene 2013-01-21 14:22:01 UTC
>it switches between kwin and kwin_gles in System Settings > Effects settings > Advanced > Compositor type
And I'm sorry, this was mistake with translating. Correct switcher place is here:
System Settings > Default Application > Window Manager
Comment 14 Thomas Lübking 2013-01-21 15:36:46 UTC
Ok, to sum up:
you're using stock kwin_gles but on a development version of mesa / xf86-intel(-dri) and it broke after a recent update of the driver and/or mesa.

Correct?
Comment 15 Eugene 2013-01-21 17:34:16 UTC
(In reply to comment #14)
> Ok, to sum up:
> you're using stock kwin_gles but on a development version of mesa /
> xf86-intel(-dri) and it broke after a recent update of the driver and/or
> mesa.
>
> Correct?
Exactly.
Comment 16 Fredrik Höglund 2013-02-27 19:42:31 UTC
When an application is stuck in _XReply() it's usually indicative of a threading bug.

That it started happening after a Mesa upgrade doesn't necessarily mean that it's a bug in Mesa, since an unrelated change can easily affect the outcome of a race condition.

I'm guessing from the backtrace that you're using the gallium EGL driver. If that's the case, is the bug still reproducible if you switch to the DRI2 driver? You do that by setting EGL_DRIVER=egl_dri2 before you start kwin_gles.
Comment 17 Eugene 2013-03-02 20:20:45 UTC
(In reply to comment #16)
> When an application is stuck in _XReply() it's usually indicative of a
> threading bug.
> 
> That it started happening after a Mesa upgrade doesn't necessarily mean that
> it's a bug in Mesa, since an unrelated change can easily affect the outcome
> of a race condition.
> 
> I'm guessing from the backtrace that you're using the gallium EGL driver. If
> that's the case, is the bug still reproducible if you switch to the DRI2
> driver? You do that by setting EGL_DRIVER=egl_dri2 before you start
> kwin_gles.

Do you mean I need to run "DISPLAY=:0 EGL_DRIVER=egl_dri2 kwin_gles --replace" command ?
Comment 18 Thomas Lübking 2013-03-02 20:48:40 UTC
Yes, though you can spare setting DISPLAY from within KDE.
Comment 19 Eugene 2013-03-02 21:46:00 UTC
(In reply to comment #18)
> Yes, though you can spare setting DISPLAY from within KDE.

Ok. When I try it in VT1, kwin_gles loads but, for some reason, composition doesn't working:

QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
X Error: BadWindow (invalid Window parameter) 3
Major opcode: 20 (X_GetProperty)
Resource id: 0x1e00017
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
libEGL warning: DRI2: failed to authenticate
kwin(5031) KWin::OpenGLBackend::SetFailed: Creating the OpenGL rendering failed: "Required support for binding pixmaps to EGLImages not found, disabling compositing"
kwin(5031) Failed to initialize compositing, compositing disabled
kwin(5031) Consult http://techbase.kde.org/Projects/KWin/4.0-release-notes#Setting_up
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread

But, when I tried it through Konsole in KDE, kwin_gles loaded successfully with compositing without any freezes:

QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
OpenGL vendor string:                   X.Org
OpenGL renderer string:                 Gallium 0.4 on AMD RV630
OpenGL version string:                  OpenGL ES 3.0 Mesa 9.2-devel (git-58bd926 quantal-oibaf-ppa)
OpenGL shading language version string: OpenGL ES GLSL ES 3.0
Driver:                                 R600G
GPU class:                              R600
OpenGL version:                         3.0
GLSL version:                           3.0
Mesa version:                           9.2
X server version:                       1.13
Linux kernel version:                   3.8
Direct rendering:                       yes
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
Comment 20 Thomas Lübking 2013-03-02 22:06:36 UTC
fails because of
> libEGL warning: DRI2: failed to authenticate

> But, when I tried it through Konsole in KDE, kwin_gles loaded successfully with compositing without any freezes:
> ...
> OpenGL renderer string:                 Gallium 0.4 on AMD RV630

                                                        ^^^^^^^^^^

Sure you set EGL_DRIVER=egl_dri2 for this run?
is egl_dri2.so present at all? (like in /usr/lib/egl)?
Comment 21 Eugene 2013-03-03 02:04:47 UTC
> Sure you set EGL_DRIVER=egl_dri2 for this run?
I ran: EGL_DRIVER=egl_dri2 kwin_gles --replace

> is egl_dri2.so present at all? (like in /usr/lib/egl)?
No, at least I wasn't able to find it on any directory in /.
Comment 22 Eugene 2013-03-03 02:15:51 UTC
There is /usr/lib/x86_64-linux-gnu/egl/egl_gallium.so file exist. Don't know, may be this info will be useful for you.
Comment 23 Thomas Lübking 2013-03-03 06:20:59 UTC
driver could still be built-in, but pot. the chip is not supported by egl_dri2

"libEGL warning: DRI2: failed to authenticate" sounds suspicious enough (yet was apparently not issued on the second attempt)

-> Please run with the stock drivers and check whether dri2 is used there.
Comment 24 Eugene 2013-03-03 19:07:14 UTC
> "libEGL warning: DRI2: failed to authenticate" sounds suspicious enough (yet
> was apparently not issued on the second attempt)

This happens only if I run the command in VT. in KDE, thorough Konsole it runs good.
 
> -> Please run with the stock drivers and check whether dri2 is used there.

EGL_DRIVER=egl_dri2 kwin_gles --replace
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
OpenGL vendor string:                   X.Org
OpenGL renderer string:                 Gallium 0.4 on AMD RV630
OpenGL version string:                  OpenGL ES 2.0 Mesa 9.0.2
OpenGL shading language version string: OpenGL ES GLSL ES 1.0.16
Driver:                                 R600G
GPU class:                              R600
OpenGL version:                         2.0
GLSL version:                           1.0.16
Mesa version:                           9.0.2
X server version:                       1.13
Linux kernel version:                   3.8
Direct rendering:                       yes
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread
Comment 25 Fredrik Höglund 2013-03-06 11:49:48 UTC
@Thomas: The EGL driver is the platform layer between the API dispatcher and the device driver, so it doesn't show up in the GL_RENDERER string. The EGL driver can only be determined by inspecting EGL_VERSION, but kwin doesn't include that in its debug output.

At any rate, the DRI2 driver doesn't install the WireToEvent handlers used by GLX and the gallium driver, so it never enters the code path in the backtrace.

I think it's fair to say that the gallium driver is unmaintained nowadays, so you should probably be using the DRI2 driver anyway. It should also have better performance since it supports page flipping.
Comment 26 Eugene 2013-03-06 18:31:38 UTC
(In reply to comment #25)
> I think it's fair to say that the gallium driver is unmaintained nowadays,
> so you should probably be using the DRI2 driver anyway. It should also have
> better performance since it supports page flipping.

Then why DRI2 driver isn't still default ?
Comment 27 Fredrik Höglund 2013-03-06 21:43:49 UTC
(In reply to comment #26)
> Then why DRI2 driver isn't still default ?

The gallium driver isn't built by default. You have to pass --enable-gallium-egl to configure when building mesa to get it.
Comment 28 Eugene 2013-03-24 14:37:03 UTC
So what should I do next? I want kwin_gles to work correctly on my system.
Comment 29 Thomas Lübking 2013-03-24 17:35:50 UTC
(In reply to comment #28)
> So what should I do next? I want kwin_gles to work correctly on my system.

(In reply to comment #19)
> > But, when I tried it through Konsole in KDE, kwin_gles loaded successfully with compositing without any freezes:

-> get rid of the gallium driver or just "export EGL_DRIVER=egl_dri2" globally in ~/.kde/env (ie. add a script that does so) or -since you use a manipulated KDEWM variable anyway, just manipulate it to "EGL_DRIVER=egl_dri2 kwin_gles"

I read correctly that by enforcing the dri2 driver everything works as expected?

Given Fredrik's comment about the gallium driver being unmaintained (comment #25) this is a downstream issue (misconfiguration, ppa bug)