<div dir="ltr"><div>Thank you, thank you, thank you! This has been annoying me for a long time. Good to see it get sorted. I did a quick grep through the tree and it looks like you got them all.<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 Mon, Jul 17, 2017 at 6:34 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">same as irb::layer_count. In case of copies and blits msaa<br>
surfacas already fall to blorp which natively works with logical<br>
slices.<br>
<br>
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 | 44 +++++-------------------<br>
src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 19 ++--------<br>
src/mesa/drivers/dri/i965/<wbr>intel_fbo.c | 3 +-<br>
src/mesa/drivers/dri/i965/<wbr>intel_fbo.h | 5 ---<br>
4 files changed, 12 insertions(+), 59 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 1b5b0f49e8..11f2fae380 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -272,20 +272,6 @@ swizzle_to_scs(GLenum swizzle)<br>
return (enum isl_channel_select)((swizzle + 4) & 7);<br>
}<br>
<br>
-static unsigned<br>
-physical_to_logical_layer(<wbr>struct intel_mipmap_tree *mt,<br>
- unsigned physical_layer)<br>
-{<br>
- if (mt->num_samples > 1 &&<br>
- (mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||<br>
- mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS)) {<br>
- assert(physical_layer % mt->num_samples == 0);<br>
- return physical_layer / mt->num_samples;<br>
- } else {<br>
- return physical_layer;<br>
- }<br>
-}<br>
-<br>
/**<br>
* Note: if the src (or dst) is a 2D multisample array texture on Gen7+ using<br>
* INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, src_layer (dst_layer) is<br>
@@ -308,10 +294,6 @@ brw_blorp_blit_miptrees(struct brw_context *brw,<br>
GLenum filter, bool mirror_x, bool mirror_y,<br>
bool decode_srgb, bool encode_srgb)<br>
{<br>
- /* Blorp operates in logical layers */<br>
- src_layer = physical_to_logical_layer(src_<wbr>mt, src_layer);<br>
- dst_layer = physical_to_logical_layer(dst_<wbr>mt, dst_layer);<br>
-<br>
DBG("%s from %dx %s mt %p %d %d (%f,%f) (%f,%f)"<br>
"to %dx %s mt %p %d %d (%f,%f) (%f,%f) (flip %d,%d)\n",<br>
__func__,<br>
@@ -733,12 +715,6 @@ set_write_disables(const struct intel_renderbuffer *irb,<br>
return disables;<br>
}<br>
<br>
-static unsigned<br>
-irb_logical_mt_layer(struct intel_renderbuffer *irb)<br>
-{<br>
- return physical_to_logical_layer(irb-<wbr>>mt, irb->mt_layer);<br>
-}<br>
-<br>
static void<br>
do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
struct gl_renderbuffer *rb, unsigned buf,<br>
@@ -776,8 +752,6 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
!brw_is_color_fast_clear_<wbr>compatible(brw, irb->mt, &ctx->Color.ClearColor))<br>
can_fast_clear = false;<br>
<br>
- const unsigned logical_layer = irb_logical_mt_layer(irb);<br>
-<br>
/* Surface state can only record one fast clear color value. Therefore<br>
* unless different levels/layers agree on the color it can be used to<br>
* represent only single level/layer. Here it will be reserved for the<br>
@@ -804,7 +778,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
<br>
if (can_fast_clear) {<br>
const enum isl_aux_state aux_state =<br>
- intel_miptree_get_aux_state(<wbr>irb->mt, irb->mt_level, logical_layer);<br>
+ intel_miptree_get_aux_state(<wbr>irb->mt, irb->mt_level, irb->mt_layer);<br>
union isl_color_value clear_color =<br>
brw_meta_convert_fast_clear_<wbr>color(brw, irb->mt,<br>
&ctx->Color.ClearColor);<br>
@@ -826,7 +800,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
struct isl_surf isl_tmp[2];<br>
struct blorp_surf surf;<br>
blorp_surf_for_miptree(brw, &surf, irb->mt, true, false, 0,<br>
- &level, logical_layer, num_layers, isl_tmp);<br>
+ &level, irb->mt_layer, num_layers, isl_tmp);<br>
<br>
/* Ivybrigde PRM Vol 2, Part 1, "11.7 MCS Buffer for Render Target(s)":<br>
*<br>
@@ -846,7 +820,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
blorp_batch_init(&brw->blorp, &batch, brw, 0);<br>
blorp_fast_clear(&batch, &surf,<br>
brw->mesa_to_isl_render_<wbr>format[format],<br>
- level, logical_layer, num_layers,<br>
+ level, irb->mt_layer, num_layers,<br>
x0, y0, x1, y1);<br>
blorp_batch_finish(&batch);<br>
<br>
@@ -857,7 +831,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
* redundant clears.<br>
*/<br>
intel_miptree_set_aux_state(<wbr>brw, irb->mt, irb->mt_level,<br>
- logical_layer, num_layers,<br>
+ irb->mt_layer, num_layers,<br>
ISL_AUX_STATE_CLEAR);<br>
} else {<br>
DBG("%s (slow) to mt %p level %d layer %d+%d\n", __FUNCTION__,<br>
@@ -869,7 +843,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
(1 << ISL_AUX_USAGE_MCS) |<br>
(1 << ISL_AUX_USAGE_CCS_E) |<br>
(1 << ISL_AUX_USAGE_CCS_D),<br>
- &level, logical_layer, num_layers, isl_tmp);<br>
+ &level, irb->mt_layer, num_layers, isl_tmp);<br>
<br>
union isl_color_value clear_color;<br>
memcpy(clear_color.f32, ctx->Color.ClearColor.f, sizeof(float) * 4);<br>
@@ -879,7 +853,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
blorp_clear(&batch, &surf,<br>
brw->mesa_to_isl_render_<wbr>format[format],<br>
ISL_SWIZZLE_IDENTITY,<br>
- level, irb_logical_mt_layer(irb), num_layers,<br>
+ level, irb->mt_layer, num_layers,<br>
x0, y0, x1, y1,<br>
clear_color, color_write_disable);<br>
blorp_batch_finish(&batch);<br>
@@ -972,7 +946,7 @@ brw_blorp_clear_depth_stencil(<wbr>struct brw_context *brw,<br>
find_miptree(GL_DEPTH_BUFFER_<wbr>BIT, irb);<br>
<br>
level = irb->mt_level;<br>
- start_layer = irb_logical_mt_layer(irb);<br>
+ start_layer = irb->mt_layer;<br>
num_layers = fb->MaxNumLayers ? irb->layer_count : 1;<br>
<br>
unsigned depth_level = level;<br>
@@ -991,11 +965,11 @@ brw_blorp_clear_depth_stencil(<wbr>struct brw_context *brw,<br>
<br>
if (mask & BUFFER_BIT_DEPTH) {<br>
assert(level == irb->mt_level);<br>
- assert(start_layer == irb_logical_mt_layer(irb));<br>
+ assert(start_layer == irb->mt_layer);<br>
assert(num_layers == fb->MaxNumLayers ? irb->layer_count : 1);<br>
} else {<br>
level = irb->mt_level;<br>
- start_layer = irb_logical_mt_layer(irb);<br>
+ start_layer = irb->mt_layer;<br>
num_layers = fb->MaxNumLayers ? irb->layer_count : 1;<br>
}<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 8d95f13f98..da5c5128c1 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>
@@ -215,16 +215,11 @@ brw_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
__func__, _mesa_get_format_name(rb_<wbr>format));<br>
}<br>
<br>
- const unsigned layer_multiplier =<br>
- (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||<br>
- irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) ?<br>
- MAX2(irb->mt->num_samples, 1) : 1;<br>
-<br>
struct isl_view view = {<br>
.format = brw->mesa_to_isl_render_<wbr>format[rb_format],<br>
.base_level = irb->mt_level - irb->mt->first_level,<br>
.levels = 1,<br>
- .base_array_layer = irb->mt_layer / layer_multiplier,<br>
+ .base_array_layer = irb->mt_layer,<br>
.array_len = MAX2(irb->layer_count, 1),<br>
.swizzle = ISL_SWIZZLE_IDENTITY,<br>
.usage = ISL_SURF_USAGE_RENDER_TARGET_<wbr>BIT,<br>
@@ -1201,21 +1196,11 @@ update_renderbuffer_read_<wbr>surfaces(struct brw_context *brw)<br>
irb->mt->target == GL_TEXTURE_1D_ARRAY ? GL_TEXTURE_2D_ARRAY :<br>
irb->mt->target;<br>
<br>
- /* intel_renderbuffer::mt_layer is expressed in sample units for<br>
- * the UMS and CMS multisample layouts, but<br>
- * intel_renderbuffer::layer_<wbr>count is expressed in units of whole<br>
- * logical layers regardless of the multisample layout.<br>
- */<br>
- const unsigned mt_layer_unit =<br>
- (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||<br>
- irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) ?<br>
- MAX2(irb->mt->num_samples, 1) : 1;<br>
-<br>
const struct isl_view view = {<br>
.format = format,<br>
.base_level = irb->mt_level - irb->mt->first_level,<br>
.levels = 1,<br>
- .base_array_layer = irb->mt_layer / mt_layer_unit,<br>
+ .base_array_layer = irb->mt_layer,<br>
.array_len = irb->layer_count,<br>
.swizzle = ISL_SWIZZLE_IDENTITY,<br>
.usage = ISL_SURF_USAGE_TEXTURE_BIT,<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 91d75ed9cc..a73ca59946 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_fbo.c<br>
@@ -530,6 +530,7 @@ intel_renderbuffer_update_<wbr>wrapper(struct brw_context *brw,<br>
<br>
intel_miptree_check_level_<wbr>layer(mt, level, layer);<br>
irb->mt_level = level;<br>
+ irb->mt_layer = layer;<br>
<br>
int layer_multiplier;<br>
switch (mt->msaa_layout) {<br>
@@ -542,8 +543,6 @@ intel_renderbuffer_update_<wbr>wrapper(struct brw_context *brw,<br>
layer_multiplier = 1;<br>
}<br>
<br>
- irb->mt_layer = layer_multiplier * layer;<br>
-<br>
if (!layered) {<br>
irb->layer_count = 1;<br>
} else if (mt->target != GL_TEXTURE_3D && image->TexObject->NumLayers > 0) {<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_fbo.h b/src/mesa/drivers/dri/i965/<wbr>intel_fbo.h<br>
index 7093ad6613..1e2494286b 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_fbo.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_fbo.h<br>
@@ -89,11 +89,6 @@ struct intel_renderbuffer<br>
*<br>
* For renderbuffers not created with glFramebufferTexture*(), mt_level and<br>
* mt_layer are 0.<br>
- *<br>
- * Note: for a 2D multisample array texture on Gen7+ using<br>
- * INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, mt_layer is the physical<br>
- * layer holding sample 0. So, for example, if mt->num_samples == 4, then<br>
- * logical layer n corresponds to mt_layer == 4*n.<br>
*/<br>
unsigned int mt_level;<br>
unsigned int mt_layer;<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>