From e8fce38ed65b0df53508ea5990bdd7d14e4be3a5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 15 Jul 2021 10:01:28 +1000 Subject: [PATCH] llvmpipe: rework query fence signalling for get_query_result_resource For compute shaders stats avail was never signalling because nothing flushed. Fixes dEQP-VK.query_pool.statistics_query.host_query_reset.compute_shader_invocations.64bits_cmdcopyquerypoolresults_primary and others Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_query.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 38c1319a466..e369925d531 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -214,15 +214,17 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, unsigned num_threads = MAX2(1, screen->num_threads); struct llvmpipe_query *pq = llvmpipe_query(q); struct llvmpipe_resource *lpr = llvmpipe_resource(resource); - bool unflushed = false; bool unsignalled = false; if (pq->fence) { /* only have a fence if there was a scene */ if (!lp_fence_signalled(pq->fence)) { - unsignalled = true; if (!lp_fence_issued(pq->fence)) - unflushed = true; + llvmpipe_flush(pipe, NULL, __FUNCTION__); + + if (wait) + lp_fence_wait(pq->fence); } + unsignalled = !lp_fence_signalled(pq->fence); } @@ -236,15 +238,6 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, else { unsigned i; - if (unflushed) { - llvmpipe_flush(pipe, NULL, __FUNCTION__); - - if (!wait) - return; - - lp_fence_wait(pq->fence); - } - switch (pq->type) { case PIPE_QUERY_OCCLUSION_COUNTER: for (i = 0; i < num_threads; i++) {