Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd3f7a05 authored by Abhilash Kumar's avatar Abhilash Kumar Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarAbhilash Kumar <krabhi@codeaurora.org>
parent 31679781
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -518,7 +518,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;
@@ -529,6 +529,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
@@ -536,9 +538,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;