[Mesa-dev] [PATCH 8/9] panfrost: Handle the bo == NULL case in panfrost_bo_[un]reference()

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Fri Aug 2 15:39:29 UTC 2019


> Was hitting a NULL pointer dereference when on the
> panfrost_bo_unreference(job->polygon_list) done in panfrost_free_job().
> Don't know having a NULL polygon_list is valid case (I guess that's
> possible for a job that does not involve the tiler) but I was facing
> this problem when running the deqp testsuite.

Ah, yeah. I'm not sure we actually hit that case -- and I don't know why
we would in ES2 -- but it can certainly happen in ES3. Compute-like
workloads (both honest-to-goodness compute shaders as well as rasterizer
discard to facilitate transform feedback) don't touch the tiler and thus
don't inherently need the polygon list. In OpenCL, there's no
framebuffer at all, right? :)

(There is still a stub SFBD allocated but whatever)

> > 
> > On Fri, Aug 02, 2019 at 12:12:56PM +0200, Boris Brezillon wrote:
> > > Allows us to pass BOs without checking if they're NULL or not.
> > > 
> > > Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> > > ---
> > >  src/gallium/drivers/panfrost/pan_resource.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
> > > index 71da383d4c7a..f74a39555b45 100644
> > > --- a/src/gallium/drivers/panfrost/pan_resource.c
> > > +++ b/src/gallium/drivers/panfrost/pan_resource.c
> > > @@ -443,12 +443,16 @@ panfrost_resource_create(struct pipe_screen *screen,
> > >  void
> > >  panfrost_bo_reference(struct panfrost_bo *bo)
> > >  {
> > > -        pipe_reference(NULL, &bo->reference);
> > > +        if (bo)
> > > +                pipe_reference(NULL, &bo->reference);
> > >  }
> > >  
> > >  void
> > >  panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
> > >  {
> > > +        if (!bo)
> > > +                return;
> > > +
> > >          /* When the reference count goes to zero, we need to cleanup */
> > >  
> > >          if (pipe_reference(&bo->reference, NULL))
> > > -- 
> > > 2.21.0
> > >   
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190802/df2014f6/attachment.sig>


More information about the mesa-dev mailing list