[Mesa-dev] [PATCH] panfrost: Maintain a whitelist of supported GPU's
Rohan Garg
rohan.garg at collabora.com
Mon Jun 24 14:43:42 UTC 2019
Maintain a list of panfrost supported GPU's and exit early when
running on a unsupported GPU.
Signed-off-by: Rohan Garg <rohan.garg at collabora.com>
---
src/gallium/drivers/panfrost/pan_screen.c | 15 +++++++++++++++
src/gallium/drivers/panfrost/pan_screen.h | 6 ++++++
2 files changed, 21 insertions(+)
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index dccb0143a53..a0c940d4c30 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -563,6 +563,8 @@ panfrost_screen_get_compiler_options(struct pipe_screen *pscreen,
struct pipe_screen *
panfrost_create_screen(int fd, struct renderonly *ro)
{
+ unsigned gpu_id;
+ bool supported_gpu = false;
struct panfrost_screen *screen = rzalloc(NULL, struct panfrost_screen);
pan_debug = debug_get_option_pan_debug();
@@ -581,6 +583,19 @@ panfrost_create_screen(int fd, struct renderonly *ro)
screen->fd = fd;
+ gpu_id = panfrost_drm_query_gpu_version(screen);
+
+ for (int i = 0; i < ARRAY_SIZE(panfrost_supported_gpus); i++) {
+ if (panfrost_supported_gpus[i] == gpu_id)
+ supported_gpu = true;
+ }
+
+ if (!supported_gpu) {
+ fprintf(stderr, "Unsupported GPU\n");
+ free(screen);
+ return NULL;
+ }
+
if (pan_debug & PAN_DBG_TRACE)
pandecode_initialize();
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index 4907bd4395f..8c8915d0ad5 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -46,6 +46,12 @@ struct panfrost_screen;
#define PAN_ALLOCATE_INVISIBLE (1 << 2)
#define PAN_ALLOCATE_COHERENT_LOCAL (1 << 3)
+static const panfrost_supported_gpus[] = {
+ 0x0750,
+ 0x0820,
+ 0x0860
+};
+
struct panfrost_screen {
struct pipe_screen base;
int fd;
--
2.17.1
More information about the mesa-dev
mailing list