Handle when XVisuals lose the alpha channel of the FBConfig

Sometimes the XVisual for an FBConfig have no alpha data, and thus
won't work when an alpha channel is required.

Fixes: QTBUG-74578
Change-Id: Idf05cbfcaea5edf667035939e9bc5d5df2172eec
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
bb10
Allan Sandfeld Jensen 2019-03-20 14:30:54 +01:00
parent 3ca05b2a2e
commit 24358aaf72
1 changed files with 3 additions and 1 deletions

View File

@ -223,6 +223,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
continue;
}
QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate));
int actualRed;
int actualGreen;
int actualBlue;
@ -231,7 +232,8 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
glXGetFBConfigAttrib(display, candidate, GLX_GREEN_SIZE, &actualGreen);
glXGetFBConfigAttrib(display, candidate, GLX_BLUE_SIZE, &actualBlue);
glXGetFBConfigAttrib(display, candidate, GLX_ALPHA_SIZE, &actualAlpha);
// Sometimes the visuals don't have a depth that includes the alpha channel.
actualAlpha = qMin(actualAlpha, visual->depth - actualRed - actualGreen - actualBlue);
if (requestedRed && actualRed < requestedRed)
continue;