summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-26 15:30:28 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-06 18:58:09 +0200
commitd1d0fc48c0db01767ac347c75b276f269e6e0293 (patch)
tree8048b04a9565b68b1dfdc31568c16fbe183b7ddf
parent3b1d0a21d842eb7b534e96cc6e23f2850413e06d (diff)
glx: fix gl_create_context() with parent context set.{merged}/staging.03.misc_fixes
If GLX window was created from a foreign Display, then that same Display shall be used for subsequent glXMakeCurrent(). This means that gl_create_context() will now use the same Display that the parent, if available. This fixes cluttersink with the Intel GenX VA driver. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r--va/glx/va_glx_impl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
index 049be09..f317961 100644
--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -340,8 +340,14 @@ gl_create_context(VADriverContextP ctx, OpenGLContextStateP parent)
if (!cs)
goto error;
- cs->display = ctx->native_dpy;
- cs->window = parent ? parent->window : None;
+ if (parent) {
+ cs->display = parent->display;
+ cs->window = parent->window;
+ }
+ else {
+ cs->display = ctx->native_dpy;
+ cs->window = None;
+ }
cs->context = NULL;
if (parent && parent->context) {
@@ -357,8 +363,8 @@ gl_create_context(VADriverContextP ctx, OpenGLContextStateP parent)
goto choose_fbconfig;
fbconfigs = glXGetFBConfigs(
- ctx->native_dpy,
- ctx->x11_screen,
+ parent->display,
+ DefaultScreen(parent->display),
&n_fbconfigs
);
if (!fbconfigs)
@@ -367,7 +373,7 @@ gl_create_context(VADriverContextP ctx, OpenGLContextStateP parent)
/* Find out a GLXFBConfig compatible with the parent context */
for (n = 0; n < n_fbconfigs; n++) {
status = glXGetFBConfigAttrib(
- ctx->native_dpy,
+ cs->display,
fbconfigs[n],
GLX_FBCONFIG_ID, &val
);
@@ -392,7 +398,7 @@ gl_create_context(VADriverContextP ctx, OpenGLContextStateP parent)
}
cs->context = glXCreateNewContext(
- ctx->native_dpy,
+ cs->display,
fbconfigs[n],
GLX_RGBA_TYPE,
parent ? parent->context : NULL,