<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 5:24 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We're about to start calling it directly, and this means the callers<br>
won't have to think about generations.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/dri/i965/Makefile.sources   |  1 -<br>
 src/mesa/drivers/dri/i965/brw_misc_state.c   | 46 ++++++++++++++--<br>
 src/mesa/drivers/dri/i965/brw_state.h        |  7 +--<br>
 src/mesa/drivers/dri/i965/brw_state_upload.c |  4 +-<br>
 src/mesa/drivers/dri/i965/gen6_blorp.c       |  2 +-<br>
 src/mesa/drivers/dri/i965/gen7_blorp.c       |  2 +-<br>
 src/mesa/drivers/dri/i965/gen8_blorp.c       |  4 +-<br>
 src/mesa/drivers/dri/i965/gen8_misc_state.c  | 82 ----------------------------<br>
 8 files changed, 51 insertions(+), 97 deletions(-)<br>
 delete mode 100644 src/mesa/drivers/dri/i965/gen8_misc_state.c<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources<br>
index 441d727..745a27f 100644<br>
--- a/src/mesa/drivers/dri/i965/Makefile.sources<br>
+++ b/src/mesa/drivers/dri/i965/Makefile.sources<br>
@@ -218,7 +218,6 @@ i965_FILES = \<br>
        gen8_ds_state.c \<br>
        gen8_gs_state.c \<br>
        gen8_hs_state.c \<br>
-       gen8_misc_state.c \<br>
        gen8_multisample_state.c \<br>
        gen8_ps_state.c \<br>
        gen8_sf_state.c \<br>
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c<br>
index 71a7fdd..c7fccfa 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c<br>
@@ -1067,8 +1067,8 @@ const struct brw_tracked_state brw_invariant_state = {<br>
  * surface state objects, but not the surfaces that the surface state<br>
  * objects point to.<br>
  */<br>
-static void<br>
-upload_state_base_address(struct brw_context *brw)<br>
+void<br>
+brw_upload_state_base_address(struct brw_context *brw)<br>
 {<br>
    /* FINISHME: According to section 3.6.1 "STATE_BASE_ADDRESS" of<br>
     * vol1a of the G45 PRM, MI_FLUSH with the ISC invalidate should be<br>
@@ -1079,7 +1079,45 @@ upload_state_base_address(struct brw_context *brw)<br>
     * maybe this isn't required for us in particular.<br>
     */<br>
<br>
-   if (brw->gen >= 6) {<br>
+   if (brw->gen >= 8) {<br>
+      uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;<br>
+      int pkt_len = brw->gen >= 9 ? 19 : 16;<br>
+<br>
+      BEGIN_BATCH(pkt_len);<br>
+      OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (pkt_len - 2));<br>
+      /* General state base address: stateless DP read/write requests */<br>
+      OUT_BATCH(mocs_wb << 4 | 1);<br>
+      OUT_BATCH(0);<br>
+      OUT_BATCH(mocs_wb << 16);<br>
+      /* Surface state base address: */<br>
+      OUT_RELOC64(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">batch.bo</a>, I915_GEM_DOMAIN_SAMPLER, 0,<br>
+                  mocs_wb << 4 | 1);<br>
+      /* Dynamic state base address: */<br>
+      OUT_RELOC64(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">batch.bo</a>,<br>
+                  I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION, 0,<br>
+                  mocs_wb << 4 | 1);<br>
+      /* Indirect object base address: MEDIA_OBJECT data */<br>
+      OUT_BATCH(mocs_wb << 4 | 1);<br>
+      OUT_BATCH(0);<br>
+      /* Instruction base address: shader kernels (incl. SIP) */<br>
+      OUT_RELOC64(brw-><a href="http://cache.bo" rel="noreferrer" target="_blank">cache.bo</a>, I915_GEM_DOMAIN_INSTRUCTION, 0,<br>
+                  mocs_wb << 4 | 1);<br>
+<br>
+      /* General state buffer size */<br>
+      OUT_BATCH(0xfffff001);<br>
+      /* Dynamic state buffer size */<br>
+      OUT_BATCH(ALIGN(brw->batch.bo->size, 4096) | 1);<br>
+      /* Indirect object upper bound */<br>
+      OUT_BATCH(0xfffff001);<br>
+      /* Instruction access upper bound */<br>
+      OUT_BATCH(ALIGN(brw->cache.bo->size, 4096) | 1);<br>
+      if (brw->gen >= 9) {<br>
+         OUT_BATCH(1);<br>
+         OUT_BATCH(0);<br>
+         OUT_BATCH(0);<br>
+      }<br>
+      ADVANCE_BATCH();<br></blockquote><div><br></div><div>I'm going to tacitly assume that you just copied-and-pasted and that you did so correctly. :-)<br><br></div><div>You already answered all my questions or IRC.  Series is<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   } else if (brw->gen >= 6) {<br>
       uint8_t mocs = brw->gen == 7 ? GEN7_MOCS_L3 : 0;<br>
<br>
        BEGIN_BATCH(10);<br>
@@ -1175,5 +1213,5 @@ const struct brw_tracked_state brw_state_base_address = {<br>
       .brw = BRW_NEW_BATCH |<br>
              BRW_NEW_PROGRAM_CACHE,<br>
    },<br>
-   .emit = upload_state_base_address<br>
+   .emit = brw_upload_state_base_address<br>
 };<br>
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h<br>
index edb7353..d704029 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_state.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_state.h<br>
@@ -167,7 +167,6 @@ extern const struct brw_tracked_state gen8_wm_state;<br>
 extern const struct brw_tracked_state gen8_raster_state;<br>
 extern const struct brw_tracked_state gen8_sbe_state;<br>
 extern const struct brw_tracked_state gen8_sf_state;<br>
-extern const struct brw_tracked_state gen8_state_base_address;<br>
 extern const struct brw_tracked_state gen8_sol_state;<br>
 extern const struct brw_tracked_state gen8_sf_clip_viewport;<br>
 extern const struct brw_tracked_state gen8_vertices;<br>
@@ -194,13 +193,13 @@ void brw_upload_invariant_state(struct brw_context *brw);<br>
 uint32_t<br>
 brw_depthbuffer_format(struct brw_context *brw);<br>
<br>
+void brw_upload_state_base_address(struct brw_context *brw);<br>
+<br>
+<br>
 /* gen8_depth_state.c */<br>
 void gen8_write_pma_stall_bits(struct brw_context *brw,<br>
                                uint32_t pma_stall_bits);<br>
<br>
-/* gen8_misc_state.c */<br>
-void gen8_upload_state_base_address(struct brw_context *brw);<br>
-<br>
 /***********************************************************************<br>
  * brw_state.c<br>
  */<br>
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c<br>
index a70b246..ed92a85 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c<br>
@@ -284,7 +284,7 @@ static const struct brw_tracked_state *gen7_compute_atoms[] =<br>
 static const struct brw_tracked_state *gen8_render_atoms[] =<br>
 {<br>
    /* Command packets: */<br>
-   &gen8_state_base_address,<br>
+   &brw_state_base_address,<br>
<br>
    &brw_cc_vp,<br>
    &gen8_sf_clip_viewport,<br>
@@ -383,7 +383,7 @@ static const struct brw_tracked_state *gen8_render_atoms[] =<br>
<br>
 static const struct brw_tracked_state *gen8_compute_atoms[] =<br>
 {<br>
-   &gen8_state_base_address,<br>
+   &brw_state_base_address,<br>
    &gen7_l3_state,<br>
    &brw_cs_image_surfaces,<br>
    &gen7_cs_push_constants,<br>
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
index 1955811..f3ac35b 100644<br>
--- a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
@@ -986,7 +986,7 @@ gen6_blorp_exec(struct brw_context *brw,<br>
    brw_emit_post_sync_nonzero_flush(brw);<br>
<br>
    if (brw_state_base_address.dirty.brw & brw->ctx.NewDriverState)<br>
-      brw_state_base_address.emit(brw);<br>
+      brw_upload_state_base_address(brw);<br>
<br>
    gen6_emit_3dstate_multisample(brw, params->dst.num_samples);<br>
    gen6_emit_3dstate_sample_mask(brw,<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.c b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
index e2e6072..93028ff 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.c<br>
@@ -811,7 +811,7 @@ gen7_blorp_exec(struct brw_context *brw,<br>
    uint32_t wm_bind_bo_offset = 0;<br>
<br>
    if (brw_state_base_address.dirty.brw & brw->ctx.NewDriverState)<br>
-      brw_state_base_address.emit(brw);<br>
+      brw_upload_state_base_address(brw);<br>
<br>
    gen6_emit_3dstate_multisample(brw, params->dst.num_samples);<br>
    gen6_emit_3dstate_sample_mask(brw,<br>
diff --git a/src/mesa/drivers/dri/i965/gen8_blorp.c b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
index 5cd070f..4baa4bb 100644<br>
--- a/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/gen8_blorp.c<br>
@@ -646,8 +646,8 @@ gen8_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params)<br>
 {<br>
    uint32_t wm_bind_bo_offset = 0;<br>
<br>
-   if (gen8_state_base_address.dirty.brw & brw->ctx.NewDriverState)<br>
-      gen8_upload_state_base_address(brw);<br>
+   if (brw_state_base_address.dirty.brw & brw->ctx.NewDriverState)<br>
+      brw_upload_state_base_address(brw);<br>
<br>
    gen7_blorp_emit_cc_viewport(brw);<br>
    gen7_l3_state.emit(brw);<br>
diff --git a/src/mesa/drivers/dri/i965/gen8_misc_state.c b/src/mesa/drivers/dri/i965/gen8_misc_state.c<br>
deleted file mode 100644<br>
index b20038e..0000000<br>
--- a/src/mesa/drivers/dri/i965/gen8_misc_state.c<br>
+++ /dev/null<br>
@@ -1,82 +0,0 @@<br>
-/*<br>
- * Copyright © 2012 Intel Corporation<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice (including the next<br>
- * paragraph) shall be included in all copies or substantial portions of the<br>
- * Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
- * IN THE SOFTWARE.<br>
- */<br>
-<br>
-#include "intel_batchbuffer.h"<br>
-#include "brw_context.h"<br>
-#include "brw_state.h"<br>
-#include "brw_defines.h"<br>
-<br>
-/**<br>
- * Define the base addresses which some state is referenced from.<br>
- */<br>
-void gen8_upload_state_base_address(struct brw_context *brw)<br>
-{<br>
-   uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;<br>
-   int pkt_len = brw->gen >= 9 ? 19 : 16;<br>
-<br>
-   BEGIN_BATCH(pkt_len);<br>
-   OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (pkt_len - 2));<br>
-   /* General state base address: stateless DP read/write requests */<br>
-   OUT_BATCH(mocs_wb << 4 | 1);<br>
-   OUT_BATCH(0);<br>
-   OUT_BATCH(mocs_wb << 16);<br>
-   /* Surface state base address: */<br>
-   OUT_RELOC64(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">batch.bo</a>, I915_GEM_DOMAIN_SAMPLER, 0,<br>
-               mocs_wb << 4 | 1);<br>
-   /* Dynamic state base address: */<br>
-   OUT_RELOC64(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">batch.bo</a>,<br>
-               I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION, 0,<br>
-               mocs_wb << 4 | 1);<br>
-   /* Indirect object base address: MEDIA_OBJECT data */<br>
-   OUT_BATCH(mocs_wb << 4 | 1);<br>
-   OUT_BATCH(0);<br>
-   /* Instruction base address: shader kernels (incl. SIP) */<br>
-   OUT_RELOC64(brw-><a href="http://cache.bo" rel="noreferrer" target="_blank">cache.bo</a>, I915_GEM_DOMAIN_INSTRUCTION, 0,<br>
-               mocs_wb << 4 | 1);<br>
-<br>
-   /* General state buffer size */<br>
-   OUT_BATCH(0xfffff001);<br>
-   /* Dynamic state buffer size */<br>
-   OUT_BATCH(ALIGN(brw->batch.bo->size, 4096) | 1);<br>
-   /* Indirect object upper bound */<br>
-   OUT_BATCH(0xfffff001);<br>
-   /* Instruction access upper bound */<br>
-   OUT_BATCH(ALIGN(brw->cache.bo->size, 4096) | 1);<br>
-   if (brw->gen >= 9) {<br>
-      OUT_BATCH(1);<br>
-      OUT_BATCH(0);<br>
-      OUT_BATCH(0);<br>
-   }<br>
-   ADVANCE_BATCH();<br>
-<br>
-   brw->ctx.NewDriverState |= BRW_NEW_STATE_BASE_ADDRESS;<br>
-}<br>
-<br>
-const struct brw_tracked_state gen8_state_base_address = {<br>
-   .dirty = {<br>
-      .mesa = 0,<br>
-      .brw = BRW_NEW_BATCH |<br>
-             BRW_NEW_PROGRAM_CACHE,<br>
-   },<br>
-   .emit = gen8_upload_state_base_address<br>
-};<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.8.0<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></div>