[Mesa-dev] [PATCH 3/4] radeonsi: add more unlikely() uses into si_draw_vbo

Marek Olšák maraeo at gmail.com
Mon Sep 5 22:46:33 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_state_draw.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 9469bb4..d4447a9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -889,46 +889,46 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 		 */
 		if (unlikely(!info->instance_count))
 			return;
 
 		/* Handle count == 0. */
 		if (unlikely(!info->count &&
 			     (info->indexed || !info->count_from_stream_output)))
 			return;
 	}
 
-	if (!sctx->vs_shader.cso) {
+	if (unlikely(!sctx->vs_shader.cso)) {
 		assert(0);
 		return;
 	}
-	if (!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard)) {
+	if (unlikely(!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard))) {
 		assert(0);
 		return;
 	}
-	if (!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES)) {
+	if (unlikely(!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES))) {
 		assert(0);
 		return;
 	}
 
 	/* Re-emit the framebuffer state if needed. */
 	dirty_fb_counter = p_atomic_read(&sctx->b.screen->dirty_fb_counter);
-	if (dirty_fb_counter != sctx->b.last_dirty_fb_counter) {
+	if (unlikely(dirty_fb_counter != sctx->b.last_dirty_fb_counter)) {
 		sctx->b.last_dirty_fb_counter = dirty_fb_counter;
 		sctx->framebuffer.dirty_cbufs |=
 			((1 << sctx->framebuffer.state.nr_cbufs) - 1);
 		sctx->framebuffer.dirty_zsbuf = true;
 		si_mark_atom_dirty(sctx, &sctx->framebuffer.atom);
 	}
 
 	/* Invalidate & recompute texture descriptors if needed. */
 	dirty_tex_counter = p_atomic_read(&sctx->b.screen->dirty_tex_descriptor_counter);
-	if (dirty_tex_counter != sctx->b.last_dirty_tex_descriptor_counter) {
+	if (unlikely(dirty_tex_counter != sctx->b.last_dirty_tex_descriptor_counter)) {
 		sctx->b.last_dirty_tex_descriptor_counter = dirty_tex_counter;
 		si_update_all_texture_descriptors(sctx);
 	}
 
 	si_decompress_graphics_textures(sctx);
 
 	/* Set the rasterization primitive type.
 	 *
 	 * This must be done after si_decompress_textures, which can call
 	 * draw_vbo recursively, and before si_update_shaders, which uses
-- 
2.7.4



More information about the mesa-dev mailing list