broadcom/vc4: Detect syncobj support
authorStefan Schake <stschake@gmail.com>
Tue, 24 Apr 2018 22:00:58 +0000 (00:00 +0200)
committerEric Anholt <eric@anholt.net>
Thu, 17 May 2018 15:04:26 +0000 (16:04 +0100)
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@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/vc4/vc4_screen.h

index 81c8049325fb0028684af6f39e8dac16b73e6bf5..5476b8cf10c1c54e95b3ed6ad99c9cacd68e6576 100644 (file)
@@ -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;
 
index 0b884423ba5a1fd7d149d1ab55211d1fe48cb4a2..438e90a1a2ca93333cd8419f75f4899591ebd7d7 100644 (file)
@@ -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;
 };