Mesa (master): v3d: Expose the dma-buf modifiers query.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 19 16:02:23 UTC 2019


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Mar 18 13:49:08 2019 -0700

v3d: Expose the dma-buf modifiers query.

This allows DRI3 to pick between UIF and raster according to whether we're
pageflipping or not and whether the pageflipping display can do UIF,
avoiding copies for the windowed/composited case that previously was
forced to linear.

Improves windowed glmark2 -b build:use-vbo=false performance by 30.7783%
+/- 13.1719% (n=3)

---

 src/gallium/drivers/v3d/v3d_screen.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c
index 7ccf5b143ff..c810fbc98b4 100644
--- a/src/gallium/drivers/v3d/v3d_screen.c
+++ b/src/gallium/drivers/v3d/v3d_screen.c
@@ -40,6 +40,7 @@
 #include "v3d_context.h"
 #include "v3d_resource.h"
 #include "compiler/v3d_compiler.h"
+#include "drm-uapi/drm_fourcc.h"
 
 static const char *
 v3d_screen_get_name(struct pipe_screen *pscreen)
@@ -512,6 +513,33 @@ v3d_screen_get_compiler_options(struct pipe_screen *pscreen,
         return &v3d_nir_options;
 }
 
+static void
+v3d_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
+                                  enum pipe_format format, int max,
+                                  uint64_t *modifiers,
+                                  unsigned int *external_only,
+                                  int *count)
+{
+        int i;
+        uint64_t available_modifiers[] = {
+                DRM_FORMAT_MOD_BROADCOM_UIF,
+                DRM_FORMAT_MOD_LINEAR,
+        };
+        int num_modifiers = ARRAY_SIZE(available_modifiers);
+
+        if (!modifiers) {
+                *count = num_modifiers;
+                return;
+        }
+
+        *count = MIN2(max, num_modifiers);
+        for (i = 0; i < *count; i++) {
+                modifiers[i] = available_modifiers[i];
+                if (external_only)
+                        external_only[i] = false;
+       }
+}
+
 struct pipe_screen *
 v3d_screen_create(int fd, struct renderonly *ro)
 {
@@ -561,6 +589,7 @@ v3d_screen_create(int fd, struct renderonly *ro)
         pscreen->get_vendor = v3d_screen_get_vendor;
         pscreen->get_device_vendor = v3d_screen_get_vendor;
         pscreen->get_compiler_options = v3d_screen_get_compiler_options;
+        pscreen->query_dmabuf_modifiers = v3d_screen_query_dmabuf_modifiers;
 
         return pscreen;
 




More information about the mesa-commit mailing list