[Mesa-dev] [PATCH 28/32] i965/blorp: Add a helper for emitting surface states
Pohjolainen, Topi
topi.pohjolainen at intel.com
Thu Aug 18 14:18:54 UTC 2016
On Thu, Aug 11, 2016 at 02:15:25PM -0700, Jason Ekstrand wrote:
> The new helper emits surface states and the binding table in one go. It's
> nice to have it pulled out of the main blorp_exec function.
> ---
> src/mesa/drivers/dri/i965/genX_blorp_exec.c | 52 ++++++++++++++++-------------
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> 1 file changed, 28 insertions(+), 24 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> index 156d8ac..922da45 100644
> --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> @@ -306,6 +306,32 @@ blorp_emit_depth_stencil_state(struct brw_context *brw,
> }
>
> static void
> +blorp_emit_surface_states(struct brw_context *brw,
> + const struct brw_blorp_params *params)
> +{
> + uint32_t bind_offset;
> + uint32_t *bind =
> + brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
> + sizeof(uint32_t) * BRW_BLORP_NUM_BINDING_TABLE_ENTRIES,
> + 32, /* alignment */ &bind_offset);
> +
> + bind[BRW_BLORP_RENDERBUFFER_BINDING_TABLE_INDEX] =
> + brw_blorp_emit_surface_state(brw, ¶ms->dst,
> + I915_GEM_DOMAIN_RENDER,
> + I915_GEM_DOMAIN_RENDER, true);
> + if (params->src.bo) {
> + bind[BRW_BLORP_TEXTURE_BINDING_TABLE_INDEX] =
> + brw_blorp_emit_surface_state(brw, ¶ms->src,
> + I915_GEM_DOMAIN_SAMPLER, 0, false);
> + }
> +
> + blorp_emit(brw, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) {
> + bt.PSBindingTableChange = true;
> + bt.PointertoPSBindingTable = bind_offset;
> + }
> +}
> +
> +static void
> blorp_emit_sampler_state(struct brw_context *brw,
> const struct brw_blorp_params *params)
> {
> @@ -381,7 +407,6 @@ genX(blorp_exec)(struct brw_context *brw,
> uint32_t blend_state_offset = 0;
> uint32_t color_calc_state_offset = 0;
> uint32_t depth_stencil_state_offset;
> - uint32_t wm_bind_bo_offset = 0;
>
> /* Emit workaround flushes when we switch from drawing to blorping. */
> brw_emit_post_sync_nonzero_flush(brw);
> @@ -413,29 +438,8 @@ genX(blorp_exec)(struct brw_context *brw,
> blorp_emit(brw, GENX(3DSTATE_CONSTANT_GS), gs);
> blorp_emit(brw, GENX(3DSTATE_CONSTANT_PS), ps);
>
> - if (params->wm_prog_data) {
> - uint32_t wm_surf_offset_renderbuffer;
> - uint32_t wm_surf_offset_texture = 0;
> -
> - wm_surf_offset_renderbuffer =
> - brw_blorp_emit_surface_state(brw, ¶ms->dst,
> - I915_GEM_DOMAIN_RENDER,
> - I915_GEM_DOMAIN_RENDER, true);
> - if (params->src.bo) {
> - wm_surf_offset_texture =
> - brw_blorp_emit_surface_state(brw, ¶ms->src,
> - I915_GEM_DOMAIN_SAMPLER, 0, false);
> - }
> - wm_bind_bo_offset =
> - gen6_blorp_emit_binding_table(brw,
> - wm_surf_offset_renderbuffer,
> - wm_surf_offset_texture);
> -
> - blorp_emit(brw, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) {
> - bt.PSBindingTableChange = true;
> - bt.PointertoPSBindingTable = wm_bind_bo_offset;
> - }
> - }
> + if (params->wm_prog_data)
> + blorp_emit_surface_states(brw, params);
>
> if (params->src.bo)
> blorp_emit_sampler_state(brw, params);
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list