<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 29, 2018 at 10:58 AM, Rafael Antognolli <span dir="ltr"><<a href="mailto:rafael.antognolli@intel.com" target="_blank">rafael.antognolli@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In a follow up patch, we make use of clear_color_bo, which is in<br>
mt->mcs_buf or mt->hiz_buf. To avoid duplicating more code that does the<br>
same thing on both aux buffers, just use aux_buf already.<br>
<br>
v5: Add aux_buf to brw_wm_surface_state too.<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>blorp.c | 19 +++++++------------<br>
src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 15 ++++++++-------<br>
2 files changed, 15 insertions(+), 19 deletions(-)<br>
<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 44064fc0cf3..a0977598309 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -155,10 +155,13 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
};<br>
<br>
struct isl_surf *aux_surf = NULL;<br>
+ struct intel_miptree_aux_buffer *aux_buf = NULL;<br>
if (mt->mcs_buf)<br>
- aux_surf = &mt->mcs_buf->surf;<br>
+ aux_buf = mt->mcs_buf;<br>
else if (mt->hiz_buf)<br>
- aux_surf = &mt->hiz_buf->surf;<br>
+ aux_buf = mt->hiz_buf;<br>
+<br>
+ aux_surf = &aux_buf->surf;<br></blockquote><div><br></div><div>Let's just drop the aux_surf temporary. It's only used a few lines below to set surf->aux_surf and now that we have an aux_buf temporary, we can easily just do "surf->aux_surf = &aux_buf->surf". With that changed,<br><br>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
if (mt->format == MESA_FORMAT_S_UINT8 && is_render_target &&<br>
devinfo->gen <= 7)<br>
@@ -180,16 +183,8 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
.mocs = surf->addr.mocs,<br>
};<br>
<br>
- if (mt->mcs_buf) {<br>
- surf->aux_addr.buffer = mt->mcs_buf->bo;<br>
- surf->aux_addr.offset = mt->mcs_buf->offset;<br>
- } else {<br>
- assert(mt->hiz_buf);<br>
- assert(surf->aux_usage == ISL_AUX_USAGE_HIZ);<br>
-<br>
- surf->aux_addr.buffer = mt->hiz_buf->bo;<br>
- surf->aux_addr.offset = mt->hiz_buf->offset;<br>
- }<br>
+ surf->aux_addr.buffer = aux_buf->bo;<br>
+ surf->aux_addr.offset = aux_buf->offset;<br>
} else {<br>
surf->aux_addr = (struct blorp_address) {<br>
.buffer = NULL,<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..ea855916403 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,22 +152,19 @@ 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>
+ struct intel_miptree_aux_buffer *aux_buf = NULL;<br>
switch (aux_usage) {<br>
case ISL_AUX_USAGE_MCS:<br>
case ISL_AUX_USAGE_CCS_D:<br>
case ISL_AUX_USAGE_CCS_E:<br>
- aux_surf = &mt->mcs_buf->surf;<br>
- aux_bo = mt->mcs_buf->bo;<br>
- aux_offset = mt->mcs_buf->offset;<br>
+ aux_buf = mt->mcs_buf;<br>
break;<br>
<br>
case ISL_AUX_USAGE_HIZ:<br>
- aux_surf = &mt->hiz_buf->surf;<br>
- aux_bo = mt->hiz_buf->bo;<br>
- aux_offset = 0;<br>
+ aux_buf = mt->hiz_buf;<br>
break;<br>
<br>
case ISL_AUX_USAGE_NONE:<br>
@@ -175,6 +172,10 @@ brw_emit_surface_state(struct brw_context *brw,<br>
}<br>
<br>
if (aux_usage != ISL_AUX_USAGE_NONE) {<br>
+ aux_surf = &aux_buf->surf;<br>
+ aux_bo = aux_buf->bo;<br>
+ aux_offset = aux_buf->offset;<br>
+<br>
/* We only really need a clear color if we also have an auxiliary<br>
* surface. Without one, it does nothing.<br>
*/<br>
<span class="gmail-HOEnZb"><font color="#888888">--<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>
</font></span></blockquote></div><br></div></div>