<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 23, 2016 at 9:00 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Aug 19, 2016 at 09:55:55AM -0700, Jason Ekstrand wrote:<br>
> ---<br>
> src/mesa/drivers/dri/i965/<wbr>blorp.c | 27 +--------------------------<br>
> src/mesa/drivers/dri/i965/<wbr>blorp.h | 4 ++++<br>
> src/mesa/drivers/dri/i965/<wbr>blorp_blit.c | 2 +-<br>
> src/mesa/drivers/dri/i965/<wbr>blorp_clear.c | 6 +++---<br>
> src/mesa/drivers/dri/i965/<wbr>blorp_priv.h | 21 ---------------------<br>
> src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 19 +++++++++++++++++++<br>
> src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c | 9 +++++++--<br>
> 7 files changed, 35 insertions(+), 53 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>blorp.c b/src/mesa/drivers/dri/i965/<wbr>blorp.c<br>
> index 0688f6b..df10e50 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>blorp.c<br>
> @@ -345,31 +345,6 @@ brw_blorp_compile_nir_shader(<wbr>struct brw_context *brw, struct nir_shader *nir,<br>
> }<br>
><br>
> void<br>
> -brw_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params)<br>
> -{<br>
> - switch (brw->gen) {<br>
> - case 6:<br>
> - gen6_blorp_exec(brw, params);<br>
> - break;<br>
> - case 7:<br>
> - if (brw->is_haswell)<br>
> - gen75_blorp_exec(brw, params);<br>
> - else<br>
> - gen7_blorp_exec(brw, params);<br>
> - break;<br>
> - case 8:<br>
> - gen8_blorp_exec(brw, params);<br>
> - break;<br>
> - case 9:<br>
> - gen9_blorp_exec(brw, params);<br>
> - break;<br>
> - default:<br>
> - /* BLORP is not supported before Gen6. */<br>
> - unreachable("not reached");<br>
> - }<br>
> -}<br>
> -<br>
> -void<br>
> blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,<br>
> unsigned level, unsigned layer, enum gen6_hiz_op op)<br>
> {<br>
> @@ -436,5 +411,5 @@ blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,<br>
> unreachable("not reached");<br>
> }<br>
><br>
> - brw_blorp_exec(brw, ¶ms);<br>
> + brw->blorp.exec(&brw->blorp, brw, ¶ms);<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>blorp.h b/src/mesa/drivers/dri/i965/<wbr>blorp.h<br>
> index a9ef754..671731e 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>blorp.h<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>blorp.h<br>
> @@ -39,6 +39,8 @@ struct hash_table;<br>
> extern "C" {<br>
> #endif<br>
><br>
> +struct brw_blorp_params;<br>
> +<br>
> struct blorp_context {<br>
> void *driver_ctx;<br>
><br>
> @@ -56,6 +58,8 @@ struct blorp_context {<br>
><br>
> uint32_t (*upload_shader)(struct blorp_context *,<br>
> const void *data, uint32_t size);<br>
> + void (*exec)(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> };<br>
><br>
> void blorp_init(struct blorp_context *blorp, void *driver_ctx,<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>blorp_blit.c b/src/mesa/drivers/dri/i965/<wbr>blorp_blit.c<br>
> index d01dfff..449e09d 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>blorp_blit.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>blorp_blit.c<br>
> @@ -1647,5 +1647,5 @@ brw_blorp_blit(struct brw_context *brw,<br>
> swizzle_to_scs(GET_SWZ(src_<wbr>swizzle, i));<br>
> }<br>
><br>
> - brw_blorp_exec(brw, ¶ms);<br>
> + brw->blorp.exec(&brw->blorp, brw, ¶ms);<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>blorp_clear.c b/src/mesa/drivers/dri/i965/<wbr>blorp_clear.c<br>
> index fb4d050..3b6d6d7 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>blorp_clear.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>blorp_clear.c<br>
> @@ -110,7 +110,7 @@ blorp_fast_clear(struct brw_context *brw, const struct brw_blorp_surf *surf,<br>
> brw_blorp_surface_info_init(<wbr>brw, ¶ms.dst, surf, level, layer,<br>
> surf->surf->format, true);<br>
><br>
> - brw_blorp_exec(brw, ¶ms);<br>
> + brw->blorp.exec(&brw->blorp, brw, ¶ms);<br>
> }<br>
><br>
><br>
> @@ -156,7 +156,7 @@ blorp_clear(struct brw_context *brw, const struct brw_blorp_surf *surf,<br>
> brw_blorp_surface_info_init(<wbr>brw, ¶ms.dst, surf, level, layer,<br>
> format, true);<br>
><br>
> - brw_blorp_exec(brw, ¶ms);<br>
> + brw->blorp.exec(&brw->blorp, brw, ¶ms);<br>
> }<br>
><br>
> void<br>
> @@ -186,5 +186,5 @@ brw_blorp_ccs_resolve(struct brw_context *brw, struct brw_blorp_surf *surf,<br>
><br>
> brw_blorp_params_get_clear_<wbr>kernel(brw, ¶ms, true);<br>
><br>
> - brw_blorp_exec(brw, ¶ms);<br>
> + brw->blorp.exec(&brw->blorp, brw, ¶ms);<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>blorp_priv.h b/src/mesa/drivers/dri/i965/<wbr>blorp_priv.h<br>
> index 9b987a8..c7a2a03 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>blorp_priv.h<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>blorp_priv.h<br>
> @@ -183,27 +183,6 @@ struct brw_blorp_params<br>
> void<br>
> brw_blorp_params_init(struct brw_blorp_params *params);<br>
><br>
> -void<br>
> -brw_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);<br>
> -<br>
> -void<br>
> -gen6_blorp_exec(struct brw_context *brw,<br>
> - const struct brw_blorp_params *params);<br>
> -<br>
> -void<br>
> -gen7_blorp_exec(struct brw_context *brw,<br>
> - const struct brw_blorp_params *params);<br>
> -<br>
> -void<br>
> -gen75_blorp_exec(struct brw_context *brw,<br>
> - const struct brw_blorp_params *params);<br>
> -<br>
> -void<br>
> -gen8_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);<br>
> -<br>
> -void<br>
> -gen9_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);<br>
> -<br>
> struct brw_blorp_blit_prog_key<br>
> {<br>
> /* Number of samples per pixel that have been configured in the surface<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> index 26bf1aa..e4898a3 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> @@ -58,6 +58,17 @@ brw_blorp_upload_shader(struct blorp_context *blorp,<br>
> return kernel;<br>
> }<br>
><br>
> +void gen6_blorp_exec(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +void gen7_blorp_exec(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +void gen75_blorp_exec(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +void gen8_blorp_exec(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +void gen9_blorp_exec(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +<br>
> void<br>
> brw_blorp_init(struct brw_context *brw)<br>
> {<br>
> @@ -68,21 +79,29 @@ brw_blorp_init(struct brw_context *brw)<br>
> brw->blorp.mocs.tex = 0;<br>
> brw->blorp.mocs.rb = 0;<br>
> brw->blorp.mocs.vb = 0;<br>
> + brw->blorp.exec = gen6_blorp_exec;<br>
> break;<br>
> case 7:<br>
> brw->blorp.mocs.tex = GEN7_MOCS_L3;<br>
> brw->blorp.mocs.rb = GEN7_MOCS_L3;<br>
> brw->blorp.mocs.vb = GEN7_MOCS_L3;<br>
> + if (brw->is_haswell) {<br>
> + brw->blorp.exec = gen75_blorp_exec;<br>
> + } else {<br>
> + brw->blorp.exec = gen7_blorp_exec;<br>
> + }<br>
> break;<br>
> case 8:<br>
> brw->blorp.mocs.tex = BDW_MOCS_WB;<br>
> brw->blorp.mocs.rb = BDW_MOCS_PTE;<br>
> brw->blorp.mocs.vb = BDW_MOCS_WB;<br>
> + brw->blorp.exec = gen8_blorp_exec;<br>
> break;<br>
> case 9:<br>
> brw->blorp.mocs.tex = SKL_MOCS_WB;<br>
> brw->blorp.mocs.rb = SKL_MOCS_PTE;<br>
> brw->blorp.mocs.vb = SKL_MOCS_WB;<br>
> + brw->blorp.exec = gen9_blorp_exec;<br>
> break;<br>
> default:<br>
> unreachable("Invalid gen");<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c b/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> index 9ba1f8a..7390a1d 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> @@ -166,10 +166,15 @@ blorp_emit_3dstate_<wbr>multisample(struct blorp_context *blorp, void *batch,<br>
> #endif<br>
> }<br>
><br>
> +void genX(blorp_exec)(struct blorp_context *blorp, void *batch,<br>
> + const struct brw_blorp_params *params);<br>
> +<br>
<br>
</div></div>Separate prototype looks unnecessary, otherwise:<br></blockquote><div><br></div><div>I've fixed that by moving the prototypes to brw_blorp.h<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
<span class=""><br>
> void<br>
> -genX(blorp_exec)(struct brw_context *brw,<br>
> +genX(blorp_exec)(struct blorp_context *blorp, void *batch,<br>
> const struct brw_blorp_params *params)<br>
> {<br>
> + assert(blorp->driver_ctx == batch);<br>
> + struct brw_context *brw = batch;<br>
> struct gl_context *ctx = &brw->ctx;<br>
> const uint32_t estimated_max_batch_usage = GEN_GEN >= 8 ? 1800 : 1500;<br>
> bool check_aperture_failed_once = false;<br>
> @@ -208,7 +213,7 @@ retry:<br>
><br>
> brw_emit_depth_stall_flushes(<wbr>brw);<br>
><br>
> - blorp_exec(&brw->blorp, brw, params);<br>
> + blorp_exec(blorp, batch, params);<br>
><br>
> /* Make sure we didn't wrap the batch unintentionally, and make sure we<br>
> * reserved enough space that a wrap will never happen.<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>