[Mesa-dev] [PATCH 2/8] Support of RENDER_TYPE property [2/6] Retrieving the value of RENDER_TYPE from GLX attribs array.

Tomasz Lis listom at gmail.com
Mon Jul 15 07:28:33 PDT 2013


This change makes sure that context creation routines are provided
with the value of RENDER_TYPE retrieved from GLX attribs.
---
 src/glx/dri2_glx.c   |    3 ++-
 src/glx/dri_common.c |    8 ++++----
 src/glx/dri_common.h |    2 +-
 src/glx/drisw_glx.c  |    2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 630dbd9..d60c675 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -258,6 +258,7 @@ dri2_create_context_attribs(struct glx_screen *base,
 
    uint32_t minor_ver = 1;
    uint32_t major_ver = 2;
+   uint32_t renderType = GLX_RGBA_TYPE;
    uint32_t flags = 0;
    unsigned api;
    int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
@@ -272,7 +273,7 @@ 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,
+				 &major_ver, &minor_ver, &renderType, &flags, &api, &reset,
                                  error))
       goto error_exit;
 
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 1bf20ec..7ab303e 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,
+			 unsigned *major_ver, unsigned *minor_ver, int *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..86b0eba 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -71,7 +71,7 @@ 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,
+			 unsigned *major_ver, unsigned *minor_ver, int *render_type,
 			 uint32_t *flags, unsigned *api, int *reset,
 			 unsigned *error);
 
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 80ddf9c..ef0e52b 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -447,7 +447,7 @@ 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,
+				 &major_ver, &minor_ver, &renderType, &flags, &api, &reset,
 				 error))
       return NULL;
 
-- 
1.7.9.5



More information about the mesa-dev mailing list