[Mesa-dev] [PATCH] panfrost: Make transient allocation rely on the BO cache
Daniel Stone
daniel at fooishbar.org
Sat Aug 31 16:10:47 UTC 2019
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?
Cheers,
Daniel
More information about the mesa-dev
mailing list