From 62fa868728c729152af0d7cecd1d3e47e831cb7d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sun, 14 Feb 2016 09:59:41 -0500 Subject: [PATCH] freedreno/a4xx: better occlusion/sample counting This seems to give more reliable results. More similar to what we do on a3xx, although I think it breaks the a3xx theory that the four sets of results map to each MRT (since we appear to still only have four sets on a4xx). The divide-by-two is a bit odd, but seems to be needed for some reason. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a4xx/fd4_query.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_query.c b/src/gallium/drivers/freedreno/a4xx/fd4_query.c index 4f69e0c1694..a1fafbc6128 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_query.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_query.c @@ -81,7 +81,12 @@ static uint64_t count_samples(const struct fd_rb_samp_ctrs *start, const struct fd_rb_samp_ctrs *end) { - return end->ctr[0] - start->ctr[0]; + uint64_t n = 0; + + for (unsigned i = 0; i < 16; i += 4) + n += end->ctr[i] - start->ctr[i]; + + return n / 2; } static void -- 2.30.2