Mesa (master): glx: Retrieve the value of RENDER_TYPE from GLX attribs array

Ian Romanick idr at kemper.freedesktop.org
Thu Jul 18 23:03:17 UTC 2013


Module: Mesa
Branch: master
Commit: f6815af5b19610c37ef9678869c96578acf63784
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6815af5b19610c37ef9678869c96578acf63784

Author: Tomasz Lis <tomasz.lis at intel.com>
Date:   Wed Jul 17 13:49:15 2013 +0200

glx: Retrieve the value of RENDER_TYPE from GLX attribs array

Make sure that context creation routines are provided with the value of
RENDER_TYPE retrieved from GLX attribs.

v2 (idr): Minor formatting changes.  Change type of
dri2_convert_glx_attribs render_type parameter to uint32_t to silence
some GCC warnings.

Signed-off-by: Tomasz Lis <tomasz.lis at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glx/dri2_glx.c   |    4 ++--
 src/glx/dri_common.c |   12 ++++++------
 src/glx/dri_common.h |    6 +++---
 src/glx/drisw_glx.c  |    4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index cc75b91..9581bff 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -273,8 +273,8 @@ dri2_create_context_attribs(struct glx_screen *base,
    /* Remap the GLX tokens to DRI2 tokens.
     */
    if (!dri2_convert_glx_attribs(num_attribs, attribs,
-				 &major_ver, &minor_ver, &flags, &api, &reset,
-                                 error))
+                                 &major_ver, &minor_ver, &renderType, &flags,
+                                 &api, &reset, error))
       goto error_exit;
 
    if (shareList) {
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 1bf20ec..32625e8 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -456,14 +456,13 @@ driReleaseDrawables(struct glx_context *gc)
 
 _X_HIDDEN bool
 dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
-			 unsigned *major_ver, unsigned *minor_ver,
-			 uint32_t *flags, unsigned *api, int *reset,
-                         unsigned *error)
+                         unsigned *major_ver, unsigned *minor_ver,
+                         uint32_t *render_type, uint32_t *flags, unsigned *api,
+                         int *reset, unsigned *error)
 {
    unsigned i;
    bool got_profile = false;
    uint32_t profile;
-   int render_type = GLX_RGBA_TYPE;
 
    if (num_attribs == 0) {
       *api = __DRI_API_OPENGL;
@@ -479,6 +478,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
 
    *major_ver = 1;
    *minor_ver = 0;
+   *render_type = GLX_RGBA_TYPE;
    *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
 
    for (i = 0; i < num_attribs; i++) {
@@ -497,7 +497,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
 	 got_profile = true;
 	 break;
       case GLX_RENDER_TYPE:
-	 render_type = attribs[i * 2 + 1];
+         *render_type = attribs[i * 2 + 1];
 	 break;
       case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
          switch (attribs[i * 2 + 1]) {
@@ -568,7 +568,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
       return false;
    }
 
-   if (*major_ver >= 3 && render_type == GLX_COLOR_INDEX_TYPE) {
+   if (*major_ver >= 3 && *render_type == GLX_COLOR_INDEX_TYPE) {
       *error = __DRI_CTX_ERROR_BAD_FLAG;
       return false;
    }
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
index 93cd744..2bbffa9 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -71,8 +71,8 @@ extern void *driOpenDriver(const char *driverName);
 
 extern bool
 dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
-			 unsigned *major_ver, unsigned *minor_ver,
-			 uint32_t *flags, unsigned *api, int *reset,
-			 unsigned *error);
+                         unsigned *major_ver, unsigned *minor_ver,
+                         uint32_t *render_type, uint32_t *flags, unsigned *api,
+                         int *reset, unsigned *error);
 
 #endif /* _DRI_COMMON_H */
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 80ddf9c..2c3e8b5 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -447,8 +447,8 @@ drisw_create_context_attribs(struct glx_screen *base,
    /* Remap the GLX tokens to DRI2 tokens.
     */
    if (!dri2_convert_glx_attribs(num_attribs, attribs,
-				 &major_ver, &minor_ver, &flags, &api, &reset,
-				 error))
+                                 &major_ver, &minor_ver, &renderType, &flags,
+                                 &api, &reset, error))
       return NULL;
 
    if (reset != __DRI_CTX_RESET_NO_NOTIFICATION)




More information about the mesa-commit mailing list