Mesa (main): panfrost: Rework PAN_GPU_ID mechanism
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Apr 16 16:13:05 UTC 2022
Module: Mesa
Branch: main
Commit: 4d460c9fdd3893e1272290cce35a15dbe2c0d93a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d460c9fdd3893e1272290cce35a15dbe2c0d93a
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Thu Apr 14 11:23:48 2022 -0400
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 at collabora.com>
Suggested-by: Icecream95 <ixn at disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15930>
---
src/panfrost/drm-shim/panfrost_noop.c | 15 +++++++++++++--
src/panfrost/lib/pan_props.c | 10 ----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/panfrost/drm-shim/panfrost_noop.c b/src/panfrost/drm-shim/panfrost_noop.c
index 52f82d1d5c8..ef1211d6680 100644
--- a/src/panfrost/drm-shim/panfrost_noop.c
+++ b/src/panfrost/drm-shim/panfrost_noop.c
@@ -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;
diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c
index 693b475beb5..152fd2cb5ef 100644
--- a/src/panfrost/lib/pan_props.c
+++ b/src/panfrost/lib/pan_props.c
@@ -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);
}
More information about the mesa-commit
mailing list