drm/vmwgfx: Assign eviction priorities to resources
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 4 Mar 2019 18:37:40 +0000 (19:37 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 18 Jun 2019 13:18:07 +0000 (15:18 +0200)
commit4251fa5fc3bbe3e1df99f60a738d367373ee335f
tree37f39f0fb74786c68cf1cc01bc1dc8e966367666
parent561564bea3248293398dc32ec36da40fb71faed0
drm/vmwgfx: Assign eviction priorities to resources

TTM provides a means to assign eviction priorities to buffer object. This
means that all buffer objects with a lower priority will be evicted first
on memory pressure.
Use this to make sure surfaces and in particular non-dirty surfaces are
evicted first. Evicting in particular shaders, cotables and contexts imply
a significant performance hit on vmwgfx, so make sure these resources are
evicted last.
Some buffer objects are sub-allocated in user-space which means we can have
many resources attached to a single buffer object or resource. In that case
the buffer object is given the highest priority of the attached resources.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
drivers/gpu/drm/vmwgfx/vmwgfx_context.c
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c