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

Commit 4541dad7 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Record the cacheability attribute of ion buffers"

parents 2353e399 7e54c564
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/compat.h>
#include <linux/ctype.h>
#include <linux/mm.h>
#include <linux/ion.h>
#include <asm/cacheflush.h>
#include <uapi/linux/sched/types.h>

@@ -2352,6 +2353,7 @@ static long _gpuobj_map_dma_buf(struct kgsl_device *device,
{
	struct kgsl_gpuobj_import_dma_buf buf;
	struct dma_buf *dmabuf;
	unsigned long flags = 0;
	int ret;

	/*
@@ -2382,6 +2384,16 @@ static long _gpuobj_map_dma_buf(struct kgsl_device *device,
	if (IS_ERR_OR_NULL(dmabuf))
		return (dmabuf == NULL) ? -EINVAL : PTR_ERR(dmabuf);

	/*
	 * ION cache ops are routed through kgsl, so record if the dmabuf is
	 * cached or not in the memdesc. Assume uncached if dma_buf_get_flags
	 * fails.
	 */
	dma_buf_get_flags(dmabuf, &flags);
	if (flags & ION_FLAG_CACHED)
		entry->memdesc.flags |=
			KGSL_CACHEMODE_WRITEBACK << KGSL_CACHEMODE_SHIFT;

	ret = kgsl_setup_dma_buf(device, pagetable, entry, dmabuf);
	if (ret)
		dma_buf_put(dmabuf);