aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2018-09-26 09:59:20 -0400
committerThomas Hellstrom <thellstrom@vmware.com>2018-09-28 02:57:07 -0400
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)
177 INIT_LIST_HEAD(&ctx->bo_list); 177 INIT_LIST_HEAD(&ctx->bo_list);
178} 178}
179 179
180/**
181 * vmw_validation_align - Align a validation memory allocation
182 * @val: The size to be aligned
183 *
184 * Returns: @val aligned to the granularity used by the validation memory
185 * allocator.
186 */
187static inline unsigned int vmw_validation_align(unsigned int val)
188{
189 return ALIGN(val, sizeof(long));
190}
191
180int vmw_validation_add_bo(struct vmw_validation_context *ctx, 192int vmw_validation_add_bo(struct vmw_validation_context *ctx,
181 struct vmw_buffer_object *vbo, 193 struct vmw_buffer_object *vbo,
182 bool as_mob, bool cpu_blit); 194 bool as_mob, bool cpu_blit);
@@ -207,6 +219,9 @@ void vmw_validation_revert(struct vmw_validation_context *ctx);
207void vmw_validation_done(struct vmw_validation_context *ctx, 219void vmw_validation_done(struct vmw_validation_context *ctx,
208 struct vmw_fence_obj *fence); 220 struct vmw_fence_obj *fence);
209 221
210void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx, size_t size); 222void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx,
211 223 unsigned int size);
224int vmw_validation_preload_bo(struct vmw_validation_context *ctx);
225int vmw_validation_preload_res(struct vmw_validation_context *ctx,
226 unsigned int size);
212#endif 227#endif