From f49862cf0e93cb5633aa53330d52395e03d09f7d7e3aad3f860a858dadb95e49 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Mon, 28 Sep 2020 09:52:47 +0000 Subject: [PATCH] - Add U_fix-mpeg1_2-decode.patch (boo#1173185) * fixes colors in kaffeine on Radeon (r600 VAAPI driver) OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=997 --- Mesa-drivers.changes | 6 + Mesa-drivers.spec | 2 + Mesa.changes | 6 + Mesa.spec | 2 + U_fix-mpeg1_2-decode.patch | 283 +++++++++++++++++++++++++++++++++++++ 5 files changed, 299 insertions(+) create mode 100644 U_fix-mpeg1_2-decode.patch diff --git a/Mesa-drivers.changes b/Mesa-drivers.changes index 8858369..ae767c9 100644 --- a/Mesa-drivers.changes +++ b/Mesa-drivers.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 24 11:08:44 UTC 2020 - Wolfgang Bauer + +- Add U_fix-mpeg1_2-decode.patch (boo#1173185) + * fixes colors in kaffeine on Radeon (r600 VAAPI driver) + ------------------------------------------------------------------- Fri Sep 18 11:11:14 UTC 2020 - Stefan Dirsch diff --git a/Mesa-drivers.spec b/Mesa-drivers.spec index f63d57d..0172190 100644 --- a/Mesa-drivers.spec +++ b/Mesa-drivers.spec @@ -128,6 +128,7 @@ Patch2: n_add-Mesa-headers-again.patch Patch54: n_drirc-disable-rgb10-for-chromium-on-amd.patch Patch58: u_dep_xcb.patch Patch60: buildfix-ppc64le.patch +Patch99: U_fix-mpeg1_2-decode.patch BuildRequires: bison BuildRequires: fdupes BuildRequires: flex @@ -704,6 +705,7 @@ rm -rf docs/README.{VMS,WIN32,OS2} %ifarch ppc64le %patch60 -p1 %endif +%patch99 -p1 # Remove requires to vulkan libs from baselibs.conf on platforms # where vulkan build is disabled; ugly ... diff --git a/Mesa.changes b/Mesa.changes index 8858369..ae767c9 100644 --- a/Mesa.changes +++ b/Mesa.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 24 11:08:44 UTC 2020 - Wolfgang Bauer + +- Add U_fix-mpeg1_2-decode.patch (boo#1173185) + * fixes colors in kaffeine on Radeon (r600 VAAPI driver) + ------------------------------------------------------------------- Fri Sep 18 11:11:14 UTC 2020 - Stefan Dirsch diff --git a/Mesa.spec b/Mesa.spec index e287d3d..60b315e 100644 --- a/Mesa.spec +++ b/Mesa.spec @@ -127,6 +127,7 @@ Patch2: n_add-Mesa-headers-again.patch Patch54: n_drirc-disable-rgb10-for-chromium-on-amd.patch Patch58: u_dep_xcb.patch Patch60: buildfix-ppc64le.patch +Patch99: U_fix-mpeg1_2-decode.patch BuildRequires: bison BuildRequires: fdupes BuildRequires: flex @@ -703,6 +704,7 @@ rm -rf docs/README.{VMS,WIN32,OS2} %ifarch ppc64le %patch60 -p1 %endif +%patch99 -p1 # Remove requires to vulkan libs from baselibs.conf on platforms # where vulkan build is disabled; ugly ... diff --git a/U_fix-mpeg1_2-decode.patch b/U_fix-mpeg1_2-decode.patch new file mode 100644 index 0000000..fb59ed8 --- /dev/null +++ b/U_fix-mpeg1_2-decode.patch @@ -0,0 +1,283 @@ +From ffdbecf3450fc2b03a6f95fe2f6ec3b44f802c44 Mon Sep 17 00:00:00 2001 +From: Pierre-Eric Pelloux-Prayer +Date: Tue, 22 Sep 2020 14:31:32 +0200 +Subject: [PATCH 1/3] gallium/vl: do not call transfer_unmap if transfer is + NULL + +CC: mesa-stable +Acked-by: Leo Liu +--- + src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 3 ++- + src/gallium/auxiliary/vl/vl_vertex_buffers.c | 6 ++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +index 58ddef9f418..5b5c4dfd5c7 100644 +--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c ++++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +@@ -769,7 +769,8 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder, + + vl_vb_unmap(&buf->vertex_stream, dec->context); + +- dec->context->transfer_unmap(dec->context, buf->tex_transfer); ++ if (buf->tex_transfer) ++ dec->context->transfer_unmap(dec->context, buf->tex_transfer); + + vb[0] = dec->quads; + vb[1] = dec->pos; +diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c +index 0cf8582f810..00c424f3bb4 100644 +--- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c ++++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c +@@ -352,11 +352,13 @@ vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe) + assert(buffer && pipe); + + for (i = 0; i < VL_NUM_COMPONENTS; ++i) { +- pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer); ++ if (buffer->ycbcr[i].transfer) ++ pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer); + } + + for (i = 0; i < VL_MAX_REF_FRAMES; ++i) { +- pipe_buffer_unmap(pipe, buffer->mv[i].transfer); ++ if (buffer->mv[i].transfer) ++ pipe_buffer_unmap(pipe, buffer->mv[i].transfer); + } + } + +-- +GitLab + + +From 9907991b8624df201861cf9648317c4a9ec9cd37 Mon Sep 17 00:00:00 2001 +From: Pierre-Eric Pelloux-Prayer +Date: Tue, 22 Sep 2020 14:32:13 +0200 +Subject: [PATCH 2/3] gallium/vl: add chroma_format arg to vl_video_buffer + functions + +vl_mpeg12_decoder needs to override the chroma_format value to get the +correct size calculated (chroma_format is used by vl_video_buffer_adjust_size). + +I'm not sure why it's needed, but this is needed to get correct mpeg decode. + +Fixes: 24f2b0a8560 ("gallium/video: remove pipe_video_buffer.chroma_format") +Acked-by: Leo Liu +--- + src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 13 +++++++------ + src/gallium/auxiliary/vl/vl_stubs.c | 3 ++- + src/gallium/auxiliary/vl/vl_video_buffer.c | 20 +++++++++++++------- + src/gallium/auxiliary/vl/vl_video_buffer.h | 6 ++++-- + src/gallium/drivers/r600/r600_uvd.c | 11 ++++++++--- + 5 files changed, 34 insertions(+), 19 deletions(-) + +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 *) +-- +GitLab + + +-- +GitLab +