[Freedreno] [PATCH] libwrap: fix mmap for IOCTL_KGSL_GPUMEM_ALLOC_ID

Stanislav Vorobiov sheffmail at mail.ru
Sat Jun 28 08:59:20 PDT 2014


---
 wrap/wrap-syscall.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/wrap/wrap-syscall.c b/wrap/wrap-syscall.c
index 5fb2083..76e22fd 100644
--- a/wrap/wrap-syscall.c
+++ b/wrap/wrap-syscall.c
@@ -1028,6 +1028,16 @@ void * mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset
 		struct buffer *buf = find_buffer(NULL, 0, offset, 0, 0);
 		if (buf)
 			buf->hostptr = ret;
+		else {
+			/*
+			 * when a buffer is allocated using IOCTL_KGSL_GPUMEM_ALLOC_ID
+			 * it's mmapped by id, not by gpuaddr, so try to find that
+			 * buffer via id now.
+			 */
+			buf = find_buffer(NULL, 0, 0, 0, offset >> 12);
+			if (buf)
+				buf->hostptr = ret;
+		}
 		printf("< [%4d]         : mmap: -> (%p)\n", fd, ret);
 	}
 
-- 
1.7.9.5



More information about the Freedreno mailing list