freedreno/fdl: Fix 3d mipmapping height alignment
We can get into a situation where the layer size for a given mip isn't large enough to hold the pitch times the aligned height, i.e. the height isn't aligned. This can happen even if the size is 4K aligned. The hardware seems not to align the height for us, so we have to use the MINLAYERSZ hammer. This was found with a Vulkan test when enabling tiling for mutable textures on a750, but it's also reproducable via "bin/texelFetch fs sampler3D 76x76" using piglit. Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32615>
This commit is contained in:
@@ -267,10 +267,8 @@ fdl6_layout(struct fdl_layout *layout, const struct fd_dev_info *info,
|
||||
if (pitch != fdl_pitch(layout, level - 1) / 2)
|
||||
min_3d_layer_size = slice->size0 = nblocksy * pitch;
|
||||
|
||||
/* If the height is now less than the alignment requirement, then
|
||||
* scale it up and let this be the minimum layer size.
|
||||
*/
|
||||
if (tile_mode && util_format_get_nblocksy(format, height) < heightalign)
|
||||
/* If the height wouldn't be aligned, stay aligned instead */
|
||||
if (slice->size0 < nblocksy * pitch)
|
||||
min_3d_layer_size = slice->size0 = nblocksy * pitch;
|
||||
|
||||
/* If the size would become un-page-aligned, stay aligned instead. */
|
||||
|
@@ -961,6 +961,40 @@ static const struct testcase
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
/* dEQP-VK.image.texel_view_compatible.graphic.extended.3d_image.texture_read.astc_8x8_unorm_block.r32g32b32a32_uint
|
||||
*
|
||||
* This is an interesting case where the size is 4K-aligned but the
|
||||
* height becomes not aligned, and we have to use MINLAYERSZ to
|
||||
* intervene.
|
||||
*
|
||||
* This test can only use tiled layouts on a750+, and the blob seems
|
||||
* to make this one texture linear rather than deal with the
|
||||
* alignment problem.
|
||||
*/
|
||||
{
|
||||
.format = PIPE_FORMAT_R32G32B32A32_FLOAT,
|
||||
.is_3d = true,
|
||||
.layout =
|
||||
{
|
||||
.tile_mode = TILE6_3,
|
||||
.ubwc = false,
|
||||
.width0 = 76,
|
||||
.height0 = 76,
|
||||
.depth0 = 1,
|
||||
.slices =
|
||||
{
|
||||
{.offset = 0, .pitch = 2048, .size0 = 163840},
|
||||
{.offset = 163840, .pitch = 1024, .size0 = 49152},
|
||||
{.offset = 212992, .pitch = 1024, .size0 = 49152},
|
||||
{.offset = 262144, .pitch = 1024},
|
||||
{.offset = 311296, .pitch = 1024},
|
||||
{.offset = 360448, .pitch = 1024},
|
||||
{.offset = 409600, .pitch = 1024},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/* has_ubwc_linear_mipmap_fallback is supported started from A6XX gen4. */
|
||||
|
Reference in New Issue
Block a user