diff options
author | Christian König <[email protected]> | 2012-02-26 12:40:47 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:22 +0100 |
commit | 494e0025d995fb2cab04474d13880ee438b0c868 (patch) | |
tree | e0f2db9d28c2c3deaeda3a48cbd646811b3aaf64 | |
parent | a0571b135ef2fdc9ade78b476e0af154f0f8a1f6 (diff) |
st/vdpau: implement OutputSurfacePutBitsNative
Signed-off-by: Christian König <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/vdpau/bitmap.c | 15 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 21 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 22 |
3 files changed, 43 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c index abd745ae1c6..a02bb941ff4 100644 --- a/src/gallium/state_trackers/vdpau/bitmap.c +++ b/src/gallium/state_trackers/vdpau/bitmap.c @@ -179,20 +179,7 @@ vlVdpBitmapSurfacePutBitsNative(VdpBitmapSurface surface, vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL); - dst_box.x = 0; - dst_box.y = 0; - dst_box.z = 0; - dst_box.width = vlsurface->sampler_view->texture->width0; - dst_box.height = vlsurface->sampler_view->texture->height0; - dst_box.depth = 1; - - if (destination_rect) { - dst_box.x = MIN2(destination_rect->x0, destination_rect->x1); - dst_box.y = MIN2(destination_rect->y0, destination_rect->y1); - dst_box.width = abs(destination_rect->x1 - destination_rect->x0); - dst_box.height = abs(destination_rect->y1 - destination_rect->y0); - } - + dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture); pipe->transfer_inline_write(pipe, vlsurface->sampler_view->texture, 0, PIPE_TRANSFER_WRITE, &dst_box, *source_data, *source_pitches, 0); diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 873edac4962..c5d26895583 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -186,7 +186,26 @@ vlVdpOutputSurfacePutBitsNative(VdpOutputSurface surface, uint32_t const *source_pitches, VdpRect const *destination_rect) { - return VDP_STATUS_NO_IMPLEMENTATION; + vlVdpOutputSurface *vlsurface; + struct pipe_box dst_box; + struct pipe_context *pipe; + + vlsurface = vlGetDataHTAB(surface); + if (!vlsurface) + return VDP_STATUS_INVALID_HANDLE; + + pipe = vlsurface->device->context; + if (!pipe) + return VDP_STATUS_INVALID_HANDLE; + + vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL); + + dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture); + pipe->transfer_inline_write(pipe, vlsurface->sampler_view->texture, 0, + PIPE_TRANSFER_WRITE, &dst_box, *source_data, + *source_pitches, 0); + + return VDP_STATUS_OK; } /** diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index b72a7d642ff..c12f36f20ce 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -285,6 +285,28 @@ RectToPipe(const VdpRect *src, struct u_rect *dst) return NULL; } +static inline struct pipe_box +RectToPipeBox(const VdpRect *rect, struct pipe_resource *res) +{ + struct pipe_box box; + + box.x = 0; + box.y = 0; + box.z = 0; + box.width = res->width0; + box.height = res->height0; + box.depth = 1; + + if (rect) { + box.x = MIN2(rect->x0, rect->x1); + box.y = MIN2(rect->y0, rect->y1); + box.width = abs(rect->x1 - rect->x0); + box.height = abs(rect->y1 - rect->y0); + } + + return box; +} + typedef struct { struct vl_screen *vscreen; |