i965: Optimize batchbuffer macros

Graphics / Mesa 3D Graphics Library / Mesa - Matt Turner [gmail.com] - 15 July 2015 15:09 UTC

Previously OUT_BATCH was just a macro around an inline function which does

brw->batch.map[brw->batch.used++] = dword;

When making consecutive calls to intel_batchbuffer_emit_dword() the compiler isn't able to recognize that we're writing consecutive memory locations or that it doesn't need to write batch.used back to memory each time.

We can avoid both of these problems by making a local pointer to the next location in the batch in BEGIN_BATCH().

Cuts 18k from the .text size.

text data bss dec hex filename 4946956 195152 26192 5168300 4edcac i965_dri.so before 4928956 195152 26192 5150300 4e965c i965_dri.so after

This series (including commit c0433948) improves performance of Synmark OglBatch7 by 8.01389% +/- 0.63922% (n=83) on Ivybridge.

f11c6f0 i965: Optimize batchbuffer macros.
src/mesa/drivers/dri/i965/brw_context.h | 5 ++-
src/mesa/drivers/dri/i965/brw_draw_upload.c | 12 ++++--
src/mesa/drivers/dri/i965/brw_urb.c | 2 +-
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 19 +++++----
src/mesa/drivers/dri/i965/intel_batchbuffer.h | 55 +++++++++++++++++--------
src/mesa/drivers/dri/i965/intel_blit.c | 19 +++++----
6 files changed, 70 insertions(+), 42 deletions(-)

Upstream: cgit.freedesktop.org


  • Share