include/drm/drm_gem_shmem_helper.h
Source file repositories/reference/linux-study-clean/include/drm/drm_gem_shmem_helper.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_gem_shmem_helper.h- Extension
.h- Size
- 9453 bytes
- Lines
- 316
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/mm.hlinux/mutex.hdrm/drm_file.hdrm/drm_gem.hdrm/drm_ioctl.hdrm/drm_prime.h
Detected Declarations
struct dma_buf_attachmentstruct drm_mode_create_dumbstruct drm_printerstruct sg_tablestruct drm_gem_shmem_objectfunction drm_gem_shmem_is_purgeablefunction drm_gem_shmem_freefunction drm_gem_shmem_object_print_infofunction drm_gem_shmem_pinfunction drm_gem_shmem_unpinfunction drm_gem_shmem_get_sg_tablefunction drm_gem_shmem_vmap_lockedfunction drm_gem_shmem_vunmap_lockedfunction drm_gem_shmem_mmap
Annotated Snippet
struct drm_gem_shmem_object {
/**
* @base: Base GEM object
*/
struct drm_gem_object base;
/**
* @pages: Page table
*/
struct page **pages;
/**
* @pages_use_count:
*
* Reference count on the pages table.
* The pages are put when the count reaches zero.
*/
refcount_t pages_use_count;
/**
* @pages_pin_count:
*
* Reference count on the pinned pages table.
*
* Pages are hard-pinned and reside in memory if count
* greater than zero. Otherwise, when count is zero, the pages are
* allowed to be evicted and purged by memory shrinker.
*/
refcount_t pages_pin_count;
/**
* @madv: State for madvise
*
* 0 is active/inuse.
* A negative value is the object is purged.
* Positive values are driver specific and not used by the helpers.
*/
int madv;
/**
* @madv_list: List entry for madvise tracking
*
* Typically used by drivers to track purgeable objects
*/
struct list_head madv_list;
/**
* @sgt: Scatter/gather table for imported PRIME buffers
*/
struct sg_table *sgt;
/**
* @vaddr: Kernel virtual address of the backing memory
*/
void *vaddr;
/**
* @vmap_use_count:
*
* Reference count on the virtual address.
* The address are un-mapped when the count reaches zero.
*/
refcount_t vmap_use_count;
/**
* @pages_mark_dirty_on_put:
*
* Mark pages as dirty when they are put.
*/
bool pages_mark_dirty_on_put : 1;
/**
* @pages_mark_accessed_on_put:
*
* Mark pages as accessed when they are put.
*/
bool pages_mark_accessed_on_put : 1;
/**
* @map_wc: map object write-combined (instead of using shmem defaults).
*/
bool map_wc : 1;
};
#define to_drm_gem_shmem_obj(obj) \
container_of(obj, struct drm_gem_shmem_object, base)
int drm_gem_shmem_init(struct drm_device *dev, struct drm_gem_shmem_object *shmem, size_t size);
struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t size);
void drm_gem_shmem_release(struct drm_gem_shmem_object *shmem);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/mm.h`, `linux/mutex.h`, `drm/drm_file.h`, `drm/drm_gem.h`, `drm/drm_ioctl.h`, `drm/drm_prime.h`.
- Detected declarations: `struct dma_buf_attachment`, `struct drm_mode_create_dumb`, `struct drm_printer`, `struct sg_table`, `struct drm_gem_shmem_object`, `function drm_gem_shmem_is_purgeable`, `function drm_gem_shmem_free`, `function drm_gem_shmem_object_print_info`, `function drm_gem_shmem_pin`, `function drm_gem_shmem_unpin`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source 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.