From e271b1ae537a339ead13cf76682d9761fb570029 Mon Sep 17 00:00:00 2001 From: Ajay Dudani <adudani@codeaurora.org> Date: Wed, 12 Jun 2013 13:33:19 -0700 Subject: [PATCH] msm: kgsl: use kgsl_mmu_device_setstate() if the GPU is already idle Use the default setstate function, which directly reprograms the IOMMU, to change IOMMU pagetables or flush the TLB if the GPU is already idle. This condition often occurs when the GPU is being powered down. In this case it is desirable to avoid the overhead of issuing commands, waiting for idle and firing events that results from using the GPU command stream to reprogram the IOMMU. Change-Id: I633002ac49c8fe58df3f1f6a1fd1ddf705fc1733 Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org> Signed-off-by: Ajay Dudani <adudani@codeaurora.org> --- drivers/gpu/msm/adreno.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 22be14c3a072..1ad44646fa7c 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -310,8 +310,14 @@ static void adreno_iommu_setstate(struct kgsl_device *device, struct kgsl_context *context; struct adreno_context *adreno_ctx = NULL; - if (!adreno_dev->drawctxt_active) + /* + * If we're idle and we don't need to use the GPU to save context + * state, use the CPU instead of the GPU to reprogram the + * iommu for simplicity's sake. + */ + if (!adreno_dev->drawctxt_active || device->ftbl->isidle(device)) return kgsl_mmu_device_setstate(&device->mmu, flags); + num_iommu_units = kgsl_mmu_get_num_iommu_units(&device->mmu); context = kgsl_context_get(device, context_id); -- GitLab