[Mesa-dev] [PATCH 00/15] R600g cleanup and rework of cache flushing

Marek Olšák maraeo at gmail.com
Mon Jan 30 12:23:03 PST 2012


Hi everyone,

This patch series is a follow-up to the previous one ("Remove all uses of the register mask"). First, it cleans up some code and merges r600_context into r600_pipe_context. The split of functionality between the two "contexts" made absolutely no sense.

Next, it adds a new mechanism for emitting states. It's largely inspired by r300g and it's really simple, yet robust. (some people should seriously learn what "polymorphism" means and how it's used to write software before even writing drivers, because I feel like I am the only one making use of it in r600g, which is really a shame /rant) It can be used to schedule *any* commands for execution before the next draw operation, not just register updates. We'll use that more often in the future. For now, it's only used for cache flushes.

Finally, this series completely reworks cache flushes. The problem with the old code was that the flags "last_flush" and "binding", which were stored in resource structs, were possible causes of race conditions. Not only does this new code fix that, it also simplifies the whole thing. The flushes are done explicitly when states are changed according to this scheme:
bind_shader -> r600_inval_shader_cache
set_constant_buffer -> r600_inval_shader_cache
bind_vertex_elements -> r600_inval_shader_cache (for the fetch shader)
bind_vertex_buffers -> r600_inval_vertex_cache
bind_sampler_views -> r600_inval_texture_cache
set_framebuffer -> r600_flush_framebuffer
flush -> r600_flush_framebuffer

Besides that, SURFACE_SYNC is called at most once between draw operations and flushes the whole memory range. The inval/flush functions only accumulate the flush flags.

The rework also fixes flushes on RV670. The fbo-drawbuffers test no longer causes issues. Flushing CB1_DEST_BASE was not enough, DEST_BASE_0 must be flushed as well. This fixes 21 piglit tests on RV670. The flushing seems to be fixed finally, but the piglit results are not yet up to par with RV730.

All this code has been tested on RV670, RV730, and REDWOOD.

Please review.

It's also available at:
  git://people.freedesktop.org/~mareko/mesa r600-big-cleanup

Marek Olšák (15):
     r600g: remove u8,u16,u32,u64 types
     r600g: merge r600_context with r600_pipe_context
     r600g: don't initialize the screen and winsys pointer twice
     r600g: remove the now-useless internal flush callback
     r600g: consolidate some context_draw code
     r600g: remove redundant pm4 and pm4_cdwords in r600_context
     r600g: add a new simple API for state emission
     r600g: rework cache flushing
     r600g: remove unused flush code
     r600g: remove dead code for tracking relocations
     r600g: remove more dead code
     r600g: remove unused r600_reg::flush_mask
     r600g: fix computation of how many dwords is needed for a flush at the end of CS
     r600g: rename r600_reg::flush_flags -> sbu_flags
     r600g: use the new code for streamout flush as well

 src/gallium/drivers/r600/evergreen_hw_context.c | 1755 +++++++++++------------
 src/gallium/drivers/r600/evergreen_state.c      |  106 +-
 src/gallium/drivers/r600/r600.h                 |  108 +-
 src/gallium/drivers/r600/r600_asm.c             |    8 +-
 src/gallium/drivers/r600/r600_asm.h             |   10 +-
 src/gallium/drivers/r600/r600_blit.c            |   26 +-
 src/gallium/drivers/r600/r600_buffer.c          |   18 +-
 src/gallium/drivers/r600/r600_hw_context.c      | 1369 ++++++++----------
 src/gallium/drivers/r600/r600_hw_context_priv.h |   22 +-
 src/gallium/drivers/r600/r600_pipe.c            |   34 +-
 src/gallium/drivers/r600/r600_pipe.h            |  130 ++-
 src/gallium/drivers/r600/r600_query.c           |   38 +-
 src/gallium/drivers/r600/r600_resource.c        |    2 +-
 src/gallium/drivers/r600/r600_resource.h        |    4 +-
 src/gallium/drivers/r600/r600_shader.c          |   20 +-
 src/gallium/drivers/r600/r600_state.c           |  110 +-
 src/gallium/drivers/r600/r600_state_common.c    |  223 ++-
 src/gallium/drivers/r600/r600_texture.c         |    8 +-
 src/gallium/drivers/r600/r600_translate.c       |    2 +-
 src/gallium/drivers/r600/r600d.h                |    1 +
 src/gallium/winsys/radeon/drm/radeon_drm_bo.h   |    4 -
 src/gallium/winsys/radeon/drm/radeon_winsys.h   |   10 +-
 22 files changed, 1961 insertions(+), 2047 deletions(-)

Marek


More information about the mesa-dev mailing list