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;
}
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)