[Mesa-dev] [PATCH v2 00/37] panfrost: Support batch pipelining

Alyssa Rosenzweig alyssa at rosenzweig.io
Mon Sep 16 20:29:05 UTC 2019


> As a drive-by comment, in case you didn't know, the "standard"
> solution for avoiding flushing when BO's are written by the CPU (e.g.
> uniform buffer updates) as documented in ARM's performance guide is to
> add a copy-on-write mechanism, so that you have "shadow" BO's when the
> original BO is modified by the user. I believe this is implemented in
> freedreno, at least there was a talk about it at XDC a few years ago.

Yes, this is implemented in freedreno. BO shadowing will be the next
step once this pipelining code settles down. For now, this series is
about eliminating the strict flushes between each and every frame of
each and every FBO that we currently occur now.

Boris, references on the freedreno model (which is the mesa gold
standard):

https://www.x.org/wiki/Events/XDC2016/Program/clark_ooo_rendering.pdf
https://bloggingthemonkey.blogspot.com/2016/07/dirty-tricks-for-moar-fps.html

The former presentation is definitely worth a read; evidently we've
already painted ourselves into some corners :p

> 
> On Mon, Sep 16, 2019 at 4:37 PM Boris Brezillon
> <boris.brezillon at collabora.com> wrote:
> >
> > Hello,
> >
> > This is the second attempt at supporting batch pipelining. This time I
> > implemented it using a dependency graph (as suggested by Alyssa and
> > Steven) so that batch submission can be delayed even more: the only
> > time we flush batches now is when we have an explicit flush or when
> > the CPU needs to access a BO (we might want to tweak that a bit to
> > avoid the extra latency incurred by this solution). With that in place
> > we hope to increase GPU utilization.
> >
> > A few words about the patches in this series:
> >
> > * Like the previous version, this series is a mix of cleanups and
> >   functional changes. Most of them should be pretty trivial to review
> >   and I intend to merge them independently once they have receive
> >   proper review (to avoid having to send another patch bomb like this
> >   one).
> >
> > * The "rework BO API" batch has been split to ease review
> >
> > * Patches 35 and 36 are not mandatory, but I remember reading (I think
> >   it was Steven who mentioned that) that draw order matters when
> >   queueing render operations for different frames (frame N should
> >   ideally be ready before frame N+1). Not sure if enforcing draw call
> >   order is enough to guarantee that rendering of frame N always
> >   finishes before frame N+1 though.
> >
> > Regards,
> >
> > Boris
> >
> > Boris Brezillon (37):
> >   panfrost: Stop exposing internal panfrost_*_batch() functions
> >   panfrost: Use the correct type for the bo_handle array
> >   panfrost: Add missing panfrost_batch_add_bo() calls
> >   panfrost: Add polygon_list to the batch BO set at allocation time
> >   panfrost: Kill a useless memset(0) in panfrost_create_context()
> >   panfrost: Stop passing has_draws to panfrost_drm_submit_vs_fs_batch()
> >   panfrost: Get rid of pan_drm.c
> >   panfrost: Move panfrost_bo_{reference,unreference}() to pan_bo.c
> >   panfrost: s/PAN_ALLOCATE_/PAN_BO_/
> >   panfrost: Move the BO API to its own header
> >   panfrost: Stop exposing panfrost_bo_cache_{fetch,put}()
> >   panfrost: Don't check if BO is mmaped before calling
> >     panfrost_bo_mmap()
> >   panfrost: Stop passing screen around for BO operations
> >   panfrost: Stop using panfrost_bo_release() outside of pan_bo.c
> >   panfrost: Add panfrost_bo_{alloc,free}()
> >   panfrost: Don't return imported/exported BOs to the cache
> >   panfrost: Make sure the BO is 'ready' when picked from the cache
> >   panfrost: Add flags to reflect the BO imported/exported state
> >   panfrost: Add the panfrost_batch_create_bo() helper
> >   panfrost: Add FBO BOs to batch->bos earlier
> >   panfrost: Allocate tiler and scratchpad BOs per-batch
> >   panfrost: Extend the panfrost_batch_add_bo() API to pass access flags
> >   panfrost: Make panfrost_batch->bos a hash table
> >   panfrost: Cache GPU accesses to BOs
> >   panfrost: Add a batch fence
> >   panfrost: Use the per-batch fences to wait on the last submitted batch
> >   panfrost: Add a panfrost_freeze_batch() helper
> >   panfrost: Start tracking inter-batch dependencies
> >   panfrost: Prepare panfrost_fence for batch pipelining
> >   panfrost: Add a panfrost_flush_all_batches() helper
> >   panfrost: Add a panfrost_flush_batches_accessing_bo() helper
> >   panfrost: Kill the explicit serialization in panfrost_batch_submit()
> >   panfrost: Get rid of the flush in panfrost_set_framebuffer_state()
> >   panfrost: Do fine-grained flushing when preparing BO for CPU accesses
> >   panfrost: Rename ctx->batches into ctx->fbo_to_batch
> >   panfrost: Take draw call order into account
> >   panfrost/ci: New tests are passing
> >
> >  .../drivers/panfrost/ci/expected-failures.txt |   4 -
> >  src/gallium/drivers/panfrost/meson.build      |   1 -
> >  src/gallium/drivers/panfrost/pan_allocate.c   |  22 +-
> >  src/gallium/drivers/panfrost/pan_allocate.h   |  20 -
> >  src/gallium/drivers/panfrost/pan_assemble.c   |   3 +-
> >  src/gallium/drivers/panfrost/pan_blend_cso.c  |  13 +-
> >  src/gallium/drivers/panfrost/pan_bo.c         | 331 +++++++-
> >  src/gallium/drivers/panfrost/pan_bo.h         | 130 +++
> >  src/gallium/drivers/panfrost/pan_compute.c    |   2 +-
> >  src/gallium/drivers/panfrost/pan_context.c    | 175 ++--
> >  src/gallium/drivers/panfrost/pan_context.h    |  22 +-
> >  src/gallium/drivers/panfrost/pan_drm.c        | 394 ---------
> >  src/gallium/drivers/panfrost/pan_fragment.c   |   3 -
> >  src/gallium/drivers/panfrost/pan_instancing.c |   6 +-
> >  src/gallium/drivers/panfrost/pan_job.c        | 760 ++++++++++++++++--
> >  src/gallium/drivers/panfrost/pan_job.h        |  85 +-
> >  src/gallium/drivers/panfrost/pan_mfbd.c       |   1 +
> >  src/gallium/drivers/panfrost/pan_resource.c   |  65 +-
> >  src/gallium/drivers/panfrost/pan_resource.h   |   6 -
> >  src/gallium/drivers/panfrost/pan_screen.c     |  91 ++-
> >  src/gallium/drivers/panfrost/pan_screen.h     |  62 +-
> >  src/gallium/drivers/panfrost/pan_sfbd.c       |   1 +
> >  src/gallium/drivers/panfrost/pan_varyings.c   |   6 +-
> >  23 files changed, 1456 insertions(+), 747 deletions(-)
> >  create mode 100644 src/gallium/drivers/panfrost/pan_bo.h
> >  delete mode 100644 src/gallium/drivers/panfrost/pan_drm.c
> >
> > --
> > 2.21.0
> >
> > _______________________________________________
> > 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