Mesa (master): r600: fix enabled_rb_mask on eg/cm

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Jan 10 04:03:54 UTC 2018


Module: Mesa
Branch: master
Commit: 7c0bc495f1e467562c4b47da1c2821fd323a45b1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c0bc495f1e467562c4b47da1c2821fd323a45b1

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Tue Jan  9 01:38:27 2018 +0100

r600: fix enabled_rb_mask on eg/cm

For eg/cm, the r600_gb_backend_map will always be 0. This is a bug in
the drm kernel driver, as it just just never fills the information in
(it is now being fixed - the history shows it was being filled in when
the query was brand new but got lost shortly thereafter with backend_map
fixes).
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).

Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/r600/r600_query.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 0d22bc5216..8f87c51cca 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -1822,8 +1822,15 @@ 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 for a long time never filled in the
+	 * associated data on eg/cm, only on r600/r700, hence ignore the valid
+	 * bit there if the map is zero.
+	 * (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;




More information about the mesa-commit mailing list