panfrost: Factor out panfrost_query_raw

We would like to query properties other than product ID.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig
2019-12-09 09:00:49 -05:00
parent a6aedc662e
commit 315324614e
+13 -3
View 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)
{