i965: Refactor Gen4-6 SURFACE_STATE setup for buffer surfaces.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 14 Sep 2013 03:12:56 +0000 (20:12 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 19 Sep 2013 17:52:58 +0000 (10:52 -0700)
commitb6b549ccfc6f71f94ba58892b0506ca5cd7b4a7c
treee8f7f1751836919798c836f908348b0203054bbe
parente114cbff966b8cee77b6d9e2ecf99c35116ae1ae
i965: Refactor Gen4-6 SURFACE_STATE setup for buffer surfaces.

This was an embarassingly large amount of copy and pasted code,
and it wasn't particularly simple code either.  By factoring it out
into a helper function, we consolidate the complexity.

v2: Properly NULL-check bo.  Caught by Eric Anholt.
v3: Do the subtraction by 1 in gen7_emit_buffer_surface_state, rather
    than making callers do it.  This makes the buffer_size parameter
    the actual size of the buffer.  Suggested by Paul Berry.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c