Linux Kernel
3.7.1
|
#include <linux/list.h>
#include <drm/drm_hashtab.h>
#include <linux/kref.h>
#include <ttm/ttm_memory.h>
Go to the source code of this file.
Data Structures | |
struct | ttm_base_object |
Enumerations | |
enum | ttm_ref_type { TTM_REF_USAGE, TTM_REF_SYNCCPU_READ, TTM_REF_SYNCCPU_WRITE, TTM_REF_NUM } |
enum | ttm_object_type { ttm_fence_type, ttm_buffer_type, ttm_lock_type, ttm_driver_type0 = 256, ttm_driver_type1, ttm_driver_type2, ttm_driver_type3, ttm_driver_type4, ttm_driver_type5 } |
Base- and reference object implementation for the various ttm objects. Implements reference counting, minimal security checks and release on file close.
Definition in file ttm_object.h.
enum ttm_object_type |
enum ttm_object_type
One entry per ttm object type. Device-specific types should use the ttm_driver_typex types.
ttm_fence_type | |
ttm_buffer_type | |
ttm_lock_type | |
ttm_driver_type0 | |
ttm_driver_type1 | |
ttm_driver_type2 | |
ttm_driver_type3 | |
ttm_driver_type4 | |
ttm_driver_type5 |
Definition at line 75 of file ttm_object.h.
enum ttm_ref_type |
enum ttm_ref_type
Describes what type of reference a ref object holds.
TTM_REF_USAGE is a simple refcount on a base object.
TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a buffer object.
TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a buffer object.
Definition at line 60 of file ttm_object.h.
int ttm_base_object_init | ( | struct ttm_object_file * | tfile, |
struct ttm_base_object * | base, | ||
bool | shareable, | ||
enum ttm_object_type | type, | ||
void(*)(struct ttm_base_object **) | refcount_release, | ||
void(*)(struct ttm_base_object *, enum ttm_ref_typeref_type) | ref_obj_release | ||
) |
ttm_base_object_init
: Pointer to a struct ttm_object_file. : The struct ttm_base_object to initialize. : This object is shareable with other applcations. (different pointers.) : The object type. : See the struct ttm_base_object description. : See the struct ttm_base_object description.
Initializes a struct ttm_base_object.
|
read |
ttm_base_object_lookup
: Pointer to a struct ttm_object_file. : Hash key
Looks up a struct ttm_base_object with the key . Also verifies that the object is visible to the application, by comparing the argument and checking the object shareable flag.
Definition at line 216 of file ttm_object.c.
void ttm_base_object_unref | ( | struct ttm_base_object ** | p_base | ) |
ttm_base_object_unref
: Pointer to a pointer referencing a struct ttm_base_object.
Decrements the base object refcount and clears the pointer pointed to by p_base.
Definition at line 198 of file ttm_object.c.
|
read |
ttm_object device init - initialize a struct ttm_object_device
: Order of hash table used to hash the base objects.
This function is typically called on device initialization to prepare data structures needed for ttm base and ref objects.
Definition at line 418 of file ttm_object.c.
void ttm_object_device_release | ( | struct ttm_object_device ** | p_tdev | ) |
ttm_object_device_release - release data held by a ttm_object_device
: Pointer to pointer to the ttm_object_device object to release. *p_tdev will be set to NULL by this function.
Releases all data associated by a ttm_object_device. Typically called from driver::unload before the destruction of the device private data structure.
Definition at line 441 of file ttm_object.c.
|
read |
ttm_object_file_init - initialize a struct ttm_object file
: A struct ttm_object device this file is initialized on. : Order of the hash table used to hold the reference objects.
This is typically called by the file_ops::open function.
Definition at line 383 of file ttm_object.c.
void ttm_object_file_release | ( | struct ttm_object_file ** | p_tfile | ) |
ttm_object_file_release - release data held by a ttm_object_file
: Pointer to pointer to the ttm_object_file object to release. *p_tfile will be set to NULL by this function.
Releases all data associated by a ttm_object_file. Typically called from file_ops::release. The caller must ensure that there are no concurrent users of tfile.
Definition at line 354 of file ttm_object.c.
int ttm_ref_object_add | ( | struct ttm_object_file * | tfile, |
struct ttm_base_object * | base, | ||
enum ttm_ref_type | ref_type, | ||
bool * | existed | ||
) |
ttm_ref_object_add.
: A struct ttm_object_file representing the application owning the ref_object. : The base object to reference. : The type of reference. : Upon completion, indicates that an identical reference object already existed, and the refcount was upped on that object instead.
Adding a ref object to a base object is basically like referencing the base object, but a user-space application holds the reference. When the file corresponding to is closed, all its reference objects are deleted. A reference object can have different types depending on what it's intended for. It can be refcounting to prevent object destruction, When user-space takes a lock, it can add a ref object to that lock to make sure the lock is released if the application dies. A ref object will hold a single reference on a base object.
Definition at line 246 of file ttm_object.c.
int ttm_ref_object_base_unref | ( | struct ttm_object_file * | tfile, |
unsigned long | key, | ||
enum ttm_ref_type | ref_type | ||
) |
ttm_ref_object_base_unref
: Key representing the base object. : Ref type of the ref object to be dereferenced.
Unreference a ref object with type on the base object identified by . If there are no duplicate references, the ref object will be destroyed and the base object will be unreferenced.
Definition at line 333 of file ttm_object.c.