summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-04-13 11:44:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-14 20:41:49 +0000
commit8ec98fc2dc40237730f99af099dffe2920ef5bcc (patch)
tree4ff2f527cfc39858b242191d1763fc3adf9b50ca /src/platformsupport/eglconvenience
parent1192c463db34e3f69be4d9ef976246ce265143a3 (diff)
Fix launching with depth 30 XOrg
Our fallback logic for inexact matches was not very good at accepting better suggestions. Change-Id: I40fb78bf583171105725156148e4a2245fb81354 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/platformsupport/eglconvenience')
-rw-r--r--src/platformsupport/eglconvenience/qxlibeglintegration.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
index 565dbfb11b..ac743e1e38 100644
--- a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
+++ b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp
@@ -91,21 +91,21 @@ VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay
int visualRedSize = qPopulationCount(chosenVisualInfo->red_mask);
int visualGreenSize = qPopulationCount(chosenVisualInfo->green_mask);
int visualBlueSize = qPopulationCount(chosenVisualInfo->blue_mask);
- int visualAlphaSize = chosenVisualInfo->depth == 32 ? 8 : 0;
+ int visualAlphaSize = chosenVisualInfo->depth - visualRedSize - visualBlueSize - visualGreenSize;
- const bool visualMatchesConfig = visualRedSize == configRedSize
- && visualGreenSize == configGreenSize
- && visualBlueSize == configBlueSize
- && visualAlphaSize == configAlphaSize;
+ const bool visualMatchesConfig = visualRedSize >= configRedSize
+ && visualGreenSize >= configGreenSize
+ && visualBlueSize >= configBlueSize
+ && visualAlphaSize >= configAlphaSize;
// In some cases EGL tends to suggest a 24-bit visual for 8888
// configs. In such a case we have to fall back to XGetVisualInfo.
if (!visualMatchesConfig) {
visualId = 0;
qCDebug(lcXlibEglDebug,
- "EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d"
+ "EGL suggested using X Visual ID %d (%d %d %d %d depth %d) for EGL config %d"
"(%d %d %d %d), but this is incompatible",
- (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth,
+ (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, visualAlphaSize, chosenVisualInfo->depth,
configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize);
}
} else {