From 2a7c308d5d6219d290de57aebe207b8842247f2d Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Tue, 25 Oct 2022 13:49:32 +0200 Subject: [PATCH] freedreno/fdl: Increase alignment for UBWC images From empirical tests (on a660) R8G8 with UBWC enabled requires 256b alignment, otherwise there would be a GPU fault during blits. Set alignment to 4096 for all UBWC images since that's what blob does and this area is heavily undertested. Fixes GPU fault in Borderlands 3 running through DXVK. cc: mesa-stable Signed-off-by: Danylo Piliaiev Part-of: (cherry picked from commit 5eaca461a774f6f8466402b5facfc426cee9f1fd) --- .pick_status.json | 2 +- src/freedreno/fdl/fd6_layout.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 78bae89cad8..632e9d44c52 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1228,7 +1228,7 @@ "description": "freedreno/fdl: Increase alignment for UBWC images", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/freedreno/fdl/fd6_layout.c b/src/freedreno/fdl/fd6_layout.c index dd09a3c6d54..41fb9e4df8e 100644 --- a/src/freedreno/fdl/fd6_layout.c +++ b/src/freedreno/fdl/fd6_layout.c @@ -83,11 +83,13 @@ fdl6_tile_alignment(struct fdl_layout *layout, uint32_t *heightalign) layout->pitchalign = 2; } - /* note: this base_align is *probably* not always right, - * it doesn't really get tested. for example with UBWC we might - * want 4k alignment, since we align UBWC levels to 4k + /* Empirical evidence suggests that images with UBWC could have much + * looser alignment requirements, however the validity of alignment is + * heavily undertested and the "officially" supported alignment is 4096b. */ - if (layout->cpp == 1) + if (layout->ubwc) + layout->base_align = 4096; + else if (layout->cpp == 1) layout->base_align = 64; else if (layout->cpp == 2) layout->base_align = 128;