Mesa (master): v3d: Use shared drm_find_modifier util

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 14 22:43:58 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Thu Mar 14 04:15:20 2019 +0000

v3d: Use shared drm_find_modifier util

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/gallium/drivers/v3d/v3d_resource.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c
index ddecafe2ec9..71248e9ca1e 100644
--- a/src/gallium/drivers/v3d/v3d_resource.c
+++ b/src/gallium/drivers/v3d/v3d_resource.c
@@ -31,6 +31,7 @@
 #include "util/u_transfer_helper.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_format_zs.h"
+#include "util/u_drm.h"
 
 #include "drm-uapi/drm_fourcc.h"
 #include "v3d_screen.h"
@@ -685,19 +686,6 @@ v3d_resource_setup(struct pipe_screen *pscreen,
         return rsc;
 }
 
-static bool
-find_modifier(uint64_t needle, const uint64_t *haystack, int count)
-{
-        int i;
-
-        for (i = 0; i < count; i++) {
-                if (haystack[i] == needle)
-                        return true;
-        }
-
-        return false;
-}
-
 static struct pipe_resource *
 v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
                                    const struct pipe_resource *tmpl,
@@ -741,7 +729,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
                 return prsc;
         }
 
-        bool linear_ok = find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
+        bool linear_ok = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
         struct v3d_resource *rsc = v3d_resource_setup(pscreen, tmpl);
         struct pipe_resource *prsc = &rsc->base;
         /* Use a tiled layout if we can, for better 3D performance. */
@@ -773,7 +761,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
                 linear_ok = true;
                 rsc->tiled = should_tile;
         } else if (should_tile &&
-                   find_modifier(DRM_FORMAT_MOD_BROADCOM_UIF,
+                   drm_find_modifier(DRM_FORMAT_MOD_BROADCOM_UIF,
                                  modifiers, count)) {
                 rsc->tiled = true;
         } else if (linear_ok) {




More information about the mesa-commit mailing list