Mesa (master): etnaviv: a bit of micro-optimization
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 17 06:19:09 UTC 2019
Module: Mesa
Branch: master
Commit: 1c34d19f904c4c9903eb6e8aefd2a8d383da396d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c34d19f904c4c9903eb6e8aefd2a8d383da396d
Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date: Fri Sep 13 08:56:11 2019 +0200
etnaviv: a bit of micro-optimization
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Jonathan Marek <jonathan at marek.ca>
---
src/gallium/drivers/etnaviv/etnaviv_context.c | 2 +-
src/gallium/drivers/etnaviv/etnaviv_util.h | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 6919d136747..b3ced5ea246 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -251,7 +251,7 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
resource_read(ctx, ctx->constant_buffer[PIPE_SHADER_FRAGMENT].buffer);
/* Mark VBOs as being read */
- for (i = 0; i < ctx->vertex_buffer.count; i++) {
+ foreach_bit(i, ctx->vertex_buffer.enabled_mask) {
assert(!ctx->vertex_buffer.vb[i].is_user_buffer);
resource_read(ctx, ctx->vertex_buffer.vb[i].buffer.resource);
}
diff --git a/src/gallium/drivers/etnaviv/etnaviv_util.h b/src/gallium/drivers/etnaviv/etnaviv_util.h
index 62f62548d2c..75b72adb5cc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_util.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_util.h
@@ -30,6 +30,9 @@
/* for conditionally setting boolean flag(s): */
#define COND(bool, val) ((bool) ? (val) : 0)
+#define foreach_bit(b, mask) \
+ for (uint32_t _m = (mask); _m && ({(b) = u_bit_scan(&_m); 1;});)
+
/* align to a value divisable by granularity >= value, works only for powers of two */
static inline uint32_t
etna_align_up(uint32_t value, uint32_t granularity)
More information about the mesa-commit
mailing list