|
XenevaOS
|
#include <drm_gem.h>

Public Attributes | ||
| struct kref | refcount | |
| unsigned | handle_count | |
| struct drm_device * | dev | |
| struct file * | filp | |
| struct drm_vma_offset_node | vma_node | |
| size_t | size | |
: | ||
Global name for this object, starts at 1. 0 means unnamed. Access is covered by &drm_device.object_name_lock. This is used by the GEM_FLINK and GEM_OPEN ioctls. | ||
| int | name | |
| struct dma_buf * | dma_buf | |
| struct dma_buf_attachment * | import_attach | |
| struct dma_resv * | resv | |
| struct dma_resv | _resv | |
| struct { | ||
| struct list_head list | ||
| struct mutex lock | ||
| } | gpuva | |
| const struct drm_gem_object_funcs * | funcs | |
| struct list_head | lru_node | |
| struct drm_gem_lru * | lru | |
struct drm_gem_object - GEM buffer object
This structure defines the generic parts for GEM buffer objects, which are mostly around handling mmap and userspace handles.
Buffer objects are often abbreviated to BO.
| struct dma_resv drm_gem_object::_resv |
@_resv:
A reservation object for this GEM object.
This is unused for imported GEM objects.
| struct drm_device* drm_gem_object::dev |
@dev: DRM dev this object belongs to.
| struct dma_buf* drm_gem_object::dma_buf |
@dma_buf:
dma-buf associated with this GEM object.
Pointer to the dma-buf associated with this gem object (either through importing or exporting). We break the resulting reference loop when the last gem handle for this object is released.
Protected by &drm_device.object_name_lock.
| struct file* drm_gem_object::filp |
@filp:
SHMEM file node used as backing storage for swappable buffer objects. GEM also supports driver private objects with driver-specific backing storage (contiguous DMA memory, special reserved blocks). In this case @filp is NULL.
| const struct drm_gem_object_funcs* drm_gem_object::funcs |
@funcs:
Optional GEM object functions. If this is set, it will be used instead of the corresponding &drm_driver GEM callbacks.
New drivers should use this.
| struct { ... } drm_gem_object::gpuva |
@gpuva: Fields used by GPUVM to manage mappings pointing to this GEM object.
When DRM_GPUVM_IMMEDIATE_MODE is set, this list is protected by the mutex. Otherwise, the list is protected by the GEMs &dma_resv lock.
Note that all entries in this list must agree on whether DRM_GPUVM_IMMEDIATE_MODE is set.
| unsigned drm_gem_object::handle_count |
@handle_count:
This is the GEM file_priv handle count of this object.
Each handle also holds a reference. Note that when the handle_count drops to 0 any global names (e.g. the id in the flink namespace) will be cleared.
Protected by &drm_device.object_name_lock.
| struct dma_buf_attachment* drm_gem_object::import_attach |
@import_attach:
dma-buf attachment backing this object.
Any foreign dma_buf imported as a gem object has this set to the attachment point for the device. This is invariant over the lifetime of a gem object.
The &drm_gem_object_funcs.free callback is responsible for cleaning up the dma_buf attachment and references acquired at import time.
Note that the drm gem/prime core does not depend upon drivers setting this field any more. So for drivers where this doesn't make sense (e.g. virtual devices or a displaylink behind an usb bus) they can simply leave it as NULL.
| struct list_head drm_gem_object::list |
@gpuva.list: list of GPUVM mappings attached to this GEM object.
Drivers should lock list accesses with either the GEMs &dma_resv lock (&drm_gem_object.resv) or the &drm_gem_object.gpuva.lock mutex.
| struct mutex drm_gem_object::lock |
@gpuva.lock: lock protecting access to &drm_gem_object.gpuva.list when DRM_GPUVM_IMMEDIATE_MODE is used.
Only used when DRM_GPUVM_IMMEDIATE_MODE is set. It should be safe to take this mutex during the fence signalling path, so do not allocate memory while holding this lock. Otherwise, the &dma_resv lock should be used.
| struct drm_gem_lru* drm_gem_object::lru |
@lru:
The current LRU list that the GEM object is on.
Access to this field must be done with drm_device::gem_lru_mutex held.
| struct list_head drm_gem_object::lru_node |
@lru_node:
List node in a &drm_gem_lru.
| int drm_gem_object::name |
| struct kref drm_gem_object::refcount |
@refcount:
Reference count of this object
Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() or drm_gem_object_put() to release a reference to a GEM buffer object.
| struct dma_resv* drm_gem_object::resv |
@resv:
Pointer to reservation object associated with the this GEM object.
Normally (@resv == &@_resv) except for imported GEM objects.
| size_t drm_gem_object::size |
@size:
Size of the object, in bytes. Immutable over the object's lifetime.
| struct drm_vma_offset_node drm_gem_object::vma_node |
@vma_node:
Mapping info for this object to support mmap. Drivers are supposed to allocate the mmap offset using drm_gem_create_mmap_offset(). The offset itself can be retrieved using drm_vma_node_offset_addr().
Memory mapping itself is handled by drm_gem_mmap(), which also checks that userspace is allowed to access the object.