[Mesa-dev] [PATCH] radeonsi/uvd: fix planar formats broken since f70f6baaa3bb0f8b280ac2eaea69bb
Benedikt Schemmer
ben at besd.de
Fri Sep 29 17:54:38 UTC 2017
Would it be ok to rewrite the patch like below?
Avoids code duplication and one variable.
Otherwise your original patch works fine so FWIW you have my
Tested-by: Benedikt Schemmer <ben at besd.de>
Cheers,
Benedikt
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -64,30 +64,16 @@ struct pipe_video_buffer *si_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);
- /* TODO: get tiling working */
- templ.bind = PIPE_BIND_LINEAR;
- resources[0] = (struct r600_texture *)
- pipe->screen->resource_create(pipe->screen, &templ);
- if (!resources[0])
- 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);
- templ.bind = PIPE_BIND_LINEAR;
- resources[1] = (struct r600_texture *)
- pipe->screen->resource_create(pipe->screen, &templ);
- if (!resources[1])
- goto error;
- }
-
- if (resource_formats[2] != PIPE_FORMAT_NONE) {
- vl_video_buffer_template(&templ, &template, resource_formats[2], 1, array_size, PIPE_USAGE_DEFAULT, 2);
- templ.bind = PIPE_BIND_LINEAR;
- resources[2] = (struct r600_texture *)
- pipe->screen->resource_create(pipe->screen, &templ);
- if (!resources[2])
- goto error;
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
+ if (resource_formats[i] != PIPE_FORMAT_NONE) {
+ vl_video_buffer_template(&templ, &template,
+ resource_formats[i], 1,
+ array_size, PIPE_USAGE_DEFAULT, i);
+ templ.bind = PIPE_BIND_LINEAR | PIPE_BIND_SHARED;
+ resources[i] = (struct r600_texture *)
+ pipe->screen->resource_create(pipe->screen, &templ);
+ if (!resources[i]) goto error;
+ }
}
for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
More information about the mesa-dev
mailing list