Skip to content

What type of offset is provided by nvidia_get_gem_map_offset? #249

Answered by aaronp24
YusufKhan-gamedev asked this question in Q&A
Discussion options

You must be logged in to vote

For a number of reasons, it's not feasible to map memory pages from a drm 'gem' object into a process's virtual memory space while inside of an ioctl handler. So instead, applications have to use the mmap syscall to actually map pages. Applications choose which gem object to map by using an ioctl, and then pass the returned "fake offset" value as the off parameter to the mmap syscall. The drm driver then uses this offset value to look up the gem object to map.

The core drm code in the kernel does something similar. See drm_gem_create_mmap_offset_size in the kernel.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@YusufKhan-gamedev
Comment options

Answer selected by YusufKhan-gamedev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants