vc4: Detect and report kernel support for branching.
authorEric Anholt <eric@anholt.net>
Thu, 10 Mar 2016 23:18:31 +0000 (15:18 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 20 Jul 2016 23:15:15 +0000 (16:15 -0700)
src/gallium/drivers/vc4/vc4_screen.c

index 5c17c55c9381b43e95a6ef050ca2240902154af4..f295ae0543165fecb53a022cf01d5964decf7790 100644 (file)
@@ -32,6 +32,8 @@
 #include "util/u_format.h"
 #include "util/ralloc.h"
 
+#include <xf86drm.h>
+#include "vc4_drm.h"
 #include "vc4_screen.h"
 #include "vc4_context.h"
 #include "vc4_resource.h"
@@ -502,9 +504,17 @@ vc4_supports_branches(struct vc4_screen *screen)
 {
 #if USE_VC4_SIMULATOR
         return true;
-#else
-        return false;
 #endif
+
+        struct drm_vc4_get_param p = {
+                .param = DRM_VC4_PARAM_SUPPORTS_BRANCHES,
+        };
+        int ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_GET_PARAM, &p);
+
+        if (ret != 0)
+                return false;
+
+        return p.value;
 }
 
 struct pipe_screen *