[Mesa-dev] [PATCH] panfrost: Reset the damage area on imported resources

Boris Brezillon boris.brezillon at collabora.com
Wed Aug 28 15:02:43 UTC 2019


On Wed, 28 Aug 2019 07:59:21 -0700
Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com> wrote:

> R-b

For the record, that was the reason for those damage_width/height = 0
situations you fixed in 0c5633036195 ("panfrost: Workaround bug in
partial update implementation").


> 
> On Wed, Aug 28, 2019 at 04:53:15PM +0200, Boris Brezillon wrote:
> > Reset the damage area in the resource_from_handle() path (as done in
> > panfrost_resource_create()).
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> > ---
> >  src/gallium/drivers/panfrost/pan_resource.c | 23 +++++++++++----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> > 
> > diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
> > index 1f5b23145cf3..57df61cb71cc 100644
> > --- a/src/gallium/drivers/panfrost/pan_resource.c
> > +++ b/src/gallium/drivers/panfrost/pan_resource.c
> > @@ -47,6 +47,17 @@
> >  #include "pan_util.h"
> >  #include "pan_tiling.h"
> >  
> > +static void
> > +panfrost_resource_reset_damage(struct panfrost_resource *pres)
> > +{
> > +        /* We set the damage extent to the full resource size but keep the
> > +         * damage box empty so that the FB content is reloaded by default.
> > +         */
> > +        memset(&pres->damage, 0, sizeof(pres->damage));
> > +        pres->damage.extent.maxx = pres->base.width0;
> > +        pres->damage.extent.maxy = pres->base.height0;
> > +}
> > +
> >  static struct pipe_resource *
> >  panfrost_resource_from_handle(struct pipe_screen *pscreen,
> >                                const struct pipe_resource *templat,
> > @@ -73,6 +84,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
> >          rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
> >          rsc->slices[0].stride = whandle->stride;
> >          rsc->slices[0].initialized = true;
> > +        panfrost_resource_reset_damage(rsc);
> >  
> >          if (screen->ro) {
> >                  rsc->scanout =
> > @@ -403,17 +415,6 @@ panfrost_resource_create_bo(struct panfrost_screen *screen, struct panfrost_reso
> >          pres->bo = panfrost_drm_create_bo(screen, bo_size, PAN_ALLOCATE_DELAY_MMAP);
> >  }
> >  
> > -static void
> > -panfrost_resource_reset_damage(struct panfrost_resource *pres)
> > -{
> > -        /* We set the damage extent to the full resource size but keep the
> > -         * damage box empty so that the FB content is reloaded by default.
> > -         */
> > -        memset(&pres->damage, 0, sizeof(pres->damage));
> > -        pres->damage.extent.maxx = pres->base.width0;
> > -        pres->damage.extent.maxy = pres->base.height0;
> > -}
> > -
> >  void
> >  panfrost_resource_set_damage_region(struct pipe_screen *screen,
> >                                      struct pipe_resource *res,
> > -- 
> > 2.21.0
> >   



More information about the mesa-dev mailing list