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) {