glx: Don't use sRGB configs on llvmpipe with depth 16

Summary:
This is necessary to keep openQA working, which uses LLVMpipe as a
renderer on a Cirrus device that operates in depth 16.

LLVMpipe advertises 24/32 bit sRGB configurations on this setup, but
they cannot be presented.

CCBUG: 408594

Test Plan: Compile tested only.

Reviewers: fvogt, #kwin, zzag

Reviewed By: fvogt, #kwin, zzag

Subscribers: romangg, sbergeron, fvogt, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22203
icc-effect-5.17.5
Fabian Vogt 2019-10-15 16:06:30 +02:00
parent 446e23af5a
commit 4982dfd5f5
1 changed files with 16 additions and 1 deletions

View File

@ -430,9 +430,24 @@ bool GlxBackend::initFbConfig()
0
};
bool llvmpipe = false;
// Note that we cannot use GLPlatform::driver() here, because it has not been initialized at this point
if (hasExtension(QByteArrayLiteral("GLX_MESA_query_renderer"))) {
const QByteArray device = glXQueryRendererStringMESA(display(), DefaultScreen(display()), 0, GLX_RENDERER_DEVICE_ID_MESA);
if (device.contains(QByteArrayLiteral("llvmpipe"))) {
llvmpipe = true;
}
}
// Try to find a double buffered sRGB capable configuration
int count = 0;
GLXFBConfig *configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs_srgb, &count);
GLXFBConfig *configs = nullptr;
// Don't request an sRGB configuration with LLVMpipe when the default depth is 16. See bug #408594.
if (!llvmpipe || Xcb::defaultDepth() > 16) {
configs = glXChooseFBConfig(display(), DefaultScreen(display()), attribs_srgb, &count);
}
if (count == 0) {
// Try to find a double buffered non-sRGB capable configuration