diff --git a/src/freedreno/common/freedreno_dev_info.h b/src/freedreno/common/freedreno_dev_info.h index b925d778bb5..811f9e60336 100644 --- a/src/freedreno/common/freedreno_dev_info.h +++ b/src/freedreno/common/freedreno_dev_info.h @@ -9,6 +9,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -379,6 +380,14 @@ fd_dev_gpu_id(const struct fd_dev_id *id) /* Unmodified dev info as defined in freedreno_devices.py */ const struct fd_dev_info *fd_dev_info_raw(const struct fd_dev_id *id); +/* Helper to check if GPU is known before going any further */ +static inline uint8_t +fd_dev_is_supported(const struct fd_dev_id *id) { + assert(id); + assert(id->gpu_id || id->chip_id); + return fd_dev_info_raw(id) != NULL; +} + /* Final dev info with dbg options and everything else applied. */ const struct fd_dev_info fd_dev_info(const struct fd_dev_id *id); diff --git a/src/freedreno/drm/freedreno_pipe.c b/src/freedreno/drm/freedreno_pipe.c index ab53c55152d..8373488368a 100644 --- a/src/freedreno/drm/freedreno_pipe.c +++ b/src/freedreno/drm/freedreno_pipe.c @@ -45,6 +45,13 @@ fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio) fd_pipe_get_param(pipe, FD_CHIP_ID, &val); pipe->dev_id.chip_id = val; + if (!fd_dev_is_supported(&pipe->dev_id)) { + ERROR_MSG("unsupported GPU id 0x%" PRIx32 " / chip id 0x%" PRIx64, + pipe->dev_id.gpu_id, + pipe->dev_id.chip_id); + return NULL; + } + pipe->is_64bit = fd_dev_64b(&pipe->dev_id); /* Use the _NOSYNC flags because we don't want the control_mem bo to hold