freedreno: support growable cmdstream buffers

Graphics / Mesa 3D Graphics Library / libdrm - Rob Clark [freedesktop.org] - 20 July 2016 18:42 UTC

The issue that userspace needed to solve is that there is ~two orders of magnitude size difference in cmdstream buffers (both for gmem commands and for draw commands), and that the previous practice of allocating worst-case sizes is quite wasteful. Previously a submit would be constructed (for example) like:

CMD TARGET DESCRIPTION g0 N gmem/tiling commands b0 Y binning commands d0 Y draw commands

Which, after the one non-IB-target cmd buffer is inserted into the kernel controlled ringbuffer, looks like (not to scale):

b0: d0: +-----+ +-----+ IB1 | ... | | ... | +-----+ +-----+ ^ ^ | | +-----+ +-+---------+ g0: | | | +----+----+----+----+----+----+----IB0 | .. | IB | .. | IB | .. | IB | ... +----+----+----+----+----+----+----^ tile0 tile1 | +-----------+ userspace | ~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel |----+----+----ringbuffer ... | IB | ...----+----+----

Now, multiple physical cmdstream buffers per fd_ringbuffer are supported, so this becomes:

CMD TARGET DESCRIPTION g0 N ... N gmem/tiling commands gN N b0 Y ... Y binning commands bN Y d0 Y ... Y draw commands dN Y

Which, after the non-IB-target cmd buffers (g0..gN) are inserted into the kernel controlled ringbuffer, looks like:

b0: b1 d0: d1 +-----+ +-----+ +-----+ +-----+ IB1 | ... | | ... | ... | ... | | ... | ... +-----+ +-----+ +-----+ +-----+ ^ ^ ^ ^ | | | | | +-+ | +-----+------+ +-----+ | | | | | | +--+----------+ | g0: | | | | | | +----+----+----+----+----+----+---+----+----+----IB0 | .. | IB | IB | .. | IB | IB |.. | IB | IB |... +----+----+----+----+----+----+---+----+----+----^ tile0 tile1 | to b0 to b1 | | | to|d0 to|d1 | | +----+ | +-+-----------+ | | | | | | | +------+ | +-+-------------+ | | g1: | | | | | | | +----+----+----+----+----+----+---+----+----+----IB0 | | .. | IB | IB | .. | IB | IB |.. | IB | IB |... | +----+----+----+----+----+----+---+----+----+----| ^ tileX tileY | | | +-----------+ +-----------+ | userspace | | ~~~~~~~~~~~~~~~~~~~|~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel | |----+----+----+----ringbuffer ... | IB | IB | ...----+----+----+----

419a154 freedreno: support growable cmdstream buffers
freedreno/freedreno_priv.h | 6 +-
freedreno/freedreno_ringbuffer.c | 32 ++++++--
freedreno/freedreno_ringbuffer.h | 2 +
freedreno/kgsl/kgsl_ringbuffer.c | 7 +-
freedreno/msm/msm_ringbuffer.c | 155 +++++++++++++++++++++++++++++++-------
5 files changed, 166 insertions(+), 36 deletions(-)

Upstream: cgit.freedesktop.org


  • Share