[Mesa-dev] [PATCH 2/2] vdpau: Handle destination rectangles correctly

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Dec 2 09:29:21 PST 2011


The brokenness in vlVdpVideoMixerRender was compensating for
brokenness in vlVdpPresentationQueueDisplay, so fix both at
the same time.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>
---
 src/gallium/state_trackers/vdpau/mixer.c        |   22 +++++++++++++++++-----
 src/gallium/state_trackers/vdpau/presentation.c |    4 ++--
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index ed5a646..b4e07cc 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -152,11 +152,12 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
                                 uint32_t layer_count,
                                 VdpLayer const *layers)
 {
-   struct pipe_video_rect src_rect;
+   struct pipe_video_rect src_rect, dst_rect;
 
    vlVdpVideoMixer *vmixer;
    vlVdpSurface *surf;
-   vlVdpOutputSurface *dst;
+   vlVdpOutputSurface *dst, *bg;
+   unsigned layer = 0;
 
    vmixer = vlGetDataHTAB(mixer);
    if (!vmixer)
@@ -171,10 +172,21 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
       return VDP_STATUS_INVALID_HANDLE;
 
    vl_compositor_clear_layers(&vmixer->compositor);
-   vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer,
-                                  RectToPipe(video_source_rect, &src_rect), NULL);
-   vl_compositor_render(&vmixer->compositor, dst->surface, NULL, NULL, false);
+   vl_compositor_reset_dirty_area(&vmixer->compositor);
+   if (background_surface != VDP_INVALID_HANDLE) {
+      bg = vlGetDataHTAB(background_surface);
+      if (!bg)
+         return VDP_STATUS_INVALID_HANDLE;
+      vl_compositor_set_rgba_layer(&vmixer->compositor, layer++, bg->sampler_view,
+                                   RectToPipe(background_source_rect, &src_rect), NULL);
+   }
+   vl_compositor_set_buffer_layer(&vmixer->compositor, layer, surf->video_buffer,
+                                  RectToPipe(video_source_rect, &src_rect),
+                                  RectToPipe(destination_video_rect, &dst_rect));
+   vl_compositor_render(&vmixer->compositor, dst->surface, NULL,
+                        RectToPipe(destination_rect, &dst_rect), !layer);
 
+   assert(!layer_count);
    return VDP_STATUS_OK;
 }
 
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index 888cf31..aba81b2 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -233,8 +233,8 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
    vo_rect.h = clip_height;
 
    vl_compositor_clear_layers(&pq->compositor);
-   vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, NULL, NULL);
-   vl_compositor_render(&pq->compositor, drawable_surface, NULL, &vo_rect, true);
+   vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, &vo_rect, NULL);
+   vl_compositor_render(&pq->compositor, drawable_surface, NULL, NULL, true);
 
    pipe = pq->device->context->pipe;
 
-- 
1.7.7.3





More information about the mesa-dev mailing list