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

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

Merge "drm:msm: begin/end CPU access before dma_buf vmap/vunmap"

parents a5f54639 4d09a720
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -648,12 +648,18 @@ void *msm_gem_get_vaddr(struct drm_gem_object *obj)
			goto fail;
		}

		if (obj->import_attach)
		if (obj->import_attach) {
			ret = dma_buf_begin_cpu_access(
				obj->import_attach->dmabuf, DMA_BIDIRECTIONAL);
			if (ret)
				goto fail;

			msm_obj->vaddr =
				dma_buf_vmap(obj->import_attach->dmabuf);
		else
		} else {
			msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
				VM_MAP, pgprot_writecombine(PAGE_KERNEL));
		}

		if (msm_obj->vaddr == NULL) {
			ret = -ENOMEM;
@@ -751,10 +757,13 @@ static void msm_gem_vunmap_locked(struct drm_gem_object *obj)
	if (!msm_obj->vaddr || WARN_ON(!is_vunmapable(msm_obj)))
		return;

	if (obj->import_attach)
	if (obj->import_attach) {
		dma_buf_vunmap(obj->import_attach->dmabuf, msm_obj->vaddr);
	else
		dma_buf_end_cpu_access(obj->import_attach->dmabuf,
						DMA_BIDIRECTIONAL);
	} else {
		vunmap(msm_obj->vaddr);
	}

	msm_obj->vaddr = NULL;
}