diff options
author | Christian König <[email protected]> | 2012-02-26 00:29:59 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:21 +0100 |
commit | e44731265dbfde75f955283f2f720a1917da120b (patch) | |
tree | ba1d63d36462404ccb84789aed0a5ea44b592932 /src/gallium/state_trackers/vdpau | |
parent | 3aa087fa048dfda37ab247e2dbe4a809c2fac948 (diff) |
st/vdpau: implement BitmapSurfacePutBitsNative
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r-- | src/gallium/state_trackers/vdpau/bitmap.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c index ddfed7205b7..c2c8a448ce6 100644 --- a/src/gallium/state_trackers/vdpau/bitmap.c +++ b/src/gallium/state_trackers/vdpau/bitmap.c @@ -152,8 +152,37 @@ vlVdpBitmapSurfacePutBitsNative(VdpBitmapSurface surface, uint32_t const *source_pitches, VdpRect const *destination_rect) { - if (!(source_data && source_pitches && destination_rect)) + vlVdpBitmapSurface *vlsurface; + struct pipe_box dst_box; + struct pipe_context *pipe; + + vlsurface = vlGetDataHTAB(surface); + if (!vlsurface) + return VDP_STATUS_INVALID_HANDLE; + + if (!(source_data && source_pitches)) return VDP_STATUS_INVALID_POINTER; - return VDP_STATUS_NO_IMPLEMENTATION; + pipe = vlsurface->device->context; + + 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); + } + + pipe->transfer_inline_write(pipe, vlsurface->sampler_view->texture, 0, + PIPE_TRANSFER_WRITE, &dst_box, *source_data, + *source_pitches, 0); + return VDP_STATUS_OK; } |