[Mesa-dev] [PATCH 18/27] i965/miptree: Add a return for updating of winsys

Pohjolainen, Topi topi.pohjolainen at gmail.com
Mon Jan 2 07:51:16 UTC 2017


On Sat, Dec 31, 2016 at 02:40:42PM -0800, Ben Widawsky wrote:
> On 16-12-10 15:39:12, Pohjolainen, Topi wrote:
> > On Thu, Dec 01, 2016 at 02:09:59PM -0800, Ben Widawsky wrote:
> > > From: Ben Widawsky <ben at bwidawsk.net>
> > > 
> > > There is nothing particularly useful to do currently if the update
> > > fails, but there is no point carrying on either. As a result, this has a
> > > behavior change.
> > > 
> > > Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
> > > ---
> > >  src/mesa/drivers/dri/i965/brw_context.c       | 14 ++++++++------
> > >  src/mesa/drivers/dri/i965/intel_mipmap_tree.c |  6 +++---
> > >  src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  2 +-
> > >  3 files changed, 12 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> > > index b928f94..593fa67 100644
> > > --- a/src/mesa/drivers/dri/i965/brw_context.c
> > > +++ b/src/mesa/drivers/dri/i965/brw_context.c
> > > @@ -1645,9 +1645,10 @@ intel_process_dri2_buffer(struct brw_context *brw,
> > >        return;
> > >     }
> > > 
> > > -   intel_update_winsys_renderbuffer_miptree(brw, rb, bo,
> > > -                                            drawable->w, drawable->h,
> > > -                                            buffer->pitch);
> > > +   if (intel_update_winsys_renderbuffer_miptree(brw, rb, bo,
> > > +                                                drawable->w, drawable->h,
> > > +                                                buffer->pitch))
> > > +      return;
> > > 
> > >     if (_mesa_is_front_buffer_drawing(fb) &&
> > >         (buffer->attachment == __DRI_BUFFER_FRONT_LEFT ||
> > > @@ -1703,9 +1704,10 @@ intel_update_image_buffer(struct brw_context *intel,
> > >     if (last_mt && last_mt->bo == buffer->bo)
> > >        return;
> > > 
> > > -   intel_update_winsys_renderbuffer_miptree(intel, rb, buffer->bo,
> > > -                                            buffer->width, buffer->height,
> > > -                                            buffer->pitch);
> > > +   if (intel_update_winsys_renderbuffer_miptree(intel, rb, buffer->bo,
> > > +                                                buffer->width, buffer->height,
> > > +                                                buffer->pitch))
> > > +      return;
> > > 
> > >     if (_mesa_is_front_buffer_drawing(fb) &&
> > >         buffer_type == __DRI_IMAGE_BUFFER_FRONT &&
> > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > index d002546..74db507 100644
> > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > > @@ -908,7 +908,7 @@ intel_miptree_create_for_image(struct brw_context *intel,
> > >   * that will contain the actual rendering (which is lazily resolved to
> > >   * irb->singlesample_mt).
> > >   */
> > > -void
> > > +int
> > 
> > We don't seem to use "zero for success"-style at least in i965. Could you
> > change this to bool and flip the check earlier for consistency?
> > 
> 
> What do you mean by flip the check earlier?

Just the intel_update_winsys_renderbuffer_miptree() return value check, sorry
for confusing (that is obvious of course without saying).

> 
> > >  intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
> > >                                           struct intel_renderbuffer *irb,
> > >                                           drm_intel_bo *bo,
> > > @@ -974,12 +974,12 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
> > >           irb->mt = multisample_mt;
> > >        }
> > >     }
> > > -   return;
> > > +   return 0;
> > > 
> > >  fail:
> > >     intel_miptree_release(&irb->singlesample_mt);
> > >     intel_miptree_release(&irb->mt);
> > > -   return;
> > > +   return -1;
> > >  }
> > > 
> > >  struct intel_mipmap_tree*
> > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > index 7b9a7be..85fe118 100644
> > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > > @@ -726,7 +726,7 @@ intel_miptree_create_for_image(struct brw_context *intel,
> > >                                 uint32_t pitch,
> > >                                 uint32_t layout_flags);
> > > 
> > > -void
> > > +int
> > >  intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
> > >                                           struct intel_renderbuffer *irb,
> > >                                           drm_intel_bo *bo,
> > > --
> > > 2.10.2
> > > 
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list