Bug 276622

Summary: Contents of windows are empty using r300g and KDE 4.6.90
Product: [Plasma] kwin Reporter: Mike Shutlar <infectedsoundsystem>
Component: scene-openglAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: critical    
Priority: VHI    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.7.0
Attachments: Native graphics system - shaders disabled
Native graphics system - shaders enabled
Raster graphics system - shaders disabled
Raster graphics system - shaders enabled
Native graphics system - e2deb7[...] reverted
Raster graphics system - e2deb7[...] reverted
Possible Fix for r300
Try 2: Possible Fix
Native graphics system - r300 possible fix try 2
Possible fix for decoration issue
Shadows missing from menus

Description Mike Shutlar 2011-06-27 16:32:09 UTC
Created attachment 61373 [details]
Native graphics system - shaders disabled

Version:           unspecified (using Devel) 
OS:                Linux

Desktop effects are unusable when using the r300g driver (for a X1800XT) with KDE 4.6.90 as all windows are empty, and enabling/disabling "Use OpenGL 2 shaders" seems to make no difference. 

Please see the attached screenshots. When using the native graphics system, there are no decorations and the windows are empty. If using the raster graphics system, the decorations are present but the windows remain empty.

kwin gives the following output when enabling compositing:
OpenGL vendor string:                   X.Org R300 Project
OpenGL renderer string:                 Gallium 0.4 on ATI R520
OpenGL version string:                  2.1 Mesa 7.11-devel (git-7d488ad)
OpenGL shading language version string: 1.20
Driver:                                 R300G
GPU class:                              R500
OpenGL version:                         2.1
GLSL version:                           1.20
Mesa version:                           7.11
X server version:                       1.10.2
Linux kernel version:                   2.6.39
Direct rendering:                       yes
Requires strict binding:                yes
GLSL shaders:                           limited
Texture NPOT support:                   limited
kwin(4518): Shaders are not supported 

The last line (kwin(4518): Shaders are not supported) appears even when shaders are disabled, and appears twice when shaders are enabled.

If I can give any more information, please let me know. Cheers :)

Reproducible: Always

Steps to Reproduce:
Activate desktop effects.

Actual Results:  
Windows are empty.

Expected Results:  
Windows not empty.
Comment 1 Mike Shutlar 2011-06-27 16:32:48 UTC
Created attachment 61374 [details]
Native graphics system - shaders enabled
Comment 2 Mike Shutlar 2011-06-27 16:33:15 UTC
Created attachment 61375 [details]
Raster graphics system - shaders disabled
Comment 3 Mike Shutlar 2011-06-27 16:33:35 UTC
Created attachment 61376 [details]
Raster graphics system - shaders enabled
Comment 4 Martin Flöser 2011-06-27 16:44:30 UTC
R300 is a very "special" graphics card as it does not support NPOT textures, but the driver 
claims to support it. This introduces a high risk in breaking on our side.

Did you test with the beta version? Did it work back then? If you have the possibility, could you 
please test with e2deb734019b7471dbe85a3dc4a599f5e5946939 reverted? If possible could 
you test with Mesa 7.10 instead of 7.11 (just to rule out a driver regression).

Are you able to test patches, if we provide them? As said r300 is special and we cannot really 
develop for it without having the hardware.
Comment 5 Mike Shutlar 2011-06-28 12:17:50 UTC
(In reply to comment #4)
> Did you test with the beta version? Did it work back then? 
No, sorry, I didn't try beta 1 (was waiting for beta 2). Though I've found a post in the Arch forums that suggests it may have been present in beta 1:
https://bbs.archlinux.org/viewtopic.php?pid=939514#p939514

> If you have the
> possibility, could you 
> please test with e2deb734019b7471dbe85a3dc4a599f5e5946939 reverted? 

Some success: with those changes reverted the contents of windows reappear, though the decorations are missing and there is an odd border to the right of the windows when using the native graphics system. Using raster, everything appears perfectly fine (please see the screenshots). Enabling/disabling shaders in the settings makes no difference whatsoever.

> If possible
> could 
> you test with Mesa 7.10 instead of 7.11 (just to rule out a driver regression).

The results are exactly the same when using 7.10.

> Are you able to test patches, if we provide them? As said r300 is special and
> we cannot really 
> develop for it without having the hardware.

Sure, I'm happy to test them. Thanks :)
Comment 6 Mike Shutlar 2011-06-28 12:18:52 UTC
Created attachment 61408 [details]
Native graphics system - e2deb7[...] reverted
Comment 7 Mike Shutlar 2011-06-28 12:19:19 UTC
Created attachment 61409 [details]
Raster graphics system - e2deb7[...] reverted
Comment 8 Martin Flöser 2011-06-28 17:54:51 UTC
Created attachment 61420 [details]
Possible Fix for r300

This *might* fix the issues for the window content. If that works I will try to get a fix also for other things as shadows and decoration.
Comment 9 Mike Shutlar 2011-06-29 09:41:52 UTC
(In reply to comment #8)
> Created an attachment (id=61420) [details]
> Possible Fix for r300

Unfortunately, the results with that patch are the same as before - no window content.
Comment 10 Martin Flöser 2011-06-29 14:28:53 UTC
> Unfortunately, the results with that patch are the same as before - no
> window content.
*Sigh* thanks for testing. I will study again the implications of the change and draft a new patch.
Comment 11 Martin Flöser 2011-06-29 18:11:35 UTC
I consider this bug as a release blocker, even if we do not yet have the keyword. Just wanted to have it written down ;-)
Comment 12 Martin Flöser 2011-06-29 18:13:38 UTC
Created attachment 61454 [details]
Try 2: Possible Fix

Restudied the old code and hope that this patch improves it. I expect that there are more issues with r300 (e.g. the already seen broken decorations with native and most likely also shadows).
Comment 13 Mike Shutlar 2011-06-30 00:11:20 UTC
(In reply to comment #12)
> Created an attachment (id=61454) [details]
> Try 2: Possible Fix
> 
> Restudied the old code and hope that this patch improves it. I expect that
> there are more issues with r300 (e.g. the already seen broken decorations with
> native and most likely also shadows).

The patch works :) The contents of windows reappear, though like you say, decorations and shadows are missing (see screenshot). All other effects that I use appear to be working fine. Raster is working perfectly.

I'll be happy to continue testing patches for the remaining issues. Thanks :)
Comment 14 Mike Shutlar 2011-06-30 00:12:37 UTC
Created attachment 61466 [details]
Native graphics system - r300 possible fix try 2
Comment 15 Martin Flöser 2011-06-30 15:50:32 UTC
Git commit bb04415e27f4e6026413258d8a273a7ce27cb726 by Martin Gräßlin.
Committed on 30/06/2011 at 17:47.
Pushed by graesslin into branch 'KDE/4.7'.

Fix major window rendering regression with NPOT textures

The adjusted code for generating texture coordinates did not
take care of GL_TEXTURE_RECTANGLE_ARB textures causing the
generation of wrong texcoords.

BUG: 276622
FIXED-IN: 4.7.0

M  +17   -6    kwin/scene_opengl.cpp     
M  +1    -1    kwin/scene_opengl.h     

http://commits.kde.org/kde-workspace/bb04415e27f4e6026413258d8a273a7ce27cb726
Comment 16 Martin Flöser 2011-06-30 16:09:37 UTC
Created attachment 61487 [details]
Possible fix for decoration issue

This is an additional patch for the remaining issue with the window decoration.
Comment 17 Mike Shutlar 2011-06-30 23:48:27 UTC
(In reply to comment #16)
> Created an attachment (id=61487) [details]
> Possible fix for decoration issue
> 
> This is an additional patch for the remaining issue with the window decoration.

Excellent, the patch works :) Decorations and shadows for windows are back, the only issue that I can see is that shadows for menus are missing (see screenshot), unless there's a system settings option for them that I'm overlooking...
Comment 18 Mike Shutlar 2011-06-30 23:49:10 UTC
Created attachment 61502 [details]
Shadows missing from menus
Comment 19 Martin Flöser 2011-07-01 16:08:01 UTC
Git commit f09e3a98d7def528b0d13d02824ec1b5843a7d11 by Martin Gräßlin.
Committed on 01/07/2011 at 18:04.
Pushed by graesslin into branch 'KDE/4.7'.

Fix decoration rendering with GL_TEXTURE_RECTANGLE_ARB

When using graphicssystem native the texture may be using
GL_TEXTURE_RECTANGLE_ARB instead of GL_TEXTURE_2D. This
needs to be honoured in order to make KWin work reliable
with e.g. R300 chipsets.

BUG: 274607
CCBUG: 276622
FIXED-IN: 4.7.0

M  +11   -5    kwin/scene_opengl.cpp     
M  +1    -1    kwin/scene_opengl.h     

http://commits.kde.org/kde-workspace/f09e3a98d7def528b0d13d02824ec1b5843a7d11
Comment 20 Martin Flöser 2011-07-01 16:12:24 UTC
concerning the shadow on menu issues, this review request might help: https://git.reviewboard.kde.org/r/101742/

I need to rebase it on top of the recent changes, but am optimistic that it can resolve the issue. If it does I will try to get it into 4.7.