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
@@ -33,6 +33,10 @@
|
||||
#include <linux/ww_mutex.h>
|
||||
#include <drm/ttm/ttm_execbuf_util.h>
|
||||
|
||||
#define VMW_RES_DIRTY_NONE 0
|
||||
#define VMW_RES_DIRTY_SET BIT(0)
|
||||
#define VMW_RES_DIRTY_CLEAR BIT(1)
|
||||
|
||||
/**
|
||||
* struct vmw_validation_mem - Custom interface to provide memory reservations
|
||||
* for the validation code.
|
||||
@@ -237,6 +241,7 @@ void vmw_validation_unref_lists(struct vmw_validation_context *ctx);
|
||||
int vmw_validation_add_resource(struct vmw_validation_context *ctx,
|
||||
struct vmw_resource *res,
|
||||
size_t priv_size,
|
||||
u32 dirty,
|
||||
void **p_node,
|
||||
bool *first_usage);
|
||||
void vmw_validation_drop_ht(struct vmw_validation_context *ctx);
|
||||
@@ -261,4 +266,6 @@ void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx,
|
||||
int vmw_validation_preload_bo(struct vmw_validation_context *ctx);
|
||||
int vmw_validation_preload_res(struct vmw_validation_context *ctx,
|
||||
unsigned int size);
|
||||
void vmw_validation_res_set_dirty(struct vmw_validation_context *ctx,
|
||||
void *val_private, u32 dirty);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user