[Mesa-dev] [PATCH] panfrost: Make transient allocation rely on the BO cache

Boris Brezillon boris.brezillon at collabora.com
Sat Aug 31 17:25:35 UTC 2019


On Sat, 31 Aug 2019 19:21:04 +0200
Boris Brezillon <boris.brezillon at collabora.com> wrote:

> On Sat, 31 Aug 2019 17:10:47 +0100
> Daniel Stone <daniel at fooishbar.org> wrote:
> 
> > Hi Boris,
> > 
> > On Sat, 31 Aug 2019 at 11:47, Boris Brezillon
> > <boris.brezillon at collabora.com> wrote:  
> > > Right now, the transient memory allocator implements its own BO caching
> > > mechanism, which is not really needed since we already have a generic
> > > BO cache. Let's simplify things a bit.
> > >
> > > [...]
> > >
> > >          bool fits_in_current = (batch->transient_offset + sz) < TRANSIENT_SLAB_SIZE;
> > >
> > > +        if (likely(batch->transient_bo && fits_in_current)) {
> > > +                /* We can reuse the current BO, so get it */
> > > +                [...]
> > >          } else {
> > > -                /* Create a new BO and reference it */
> > > -                bo = panfrost_drm_create_bo(screen, ALIGN_POT(sz, 4096), 0);
> > > +                size_t bo_sz = sz < TRANSIENT_SLAB_SIZE ?
> > > +                               TRANSIENT_SLAB_SIZE : ALIGN_POT(sz, 4096);    
> > 
> > Should we record the size of the allocated transient BO here, so we
> > can use the whole BO for transients when we allocate more than the
> > slab size?  
> 
> Absolutely. I'll fix that.

Hm, that would require a few changes, and that's actually not really
related to this patch. But I can definitely have a follow-up patch that
does what you suggest.



More information about the mesa-dev mailing list