drm_gem_create_mmap_offset(9)
π drm_gem_create_mmap_offset (kernel API manual, bestie edition) π
okay so welcome to the group chat, the function we're stanning today is literally drm_gem_create_mmap_offset(9) β she lives in the Kernel API Manual and honestly she's giving backstage-pass energy for GEM objects. let's get into it β¨
πΈ NAME πΈ
drm_gem_create_mmap_offset β create a fake mmap offset for an object π«Ά
no fr, "fake" is the official word here, it's iconic, we love a harmless little fiction π
β¨ SYNOPSIS β¨
int drm_gem_create_mmap_offset (struct drm_gem_object *obj );
that's it, that's the whole vibe check β one argument, returns an int, slay π
π¦ ARGUMENTS π¦
objβ the obj in question π (yes, that's literally what the manual says, and honestly? valid. it's the object you're doing the whole fake-offset thing for.)
π₯ DESCRIPTION π₯
so here's how GEM memory mapping works, bestie, listen up π§
it hands back to userspace a fake mmap offset that userspace can then use in a subsequent mmap(2) call. then the DRM core code does its little lookup moment β it looks up the object based on that offset and sets up all the various memory mapping structures. main character behaviour, no cap π
this routine allocates and attaches a fake offset for obj. periodt. that's the job π
drivers can call drm_gem_free_mmap_offset before freeing obj to release the fake offset again β like returning your borrowed hoodie before you move out, please do this π π
ngl the "fake" wording is doing a lot of heavy lifting here but it's exactly what the docs say, so we're keeping it fr fr π
π SEE ALSO π
kernel file ./drivers/gpu/drm/drm_gem.c and honestly the whole extended friend group π :
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_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_mmap(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)
like, the whole roster. tag yourself, i'm drm_gem_free_mmap_offset(9) because i also clean up after everyone π π«Ά
and that's the page!! source path ./drivers/gpu/drm, dated October 2026, from the Kernel API Manual β drm_gem_create_mmap_offset(9) out πβ¨
π¦ 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