Module: Mesa
Branch: staging/23.3
Commit: 4a6094622576c6a2b670f15020f1251ac2095277
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a6094622576c6a2b670f15020f1251ac2095277

Author: Rob Clark <[email protected]>
Date:   Fri Dec  8 11:30:44 2023 -0800

freedreno/a6xx: Fix NV12+UBWC import

Treat R8_G8B8_420_UNORM and NV12 the same, because dri2 frontend doesn't
understand or care about the difference from the sampler PoV.

Fixes: 1e820ac12850 ("freedreno: Rework supported-modifiers handling")
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26601>
(cherry picked from commit 2132f95de0b0f291b116a67149793eaac2e2b5bf)

---

 .pick_status.json                                  | 2 +-
 src/gallium/drivers/freedreno/a6xx/fd6_resource.cc | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index d2e2d718fad..ba109267fb9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1784,7 +1784,7 @@
         "description": "freedreno/a6xx: Fix NV12+UBWC import",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "1e820ac128506bd66a20fb7345fd562feb9e730b",
         "notes": null
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc 
b/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
index b8f96bee616..0ed5a191e26 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
@@ -55,6 +55,13 @@ ok_ubwc_format(struct pipe_screen *pscreen, enum pipe_format 
pfmt)
       return info->a6xx.has_z24uint_s8uint;
 
    case PIPE_FORMAT_R8_G8B8_420_UNORM:
+      /* The difference between NV12 and R8_G8B8_420_UNORM is only where the
+       * conversion to RGB happens, with the latter it happens _after_ the
+       * texture samp instruction.  But dri2_get_mapping_by_fourcc() doesn't
+       * know this, so it asks for NV12 when it really meant to ask for
+       * R8_G8B8_420_UNORM.  Just treat them the same here to work around it:
+       */
+   case PIPE_FORMAT_NV12:
       return true;
 
    default:

Reply via email to