mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
panvk: only add storage usage without AFBC
Instead of always adding storage usage on pre_mod_adjustments and preventing AFBC for all images with usage TRANSFER_DST, only do this when the image doesn't use AFBC, by adding a new post_mod_adjustments pass. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37771>
This commit is contained in:
parent
8c332b1cad
commit
0551a40c36
1 changed files with 21 additions and 3 deletions
|
|
@ -483,10 +483,8 @@ panvk_image_pre_mod_select_meta_adjustments(struct panvk_image *image)
|
|||
if (aspects & VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||
image->vk.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
|
||||
if (aspects & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (aspects & VK_IMAGE_ASPECT_COLOR_BIT)
|
||||
image->vk.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
image->vk.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
if (image->vk.stencil_usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT)
|
||||
|
|
@ -518,6 +516,20 @@ panvk_image_pre_mod_select_meta_adjustments(struct panvk_image *image)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
panvk_image_post_mod_select_meta_adjustments(struct panvk_image *image)
|
||||
{
|
||||
const VkImageAspectFlags aspects = vk_format_aspects(image->vk.format);
|
||||
|
||||
/* If the image didn't end up using AFBC, we should add the storage flag
|
||||
* to allow vkmeta to take the compute based copying path. */
|
||||
if ((image->vk.usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) &&
|
||||
(aspects & VK_IMAGE_ASPECT_COLOR_BIT) &&
|
||||
!drm_is_afbc(image->vk.drm_format_mod)) {
|
||||
image->vk.usage |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
panvk_image_get_total_size(const struct panvk_image *image)
|
||||
{
|
||||
|
|
@ -554,6 +566,12 @@ panvk_image_init(struct panvk_image *image,
|
|||
/* Now that we've patched the create/usage flags, we can proceed with the
|
||||
* modifier selection. */
|
||||
image->vk.drm_format_mod = panvk_image_get_mod(image, pCreateInfo);
|
||||
|
||||
/* Some modifiers like AFBC affect some decisions we make for vkmeta, but
|
||||
* we don't want to outright prevent these modifiers. If those weren't used,
|
||||
* we apply additional flags here. */
|
||||
panvk_image_post_mod_select_meta_adjustments(image);
|
||||
|
||||
return panvk_image_init_layouts(image, pCreateInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue