From: Roland Scheidegger <srol...@vmware.com>

For eg/cm, the r600_gb_backend_map will always be 0. I assume this is a bug
in the drm kernel driver, as it just just never fills the information in.
I am not entirely sure if the map is supposed to be needed for these chips,
since unlike on r600/r700 the value calculated for the map is in fact written
to the GB_BACKEND_MAP reg, for which I am unable to dig up any documentation.

In any case, this causes r600_query_hw_prepare_buffer to write the "status bit"
(just the highest bit of the occlusion query result) even for active rbes
(all but the first). This doesn't make much sense, albeit I suppose it's mostly
safe. According to the commit history, it's necessary to set these bits for
inactive rbes since otherwise predication will lock up - presumably the hw just
is waiting for the status bit to appear, which will never happen with inactive
rbes. I'd guess potentially predication could be wrong (due to not waiting for
the actual result if the status bit is already there) if this is set for
active rbes.

Discovered while trying to fix predication lockups on Juniper (needs another
patch).
---
 src/gallium/drivers/r600/r600_query.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_query.c 
b/src/gallium/drivers/r600/r600_query.c
index 987da9a806..699404b10d 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -1834,8 +1834,14 @@ void r600_query_fix_enabled_rb_mask(struct 
r600_common_screen *rscreen)
 
        assert(rscreen->chip_class <= CAYMAN);
 
-       /* if backend_map query is supported by the kernel */
-       if (rscreen->info.r600_gb_backend_map_valid) {
+       /*
+        * if backend_map query is supported by the kernel.
+        * Note the kernel drm driver (as of now) never fills in the associated
+        * data on eg/cm, only r600/r700, hence ignore the valid bit there.
+        * (Albeit some chips with just one active rb can have a valid 0 map.)
+        */ 
+       if (rscreen->info.r600_gb_backend_map_valid &&
+           (ctx->chip_class < EVERGREEN || rscreen->info.r600_gb_backend_map 
!= 0)) {
                unsigned num_tile_pipes = rscreen->info.num_tile_pipes;
                unsigned backend_map = rscreen->info.r600_gb_backend_map;
                unsigned item_width, item_mask;
-- 
2.12.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to