panfrost: Rework PAN_GPU_ID mechanism

Originally, PAN_GPU_ID was checked in the driver itself. I added the mechanism
to run Bifrost shader-db on my Midgard laptop. There was no drm-shim support at
this point, and this was a reasonable stop gap at the time.

Nowadays, we have a competent drm-shim implementation, which wholly replaces
this use case. So PAN_GPU_ID is only useful for drm-shim. Let's pull the code
into drm-shim and get it out of the driver. This allows NDEBUG drm-shim builds
to work properly.

While we're at it, the default emulated GPU is changed from Mali-T860 to
Mali-G52. This reflects our shifting development priorities.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Suggested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15930>
This commit is contained in:
Alyssa Rosenzweig 2022-04-14 11:23:48 -04:00
parent dae5e1bccd
commit 4d460c9fdd
2 changed files with 13 additions and 12 deletions

View file

@ -30,6 +30,9 @@
#include "util/u_math.h"
/* Default GPU ID if PAN_GPU_ID is not set. This defaults to Mali-G52. */
#define PAN_GPU_ID_DEFAULT (0x7212)
bool drm_shim_driver_prefers_first_render_node = true;
static int
@ -45,9 +48,17 @@ pan_ioctl_get_param(int fd, unsigned long request, void *arg)
switch (gp->param) {
case DRM_PANFROST_PARAM_GPU_PROD_ID:
/* Other GPUs can be set using PAN_GPU_ID */
gp->value = 0x860;
{
char *override_version = getenv("PAN_GPU_ID");
if (override_version)
gp->value = strtol(override_version, NULL, 16);
else
gp->value = PAN_GPU_ID_DEFAULT;
return 0;
}
case DRM_PANFROST_PARAM_SHADER_PRESENT:
/* Assume an MP4 GPU */
gp->value = 0xF;

View file

@ -115,16 +115,6 @@ panfrost_query_raw(
static unsigned
panfrost_query_gpu_version(int fd)
{
#ifndef NDEBUG
/* In debug builds, allow overriding the GPU ID, for example to run
* Bifrost shader-db on a Midgard machine. This is a bit less heavy
* handed than setting up the entirety of drm-shim */
char *override_version = getenv("PAN_GPU_ID");
if (override_version)
return strtol(override_version, NULL, 16);
#endif
return panfrost_query_raw(fd, DRM_PANFROST_PARAM_GPU_PROD_ID, true, 0);
}