panfrost: Factor out panfrost_query_raw
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 9 Dec 2019 14:00:49 +0000 (09:00 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 13 Dec 2019 00:47:23 +0000 (00:47 +0000)
We would like to query properties other than product ID.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_screen.c

index c9bf9bcc7eb616682ab3aadf581c1b30b4e4191d..ff9e93e5c00ed7308c1da97ef575b670e441add8 100644 (file)
@@ -670,19 +670,29 @@ panfrost_screen_get_compiler_options(struct pipe_screen *pscreen,
         return &midgard_nir_options;
 }
 
-static unsigned
-panfrost_query_gpu_version(struct panfrost_screen *screen)
+static __u64
+panfrost_query_raw(
+                struct panfrost_screen *screen,
+                enum drm_panfrost_param param,
+                bool required)
 {
         struct drm_panfrost_get_param get_param = {0,};
         ASSERTED int ret;
 
         get_param.param = DRM_PANFROST_PARAM_GPU_PROD_ID;
         ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_PARAM, &get_param);
-        assert(!ret);
+
+        assert(!(ret && required));
 
         return get_param.value;
 }
 
+static unsigned
+panfrost_query_gpu_version(struct panfrost_screen *screen)
+{
+        return panfrost_query_raw(screen, DRM_PANFROST_PARAM_GPU_PROD_ID, true);
+}
+
 static uint32_t
 panfrost_active_bos_hash(const void *key)
 {