From 84b7f700bba389e8cb927452fb90795eb9629f28 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 11 Sep 2023 09:41:37 -0400 Subject: [PATCH] aux/tc: fix renderpass tracking fb state clobber scenario MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in a stream like: * set fb state (A) * flush * set fb state (B) * draw -> driver query * flush the "driver query" should return the tc info corresponding to the most recent fb state (B). previously this would increment to C because the flag for incrementing at the start of a batch was set Fixes: 07017aa137b ("util/tc: implement renderpass tracking") Acked-by: Marek Olšák Part-of: (cherry picked from commit 9399165bd4e01d7842440d306d82351b83f1b0a9) --- .pick_status.json | 2 +- src/gallium/auxiliary/util/u_threaded_context.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 60ec916758c..2c653815034 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1975,7 +1975,7 @@ "description": "aux/tc: fix renderpass tracking fb state clobber scenario", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "07017aa137b9fa48ec25ef5d1e3fd2d137beb651" }, diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 38b0e7cea03..252aca0344c 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1458,6 +1458,13 @@ tc_set_framebuffer_state(struct pipe_context *_pipe, if (tc->options.parse_renderpass_info) { + /* ensure this is treated as the first fb set if no fb activity has occurred */ + if (!tc->renderpass_info_recording->has_draw && + !tc->renderpass_info_recording->cbuf_clear && + !tc->renderpass_info_recording->cbuf_load && + !tc->renderpass_info_recording->zsbuf_load && + !tc->renderpass_info_recording->zsbuf_clear_partial) + tc->batch_slots[tc->next].first_set_fb = false; /* store existing zsbuf data for possible persistence */ uint8_t zsbuf = tc->renderpass_info_recording->has_draw ? 0 :