freedreno: Avoid unnecessarily aligning to gmem_align_w

If we aren't going to be rendering to this resource, we don't need to
take gmem alignment into account.

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35982>
This commit is contained in:
Rob Clark 2025-06-30 14:23:36 -07:00 committed by Marge Bot
parent 70fe77f61b
commit 29c342649d

View file

@ -1531,14 +1531,18 @@ fd_resource_from_handle(struct pipe_screen *pscreen,
slice->offset = handle->offset;
slice->size0 = handle->stride * prsc->height0;
/* use a pitchalign of gmem_align_w pixels, because GMEM resolve for
* lower alignments is not implemented (but possible for a6xx at least)
*
* for UBWC-enabled resources, layout_resource_for_modifier will further
* validate the pitch and set the right pitchalign
*/
rsc->layout.pitchalign =
fdl_cpp_shift(&rsc->layout) + util_logbase2(screen->info->gmem_align_w);
if (usage & PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE) {
/* use a pitchalign of gmem_align_w pixels, because GMEM resolve for
* lower alignments is not implemented (but possible for a6xx at least)
*
* for UBWC-enabled resources, layout_resource_for_modifier will further
* validate the pitch and set the right pitchalign
*/
rsc->layout.pitchalign =
fdl_cpp_shift(&rsc->layout) + util_logbase2(screen->info->gmem_align_w);
} else {
rsc->layout.pitchalign = fdl_cpp_shift(&rsc->layout);
}
/* apply the minimum pitchalign (note: actually 4 for a3xx but doesn't
* matter) */