<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 27, 2018 at 4:37 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 Thu, Mar 08, 2018 at 08:49:06AM -0800, Rafael Antognolli wrote:<br>
> On Gen10, when emitting the surface state, use the value stored in the<br>
> clear color entry buffer by using a clear color address in the surface<br>
> state.<br>
><br>
> v4: Use the clear color offset from the clear_color_bo, when available.<br>
><br>
> Signed-off-by: Rafael Antognolli <<a href="mailto:rafael.antognolli@intel.com">rafael.antognolli@intel.com</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 29 +++++++++++++++++++++++-<br>
> 1 file changed, 28 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
> index caa92d7d878..268effef397 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
> @@ -152,7 +152,7 @@ brw_emit_surface_state(struct brw_context *brw,<br>
><br>
> union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } };<br>
><br>
> - struct brw_bo *aux_bo;<br>
> + struct brw_bo *aux_bo = NULL;<br>
> struct isl_surf *aux_surf = NULL;<br>
> uint64_t aux_offset = 0;<br>
> switch (aux_usage) {<br>
> @@ -186,6 +186,20 @@ brw_emit_surface_state(struct brw_context *brw,<br>
> brw->isl_dev.ss.align,<br>
> surf_offset);<br>
><br>
> + bool use_clear_address = devinfo->gen >= 10 && aux_surf;<br>
> +<br>
> + struct brw_bo *clear_bo = NULL;<br>
> + uint32_t clear_offset = 0;<br>
> + if (use_clear_address) {<br>
> + if (mt->mcs_buf && mt->mcs_buf->clear_color_bo) {<br>
> + clear_bo = mt->mcs_buf->clear_color_bo;<br>
> + clear_offset = mt->mcs_buf->clear_color_<wbr>offset;<br>
<br>
</div></div>In case of "mt->mcs_buf" holding the clear value one needs to use<br>
"mt->mcs_buf->clear_color_<wbr>offset" instead of "aux_surf->size" as that<br>
includes the space reserved for clear value and hence points past it<br>
(aux_offset doesn't matter is it will be zero in that case):<br></blockquote><div><br></div><div>I'm pretty sure the second case is now dead and should be deleted.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
} else if (mt->mcs_buf) {<br>
clear_bo = aux_bo;<br>
<div class="HOEnZb"><div class="h5"> clear_offset = mt->mcs_buf->clear_color_<wbr>offset;<br>
<br>
> + } else {<br>
> + clear_bo = aux_bo;<br>
> + clear_offset = aux_offset + aux_surf->size;<br>
> + }<br>
> + }<br>
> +<br>
> isl_surf_fill_state(&brw->isl_<wbr>dev, state, .surf = &surf, .view = &view,<br>
> .address = brw_state_reloc(&brw->batch,<br>
> *surf_offset + brw->isl_dev.ss.addr_offset,<br>
> @@ -194,6 +208,8 @@ brw_emit_surface_state(struct brw_context *brw,<br>
> .aux_address = aux_offset,<br>
> .mocs = brw_get_bo_mocs(devinfo, mt->bo),<br>
> .clear_color = clear_color,<br>
> + .use_clear_address = use_clear_address,<br>
> + .clear_address = clear_offset,<br>
> .x_offset_sa = tile_x, .y_offset_sa = tile_y);<br>
> if (aux_surf) {<br>
> /* On gen7 and prior, the upper 20 bits of surface state DWORD 6 are the<br>
> @@ -223,6 +239,17 @@ brw_emit_surface_state(struct brw_context *brw,<br>
><br>
> }<br>
> }<br>
> +<br>
> + if (use_clear_address) {<br>
> + /* Make sure the offset is aligned with a cacheline. */<br>
> + assert((clear_offset & 0x3f) == 0);<br>
> + uint32_t *clear_address =<br>
> + state + brw->isl_dev.ss.clear_color_<wbr>state_offset;<br>
> + *clear_address = brw_state_reloc(&brw->batch,<br>
> + *surf_offset +<br>
> + brw->isl_dev.ss.clear_color_<wbr>state_offset,<br>
> + clear_bo, *clear_address, reloc_flags);<br>
> + }<br>
> }<br>
><br>
> static uint32_t<br>
> --<br>
> 2.14.3<br>
><br>
> ______________________________<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>
______________________________<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>
</div></div></blockquote></div><br></div></div>