summaryrefslogtreecommitdiff
path: root/debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch')
-rw-r--r--debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch b/debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch
new file mode 100644
index 0000000..8b5a076
--- /dev/null
+++ b/debian/dkms/patches/0001-km-fix-failed-mmap-s-of-non-page-aligned-buffers.patch
@@ -0,0 +1,52 @@
+From d13f1b816d82ba4dd1d4fd13efbfb78cdf6eac6f Mon Sep 17 00:00:00 2001
+From: Rob Clark <rob@ti.com>
+Date: Mon, 23 Apr 2012 16:38:37 -0500
+Subject: [PATCH] km: fix failed mmap's of non-page aligned buffers
+
+GEM would round up the buffer size to next page boundary, but if the
+backing memory is not page aligned to begin w/ the ui32RealByteSize
+could actually be rounded up to next+1 page boundary. Causing an
+error to be returned from drm_gem_mmap() later when userspace attempts
+to mmap() the buffer.
+---
+ services4/srvkm/env/linux/mmap.c | 10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/services4/srvkm/env/linux/mmap.c b/services4/srvkm/env/linux/mmap.c
+index ca38e5d..5835594 100644
+--- a/services4/srvkm/env/linux/mmap.c
++++ b/services4/srvkm/env/linux/mmap.c
+@@ -420,6 +420,10 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc,
+
+ psLinuxMemArea = (LinuxMemArea *)hOSMemHandle;
+
++ DetermineUsersSizeAndByteOffset(psLinuxMemArea,
++ pui32RealByteSize,
++ pui32ByteOffset);
++
+ #if defined(SUPPORT_DRI_DRM_EXTERNAL)
+ /* if we are using DRM/GEM, then let GEM generate the buffer offset..
+ * this is done by creating a wrapper object.
+@@ -430,7 +434,7 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc,
+ if (!buf)
+ {
+ buf = create_gem_wrapper(psEnvPerProc->dev,
+- psLinuxMemArea, 0, psLinuxMemArea->ui32ByteSize);
++ psLinuxMemArea, 0, *pui32RealByteSize);
+ if (!buf)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "%s: Screw you guys, I'm going home..", __FUNCTION__));
+@@ -442,10 +446,6 @@ PVRMMapOSMemHandleToMMapData(PVRSRV_PER_PROCESS_DATA *psPerProc,
+ }
+ #endif /* SUPPORT_DRI_DRM_EXTERNAL */
+
+- DetermineUsersSizeAndByteOffset(psLinuxMemArea,
+- pui32RealByteSize,
+- pui32ByteOffset);
+-
+ psOffsetStruct = FindOffsetStructByPID(psLinuxMemArea, psPerProc->ui32PID);
+ if (psOffsetStruct)
+ {
+--
+1.7.4.1
+