summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_gpu.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2022-03-03 16:52:16 -0800
committerRob Clark <robdclark@chromium.org>2022-03-04 11:59:31 -0800
commit90f45c42d7d7b0ec0fd797485c07fc421c474e12 (patch)
tree152e021024f941ad5476aa2585f455bb58d4d321 /drivers/gpu/drm/msm/msm_gpu.h
parentf7ddbf5581b474fe4a0a29244acaa1bf72234675 (diff)
downloadlinux-stable-90f45c42d7d7b0ec0fd797485c07fc421c474e12.tar.gz
linux-stable-90f45c42d7d7b0ec0fd797485c07fc421c474e12.tar.bz2
linux-stable-90f45c42d7d7b0ec0fd797485c07fc421c474e12.zip
drm/msm: Add SYSPROF param (v2)
Add a SYSPROF param for system profiling tools like Mesa's pps-producer (perfetto) to control behavior related to system-wide performance counter collection. In particular, for profiling, one wants to ensure that GPU context switches do not effect perfcounter state, and might want to suppress suspend (which would cause counters to lose state). v2: Swap the order in msm_file_private_set_sysprof() [sboyd] and initialize the sysprof_active refcount to one (because the under/ overflow checking in refcount_t doesn't expect a 0->1 transition) meaning that values greater than 1 means sysprof is active. Signed-off-by: Rob Clark <robdclark@chromium.org> Link: https://lore.kernel.org/r/20220304005317.776110-4-robdclark@gmail.com
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.h')
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 07ee6573a301..02419f2ca2bc 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -160,6 +160,13 @@ struct msm_gpu {
int nr_rings;
/**
+ * sysprof_active:
+ *
+ * The count of contexts that have enabled system profiling.
+ */
+ refcount_t sysprof_active;
+
+ /**
* cur_ctx_seqno:
*
* The ctx->seqno value of the last context to submit rendering,
@@ -330,6 +337,24 @@ struct msm_file_private {
int seqno;
/**
+ * sysprof:
+ *
+ * The value of MSM_PARAM_SYSPROF set by userspace. This is
+ * intended to be used by system profiling tools like Mesa's
+ * pps-producer (perfetto), and restricted to CAP_SYS_ADMIN.
+ *
+ * Setting a value of 1 will preserve performance counters across
+ * context switches. Setting a value of 2 will in addition
+ * suppress suspend. (Performance counters lose state across
+ * power collapse, which is undesirable for profiling in some
+ * cases.)
+ *
+ * The value automatically reverts to zero when the drm device
+ * file is closed.
+ */
+ int sysprof;
+
+ /**
* entities:
*
* Table of per-priority-level sched entities used by submitqueues
@@ -525,6 +550,8 @@ void msm_submitqueue_close(struct msm_file_private *ctx);
void msm_submitqueue_destroy(struct kref *kref);
+int msm_file_private_set_sysprof(struct msm_file_private *ctx,
+ struct msm_gpu *gpu, int sysprof);
void __msm_file_private_destroy(struct kref *kref);
static inline void msm_file_private_put(struct msm_file_private *ctx)