isl: Work around NVIDIA and AMD display pitch requirements

In the case where we're rendering on the Intel GPU, but displaying
on an AMD and NVIDIA GPU, we need to follow their pitch requirements
for our linear scanout buffers.

Based on a patch by Lionel Landwerlin.

Closes: #4706
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10895>
This commit is contained in:
Kenneth Graunke 2021-05-20 02:03:07 -07:00 committed by Marge Bot
parent d8a1d41952
commit a3a4517f41
1 changed files with 4 additions and 1 deletions

View File

@ -1466,9 +1466,12 @@ isl_calc_row_pitch_alignment(const struct isl_device *dev,
* PRI_STRIDE Stride (p1254):
*
* "When using linear memory, this must be at least 64 byte aligned."
*
* However, when displaying on NVIDIA and recent AMD GPUs via PRIME,
* we need a larger pitch of 256 bytes. We do that just in case.
*/
if (surf_info->usage & ISL_SURF_USAGE_DISPLAY_BIT)
alignment = isl_align(alignment, 64);
alignment = isl_align(alignment, 256);
return alignment;
}