<div dir="ltr"><div>I think you want to say "clear_color_bo is non-NULL" in the commit message rather than talking about addresses. Otherwise, this looks like a very nice clean-up.<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 11, 2018 at 1:42 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We want to add and use a getter that turns off the indirect path by<br>
returning zero for the clear address.<br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 17 ++++++-----------<br>
1 file changed, 6 insertions(+), 11 deletions(-)<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 06f739faf61..3c70dbcc110 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>
@@ -155,6 +155,8 @@ brw_emit_surface_state(struct brw_context *brw,<br>
struct brw_bo *aux_bo = NULL;<br>
struct isl_surf *aux_surf = NULL;<br>
uint64_t aux_offset = 0;<br>
+ struct brw_bo *clear_bo = NULL;<br>
+ uint32_t clear_offset = 0;<br>
struct intel_miptree_aux_buffer *aux_buf = intel_miptree_get_aux_buffer(<wbr>mt);<br>
<br>
if (aux_usage != ISL_AUX_USAGE_NONE) {<br>
@@ -165,6 +167,8 @@ brw_emit_surface_state(struct brw_context *brw,<br>
/* We only really need a clear color if we also have an auxiliary<br>
* surface. Without one, it does nothing.<br>
*/<br>
+ clear_bo = aux_buf->clear_color_bo;<br>
+ clear_offset = aux_buf->clear_color_offset;<br>
clear_color = mt->fast_clear_color;<br>
}<br>
<br>
@@ -173,15 +177,6 @@ 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>
- clear_bo = aux_buf->clear_color_bo;<br>
- clear_offset = aux_buf->clear_color_offset;<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>
@@ -190,7 +185,7 @@ 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>
+ .use_clear_address = clear_bo != NULL,<br>
.clear_address = clear_offset,<br>
.x_offset_sa = tile_x, .y_offset_sa = tile_y);<br>
if (aux_surf) {<br>
@@ -222,7 +217,7 @@ brw_emit_surface_state(struct brw_context *brw,<br>
}<br>
}<br>
<br>
- if (use_clear_address) {<br>
+ if (clear_bo != NULL) {<br>
/* Make sure the offset is aligned with a cacheline. */<br>
assert((clear_offset & 0x3f) == 0);<br>
uint32_t *clear_address =<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.16.2<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>
</font></span></blockquote></div><br></div>