summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/vdpau/surface.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2013-05-15 15:10:11 +0200
committerChristian König <christian.koenig@amd.com>2013-10-26 12:13:36 +0200
commit80964226e9b8a05c39157f9305c06c0b2861e080 (patch)
treec4f1c11f0f3e82e0b8167b8cba21de6694f2f9d9 /src/gallium/state_trackers/vdpau/surface.c
parent3d3a0b9b67982a96a4c4d87f78c21204f3a48776 (diff)
implement NV_vdpau_interop v7
v2: Actually implement interop between the gallium state tracker and the VDPAU backend. v3: Make it also available in non legacy contexts, fix video buffer sharing. v4: deny interop if we don't have the same screen object v5: rebased on upstream changes v6: implemented VDPAUGetSurfaceivNV, improved error handling, unregister all surfaces in VDPAUFiniNV v7: squash merge with Mareks changes Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/surface.c')
-rw-r--r--src/gallium/state_trackers/vdpau/surface.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 074363bdafb..cd798a21a32 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -469,3 +469,24 @@ vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf)
}
pipe->flush(pipe, NULL, 0);
}
+
+/**
+ * Interop to mesa state tracker
+ */
+struct pipe_video_buffer *vlVdpVideoSurfaceGallium(VdpVideoSurface surface)
+{
+ vlVdpSurface *p_surf = vlGetDataHTAB(surface);
+ if (!p_surf)
+ return NULL;
+
+ pipe_mutex_lock(p_surf->device->mutex);
+ if (p_surf->video_buffer == NULL) {
+ struct pipe_context *pipe = p_surf->device->context;
+
+ /* try to create a video buffer if we don't already have one */
+ p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
+ }
+ pipe_mutex_unlock(p_surf->device->mutex);
+
+ return p_surf->video_buffer;
+}