接前一篇文章:DRM全解析 —— MAP_DUMB(1)
上一回围绕libdrm与DRM在Linux内核中的接口:
DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, 0),
进行了相关宏的展开。本文开始对于drm_mode_mmap_dumb_ioctl函数进行详解。drm_mode_mmap_dumb_ioctl函数在drivers/gpu/drm/drm_framebuffer.c中,代码如下:
/**
* drm_mode_mmap_dumb_ioctl - create an mmap offset for a dumb backing storage buffer
* @dev: DRM device
* @data: ioctl data
* @file_priv: DRM file info
*
* Allocate an offset in the drm device node's address space to be able to
* memory map a dumb buffer.
*
* Called by the user via ioctl.
*
* Returns:
* Zero on success, negative er