[Mesa-dev] [PATCH 13/22] blorp/clear: Add a binding-table-based CCS resolve function

Jason Ekstrand jason at jlekstrand.net
Wed May 3 00:01:23 UTC 2017


On Thu, Apr 27, 2017 at 11:32 AM, Nanley Chery <nanleychery at gmail.com>
wrote:

> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/intel/blorp/blorp.h       |  9 ++++++
>  src/intel/blorp/blorp_clear.c | 64 ++++++++++++++++++++++++++++++
> ++-----------
>  2 files changed, 57 insertions(+), 16 deletions(-)
>
> diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> index eab75d70ab..8b8227bb1c 100644
> --- a/src/intel/blorp/blorp.h
> +++ b/src/intel/blorp/blorp.h
> @@ -191,6 +191,15 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>                    enum isl_format format,
>                    enum blorp_fast_clear_op resolve_op);
>
> +/* Resolves the image subresource specified in the binding table.  */
> +void
> +blorp_ccs_resolve_bt(struct blorp_batch *batch,
> +                     const uint32_t binding_table_offset,
> +                     struct blorp_surf * const surf,
> +                     const uint32_t level, const uint32_t layer,
> +                     const enum isl_format format,
> +                     const enum blorp_fast_clear_op resolve_op);
>

Other binding-table versions of functions in blorp use the _attachment
suffix instead of _bt.


> +
>  /**
>   * For an overview of the HiZ operations, see the following sections of
> the
>   * Sandy Bridge PRM, Volume 1, Part2:
> diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> index 4e834ba123..6204784a7e 100644
> --- a/src/intel/blorp/blorp_clear.c
> +++ b/src/intel/blorp/blorp_clear.c
> @@ -665,20 +665,20 @@ blorp_clear_attachments(struct blorp_batch *batch,
>     batch->blorp->exec(batch, &params);
>  }
>
> -void
> -blorp_ccs_resolve(struct blorp_batch *batch,
> -                  struct blorp_surf *surf, uint32_t level, uint32_t layer,
> -                  enum isl_format format,
> -                  enum blorp_fast_clear_op resolve_op)
> +static void
> +blorp_ccs_resolve_prepare(struct blorp_batch * const batch,
> +                          struct blorp_params * const params,
> +                          const struct blorp_surf * const surf,
> +                          const uint32_t level, const uint32_t layer,
> +                          const enum isl_format format,
> +                          const enum blorp_fast_clear_op resolve_op)
>

Maybe call this prepare_ccs_resolve?  Or maybe
blorp_params_init_for_ccs_resolve and do the init in here too?


>  {
> -   struct blorp_params params;
> -   blorp_params_init(&params);
>
>     /* Layered and mipmapped fast clear is only available from Gen8
> onwards. */
>     assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 8 ||
>            (level == 0 && layer == 0));
>
> -   brw_blorp_surface_info_init(batch->blorp, &params.dst, surf,
> +   brw_blorp_surface_info_init(batch->blorp, &params->dst, surf,
>                                 level, layer, format, true);
>
>     /* From the Ivy Bridge PRM, Vol2 Part1 11.9 "Render Target Resolve":
> @@ -691,7 +691,7 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>      * multiply by 8 and 16. On Sky Lake, we multiply by 8.
>      */
>     const struct isl_format_layout *aux_fmtl =
> -      isl_format_get_layout(params.dst.aux_surf.format);
> +      isl_format_get_layout(params->dst.aux_surf.format);
>     assert(aux_fmtl->txc == ISL_TXC_CCS);
>
>     unsigned x_scaledown, y_scaledown;
> @@ -705,11 +705,11 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>        x_scaledown = aux_fmtl->bw / 2;
>        y_scaledown = aux_fmtl->bh / 2;
>     }
> -   params.x0 = params.y0 = 0;
> -   params.x1 = minify(params.dst.aux_surf.logical_level0_px.width,
> level);
> -   params.y1 = minify(params.dst.aux_surf.logical_level0_px.height,
> level);
> -   params.x1 = ALIGN(params.x1, x_scaledown) / x_scaledown;
> -   params.y1 = ALIGN(params.y1, y_scaledown) / y_scaledown;
> +   params->x0 = params->y0 = 0;
> +   params->x1 = minify(params->dst.aux_surf.logical_level0_px.width,
> level);
> +   params->y1 = minify(params->dst.aux_surf.logical_level0_px.height,
> level);
> +   params->x1 = ALIGN(params->x1, x_scaledown) / x_scaledown;
> +   params->y1 = ALIGN(params->y1, y_scaledown) / y_scaledown;
>
>     if (batch->blorp->isl_dev->info->gen >= 9) {
>        assert(resolve_op == BLORP_FAST_CLEAR_OP_RESOLVE_FULL ||
> @@ -718,7 +718,7 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>        /* Broadwell and earlier do not have a partial resolve */
>        assert(resolve_op == BLORP_FAST_CLEAR_OP_RESOLVE_FULL);
>     }
> -   params.fast_clear_op = resolve_op;
> +   params->fast_clear_op = resolve_op;
>
>     /* Note: there is no need to initialize push constants because it
> doesn't
>      * matter what data gets dispatched to the render target.  However, we
> must
> @@ -726,8 +726,40 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>      * color" message.
>      */
>
> -   if (!blorp_params_get_clear_kernel(batch->blorp, &params, true))
> +   if (!blorp_params_get_clear_kernel(batch->blorp, params, true))
>        return;
> +}
> +
> +void
> +blorp_ccs_resolve(struct blorp_batch *batch,
> +                  struct blorp_surf *surf, uint32_t level, uint32_t layer,
> +                  enum isl_format format,
> +                  enum blorp_fast_clear_op resolve_op)
> +{
> +   struct blorp_params params;
> +   blorp_params_init(&params);
>

I think you can do the init in the prepare function as well.


> +
> +   blorp_ccs_resolve_prepare(batch, &params, surf, level, layer, format,
> +                             resolve_op);
> +
> +   batch->blorp->exec(batch, &params);
> +}
> +
> +void
> +blorp_ccs_resolve_bt(struct blorp_batch *batch,
> +                     const uint32_t binding_table_offset,
> +                     struct blorp_surf * const surf,
> +                     const uint32_t level, const uint32_t layer,
> +                     const enum isl_format format,
> +                     const enum blorp_fast_clear_op resolve_op)
> +{
> +   struct blorp_params params;
> +   blorp_params_init(&params);
> +
> +   params.use_pre_baked_binding_table = true;
> +   params.pre_baked_binding_table_offset = binding_table_offset;
>
> +   blorp_ccs_resolve_prepare(batch, &params, surf, level, layer, format,
> +                             resolve_op);
>     batch->blorp->exec(batch, &params);
>  }
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170502/9e1b0fe4/attachment.html>


More information about the mesa-dev mailing list