mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 22:46:24 +00:00
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.
This commit is contained in:
parent
753a56e9a1
commit
e52def4737
1 changed files with 14 additions and 7 deletions
|
@ -309,8 +309,15 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
|
||||||
if (!cs)
|
if (!cs)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cs->display = dpy;
|
if (parent) {
|
||||||
cs->window = parent ? parent->window : None;
|
cs->display = parent->display;
|
||||||
|
cs->window = parent->window;
|
||||||
|
screen = DefaultScreen(parent->display);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cs->display = dpy;
|
||||||
|
cs->window = None;
|
||||||
|
}
|
||||||
cs->visual = NULL;
|
cs->visual = NULL;
|
||||||
cs->context = NULL;
|
cs->context = NULL;
|
||||||
cs->swapped_buffers = FALSE;
|
cs->swapped_buffers = FALSE;
|
||||||
|
@ -327,14 +334,14 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
|
||||||
if (fbconfig_id == GLX_DONT_CARE)
|
if (fbconfig_id == GLX_DONT_CARE)
|
||||||
goto choose_fbconfig;
|
goto choose_fbconfig;
|
||||||
|
|
||||||
fbconfigs = glXGetFBConfigs(dpy, screen, &n_fbconfigs);
|
fbconfigs = glXGetFBConfigs(parent->display, screen, &n_fbconfigs);
|
||||||
if (!fbconfigs)
|
if (!fbconfigs)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Find out a GLXFBConfig compatible with the parent context */
|
/* Find out a GLXFBConfig compatible with the parent context */
|
||||||
for (n = 0; n < n_fbconfigs; n++) {
|
for (n = 0; n < n_fbconfigs; n++) {
|
||||||
status = glXGetFBConfigAttrib(
|
status = glXGetFBConfigAttrib(
|
||||||
dpy,
|
parent->display,
|
||||||
fbconfigs[n],
|
fbconfigs[n],
|
||||||
GLX_FBCONFIG_ID, &val
|
GLX_FBCONFIG_ID, &val
|
||||||
);
|
);
|
||||||
|
@ -347,7 +354,7 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
|
||||||
else {
|
else {
|
||||||
choose_fbconfig:
|
choose_fbconfig:
|
||||||
fbconfigs = glXChooseFBConfig(
|
fbconfigs = glXChooseFBConfig(
|
||||||
dpy,
|
cs->display,
|
||||||
screen,
|
screen,
|
||||||
fbconfig_attrs, &n_fbconfigs
|
fbconfig_attrs, &n_fbconfigs
|
||||||
);
|
);
|
||||||
|
@ -358,9 +365,9 @@ gl_create_context(Display *dpy, int screen, GLContextState *parent)
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cs->visual = glXGetVisualFromFBConfig(dpy, fbconfigs[n]);
|
cs->visual = glXGetVisualFromFBConfig(cs->display, fbconfigs[n]);
|
||||||
cs->context = glXCreateNewContext(
|
cs->context = glXCreateNewContext(
|
||||||
dpy,
|
cs->display,
|
||||||
fbconfigs[n],
|
fbconfigs[n],
|
||||||
GLX_RGBA_TYPE,
|
GLX_RGBA_TYPE,
|
||||||
parent ? parent->context : NULL,
|
parent ? parent->context : NULL,
|
||||||
|
|
Loading…
Reference in a new issue