mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
panvk: Only use Z24_UNORM_PACKED for AFBC images
The host copy logic doesn't support unpacking/packing D24X8, and if we
were to support it, it would be inefficient because of the non-32-bit
alignment. Given host copy is not a thing on AFBC resources, and given
the Z24_UNORM_PACKED is mostly beneficial to AFBC(Z) resources, let's
restrict its use to this case only and use Z24X8 otherwise.
Fixes: a620f33b7c ("panvk: Add planar Z24S8 support")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37473>
This commit is contained in:
parent
76843c049f
commit
3d241e69c5
2 changed files with 21 additions and 8 deletions
|
|
@ -160,11 +160,15 @@ get_plane_count(struct panvk_image *image)
|
|||
}
|
||||
|
||||
static enum pipe_format
|
||||
select_depth_plane_pfmt(struct panvk_image *image)
|
||||
select_depth_plane_pfmt(struct panvk_image *image, uint64_t mod)
|
||||
{
|
||||
switch (image->vk.format) {
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
return PIPE_FORMAT_Z24_UNORM_PACKED;
|
||||
/* We only use packed Z24 when AFBC is involved, to simplify copies on on
|
||||
* AFBC resources.
|
||||
*/
|
||||
return drm_is_afbc(mod) ? PIPE_FORMAT_Z24_UNORM_PACKED
|
||||
: PIPE_FORMAT_Z24X8_UNORM;
|
||||
case VK_FORMAT_D32_SFLOAT_S8_UINT:
|
||||
return PIPE_FORMAT_Z32_FLOAT;
|
||||
default:
|
||||
|
|
@ -185,11 +189,11 @@ select_stencil_plane_pfmt(struct panvk_image *image)
|
|||
}
|
||||
|
||||
static enum pipe_format
|
||||
select_plane_pfmt(struct panvk_image *image, unsigned plane)
|
||||
select_plane_pfmt(struct panvk_image *image, uint64_t mod, unsigned plane)
|
||||
{
|
||||
if (panvk_image_is_planar_depth_stencil(image)) {
|
||||
return plane > 0 ? select_stencil_plane_pfmt(image)
|
||||
: select_depth_plane_pfmt(image);
|
||||
: select_depth_plane_pfmt(image, mod);
|
||||
}
|
||||
|
||||
VkFormat plane_format = vk_format_get_plane_format(image->vk.format, plane);
|
||||
|
|
@ -279,7 +283,7 @@ panvk_image_can_use_mod(struct panvk_image *image,
|
|||
};
|
||||
|
||||
for (uint8_t plane = 0; plane < image->plane_count; plane++) {
|
||||
iprops.format = select_plane_pfmt(image, plane);
|
||||
iprops.format = select_plane_pfmt(image, mod, plane);
|
||||
iprops.extent_px = (struct pan_image_extent){
|
||||
.width = vk_format_get_plane_width(image->vk.format, plane,
|
||||
image->vk.extent.width),
|
||||
|
|
@ -410,7 +414,8 @@ panvk_image_init_layouts(struct panvk_image *image,
|
|||
.offset_B = 0,
|
||||
};
|
||||
for (uint8_t plane = 0; plane < image->plane_count; plane++) {
|
||||
enum pipe_format pfmt = select_plane_pfmt(image, plane);
|
||||
enum pipe_format pfmt =
|
||||
select_plane_pfmt(image, image->vk.drm_format_mod, plane);
|
||||
|
||||
if (explicit_info) {
|
||||
plane_layout = (struct pan_image_layout_constraints){
|
||||
|
|
|
|||
|
|
@ -98,8 +98,16 @@ panvk_meta_copy_get_image_properties(struct panvk_image *img,
|
|||
break;
|
||||
case VK_FORMAT_D24_UNORM_S8_UINT:
|
||||
if (panvk_image_is_planar_depth_stencil(img)) {
|
||||
props.depth.view_format =
|
||||
use_unorm ? VK_FORMAT_R8G8B8_UNORM : VK_FORMAT_R8G8B8_UINT;
|
||||
if (img->planes[0].image.props.format ==
|
||||
PIPE_FORMAT_Z24_UNORM_PACKED) {
|
||||
props.depth.view_format =
|
||||
use_unorm ? VK_FORMAT_R8G8B8_UNORM : VK_FORMAT_R8G8B8_UINT;
|
||||
} else {
|
||||
assert(img->planes[0].image.props.format ==
|
||||
PIPE_FORMAT_Z24X8_UNORM);
|
||||
props.depth.view_format = use_unorm ? VK_FORMAT_R8G8B8A8_UNORM
|
||||
: VK_FORMAT_R8G8B8A8_UINT;
|
||||
}
|
||||
props.depth.component_mask = BITFIELD_MASK(3);
|
||||
props.stencil.view_format =
|
||||
use_unorm ? VK_FORMAT_R8_UNORM : VK_FORMAT_R8_UINT;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue