[v4,06/18] intel/blorp: Add support for fast clear address.

Submitted by Rafael Antognolli on March 8, 2018, 4:48 p.m.

Details

Message ID 20180308164911.15375-7-rafael.antognolli@intel.com
State New
Headers show
Series "Use clear color address in surface state." ( rev: 4 3 ) in Mesa

Not browsing as part of any series.

Commit Message

Rafael Antognolli March 8, 2018, 4:48 p.m.
On gen10+, if surface->clear_color_addr is present, use it directly
intead of copying it to the surface state.

v4: Remove redundant #if clause for GEN <= 10 (Jason)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
---
 src/intel/blorp/blorp_genX_exec.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
index 7f5a4539e8d..28a17a7df46 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -1313,11 +1313,15 @@  blorp_emit_surface_state(struct blorp_batch *batch,
          write_disable_mask |= ISL_CHANNEL_ALPHA_BIT;
    }
 
+   const bool use_clear_address =
+      GEN_GEN >= 10 && (surface->clear_color_addr.buffer != NULL);
+
    isl_surf_fill_state(batch->blorp->isl_dev, state,
                        .surf = &surf, .view = &surface->view,
                        .aux_surf = &surface->aux_surf, .aux_usage = aux_usage,
                        .mocs = surface->addr.mocs,
                        .clear_color = surface->clear_color,
+                       .use_clear_address = use_clear_address,
                        .write_disables = write_disable_mask);
 
    blorp_surface_reloc(batch, state_offset + isl_dev->ss.addr_offset,
@@ -1337,9 +1341,12 @@  blorp_emit_surface_state(struct blorp_batch *batch,
    blorp_flush_range(batch, state, GENX(RENDER_SURFACE_STATE_length) * 4);
 
    if (surface->clear_color_addr.buffer) {
-#if GEN_GEN > 10
-      unreachable("Implement indirect clear support on gen11+");
-#elif GEN_GEN >= 7 && GEN_GEN <= 10
+#if GEN_GEN >= 10
+      assert((surface->clear_color_addr.offset & 0x3f) == 0);
+      blorp_surface_reloc(batch, state_offset +
+                          isl_dev->ss.clear_color_state_offset,
+                          surface->clear_color_addr, 0);
+#elif GEN_GEN >= 7
       struct blorp_address dst_addr = blorp_get_surface_base_address(batch);
       dst_addr.offset += state_offset + isl_dev->ss.clear_value_offset;
       blorp_emit_memcpy(batch, dst_addr, surface->clear_color_addr,

Comments

On Thu, Mar 08, 2018 at 08:48:59AM -0800, Rafael Antognolli wrote:
> On gen10+, if surface->clear_color_addr is present, use it directly
> intead of copying it to the surface state.
> 
> v4: Remove redundant #if clause for GEN <= 10 (Jason)
> 
> Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
> ---
>  src/intel/blorp/blorp_genX_exec.h | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
> index 7f5a4539e8d..28a17a7df46 100644
> --- a/src/intel/blorp/blorp_genX_exec.h
> +++ b/src/intel/blorp/blorp_genX_exec.h
> @@ -1313,11 +1313,15 @@ blorp_emit_surface_state(struct blorp_batch *batch,
>           write_disable_mask |= ISL_CHANNEL_ALPHA_BIT;
>     }
>  
> +   const bool use_clear_address =
> +      GEN_GEN >= 10 && (surface->clear_color_addr.buffer != NULL);
> +
>     isl_surf_fill_state(batch->blorp->isl_dev, state,
>                         .surf = &surf, .view = &surface->view,
>                         .aux_surf = &surface->aux_surf, .aux_usage = aux_usage,
>                         .mocs = surface->addr.mocs,
>                         .clear_color = surface->clear_color,
> +                       .use_clear_address = use_clear_address,
>                         .write_disables = write_disable_mask);
>  
>     blorp_surface_reloc(batch, state_offset + isl_dev->ss.addr_offset,
> @@ -1337,9 +1341,12 @@ blorp_emit_surface_state(struct blorp_batch *batch,
>     blorp_flush_range(batch, state, GENX(RENDER_SURFACE_STATE_length) * 4);

We should move this after the reloc() call as it still updates the clear
address.

>  
>     if (surface->clear_color_addr.buffer) {
> -#if GEN_GEN > 10
> -      unreachable("Implement indirect clear support on gen11+");
> -#elif GEN_GEN >= 7 && GEN_GEN <= 10
> +#if GEN_GEN >= 10
> +      assert((surface->clear_color_addr.offset & 0x3f) == 0);

In order not to loose the lower bits later on:

         uint32_t *clear_addr = state + isl_dev->ss.clear_color_state_offset;

> +      blorp_surface_reloc(batch, state_offset +
> +                          isl_dev->ss.clear_color_state_offset,
> +                          surface->clear_color_addr, 0);

			     surface->clear_color_addr, *clear_addr);

> +#elif GEN_GEN >= 7
>        struct blorp_address dst_addr = blorp_get_surface_base_address(batch);
>        dst_addr.offset += state_offset + isl_dev->ss.clear_value_offset;
>        blorp_emit_memcpy(batch, dst_addr, surface->clear_color_addr,
> -- 
> 2.14.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev