diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-26 09:59:20 -0400 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2018-09-28 02:57:07 -0400 |
commit | 64ad2abfe9a628ce79859d072704bd1ef7682044 (patch) | |
tree | 6d7df075d3d405e394fbebd4878373a15e57c430 /drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | |
parent | 24dc64c1ba5c3ef0463d59fef6df09336754188d (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.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) | |||
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 | */ | ||
187 | static inline unsigned int vmw_validation_align(unsigned int val) | ||
188 | { | ||
189 | return ALIGN(val, sizeof(long)); | ||
190 | } | ||
191 | |||
180 | int vmw_validation_add_bo(struct vmw_validation_context *ctx, | 192 | int 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); | |||
207 | void vmw_validation_done(struct vmw_validation_context *ctx, | 219 | void vmw_validation_done(struct vmw_validation_context *ctx, |
208 | struct vmw_fence_obj *fence); | 220 | struct vmw_fence_obj *fence); |
209 | 221 | ||
210 | void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx, size_t size); | 222 | void *vmw_validation_mem_alloc(struct vmw_validation_context *ctx, |
211 | 223 | unsigned int size); | |
224 | int vmw_validation_preload_bo(struct vmw_validation_context *ctx); | ||
225 | int vmw_validation_preload_res(struct vmw_validation_context *ctx, | ||
226 | unsigned int size); | ||
212 | #endif | 227 | #endif |