pan/va: Stall after ATEST

In theory this wait is required for correct behaviour of discarded threads with
ATEST. Mesa usually waits before the instruction after ATEST, so this wait will
get optimized out by va_merge_flow, but as our scheduler gets more sophisticated
this could become an issue.

Let's stay on the safe side and insert the recommended wait.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17428>
This commit is contained in:
Alyssa Rosenzweig 2022-06-17 21:06:24 -04:00 committed by Marge Bot
parent db2bdc1dc3
commit 29c33f75d3
2 changed files with 9 additions and 1 deletions

View File

@ -104,12 +104,13 @@ TEST_F(InsertFlow, TilebufferWait7) {
});
}
TEST_F(InsertFlow, AtestWait6) {
TEST_F(InsertFlow, AtestWait6AndWait0After) {
CASE(FRAGMENT, {
flow(DISCARD);
bi_fadd_f32_to(b, bi_register(0), bi_register(0), bi_register(0));
flow(WAIT0126);
bi_atest_to(b, bi_register(0), bi_register(4), bi_register(5));
flow(WAIT0);
flow(END);
});
}

View File

@ -429,6 +429,10 @@ va_insert_flow_control_nops(bi_context *ctx)
/* Insert waits for tilebuffer and depth/stencil instructions. These
* only happen in regular fragment shaders, as the required waits are
* assumed to already have happened in blend shaders.
*
* For discarded thread handling, ATEST must be serialized against all
* other asynchronous instructions and should be serialized against all
* instructions. Wait for slot 0 immediately after the ATEST.
*/
case BI_OPCODE_BLEND:
case BI_OPCODE_LD_TILE:
@ -437,6 +441,9 @@ va_insert_flow_control_nops(bi_context *ctx)
bi_flow(ctx, bi_before_instr(I), VA_FLOW_WAIT);
break;
case BI_OPCODE_ATEST:
bi_flow(ctx, bi_before_instr(I), VA_FLOW_WAIT0126);
bi_flow(ctx, bi_after_instr(I), VA_FLOW_WAIT0);
break;
case BI_OPCODE_ZS_EMIT:
if (!ctx->inputs->is_blend)
bi_flow(ctx, bi_before_instr(I), VA_FLOW_WAIT0126);