Module: Mesa
Branch: main
Commit: a9bdf58c36e6d520b3bfccfcfa06543e932374a6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9bdf58c36e6d520b3bfccfcfa06543e932374a6

Author: Rob Clark <[email protected]>
Date:   Wed Nov  8 10:51:26 2023 -0800

freedreno/a6xx: Assume MOD_INVALID imports are linear

Without !25945 we must assume imports with invalid modifier are linear.
When both sides support metadata, we can promote the modifier.

Fixes: 33de58154f80 ("freedreno: Handle DRM_FORMAT_MOD_QCOM_TILED3 import")
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26115>

---

 src/gallium/drivers/freedreno/a6xx/fd6_resource.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc 
b/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
index dcb412033cd..539aa707321 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.cc
@@ -323,13 +323,17 @@ fd6_layout_resource_for_modifier(struct fd_resource *rsc, 
uint64_t modifier)
       }
       return 0;
    case DRM_FORMAT_MOD_QCOM_TILED3:
+      rsc->layout.tile_mode = fd6_tile_mode(&rsc->b.b);
+      FALLTHROUGH;
    case DRM_FORMAT_MOD_INVALID:
+      /* For now, without buffer metadata, we must assume that buffers
+       * imported with INVALID modifier are linear
+       */
       if (can_do_ubwc(&rsc->b.b)) {
          perf_debug("%" PRSC_FMT
                     ": not UBWC: imported with DRM_FORMAT_MOD_INVALID!",
                     PRSC_ARGS(&rsc->b.b));
       }
-      rsc->layout.tile_mode = fd6_tile_mode(&rsc->b.b);
       return 0;
    default:
       return -1;

Reply via email to