panfrost: Fix ZS reloading on Bifrost v6

EARLY_ZS_ALWAYS was introduced in Bifrost v7. Use ALWAYS (or INTERSECT
depending on the situation) on v6.

Fixes: 8ba2f9f698 ("panfrost: Create a blitter library to replace the existing preload helpers")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Icecream95 <ixn@keemail.me>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10250>
(cherry picked from commit 1de393fec5)
This commit is contained in:
Boris Brezillon 2021-04-15 10:10:16 +02:00 committed by Eric Engestrom
parent 3c35559eaf
commit a8ee300289
2 changed files with 31 additions and 5 deletions

View file

@ -40,7 +40,7 @@
"description": "panfrost: Fix ZS reloading on Bifrost v6",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "8ba2f9f698584d20830ef31bbc2fb8a6635c8314"
},

View file

@ -977,10 +977,36 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool *desc_pool,
(dcd_idx * (MALI_DRAW_LENGTH + MALI_DRAW_PADDING_LENGTH));
pan_preload_emit_dcd(desc_pool, fb, zs, coords, tsd, rsd, dcd);
fb->bifrost.pre_post.modes[dcd_idx] =
zs ?
MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS :
MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
if (zs) {
enum pipe_format fmt = fb->zs.view.zs->image->layout.format;
bool always = false;
/* If we're dealing with a combined ZS resource and only one
* component is cleared, we need to reload the whole surface
* because the zs_clean_pixel_write_enable flag is set in that
* case.
*/
if (util_format_is_depth_and_stencil(fmt) &&
fb->zs.clear.z != fb->zs.clear.s)
always = true;
/* We could use INTERSECT on Bifrost v7 too, but
* EARLY_ZS_ALWAYS has the advantage of reloading the ZS tile
* buffer one or more tiles ahead, making ZS data immediately
* available for any ZS tests taking place in other shaders.
* Thing's haven't been benchmarked to determine what's
* preferable (saving bandwidth vs having ZS preloaded
* earlier), so let's leave it like that for now.
*/
fb->bifrost.pre_post.modes[dcd_idx] =
desc_pool->dev->arch > 6 ?
MALI_PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS :
always ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS :
MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
} else {
fb->bifrost.pre_post.modes[dcd_idx] =
MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
}
}
static void