Commit 3ab1c5cc authored by Rob Clark's avatar Rob Clark

drm/msm: Add param for userspace to query suspend count

Performance counts, and ALWAYS_ON counters used for capturing GPU
timestamps, lose their state across suspend/resume cycles.  Userspace
tooling for performance monitoring needs to be aware of this.  For
example, after a suspend userspace needs to recalibrate it's offset
between CPU and GPU time.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Acked-by: default avatarJordan Crouse <jordan@cosmicpenguin.net>
Link: https://lore.kernel.org/r/20210325012358.1759770-3-robdclark@gmail.comSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent f5b1a878
...@@ -273,6 +273,9 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value) ...@@ -273,6 +273,9 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value)
case MSM_PARAM_FAULTS: case MSM_PARAM_FAULTS:
*value = gpu->global_faults; *value = gpu->global_faults;
return 0; return 0;
case MSM_PARAM_SUSPENDS:
*value = gpu->suspend_count;
return 0;
default: default:
DBG("%s: invalid param: %u", gpu->name, param); DBG("%s: invalid param: %u", gpu->name, param);
return -EINVAL; return -EINVAL;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
* GEM object's debug name * GEM object's debug name
* - 1.5.0 - Add SUBMITQUERY_QUERY ioctl * - 1.5.0 - Add SUBMITQUERY_QUERY ioctl
* - 1.6.0 - Syncobj support * - 1.6.0 - Syncobj support
* - 1.7.0 - Add MSM_PARAM_SUSPENDS to access suspend count
*/ */
#define MSM_VERSION_MAJOR 1 #define MSM_VERSION_MAJOR 1
#define MSM_VERSION_MINOR 6 #define MSM_VERSION_MINOR 6
......
...@@ -251,6 +251,8 @@ int msm_gpu_pm_suspend(struct msm_gpu *gpu) ...@@ -251,6 +251,8 @@ int msm_gpu_pm_suspend(struct msm_gpu *gpu)
if (ret) if (ret)
return ret; return ret;
gpu->suspend_count++;
return 0; return 0;
} }
......
...@@ -152,6 +152,8 @@ struct msm_gpu { ...@@ -152,6 +152,8 @@ struct msm_gpu {
ktime_t time; ktime_t time;
} devfreq; } devfreq;
uint32_t suspend_count;
struct msm_gpu_state *crashstate; struct msm_gpu_state *crashstate;
/* True if the hardware supports expanded apriv (a650 and newer) */ /* True if the hardware supports expanded apriv (a650 and newer) */
bool hw_apriv; bool hw_apriv;
......
...@@ -76,6 +76,7 @@ struct drm_msm_timespec { ...@@ -76,6 +76,7 @@ struct drm_msm_timespec {
#define MSM_PARAM_NR_RINGS 0x07 #define MSM_PARAM_NR_RINGS 0x07
#define MSM_PARAM_PP_PGTABLE 0x08 /* => 1 for per-process pagetables, else 0 */ #define MSM_PARAM_PP_PGTABLE 0x08 /* => 1 for per-process pagetables, else 0 */
#define MSM_PARAM_FAULTS 0x09 #define MSM_PARAM_FAULTS 0x09
#define MSM_PARAM_SUSPENDS 0x0a
struct drm_msm_param { struct drm_msm_param {
__u32 pipe; /* in, MSM_PIPE_x */ __u32 pipe; /* in, MSM_PIPE_x */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment