[Mesa-dev] [PATCH v2 4/6] i965: emit BRW_NEW_AUX_STATE when we change the fast clear value

Jason Ekstrand jason at jlekstrand.net
Sat Sep 16 00:08:31 UTC 2017


On Fri, Sep 15, 2017 at 3:02 AM, Iago Toral Quiroga <itoral at igalia.com>
wrote:

> ---
>  src/mesa/drivers/dri/i965/brw_blorp.c         | 12 ++----------
>  src/mesa/drivers/dri/i965/brw_clear.c         |  2 +-
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 28
> +++++++++++++++++++++++++++
>  3 files changed, 31 insertions(+), 11 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
> b/src/mesa/drivers/dri/i965/brw_blorp.c
> index fde1257623..aba7b6ddb8 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> @@ -847,8 +847,8 @@ do_single_blorp_clear(struct brw_context *brw, struct
> gl_framebuffer *fb,
>           brw_meta_convert_fast_clear_color(brw, irb->mt,
>                                             &ctx->Color.ClearColor);
>
> -      bool same_clear_color = memcmp(&irb->mt->fast_clear_color,
> -                                     &clear_color, sizeof(clear_color))
> == 0;
> +      bool same_clear_color =
> +         !intel_miptree_set_clear_value(ctx, irb->mt, clear_color);
>
>        /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the
> clear
>         * is redundant and can be skipped.
> @@ -856,14 +856,6 @@ do_single_blorp_clear(struct brw_context *brw, struct
> gl_framebuffer *fb,
>        if (aux_state == ISL_AUX_STATE_CLEAR && same_clear_color)
>           return;
>
> -      irb->mt->fast_clear_color = clear_color;
> -
> -      /* If the clear color has changed, we need to emit a new
> SURFACE_STATE
> -       * on the next draw call.
> -       */
> -      if (!same_clear_color)
> -         ctx->NewDriverState |= BRW_NEW_AUX_STATE;
> -
>        DBG("%s (fast) to mt %p level %d layers %d+%d\n", __FUNCTION__,
>            irb->mt, irb->mt_level, irb->mt_layer, num_layers);
>
> diff --git a/src/mesa/drivers/dri/i965/brw_clear.c
> b/src/mesa/drivers/dri/i965/brw_clear.c
> index b9e087ce33..fe8634b3b3 100644
> --- a/src/mesa/drivers/dri/i965/brw_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> @@ -212,7 +212,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
>           }
>        }
>
> -      mt->fast_clear_color.f32[0] = clear_value;
> +      intel_miptree_set_depth_clear_value(ctx, mt, clear_value);
>     }
>
>     bool need_clear = false;
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> index e2b23c5aad..452608c2f8 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> @@ -50,6 +50,7 @@
>  #include "isl/isl.h"
>  #include "blorp/blorp.h"
>  #include "brw_bufmgr.h"
> +#include "brw_context.h"
>  #include <GL/internal/dri_interface.h>
>
>  #ifdef __cplusplus
> @@ -710,6 +711,33 @@ bool
>  intel_miptree_sample_with_hiz(struct brw_context *brw,
>                                struct intel_mipmap_tree *mt);
>
> +
> +static inline bool
> +intel_miptree_set_clear_value(struct gl_context *ctx,
>

Maybe call this "set_clear_color"?


> +                              struct intel_mipmap_tree *mt,
> +                              union isl_color_value clear_value)
> +{
> +   if (memcmp(&mt->fast_clear_color, &clear_value, sizeof(clear_value))
> != 0) {
> +      mt->fast_clear_color = clear_value;
> +      ctx->NewDriverState |= BRW_NEW_AUX_STATE;
> +      return true;
> +   }
> +   return false;
> +}
> +
> +static inline bool
> +intel_miptree_set_depth_clear_value(struct gl_context *ctx,
> +                                    struct intel_mipmap_tree *mt,
> +                                    float clear_value)
> +{
> +   if (mt->fast_clear_color.f32[0] != clear_value) {
> +      mt->fast_clear_color.f32[0] = clear_value;
> +      ctx->NewDriverState |= BRW_NEW_AUX_STATE;
> +      return true;
> +   }
> +   return false;
> +}
> +
>  #ifdef __cplusplus
>  }
>  #endif
> --
> 2.11.0
>
> _______________________________________________
> 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/20170915/74f27f1c/attachment-0001.html>


More information about the mesa-dev mailing list