Skip to content
  • Marek Olšák's avatar
    radeonsi: add new possibly faster command submission helpers · a0978fff
    Marek Olšák authored
    
    
    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: default avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
    Part-of: <!8653>
    a0978fff