Mesa (master): radeonsi: add new possibly faster command submission helpers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 22 17:04:10 UTC 2021


Module: Mesa
Branch: master
Commit: a0978fffb849264ccb20e6b4905b9cf05ed17593
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0978fffb849264ccb20e6b4905b9cf05ed17593

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Jan  9 15:14:22 2021 -0500

radeonsi: add new possibly faster command submission helpers

This decreases the release libgallium_dri.so size without debug symbols
by 16384 bytes. The CPU time spent in si_emit_draw_packets decreased
from 4.5% to 4.1% in viewperf13/catia/plane01.

The previous code did:
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;
    cs->current.buf[cs->current.cdw++] = ...;

The new code does:
    unsigned num = cs->current.cdw;
    uint32_t *buf = cs->current.buf;
    buf[num++] = ...;
    buf[num++] = ...;
    buf[num++] = ...;
    buf[num++] = ...;
    cs->current.cdw = num;

The code is the same (radeon_emit is redefined as a macro) except that
all set and emit functions must be surrounded by radeon_begin(cs) and
radeon_end().

radeon_packets_added() returns whether there has been any new packets added
since radeon_begin.

radeon_end_update_context_roll(sctx) sets sctx->context_roll = true
if there has been any new packets added since radeon_begin.

For now, the "cs" parameter is intentionally unused in radeon_emit and
radeon_emit_array.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653>

---

 src/gallium/drivers/radeonsi/si_build_pm4.h        | 446 +++++++++++----------
 src/gallium/drivers/radeonsi/si_compute.c          |  21 +-
 .../drivers/radeonsi/si_compute_prim_discard.c     |  19 +
 src/gallium/drivers/radeonsi/si_cp_dma.c           |  10 +
 src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c |  12 +-
 src/gallium/drivers/radeonsi/si_descriptors.c      | 128 +++---
 src/gallium/drivers/radeonsi/si_fence.c            |   6 +
 src/gallium/drivers/radeonsi/si_gfx_cs.c           |  21 +
 src/gallium/drivers/radeonsi/si_perfcounter.c      |  17 +
 src/gallium/drivers/radeonsi/si_pm4.c              |   2 +
 src/gallium/drivers/radeonsi/si_query.c            |  24 +-
 src/gallium/drivers/radeonsi/si_sqtt.c             |  46 ++-
 src/gallium/drivers/radeonsi/si_state.c            |  39 +-
 src/gallium/drivers/radeonsi/si_state_binning.c    |  10 +-
 src/gallium/drivers/radeonsi/si_state_draw.cpp     |  56 ++-
 src/gallium/drivers/radeonsi/si_state_msaa.c       |   4 +
 src/gallium/drivers/radeonsi/si_state_shaders.c    |  77 ++--
 src/gallium/drivers/radeonsi/si_state_streamout.c  |  15 +-
 src/gallium/drivers/radeonsi/si_state_viewport.c   |  35 +-
 19 files changed, 593 insertions(+), 395 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=a0978fffb849264ccb20e6b4905b9cf05ed17593


More information about the mesa-commit mailing list