summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-03-18 05:30:11 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-03-18 05:30:11 +0000
commitca1b8306e4b33306cd3fafab626962c21108be8d (patch)
tree71e17775896ef937119551fcfed41d87b00c80d0
parentc72e56bcf45c9bf1da9f094e54471dae9d91d8c7 (diff)
Backport a Mesa fix from Andreas Boll.
glx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA
-rw-r--r--dist/Mesa/src/glx/dri2_query_renderer.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/dist/Mesa/src/glx/dri2_query_renderer.c b/dist/Mesa/src/glx/dri2_query_renderer.c
index 247ec1ca6..f614a30d3 100644
--- a/dist/Mesa/src/glx/dri2_query_renderer.c
+++ b/dist/Mesa/src/glx/dri2_query_renderer.c
@@ -66,10 +66,23 @@ dri2_convert_glx_query_renderer_attribs(int attribute)
return -1;
}
+/* Convert internal dri context profile bits into GLX context profile bits */
+static inline void
+dri_convert_context_profile_bits(int attribute, unsigned int *value)
+{
+ if (attribute == GLX_RENDERER_PREFERRED_PROFILE_MESA) {
+ if (value[0] == (1U << __DRI_API_OPENGL_CORE))
+ value[0] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ else if (value[0] == (1U << __DRI_API_OPENGL))
+ value[0] = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ }
+}
+
_X_HIDDEN int
dri2_query_renderer_integer(struct glx_screen *base, int attribute,
unsigned int *value)
{
+ int ret;
struct dri2_screen *const psc = (struct dri2_screen *) base;
/* Even though there are invalid values (and
@@ -82,8 +95,11 @@ dri2_query_renderer_integer(struct glx_screen *base, int attribute,
if (psc->rendererQuery == NULL)
return -1;
- return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
- value);
+ ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
+ value);
+ dri_convert_context_profile_bits(attribute, value);
+
+ return ret;
}
_X_HIDDEN int
@@ -109,6 +125,7 @@ _X_HIDDEN int
dri3_query_renderer_integer(struct glx_screen *base, int attribute,
unsigned int *value)
{
+ int ret;
struct dri3_screen *const psc = (struct dri3_screen *) base;
/* Even though there are invalid values (and
@@ -121,8 +138,11 @@ dri3_query_renderer_integer(struct glx_screen *base, int attribute,
if (psc->rendererQuery == NULL)
return -1;
- return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
- value);
+ ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
+ value);
+ dri_convert_context_profile_bits(attribute, value);
+
+ return ret;
}
_X_HIDDEN int
@@ -148,6 +168,7 @@ _X_HIDDEN int
drisw_query_renderer_integer(struct glx_screen *base, int attribute,
unsigned int *value)
{
+ int ret;
struct drisw_screen *const psc = (struct drisw_screen *) base;
/* Even though there are invalid values (and
@@ -160,8 +181,11 @@ drisw_query_renderer_integer(struct glx_screen *base, int attribute,
if (psc->rendererQuery == NULL)
return -1;
- return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
- value);
+ ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
+ value);
+ dri_convert_context_profile_bits(attribute, value);
+
+ return ret;
}
_X_HIDDEN int