[Mesa-dev] [PATCH 3/3] vdpau: Add background surface support

Maarten Lankhorst m.b.lankhorst at gmail.com
Mon Dec 19 01:16:06 PST 2011


Sets rgba layer as zeroth layer if a custom background_surface is specified.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>

---
Can be applied without dependency on previous 2 patches in this series

 src/gallium/state_trackers/vdpau/mixer.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index a05ad57..cd15739 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -209,6 +209,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
 {
    struct pipe_video_rect src_rect, dst_rect, dst_clip;
    VdpStatus ret;
+   unsigned layer = 0;
 
    vlVdpVideoMixer *vmixer;
    vlVdpSurface *surf;
@@ -231,8 +232,16 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    if (!dst)
       return VDP_STATUS_INVALID_HANDLE;
 
+   if (background_surface != VDP_INVALID_HANDLE) {
+      vlVdpOutputSurface *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_clear_layers(&vmixer->compositor);
-   vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer,
+   vl_compositor_set_buffer_layer(&vmixer->compositor, layer, surf->video_buffer,
                                   RectToPipe(video_source_rect, &src_rect), NULL);
    vl_compositor_render(&vmixer->compositor, dst->surface,
                         RectToPipe(destination_video_rect, &dst_rect),
-- 
1.7.7.4





More information about the mesa-dev mailing list