接前一篇文章:KWin、libdrm、DRM从上到下全过程 —— drmModeAddFBxxx(30)
上回书解析了drm_gem_open函数的两个参数struct drm_device *dev和struct drm_file *file_private(所对应的实参),本回开始解析drm_gem_open函数的内容。为了便于理解和加深印象,再次贴出drm_gem_open函数源码,在drivers/gpu/drm/drm_gem.c中,如下:
/**
* drm_gem_open - initializes GEM file-private structures at devnode open time
* @dev: drm_device which is being opened by userspace
* @file_private: drm file-private structure to set up
*
* Called at device open time, sets up the structure for handling refcounting
* of mm objects.
*/
void
drm_gem_open(struct drm_device *dev, struct drm_file *file_private)
{
idr_init_base(&file_private->object_idr, 1);
spin_lock_init(&file_private->table_lock);
}
上回书已经讲明