mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
anv: Use RCS cmd buffer if blit src/dest has 3 components
The Blitter engine lacks support for 3 components color format so we can just fallback to RCS companion command buffer for the blit operation. Even though blitter supports 96-bit support it only supports linear tiling. We can support other types of tiling by falling back to the RCS companion command buffer. Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Rohan Garg <rohan.garg@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26300>
This commit is contained in:
parent
87cdcbd7d7
commit
708d4f59f8
1 changed files with 83 additions and 1 deletions
|
|
@ -404,6 +404,55 @@ end_main_rcs_cmd_buffer_done(struct anv_cmd_buffer *cmd_buffer,
|
|||
syncpoint);
|
||||
}
|
||||
|
||||
static bool
|
||||
anv_blorp_blitter_execute_on_companion(struct anv_cmd_buffer *cmd_buffer,
|
||||
struct anv_image *image,
|
||||
const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo,
|
||||
const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo)
|
||||
{
|
||||
if (!anv_cmd_buffer_is_blitter_queue(cmd_buffer))
|
||||
return false;
|
||||
|
||||
assert((pCopyBufferToImageInfo && !pCopyImageToBufferInfo) ||
|
||||
(pCopyImageToBufferInfo && !pCopyBufferToImageInfo));
|
||||
|
||||
bool blorp_execute_on_companion = false;
|
||||
VkImageAspectFlags aspect_mask = VK_IMAGE_ASPECT_NONE;
|
||||
const uint32_t region_count = pCopyBufferToImageInfo ?
|
||||
pCopyBufferToImageInfo->regionCount :
|
||||
pCopyImageToBufferInfo->regionCount;
|
||||
|
||||
for (unsigned r = 0; r < region_count &&
|
||||
!blorp_execute_on_companion; r++) {
|
||||
if (pCopyBufferToImageInfo) {
|
||||
aspect_mask =
|
||||
pCopyBufferToImageInfo->pRegions[r].imageSubresource.aspectMask;
|
||||
} else {
|
||||
aspect_mask =
|
||||
pCopyImageToBufferInfo->pRegions[r].imageSubresource.aspectMask;
|
||||
}
|
||||
|
||||
enum isl_format linear_format =
|
||||
anv_get_isl_format(cmd_buffer->device->info, image->vk.format,
|
||||
aspect_mask, VK_IMAGE_TILING_LINEAR);
|
||||
const struct isl_format_layout *linear_fmtl =
|
||||
isl_format_get_layout(linear_format);
|
||||
|
||||
switch (linear_fmtl->bpb) {
|
||||
case 96:
|
||||
/* We can only support linear mode for 96bpp on blitter engine. */
|
||||
blorp_execute_on_companion |=
|
||||
image->vk.tiling != VK_IMAGE_TILING_LINEAR;
|
||||
break;
|
||||
default:
|
||||
blorp_execute_on_companion |= linear_fmtl->bpb % 3 == 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return blorp_execute_on_companion;
|
||||
}
|
||||
|
||||
static bool
|
||||
anv_blorp_execute_on_companion(struct anv_cmd_buffer *cmd_buffer,
|
||||
struct anv_image *dst_image)
|
||||
|
|
@ -613,7 +662,18 @@ void anv_CmdCopyBufferToImage2(
|
|||
struct anv_cmd_buffer *main_cmd_buffer = cmd_buffer;
|
||||
UNUSED struct anv_state rcs_done = ANV_STATE_NULL;
|
||||
|
||||
if (anv_blorp_execute_on_companion(cmd_buffer, dst_image)) {
|
||||
bool blorp_execute_on_companion =
|
||||
anv_blorp_execute_on_companion(cmd_buffer, dst_image);
|
||||
|
||||
/* Check if any one of the aspects is incompatible with the blitter engine,
|
||||
* if true, use the companion RCS command buffer for blit operation since 3
|
||||
* component formats are not supported natively except 96bpb on the blitter.
|
||||
*/
|
||||
blorp_execute_on_companion |=
|
||||
anv_blorp_blitter_execute_on_companion(cmd_buffer, dst_image,
|
||||
pCopyBufferToImageInfo, NULL);
|
||||
|
||||
if (blorp_execute_on_companion) {
|
||||
rcs_done = record_main_rcs_cmd_buffer_done(cmd_buffer);
|
||||
cmd_buffer = cmd_buffer->companion_rcs_cmd_buffer;
|
||||
}
|
||||
|
|
@ -676,6 +736,25 @@ void anv_CmdCopyImageToBuffer2(
|
|||
ANV_FROM_HANDLE(anv_image, src_image, pCopyImageToBufferInfo->srcImage);
|
||||
ANV_FROM_HANDLE(anv_buffer, dst_buffer, pCopyImageToBufferInfo->dstBuffer);
|
||||
|
||||
UNUSED struct anv_cmd_buffer *main_cmd_buffer = cmd_buffer;
|
||||
UNUSED struct anv_state rcs_done = ANV_STATE_NULL;
|
||||
|
||||
bool blorp_execute_on_companion =
|
||||
anv_blorp_execute_on_companion(cmd_buffer, src_image);
|
||||
|
||||
/* Check if any one of the aspects is incompatible with the blitter engine,
|
||||
* if true, use the companion RCS command buffer for blit operation since 3
|
||||
* component formats are not supported natively except 96bpb on the blitter.
|
||||
*/
|
||||
blorp_execute_on_companion |=
|
||||
anv_blorp_blitter_execute_on_companion(cmd_buffer, src_image, NULL,
|
||||
pCopyImageToBufferInfo);
|
||||
|
||||
if (blorp_execute_on_companion) {
|
||||
rcs_done = record_main_rcs_cmd_buffer_done(cmd_buffer);
|
||||
cmd_buffer = cmd_buffer->companion_rcs_cmd_buffer;
|
||||
}
|
||||
|
||||
struct blorp_batch batch;
|
||||
anv_blorp_batch_init(cmd_buffer, &batch, 0);
|
||||
|
||||
|
|
@ -688,6 +767,9 @@ void anv_CmdCopyImageToBuffer2(
|
|||
anv_add_buffer_write_pending_bits(cmd_buffer, "after copy image to buffer");
|
||||
|
||||
anv_blorp_batch_finish(&batch);
|
||||
|
||||
if (rcs_done.alloc_size)
|
||||
end_main_rcs_cmd_buffer_done(main_cmd_buffer, rcs_done);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue