mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
panvk: fix ycbcr format issues on bifrost
When preparing the attribute buffer descriptor, need to select the correct plane index for multi-planar images (like ycbcr ones) Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38145>
This commit is contained in:
parent
072ea76a47
commit
e1a0f2260b
2 changed files with 22 additions and 12 deletions
|
|
@ -48,6 +48,27 @@ struct panvk_image_view {
|
|||
VK_DEFINE_NONDISP_HANDLE_CASTS(panvk_image_view, vk.base, VkImageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW);
|
||||
|
||||
static inline uint32_t
|
||||
panvk_image_view_plane_index(struct panvk_image_view *view)
|
||||
{
|
||||
struct panvk_image *image =
|
||||
container_of(view->vk.image, struct panvk_image, vk);
|
||||
|
||||
if (vk_format_is_depth_or_stencil(view->vk.image->format) &&
|
||||
view->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
/* Color views of ZS is needed for meta copies. 1 byte format is always
|
||||
* stencil, and if it's not the stencil component the caller wants, it
|
||||
* has to be the depth.
|
||||
*/
|
||||
if (vk_format_get_blocksize(view->vk.view_format))
|
||||
return panvk_plane_index(image, VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||
else
|
||||
return panvk_plane_index(image, VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
} else {
|
||||
return panvk_plane_index(image, view->vk.aspects);
|
||||
}
|
||||
}
|
||||
|
||||
static_assert(offsetof(struct panvk_image_view, descs.zs.tex) ==
|
||||
offsetof(struct panvk_image_view, descs.tex),
|
||||
"ZS texture descriptor must alias with color texture descriptor");
|
||||
|
|
|
|||
|
|
@ -225,18 +225,7 @@ prepare_attr_buf_descs(struct panvk_image_view *view)
|
|||
{
|
||||
struct panvk_image *image =
|
||||
container_of(view->vk.image, struct panvk_image, vk);
|
||||
unsigned plane_idx = 0;
|
||||
|
||||
/* Stencil is on plane 1 in a D32_S8 image. The special color case is for
|
||||
* vk_meta copies which create color views of depth/stencil images. In
|
||||
* that case, we base the stencil vs depth detection on the format block
|
||||
* size.
|
||||
*/
|
||||
if (image->vk.format == VK_FORMAT_D32_SFLOAT_S8_UINT &&
|
||||
(view->vk.aspects == VK_IMAGE_ASPECT_STENCIL_BIT ||
|
||||
(view->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT &&
|
||||
vk_format_get_blocksize(view->vk.view_format) == 1)))
|
||||
plane_idx = 1;
|
||||
unsigned plane_idx = panvk_image_view_plane_index(view);
|
||||
|
||||
const struct pan_image_props *plane_props =
|
||||
&image->planes[plane_idx].image.props;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue