summaryrefslogtreecommitdiff
path: root/xserver/glx
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2022-02-20 17:41:37 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2022-02-20 17:41:37 +0000
commitc259179a37a495b4e22c6787185a50171358d838 (patch)
treed6bea7165f184d9d1d0dedd3c6e1d78935655de0 /xserver/glx
parent8e9a1d1ad7c4069aa127b34a72800fbc48c8c994 (diff)
Sync with xorg-server 21.1.3.
This does *not* include the commit that reverts the new computation of the screen resolution from dimensions returned by the screen since many of you told they prefer the new behaviour from 21.1.1. This is going to be discussed again before 7.1
Diffstat (limited to 'xserver/glx')
-rw-r--r--xserver/glx/glxdricommon.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xserver/glx/glxdricommon.c b/xserver/glx/glxdricommon.c
index 2e00bab03..35a539629 100644
--- a/xserver/glx/glxdricommon.c
+++ b/xserver/glx/glxdricommon.c
@@ -115,6 +115,16 @@ render_type_is_pbuffer_only(unsigned renderType)
| __DRI_ATTRIB_FLOAT_BIT));
}
+static int
+server_has_depth(int depth)
+{
+ int i;
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ if (screenInfo.formats[i].depth == depth)
+ return 1;
+ return 0;
+}
+
static __GLXconfig *
createModeFromConfig(const __DRIcoreExtension * core,
const __DRIconfig * driConfig,
@@ -178,6 +188,16 @@ createModeFromConfig(const __DRIcoreExtension * core,
if (!render_type_is_pbuffer_only(renderType))
drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+ /* Make sure we don't advertise things the server isn't configured for */
+ if ((drawableType & (GLX_PBUFFER_BIT | GLX_PIXMAP_BIT)) &&
+ !server_has_depth(config->config.rgbBits)) {
+ drawableType &= ~(GLX_PBUFFER_BIT | GLX_PIXMAP_BIT);
+ if (!drawableType) {
+ free(config);
+ return NULL;
+ }
+ }
+
config->config.next = NULL;
config->config.visualType = visualType;
config->config.renderType = renderType;