Mesa (master): i965: Use the upload BO for push constants on Gen7.5-Gen8.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat May 20 07:23:46 UTC 2017


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu May 11 22:23:14 2017 -0700

i965: Use the upload BO for push constants on Gen7.5-Gen8.

We can easily use the upload BO for push constants on Gen7.5/Gen8 too,
at the cost of a relocation when emitting 3DSTATE_CONSTANT_XS.  We can
simply switch to using constant buffer pointer 2 instead of pointer 0,
like we do on Gen9+.

Ivybridge and Baytrail can't do this trick because they require the
constant buffers to be enabled in order, starting with 0.  We'd have
to set the INSTPM bit to make the constant buffer pointer not relative
to dynamic state base address, which would need kernel command parser
support.

Improves performance in GLBenchmark 2.7/TRex Offscreen by:
- Broadwell GT2: 0.305608% +/- 0.19877% (n = 68)
- Braswell: No difference proven (n = 742)
- Haswell GT3e: 0.180755% +/- 0.0237505% (n = 30)

Reviewed-by: Chris Forbes <chrisforbes at google.com>

---

 src/mesa/drivers/dri/i965/gen6_constant_state.c | 2 +-
 src/mesa/drivers/dri/i965/genX_state_upload.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c
index 749e77e958..f3927c5dba 100644
--- a/src/mesa/drivers/dri/i965/gen6_constant_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c
@@ -64,7 +64,7 @@ gen6_upload_push_constants(struct brw_context *brw,
       int i;
       const int size = prog_data->nr_params * sizeof(gl_constant_value);
       gl_constant_value *param;
-      if (brw->gen >= 9) {
+      if (brw->gen >= 8 || brw->is_haswell) {
          param = intel_upload_space(brw, size, 32, &brw->curbe.curbe_bo,
                                     &stage_state->push_const_offset);
       } else {
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index f7128ae896..5fad3b72e2 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -2597,7 +2597,7 @@ upload_constant_state(struct brw_context *brw,
    brw_batch_emit(brw, GENX(3DSTATE_CONSTANT_VS), pkt) {
       pkt._3DCommandSubOpcode = push_constant_opcodes[stage];
       if (active) {
-#if GEN_GEN >= 9
+#if GEN_GEN >= 8 || GEN_IS_HASWELL
          pkt.ConstantBody.ConstantBuffer2ReadLength =
             stage_state->push_const_size;
          pkt.ConstantBody.PointerToConstantBuffer2 =




More information about the mesa-commit mailing list