drm_gem_mmap(9)
π drm_gem_mmap β memory map routine for GEM objects β¨
okay so this is drm_gem_mmap(9) from the Kernel API Manual, and bestie, it's literally the memory-map routine for GEM objects. let's get into it π
πΈ SYNOPSIS πΈ
int drm_gem_mmap (struct file *filp , struct vm_area_struct *vma );
β¨ ARGUMENTS β¨
filpβ the DRM file pointer, aka the file you're coming in through π«Άvmaβ the VMA for the area that's about to get mapped π«
π DESCRIPTION π
so here's the vibe: if a driver supports GEM object mapping, then mmap calls on the DRM file descriptor will end up right here. like, this function is the main character they all report to π
what it does is look up the GEM object based on the offset that got passed in β and yes, vma->vm_pgoff will contain the fake offset we created, iykyk β and then it maps it with a call to drm_gem_mmap_obj.
π¨ important: if the caller is not granted access to the buffer object, the mmap will fail with EACCES. no access, no mapping, periodt. please see the vma manager for more information π§
π₯ SEE ALSO π₯
Kernel file ./drivers/gpu/drm/drm_gem.c π
drm_gem_huge_mnt_create(9)drm_gem_init(9)drm_gem_object_init(9)drm_gem_private_object_init(9)drm_gem_private_object_fini(9)drm_gem_object_handle_get_if_exists_unlocked(9)drm_gem_object_handle_free(9)drm_gem_object_handle_put_unlocked(9)drm_gem_handle_delete(9)drm_gem_dumb_map_offset(9)drm_gem_handle_create_tail(9)drm_gem_handle_create(9)drm_gem_free_mmap_offset(9)drm_gem_create_mmap_offset_size(9)drm_gem_create_mmap_offset(9)drm_gem_get_pages(9)drm_gem_put_pages(9)drm_gem_objects_lookup(9)drm_gem_object_lookup(9)drm_gem_dma_resv_wait(9)drm_gem_open(9)drm_gem_release(9)drm_gem_object_release(9)drm_gem_object_free(9)drm_gem_vm_open(9)drm_gem_vm_close(9)drm_gem_mmap_obj(9)drm_gem_get_unmapped_area(9)drm_gem_lock_reservations(9)drm_gem_lru_init(9)drm_gem_lru_remove(9)drm_gem_lru_move_tail_locked(9)drm_gem_lru_move_tail(9)drm_gem_lru_scan(9)drm_gem_evict_locked(9)
and that's the whole page, bestie β no cap, nothing skipped π
this lil drop came straight from the Kernel API Manual, living at ./drivers/gpu/drm, dated October 2026 β so yeah, shoutout to the drm_gem_mmap(9) era, she ate and left no crumbs πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms