summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-24 10:58:32 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-07-25 15:23:50 +0200
commite8937aca0c89447bcb4a1cd37602fbd259340b44 (patch)
tree68af2bd19eb1a60d2cf5be6981aa1d1471eeef35
parentb06a921d6b648da838f72279a24a657f27b93abf (diff)
downloadgst-vaapi-e8937aca0c89447bcb4a1cd37602fbd259340b44.tar.gz
utils: fix gl_create_context() with parent context set.
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.
-rw-r--r--NEWS1
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_glx.c21
2 files changed, 15 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 6f0bb885..eddd6eee 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Copyright (C) 2011 Collabora
Version 0.3.8 - DD.Jul.2012
* Disable FFmpeg-based decoders by default
+* Fix GLX rendering with FBO + texture-from-pixmap (fallback for VA/GLX)
Version 0.3.7 - 26.Jun.2012
* Fix vaapidecode to report unsupported codec profiles
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_glx.c b/gst-libs/gst/vaapi/gstvaapiutils_glx.c
index bf7c3580..38211813 100644
--- a/gst-libs/gst/vaapi/gstvaapiutils_glx.c
+++ b/gst-libs/gst/vaapi/gstvaapiutils_glx.c
@@ -309,8 +309,15 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
if (!cs)
goto error;
- cs->display = dpy;
- cs->window = parent ? parent->window : None;
+ if (parent) {
+ cs->display = parent->display;
+ cs->window = parent->window;
+ screen = DefaultScreen(parent->display);
+ }
+ else {
+ cs->display = dpy;
+ cs->window = None;
+ }
cs->visual = NULL;
cs->context = NULL;
cs->swapped_buffers = FALSE;
@@ -327,14 +334,14 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
if (fbconfig_id == GLX_DONT_CARE)
goto choose_fbconfig;
- fbconfigs = glXGetFBConfigs(dpy, screen, &n_fbconfigs);
+ fbconfigs = glXGetFBConfigs(parent->display, screen, &n_fbconfigs);
if (!fbconfigs)
goto error;
/* Find out a GLXFBConfig compatible with the parent context */
for (n = 0; n < n_fbconfigs; n++) {
status = glXGetFBConfigAttrib(
- dpy,
+ parent->display,
fbconfigs[n],
GLX_FBCONFIG_ID, &val
);
@@ -347,7 +354,7 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
else {
choose_fbconfig:
fbconfigs = glXChooseFBConfig(
- dpy,
+ cs->display,
screen,
fbconfig_attrs, &n_fbconfigs
);
@@ -358,9 +365,9 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
n = 0;
}
- cs->visual = glXGetVisualFromFBConfig(dpy, fbconfigs[n]);
+ cs->visual = glXGetVisualFromFBConfig(cs->display, fbconfigs[n]);
cs->context = glXCreateNewContext(
- dpy,
+ cs->display,
fbconfigs[n],
GLX_RGBA_TYPE,
parent ? parent->context : NULL,