mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-18 19:50:20 +01:00
radv: Add temporary BO for transfer queues.
Some copy operations are poorly supported by the SDMA hardware, meaning that the built-in packets don't support them, so we will need to work around that by copying to and from a temporary BO. The size of the temporary buffer was chosen so that it can fit at least one full pixel row of the largest possible image. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25831>
This commit is contained in:
parent
8156c923ee
commit
ec0605ff72
4 changed files with 32 additions and 0 deletions
|
|
@ -85,6 +85,26 @@ radv_image_is_renderable(const struct radv_device *device, const struct radv_ima
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
alloc_transfer_temp_bo(struct radv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
if (cmd_buffer->transfer.copy_temp)
|
||||
return true;
|
||||
|
||||
const struct radv_device *const device = cmd_buffer->device;
|
||||
const VkResult r = device->ws->buffer_create(device->ws, RADV_SDMA_TRANSFER_TEMP_BYTES, 4096, RADEON_DOMAIN_VRAM,
|
||||
RADEON_FLAG_NO_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
|
||||
RADV_BO_PRIORITY_SCRATCH, 0, &cmd_buffer->transfer.copy_temp);
|
||||
|
||||
if (r != VK_SUCCESS) {
|
||||
vk_command_buffer_set_error(&cmd_buffer->vk, r);
|
||||
return false;
|
||||
}
|
||||
|
||||
radv_cs_add_buffer(device->ws, cmd_buffer->cs, cmd_buffer->transfer.copy_temp);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
transfer_copy_buffer_image(struct radv_cmd_buffer *cmd_buffer, struct radv_buffer *buffer, struct radv_image *image,
|
||||
const VkBufferImageCopy2 *region, bool to_image)
|
||||
|
|
|
|||
|
|
@ -312,6 +312,8 @@ radv_destroy_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer)
|
|||
cmd_buffer->device->ws->cs_destroy(cmd_buffer->cs);
|
||||
if (cmd_buffer->gang.cs)
|
||||
cmd_buffer->device->ws->cs_destroy(cmd_buffer->gang.cs);
|
||||
if (cmd_buffer->transfer.copy_temp)
|
||||
cmd_buffer->device->ws->buffer_destroy(cmd_buffer->device->ws, cmd_buffer->transfer.copy_temp);
|
||||
|
||||
for (unsigned i = 0; i < MAX_BIND_POINTS; i++) {
|
||||
struct radv_descriptor_set_header *set = &cmd_buffer->descriptors[i].push_set.set;
|
||||
|
|
|
|||
|
|
@ -166,4 +166,9 @@
|
|||
/* Number of samples for line smooth lowering (hw requirement). */
|
||||
#define RADV_NUM_SMOOTH_AA_SAMPLES 4
|
||||
|
||||
/* Size of the temporary buffer allocated for transfer queue copy command workarounds.
|
||||
* The size is chosen so that it can fit two lines of (1 << 14) blocks at 16 bpp.
|
||||
*/
|
||||
#define RADV_SDMA_TRANSFER_TEMP_BYTES (2 * (1 << 14) * 16)
|
||||
|
||||
#endif /* RADV_CONSTANTS_H */
|
||||
|
|
|
|||
|
|
@ -1869,6 +1869,11 @@ struct radv_cmd_buffer {
|
|||
struct rvcn_decode_buffer_s *decode_buffer;
|
||||
} video;
|
||||
|
||||
struct {
|
||||
/* Temporary space for some transfer queue copy command workarounds. */
|
||||
struct radeon_winsys_bo *copy_temp;
|
||||
} transfer;
|
||||
|
||||
uint64_t shader_upload_seq;
|
||||
|
||||
uint32_t sqtt_cb_id;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue