Bug 387159 - Mesa requires explicit "don't care"(or "true") to list srgb capable fbconfigs
Summary: Mesa requires explicit "don't care"(or "true") to list srgb capable fbconfigs
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-x11-standalone (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-20 16:01 UTC by Pierre Willenbrock
Modified: 2017-11-20 17:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.11.4
Sentry Crash Report:


Attachments
Patch adding GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB attribute (661 bytes, patch)
2017-11-20 16:01 UTC, Pierre Willenbrock
Details
Git format-patch Patch adding GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT attribute (1.35 KB, patch)
2017-11-20 16:42 UTC, Pierre Willenbrock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Willenbrock 2017-11-20 16:01:41 UTC
Created attachment 108987 [details]
Patch adding GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB attribute

On systems where the only ARGB visual/fbconfig combination is sRGB capable and which use mesa after 17.2, kwin will not render windows using an ARGB visual.

Steps to Reproduce:
  1) Start an application that chooses ARGB visuals for some of its windows
     For example, QT4 apps may choose the ARGB visual for their menus or drop-downs. (They probably should not, but they do here.)
  2) Make the application show such a window
     
Actual Results:
  The window is invisible

Expected Results:
  The window should be visible

Build Date & Platform:
  Using the 5.11.3 release on a gentoo system. Inspection of the git repository shows bug still present.
  Mesa 17.3 branch. The commit changing mesa behaviour went into 17.2.
  Xserver 1.19.5
  
Additional Information:

Commit 6e06e281c6ee342276d087ed4ee4a442626e433a in mesa changed the behaviour of glXChooseFBConfig so that it can filter for sRGB capable fbconfigs. By default, it will filter out all sRGB capable fbconfigs. The only ARGB visual/fbconfig combination on my system is sRGB capable, so kwin never finds it when an application uses the ARGB visual on a window, thus it will not be able to render the windows content.

I solved this problem by adding 
GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB,  int(GLX_DONT_CARE)
to the attribute list of glXChooseFBConfig, plugins/platforms/x11/standalone/glxbackend.cpp, about line 550. It may be more appropriate to use GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT(which is the same value).
Comment 1 Martin Flöser 2017-11-20 16:11:36 UTC
Patch looks fine to me. Could you please provide a patch exported from git so that I can push keeping you as author?
Comment 2 Pierre Willenbrock 2017-11-20 16:42:40 UTC
Created attachment 108989 [details]
Git format-patch Patch adding GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT attribute

Changed to _EXT instead of _ARB since that seems to be preferred in glxbackend.cpp. Also changed the comment to mention mesa/i965, since all of the mesa "drivers" are somewhat independent.
Comment 3 Martin Flöser 2017-11-20 17:13:16 UTC
Git commit 9300aa82be77ee23c346b85fb49091ab9728aba0 by Martin Flöser, on behalf of Pierre Willenbrock.
Committed on 20/11/2017 at 17:12.
Pushed by graesslin into branch 'Plasma/5.11'.

Allow glXChooseFBConfig to return sRGB capable fbconfig

Mesa's glXChooseFBConfig will not return any sRGB capable fbconfig when it
is not explicitly asked for. On some systems, the only ARGB32 visual is
paired with an sRGB capable fbconfig, so application windows using ARGB32
visuals would fail to display.
FIXED-IN: 5.11.4

M  +1    -0    plugins/platforms/x11/standalone/glxbackend.cpp

https://commits.kde.org/kwin/9300aa82be77ee23c346b85fb49091ab9728aba0