include/drm/drm_gem.h
Source file repositories/reference/linux-study-clean/include/drm/drm_gem.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_gem.h- Extension
.h- Size
- 20756 bytes
- Lines
- 700
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kref.hlinux/dma-buf.hlinux/dma-resv.hlinux/list.hlinux/mutex.hdrm/drm_device.hdrm/drm_vma_manager.h
Detected Declarations
struct iosys_mapstruct drm_gem_objectstruct drm_gem_object_funcsstruct drm_gem_lrustruct drm_gem_objectenum drm_gem_object_statusfunction drm_gem_huge_mnt_createfunction drm_gem_huge_mnt_createfunction drm_gem_object_getfunction __drm_gem_object_putfunction drm_gem_object_putfunction drm_gem_object_is_shared_for_memory_statsfunction drm_gem_is_importedfunction lockdep_is_held
Annotated Snippet
* This macro autogenerates a suitable &struct file_operations for GEM based
* drivers, which can be assigned to &drm_driver.fops. Note that this structure
* cannot be shared between drivers, because it contains a reference to the
* current module using THIS_MODULE.
*
* Note that the declaration is already marked as static - if you need a
* non-static version of this you're probably doing it wrong and will break the
* THIS_MODULE reference by accident.
*/
#define DEFINE_DRM_GEM_FOPS(name) \
static const struct file_operations name = {\
.owner = THIS_MODULE,\
DRM_GEM_FOPS,\
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
int drm_gem_huge_mnt_create(struct drm_device *dev, const char *value);
#else
static inline int drm_gem_huge_mnt_create(struct drm_device *dev,
const char *value)
{
return 0;
}
#endif
/**
* drm_gem_get_huge_mnt - Get the huge tmpfs mountpoint used by a DRM device
* @dev: DRM device
*
* This function gets the huge tmpfs mountpoint used by DRM device @dev. A huge
* tmpfs mountpoint is used instead of `shm_mnt` after a successful call to
* drm_gem_huge_mnt_create() when CONFIG_TRANSPARENT_HUGEPAGE is enabled.
*
* Returns:
* The huge tmpfs mountpoint in use, NULL otherwise.
*/
static inline struct vfsmount *drm_gem_get_huge_mnt(struct drm_device *dev)
{
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
return dev->huge_mnt;
#else
return NULL;
#endif
}
void drm_gem_object_release(struct drm_gem_object *obj);
void drm_gem_object_free(struct kref *kref);
int drm_gem_object_init(struct drm_device *dev,
struct drm_gem_object *obj, size_t size);
void drm_gem_private_object_init(struct drm_device *dev,
struct drm_gem_object *obj, size_t size);
void drm_gem_private_object_fini(struct drm_gem_object *obj);
void drm_gem_vm_open(struct vm_area_struct *vma);
void drm_gem_vm_close(struct vm_area_struct *vma);
int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
struct vm_area_struct *vma);
int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
#ifdef CONFIG_MMU
unsigned long drm_gem_get_unmapped_area(struct file *filp, unsigned long uaddr,
unsigned long len, unsigned long pgoff,
unsigned long flags);
#else
#define drm_gem_get_unmapped_area NULL
#endif
/**
* drm_gem_object_get - acquire a GEM buffer object reference
* @obj: GEM buffer object
*
* This function acquires an additional reference to @obj. It is illegal to
* call this without already holding a reference. No locks required.
*/
static inline void drm_gem_object_get(struct drm_gem_object *obj)
{
kref_get(&obj->refcount);
}
__attribute__((nonnull))
static inline void
__drm_gem_object_put(struct drm_gem_object *obj)
{
kref_put(&obj->refcount, drm_gem_object_free);
}
/**
* drm_gem_object_put - drop a GEM buffer object reference
* @obj: GEM buffer object
*
* This releases a reference to @obj.
Annotation
- Immediate include surface: `linux/kref.h`, `linux/dma-buf.h`, `linux/dma-resv.h`, `linux/list.h`, `linux/mutex.h`, `drm/drm_device.h`, `drm/drm_vma_manager.h`.
- Detected declarations: `struct iosys_map`, `struct drm_gem_object`, `struct drm_gem_object_funcs`, `struct drm_gem_lru`, `struct drm_gem_object`, `enum drm_gem_object_status`, `function drm_gem_huge_mnt_create`, `function drm_gem_huge_mnt_create`, `function drm_gem_object_get`, `function __drm_gem_object_put`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: pattern implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.