From 315324614e95a86f743de864756f0ae52d8ecf74 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 9 Dec 2019 09:00:49 -0500 Subject: [PATCH] panfrost: Factor out panfrost_query_raw We would like to query properties other than product ID. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_screen.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index c9bf9bcc7eb..ff9e93e5c00 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -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) { -- 2.30.2