panfrost: Check GPU version before loading

Panfrost is known to only work on a select few CPU/GPU combinations at
the moment (tested system-on-chips: RK3288, RK3399, and S912). Whitelist
the combinations known to work and refuse to load on others where
nothing works yet to avoid user confusion.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-08 09:14:59 -07:00
parent b5de423ac1
commit 2f7145a6de
3 changed files with 28 additions and 5 deletions

View file

@ -2675,12 +2675,9 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
struct panfrost_screen *pscreen = pan_screen(screen);
memset(ctx, 0, sizeof(*ctx));
struct pipe_context *gallium = (struct pipe_context *) ctx;
unsigned gpu_id;
gpu_id = panfrost_drm_query_gpu_version(pscreen);
ctx->is_t6xx = gpu_id <= 0x0750; /* For now, this flag means T760 or less */
ctx->require_sfbd = gpu_id < 0x0750; /* T760 is the first to support MFBD */
ctx->is_t6xx = pscreen->gpu_id <= 0x0750; /* For now, this flag means T760 or less */
ctx->require_sfbd = pscreen->gpu_id < 0x0750; /* T760 is the first to support MFBD */
gallium->screen = screen;

View file

@ -487,6 +487,31 @@ panfrost_create_screen(int fd, struct renderonly *ro)
screen->fd = fd;
screen->gpu_id = panfrost_drm_query_gpu_version(screen);
/* Check if we're loading against a supported GPU model
* paired with a supported CPU (differences from
* armhf/aarch64 break models on incompatible CPUs at the
* moment -- this is a TODO). In other words, we whitelist
* RK3288, RK3399, and S912, which are verified to work. */
switch (screen->gpu_id) {
#ifdef __LP64__
case 0x820: /* T820 */
case 0x860: /* T860 */
break;
#else
case 0x750: /* T760 */
break;
#endif
default:
/* Fail to load against untested models */
debug_printf("panfrost: Unsupported model %X",
screen->gpu_id);
return NULL;
}
if (pan_debug & PAN_DBG_TRACE)
pandecode_initialize();

View file

@ -49,6 +49,7 @@ struct panfrost_screen;
struct panfrost_screen {
struct pipe_screen base;
int fd;
unsigned gpu_id;
struct renderonly *ro;