diff options
author | Christian König <[email protected]> | 2012-01-04 00:51:40 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-01-15 12:40:44 +0100 |
commit | 9af70c90dba9ed9902778883b675062fa0168b48 (patch) | |
tree | 58931851414490c49e819609dbf70ebaaf485027 /src/gallium | |
parent | 12b49ca2dfab832ff9dce50c846aee7f3efc3084 (diff) |
vl/video_buffer: add support for interlaced buffers
Add the infrastructure, but not the decode implementation.
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 35 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.h | 2 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_decoder.h | 1 |
3 files changed, 25 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 008186cdc4f..21a2a89c34f 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -161,11 +161,14 @@ vl_video_buffer_destroy(struct pipe_video_buffer *buffer) assert(buf); for (i = 0; i < VL_MAX_PLANES; ++i) { - pipe_surface_reference(&buf->surfaces[i], NULL); pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); pipe_resource_reference(&buf->resources[i], NULL); } + + for (i = 0; i < VL_MAX_PLANES * 2; ++i) + pipe_surface_reference(&buf->surfaces[i], NULL); + vl_video_buffer_set_associated_data(buffer, NULL, NULL, NULL); FREE(buffer); @@ -251,27 +254,32 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer) struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer; struct pipe_surface surf_templ; struct pipe_context *pipe; - unsigned i; + unsigned i, j, surf; assert(buf); pipe = buf->base.context; - for (i = 0; i < buf->num_planes; ++i ) { - if (!buf->surfaces[i]) { - memset(&surf_templ, 0, sizeof(surf_templ)); - surf_templ.format = buf->resources[i]->format; - surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; - buf->surfaces[i] = pipe->create_surface(pipe, buf->resources[i], &surf_templ); - if (!buf->surfaces[i]) - goto error; + for (i = 0, surf = 0; i < buf->num_planes; ++i ) { + for (j = 0; j < buf->resources[i]->depth0; ++j, ++surf) { + assert(surf < (VL_MAX_PLANES * 2)); + + if (!buf->surfaces[surf]) { + memset(&surf_templ, 0, sizeof(surf_templ)); + surf_templ.format = buf->resources[i]->format; + surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; + surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = j; + buf->surfaces[i] = pipe->create_surface(pipe, buf->resources[i], &surf_templ); + if (!buf->surfaces[i]) + goto error; + } } } return buf->surfaces; error: - for (i = 0; i < buf->num_planes; ++i ) + for (i = 0; i < (VL_MAX_PLANES * 2); ++i ) pipe_surface_reference(&buf->surfaces[i], NULL); return NULL; @@ -305,10 +313,13 @@ vl_video_buffer_create(struct pipe_context *pipe, templat.height = pot_buffers ? util_next_power_of_two(tmpl->height) : align(tmpl->height, MACROBLOCK_HEIGHT); + if (tmpl->interlaced) + templat.height /= 2; + return vl_video_buffer_create_ex ( pipe, &templat, resource_formats, - 1, PIPE_USAGE_STATIC + tmpl->interlaced ? 2 : 1, PIPE_USAGE_STATIC ); } diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 1329fbdf6a5..a323efd2a9b 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -45,7 +45,7 @@ struct vl_video_buffer struct pipe_resource *resources[VL_MAX_PLANES]; struct pipe_sampler_view *sampler_view_planes[VL_MAX_PLANES]; struct pipe_sampler_view *sampler_view_components[VL_MAX_PLANES]; - struct pipe_surface *surfaces[VL_MAX_PLANES]; + struct pipe_surface *surfaces[VL_MAX_PLANES * 2]; }; /** diff --git a/src/gallium/include/pipe/p_video_decoder.h b/src/gallium/include/pipe/p_video_decoder.h index 69e59a6fa4b..62169ffc567 100644 --- a/src/gallium/include/pipe/p_video_decoder.h +++ b/src/gallium/include/pipe/p_video_decoder.h @@ -128,6 +128,7 @@ struct pipe_video_buffer enum pipe_video_chroma_format chroma_format; unsigned width; unsigned height; + bool interlaced; /** * destroy this video buffer |