#include "glxclient.h"
#include "glx_error.h"
-#include "dri_interface.h"
+#include "GL/internal/dri_interface.h"
#include "dri2_priv.h"
#if defined(HAVE_DRI3)
#include "dri3_priv.h"
static int
dri2_convert_glx_query_renderer_attribs(int attribute)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(query_renderer_map); i++)
if (query_renderer_map[i].glx_attrib == 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
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
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
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
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
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