summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2014-10-01 11:28:17 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2014-10-29 17:44:20 +0000
commitc4f58245d0add5c1633cd8bbf038bbe1fd86cf78 (patch)
tree093f6f3004d8033c5b3b57acfd4fa446d3fc68c5 /src
parenteb496ff68db8f2ffa51d1c72c57491e2c49fa053 (diff)
freedreno/a3xx: emit all immediates in one shot
Makes the command stream a bit tighter when there are lots of immediates. Signed-off-by: Rob Clark <robclark@freedesktop.org> (cherry picked from commit f5eeb8a6dc4d1a1a4b88843e1c8d6d3a9c50512a)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_emit.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index 430339ae47d..d92ebc2f0ad 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -92,14 +92,13 @@ emit_constants(struct fd_ringbuffer *ring,
uint32_t enabled_mask = constbuf->enabled_mask;
uint32_t first_immediate;
uint32_t base = 0;
- unsigned i;
// XXX TODO only emit dirty consts.. but we need to keep track if
// they are clobbered by a clear, gmem2mem, or mem2gmem..
constbuf->dirty_mask = enabled_mask;
- /* in particular, with binning shader and a unneeded consts no
- * longer referenced, we could end up w/ constlen that is smaller
+ /* in particular, with binning shader we may end up with unused
+ * consts, ie. we could end up w/ constlen that is smaller
* than first_immediate. In that case truncate the user consts
* early to avoid HLSQ lockup caused by writing too many consts
*/
@@ -137,12 +136,21 @@ emit_constants(struct fd_ringbuffer *ring,
/* emit shader immediates: */
if (shader) {
- for (i = 0; i < shader->immediates_count; i++) {
- base = 4 * (shader->first_immediate + i);
- if (base >= (4 * shader->constlen))
- break;
+ int size = shader->immediates_count;
+ base = shader->first_immediate;
+
+ /* truncate size to avoid writing constants that shader
+ * does not use:
+ */
+ size = MIN2(size + base, shader->constlen) - base;
+
+ /* convert out of vec4: */
+ base *= 4;
+ size *= 4;
+
+ if (size > 0) {
fd3_emit_constant(ring, sb, base,
- 0, 4, shader->immediates[i].val, NULL);
+ 0, size, shader->immediates[0].val, NULL);
}
}
}