diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 5b5c4dfd5c7..66d8538a444 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -983,28 +983,28 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf nr_of_idct_render_targets = 1; formats[0] = formats[1] = formats[2] = format_config->idct_source_format; - assert(pipe_format_to_chroma_format(formats[0]) == dec->base.chroma_format); memset(&templat, 0, sizeof(templat)); templat.width = dec->base.width / 4; templat.height = dec->base.height; dec->idct_source = vl_video_buffer_create_ex ( dec->context, &templat, - formats, 1, 1, PIPE_USAGE_DEFAULT + formats, 1, 1, PIPE_USAGE_DEFAULT, + PIPE_VIDEO_CHROMA_FORMAT_420 ); if (!dec->idct_source) goto error_idct_source; formats[0] = formats[1] = formats[2] = format_config->mc_source_format; - assert(pipe_format_to_chroma_format(formats[0]) == dec->base.chroma_format); memset(&templat, 0, sizeof(templat)); templat.width = dec->base.width / nr_of_idct_render_targets; templat.height = dec->base.height / 4; dec->mc_source = vl_video_buffer_create_ex ( dec->context, &templat, - formats, nr_of_idct_render_targets, 1, PIPE_USAGE_DEFAULT + formats, nr_of_idct_render_targets, 1, PIPE_USAGE_DEFAULT, + PIPE_VIDEO_CHROMA_FORMAT_420 ); if (!dec->mc_source) @@ -1055,9 +1055,10 @@ init_mc_source_widthout_idct(struct vl_mpeg12_decoder *dec, const struct format_ dec->mc_source = vl_video_buffer_create_ex ( dec->context, &templat, - formats, 1, 1, PIPE_USAGE_DEFAULT + formats, 1, 1, PIPE_USAGE_DEFAULT, + PIPE_VIDEO_CHROMA_FORMAT_420 ); - + return dec->mc_source != NULL; } diff --git a/src/gallium/auxiliary/vl/vl_stubs.c b/src/gallium/auxiliary/vl/vl_stubs.c index befd2468f49..02568ac2843 100644 --- a/src/gallium/auxiliary/vl/vl_stubs.c +++ b/src/gallium/auxiliary/vl/vl_stubs.c @@ -85,7 +85,8 @@ vl_video_buffer_template(struct pipe_resource *templ, const struct pipe_video_buffer *tmpl, enum pipe_format resource_format, unsigned depth, unsigned array_size, - unsigned usage, unsigned plane) + unsigned usage, unsigned plane, + enum pipe_video_chroma_format chroma_format) { assert(0); } diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index f4fac6ca0bc..54cc0c52909 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -169,7 +169,8 @@ vl_video_buffer_template(struct pipe_resource *templ, const struct pipe_video_buffer *tmpl, enum pipe_format resource_format, unsigned depth, unsigned array_size, - unsigned usage, unsigned plane) + unsigned usage, unsigned plane, + enum pipe_video_chroma_format chroma_format) { unsigned height = tmpl->height; @@ -188,7 +189,7 @@ vl_video_buffer_template(struct pipe_resource *templ, templ->usage = usage; vl_video_buffer_adjust_size(&templ->width0, &height, plane, - pipe_format_to_chroma_format(tmpl->buffer_format), false); + chroma_format, false); templ->height0 = height; } @@ -372,7 +373,8 @@ vl_video_buffer_create(struct pipe_context *pipe, result = vl_video_buffer_create_ex ( pipe, &templat, resource_formats, - 1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_DEFAULT + 1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_DEFAULT, + pipe_format_to_chroma_format(templat.buffer_format) ); @@ -386,7 +388,8 @@ struct pipe_video_buffer * vl_video_buffer_create_ex(struct pipe_context *pipe, const struct pipe_video_buffer *tmpl, const enum pipe_format resource_formats[VL_NUM_COMPONENTS], - unsigned depth, unsigned array_size, unsigned usage) + unsigned depth, unsigned array_size, unsigned usage, + enum pipe_video_chroma_format chroma_format) { struct pipe_resource res_tmpl; struct pipe_resource *resources[VL_NUM_COMPONENTS]; @@ -396,7 +399,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, memset(resources, 0, sizeof resources); - vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, array_size, usage, 0); + vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, array_size, + usage, 0, chroma_format); resources[0] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[0]) goto error; @@ -406,7 +410,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, return vl_video_buffer_create_ex2(pipe, tmpl, resources); } - vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, array_size, usage, 1); + vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, array_size, + usage, 1, chroma_format); resources[1] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[1]) goto error; @@ -414,7 +419,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe, if (resource_formats[2] == PIPE_FORMAT_NONE) return vl_video_buffer_create_ex2(pipe, tmpl, resources); - vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, array_size, usage, 2); + vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, array_size, + usage, 2, chroma_format); resources[2] = pipe->screen->resource_create(pipe->screen, &res_tmpl); if (!resources[2]) goto error; diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index fe92d4cfcfa..2045f04a391 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -119,7 +119,8 @@ vl_video_buffer_template(struct pipe_resource *templ, const struct pipe_video_buffer *templat, enum pipe_format resource_format, unsigned depth, unsigned array_size, - unsigned usage, unsigned plane); + unsigned usage, unsigned plane, + enum pipe_video_chroma_format chroma_format); /** * creates a video buffer, can be used as a standard implementation for pipe->create_video_buffer @@ -135,7 +136,8 @@ struct pipe_video_buffer * vl_video_buffer_create_ex(struct pipe_context *pipe, const struct pipe_video_buffer *templat, const enum pipe_format resource_formats[VL_NUM_COMPONENTS], - unsigned depth, unsigned array_size, unsigned usage); + unsigned depth, unsigned array_size, unsigned usage, + enum pipe_video_chroma_format chroma_format); /** * even more extended create function, provide the pipe_resource for each plane diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c index 2e7d7ee4d40..18ac073da36 100644 --- a/src/gallium/drivers/r600/r600_uvd.c +++ b/src/gallium/drivers/r600/r600_uvd.c @@ -66,6 +66,8 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, struct pipe_video_buffer template; struct pipe_resource templ; unsigned i, array_size; + enum pipe_video_chroma_format chroma_format = + pipe_format_to_chroma_format(tmpl->buffer_format); assert(pipe); @@ -77,7 +79,8 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, template.width = align(tmpl->width, VL_MACROBLOCK_WIDTH); template.height = align(tmpl->height / array_size, VL_MACROBLOCK_HEIGHT); - vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, PIPE_USAGE_DEFAULT, 0); + vl_video_buffer_template(&templ, &template, resource_formats[0], 1, array_size, + PIPE_USAGE_DEFAULT, 0, chroma_format); if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced || !R600_UVD_ENABLE_TILING) templ.bind = PIPE_BIND_LINEAR; resources[0] = (struct r600_texture *) @@ -86,7 +89,8 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, goto error; if (resource_formats[1] != PIPE_FORMAT_NONE) { - vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, PIPE_USAGE_DEFAULT, 1); + vl_video_buffer_template(&templ, &template, resource_formats[1], 1, array_size, + PIPE_USAGE_DEFAULT, 1, chroma_format); if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced || !R600_UVD_ENABLE_TILING) templ.bind = PIPE_BIND_LINEAR; resources[1] = (struct r600_texture *) @@ -96,7 +100,8 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe, } if (resource_formats[2] != PIPE_FORMAT_NONE) { - vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_DEFAULT, 2); + vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, + PIPE_USAGE_DEFAULT, 2, chroma_format); if (ctx->b.chip_class < EVERGREEN || tmpl->interlaced || !R600_UVD_ENABLE_TILING) templ.bind = PIPE_BIND_LINEAR; resources[2] = (struct r600_texture *)