diff options
author | Christian König <[email protected]> | 2011-04-12 19:21:07 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-12 19:21:07 +0200 |
commit | 4f3fb1586aebfe248321e935651b5af92b5a8261 (patch) | |
tree | e726624324d952dec27643f35524c15390209d73 /src/gallium/auxiliary | |
parent | ccc80d2c09ad35f867c0c0a85f7e1cadd73941bb (diff) |
[g3dvl] make resource format selection a public interface
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_context.c | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.h | 1 |
4 files changed, 13 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/vl/vl_context.c b/src/gallium/auxiliary/vl/vl_context.c index 2bc027fedc5..ba732548732 100644 --- a/src/gallium/auxiliary/vl/vl_context.c +++ b/src/gallium/auxiliary/vl/vl_context.c @@ -199,15 +199,10 @@ vl_context_create_decoder(struct pipe_video_context *context, static struct pipe_video_buffer * vl_context_create_buffer(struct pipe_video_context *context, enum pipe_format buffer_format, + enum pipe_format resource_formats[3], enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) { - const enum pipe_format resource_formats[3] = { - PIPE_FORMAT_R8_SNORM, - PIPE_FORMAT_R8_SNORM, - PIPE_FORMAT_R8_SNORM - }; - struct vl_context *ctx = (struct vl_context*)context; struct pipe_video_buffer *result; unsigned buffer_width, buffer_height; @@ -221,7 +216,7 @@ vl_context_create_buffer(struct pipe_video_context *context, result = vl_video_buffer_init(context, ctx->pipe, buffer_width, buffer_height, 1, - chroma_format, 3, + chroma_format, resource_formats, PIPE_USAGE_STATIC); if (result) // TODO move format handling into vl_video_buffer diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 40a1b74f654..ce0393848e3 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -309,7 +309,7 @@ init_idct_buffer(struct vl_mpeg12_buffer *buffer) formats[0] = formats[1] = formats[2] = dec->idct_source_format; buffer->idct_source = vl_video_buffer_init(dec->base.context, dec->pipe, dec->base.width / 4, dec->base.height, 1, - dec->base.chroma_format, 3, + dec->base.chroma_format, formats, PIPE_USAGE_STREAM); if (!buffer->idct_source) goto error_source; @@ -318,7 +318,7 @@ init_idct_buffer(struct vl_mpeg12_buffer *buffer) buffer->idct_intermediate = vl_video_buffer_init(dec->base.context, dec->pipe, dec->base.width / dec->nr_of_idct_render_targets, dec->base.height / 4, dec->nr_of_idct_render_targets, - dec->base.chroma_format, 3, + dec->base.chroma_format, formats, PIPE_USAGE_STATIC); if (!buffer->idct_intermediate) @@ -395,7 +395,7 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder) formats[0] = formats[1] = formats[2] =dec->mc_source_format; buffer->mc_source = vl_video_buffer_init(dec->base.context, dec->pipe, dec->base.width, dec->base.height, 1, - dec->base.chroma_format, 3, + dec->base.chroma_format, formats, PIPE_USAGE_STATIC); if (!buffer->mc_source) diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index b1d8fd85dcd..dad8dd2c9ae 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -133,7 +133,6 @@ vl_video_buffer_init(struct pipe_video_context *context, struct pipe_context *pipe, unsigned width, unsigned height, unsigned depth, enum pipe_video_chroma_format chroma_format, - unsigned num_planes, const enum pipe_format resource_formats[VL_MAX_PLANES], unsigned usage) { @@ -142,7 +141,6 @@ vl_video_buffer_init(struct pipe_video_context *context, unsigned i; assert(context && pipe); - assert(num_planes > 0 && num_planes <= VL_MAX_PLANES); buffer = CALLOC_STRUCT(vl_video_buffer); @@ -150,7 +148,7 @@ vl_video_buffer_init(struct pipe_video_context *context, buffer->base.get_sampler_views = vl_video_buffer_sampler_views; buffer->base.get_surfaces = vl_video_buffer_surfaces; buffer->pipe = pipe; - buffer->num_planes = num_planes; + buffer->num_planes = 1; memset(&templ, 0, sizeof(templ)); templ.target = depth > 1 ? PIPE_TEXTURE_3D : PIPE_TEXTURE_2D; @@ -166,10 +164,12 @@ vl_video_buffer_init(struct pipe_video_context *context, if (!buffer->resources[0]) goto error; - if (num_planes == 1) { + if (resource_formats[1] == PIPE_FORMAT_NONE) { assert(chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444); + assert(resource_formats[2] == PIPE_FORMAT_NONE); return &buffer->base; - } + } else + buffer->num_planes = 2; templ.format = resource_formats[1]; if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { @@ -183,8 +183,10 @@ vl_video_buffer_init(struct pipe_video_context *context, if (!buffer->resources[1]) goto error; - if (num_planes == 2) + if (resource_formats[2] == PIPE_FORMAT_NONE) return &buffer->base; + else + buffer->num_planes = 3; templ.format = resource_formats[2]; buffer->resources[2] = pipe->screen->resource_create(pipe->screen, &templ); diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 3f462acc510..f5c424cf296 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -56,7 +56,6 @@ vl_video_buffer_init(struct pipe_video_context *context, struct pipe_context *pipe, unsigned width, unsigned height, unsigned depth, enum pipe_video_chroma_format chroma_format, - unsigned num_planes, const enum pipe_format resource_formats[VL_MAX_PLANES], unsigned usage); #endif /* vl_ycbcr_buffer_h */ |