[Mesa-dev] [PATCH 05/10] Support of RENDER_TYPE property [5/7] Storing the RENDER_TYPE in indirect rendering.

Tomasz Lis listom at gmail.com
Wed Jul 17 04:49:18 PDT 2013


glx: Storing the RENDER_TYPE in indirect rendering.

The change allows to store RENDER_TYPE value in GLX context
when indirect rendering is in use.
---
 src/glx/create_context.c |    4 +++-
 src/glx/glxclient.h      |    7 +++++++
 src/glx/glxcmds.c        |    1 -
 src/glx/indirect_glx.c   |   29 +++++++++++++++++++----------
 4 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/glx/create_context.c b/src/glx/create_context.c
index a755e83..38e949a 100644
--- a/src/glx/create_context.c
+++ b/src/glx/create_context.c
@@ -84,7 +84,9 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
 #ifdef GLX_USE_APPLEGL
       gc = applegl_create_context(psc, cfg, share, 0);
 #else
-      gc = indirect_create_context(psc, cfg, share, 0);
+      gc = indirect_create_context_attribs(psc, cfg, share, num_attribs,
+              (const uint32_t *) attrib_list,
+              &dummy_err);
 #endif
    }
 
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 3e9b730..fc8f31c 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -817,5 +817,12 @@ extern struct glx_context *
 indirect_create_context(struct glx_screen *psc,
 			struct glx_config *mode,
 			struct glx_context *shareList, int renderType);
+extern struct glx_context *
+indirect_create_context_attribs(struct glx_screen *base,
+				struct glx_config *config_base,
+				struct glx_context *shareList,
+				unsigned num_attribs,
+				const uint32_t *attribs,
+				unsigned *error);
 
 #endif /* !__GLX_client_h__ */
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 300d681..352b75c 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -344,7 +344,6 @@ CreateContext(Display *dpy, int generic_id, struct glx_config *config,
 
    gc->share_xid = shareList ? shareList->xid : None;
    gc->imported = GL_FALSE;
-   gc->renderType = renderType;
 
    return (GLXContext) gc;
 }
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index ff869e2..47e514d 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -32,6 +32,7 @@
 
 #include "glapi.h"
 #include "glxclient.h"
+#include "dri_common.h"
 
 extern struct _glapi_table *__glXNewIndirectAPI(void);
 
@@ -362,6 +363,8 @@ indirect_create_context(struct glx_screen *psc,
    gc->isDirect = GL_FALSE;
    gc->vtable = &indirect_context_vtable;
    state = calloc(1, sizeof(struct __GLXattributeRec));
+   gc->renderType = renderType;
+
    if (state == NULL) {
       /* Out of memory */
       free(gc);
@@ -430,7 +433,7 @@ indirect_create_context(struct glx_screen *psc,
    return gc;
 }
 
-static struct glx_context *
+_X_HIDDEN struct glx_context *
 indirect_create_context_attribs(struct glx_screen *base,
 				struct glx_config *config_base,
 				struct glx_context *shareList,
@@ -438,18 +441,24 @@ indirect_create_context_attribs(struct glx_screen *base,
 				const uint32_t *attribs,
 				unsigned *error)
 {
-   /* All of the attribute validation for indirect contexts is handled on the
-    * server, so there's not much to do here.
-    */
-   (void) num_attribs;
-   (void) attribs;
+    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;
 
-   /* The error parameter is only used on the server so that correct GLX
-    * protocol errors can be generated.  On the client, it can be ignored.
+   /* All of the attribute validation for indirect contexts is handled on the
+    * server, so there's not much to do here. Still, we need to parse the attributes
+    * to correctly set renderType.
     */
-   (void) error;
+    if (!dri2_convert_glx_attribs(num_attribs, attribs,
+             &major_ver, &minor_ver, &renderType, &flags,
+             &api, &reset, error)) {
+        return NULL;
+    }
 
-   return indirect_create_context(base, config_base, shareList, 0);
+   return indirect_create_context(base, config_base, shareList, renderType);
 }
 
 struct glx_screen_vtable indirect_screen_vtable = {
-- 
1.7.9.5



More information about the mesa-dev mailing list