Bug 321217

Summary: Kwin returns black screen on gl > 1.2
Product: [Plasma] kwin Reporter: Jamie Smith <smithjd15>
Component: colorcorrectionAssignee: Casian Andrei <casian>
Status: RESOLVED FIXED    
Severity: grave CC: casian, fredrik, hrvoje.senjan, kamikazow, kwin-bugs-null, maris.kde, oliviervdtoorn
Priority: NOR    
Version: 4.10.80   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: output with kwin_gles --replace &
es2_info & eglinfo & kwin support info

Description Jamie Smith 2013-06-16 08:38:01 UTC
Kwin has blank screen after specified commit is applied to the kwin codebase:

ab7e2284dc530ca110415289920833f1632cd210



Reproducible: Always

Steps to Reproduce:
1.Launch Kwin with opengl set to > 1.2
2. Kwin starts
3. Screen slowly or quickly fills in with black
Actual Results:  
Black unusable screen

Expected Results:  
Kwin doesn't misfunction with a black screen
Comment 1 Martin Flöser 2013-06-16 09:10:50 UTC
Please provide output of:
qdbus org.kde.kwin /KWin supportInformation
Comment 2 markuss 2013-06-16 14:44:15 UTC
Same here. Btw, workaround: Turn compositing off (Shift-Alt-F12) and then turn it back on again.

Output from me:

Version
=======
KWin version: 4.10.80
KDE SC version (runtime): 4.10.80
KDE SC version (compile): 4.10.80
Qt Version: 4.8.4

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
showDesktopIsMinimizeAll: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30                                                                                                           
commandActiveTitlebar3: 2                                                                                                            
commandInactiveTitlebar1: 4                                                                                                          
commandInactiveTitlebar2: 30                                                                                                         
commandInactiveTitlebar3: 2                                                                                                          
commandWindow1: 7                                                                                                                    
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: false
electricBorderTiling: false
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
unredirectFullscreen: false
glSmoothScale: 2
colorCorrected: false
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glDirect: true
glStrictBinding: false
glStrictBindingFollowsDriver: true
glLegacy: false
glCoreProfile: false
glPreferBufferSwap: 101

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Number of Screens: 1
Screen 0 Geometry: 0,0,1280x800

Decoration
==========
Current Plugin: kwin3_oxygen
Shadows: yes
Alpha: yes
Announces Alpha: yes
Tabbing: yes
Frame Overlap: no
Blur Behind: no

Compositing
===========
Qt Graphics System: raster
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 9200M GS/PCIe/SSE2
OpenGL version string: 3.3.0 NVIDIA 319.17
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
Driver: NVIDIA
Driver version: 319.17
GPU class: G80/G90
OpenGL version: 3.3
GLSL version: 3.30
X server version: 1.13.2
Linux kernel version: 3.7.10
Direct rendering: yes
Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used

Loaded Effects:
---------------
kwin4_effect_invert
kwin4_effect_login
kwin4_effect_coverswitch
kwin4_effect_screenshot
kwin4_effect_translucency
kwin4_effect_diminactive
kwin4_effect_magiclamp
kwin4_effect_fade
kwin4_effect_highlightwindow
kwin4_effect_taskbarthumbnail
kwin4_effect_dialogparent
kwin4_effect_presentwindows
kwin4_effect_blur
kwin4_effect_logout
kwin4_effect_dashboard
kwin4_effect_screenedge
kwin4_effect_startupfeedback
kwin4_effect_kscreen

Currently Active Effects:
-------------------------
kwin4_effect_diminactive
kwin4_effect_blur

Effect Settings:
----------------
kwin4_effect_invert:

kwin4_effect_login:

kwin4_effect_coverswitch:
animationDuration: 200
animateSwitch: true
animateStart: true
animateStop: true
reflection: true
windowTitle: true
zPosition: 900
primaryTabBox: false
secondaryTabBox: false

kwin4_effect_screenshot:

kwin4_effect_translucency:

kwin4_effect_diminactive:
dimPanels: false
dimDesktop: false
dimKeepAbove: false
dimByGroup: true
dimStrength: 25

kwin4_effect_magiclamp:
animationDuration: 250

kwin4_effect_fade:

kwin4_effect_highlightwindow:

kwin4_effect_taskbarthumbnail:

kwin4_effect_dialogparent:

kwin4_effect_presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0
dragToClose: false

kwin4_effect_blur:
blurRadius: 6
cacheTexture: true

kwin4_effect_logout:
useBlur: true

kwin4_effect_dashboard:
brightness: 0.5
saturation: 0.5
blur: false

kwin4_effect_screenedge:

kwin4_effect_startupfeedback:

kwin4_effect_kscreen:
Comment 3 Fredrik Höglund 2013-06-16 15:21:42 UTC
(In reply to comment #0)
> Kwin has blank screen after specified commit is applied to the kwin codebase:
> 
> ab7e2284dc530ca110415289920833f1632cd210

Are you absolutely sure that this is the commit that's responsible for the regression?

Reverting this commit results in two additional OpenGL calls to glGetError() and glGetUniformLocation(). Neither of those calls have any affect on rendering.
Comment 4 Thomas Lübking 2013-06-16 17:59:54 UTC
(In reply to comment #2)
> Same here. Btw, workaround: Turn compositing off (Shift-Alt-F12) and then turn it back on again.

What happens for "kwin --replace&"?

@Jamie
"qdbus org.kde.kwin /KWin supportInformation" is still valuable (esp. if it's caused by that commit) or at least we should know about your HW/driver (nvidia? what GPU/driver version?)
Comment 5 Jamie Smith 2013-06-17 01:44:12 UTC
On June 16, 2013 05:59:54 PM you wrote:


*Comment # 4[1] on bug 321217[2] from Thomas Lübking[3] *
(In reply to comment #2[4])
> Same here. Btw, workaround: Turn compositing off (Shift-Alt-F12) and 
then turn it back on again.

What happens for "kwin --replace&"?

@Jamie
"qdbus org.kde.kwin /KWin supportInformation" is still valuable (esp. if it's
caused by that commit) or at least we should know about your HW/driver 
(nvidia?
what GPU/driver version?) 
--------------------
     *  You reported the bug. 
kwin qdbus output:
http://paste.kde.org/775706
I'm quite certain that is the commit that causes the issue; i tried reverting / 
compile and run-checking twice.

--------
[1] https://bugs.kde.org/show_bug.cgi?id=321217#c4
[2] https://bugs.kde.org/show_bug.cgi?id=321217
[3] mailto:thomas.luebking@gmail.com
[4] show_bug.cgi?id=321217#c2
Comment 6 Jamie Smith 2013-06-17 02:10:48 UTC
I didn't have oyranous or kolormanager installed. I installed kolormanager and the bug went away. I assume Opensuse would like to know that kolormanager is now a dependency for Kwin whether color management is desired or not?
Comment 7 Fredrik Höglund 2013-06-17 02:25:28 UTC
(In reply to comment #6)
> I didn't have oyranous or kolormanager installed. I installed kolormanager
> and the bug went away. I assume Opensuse would like to know that
> kolormanager is now a dependency for Kwin whether color management is
> desired or not?

The commit shouldn't have any effect when color management is enabled, so it's not that surprising that enabling it works around the problem. The mystery is why it breaks when color management is disabled (and also why I'm not able to reproduce the problem).

I'm adding Casian, who is the color management author, to the CC list in case he has any theories.
Comment 8 Casian Andrei 2013-06-17 05:49:53 UTC
Ok, I think somehow the modified shaders for color correction get used and the patch avoids setting up a default color correction texture that basically doesn't change anything in the colors, and the shanders end up with a black texture and that's why everything is black. I have encountered this when implementing.

This should not happen when color correction is disabled...

Looking at the code, there might be a possible explanation:
Color correction starts disabled, then it tries to get enabled (checkbox probably checked), calls for KolorManager, fails, ends up in ColorCorrectionPrivate::colorServerUpdateFailedSlot, which sets enabled back to false BUT the color correction shaders are still being used (wrong!). 

So the patch is correct, but highlights this issue.

I think a fix might be to emit changed() inside that method, and make sure to connect it in SceneOpenGL2::SceneOpenGL2 with the slotColorCorrectedChanged() of SceneOpenGL2.
Comment 9 markuss 2013-06-17 09:56:51 UTC
(In reply to comment #6)
> I didn't have oyranous or kolormanager installed. I installed kolormanager
> and the bug went away.

No package called kolormanager here. Did you mean colord-kde?

> I assume Opensuse would like to know that 
> kolormanager is now a dependency for Kwin
> whether color management is desired or not?

Well, it's not required (a color management is correctly detected as not available and the checkbox is greyed out).
Comment 10 Casian Andrei 2013-06-17 10:27:38 UTC
(In reply to comment #9)
> (In reply to comment #6)
> > I didn't have oyranous or kolormanager installed. I installed kolormanager
> > and the bug went away.
> 
> No package called kolormanager here. Did you mean colord-kde?
> 
> > I assume Opensuse would like to know that 
> > kolormanager is now a dependency for Kwin
> > whether color management is desired or not?
> 
> Well, it's not required (a color management is correctly detected as not
> available and the checkbox is greyed out).

(In reply to comment #9)
> (In reply to comment #6)
> > I didn't have oyranous or kolormanager installed. I installed kolormanager
> > and the bug went away.
> 
> No package called kolormanager here. Did you mean colord-kde?
It's about http://quickgit.kde.org/?p=kolor-manager.git
> 
> > I assume Opensuse would like to know that 
> > kolormanager is now a dependency for Kwin
> > whether color management is desired or not?
> 
> Well, it's not required (a color management is correctly detected as not
> available and the checkbox is greyed out).
There is no detection mechanism yet implemented, the grayed out checkbox is a regression that will be fixed soon.
Comment 11 Casian Andrei 2013-06-17 19:04:21 UTC
Try this review request:
https://git.reviewboard.kde.org/r/111078/

It should fix the problem, but I was unable to perform resonable testing thus far...
Comment 12 Casian Andrei 2013-06-18 14:30:46 UTC
Git commit 4a172a9d0ee5a89cc17b0dd318f41df5f2ef26fb by Casian Andrei.
Committed on 17/06/2013 at 18:19.
Pushed by casianandrei into branch 'master'.

Enable color correction only after successfuly contacting KolorManager

Prevents the possiblity of using shaders modified for color correction
without valid data from KolorManager. If that happened, everthing
blacked out.

Now the color correction shaders are enabled only after successfuly
contacting KolorManager.

The issue was highlighted after ab7e228d.

M  +27   -5    kwin/libkwineffects/kwinglcolorcorrection.cpp
M  +1    -0    kwin/libkwineffects/kwinglcolorcorrection_p.h
M  +1    -0    kwin/libkwineffects/kwinglutils.h
M  +1    -5    kwin/scene_opengl.cpp

http://commits.kde.org/kde-workspace/4a172a9d0ee5a89cc17b0dd318f41df5f2ef26fb
Comment 13 Jamie Smith 2013-06-19 01:44:46 UTC
kwin_gles from OpenSuse packages still has a black screen even with kolormanager installed(!), and kwin_gles from git won't enable compositing without crashing.
Comment 14 Casian Andrei 2013-06-19 04:34:19 UTC
(In reply to comment #13)
> kwin_gles from OpenSuse packages still has a black screen even with
> kolormanager installed(!), and kwin_gles from git won't enable compositing
> without crashing.

I think that is about bug 315419. You can try the small fix from there.

There is a fix coming for that separately. I can make a review request for it after the currently pending review is submitted, because I am not able to trick reviewboard into accepting the diff so far. (it needs something like 2 parent diffs)
Comment 15 Thomas Lübking 2013-06-22 19:50:04 UTC
*** Bug 321504 has been marked as a duplicate of this bug. ***
Comment 16 Hrvoje Senjan 2013-06-23 13:00:35 UTC
(In reply to comment #14)
> I think that is about bug 315419. You can try the small fix from there.

At least here, with latest master, kwin_gles + cc produces black screen. No crashing, just nice black screen. "Normal" KWin works fine with cc.

Somehow is tickbox greyed out in kcm, so for activating i just enabled it in kwinrc.
Comment 17 Hrvoje Senjan 2013-06-23 13:03:58 UTC
Created attachment 80733 [details]
output with kwin_gles --replace &
Comment 18 Hrvoje Senjan 2013-06-23 13:13:40 UTC
Created attachment 80734 [details]
es2_info  & eglinfo & kwin support info
Comment 19 Casian Andrei 2013-06-23 15:55:05 UTC
(In reply to comment #17)
> Created attachment 80733 [details]
> output with kwin_gles --replace &

Thanks for the info!

Looks like the fix i was preparing for the gles bug was incomplete.

The fix will come with the fix for that bug, because it is more related to that one than this one.
Comment 20 markuss 2013-07-18 23:01:04 UTC
So, it's RC1, I even installed kolor-manager, and the screen's still black after wakeup with non-ES OpenGL.
Comment 21 Thomas Lübking 2013-07-18 23:24:55 UTC
(In reply to comment #20)
> So, it's RC1, I even installed kolor-manager, and the screen's still black
> after wakeup with non-ES OpenGL.

If this is (only) about the condition after resume from STR, i doubt this is this particular bug, but the GPU lacks a memory repost or whatever.

In this case rather open a new bug and post the output of "qdbus org.kde.kwin /KWin supportInformation", also check the content of /var/log/Xorg.0.log and output of dmesg for error messages from the driver.
Comment 22 Māris Nartišs 2013-08-18 19:19:55 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > So, it's RC1, I even installed kolor-manager, and the screen's still black
> > after wakeup with non-ES OpenGL.
> 
> If this is (only) about the condition after resume from STR, i doubt this is
> this particular bug, but the GPU lacks a memory repost or whatever.
> 
> In this case rather open a new bug and post the output of "qdbus
> org.kde.kwin /KWin supportInformation", also check the content of
> /var/log/Xorg.0.log and output of dmesg for error messages from the driver.

I would guess it's a Bug 323686
Comment 23 Hrvoje Senjan 2014-03-16 17:44:40 UTC
maybe we could close this one. i haven't seen it with multiple combos (glx, egl, gles, etc) since last Casian's related commits. (note: i don't have correction enabled, nor kolor-manager installed)
Comment 24 Jamie Smith 2014-03-17 03:48:22 UTC
Now works fine also without kolor-manager, kwin and kwin_gles. Thanks! KWin from Opensuse 13.1, v. 4.12.2.