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

Commit 31fe3b64 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Do not mark all buffers as iocoherent"

parents 98e83a9d b3c1aa05
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/highmem.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/bitfield.h>

#include "kgsl_device.h"
#include "kgsl_pool.h"
@@ -664,6 +665,7 @@ void kgsl_memdesc_init(struct kgsl_device *device,
{
	struct kgsl_mmu *mmu = &device->mmu;
	unsigned int align;
	u32 cachemode;

	memset(memdesc, 0, sizeof(*memdesc));
	/* Turn off SVM if the system doesn't support it */
@@ -683,6 +685,17 @@ void kgsl_memdesc_init(struct kgsl_device *device,
	} else if (IS_ENABLED(CONFIG_QCOM_KGSL_IOCOHERENCY_DEFAULT))
		flags |= KGSL_MEMFLAGS_IOCOHERENT;

	/*
	 * We can't enable I/O coherency on uncached surfaces because of
	 * situations where hardware might snoop the cpu caches which can
	 * have stale data. This happens primarily due to the limitations
	 * of dma caching APIs available on arm64
	 */
	cachemode = FIELD_GET(KGSL_CACHEMODE_MASK, flags);
	if ((cachemode == KGSL_CACHEMODE_WRITECOMBINE ||
		cachemode == KGSL_CACHEMODE_UNCACHED))
		flags &= ~((u64) KGSL_MEMFLAGS_IOCOHERENT);

	if (MMU_FEATURE(mmu, KGSL_MMU_NEED_GUARD_PAGE))
		memdesc->priv |= KGSL_MEMDESC_GUARD_PAGE;