Use mmap64() for performing the GTT mapping

Although the address space for GTT mappings may only be 32-bits, we need
to use the explicit 64-bit mmap interface so that on a 32-bit platform
the offset we pass is not truncated to 31-bits.

Fixes gem_mmap_offset_exhaustion on 32-bit platforms.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-04-12 15:47:00 +01:00
parent 8f6ebd4ac0
commit 5ce86f88a0

View File

@ -303,7 +303,7 @@ void *gem_mmap(int fd, uint32_t handle, int size, int prot)
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg)) if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
return NULL; return NULL;
ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset); ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
if (ptr == MAP_FAILED) if (ptr == MAP_FAILED)
ptr = NULL; ptr = NULL;