Mesa (master): r600g: Add more (un)likely functions

Marek Olšák mareko at kemper.freedesktop.org
Sun Apr 2 22:36:38 UTC 2017


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

Author: Constantine Kharlamov <Hi-Angel at yandex.ru>
Date:   Sun Mar 26 18:36:22 2017 +0300

r600g: Add more (un)likely functions

1-st is obvious because of assert, 2-nd stolen frmo si_draw_vbo(),
and 3-rd is just a small refactoring.

Signed-off-by: Constantine Kharlamov <Hi-Angel at yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/r600/r600_state_common.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 2e32e6cb5a..096caed8d3 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1683,7 +1683,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
 		return;
 	}
 
-	if (!rctx->vs_shader || !rctx->ps_shader) {
+	if (unlikely(!rctx->vs_shader || !rctx->ps_shader)) {
 		assert(0);
 		return;
 	}
@@ -1695,7 +1695,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
 
 	/* Re-emit the framebuffer state if needed. */
 	dirty_tex_counter = p_atomic_read(&rctx->b.screen->dirty_tex_counter);
-	if (dirty_tex_counter != rctx->b.last_dirty_tex_counter) {
+	if (unlikely(dirty_tex_counter != rctx->b.last_dirty_tex_counter)) {
 		rctx->b.last_dirty_tex_counter = dirty_tex_counter;
 		r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom);
 	}
@@ -1884,12 +1884,10 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
 	}
 
 	/* Draw packets. */
-	if (!info->indirect) {
+	if (likely(!info->indirect)) {
 		radeon_emit(cs, PKT3(PKT3_NUM_INSTANCES, 0, 0));
 		radeon_emit(cs, info->instance_count);
-	}
-
-	if (unlikely(info->indirect)) {
+	} else {
 		uint64_t va = r600_resource(info->indirect)->gpu_address;
 		assert(rctx->b.chip_class >= EVERGREEN);
 




More information about the mesa-commit mailing list