asahi: Don't hardcode is_dmabuf_modifier_supported
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 25 Nov 2022 16:54:50 +0000 (11:54 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 25 Nov 2022 18:56:48 +0000 (18:56 +0000)
So we can add more modifiers more easily.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19999>

src/gallium/drivers/asahi/agx_pipe.c

index 54e478f..27eb395 100644 (file)
@@ -1543,13 +1543,12 @@ agx_is_dmabuf_modifier_supported(struct pipe_screen *screen,
    if (external_only)
       *external_only = false;
 
-   switch (modifier) {
-   case DRM_FORMAT_MOD_APPLE_TWIDDLED:
-   case DRM_FORMAT_MOD_LINEAR:
-      return true;
-   default:
-      return false;
+   for (unsigned i = 0; i < ARRAY_SIZE(agx_best_modifiers); ++i) {
+      if (agx_best_modifiers[i] == modifier)
+         return true;
    }
+
+   return false;
 }
 
 static void