From 357bb212af1d2216f932f8c8b16a6ef5262eff5c Mon Sep 17 00:00:00 2001 From: "hyesoo.yu" Date: Thu, 2 Nov 2017 21:47:44 +0900 Subject: [PATCH] [COMMON] g2d: eliminate unnecessary cache maintenance The g2d execute cache maintencance only for the cachable buffer that is accessed by GPU if device is coherent, so condition check for cache maintenance is fixed. Change-Id: I9b8fa16cddcd12c00ed95fc08e4d4e179411938e Signed-off-by: hyesoo.yu --- drivers/gpu/exynos/g2d/g2d_uapi_process.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_uapi_process.c b/drivers/gpu/exynos/g2d/g2d_uapi_process.c index 0e8ed16d5141..b363194a687b 100644 --- a/drivers/gpu/exynos/g2d/g2d_uapi_process.c +++ b/drivers/gpu/exynos/g2d/g2d_uapi_process.c @@ -226,12 +226,13 @@ static int g2d_get_dmabuf(struct g2d_task *task, goto err; } - if (ion_cached_needsync_dmabuf(dmabuf)) + if (dir != DMA_TO_DEVICE) + prot |= IOMMU_WRITE; + + if (ion_cached_needsync_dmabuf(dmabuf)) { task->total_cached_len += buffer->payload; - if (dir != DMA_TO_DEVICE) { - prot |= IOMMU_WRITE; - if (ion_may_hwrender_dmabuf(dmabuf)) + if ((dir == DMA_TO_DEVICE) && ion_may_hwrender_dmabuf(dmabuf)) task->total_hwrender_len += buffer->payload; } @@ -770,6 +771,8 @@ int g2d_get_userdata(struct g2d_device *g2d_dev, struct g2d_context *ctx, task->flags = data->flags; task->num_source = data->num_source; + task->total_cached_len = 0; + task->total_hwrender_len = 0; ret = g2d_import_commands(g2d_dev, task, data, task->num_source); if (ret < 0) -- 2.20.1