drm/ttm: add multihop infrastrucutre (v3)
Currently drivers get called to move a buffer, but if they have to move it temporarily through another space (SYSTEM->VRAM via TT) then they can end up with a lot of ttm->driver->ttm call stacks, if the temprorary space moves requires eviction. Instead of letting the driver do all the placement/space for the temporary, allow it to report back (-EMULTIHOP) and a placement (hop) to the move code, which will then do the temporary move, and the correct placement move afterwards. This removes a lot of code from drivers, at the expense of adding some midlayering. I've some further ideas on how to turn it inside out, but I think this is a good solution to the call stack problems. v2: separate out the driver patches, add WARN for getting MULTHOP in paths we shouldn't (Daniel) v3: use memset (Christian) Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: hristian König <christian.koenig@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201109005432.861936-2-airlied@gmail.com
This commit is contained in:
@@ -121,6 +121,8 @@ struct ttm_bo_driver {
|
||||
* Return the bo flags for a buffer which is not mapped to the hardware.
|
||||
* These will be placed in proposed_flags so that when the move is
|
||||
* finished, they'll end up in bo->mem.flags
|
||||
* This should not cause multihop evictions, and the core will warn
|
||||
* if one is proposed.
|
||||
*/
|
||||
|
||||
void (*evict_flags)(struct ttm_buffer_object *bo,
|
||||
@@ -134,12 +136,15 @@ struct ttm_bo_driver {
|
||||
* the graphics address space
|
||||
* @ctx: context for this move with parameters
|
||||
* @new_mem: the new memory region receiving the buffer
|
||||
@ @hop: placement for driver directed intermediate hop
|
||||
*
|
||||
* Move a buffer between two memory regions.
|
||||
* Returns errno -EMULTIHOP if driver requests a hop
|
||||
*/
|
||||
int (*move)(struct ttm_buffer_object *bo, bool evict,
|
||||
struct ttm_operation_ctx *ctx,
|
||||
struct ttm_resource *new_mem);
|
||||
struct ttm_resource *new_mem,
|
||||
struct ttm_place *hop);
|
||||
|
||||
/**
|
||||
* struct ttm_bo_driver_member verify_access
|
||||
|
||||
Reference in New Issue
Block a user