vdpau: Implement basic output functionality
authorChristian König <deathsimple@vodafone.de>
Fri, 8 Apr 2011 23:32:25 +0000 (01:32 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 8 Apr 2011 23:34:02 +0000 (01:34 +0200)
Even with totally wrong color space conversion
we finally se a picture with VDPAU. Yeah!

src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/vdpau/surface.c
src/gallium/state_trackers/vdpau/vdpau_private.h

index fadc57e70c024137ce3eeb3eebe96b72db18e16f..fdd0144fe22c04e98ce3f627843f39681962c31c 100644 (file)
@@ -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
index 496f647a8d0e3ddcbfbbf9eeaa1878fcc8271168..f0aafae79b5d3ca4c897a8476738959047cc0fa0 100644 (file)
@@ -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);
    }
 
index 25f289aa726e198bd4a46d83aebdc323304bb105..bd77507567f2a40e51eae75290c6772dbacdf429 100644 (file)
@@ -183,6 +183,7 @@ typedef struct
 typedef struct
 {
    vlVdpDevice *device;
+   Drawable drawable;
    struct pipe_video_compositor *compositor;
 } vlVdpPresentationQueue;