diff options
author | Philip Lorenz <philip@bithub.de> | 2012-09-02 17:58:09 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-09-14 18:11:57 +0200 |
commit | ca895d6710122afe20996bedabbbc8c0fa895a90 (patch) | |
tree | c46e917961993e5ead6703316fce78ab81ad13d9 | |
parent | a9c34c30f98aa6ded1267372743fc9f53da1a95b (diff) |
glx: call VDPAUInitNV for each newly created context.
VDPAUInitNV must be called in each context in which VDPAU extensions are
to be used. This enables multiple playback streams from one process with
different VDPAU devices and also fixes rendering to different surfaces
on the same VDPAU device.
-rw-r--r-- | src/utils_glx.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/utils_glx.c b/src/utils_glx.c index 3712bbc..b73dd99 100644 --- a/src/utils_glx.c +++ b/src/utils_glx.c @@ -1228,18 +1228,13 @@ gl_unbind_framebuffer_object(GLFramebufferObject *fbo) return 1; } -/* VDPAU/GL data */ -static pthread_mutex_t gl_vdpau_mutex = PTHREAD_MUTEX_INITIALIZER; -static VdpDevice gl_vdpau_device = VDP_INVALID_HANDLE; -static unsigned int gl_vdpau_refcount; - /** * gl_vdpau_init: * @device: a #VdpDevice * @get_proc_address: the #VdpGetProcAddress generated during * #VdpDevice creation * - * Informs the GL which VDPAU device to interact with. + * Informs the GL context which VDPAU device to interact with. * * Return value: 1 on success */ @@ -1251,21 +1246,15 @@ gl_vdpau_init(VdpDevice device, VdpGetProcAddress get_proc_address) if (!gl_vtable || !gl_vtable->has_vdpau_interop) return 0; - if (gl_vdpau_device != VDP_INVALID_HANDLE && gl_vdpau_device != device) - return 0; + gl_vtable->gl_vdpau_init((void *)(uintptr_t)device, get_proc_address); - pthread_mutex_lock(&gl_vdpau_mutex); - gl_vdpau_device = device; - if (gl_vdpau_refcount++ == 0) - gl_vtable->gl_vdpau_init((void *)(uintptr_t)device, get_proc_address); - pthread_mutex_unlock(&gl_vdpau_mutex); return 1; } /** * gl_vdpau_exit: * - * Disposes the VDPAU/GL interact functionality. + * Disposes the VDPAU/GL interact functionality for the current context. */ void gl_vdpau_exit(void) @@ -1275,10 +1264,7 @@ gl_vdpau_exit(void) if (!gl_vtable || !gl_vtable->has_vdpau_interop) return; - pthread_mutex_lock(&gl_vdpau_mutex); - if (--gl_vdpau_refcount == 0) - gl_vtable->gl_vdpau_fini(); - pthread_mutex_unlock(&gl_vdpau_mutex); + gl_vtable->gl_vdpau_fini(); } /** |