carta
drm_gem_mmap_obj(9)

drm_gem_mmap_obj9

Memory map a gem object

Arguments

obj

the GEM object to map

obj_size

the object size to be mapped, in bytes

vma

VMA for the area to be mapped

Overview

Set up the VMA to prepare mapping of the GEM object using the gem_vm_ops provided by the driver. Depending on their requirements, drivers can either provide a fault handler in their gem_vm_ops (in which case any accesses to the object will be trapped, to perform migration, GTT binding, surface register allocation, or performance monitoring), or mmap the buffer memory synchronously after calling drm_gem_mmap_obj.

This function is mainly intended to implement the DMABUF mmap operation, when the GEM object is not looked up based on its fake offset. To implement the DRM mmap operation, drivers should use the drm_gem_mmap function.

drm_gem_mmap_obj assumes the user is granted access to the buffer while drm_gem_mmap prevents unprivileged users from mapping random objects. So callers must verify access restrictions before calling this helper.

Note

This function has to be protected with dev->struct_mutex

Return 0 or success or -EINVAL if the object size is smaller than the VMA size, or if no gem_vm_ops are provided.

Authors

Jesse Barnes <[email protected]>
Intel Corporation,

Initial version

Laurent Pinchart <[email protected]>
Ideas on board SPRL,

Driver internals

Daniel Vetter <[email protected]>
Intel Corporation,

Contributions all over the place

From linux-manual-3.16 3.16.56-1+deb8u1 in Debian 8 (Jessie). Parsed by carta from the page's man source.