diff options
author | Christian König <[email protected]> | 2012-01-30 18:04:50 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-02-06 10:35:58 +0100 |
commit | 8bfadc802f6c3c85de4c429b2a87d0bdb1705028 (patch) | |
tree | 45d4f3ae9ac7f752b1884ed841fd367c326cc817 /src/gallium/state_trackers/vdpau | |
parent | f3f03c67e90f962f67e7b58b7c7baff3be251cb1 (diff) |
st/vdpau: implement uploads to interlaced video buffers
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 85ce4c354bb..00c64ee21fc 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -191,7 +191,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format); struct pipe_context *pipe; struct pipe_sampler_view **sampler_views; - unsigned i; + unsigned i, j; if (!vlCreateHTAB()) return VDP_STATUS_RESOURCES; @@ -204,8 +204,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, if (!pipe) return VDP_STATUS_INVALID_HANDLE; - if (p_surf->video_buffer == NULL || p_surf->video_buffer->interlaced || - pformat != p_surf->video_buffer->buffer_format) { + if (p_surf->video_buffer == NULL || pformat != p_surf->video_buffer->buffer_format) { /* destroy the old one */ if (p_surf->video_buffer) @@ -213,7 +212,6 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, /* adjust the template parameters */ p_surf->templat.buffer_format = pformat; - p_surf->templat.interlaced = false; /* and try to create the video buffer with the new format */ p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat); @@ -227,27 +225,35 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, if (!sampler_views) return VDP_STATUS_RESOURCES; - for (i = 0; i < 3; ++i) { //TODO put nr of planes into util format + for (i = 0; i < 3; ++i) { struct pipe_sampler_view *sv = sampler_views[i]; - struct pipe_box dst_box = { 0, 0, 0, sv->texture->width0, sv->texture->height0, 1 }; - - struct pipe_transfer *transfer; - void *map; - - transfer = pipe->get_transfer(pipe, sv->texture, 0, PIPE_TRANSFER_WRITE, &dst_box); - if (!transfer) - return VDP_STATUS_RESOURCES; - - map = pipe->transfer_map(pipe, transfer); - if (map) { - util_copy_rect(map, sv->texture->format, transfer->stride, 0, 0, - dst_box.width, dst_box.height, - source_data[i], source_pitches[i], 0, 0); + if (!sv) continue; + + for (j = 0; j < sv->texture->depth0; ++j) { + struct pipe_box dst_box = { + 0, 0, j, + sv->texture->width0, sv->texture->height0, 1 + }; + + struct pipe_transfer *transfer; + void *map; + + transfer = pipe->get_transfer(pipe, sv->texture, 0, PIPE_TRANSFER_WRITE, &dst_box); + if (!transfer) + return VDP_STATUS_RESOURCES; + + map = pipe->transfer_map(pipe, transfer); + if (map) { + util_copy_rect(map, sv->texture->format, transfer->stride, 0, 0, + dst_box.width, dst_box.height, + source_data[i] + source_pitches[i] * j, + source_pitches[i] * sv->texture->depth0, + 0, 0); + } pipe->transfer_unmap(pipe, transfer); + pipe->transfer_destroy(pipe, transfer); } - - pipe->transfer_destroy(pipe, transfer); } return VDP_STATUS_OK; |