diff options
author | Marek Olšák <[email protected]> | 2017-06-27 20:27:29 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-07-04 15:40:37 +0200 |
commit | 91f72975ac1b8e5649322b9750d3aca639af7380 (patch) | |
tree | 088bec3b0169285c2b2339862e0e4b616ce6223c | |
parent | 0f13451da30a6ae298af297de18db595b791b62c (diff) |
gallium/radeon: add radeon_winsys::buffer_is_suballocated
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeon/radeon_winsys.h | 3 | ||||
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 8 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 239b6ab9a67..b37af91dffd 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -360,6 +360,9 @@ struct radeon_winsys { */ bool (*buffer_is_user_ptr)(struct pb_buffer *buf); + /** Whether the buffer was suballocated. */ + bool (*buffer_is_suballocated)(struct pb_buffer *buf); + /** * Get a winsys handle from a winsys buffer. The internal structure * of the handle is platform-specific and only a winsys should access it. diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 4c47f378de9..d0d80904f1f 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -1410,6 +1410,13 @@ static bool amdgpu_bo_is_user_ptr(struct pb_buffer *buf) return ((struct amdgpu_winsys_bo*)buf)->user_ptr != NULL; } +static bool amdgpu_bo_is_suballocated(struct pb_buffer *buf) +{ + struct amdgpu_winsys_bo *bo = (struct amdgpu_winsys_bo*)buf; + + return !bo->bo && !bo->sparse; +} + static uint64_t amdgpu_bo_get_va(struct pb_buffer *buf) { return ((struct amdgpu_winsys_bo*)buf)->va; @@ -1426,6 +1433,7 @@ void amdgpu_bo_init_functions(struct amdgpu_winsys *ws) ws->base.buffer_from_handle = amdgpu_bo_from_handle; ws->base.buffer_from_ptr = amdgpu_bo_from_ptr; ws->base.buffer_is_user_ptr = amdgpu_bo_is_user_ptr; + ws->base.buffer_is_suballocated = amdgpu_bo_is_suballocated; ws->base.buffer_get_handle = amdgpu_bo_get_handle; ws->base.buffer_commit = amdgpu_bo_sparse_commit; ws->base.buffer_get_virtual_address = amdgpu_bo_get_va; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index aa3fb788efc..8027a5f1ce8 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -1290,6 +1290,11 @@ static bool radeon_winsys_bo_is_user_ptr(struct pb_buffer *buf) return ((struct radeon_bo*)buf)->user_ptr != NULL; } +static bool radeon_winsys_bo_is_suballocated(struct pb_buffer *buf) +{ + return !((struct radeon_bo*)buf)->handle; +} + static uint64_t radeon_winsys_bo_va(struct pb_buffer *buf) { return ((struct radeon_bo*)buf)->va; @@ -1316,6 +1321,7 @@ void radeon_drm_bo_init_functions(struct radeon_drm_winsys *ws) ws->base.buffer_from_handle = radeon_winsys_bo_from_handle; ws->base.buffer_from_ptr = radeon_winsys_bo_from_ptr; ws->base.buffer_is_user_ptr = radeon_winsys_bo_is_user_ptr; + ws->base.buffer_is_suballocated = radeon_winsys_bo_is_suballocated; ws->base.buffer_get_handle = radeon_winsys_bo_get_handle; ws->base.buffer_get_virtual_address = radeon_winsys_bo_va; ws->base.buffer_get_reloc_offset = radeon_winsys_bo_get_reloc_offset; |