diff options
author | Zack Rusin <zackr@vmware.com> | 2023-01-31 06:35:41 +0300 |
---|---|---|
committer | Zack Rusin <zackr@vmware.com> | 2023-02-14 06:37:55 +0300 |
commit | 39985eea5a6dd1e844f216028252870e980b9e7f (patch) | |
tree | 54f7e1eb2590562d590fc0bcd37b97389d585c9f /drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |
parent | e0029da927fa9cc3c8ca6b37dc10624d1209e310 (diff) | |
download | linux-39985eea5a6dd1e844f216028252870e980b9e7f.tar.xz |
drm/vmwgfx: Abstract placement selection
Problem with explicit placement selection in vmwgfx is that by the time
the buffer object needs to be validated the information about which
placement was supposed to be used is lost. To workaround this the driver
had a bunch of state in various places e.g. as_mob or cpu_blit to
somehow convey the information on which placement was intended.
Fix it properly by allowing the buffer objects to hold their preferred
placement so it can be reused whenever needed. This makes the entire
validation pipeline a lot easier both to understand and maintain.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Martin Krastev <krastevm@vmware.com>
Reviewed-by: Maaz Mombasawala <mombasawalam@vmware.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131033542.953249-8-zack@kde.org
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 54e412f8c2d1..6780a36e6171 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -332,7 +332,7 @@ static int vmw_resource_buf_alloc(struct vmw_resource *res, } ret = vmw_bo_create(res->dev_priv, res->backup_size, - res->func->backup_placement, + res->func->domain, res->func->busy_domain, interruptible, false, &backup); if (unlikely(ret != 0)) goto out_no_bo; @@ -529,8 +529,10 @@ vmw_resource_check_buffer(struct ww_acquire_ctx *ticket, return 0; backup_dirty = res->backup_dirty; + vmw_bo_placement_set(res->backup, res->func->domain, + res->func->busy_domain); ret = ttm_bo_validate(&res->backup->base, - res->func->backup_placement, + &res->backup->placement, &ctx); if (unlikely(ret != 0)) @@ -968,9 +970,12 @@ int vmw_resource_pin(struct vmw_resource *res, bool interruptible) if (ret) goto out_no_validate; if (!vbo->base.pin_count) { + vmw_bo_placement_set(vbo, + res->func->domain, + res->func->busy_domain); ret = ttm_bo_validate (&vbo->base, - res->func->backup_placement, + &vbo->placement, &ctx); if (ret) { ttm_bo_unreserve(&vbo->base); |