Mesa (master): broadcom/vc4: Detect syncobj support

Eric Anholt anholt at kemper.freedesktop.org
Thu May 17 15:05:09 UTC 2018


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

Author: Stefan Schake <stschake at gmail.com>
Date:   Wed Apr 25 00:00:58 2018 +0200

broadcom/vc4: Detect syncobj support

We need to know if the kernel supports syncobj submission since otherwise
all the DRM syncobj calls fail.

v2: Use drmGetCap to detect syncobj support (Eric)

Signed-off-by: Stefan Schake <stschake at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/gallium/drivers/vc4/vc4_screen.c | 6 ++++++
 src/gallium/drivers/vc4/vc4_screen.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 81c8049325..5476b8cf10 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -659,7 +659,9 @@ struct pipe_screen *
 vc4_screen_create(int fd, struct renderonly *ro)
 {
         struct vc4_screen *screen = rzalloc(NULL, struct vc4_screen);
+        uint64_t syncobj_cap = 0;
         struct pipe_screen *pscreen;
+        int err;
 
         pscreen = &screen->base;
 
@@ -695,6 +697,10 @@ vc4_screen_create(int fd, struct renderonly *ro)
         screen->has_perfmon_ioctl =
                 vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_PERFMON);
 
+        err = drmGetCap(fd, DRM_CAP_SYNCOBJ, &syncobj_cap);
+        if (err == 0 && syncobj_cap)
+                screen->has_syncobj = true;
+
         if (!vc4_get_chip_info(screen))
                 goto fail;
 
diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h
index 0b884423ba..438e90a1a2 100644
--- a/src/gallium/drivers/vc4/vc4_screen.h
+++ b/src/gallium/drivers/vc4/vc4_screen.h
@@ -98,6 +98,7 @@ struct vc4_screen {
         bool has_madvise;
         bool has_tiling_ioctl;
         bool has_perfmon_ioctl;
+        bool has_syncobj;
 
         struct vc4_simulator_file *sim_file;
 };




More information about the mesa-commit mailing list