接前一篇文章:KWin、libdrm、DRM从上到下全过程 —— drmModeAddFBxxx(24)
上回书讲解了i915_gem_object_lookup_rcu函数代码的前一部分,本回讲解后一部分代码。为了便于理解,再次贴出函数源码,在drivers/gpu/drm/i915/gem/i915_gem_object.h中,代码如下:
/**
* i915_gem_object_lookup_rcu - look up a temporary GEM object from its handle
* @filp: DRM file private date
* @handle: userspace handle
*
* Returns:
*
* A pointer to the object named by the handle if such exists on @filp, NULL
* otherwise. This object is only valid whilst under the RCU read lock, and
* note carefully the object may be in the process of being destroyed.
*/
static inline struct drm_i915_gem_object *
i915_gem_object_lookup_rcu(struct drm_file *file, u32 handle)
{
#ifdef CONFIG_LOCKDEP
WARN_ON(debug_locks && !lock_is_held(&