Mesa (master): panfrost: Add PAN_GPU_ID debug option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 13:26:48 UTC 2020


Module: Mesa
Branch: master
Commit: 33a764554204596db67940a5672a7690f56f3a4b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33a764554204596db67940a5672a7690f56f3a4b

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Fri Nov 13 16:59:16 2020 -0500

panfrost: Add PAN_GPU_ID debug option

I'd like to run shader-db locally without turning on the Bifrost
machine. I'm lazy, it's just for debug builds, ok? 😇

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>

---

 src/panfrost/lib/pan_props.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c
index c40d9c014f5..0553d5f3959 100644
--- a/src/panfrost/lib/pan_props.c
+++ b/src/panfrost/lib/pan_props.c
@@ -64,6 +64,16 @@ 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