summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAbhilash Kumar <krabhi@codeaurora.org>2017-07-17 01:05:23 +0530
committerAbhilash Kumar <krabhi@codeaurora.org>2017-07-21 10:49:25 +0530
commit9b0026e54f16dfc64d8bc8a566e333bfdaa314db (patch)
tree2466e0f13e26530584a7cda26c2735e7bd44e482 /drivers/gpu
parent7aa065cbc4f86125895f6c7c6a5ac1fdda231505 (diff)
msm: kgsl: Update total time at right place for accurate GPU busy
For calculation of busy time and total time, KGSL relies on perf counters and CPU clock. These can be a bit out of sync and may give GPU busy greater than 100 percent. Updating time at the right place will give more accurate total time and will avoid crossing 100% in GPU busy calculation. Change-Id: I3cc702492325b9dc44ea2b705e4d9014d95abd33 Signed-off-by: Abhilash Kumar <krabhi@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/msm/kgsl_pwrscale.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/msm/kgsl_pwrscale.c b/drivers/gpu/msm/kgsl_pwrscale.c
index 3e4cc4490792..2b7a1fcbaa78 100644
--- a/drivers/gpu/msm/kgsl_pwrscale.c
+++ b/drivers/gpu/msm/kgsl_pwrscale.c
@@ -591,7 +591,7 @@ int kgsl_devfreq_get_dev_status(struct device *dev,
struct kgsl_device *device = dev_get_drvdata(dev);
struct kgsl_pwrctrl *pwrctrl;
struct kgsl_pwrscale *pwrscale;
- ktime_t tmp;
+ ktime_t tmp1, tmp2;
if (device == NULL)
return -ENODEV;
@@ -602,6 +602,8 @@ int kgsl_devfreq_get_dev_status(struct device *dev,
pwrctrl = &device->pwrctrl;
mutex_lock(&device->mutex);
+
+ tmp1 = ktime_get();
/*
* If the GPU clock is on grab the latest power counter
* values. Otherwise the most recent ACTIVE values will
@@ -609,9 +611,9 @@ int kgsl_devfreq_get_dev_status(struct device *dev,
*/
kgsl_pwrscale_update_stats(device);
- tmp = ktime_get();
- stat->total_time = ktime_us_delta(tmp, pwrscale->time);
- pwrscale->time = tmp;
+ tmp2 = ktime_get();
+ stat->total_time = ktime_us_delta(tmp2, pwrscale->time);
+ pwrscale->time = tmp1;
stat->busy_time = pwrscale->accum_stats.busy_time;