[Mesa-dev] [PATCH 3/3] dri/common: Fix returned value of __DRI2_RENDERER_PREFERRED_PROFILE

Andreas Boll andreas.boll.dev at gmail.com
Mon Feb 9 04:19:19 PST 2015


If the renderer supports the core profile the query returned incorrectly
0x8 as value, because it was using (1U << __DRI_API_OPENGL_CORE) for the
returned value.

The same happened with the compatibility profile. It returned 0x1
(1U << __DRI_API_OPENGL) instead of 0x2.

Used defines for the incorrect behavior:
   dri_interface.h: #define __DRI_API_OPENGL       0
   dri_interface.h: #define __DRI_API_OPENGL_CORE  3

Now we return GLX_CONTEXT_CORE_PROFILE_BIT_ARB (0x1) for a preferred
core context profile and GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB (0x2)
for a preferred compatibility context profile.

Cc: "10.3 10.4 10.5" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Andreas Boll <andreas.boll.dev at gmail.com>
---

I've noticed this wrong behavior while testing Adam's glxinfo changes [1]
(glxinfo: Add support for GLX_MESA_query_renderer)

For reproducing this bug and/or testing this and the previous patch just run
  glxinfo | grep "Preferred profile"

Andreas.

[1] http://cgit.freedesktop.org/mesa/demos/commit/?id=999b6950c644266bb871e79438751bdba2fa2a08

 src/mesa/drivers/dri/common/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index ccdc971..08e0d79 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -522,7 +522,8 @@ driQueryRendererIntegerCommon(__DRIscreen *psp, int param, unsigned int *value)
    }
    case __DRI2_RENDERER_PREFERRED_PROFILE:
       value[0] = (psp->max_gl_core_version != 0)
-         ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
+         ? GLX_CONTEXT_CORE_PROFILE_BIT_ARB
+         : GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
       return 0;
    case __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION:
       value[0] = psp->max_gl_core_version / 10;
-- 
2.1.4



More information about the mesa-dev mailing list