Backport a Mesa fix from Andreas Boll.
glx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA
This commit is contained in:
parent
dada7626ab
commit
94a0ddf05d
36
dist/Mesa/src/glx/dri2_query_renderer.c
vendored
36
dist/Mesa/src/glx/dri2_query_renderer.c
vendored
@ -66,10 +66,23 @@ dri2_convert_glx_query_renderer_attribs(int attribute)
|
|||||||
return -1;
|
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
|
_X_HIDDEN int
|
||||||
dri2_query_renderer_integer(struct glx_screen *base, int attribute,
|
dri2_query_renderer_integer(struct glx_screen *base, int attribute,
|
||||||
unsigned int *value)
|
unsigned int *value)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct dri2_screen *const psc = (struct dri2_screen *) base;
|
struct dri2_screen *const psc = (struct dri2_screen *) base;
|
||||||
|
|
||||||
/* Even though there are invalid values (and
|
/* 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)
|
if (psc->rendererQuery == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
||||||
value);
|
value);
|
||||||
|
dri_convert_context_profile_bits(attribute, value);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_HIDDEN int
|
_X_HIDDEN int
|
||||||
@ -109,6 +125,7 @@ _X_HIDDEN int
|
|||||||
dri3_query_renderer_integer(struct glx_screen *base, int attribute,
|
dri3_query_renderer_integer(struct glx_screen *base, int attribute,
|
||||||
unsigned int *value)
|
unsigned int *value)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct dri3_screen *const psc = (struct dri3_screen *) base;
|
struct dri3_screen *const psc = (struct dri3_screen *) base;
|
||||||
|
|
||||||
/* Even though there are invalid values (and
|
/* 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)
|
if (psc->rendererQuery == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
||||||
value);
|
value);
|
||||||
|
dri_convert_context_profile_bits(attribute, value);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_HIDDEN int
|
_X_HIDDEN int
|
||||||
@ -148,6 +168,7 @@ _X_HIDDEN int
|
|||||||
drisw_query_renderer_integer(struct glx_screen *base, int attribute,
|
drisw_query_renderer_integer(struct glx_screen *base, int attribute,
|
||||||
unsigned int *value)
|
unsigned int *value)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct drisw_screen *const psc = (struct drisw_screen *) base;
|
struct drisw_screen *const psc = (struct drisw_screen *) base;
|
||||||
|
|
||||||
/* Even though there are invalid values (and
|
/* 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)
|
if (psc->rendererQuery == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
ret = psc->rendererQuery->queryInteger(psc->driScreen, dri_attribute,
|
||||||
value);
|
value);
|
||||||
|
dri_convert_context_profile_bits(attribute, value);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_HIDDEN int
|
_X_HIDDEN int
|
||||||
|
Loading…
Reference in New Issue
Block a user