Mesa (pipe-video): vdpau: Implement basic output functionality

Christian König deathsimple at kemper.freedesktop.org
Fri Apr 8 23:40:17 UTC 2011


Module: Mesa
Branch: pipe-video
Commit: cae77aa80b3629a147ce3ae4526646014efae595
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cae77aa80b3629a147ce3ae4526646014efae595

Author: Christian König <deathsimple at vodafone.de>
Date:   Sat Apr  9 01:32:25 2011 +0200

vdpau: Implement basic output functionality

Even with totally wrong color space conversion
we finally se a picture with VDPAU. Yeah!

---

 src/gallium/state_trackers/vdpau/presentation.c  |   32 +++++++++++++++++++++-
 src/gallium/state_trackers/vdpau/surface.c       |    2 +-
 src/gallium/state_trackers/vdpau/vdpau_private.h |    1 +
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index fadc57e..fdd0144 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -69,6 +69,7 @@ vlVdpPresentationQueueCreate(VdpDevice device,
 
    pq->device = dev;
    pq->compositor = context->create_compositor(context);
+   pq->drawable = pqt->drawable;
    if (!pq->compositor) {
       ret = VDP_STATUS_ERROR;
       goto no_compositor;
@@ -130,7 +131,36 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
                               uint32_t clip_height,
                               VdpTime  earliest_presentation_time)
 {
-   return VDP_STATUS_NO_IMPLEMENTATION;
+   vlVdpPresentationQueue *pq;
+   vlVdpOutputSurface *surf;
+   struct pipe_surface *drawable_surface;
+
+   pq = vlGetDataHTAB(presentation_queue);
+   if (!pq)
+      return VDP_STATUS_INVALID_HANDLE;
+
+   drawable_surface = vl_drawable_surface_get(pq->device->context, pq->drawable);
+   if (!drawable_surface)
+      return VDP_STATUS_INVALID_HANDLE;
+
+   surf = vlGetDataHTAB(surface);
+   if (!surf)
+      return VDP_STATUS_INVALID_HANDLE;
+
+   pq->compositor->clear_layers(pq->compositor);
+   pq->compositor->set_rgba_layer(pq->compositor, 0, surf->sampler_view, NULL, NULL);
+   pq->compositor->render_picture(pq->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
+                                  drawable_surface, NULL, NULL);
+
+   pq->device->context->vpipe->screen->flush_frontbuffer
+   (
+      pq->device->context->vpipe->screen,
+      drawable_surface->texture,
+      0, 0,
+      vl_contextprivate_get(pq->device->context, drawable_surface)
+   );
+
+   return VDP_STATUS_OK;
 }
 
 VdpStatus
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 496f647..f0aafae 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -182,7 +182,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
 
    for (i = 0; i < 3; ++i) { //TODO put nr of planes into util format
       struct pipe_sampler_view *sv = sampler_views[i];
-      struct pipe_box dst_box = { 0, 0, sv->texture->width0, sv->texture->height0 };
+      struct pipe_box dst_box = { 0, 0, 0, sv->texture->width0, sv->texture->height0, 1 };
       context->upload_sampler(context, sv, &dst_box, source_data[i], source_pitches[i], 0, 0);
    }
 
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 25f289a..bd77507 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -183,6 +183,7 @@ typedef struct
 typedef struct
 {
    vlVdpDevice *device;
+   Drawable drawable;
    struct pipe_video_compositor *compositor;
 } vlVdpPresentationQueue;
 




More information about the mesa-commit mailing list