anv: Use the YCbCr format info from common code

We still maintain our own table of formats but all of the conversion and
sampling info we pull from common code.

Acked-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19950>
This commit is contained in:
Jason Ekstrand
2021-03-30 23:44:25 -05:00
committed by Marge Bot
parent 30a91d333d
commit 2ac771973d
5 changed files with 85 additions and 109 deletions

View File

@@ -827,11 +827,21 @@ add_primary_surface(struct anv_device *device,
struct anv_surface *anv_surf = &image->planes[plane].primary_surface;
bool ok;
uint32_t width = image->vk.extent.width;
uint32_t height = image->vk.extent.height;
const struct vk_format_ycbcr_info *ycbcr_info =
vk_format_get_ycbcr_info(image->vk.format);
if (ycbcr_info) {
assert(plane < ycbcr_info->n_planes);
width /= ycbcr_info->planes[plane].denominator_scales[0];
height /= ycbcr_info->planes[plane].denominator_scales[1];
}
ok = isl_surf_init(&device->isl_dev, &anv_surf->isl,
.dim = vk_to_isl_surf_dim[image->vk.image_type],
.format = plane_format.isl_format,
.width = image->vk.extent.width / plane_format.denominator_scales[0],
.height = image->vk.extent.height / plane_format.denominator_scales[1],
.width = width,
.height = height,
.depth = image->vk.extent.depth,
.levels = image->vk.mip_levels,
.array_len = image->vk.array_layers,