st/vdpau: fix background handling in the mixer
authorChristian König <christian.koenig@amd.com>
Tue, 30 Apr 2013 12:55:14 +0000 (14:55 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 1 May 2013 11:33:46 +0000 (13:33 +0200)
Signed-off-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/vdpau/mixer.c

index 1d2ae497b0704ce0a22ccfeb53dcd2b235559832..26db5c8bd8b3eb557e2ec6c13fbb8eb585bc1471 100644 (file)
@@ -221,7 +221,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
 
    vlVdpVideoMixer *vmixer;
    vlVdpSurface *surf;
-   vlVdpOutputSurface *dst;
+   vlVdpOutputSurface *dst, *bg = NULL;
 
    struct vl_compositor *compositor;
 
@@ -250,20 +250,21 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    if (!dst)
       return VDP_STATUS_INVALID_HANDLE;
 
-   pipe_mutex_lock(vmixer->device->mutex);
-   vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
    if (background_surface != VDP_INVALID_HANDLE) {
-      vlVdpOutputSurface *bg = vlGetDataHTAB(background_surface);
-      if (!bg) {
-         pipe_mutex_unlock(vmixer->device->mutex);
+      bg = vlGetDataHTAB(background_surface);
+      if (!bg)
          return VDP_STATUS_INVALID_HANDLE;
-      }
-      vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view,
-                                   RectToPipe(background_source_rect, &rect), NULL, NULL);
    }
 
+   pipe_mutex_lock(vmixer->device->mutex);
+   vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
+
    vl_compositor_clear_layers(&vmixer->cstate);
 
+   if (bg)
+      vl_compositor_set_rgba_layer(&vmixer->cstate, compositor, layer++, bg->sampler_view,
+                                   RectToPipe(background_source_rect, &rect), NULL, NULL);
+
    switch (current_picture_structure) {
    case VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD:
       deinterlace = VL_COMPOSITOR_BOB_TOP;