[COMMON] g2d: eliminate unnecessary cache maintenance
authorhyesoo.yu <hyesoo.yu@samsung.com>
Thu, 2 Nov 2017 12:47:44 +0000 (21:47 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:15 +0000 (20:22 +0300)
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 <hyesoo.yu@samsung.com>
drivers/gpu/exynos/g2d/g2d_uapi_process.c

index 0e8ed16d5141bffe3bb4ebe87455ff8ea07a5949..b363194a687bb342a13c8f6a333b87c5ae76e7c2 100644 (file)
@@ -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)