Bug 323688 - Slide effect flicker after vertical desktop change on dual monitor setup
Summary: Slide effect flicker after vertical desktop change on dual monitor setup
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Unclassified
Component: scene-opengl (show other bugs)
Version: 4.11.0
Platform: openSUSE RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL: https://git.reviewboard.kde.org/r/112...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-18 20:24 UTC by Angelos Skembris
Modified: 2013-09-09 07:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.2
thomas.luebking: ReviewRequest+


Attachments
Output of "qdbus org.kde.kwin /KWin supportInformation" (5.26 KB, text/plain)
2013-08-19 10:36 UTC, Angelos Skembris
Details
Kwin crash backtrace after selecting OpenGL3.1 (6.21 KB, text/plain)
2013-08-19 22:20 UTC, Angelos Skembris
Details
Xorg.log file (52.16 KB, application/octet-stream)
2013-08-19 23:32 UTC, Angelos Skembris
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Angelos Skembris 2013-08-18 20:24:34 UTC
Hi all, 

After the upgrade to 4.11, I tried switching to OpenGL 3.1 to see if there is any difference (not much and some instability). After the usual crashes / fails to detect OpenGL capabilities properly, I managed to switch back to OpenGL 2.0 as the rendering method. Now the slide effect for desktop switching causes a momentary flicker at the end of the slide, i.e. the slide completes and the screen flickers (goes black) for a moment. The flicker is less than a 0.1 seconds long but it is quite noticable. I did not have it before the switch from OpenGL 2 -> 3.1 -> 2.

Also, I have noticed the following: the problem is more pronounced when  the desktop selection moves in a vertical manner (i.e. from desktop 1 or 2 to desktops 3 or 4 and the opposite) but not when switching sideways (from 3 to 4 or vice-versa). 



Reproducible: Always

Steps to Reproduce:
1.Change desktop effects compositing type to OpenGL 3.1
2.Use the system a bit
3.Revert compositing to OpenGL 2.0
4. Activate the slide effect
Actual Results:  
Screen flickers momentarily when switching from desktops (1 or 2) to (3 or 4) and vice versa.

Expected Results:  
No flicker should appear

The graphics card is a Radeon 4870 with the open source drivers on OpenSUSE 12.3. I also have 2 monitors, one of which (DVI-0) is rotated by 90 degrees.
Comment 1 Thomas Lübking 2013-08-18 20:55:42 UTC
- Please attach the output of "qdbus org.kde.kwin /KWin supportInformation"
- Does the issue survive the next login / reboot?
- Does it also happen when changing
   * GL2 -> GL1.1 -> GL2
   * GL2 -> XRender -> GL2
- ... or just restaring the compositor (Shift+Alt+F12 twice)
Comment 2 Angelos Skembris 2013-08-19 10:36:24 UTC
Created attachment 81778 [details]
Output of "qdbus org.kde.kwin /KWin supportInformation"
Comment 3 Angelos Skembris 2013-08-19 10:42:28 UTC
Thank you for the prompt response. 

I have uploaded the output of the requested command. As to the rest of the questions:

1) The issue has survived multiple logout / logins and reboots.
2) The issue is there when selecting any compositing method (GL1.2, GL2, Xrender) except GL3. Selecting GL3 causes Kwin to crash and desktop effects to be disabled. If that happens, then I need to reselect GL2 as the compositing method, deactivate desktop effects using Shift+Alt+F12, enable OpenGL detection from the settings panel and then reactivate desktop effects (using the keyboard shortcut). If I simply select GL2 AFTER the crashes with GL3.1 occur then Kwin will crash when activating desktop effects again with GL2. No such issue when switching from GL1.2 to GL2 or vice versa.
3) The issue is still present when simply restarting the compositor using the keyboard shortcut twice.
Comment 4 Thomas Lübking 2013-08-19 12:08:08 UTC
(In reply to comment #3)

> 1) The issue has survived multiple logout / logins and reboots.
Just to leave absolutely no misunderstanding about this:
Once you encountered the issue, not even rebooting resolved it (ie. it was there despite you didn't try to reselect GL3 again)?

> 2) The issue is there when selecting [...] Xrender
Do you use "one activity per virtual desktop"?
(Plasma setting to eg. have different wallpapers on different VDs)

Otherwise I'd rather suspect another effect to kick in here.
Please  deactivate all other effect plugins (translucency, fade, desktop grid, ...) and see whether the flicker still happens.

> Selecting GL3 causes Kwin to crash and desktop effects [...]
> If I simply select GL2 AFTER the crashes with GL3.1 occur then Kwin will crash when activating desktop effects again with GL2.

Please attach the respective backtraces, eventually error messages in Xorg.0.log or dmesg after this.
Comment 5 Angelos Skembris 2013-08-19 22:20:11 UTC
Created attachment 81793 [details]
Kwin crash backtrace after selecting OpenGL3.1
Comment 6 Angelos Skembris 2013-08-19 22:34:39 UTC
(In reply to comment #4)
> > 1) The issue has survived multiple logout / logins and reboots.
> Just to leave absolutely no misunderstanding about this:
> Once you encountered the issue, not even rebooting resolved it (ie. it was
> there despite you didn't try to reselect GL3 again)?
Yes, the issue has survived all combinations of rebooting / changing compositing methods I can think of.


> > 2) The issue is there when selecting [...] Xrender
> Do you use "one activity per virtual desktop"?
> (Plasma setting to eg. have different wallpapers on different VDs)

Nope, only one activity used.

> 
> Otherwise I'd rather suspect another effect to kick in here.
> Please  deactivate all other effect plugins (translucency, fade, desktop
> grid, ...) and see whether the flicker still happens.
> 

Tried disabling everything but slide effect, problem persists.


> > Selecting GL3 causes Kwin to crash and desktop effects [...]
> > If I simply select GL2 AFTER the crashes with GL3.1 occur then Kwin will crash when activating desktop effects again with GL2.
> 
> Please attach the respective backtraces, eventually error messages in
> Xorg.0.log or dmesg after this.

Xorg.0.log and dmesg show no error messages after the crash but I can attach them if you think they'd be helpful. The backtrace of the crash after selecting OpenGL3.1 has been attached. Regarding the few missing symbols, I have installed the relevant debug packages for Mesa-libGL1 and libX11-6 (which contain libGL.so.1 and libX11.so.6 respectively) but I could not get any better results than those attached. 

Also, I should note that all desktop effects currently seem to stutter, whereas they were very smooth before this whole affair began.
Comment 7 Thomas Lübking 2013-08-19 23:26:45 UTC
(In reply to comment #6)

> Yes, the issue has survived all combinations of rebooting / changing
> compositing methods I can think of.

In case this was really induced by some GL3 call (and not some Mesa update or so), this would point the firmware :-\

However:
Does it also happen if you disable the "tearing prevention" (set it to none) or on a single screen setup?

If yes, my last idea was to install and load fglrx (you'll need the legacy driver, i assume?) and see whether this has any impact.
 
> Xorg.0.log and dmesg show no error messages after the crash but I can attach
> them if you think they'd be helpful.
Warnings (WW) or general mentions about flipping in Xorg.0.log?
Feel free to attach it for inspection.

The backtrace remotely hints the lack of a XInitThreads() call - i assume you don't compile kwin, do you?
Comment 8 Angelos Skembris 2013-08-19 23:32:51 UTC
Created attachment 81794 [details]
Xorg.log file
Comment 9 Angelos Skembris 2013-08-20 00:27:42 UTC
You are on to something with the second display suggestion. Disconnecting the second display makes the problem go away! Therefore, before proceeding with installing fglrx, I tried a few things.

First, desktop effects are really smooth if I choose "Raster" as the Qt graphics system, so that's solved. 

I guess it is a Xinerama related issue, so I figure at this point a bit more info on the displays is warranted. My main screen is a Samsung 2223Nw, not rotated, max resolution 1680x1050. The other one is a LG Flatron L1932P, max resolution 1280x1024. The second one is rotated by 90 degrees and offset so that its top left corner lines up with the bottom right corner of the first one. This is the output of xrandr:

Screen 0: minimum 320 x 200, current 2704 x 1280, maximum 8192 x 8192
DVI-0 connected primary 1680x1050+0+230 (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050      60.0*+
   1680x945       60.0  
   1400x1050      60.0  
   1600x900       60.0  
   1280x1024      75.0     60.0  
   1440x900       75.0     59.9  
   1280x960       60.0  
   1366x768       60.0  
   1360x768       60.0  
   1280x800       74.9     59.8  
   1152x864       75.0  
   1280x768       74.9     59.9  
   1024x768       75.1     70.1     60.0  
   1024x576       60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   848x480        60.0  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
DIN disconnected (normal left inverted right x axis y axis)
DVI-1 connected 1024x1280+1680+0 left (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+
   1280x960       60.0  
   1280x800       74.9     59.9  
   1152x864       75.0  
   1280x768       74.9     60.0  
   1024x768       75.1     75.0     70.1     60.0  
   1024x576       60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   848x480        60.0  
   640x480        72.8     75.0     60.0  
   720x400        70.1  


I have tried the following: shut down, disconnect the second screen, boot into KDE, shut down, reconnect, reboot. No dice, the problem reappears when the second screen is activated. Also, I tried removing the screen rotation (I have it at 90 degrees for reading articles and stuff) but the flicker is still there. Also, switching the display ports made no difference, the system was not fooled. It just switched display designations and went about its usual business.

Playing around with the display settings I noticed that the problem disappears when I change the rotated screen's resolution to 1280x800, which also changes the refresh rate to 75hz. All lower available resolutions cause the flicker to disappear, the two higher ones (1280x960 and 1280x1024) make it reappear.


I would appreciate any suggestions you might have on this, I would like to avoid using fglrx if possible (I will try it as a last resort).
Comment 10 FiNeX 2013-08-31 20:24:39 UTC
Bug confirmed using nvidia card with nvidia drivers. I've tried with OpenGL 2 and 3.1 and there are no differences.

I've six desktop, three per row. When I switch from the first row to the second row (or vice versa) I can reproduce the bug.

I've tried to reboot many times, I've disabled other effects and I'm using only one plasma activity.
Comment 11 Thomas Lübking 2013-08-31 20:36:08 UTC
> i.e. the slide completes and the screen flickers (goes black) for a moment
Just to be sure, you see this?

How many screens do you use and does it also happen on only one screen?
Comment 12 FiNeX 2013-09-01 09:55:16 UTC
@Thomas: thanks to mention the number of screens: I've forgot to mention that I'm using a dual monitor setup with nvidia twinview. I've disabled one monitor and with only one screen the bug is not reproducible. I've changed the bug summary.
Comment 13 Thomas Lübking 2013-09-01 13:30:05 UTC
Happens.
Multiscreen only, effect speed (always only like one frame) or desktop system are irrelevant. Happens on XRender or GL raster or native.
Is the effect (generic animations effect does not cause this)
Comment 14 Thomas Lübking 2013-09-01 14:03:25 UTC
is because of PAINT_SCREEN_BACKGROUND_FIRST, causes a spurious erase between any change of desktop while the effect is running (ie. 3 flickers if you swap 1-2-3-4)
Comment 15 Thomas Lübking 2013-09-01 14:38:54 UTC
actual problem is that "currentRegion.contains(rect)" can match for no desktop rect in the paintScreen() desktop painting loop (on multiscreen setups)
Comment 16 Thomas Lübking 2013-09-01 20:38:42 UTC
CONGRATULATIONS!

You found a timebomb. The bug is NOT limited to the slide effect at all and exists since KWin has compositing =D
Comment 17 FiNeX 2013-09-02 08:06:34 UTC
Wow, it looks great! :-)
Comment 18 Thomas Lübking 2013-09-08 22:03:47 UTC
Git commit e53b5ef25a6e38279f142502bf4653ee735b1934 by Thomas Lübking.
Committed on 01/09/2013 at 20:30.
Pushed by luebking into branch 'KDE/4.11'.

copy and paste timebomb

bug as old as kwin compositing ....
FIXED-IN: 4.11.2
REVIEW: 112436

M  +1    -1    kwin/effects.cpp

http://commits.kde.org/kde-workspace/e53b5ef25a6e38279f142502bf4653ee735b1934
Comment 19 FiNeX 2013-09-09 07:48:24 UTC
Thanks :-)