diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-26 15:59:20 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-28 08:57:07 +0200 |
commit | 64ad2abfe9a628ce79859d072704bd1ef7682044 (patch) | |
tree | 6d7df075d3d405e394fbebd4878373a15e57c430 /drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | |
parent | drm/ttm: Export ttm_bo_get_unless_zero() (diff) | |
download | linux-64ad2abfe9a628ce79859d072704bd1ef7682044.tar.xz linux-64ad2abfe9a628ce79859d072704bd1ef7682044.zip |
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.h | 19 |
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 |