Mesa (11.0): r600: fix constant buffer size programming

Emil Velikov evelikov at kemper.freedesktop.org
Fri Jan 15 14:45:18 UTC 2016


Module: Mesa
Branch: 11.0
Commit: 7562abc8d54045544bfbbd1bd60f2a82bc820eb9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7562abc8d54045544bfbbd1bd60f2a82bc820eb9

Author: Grazvydas Ignotas <notasas at gmail.com>
Date:   Tue Dec 22 04:12:07 2015 +0200

r600: fix constant buffer size programming

When buffer size is less than 16, zero ends up being programmed as
size, which prevents the hardware from fetching the correct values.
Fix it by combining shift and align so that the value is always
rounded up.

Cc: "11.1 11.0 10.6" <mesa-stable at lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92229
Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
(cherry picked from commit da0e216e069bd064199ed04b52de6fb23d810806)
[Emil Velikov: s/radeon_set_context_reg/r600_write_context_reg/]
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>

Conflicts:
	src/gallium/drivers/r600/evergreen_state.c
	src/gallium/drivers/r600/r600_state.c

---

 src/gallium/drivers/r600/evergreen_state.c |    2 +-
 src/gallium/drivers/r600/r600_state.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 1976d87..9eb7523 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1916,7 +1916,7 @@ static void evergreen_emit_constant_buffers(struct r600_context *rctx,
 
 		if (!gs_ring_buffer) {
 			r600_write_context_reg_flag(cs, reg_alu_constbuf_size + buffer_index * 4,
-						    ALIGN_DIVUP(cb->buffer_size >> 4, 16), pkt_flags);
+						    ALIGN_DIVUP(cb->buffer_size, 256), pkt_flags);
 			r600_write_context_reg_flag(cs, reg_alu_const_cache + buffer_index * 4, va >> 8,
 						    pkt_flags);
 		}
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index a588e16..3460925 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1732,7 +1732,7 @@ static void r600_emit_constant_buffers(struct r600_context *rctx,
 
 		if (!gs_ring_buffer) {
 			r600_write_context_reg(cs, reg_alu_constbuf_size + buffer_index * 4,
-					       ALIGN_DIVUP(cb->buffer_size >> 4, 16));
+					       ALIGN_DIVUP(cb->buffer_size, 256));
 			r600_write_context_reg(cs, reg_alu_const_cache + buffer_index * 4, offset >> 8);
 		}
 




More information about the mesa-commit mailing list