summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2018-09-26 15:59:20 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2018-09-28 08:57:07 +0200
commit64ad2abfe9a628ce79859d072704bd1ef7682044 (patch)
tree6d7df075d3d405e394fbebd4878373a15e57c430 /drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
parent24dc64c1ba5c3ef0463d59fef6df09336754188d (diff)
drm/vmwgfx: Adapt validation code for reference-free lookups
Adapt the validation code so that vmw_validation_add[res|bo] can be called under an rcu read lock (non-sleeping) and with rcu-only protected resource- or buffer object pointers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_validation.h')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_validation.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
index 0eb2d02d0c0c..b57e3292c386 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
@@ -177,6 +177,18 @@ vmw_validation_context_init(struct vmw_validation_context *ctx)
INIT_LIST_HEAD(&ctx->bo_list);
}
+/**
+ * vmw_validation_align - Align a validation memory allocation
+ * @val: The size to be aligned
+ *
+ * Returns: @val aligned to the granularity used by the validation memory
+ * allocator.
+ */
+static inline unsigned int vmw_validation_align(unsigned int val)
+{
+ return ALIGN(val, sizeof(long));
+}
+
int vmw_validation_add_bo(struct vmw_validation_context *ctx,
struct vmw_buffer_object *vbo,
bool as_mob, bool cpu_blit);
@@ -207,6 +219,9 @@ void vmw_validation_revert(struct vmw_validation_context *ctx);
void vmw_validation_done(struct vmw_validation_context *ctx,
struct vmw_fence_obj *fence);
-void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx, size_t size);
-
+void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx,
+ unsigned int size);
+int vmw_validation_preload_bo(struct vmw_validation_context *ctx);
+int vmw_validation_preload_res(struct vmw_validation_context *ctx,
+ unsigned int size);
#endif