radv: fix vk_object_base_init/finish for internal buffer views

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>
This commit is contained in:
Samuel Pitoiset 2021-09-29 09:40:00 +02:00 committed by Marge Bot
parent 1b3f0ccb38
commit 3e89b20858
5 changed files with 25 additions and 3 deletions

View file

@ -2330,6 +2330,8 @@ radv_buffer_view_init(struct radv_buffer_view *view, struct radv_device *device,
{
RADV_FROM_HANDLE(radv_buffer, buffer, pCreateInfo->buffer);
vk_object_base_init(&device->vk, &view->base, VK_OBJECT_TYPE_BUFFER_VIEW);
view->bo = buffer->bo;
view->range =
pCreateInfo->range == VK_WHOLE_SIZE ? buffer->size - pCreateInfo->offset : pCreateInfo->range;
@ -2339,6 +2341,12 @@ radv_buffer_view_init(struct radv_buffer_view *view, struct radv_device *device,
view->state);
}
void
radv_buffer_view_finish(struct radv_buffer_view *view)
{
vk_object_base_finish(&view->base);
}
VkResult
radv_CreateBufferView(VkDevice _device, const VkBufferViewCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBufferView *pView)
@ -2351,8 +2359,6 @@ radv_CreateBufferView(VkDevice _device, const VkBufferViewCreateInfo *pCreateInf
if (!view)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vk_object_base_init(&device->vk, &view->base, VK_OBJECT_TYPE_BUFFER_VIEW);
radv_buffer_view_init(view, device, pCreateInfo);
*pView = radv_buffer_view_to_handle(view);
@ -2370,6 +2376,6 @@ radv_DestroyBufferView(VkDevice _device, VkBufferView bufferView,
if (!view)
return;
vk_object_base_finish(&view->base);
radv_buffer_view_finish(view);
vk_free2(&device->vk.alloc, pAllocator, view);
}

View file

@ -395,6 +395,9 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer,
*/
radv_DestroyFramebuffer(radv_device_to_handle(device), dst_temps.fb,
&cmd_buffer->pool->alloc);
if (src_type == BLIT2D_SRC_TYPE_BUFFER)
radv_buffer_view_finish(&src_temps.bview);
}
}
}

View file

@ -1462,6 +1462,8 @@ radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_b
radv_unaligned_dispatch(cmd_buffer, rects[r].width, rects[r].height, 1);
}
radv_buffer_view_finish(&dst_view);
}
static void
@ -1537,6 +1539,8 @@ radv_meta_buffer_to_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
radv_unaligned_dispatch(cmd_buffer, rects[r].width, rects[r].height, 1);
}
radv_buffer_view_finish(&src_view);
radv_buffer_view_finish(&dst_view);
radv_DestroyBuffer(radv_device_to_handle(device), buffer, NULL);
}
@ -1611,6 +1615,8 @@ radv_meta_buffer_to_image_cs(struct radv_cmd_buffer *cmd_buffer,
radv_unaligned_dispatch(cmd_buffer, rects[r].width, rects[r].height, 1);
}
radv_buffer_view_finish(&src_view);
}
static void
@ -1689,6 +1695,8 @@ radv_meta_image_to_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
radv_unaligned_dispatch(cmd_buffer, rects[r].width, rects[r].height, 1);
}
radv_buffer_view_finish(&src_view);
radv_buffer_view_finish(&dst_view);
radv_DestroyBuffer(radv_device_to_handle(device), src_buffer, NULL);
radv_DestroyBuffer(radv_device_to_handle(device), dst_buffer, NULL);
}
@ -1836,6 +1844,7 @@ radv_meta_clear_image_cs_r32g32b32(struct radv_cmd_buffer *cmd_buffer,
radv_unaligned_dispatch(cmd_buffer, dst->image->info.width, dst->image->info.height, 1);
radv_buffer_view_finish(&dst_view);
radv_DestroyBuffer(radv_device_to_handle(device), buffer, NULL);
}

View file

@ -306,6 +306,9 @@ radv_retile_dcc(struct radv_cmd_buffer *cmd_buffer, struct radv_image *image)
radv_unaligned_dispatch(cmd_buffer, dcc_width, dcc_height, 1);
radv_buffer_view_finish(views);
radv_buffer_view_finish(views + 1);
radv_meta_restore(&saved_state, cmd_buffer);
state->flush_bits |= RADV_CMD_FLAG_CS_PARTIAL_FLUSH |

View file

@ -2320,6 +2320,7 @@ struct radv_buffer_view {
};
void radv_buffer_view_init(struct radv_buffer_view *view, struct radv_device *device,
const VkBufferViewCreateInfo *pCreateInfo);
void radv_buffer_view_finish(struct radv_buffer_view *view);
static inline struct VkExtent3D
radv_sanitize_image_extent(const VkImageType imageType, const struct VkExtent3D imageExtent)