mesa: gallium/dri Make YUV formats we're going to emulate external-only

This patch fixes the red label issues on video for Raspberry 4-64 Mesa VC4
driver and for iMX53 Adreno A200 GPU using the Mesa Freedreno driver.

Issue was originally reported in meta-webkit [1] and later contributed
in Mesa [2] where it was already merged in master.

[1] https://github.com/Igalia/meta-webkit/issues/185
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13038

(From OE-Core rev: 09f6038fbf479f8047fa566ff6b50bffc7a47f99)

Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Pablo Saavedra Rodi?o
2021-10-18 18:21:38 +02:00
committed by Richard Purdie
parent a85f3639c4
commit 7b2b3f4002
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
commit 8bd63cd28939d79d6681943b840627eaa3614ee4
Author: Pablo Saavedra <psaavedra@igalia.com>
Date: Mon Oct 18 15:48:42 2021 +0200
gallium/dri: Make YUV formats we're going to emulate external-only.
If we're going to have to bind them as separate planes with colorspace
conversion for sampling on the frontend, then we need to report that
they're only for external-image samplers, otherwise the lowering won't be
applied.
Fixes: 4e3a7dcf ("gallium: enable EGL_EXT_image_dma_buf_import_modifiers unconditionally")
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13038>
Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13038]
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index b0c0d7e..ef8df5a 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -1445,16 +1445,24 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
format = map->pipe_format;
+ bool native_sampling = pscreen->is_format_supported(pscreen, format, screen->target, 0, 0,
+ PIPE_BIND_SAMPLER_VIEW);
if (pscreen->is_format_supported(pscreen, format, screen->target, 0, 0,
- PIPE_BIND_RENDER_TARGET) ||
- pscreen->is_format_supported(pscreen, format, screen->target, 0, 0,
- PIPE_BIND_SAMPLER_VIEW) ||
- dri2_yuv_dma_buf_supported(screen, map)) {
- if (pscreen->query_dmabuf_modifiers != NULL)
+ PIPE_BIND_RENDER_TARGET) ||
+ native_sampling ||
+ dri2_yuv_dma_buf_supported(screen, map)) {
+ if (pscreen->query_dmabuf_modifiers != NULL) {
pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers,
external_only, count);
- else
+ if (!native_sampling && external_only) {
+ /* To support it using YUV lowering, we need it to be samplerExternalOES.
+ */
+ for (int i = 0; i < *count; i++)
+ external_only[i] = true;
+ }
+ } else {
*count = 0;
+ }
return true;
}
return false;

View File

@@ -19,6 +19,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
file://0002-meson.build-make-TLS-ELF-optional.patch \
file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
file://0001-gallium-dri-Make-YUV-formats-we-re-going-to-emulate-.patch \
"
SRC_URI[sha256sum] = "565c6f4bd2d5747b919454fc1d439963024fc78ca56fd05158c3b2cde2f6912b"