On Mon, May 07, 2018 at 11:12:26AM -0700, Nanley Chery wrote:
> On Mon, May 07, 2018 at 03:36:54PM +0300, Pohjolainen, Topi wrote:
> > On Thu, May 03, 2018 at 12:03:55PM -0700, Nanley Chery wrote:
> > > We're going to delete intel_miptree_alloc_ccs() in the next commit. With
> > > that in mind, replace the use of this function in
> > > do_single_blorp_clear() with intel_miptree_alloc_aux() and move the
> > > delayed allocation logic to it's callers.
> > > ---
> > > src/mesa/drivers/dri/i965/brw_blorp.c | 2 +-
> > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 19 ++++++-------------
> > > src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 2 +-
> > > 3 files changed, 8 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c
> > > b/src/mesa/drivers/dri/i965/brw_blorp.c
> > > index ba14136edc6..e6eedf3cedc 100644
> > > --- a/src/mesa/drivers/dri/i965/brw_blorp.c
> > > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c
> > > @@ -1209,7 +1209,7 @@ do_single_blorp_clear(struct brw_context *brw,
> > > struct gl_framebuffer *fb,
> > > */
> > > if (can_fast_clear && !irb->mt->aux_buf) {
> > > assert(irb->mt->aux_usage == ISL_AUX_USAGE_CCS_D);
> > > - if (!intel_miptree_alloc_ccs(brw, irb->mt)) {
> > > + if (!intel_miptree_alloc_aux(brw, irb->mt)) {
> > > /* There are a few reasons in addition to out-of-memory, that
> > > can
> > > * cause intel_miptree_alloc_non_msrt_mcs to fail. Try to
> > > recover by
> > > * falling back to non-fast clear.
> > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > index 1de381141ea..84be7c07c6f 100644
> > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > @@ -59,10 +59,6 @@ static void *intel_miptree_map_raw(struct brw_context
> > > *brw,
> > >
> > > static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
> > >
> > > -static bool
> > > -intel_miptree_alloc_aux(struct brw_context *brw,
> > > - struct intel_mipmap_tree *mt);
> > > -
> > > static bool
> > > intel_miptree_supports_mcs(struct brw_context *brw,
> > > const struct intel_mipmap_tree *mt)
> > > @@ -791,7 +787,8 @@ intel_miptree_create(struct brw_context *brw,
> > >
> > > mt->offset = 0;
> > >
> > > - if (!intel_miptree_alloc_aux(brw, mt)) {
> > > + if (mt->aux_usage != ISL_AUX_USAGE_CCS_D &&
> > > + !intel_miptree_alloc_aux(brw, mt)) {
> > > intel_miptree_release(&mt);
> > > return NULL;
> > > }
> > > @@ -882,7 +879,8 @@ intel_miptree_create_for_bo(struct brw_context *brw,
> > > if (!(flags & MIPTREE_CREATE_NO_AUX)) {
> > > intel_miptree_choose_aux_usage(brw, mt);
> > >
> > > - if (!intel_miptree_alloc_aux(brw, mt)) {
> > > + if (mt->aux_usage != ISL_AUX_USAGE_CCS_D &&
> > > + !intel_miptree_alloc_aux(brw, mt)) {
> > > intel_miptree_release(&mt);
> > > return NULL;
> > > }
> > > @@ -1781,7 +1779,7 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
> > > return true;
> > > }
> > >
> > > -bool
> > > +static bool
> > > intel_miptree_alloc_ccs(struct brw_context *brw,
> > > struct intel_mipmap_tree *mt)
> > > {
> > > @@ -1902,7 +1900,7 @@ intel_miptree_alloc_hiz(struct brw_context *brw,
> > > * create the auxiliary surfaces up-front. CCS_D, on the other hand,
> > > can only
> > > * compress clear color so we wait until an actual fast-clear to
> > > allocate it.
> >
> > I started wondering if we should duplicate this piece of comment in the
> > callers as they now make that decision?
> >
>
> That's a good idea.
>
> /* Create the auxiliary surface up-front. CCS_D, on the other hand,
> * can only compress clear color so we wait until an actual
> * fast-clear to allocate it.
> */
>
I've added the comment to the two callers in intel_mipmap_tree.c and
appended the commit message with:
v2: Duplicate the delayed allocation comment (Topi Pohjolainen).
Please let me know if you'd like me to send the v2 to the list.
-Nanley
> -Nanley
>
> > > */
> > > -static bool
> > > +bool
> > > intel_miptree_alloc_aux(struct brw_context *brw,
> > > struct intel_mipmap_tree *mt)
> > > {
> > > @@ -1924,11 +1922,6 @@ intel_miptree_alloc_aux(struct brw_context *brw,
> > > return true;
> > >
> > > case ISL_AUX_USAGE_CCS_D:
> > > - /* Since CCS_D can only compress clear color so we wait until an
> > > actual
> > > - * fast-clear to allocate it.
> > > - */
> > > - return true;
> > > -
> > > case ISL_AUX_USAGE_CCS_E:
> > > assert(_mesa_is_format_color_format(mt->format));
> > > assert(mt->surf.samples == 1);
> > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > index 8cea562dfa4..9a5d97bf348 100644
> > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > @@ -379,7 +379,7 @@ struct intel_mipmap_tree
> > > };
> > >
> > > bool
> > > -intel_miptree_alloc_ccs(struct brw_context *brw,
> > > +intel_miptree_alloc_aux(struct brw_context *brw,
> > > struct intel_mipmap_tree *mt);
> > >
> > > enum intel_miptree_create_flags {
> > > --
> > > 2.16.2
> > >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > [email protected]
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev