drm/vmwgfx: Be more restrictive when dirtying resources
Currently we flag resources as dirty (GPU contents not yet read back to the backing MOB) whenever they have been part of a command stream. Obviously many resources can't be dirty and others can only be dirty when written to by the GPU. That is when they are either bound to the context as render-targets, depth-stencil, copy / clear destinations and stream-output targets, or similarly when there are corresponding views into them. So mark resources dirty only in these special cases. Context- and cotable resources are always marked dirty when referenced. This is important for upcoming emulated coherent memory, since we can avoid issuing automatic readbacks to non-dirty resources when the CPU tries to access part of the backing MOB. Testing: Unigine Heaven with max GPU memory set to 256MB resulting in heavy resource thrashing. --- v2: Addressed review comments by Deepak Rawat. v3: Added some documentation Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
This commit is contained in:

committed by
Deepak Rawat

parent
14d2bd53a4
commit
a9f58c456e
@@ -1269,6 +1269,32 @@ void vmw_binding_state_reset(struct vmw_ctx_binding_state *cbs)
|
||||
vmw_binding_drop(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* vmw_binding_dirtying - Return whether a binding type is dirtying its resource
|
||||
* @binding_type: The binding type
|
||||
*
|
||||
* Each time a resource is put on the validation list as the result of a
|
||||
* context binding referencing it, we need to determine whether that resource
|
||||
* will be dirtied (written to by the GPU) as a result of the corresponding
|
||||
* GPU operation. Currently rendertarget-, depth-stencil-, and
|
||||
* stream-output-target bindings are capable of dirtying its resource.
|
||||
*
|
||||
* Return: Whether the binding type dirties the resource its binding points to.
|
||||
*/
|
||||
u32 vmw_binding_dirtying(enum vmw_ctx_binding_type binding_type)
|
||||
{
|
||||
static u32 is_binding_dirtying[vmw_ctx_binding_max] = {
|
||||
[vmw_ctx_binding_rt] = VMW_RES_DIRTY_SET,
|
||||
[vmw_ctx_binding_dx_rt] = VMW_RES_DIRTY_SET,
|
||||
[vmw_ctx_binding_ds] = VMW_RES_DIRTY_SET,
|
||||
[vmw_ctx_binding_so] = VMW_RES_DIRTY_SET,
|
||||
};
|
||||
|
||||
/* Review this function as new bindings are added. */
|
||||
BUILD_BUG_ON(vmw_ctx_binding_max != 11);
|
||||
return is_binding_dirtying[binding_type];
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is unused at run-time, and only used to hold various build
|
||||
* asserts important for code optimization assumptions.
|
||||
|
Reference in New Issue
Block a user