28
28
#ifndef _VMWGFX_DRV_H_
29
29
#define _VMWGFX_DRV_H_
30
30
31
+ #include "vmwgfx_validation.h"
31
32
#include "vmwgfx_reg.h"
32
33
#include <drm/drmP.h>
33
34
#include <drm/vmwgfx_drm.h>
@@ -207,26 +208,27 @@ struct vmw_fifo_state {
207
208
struct vmw_relocation {
208
209
SVGAMobId * mob_loc ;
209
210
SVGAGuestPtr * location ;
210
- uint32_t index ;
211
+ struct vmw_buffer_object * vbo ;
211
212
};
212
213
213
214
/**
214
215
* struct vmw_res_cache_entry - resource information cache entry
215
- *
216
+ * @handle: User-space handle of a resource.
217
+ * @res: Non-ref-counted pointer to the resource.
218
+ * @valid_handle: Whether the @handle member is valid.
216
219
* @valid: Whether the entry is valid, which also implies that the execbuf
217
220
* code holds a reference to the resource, and it's placed on the
218
221
* validation list.
219
- * @handle: User-space handle of a resource.
220
- * @res: Non-ref-counted pointer to the resource.
221
222
*
222
223
* Used to avoid frequent repeated user-space handle lookups of the
223
224
* same resource.
224
225
*/
225
226
struct vmw_res_cache_entry {
226
- bool valid ;
227
227
uint32_t handle ;
228
228
struct vmw_resource * res ;
229
- struct vmw_resource_val_node * node ;
229
+ void * private ;
230
+ unsigned short valid_handle ;
231
+ unsigned short valid ;
230
232
};
231
233
232
234
/**
@@ -291,21 +293,52 @@ enum vmw_display_unit_type {
291
293
vmw_du_screen_target
292
294
};
293
295
296
+ struct vmw_validation_context ;
297
+ struct vmw_ctx_validation_info ;
294
298
299
+ /**
300
+ * struct vmw_sw_context - Command submission context
301
+ * @res_ht: Pointer hash table used to find validation duplicates
302
+ * @kernel: Whether the command buffer originates from kernel code rather
303
+ * than from user-space
304
+ * @fp: If @kernel is false, points to the file of the client. Otherwise
305
+ * NULL
306
+ * @relocs: Array of buffer object relocations
307
+ * @cur_reloc: Cursor pointing to the current relocation
308
+ * @cmd_bounce: Command bounce buffer used for command validation before
309
+ * copying to fifo space
310
+ * @cmd_bounce_size: Current command bounce buffer size
311
+ * @cur_query_bo: Current buffer object used as query result buffer
312
+ * @res_relocations: List of resource relocations
313
+ * @buf_start: Pointer to start of memory where command validation takes
314
+ * place
315
+ * @res_cache: Cache of recently looked up resources
316
+ * @last_query_ctx: Last context that submitted a query
317
+ * @needs_post_query_barrier: Whether a query barrier is needed after
318
+ * command submission
319
+ * @error_resource: Pointer to hold a reference to the resource causing
320
+ * an error
321
+ * @staged_bindings: Cached per-context binding tracker
322
+ * @staged_bindings_inuse: Whether the cached per-context binding tracker
323
+ * is in use
324
+ * @staged_cmd_res: List of staged command buffer managed resources in this
325
+ * command buffer
326
+ * @ctx_list: List of context resources referenced in this command buffer
327
+ * @dx_ctx_node: Validation metadata of the current DX context
328
+ * @dx_query_mob: The MOB used for DX queries
329
+ * @dx_query_ctx: The DX context used for the last DX query
330
+ * @man: Pointer to the command buffer managed resource manager
331
+ * @ctx: The validation context
332
+ */
295
333
struct vmw_sw_context {
296
334
struct drm_open_hash res_ht ;
297
335
bool res_ht_initialized ;
298
- bool kernel ; /**< is the called made from the kernel */
336
+ bool kernel ;
299
337
struct vmw_fpriv * fp ;
300
- struct list_head validate_nodes ;
301
338
struct vmw_relocation relocs [VMWGFX_MAX_RELOCATIONS ];
302
339
uint32_t cur_reloc ;
303
- struct vmw_validate_buffer val_bufs [VMWGFX_MAX_VALIDATIONS ];
304
- uint32_t cur_val_buf ;
305
340
uint32_t * cmd_bounce ;
306
341
uint32_t cmd_bounce_size ;
307
- struct list_head resource_list ;
308
- struct list_head ctx_resource_list ; /* For contexts and cotables */
309
342
struct vmw_buffer_object * cur_query_bo ;
310
343
struct list_head res_relocations ;
311
344
uint32_t * buf_start ;
@@ -316,10 +349,12 @@ struct vmw_sw_context{
316
349
struct vmw_ctx_binding_state * staged_bindings ;
317
350
bool staged_bindings_inuse ;
318
351
struct list_head staged_cmd_res ;
319
- struct vmw_resource_val_node * dx_ctx_node ;
352
+ struct list_head ctx_list ;
353
+ struct vmw_ctx_validation_info * dx_ctx_node ;
320
354
struct vmw_buffer_object * dx_query_mob ;
321
355
struct vmw_resource * dx_query_ctx ;
322
356
struct vmw_cmdbuf_res_manager * man ;
357
+ struct vmw_validation_context * ctx ;
323
358
};
324
359
325
360
struct vmw_legacy_display ;
@@ -864,10 +899,6 @@ extern void vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,
864
899
uint32_t fence_handle ,
865
900
int32_t out_fence_fd ,
866
901
struct sync_file * sync_file );
867
- extern int vmw_validate_single_buffer (struct vmw_private * dev_priv ,
868
- struct ttm_buffer_object * bo ,
869
- bool interruptible ,
870
- bool validate_as_mob );
871
902
bool vmw_cmd_describe (const void * buf , u32 * size , char const * * cmd );
872
903
873
904
/**
0 commit comments