Mesa (master): st/vdpau: Respect source_rect in VideoMixerRender

Christian König deathsimple at kemper.freedesktop.org
Mon Aug 29 01:17:25 PDT 2011


Module: Mesa
Branch: master
Commit: ddd25cfbb05582963fc15a7ade1a9c5cd4a3ed27
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddd25cfbb05582963fc15a7ade1a9c5cd4a3ed27

Author: Christian König <deathsimple at vodafone.de>
Date:   Sun Aug 28 13:52:44 2011 +0200

st/vdpau: Respect source_rect in VideoMixerRender

Fixing a bug reported by Andy Furniss.

---

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

diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index fbd24a2..5c3c6c6 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -139,6 +139,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
                                 uint32_t layer_count,
                                 VdpLayer const *layers)
 {
+   struct pipe_video_rect src_rect, *p_src_rect = NULL;
+
    vlVdpVideoMixer *vmixer;
    vlVdpSurface *surf;
    vlVdpOutputSurface *dst;
@@ -155,8 +157,16 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    if (!dst)
       return VDP_STATUS_INVALID_HANDLE;
 
+   if (video_source_rect) {
+      src_rect.x = MIN2(video_source_rect->x1, video_source_rect->x0);
+      src_rect.y = MIN2(video_source_rect->y1, video_source_rect->y0);
+      src_rect.w = abs(video_source_rect->x1 - video_source_rect->x0);
+      src_rect.h = abs(video_source_rect->y1 - video_source_rect->y0);
+      p_src_rect = &src_rect;
+   }
+
    vl_compositor_clear_layers(&vmixer->compositor);
-   vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer, NULL, NULL);
+   vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer, p_src_rect, NULL);
    vl_compositor_render(&vmixer->compositor, dst->surface, NULL, NULL);
 
    return VDP_STATUS_OK;



More information about the mesa-commit mailing list