Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 312e4b6f authored by Sushmita Susheelendra's avatar Sushmita Susheelendra
Browse files

msm: kgsl: Sync non io-coherent dma buffers on attach to GPU



Sync the dma buffer when it is attached to the GPU device.
This is necessary to make sure any data in the buffer
is flushed to memory at attach time. Skipping it can
lead to coherency problems between CPU and GPU. The sync
can be skipped for IO-coherent DMA buffers.

Change-Id: I06fa54822688b1834e83a4e137c95d1c681300fb
Signed-off-by: default avatarSushmita Susheelendra <ssusheel@codeaurora.org>
parent 4719c01d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2672,6 +2672,12 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device,
		return -ENOMEM;

	attach = dma_buf_attach(dmabuf, device->dev);
	/*
	 * If dma buffer is marked IO coherent, skip sync at attach,
	 * which involves flushing the buffer on CPU.
	 * HW manages coherency for IO coherent buffers.
	 */
	if (entry->memdesc.flags & KGSL_MEMFLAGS_IOCOHERENT)
		attach->dma_map_attrs |= DMA_ATTR_SKIP_CPU_SYNC;

	if (IS_ERR_OR_NULL(attach)) {