<div dir="ltr">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 Tue, Jul 18, 2017 at 1:46 AM, Topi Pohjolainen <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">Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 3 +-<br>
src/mesa/drivers/dri/i965/brw_<wbr>tex_layout.c | 9 ++-<br>
src/mesa/drivers/dri/i965/brw_<wbr>wm.c | 2 +-<br>
src/mesa/drivers/dri/i965/<wbr>intel_fbo.c | 13 +---<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 85 +++++++--------------------<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 49 ---------------<br>
6 files changed, 30 insertions(+), 131 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 11f2fae380..be310de85b 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -134,8 +134,7 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
unsigned start_layer, unsigned num_layers,<br>
struct isl_surf tmp_surfs[1])<br>
{<br>
- if (mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||<br>
- mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {<br>
+ if (mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY) {<br>
const unsigned num_samples = MAX2(1, mt->num_samples);<br>
for (unsigned i = 0; i < num_layers; i++) {<br>
for (unsigned s = 0; s < num_samples; s++) {<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c b/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
index c76e87bc06..91e94ee4a0 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tex_layout.c<br>
@@ -625,13 +625,12 @@ intel_miptree_set_total_width_<wbr>height(struct brw_context *brw,<br>
break;<br>
<br>
default:<br>
- switch (mt->msaa_layout) {<br>
- case INTEL_MSAA_LAYOUT_UMS:<br>
- case INTEL_MSAA_LAYOUT_CMS:<br>
+ switch (mt->surf.msaa_layout) {<br>
+ case ISL_MSAA_LAYOUT_ARRAY:<br>
brw_miptree_layout_texture_<wbr>array(brw, mt);<br>
break;<br>
- case INTEL_MSAA_LAYOUT_NONE:<br>
- case INTEL_MSAA_LAYOUT_IMS:<br>
+ case ISL_MSAA_LAYOUT_NONE:<br>
+ case ISL_MSAA_LAYOUT_INTERLEAVED:<br>
if (gen9_use_linear_1d_layout(<wbr>brw, mt))<br>
gen9_miptree_layout_1d(mt);<br>
else if (mt->array_layout == GEN6_HIZ_STENCIL)<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_wm.c b/src/mesa/drivers/dri/i965/<wbr>brw_wm.c<br>
index 18056d51d0..9e1dcee8fd 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_wm.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_wm.c<br>
@@ -400,7 +400,7 @@ brw_populate_sampler_prog_key_<wbr>data(struct gl_context *ctx,<br>
assert(brw->gen >= 7);<br>
assert(intel_tex->mt->num_<wbr>samples > 1);<br>
assert(intel_tex->mt->mcs_buf)<wbr>;<br>
- assert(intel_tex->mt->msaa_<wbr>layout == INTEL_MSAA_LAYOUT_CMS);<br>
+ assert(intel_tex->mt->surf.<wbr>msaa_layout == ISL_MSAA_LAYOUT_ARRAY);<br>
key->compressed_multisample_<wbr>layout_mask |= 1 << s;<br>
<br>
if (intel_tex->mt->num_samples >= 16) {<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c b/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c<br>
index a73ca59946..3ac6892ea0 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c<br>
@@ -532,16 +532,9 @@ intel_renderbuffer_update_<wbr>wrapper(struct brw_context *brw,<br>
irb->mt_level = level;<br>
irb->mt_layer = layer;<br>
<br>
- int layer_multiplier;<br>
- switch (mt->msaa_layout) {<br>
- case INTEL_MSAA_LAYOUT_UMS:<br>
- case INTEL_MSAA_LAYOUT_CMS:<br>
- layer_multiplier = MAX2(mt->num_samples, 1);<br>
- break;<br>
-<br>
- default:<br>
- layer_multiplier = 1;<br>
- }<br>
+ const unsigned layer_multiplier =<br>
+ mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY ?<br>
+ MAX2(mt->num_samples, 1) : 1;<br>
<br>
if (!layered) {<br>
irb->layer_count = 1;<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index f292d71d38..8e241b8462 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -101,42 +101,22 @@ is_mcs_supported(const struct brw_context *brw, mesa_format format,<br>
* Determine which MSAA layout should be used by the MSAA surface being<br>
* created, based on the chip generation and the surface type.<br>
*/<br>
-static enum intel_msaa_layout<br>
+static enum isl_msaa_layout<br>
compute_msaa_layout(struct brw_context *brw, mesa_format format,<br>
uint32_t layout_flags)<br>
{<br>
/* Prior to Gen7, all MSAA surfaces used IMS layout. */<br>
if (brw->gen < 7)<br>
- return INTEL_MSAA_LAYOUT_IMS;<br>
+ return ISL_MSAA_LAYOUT_INTERLEAVED;<br>
<br>
/* In Gen7, IMS layout is only used for depth and stencil buffers. */<br>
switch (_mesa_get_format_base_format(<wbr>format)) {<br>
case GL_DEPTH_COMPONENT:<br>
case GL_STENCIL_INDEX:<br>
case GL_DEPTH_STENCIL:<br>
- return INTEL_MSAA_LAYOUT_IMS;<br>
+ return ISL_MSAA_LAYOUT_INTERLEAVED;<br>
default:<br>
- /* From the Ivy Bridge PRM, Vol4 Part1 p77 ("MCS Enable"):<br>
- *<br>
- * This field must be set to 0 for all SINT MSRTs when all RT channels<br>
- * are not written<br>
- *<br>
- * In practice this means that we have to disable MCS for all signed<br>
- * integer MSAA buffers. The alternative, to disable MCS only when one<br>
- * of the render target channels is disabled, is impractical because it<br>
- * would require converting between CMS and UMS MSAA layouts on the fly,<br>
- * which is expensive.<br>
- */<br>
- if (brw->gen == 7 && _mesa_get_format_datatype(<wbr>format) == GL_INT) {<br>
- return INTEL_MSAA_LAYOUT_UMS;<br>
- } else if (layout_flags & MIPTREE_LAYOUT_DISABLE_AUX) {<br>
- /* We can't use the CMS layout because it uses an aux buffer, the MCS<br>
- * buffer. So fallback to UMS, which is identical to CMS without the<br>
- * MCS. */<br>
- return INTEL_MSAA_LAYOUT_UMS;<br>
- } else {<br>
- return INTEL_MSAA_LAYOUT_CMS;<br>
- }<br>
+ return ISL_MSAA_LAYOUT_ARRAY;<br>
}<br>
}<br>
<br>
@@ -404,7 +384,7 @@ intel_miptree_create_layout(<wbr>struct brw_context *brw,<br>
mt->cpp = _mesa_get_format_bytes(format)<wbr>;<br>
mt->num_samples = num_samples;<br>
mt->compressed = _mesa_is_format_compressed(<wbr>format);<br>
- mt->msaa_layout = INTEL_MSAA_LAYOUT_NONE;<br>
+ mt->surf.msaa_layout = ISL_MSAA_LAYOUT_NONE;<br>
mt->refcount = 1;<br>
<br>
if (brw->gen == 6 && format == MESA_FORMAT_S_UINT8)<br>
@@ -413,8 +393,8 @@ intel_miptree_create_layout(<wbr>struct brw_context *brw,<br>
int depth_multiply = 1;<br>
if (num_samples > 1) {<br>
/* Adjust width/height/depth for MSAA */<br>
- mt->msaa_layout = compute_msaa_layout(brw, format, layout_flags);<br>
- if (mt->msaa_layout == INTEL_MSAA_LAYOUT_IMS) {<br>
+ mt->surf.msaa_layout = compute_msaa_layout(brw, format, layout_flags);<br>
+ if (mt->surf.msaa_layout == ISL_MSAA_LAYOUT_INTERLEAVED) {<br>
/* From the Ivybridge PRM, Volume 1, Part 1, page 108:<br>
* "If the surface is multisampled and it is a depth or stencil<br>
* surface or Multisampled Surface StorageFormat in SURFACE_STATE is<br>
@@ -520,13 +500,12 @@ intel_miptree_create_layout(<wbr>struct brw_context *brw,<br>
if (brw->gen >= 9) {<br>
mt->array_layout = ALL_LOD_IN_EACH_SLICE;<br>
} else {<br>
- switch (mt->msaa_layout) {<br>
- case INTEL_MSAA_LAYOUT_NONE:<br>
- case INTEL_MSAA_LAYOUT_IMS:<br>
+ switch (mt->surf.msaa_layout) {<br>
+ case ISL_MSAA_LAYOUT_NONE:<br>
+ case ISL_MSAA_LAYOUT_INTERLEAVED:<br>
mt->array_layout = ALL_LOD_IN_EACH_SLICE;<br>
break;<br>
- case INTEL_MSAA_LAYOUT_UMS:<br>
- case INTEL_MSAA_LAYOUT_CMS:<br>
+ case ISL_MSAA_LAYOUT_ARRAY:<br>
mt->array_layout = ALL_SLICES_AT_EACH_LOD;<br>
break;<br>
}<br>
@@ -624,7 +603,7 @@ intel_miptree_choose_aux_<wbr>usage(struct brw_context *brw,<br>
<br>
const unsigned no_flags = 0;<br>
if (mt->num_samples > 1 && is_mcs_supported(brw, mt->format, no_flags)) {<br>
- assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);<br>
+ assert(mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);<br>
mt->aux_usage = ISL_AUX_USAGE_MCS;<br>
} else if (intel_tiling_supports_ccs(<wbr>brw, mt->tiling) &&<br>
intel_miptree_supports_ccs(<wbr>brw, mt)) {<br>
@@ -1385,17 +1364,8 @@ intel_miptree_match_image(<wbr>struct intel_mipmap_tree *mt,<br>
}<br>
<br>
int level_depth = mt->level[level].depth;<br>
- if (mt->num_samples > 1) {<br>
- switch (mt->msaa_layout) {<br>
- case INTEL_MSAA_LAYOUT_NONE:<br>
- case INTEL_MSAA_LAYOUT_IMS:<br>
- break;<br>
- case INTEL_MSAA_LAYOUT_UMS:<br>
- case INTEL_MSAA_LAYOUT_CMS:<br>
- level_depth /= mt->num_samples;<br>
- break;<br>
- }<br>
- }<br>
+ if (mt->num_samples > 1 && mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY)<br>
+ level_depth /= mt->num_samples;<br>
<br>
/* Test image dimensions against the base level image adjusted for<br>
* minification. This will also catch images not present in the<br>
@@ -2571,7 +2541,8 @@ intel_miptree_get_aux_state(<wbr>const struct intel_mipmap_tree *mt,<br>
<br>
if (_mesa_is_format_color_format(<wbr>mt->format)) {<br>
assert(mt->mcs_buf != NULL);<br>
- assert(mt->num_samples <= 1 || mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);<br>
+ assert(mt->num_samples <= 1 ||<br>
+ mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);<br>
} else if (mt->format == MESA_FORMAT_S_UINT8) {<br>
unreachable("Cannot get aux state for stencil");<br>
} else {<br>
@@ -2591,7 +2562,8 @@ intel_miptree_set_aux_state(<wbr>struct brw_context *brw,<br>
<br>
if (_mesa_is_format_color_format(<wbr>mt->format)) {<br>
assert(mt->mcs_buf != NULL);<br>
- assert(mt->num_samples <= 1 || mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);<br>
+ assert(mt->num_samples <= 1 ||<br>
+ mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);<br>
} else if (mt->format == MESA_FORMAT_S_UINT8) {<br>
unreachable("Cannot get aux state for stencil");<br>
} else {<br>
@@ -2774,7 +2746,8 @@ intel_miptree_make_shareable(<wbr>struct brw_context *brw,<br>
* pixel data is stored. Fortunately this code path should never be<br>
* reached for multisample buffers.<br>
*/<br>
- assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE || mt->num_samples <= 1);<br>
+ assert(mt->surf.msaa_layout == ISL_MSAA_LAYOUT_NONE ||<br>
+ mt->num_samples <= 1);<br>
<br>
intel_miptree_prepare_access(<wbr>brw, mt, 0, INTEL_REMAINING_LEVELS,<br>
0, INTEL_REMAINING_LAYERS, false, false);<br>
@@ -3761,23 +3734,7 @@ intel_miptree_get_isl_surf(<wbr>struct brw_context *brw,<br>
surf->dim_layout = get_isl_dim_layout(&brw-><wbr>screen->devinfo,<br>
mt->tiling, mt->target,<br>
mt->array_layout);<br>
-<br>
- if (mt->num_samples > 1) {<br>
- switch (mt->msaa_layout) {<br>
- case INTEL_MSAA_LAYOUT_IMS:<br>
- surf->msaa_layout = ISL_MSAA_LAYOUT_INTERLEAVED;<br>
- break;<br>
- case INTEL_MSAA_LAYOUT_UMS:<br>
- case INTEL_MSAA_LAYOUT_CMS:<br>
- surf->msaa_layout = ISL_MSAA_LAYOUT_ARRAY;<br>
- break;<br>
- default:<br>
- unreachable("Invalid MSAA layout");<br>
- }<br>
- } else {<br>
- surf->msaa_layout = ISL_MSAA_LAYOUT_NONE;<br>
- }<br>
-<br>
+ surf->msaa_layout = mt->surf.msaa_layout;<br>
surf->tiling = intel_miptree_get_isl_tiling(<wbr>mt);<br>
<br>
if (mt->format == MESA_FORMAT_S_UINT8) {<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index 45ac5dfd38..89590d2ba2 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -158,48 +158,6 @@ struct intel_mipmap_level<br>
} *slice;<br>
};<br>
<br>
-/**<br>
- * Enum for keeping track of the different MSAA layouts supported by Gen7.<br>
- */<br>
-enum intel_msaa_layout<br>
-{<br>
- /**<br>
- * Ordinary surface with no MSAA.<br>
- */<br>
- INTEL_MSAA_LAYOUT_NONE,<br>
-<br>
- /**<br>
- * Interleaved Multisample Surface. The additional samples are<br>
- * accommodated by scaling up the width and the height of the surface so<br>
- * that all the samples corresponding to a pixel are located at nearby<br>
- * memory locations.<br>
- *<br>
- * @see PRM section "Interleaved Multisampled Surfaces"<br>
- */<br>
- INTEL_MSAA_LAYOUT_IMS,<br>
-<br>
- /**<br>
- * Uncompressed Multisample Surface. The surface is stored as a 2D array,<br>
- * with array slice n containing all pixel data for sample n.<br>
- *<br>
- * @see PRM section "Uncompressed Multisampled Surfaces"<br>
- */<br>
- INTEL_MSAA_LAYOUT_UMS,<br>
-<br>
- /**<br>
- * Compressed Multisample Surface. The surface is stored as in<br>
- * INTEL_MSAA_LAYOUT_UMS, but there is an additional buffer called the MCS<br>
- * (Multisample Control Surface) buffer. Each pixel in the MCS buffer<br>
- * indicates the mapping from sample number to array slice. This allows<br>
- * the common case (where all samples constituting a pixel have the same<br>
- * color value) to be stored efficiently by just using a single array<br>
- * slice.<br>
- *<br>
- * @see PRM section "Compressed Multisampled Surfaces"<br>
- */<br>
- INTEL_MSAA_LAYOUT_CMS,<br>
-};<br>
-<br>
enum miptree_array_layout {<br>
/* Each array slice contains all miplevels packed together.<br>
*<br>
@@ -518,13 +476,6 @@ struct intel_mipmap_tree<br>
*/<br>
uint32_t qpitch;<br>
<br>
- /**<br>
- * MSAA layout used by this buffer.<br>
- *<br>
- * @see RENDER_SURFACE_STATE.<wbr>MultisampledSurfaceStorageForm<wbr>at<br>
- */<br>
- enum intel_msaa_layout msaa_layout;<br>
-<br>
/* Derived from the above:<br>
*/<br>
GLuint total_width;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<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>