diff options
author | Tomasz Lis <[email protected]> | 2013-07-17 13:49:18 +0200 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-07-18 16:03:42 -0700 |
commit | 27c8aa5cfbcf6f2ad21564dfcdabbe747c277cab (patch) | |
tree | 6a63a21b1770cebeeed83a94438f17083776b719 | |
parent | 1c748dff6b13ff127c02790fa6078cc68eb42291 (diff) |
glx: Store the RENDER_TYPE in indirect rendering
v2 (idr): Open-code the check for GLX_RENDER_TYPE.
dri2_convert_glx_attribs can't be called from here because that function
only exists in direct-rendering builds. Also add a stub version of
indirect_create_context_attribs to tests/fake_glx_screen.cpp to prevent
'make check' regressions.
Signed-off-by: Tomasz Lis <[email protected]>
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/glx/create_context.c | 4 | ||||
-rw-r--r-- | src/glx/glxclient.h | 7 | ||||
-rw-r--r-- | src/glx/glxcmds.c | 1 | ||||
-rw-r--r-- | src/glx/indirect_glx.c | 22 | ||||
-rw-r--r-- | src/glx/tests/fake_glx_screen.cpp | 17 | ||||
-rw-r--r-- | src/glx/tests/fake_glx_screen.h | 15 |
6 files changed, 41 insertions, 25 deletions
diff --git a/src/glx/create_context.c b/src/glx/create_context.c index a755e83f448..38e949ab4cd 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 3e9b730e54a..5b99e093d01 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 415e7849742..f6eb07df192 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 ff869e2dc8f..11e92979156 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -362,6 +362,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 +432,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 +440,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; + int renderType = GLX_RGBA_TYPE; + unsigned i; /* 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. */ (void) error; - return indirect_create_context(base, config_base, shareList, 0); + /* 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. + */ + for (i = 0; i < num_attribs; i++) { + if (attribs[i * 2] == GLX_RENDER_TYPE) + renderType = attribs[i * 2 + 1]; + } + + return indirect_create_context(base, config_base, shareList, renderType); } struct glx_screen_vtable indirect_screen_vtable = { diff --git a/src/glx/tests/fake_glx_screen.cpp b/src/glx/tests/fake_glx_screen.cpp index 12d003b84f7..845084faa0f 100644 --- a/src/glx/tests/fake_glx_screen.cpp +++ b/src/glx/tests/fake_glx_screen.cpp @@ -24,7 +24,7 @@ struct glx_screen_vtable fake_glx_screen::vt = { indirect_create_context, - fake_glx_context::create_attribs + indirect_create_context_attribs }; struct glx_screen_vtable fake_glx_screen_direct::vt = { @@ -55,3 +55,18 @@ indirect_create_context(struct glx_screen *psc, struct glx_config *mode, return new fake_glx_context(psc, mode); } + +extern "C" 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) +{ + (void) num_attribs; + (void) attribs; + (void) error; + + return indirect_create_context(base, config_base, shareList, 0); +} diff --git a/src/glx/tests/fake_glx_screen.h b/src/glx/tests/fake_glx_screen.h index 6aa6cb68fe9..0249e79bcff 100644 --- a/src/glx/tests/fake_glx_screen.h +++ b/src/glx/tests/fake_glx_screen.h @@ -88,21 +88,6 @@ public: contexts_allocated--; } - static glx_context *create_attribs(struct glx_screen *psc, - struct glx_config *mode, - struct glx_context *shareList, - unsigned num_attribs, - const uint32_t *attribs, - unsigned *error) - { - (void) shareList; - (void) num_attribs; - (void) attribs; - - *error = 0; - return new fake_glx_context(psc, mode); - } - /** Number of context that are allocated (and not freed). */ static int contexts_allocated; |