aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_validation.h')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_validation.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
index b57e3292c386..3b396fea40d7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
@@ -34,6 +34,21 @@
34#include <drm/ttm/ttm_execbuf_util.h> 34#include <drm/ttm/ttm_execbuf_util.h>
35 35
36/** 36/**
37 * struct vmw_validation_mem - Custom interface to provide memory reservations
38 * for the validation code.
39 * @reserve_mem: Callback to reserve memory
40 * @unreserve_mem: Callback to unreserve memory
41 * @gran: Reservation granularity. Contains a hint how much memory should
42 * be reserved in each call to @reserve_mem(). A slow implementation may want
43 * reservation to be done in large batches.
44 */
45struct vmw_validation_mem {
46 int (*reserve_mem)(struct vmw_validation_mem *m, size_t size);
47 void (*unreserve_mem)(struct vmw_validation_mem *m, size_t size);
48 size_t gran;
49};
50
51/**
37 * struct vmw_validation_context - Per command submission validation context 52 * struct vmw_validation_context - Per command submission validation context
38 * @ht: Hash table used to find resource- or buffer object duplicates 53 * @ht: Hash table used to find resource- or buffer object duplicates
39 * @resource_list: List head for resource validation metadata 54 * @resource_list: List head for resource validation metadata
@@ -47,6 +62,10 @@
47 * buffer objects 62 * buffer objects
48 * @mem_size_left: Free memory left in the last page in @page_list 63 * @mem_size_left: Free memory left in the last page in @page_list
49 * @page_address: Kernel virtual address of the last page in @page_list 64 * @page_address: Kernel virtual address of the last page in @page_list
65 * @vm: A pointer to the memory reservation interface or NULL if no
66 * memory reservation is needed.
67 * @vm_size_left: Amount of reserved memory that so far has not been allocated.
68 * @total_mem: Amount of reserved memory.
50 */ 69 */
51struct vmw_validation_context { 70struct vmw_validation_context {
52 struct drm_open_hash *ht; 71 struct drm_open_hash *ht;
@@ -59,6 +78,9 @@ struct vmw_validation_context {
59 unsigned int merge_dups; 78 unsigned int merge_dups;
60 unsigned int mem_size_left; 79 unsigned int mem_size_left;
61 u8 *page_address; 80 u8 *page_address;
81 struct vmw_validation_mem *vm;
82 size_t vm_size_left;
83 size_t total_mem;
62}; 84};
63 85
64struct vmw_buffer_object; 86struct vmw_buffer_object;
@@ -102,6 +124,21 @@ vmw_validation_has_bos(struct vmw_validation_context *ctx)
102} 124}
103 125
104/** 126/**
127 * vmw_validation_set_val_mem - Register a validation mem object for
128 * validation memory reservation
129 * @ctx: The validation context
130 * @vm: Pointer to a struct vmw_validation_mem
131 *
132 * Must be set before the first attempt to allocate validation memory.
133 */
134static inline void
135vmw_validation_set_val_mem(struct vmw_validation_context *ctx,
136 struct vmw_validation_mem *vm)
137{
138 ctx->vm = vm;
139}
140
141/**
105 * vmw_validation_set_ht - Register a hash table for duplicate finding 142 * vmw_validation_set_ht - Register a hash table for duplicate finding
106 * @ctx: The validation context 143 * @ctx: The validation context
107 * @ht: Pointer to a hash table to use for duplicate finding 144 * @ht: Pointer to a hash table to use for duplicate finding