mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
drm/ttm: add a weak BO reference to the resource v3
Keep track for which BO a resource was allocated.
This is necessary to move the LRU handling into the resources.
A bit problematic is i915 since it tries to use the resource
interface without a BO which is illegal from the conceptional
point of view.
v2: Document that this is a weak reference and add a workaround for i915
v3: further document that this is protected by ttm_device::lru_lock and
clarify the i915 workaround
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220124122514.1832-4-christian.koenig@amd.com
This commit is contained in:
@@ -161,6 +161,7 @@ struct ttm_bus_placement {
|
||||
* @mem_type: Resource type of the allocation.
|
||||
* @placement: Placement flags.
|
||||
* @bus: Placement on io bus accessible to the CPU
|
||||
* @bo: weak reference to the BO, protected by ttm_device::lru_lock
|
||||
*
|
||||
* Structure indicating the placement and space resources used by a
|
||||
* buffer object.
|
||||
@@ -171,6 +172,7 @@ struct ttm_resource {
|
||||
uint32_t mem_type;
|
||||
uint32_t placement;
|
||||
struct ttm_bus_placement bus;
|
||||
struct ttm_buffer_object *bo;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -271,6 +273,8 @@ int ttm_resource_alloc(struct ttm_buffer_object *bo,
|
||||
void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res);
|
||||
bool ttm_resource_compat(struct ttm_resource *res,
|
||||
struct ttm_placement *placement);
|
||||
void ttm_resource_set_bo(struct ttm_resource *res,
|
||||
struct ttm_buffer_object *bo);
|
||||
|
||||
void ttm_resource_manager_init(struct ttm_resource_manager *man,
|
||||
struct ttm_device *bdev,
|
||||
|
||||
Reference in New Issue
Block a user