Mesa (main): panfrost: Add panfrost_query_l2_slices helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 14:10:05 UTC 2022
Module: Mesa
Branch: main
Commit: 0ecbfcc892b89aebe30a266b05922a782ed324a5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ecbfcc892b89aebe30a266b05922a782ed324a5
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Wed May 25 14:34:39 2022 -0400
panfrost: Add panfrost_query_l2_slices helper
The number of L2 performance counter blocks equals the number of L2 slices, so
add a query to get this. This information isn't needed by the Mesa driver, so
don't get it in the default device initialization path.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Antonio Caggiano <antonio.caggiano at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16803>
---
src/panfrost/lib/pan_device.h | 3 +++
src/panfrost/lib/pan_props.c | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/panfrost/lib/pan_device.h b/src/panfrost/lib/pan_device.h
index a334a194081..dbd9fafb4fa 100644
--- a/src/panfrost/lib/pan_device.h
+++ b/src/panfrost/lib/pan_device.h
@@ -272,6 +272,9 @@ panfrost_query_sample_position(
unsigned sample_idx,
float *out);
+unsigned
+panfrost_query_l2_slices(const struct panfrost_device *dev);
+
static inline struct panfrost_bo *
pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
{
diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c
index 8ec6049427f..3cc16169d4c 100644
--- a/src/panfrost/lib/pan_props.c
+++ b/src/panfrost/lib/pan_props.c
@@ -125,6 +125,18 @@ panfrost_query_gpu_revision(int fd)
return panfrost_query_raw(fd, DRM_PANFROST_PARAM_GPU_REVISION, true, 0);
}
+unsigned
+panfrost_query_l2_slices(const struct panfrost_device *dev)
+{
+ /* Query MEM_FEATURES register */
+ uint32_t mem_features =
+ panfrost_query_raw(dev->fd, DRM_PANFROST_PARAM_MEM_FEATURES,
+ true, 0);
+
+ /* L2_SLICES is MEM_FEATURES[11:8] minus(1) */
+ return ((mem_features >> 8) & 0xF) + 1;
+}
+
static struct panfrost_tiler_features
panfrost_query_tiler_features(int fd)
{
More information about the mesa-commit
mailing list