From f8c44e4ed7886a7c81cbe86521fa6728efd27f5c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 27 Aug 2019 11:32:24 -0700 Subject: [PATCH] iris: Skip allocating a null surface when there are 0 color regions. The compiler now sets the "Null Render Target" bit in the RT write extended message descriptor, causing it to write to an implicit null surface without us needing to set one up in the binding table. Together with the last patch, this improves performance in Car Chase on an Icelake 8x8 (locked to 700Mhz) by 0.0445526% +/- 0.0132736% (n=832). Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gallium/drivers/iris/iris_program.c | 9 ++++++++- src/gallium/drivers/iris/iris_state.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 9eb7a47e1f1..50ea72ab9ec 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1522,8 +1522,15 @@ iris_compile_fs(struct iris_context *ice, */ brw_nir_lower_fs_outputs(nir); + /* On Gen11+, shader RT write messages have a "Null Render Target" bit + * and do not need a binding table entry with a null surface. Earlier + * generations need an entry for a null surface. + */ + int null_rts = devinfo->gen < 11 ? 1 : 0; + struct iris_binding_table bt; - iris_setup_binding_table(devinfo, nir, &bt, MAX2(key->nr_color_regions, 1), + iris_setup_binding_table(devinfo, nir, &bt, + MAX2(key->nr_color_regions, null_rts), num_system_values, num_cbufs); brw_nir_analyze_ubo_ranges(compiler, nir, NULL, prog_data->ubo_ranges); diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 3fca191937d..d45b1736af3 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -4337,7 +4337,7 @@ iris_populate_binding_table(struct iris_context *ice, } push_bt_entry(addr); } - } else { + } else if (GEN_GEN < 11) { uint32_t addr = use_null_fb_surface(batch, ice); push_bt_entry(addr); } -- 2.30.2