[Mesa-dev] [PATCH 01/26] i965/meta: Split conversion of color and setting it

Pohjolainen, Topi topi.pohjolainen at gmail.com
Tue Oct 25 19:57:07 UTC 2016


On Wed, Oct 19, 2016 at 02:29:17PM -0700, Ben Widawsky wrote:
> On 16-10-11 22:26:33, Topi Pohjolainen wrote:
> > And fix a mangled comment while at it.
> > 
> > Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> > CC: Ben Widawsky <benjamin.widawsky at intel.com>
> > CC: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> > src/mesa/drivers/dri/i965/brw_blorp.c     |  7 +++-
> > src/mesa/drivers/dri/i965/brw_meta_util.c | 56 +++++++++++++++++--------------
> > src/mesa/drivers/dri/i965/brw_meta_util.h | 10 ++++--
> > 3 files changed, 45 insertions(+), 28 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
> > index b6c27982..f301192 100644
> > --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> > @@ -809,12 +809,17 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
> >                                           brw, irb->mt);
> > 
> >    if (can_fast_clear) {
> > +      union gl_color_union override_color;
> > +      brw_meta_convert_fast_clear_color(brw, irb->mt, &ctx->Color.ClearColor,
> > +                                        &override_color);
> > +
> >       /* Record the clear color in the miptree so that it will be
> >        * programmed in SURFACE_STATE by later rendering and resolve
> >        * operations.
> >        */
> >       const bool color_updated = brw_meta_set_fast_clear_color(
> > -                                    brw, irb->mt, &ctx->Color.ClearColor);
> > +                                    brw, &irb->mt->gen9_fast_clear_color,
> > +                                    &override_color);
> > 
> >       /* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, and the
> >        * buffer isn't compressed, the clear is redundant and can be skipped.
> > diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c
> > index 499b6ea..1badea1 100644
> > --- a/src/mesa/drivers/dri/i965/brw_meta_util.c
> > +++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
> > @@ -372,15 +372,14 @@ brw_is_color_fast_clear_compatible(struct brw_context *brw,
> > /**
> >  * Convert the given color to a bitfield suitable for ORing into DWORD 7 of
> >  * SURFACE_STATE (DWORD 12-15 on SKL+).
> > - *
> > - * Returned boolean tells if the given color differs from the stored.
> >  */
> > -bool
> > -brw_meta_set_fast_clear_color(struct brw_context *brw,
> > -                              struct intel_mipmap_tree *mt,
> > -                              const union gl_color_union *color)
> > +void
> > +brw_meta_convert_fast_clear_color(const struct brw_context *brw,
> > +                                  const struct intel_mipmap_tree *mt,
> > +                                  const union gl_color_union *color,
> > +                                  union gl_color_union *override_color)
> 
> I think it makes a lot more sense to return the color, my suggestion would be
> (but whatever you like)...
> union gl_color_union
> brw_meta_convert_fast_clear_color(const struct brw_context *brw,
> 				  uint32_t format
> 				  const union gl_color_union *color)

Sounds good to me, I'll change it.


More information about the mesa-dev mailing list