summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/vdpau/surface.c48
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;