<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 25, 2018 at 12:53 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</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 Friday, May 25, 2018 12:31:03 PM PDT Jason Ekstrand wrote:<br>
> For certain EGLImage cases, we represent a single slice or LOD of an<br>
> image with a byte offset to a tile and X/Y intratile offsets to the<br>
> given slice. Most of i965 is fine with this but it breaks blorp. This<br>
> is a terrible way to represent slices of a surface in EGL and we should<br>
> stop some day but that's a very scary and thorny path. This gets blorp<br>
> to start working with those surfaces and fixes some dEQP EGL test bugs.<br>
> <br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106629" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=106629</a><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> ---<br>
> src/intel/blorp/blorp.c | 22 ++++++++++++++++++++++<br>
> src/intel/blorp/blorp.h | 3 +++<br>
> src/intel/blorp/blorp_blit.c | 4 +++-<br>
> src/intel/blorp/blorp_clear.c | 9 +++++++++<br>
> src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 2 ++<br>
> 5 files changed, 39 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c<br>
> index e348caf..73f8c67 100644<br>
> --- a/src/intel/blorp/blorp.c<br>
> +++ b/src/intel/blorp/blorp.c<br>
> @@ -137,6 +137,28 @@ brw_blorp_surface_info_init(<wbr>struct blorp_context *blorp,<br>
> */<br>
> if (is_render_target && blorp->isl_dev->info->gen <= 6)<br>
> info->view.array_len = MIN2(info->view.array_len, 512);<br>
> +<br>
> + if (surf->tile_x_sa || surf->tile_y_sa) {<br>
> + /* This is only allowed on simple 2D surfaces without MSAA */<br>
> + assert(info->surf.dim == ISL_SURF_DIM_2D);<br>
> + assert(info->surf.samples == 1);<br>
> + assert(info->surf.levels == 1);<br>
> + assert(info->surf.logical_<wbr>level0_px.array_len == 1);<br>
> + assert(info->aux_usage == ISL_AUX_USAGE_NONE);<br>
> +<br>
> + info->tile_x_sa = surf->tile_x_sa;<br>
> + info->tile_y_sa = surf->tile_y_sa;<br>
> +<br>
> + /* Instead of using the X/Y Offset fields in RENDER_SURFACE_STATE, we<br>
> + * place the image at the tile boundary and offset our sampling or<br>
> + * rendering. For this reason, we need to grow the image by the offset<br>
> + * to ensure that the hardware doesn't think we've gone past the edge.<br>
> + */<br>
> + info->surf.logical_level0_px.w += surf->tile_x_sa;<br>
> + info->surf.logical_level0_px.h += surf->tile_y_sa;<br>
> + info->surf.phys_level0_sa.w += surf->tile_x_sa;<br>
> + info->surf.phys_level0_sa.h += surf->tile_y_sa;<br>
> + }<br>
> }<br>
> <br>
> <br>
> diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h<br>
> index f22110b..0a10ff9 100644<br>
> --- a/src/intel/blorp/blorp.h<br>
> +++ b/src/intel/blorp/blorp.h<br>
> @@ -114,6 +114,9 @@ struct blorp_surf<br>
> * that it contains a swizzle of RGBA and resource min LOD of 0.<br>
> */<br>
> struct blorp_address clear_color_addr;<br>
> +<br>
> + /* Only allowed for simple 2D non-MSAA surfaces */<br>
> + uint32_t tile_x_sa, tile_y_sa;<br>
> };<br>
> <br>
> void<br>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c<br>
> index 67d4266..68e6d4e 100644<br>
> --- a/src/intel/blorp/blorp_blit.c<br>
> +++ b/src/intel/blorp/blorp_blit.c<br>
> @@ -2510,7 +2510,9 @@ blorp_copy(struct blorp_batch *batch,<br>
> dst_layer, ISL_FORMAT_UNSUPPORTED, true);<br>
> <br>
> struct brw_blorp_blit_prog_key wm_prog_key = {<br>
> - .shader_type = BLORP_SHADER_TYPE_BLIT<br>
> + .shader_type = BLORP_SHADER_TYPE_BLIT,<br>
> + .need_src_offset = src_surf->tile_x_sa || src_surf->tile_y_sa,<br>
> + .need_dst_offset = dst_surf->tile_x_sa || dst_surf->tile_y_sa,<br>
> };<br>
> <br>
> const struct isl_format_layout *src_fmtl =<br>
> diff --git a/src/intel/blorp/blorp_clear.<wbr>c b/src/intel/blorp/blorp_clear.<wbr>c<br>
> index 832e8ee..4d3125a 100644<br>
> --- a/src/intel/blorp/blorp_clear.<wbr>c<br>
> +++ b/src/intel/blorp/blorp_clear.<wbr>c<br>
> @@ -438,6 +438,15 @@ blorp_clear(struct blorp_batch *batch,<br>
> params.x1 = x1;<br>
> params.y1 = y1;<br>
> <br>
> + if (params.dst.tile_x_sa || params.dst.tile_y_sa) {<br>
> + assert(params.dst.surf.samples == 1);<br>
> + assert(num_layers == 1);<br>
> + params.x0 += params.dst.tile_x_sa;<br>
> + params.y0 += params.dst.tile_y_sa;<br>
> + params.x1 += params.dst.tile_x_sa;<br>
> + params.y1 += params.dst.tile_y_sa;<br>
> + }<br>
> +<br>
> /* The MinLOD and MinimumArrayElement don't work properly for cube maps.<br>
> * Convert them to a single slice on gen4.<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 d7a2cb2..8c6d77e 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> @@ -152,6 +152,8 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
> .mocs = brw_get_bo_mocs(devinfo, mt->bo),<br>
> },<br>
> .aux_usage = aux_usage,<br>
> + .tile_x_sa = mt->level[*level].level_x,<br>
> + .tile_y_sa = mt->level[*level].level_y,<br>
> };<br>
> <br>
> if (mt->format == MESA_FORMAT_S_UINT8 && is_render_target &&<br>
> <br>
<br>
</div></div>Hopefully we don't run afoul of surface width/height limits. Probably<br>
won't, hard to imagine offsetting into something that's already max<br>
dimensions...<br>
<br>
Strange that this only happens on Gen6-8 and not Gen9+. I wonder what<br>
changed?<br></blockquote><div><br></div><div>Most likely a difference in the surface vertical alignment requirements between generations causes us to not hit it by accident on SKL. Not 100% sure though.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
</blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks!<br></div></div>