radv: Add plane width/height helpers.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8797>
This commit is contained in:
committed by
Marge Bot
parent
b71406dda1
commit
34a1c64d08
@@ -7041,12 +7041,12 @@ radv_initialise_color_surface(struct radv_device *device,
|
||||
}
|
||||
|
||||
if (device->physical_device->rad_info.chip_class >= GFX9) {
|
||||
const struct vk_format_description *format_desc = vk_format_description(iview->image->vk_format);
|
||||
|
||||
unsigned mip0_depth = iview->image->type == VK_IMAGE_TYPE_3D ?
|
||||
(iview->extent.depth - 1) : (iview->image->info.array_size - 1);
|
||||
unsigned width = iview->extent.width / (iview->plane_id ? format_desc->width_divisor : 1);
|
||||
unsigned height = iview->extent.height / (iview->plane_id ? format_desc->height_divisor : 1);
|
||||
unsigned width = vk_format_get_plane_width(iview->image->vk_format,
|
||||
iview->plane_id, iview->extent.width);
|
||||
unsigned height = vk_format_get_plane_height(iview->image->vk_format,
|
||||
iview->plane_id, iview->extent.height);
|
||||
|
||||
if (device->physical_device->rad_info.chip_class >= GFX10) {
|
||||
cb->cb_color_view |= S_028C6C_MIP_LEVEL_GFX10(iview->base_mip);
|
||||
|
||||
@@ -1372,14 +1372,8 @@ radv_image_create_layout(struct radv_device *device,
|
||||
uint64_t offset;
|
||||
unsigned stride;
|
||||
|
||||
if (plane) {
|
||||
const struct vk_format_description *desc = vk_format_description(image->vk_format);
|
||||
assert(info.width % desc->width_divisor == 0);
|
||||
assert(info.height % desc->height_divisor == 0);
|
||||
|
||||
info.width /= desc->width_divisor;
|
||||
info.height /= desc->height_divisor;
|
||||
}
|
||||
info.width = vk_format_get_plane_width(image->vk_format, plane, info.width);
|
||||
info.height = vk_format_get_plane_height(image->vk_format, plane, info.height);
|
||||
|
||||
if (create_info.no_metadata_planes || image->plane_count > 1) {
|
||||
image->planes[plane].surface.flags |= RADEON_SURF_DISABLE_DCC |
|
||||
@@ -1684,7 +1678,6 @@ radv_image_view_make_descriptor(struct radv_image_view *iview,
|
||||
{
|
||||
struct radv_image *image = iview->image;
|
||||
struct radv_image_plane *plane = &image->planes[plane_id];
|
||||
const struct vk_format_description *format_desc = vk_format_description(image->vk_format);
|
||||
bool is_stencil = iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
uint32_t blk_w;
|
||||
union radv_descriptor *descriptor;
|
||||
@@ -1709,8 +1702,8 @@ radv_image_view_make_descriptor(struct radv_image_view *iview,
|
||||
hw_level, hw_level + iview->level_count - 1,
|
||||
iview->base_layer,
|
||||
iview->base_layer + iview->layer_count - 1,
|
||||
iview->extent.width / (plane_id ? format_desc->width_divisor : 1),
|
||||
iview->extent.height / (plane_id ? format_desc->height_divisor : 1),
|
||||
vk_format_get_plane_width(image->vk_format, plane_id, iview->extent.width),
|
||||
vk_format_get_plane_height(image->vk_format, plane_id, iview->extent.height),
|
||||
iview->extent.depth,
|
||||
descriptor->plane_descriptors[descriptor_plane_id],
|
||||
descriptor_plane_id ? NULL : descriptor->fmask_descriptor);
|
||||
|
||||
@@ -576,6 +576,20 @@ vk_format_get_plane_count(VkFormat format)
|
||||
return desc->plane_count;
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_plane_width(VkFormat format, unsigned plane,
|
||||
unsigned width)
|
||||
{
|
||||
return util_format_get_plane_width(vk_format_to_pipe_format(format), plane, width);
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_plane_height(VkFormat format, unsigned plane,
|
||||
unsigned height)
|
||||
{
|
||||
return util_format_get_plane_height(vk_format_to_pipe_format(format), plane, height);
|
||||
}
|
||||
|
||||
static inline VkFormat
|
||||
vk_format_get_plane_format(VkFormat format, unsigned plane_id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user