Bug 284888 - Lacking XSYNC support for Unmanaged windows
Summary: Lacking XSYNC support for Unmanaged windows
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: decorations (show other bugs)
Version: 4.7.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-24 16:59 UTC by micu
Modified: 2015-01-05 14:19 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screen shot showing that behavior (47.45 KB, image/png)
2011-10-24 17:00 UTC, micu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description micu 2011-10-24 16:59:51 UTC
Version:           4.7.2 (using KDE 4.7.2) 
OS:                Linux

When accessing a dialog, e.g. in a application window, sometimes I can see how it paints the decoration (like shadows) first and then the content afterwards. See attached screenshot.

Reproducible: Always

Steps to Reproduce:
Just klick on a menu item.

Actual Results:  
Dialog decorations are painted before the content, which looks ugly — especially if the system is under load. (See screenshot)

Expected Results:  
Dialog decorations and content should be painted atomically.

In case you you wonder: I switched from Debian sid / aptosid / sidux to Fedora 16 beta, where I also got my KDE packages from.
Comment 1 micu 2011-10-24 17:00:30 UTC
Created attachment 64840 [details]
screen shot showing that behavior
Comment 2 Thomas Lübking 2011-10-24 18:28:45 UTC
There's no popup dialog but a popup menu in that screenshot, assuming you were referring to those in general (ie. it's a shadow - menucontent issue)

a) how long (appr.) is the lag time?
b) try "kwrite --graphicssystem raster" as well as "kwrite --graphicssystem native" - does it happen with either?
c) does it happen with both compositor backends (OpenGL/XRender, see "kcmshell4 kwincompositing", 3rd tab) - try both (b) cases with either backend and report, thanks.
Comment 3 micu 2011-10-24 21:47:39 UTC
Hi Christoph,

Thanks for your fast reply.

(In reply to comment #2)
> There's no popup dialog but a popup menu in that screenshot, assuming you were
> referring to those in general (ie. it's a shadow - menucontent issue)

Your assumption is correct → this shadow - menucontent issue is what mean.


> a) how long (appr.) is the lag time?

Hard to say in general. If there is a lot of I/O load going on — like now (migrating KMails :P), it can take even seconds. In many cases it is hardly perceivable, in some cases it looks like flickering. This effect gets stronger when enabling the blur effect (which I disabled for that reason).

> b) try "kwrite --graphicssystem raster" as well as "kwrite --graphicssystem
> native" - does it happen with either?

I am running raster by default, but it happens with native rendering, as well. 


> c) does it happen with both compositor backends (OpenGL/XRender, see "kcmshell4
> kwincompositing", 3rd tab) - try both (b) cases with either backend and report,
> thanks.

By default, I am using OpenGL, but it also happens with XRender.
Comment 4 Christoph Feck 2011-10-25 10:27:46 UTC
In the case of menus, often Qt needs to load the menu icons before showing them, so the initial sync() will be delayed. KWin should wait for the sync() before starting compositing it.
Comment 5 Thomas Lübking 2011-10-25 10:43:38 UTC
At least that should be fixed in 4.8 - https://git.reviewboard.kde.org/r/102311/
Comment 6 Christoph Feck 2011-10-25 11:32:24 UTC
Well, in case of menus, I see a black area appearing shortly before the content. I blame the intel drivers for this bug, though.
Comment 7 Thomas Lübking 2011-10-25 17:46:07 UTC
(In reply to comment #6)
> Well, in case of menus, I see a black area appearing shortly before the
> content.
With Skulpture?? Do you use ARGB popups?

> I blame the intel drivers for this bug, though.
In case it's an ARGB popup, the intel driver is responsible for the "black" of what should be "transparent", but in general it the very same issue.

This would mean that
a) the sync timer times out (we don't wait ages for the window to get itself ready _after_ the maprequest) or
b) QMenu doesn't support netwm_sync at all
Comment 8 Christoph Feck 2011-10-25 21:43:01 UTC
Skulpture (still) does not use any ARGB stuff, it simply paints on the given painters. Looking at b), I wonder what an application has to do to "support" netwm_sync. I mean, I always thought that calling XFlush() or XSync() (or whatever Qt uses at the begin/end of the event loop) is enough to signal that it is finished drawing.
Comment 9 Christoph Feck 2011-10-25 21:57:24 UTC
Looking at the NETWM specs, it looks like it is only used to synchronize rendering between two X Windows (the decoration, and the client).

In case of the popup menu, there is only a single X Window (and before you ask: Skulpture does not yet support popup shadows ;)

I do not see the issue with Oxygen, but it is visible with e.g. Plastique, too.
Comment 10 Thomas Lübking 2011-10-25 22:05:45 UTC
No, XSync(false) is NOT the same as the XSync extension (don't ask me who picked the name)
The XSync extension is defined in extensions/sync[proto|const|str].h and describes some sort of inter-client mutex system.

The NETWM usage is "specified" here:
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2552503

It's used to sync client and decoration, but kwin (just as assumingly compiz) also sends (and now honors) an initial syncRequest, but errrrmmm... as i just realize: to MANAGED clients, what popups are not :S

We'd have to check whether we can do this with unmanged clients as well.
Comment 11 micu 2011-11-11 16:34:10 UTC
(In reply to comment #6)
> I blame the intel drivers for this bug, though.

BTW: I am using intel.
Comment 12 micu 2011-11-24 10:43:55 UTC
(In reply to comment #11)
> (In reply to comment #6)
> > I blame the intel drivers for this bug, though.
> 
> BTW: I am using intel.


> micu@denkbrett:~$ kwin
> QDBusConnection: session D-Bus connection created before
> QCoreApplication. Application may misbehave. OpenGL vendor string: 
>                  Tungsten Graphics, Inc OpenGL renderer string:    
>             Mesa DRI Intel(R) 965GM OpenGL version string:         
>         2.1 Mesa 7.11
> OpenGL shading language version string: 1.20
> Driver:                                 Intel
> GPU class:                              i965
> OpenGL version:                         2.1
> GLSL version:                           1.20
> Mesa version:                           7.11
> Linux kernel version:                   3.1.1
> Direct rendering:                       yes
> Requires strict binding:                yes
> GLSL shaders:                           yes
> Texture NPOT support:                   yes
Comment 13 Martin Flöser 2013-01-18 20:09:38 UTC
is this still an issue with a later version of KDE SC (e.g. 4.9 or 4.10)?
Comment 14 micu 2013-01-19 14:13:06 UTC
(In reply to comment #13)
> is this still an issue with a later version of KDE SC (e.g. 4.9 or 4.10)?

Yes, unfortunately, I am still experiencing this behaviour with KDE 4.9.5
Comment 15 Thomas Lübking 2013-07-01 19:28:07 UTC
Git commit b9b4b918c2f241d81a95f87a37414ccc62b233b8 by Thomas Lübking.
Committed on 28/06/2013 at 12:23.
Pushed by luebking into branch 'master'.

delay adding Unmanaged clients by 50ms

This provides some sort of synthetic XSYNC support
for unmanaged clients and allows them to do an initial
update after mapping and before being painted (prevent
flicker)
Also it helps with Unmanaged clients performing quick
map/unmap/map cycles what also seems to induce the black
window issue on the nvidia blob.
Related: bug 319184
FIXED-IN: 4.11
REVIEW: 111292

M  +11   -3    kwin/effects.cpp
M  +1    -0    kwin/effects.h
M  +1    -1    kwin/toplevel.h
M  +3    -0    kwin/unmanaged.cpp

http://commits.kde.org/kde-workspace/b9b4b918c2f241d81a95f87a37414ccc62b233b8
Comment 16 Martin Flöser 2014-01-08 13:22:55 UTC
did you have the chance to re-test with 4.11? Did the patch from comment #15 improve the situation?
Comment 17 Martin Flöser 2015-01-05 14:19:45 UTC
Assuming fixed given that there was no complain after a year.