From 4c27cb031ca766af259a6f95f6e5fb1f77e4041b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 1 Sep 2018 00:58:29 -0700 Subject: [PATCH] iris: skip over whole function if dirty == 0 kinda pointless in non-pathological cases, but does boost our score in the drawarrays case by 50%... --- src/gallium/drivers/iris/iris_state.c | 59 ++++++++++++++++----------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index b6a409fe3b3..abe4c442089 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3251,12 +3251,15 @@ iris_restore_context_saved_bos(struct iris_context *ice, } static void -iris_upload_render_state(struct iris_context *ice, - struct iris_batch *batch, - const struct pipe_draw_info *draw) +iris_upload_dirty_render_state(struct iris_context *ice, + struct iris_batch *batch, + const struct pipe_draw_info *draw) { const uint64_t dirty = ice->state.dirty; + if (!dirty) + return; + struct iris_genx_state *genx = ice->state.genx; struct brw_wm_prog_data *wm_prog_data = (void *) ice->shaders.prog[MESA_SHADER_FRAGMENT]->prog_data; @@ -3645,27 +3648,6 @@ iris_upload_render_state(struct iris_context *ice, } } - if (draw->index_size > 0) { - struct iris_resource *res = NULL; - unsigned offset; - - if (draw->has_user_indices) { - u_upload_data(ice->ctx.stream_uploader, 0, - draw->count * draw->index_size, 4, draw->index.user, - &offset, (struct pipe_resource **) &res); - } else { - res = (struct iris_resource *) draw->index.resource; - offset = 0; - } - - iris_emit_cmd(batch, GENX(3DSTATE_INDEX_BUFFER), ib) { - ib.IndexFormat = draw->index_size >> 1; - ib.MOCS = MOCS_WB; - ib.BufferSize = res->bo->size; - ib.BufferStartingAddress = ro_bo(res->bo, offset); - } - } - if (dirty & IRIS_DIRTY_VERTEX_BUFFERS) { struct iris_vertex_buffer_state *cso = &ice->state.genx->vertex_buffers; const unsigned vb_dwords = GENX(VERTEX_BUFFER_STATE_length); @@ -3720,6 +3702,35 @@ iris_upload_render_state(struct iris_context *ice, } // XXX: Gen8 - PMA fix +} + +static void +iris_upload_render_state(struct iris_context *ice, + struct iris_batch *batch, + const struct pipe_draw_info *draw) +{ + iris_upload_dirty_render_state(ice, batch, draw); + + if (draw->index_size > 0) { + struct iris_resource *res = NULL; + unsigned offset; + + if (draw->has_user_indices) { + u_upload_data(ice->ctx.stream_uploader, 0, + draw->count * draw->index_size, 4, draw->index.user, + &offset, (struct pipe_resource **) &res); + } else { + res = (struct iris_resource *) draw->index.resource; + offset = 0; + } + + iris_emit_cmd(batch, GENX(3DSTATE_INDEX_BUFFER), ib) { + ib.IndexFormat = draw->index_size >> 1; + ib.MOCS = MOCS_WB; + ib.BufferSize = res->bo->size; + ib.BufferStartingAddress = ro_bo(res->bo, offset); + } + } #define _3DPRIM_END_OFFSET 0x2420 #define _3DPRIM_START_VERTEX 0x2430 -- 2.30.2