msm: kgsl: Don't count io busy at the lowest power level
If the GPU is running as slowly as possible, it is adding
lots of io busy to the CPU. This causes the CPU ondemand
algorithm to unneccessarily increase CPU frequency.
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 8fef073..d30427d 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -1050,15 +1050,18 @@
}
/*
- wait_io_event_interruptible_timeout checks for the exit condition before
+ wait_event_interruptible_timeout checks for the exit condition before
placing a process in wait q. For conditional interrupts we expect the
process to already be in its wait q when its exit condition checking
function is called.
*/
-#define kgsl_wait_io_event_interruptible_timeout(wq, condition, timeout)\
+#define kgsl_wait_event_interruptible_timeout(wq, condition, timeout, io)\
({ \
long __ret = timeout; \
- __wait_io_event_interruptible_timeout(wq, condition, __ret); \
+ if (io) \
+ __wait_io_event_interruptible_timeout(wq, condition, __ret);\
+ else \
+ __wait_event_interruptible_timeout(wq, condition, __ret);\
__ret; \
})
@@ -1068,7 +1071,9 @@
unsigned int msecs)
{
long status = 0;
+ uint io = 1;
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
+ struct kgsl_pwrctrl *pwr = &device->pwrctrl;
if (timestamp != adreno_dev->ringbuffer.timestamp &&
timestamp_cmp(timestamp,
@@ -1080,13 +1085,20 @@
goto done;
}
if (!kgsl_check_timestamp(device, timestamp)) {
+ if (pwr->active_pwrlevel) {
+ int low_pwrlevel = pwr->num_pwrlevels -
+ KGSL_PWRLEVEL_LOW_OFFSET;
+ if (pwr->active_pwrlevel == low_pwrlevel)
+ io = 0;
+ }
mutex_unlock(&device->mutex);
/* We need to make sure that the process is placed in wait-q
* before its condition is called */
- status = kgsl_wait_io_event_interruptible_timeout(
+ status = kgsl_wait_event_interruptible_timeout(
device->wait_queue,
kgsl_check_interrupt_timestamp(device,
- timestamp), msecs_to_jiffies(msecs));
+ timestamp),
+ msecs_to_jiffies(msecs), io);
mutex_lock(&device->mutex);
if (status > 0)
diff --git a/drivers/gpu/msm/kgsl_pwrctrl.h b/drivers/gpu/msm/kgsl_pwrctrl.h
index c3ade1a..794a895 100644
--- a/drivers/gpu/msm/kgsl_pwrctrl.h
+++ b/drivers/gpu/msm/kgsl_pwrctrl.h
@@ -26,6 +26,8 @@
#define KGSL_PWRLEVEL_TURBO 0
#define KGSL_PWRLEVEL_NOMINAL 1
+#define KGSL_PWRLEVEL_LOW_OFFSET 2
+
#define KGSL_MAX_CLKS 5
struct platform_device;