<div dir="ltr">Hooray! \o/<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 23, 2016 at 12:17 PM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_blorp.c  | 17 ++---------<br>
 src/mesa/drivers/dri/i965/brw_blorp.h  | 15 ---------<br>
 src/mesa/drivers/dri/i965/gen6_blorp.c | 56 +---------------------------------<br>
 src/mesa/drivers/dri/i965/gen7_blorp.c | 41 +------------------------<br>
 src/mesa/drivers/dri/i965/gen8_blorp.c | 28 +++++------------<br>
 5 files changed, 12 insertions(+), 145 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
index 4d6c0ba..04c10b6 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
@@ -187,17 +187,8 @@ brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,<br>
    struct brw_wm_prog_data wm_prog_data;<br>
    memset(&wm_prog_data, 0, sizeof(wm_prog_data));<br>
<br>
-   /* We set up the params array but instead of making them point at actual<br>
-    * GL constant values, they just store an index.  This is just fine as the<br>
-    * backend compiler never looks at the contents of the pointers, it just<br>
-    * re-arranges them for us.<br>
-    */<br>
-   const union gl_constant_value *param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];<br>
-   for (unsigned i = 0; i < ARRAY_SIZE(param); i++)<br>
-      param[i] = (const union gl_constant_value *)(intptr_t)i;<br>
-<br>
-   wm_prog_data.base.nr_params = BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS;<br>
-   wm_prog_data.base.param = param;<br>
+   wm_prog_data.base.nr_params = 0;<br>
+   wm_prog_data.base.param = NULL;<br>
<br>
    /* BLORP always just uses the first two binding table entries */<br>
    wm_prog_data.binding_table.render_target_start = 0;<br>
@@ -235,9 +226,7 @@ brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,<br>
    prog_data->num_varying_inputs = wm_prog_data.num_varying_inputs;<br>
    prog_data->inputs_read = nir->info.inputs_read;<br>
<br>
-   prog_data->nr_params = wm_prog_data.base.nr_params;<br>
-   for (unsigned i = 0; i < ARRAY_SIZE(param); i++)<br>
-      prog_data->param[i] = (uintptr_t)wm_prog_data.base.param[i];<br>
+   assert(wm_prog_data.base.nr_params == 0);<br>
<br>
    return program;<br>
 }<br>
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
index 91d111e..d3fc713 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
@@ -233,13 +233,6 @@ struct brw_blorp_wm_inputs<br>
    uint32_t pad[7];<br>
 };<br>
<br>
-#define BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS \<br>
-   (sizeof(struct brw_blorp_wm_inputs) / 4)<br>
-<br>
-/* Every 32 bytes of push constant data constitutes one GEN register. */<br>
-static const unsigned int BRW_BLORP_NUM_PUSH_CONST_REGS =<br>
-   sizeof(struct brw_blorp_wm_inputs) / 32;<br>
-<br>
 struct brw_blorp_prog_data<br>
 {<br>
    bool dispatch_8;<br>
@@ -263,14 +256,6 @@ struct brw_blorp_prog_data<br>
    uint32_t flat_inputs;<br>
    unsigned num_varying_inputs;<br>
    GLbitfield64 inputs_read;<br>
-<br>
-   /* The compiler will re-arrange push constants and store the upload order<br>
-    * here. Given an index 'i' in the final upload buffer, param[i] gives the<br>
-    * index in the uniform store. In other words, the value to be uploaded can<br>
-    * be found by brw_blorp_params::wm_push_consts[param[i]].<br>
-    */<br>
-   uint8_t nr_params;<br>
-   uint8_t param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];<br>
 };<br>
<br>
 inline unsigned<br>
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
index 8b6b8f9..c38952e 100644<br>
--- a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
@@ -350,26 +350,6 @@ gen6_blorp_emit_cc_state_pointers(struct brw_context *brw,<br>
    ADVANCE_BATCH();<br>
 }<br>
<br>
-<br>
-/* WM push constants */<br>
-uint32_t<br>
-gen6_blorp_emit_wm_constants(struct brw_context *brw,<br>
-                             const struct brw_blorp_params *params)<br>
-{<br>
-   uint32_t wm_push_const_offset;<br>
-<br>
-   uint32_t *constants = brw_state_batch(brw, AUB_TRACE_WM_CONSTANTS,<br>
-                                         sizeof(params->wm_inputs),<br>
-                                         32, &wm_push_const_offset);<br>
-<br>
-   const uint32_t *push_consts = (const uint32_t *)&params->wm_inputs;<br>
-   for (unsigned i = 0; i < params->wm_prog_data->nr_params; i++)<br>
-      constants[i] = push_consts[params->wm_prog_data->param[i]];<br>
-<br>
-   return wm_push_const_offset;<br>
-}<br>
-<br>
-<br>
 /* SURFACE_STATE for renderbuffer or texture surface (see<br>
  * brw_update_renderbuffer_surface and brw_update_texture_surface)<br>
  */<br>
@@ -755,32 +735,6 @@ gen6_blorp_emit_wm_config(struct brw_context *brw,<br>
    ADVANCE_BATCH();<br>
 }<br>
<br>
-<br>
-static void<br>
-gen6_blorp_emit_constant_ps(struct brw_context *brw,<br>
-                            const struct brw_blorp_params *params,<br>
-                            uint32_t wm_push_const_offset)<br>
-{<br>
-   /* Make sure the push constants fill an exact integer number of<br>
-    * registers.<br>
-    */<br>
-   STATIC_ASSERT(sizeof(struct brw_blorp_wm_inputs) % 32 == 0);<br>
-<br>
-   /* There must be at least one register worth of push constant data. */<br>
-   assert(BRW_BLORP_NUM_PUSH_CONST_REGS > 0);<br>
-<br>
-   /* Enable push constant buffer 0. */<br>
-   BEGIN_BATCH(5);<br>
-   OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 |<br>
-             GEN6_CONSTANT_BUFFER_0_ENABLE |<br>
-             (5 - 2));<br>
-   OUT_BATCH(wm_push_const_offset + (BRW_BLORP_NUM_PUSH_CONST_REGS - 1));<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(0);<br>
-   ADVANCE_BATCH();<br>
-}<br>
-<br>
 static void<br>
 gen6_blorp_emit_constant_ps_disable(struct brw_context *brw,<br>
                                     const struct brw_blorp_params *params)<br>
@@ -1050,7 +1004,6 @@ gen6_blorp_exec(struct brw_context *brw,<br>
    uint32_t cc_blend_state_offset = 0;<br>
    uint32_t cc_state_offset = 0;<br>
    uint32_t depthstencil_offset;<br>
-   uint32_t wm_push_const_offset = 0;<br>
    uint32_t wm_bind_bo_offset = 0;<br>
<br>
    /* Emit workaround flushes when we switch from drawing to blorping. */<br>
@@ -1075,10 +1028,6 @@ gen6_blorp_exec(struct brw_context *brw,<br>
       uint32_t wm_surf_offset_renderbuffer;<br>
       uint32_t wm_surf_offset_texture = 0;<br>
<br>
-      if (params->wm_prog_data->nr_params) {<br>
-         wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, params);<br>
-      }<br>
-<br>
       intel_miptree_used_for_rendering(params-><a href="http://dst.mt" rel="noreferrer" target="_blank">dst.mt</a>);<br>
       wm_surf_offset_renderbuffer =<br>
          gen6_blorp_emit_surface_state(brw, params, &params->dst,<br>
@@ -1104,10 +1053,7 @@ gen6_blorp_exec(struct brw_context *brw,<br>
    gen6_blorp_emit_gs_disable(brw, params);<br>
    gen6_blorp_emit_clip_disable(brw);<br>
    gen6_blorp_emit_sf_config(brw, params);<br>
-   if (params->wm_prog_data && params->wm_prog_data->nr_params)<br>
-      gen6_blorp_emit_constant_ps(brw, params, wm_push_const_offset);<br>
-   else<br>
-      gen6_blorp_emit_constant_ps_disable(brw, params);<br>
+   gen6_blorp_emit_constant_ps_disable(brw, params);<br>
    gen6_blorp_emit_wm_config(brw, params);<br>
    if (params->wm_prog_data)<br>
       gen6_blorp_emit_binding_table_pointers(brw, wm_bind_bo_offset);<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.c b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
index 4215775..b71224a 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
@@ -552,9 +552,6 @@ gen7_blorp_emit_ps_config(struct brw_context *brw,<br>
    if (brw->is_haswell)<br>
       dw4 |= SET_FIELD(1, HSW_PS_SAMPLE_MASK); /* 1 sample for now */<br>
    if (params->wm_prog_data) {<br>
-      if (params->wm_prog_data->nr_params)<br>
-         dw4 |= GEN7_PS_PUSH_CONSTANT_ENABLE;<br>
-<br>
       dw5 |= prog_data->first_curbe_grf_0 << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
       dw5 |= prog_data->first_curbe_grf_2 << GEN7_PS_DISPATCH_START_GRF_SHIFT_2;<br>
<br>
@@ -613,34 +610,6 @@ gen7_blorp_emit_sampler_state_pointers_ps(struct brw_context *brw,<br>
    ADVANCE_BATCH();<br>
 }<br>
<br>
-<br>
-void<br>
-gen7_blorp_emit_constant_ps(struct brw_context *brw,<br>
-                            uint32_t wm_push_const_offset)<br>
-{<br>
-   const uint8_t mocs = GEN7_MOCS_L3;<br>
-<br>
-   /* Make sure the push constants fill an exact integer number of<br>
-    * registers.<br>
-    */<br>
-   STATIC_ASSERT(sizeof(struct brw_blorp_wm_inputs) % 32 == 0);<br>
-<br>
-   /* There must be at least one register worth of push constant data. */<br>
-   assert(BRW_BLORP_NUM_PUSH_CONST_REGS > 0);<br>
-<br>
-   /* Enable push constant buffer 0. */<br>
-   BEGIN_BATCH(7);<br>
-   OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 |<br>
-             (7 - 2));<br>
-   OUT_BATCH(BRW_BLORP_NUM_PUSH_CONST_REGS);<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(wm_push_const_offset | mocs);<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(0);<br>
-   ADVANCE_BATCH();<br>
-}<br>
-<br>
 void<br>
 gen7_blorp_emit_constant_ps_disable(struct brw_context *brw)<br>
 {<br>
@@ -833,7 +802,6 @@ gen7_blorp_exec(struct brw_context *brw,<br>
    uint32_t cc_blend_state_offset = 0;<br>
    uint32_t cc_state_offset = 0;<br>
    uint32_t depthstencil_offset;<br>
-   uint32_t wm_push_const_offset = 0;<br>
    uint32_t wm_bind_bo_offset = 0;<br>
<br>
    brw_upload_state_base_address(brw);<br>
@@ -858,10 +826,6 @@ gen7_blorp_exec(struct brw_context *brw,<br>
       uint32_t wm_surf_offset_renderbuffer;<br>
       uint32_t wm_surf_offset_texture = 0;<br>
<br>
-      if (params->wm_prog_data->nr_params) {<br>
-          wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, params);<br>
-      }<br>
-<br>
       intel_miptree_used_for_rendering(params-><a href="http://dst.mt" rel="noreferrer" target="_blank">dst.mt</a>);<br>
       wm_surf_offset_renderbuffer =<br>
          gen7_blorp_emit_surface_state(brw, &params->dst,<br>
@@ -891,10 +855,7 @@ gen7_blorp_exec(struct brw_context *brw,<br>
    if (params->wm_prog_data)<br>
       gen7_blorp_emit_binding_table_pointers_ps(brw, wm_bind_bo_offset);<br>
<br>
-   if (params->wm_prog_data && params->wm_prog_data->nr_params)<br>
-      gen7_blorp_emit_constant_ps(brw, wm_push_const_offset);<br>
-   else<br>
-      gen7_blorp_emit_constant_ps_disable(brw);<br>
+   gen7_blorp_emit_constant_ps_disable(brw);<br>
<br>
    if (params-><a href="http://src.mt" rel="noreferrer" target="_blank">src.mt</a>) {<br>
       const uint32_t sampler_offset =<br>
diff --git a/src/mesa/drivers/dri/i965/gen8_blorp.c b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
index 553c637..a3216f5 100644<br>
--- a/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
@@ -402,9 +402,6 @@ gen8_blorp_emit_ps_config(struct brw_context *brw,<br>
       dw3 |= 1 << GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT; /* One surface */<br>
    }<br>
<br>
-   if (prog_data->nr_params)<br>
-      dw6 |= GEN7_PS_PUSH_CONSTANT_ENABLE;<br>
-<br>
    dw7 |= prog_data->first_curbe_grf_0 << GEN7_PS_DISPATCH_START_GRF_SHIFT_0;<br>
    dw7 |= prog_data->first_curbe_grf_2 << GEN7_PS_DISPATCH_START_GRF_SHIFT_2;<br>
<br>
@@ -577,9 +574,7 @@ gen8_blorp_emit_depth_stencil_state(struct brw_context *brw,<br>
 }<br>
<br>
 static void<br>
-gen8_blorp_emit_constant_ps(struct brw_context *brw,<br>
-                            const struct brw_blorp_params *params,<br>
-                            uint32_t wm_push_const_offset)<br>
+gen8_blorp_emit_disable_constant_ps(struct brw_context *brw)<br>
 {<br>
    const int dwords = brw->gen >= 8 ? 11 : 7;<br>
    BEGIN_BATCH(dwords);<br>
@@ -587,9 +582,9 @@ gen8_blorp_emit_constant_ps(struct brw_context *brw,<br>
<br>
    if (brw->gen >= 9) {<br>
       OUT_BATCH(0);<br>
-      OUT_BATCH(params->wm_prog_data->nr_params);<br>
+      OUT_BATCH(0);<br>
    } else {<br>
-      OUT_BATCH(params->wm_prog_data->nr_params);<br>
+      OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
    }<br>
<br>
@@ -598,19 +593,12 @@ gen8_blorp_emit_constant_ps(struct brw_context *brw,<br>
       OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
-<br>
-      if (params->wm_prog_data->nr_params) {<br>
-         OUT_RELOC64(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">batch.bo</a>, I915_GEM_DOMAIN_RENDER, 0,<br>
-                     wm_push_const_offset);<br>
-      } else {<br>
-         OUT_BATCH(0);<br>
-         OUT_BATCH(0);<br>
-      }<br>
-<br>
+      OUT_BATCH(0);<br>
+      OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
    } else {<br>
-      OUT_BATCH(wm_push_const_offset);<br>
+      OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
       OUT_BATCH(0);<br>
@@ -704,9 +692,7 @@ gen8_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params)<br>
    gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_DS);<br>
    gen8_blorp_emit_disable_constant_state(brw, _3DSTATE_CONSTANT_GS);<br>
<br>
-   const uint32_t wm_push_const_offset = params->wm_prog_data->nr_params ?<br>
-      gen6_blorp_emit_wm_constants(brw, params) : 0;<br>
-   gen8_blorp_emit_constant_ps(brw, params, wm_push_const_offset);<br>
+   gen8_blorp_emit_disable_constant_ps(brw);<br>
    wm_bind_bo_offset = gen8_blorp_emit_surface_states(brw, params);<br>
<br>
    gen8_blorp_emit_disable_binding_table(brw,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>