aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-03-20 10:46:20 -0700
committerEric Anholt <[email protected]>2013-04-01 16:17:25 -0700
commit2f41a601455e6e0366e28b6b84871842cb4bd341 (patch)
tree8721a3182e5ad2675e15db7fe512b0f8dc5a32ec /src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
parent8c694dfe6478ce9355c866ae70db45e49e499de3 (diff)
i965: Make the constant surface interface take a normal byte size.
This puts the rounding-up logic into the function itself instead of all the callers having to manage it. Also drop an "unused" comment in gen4, as the stride *is* used for texbos (and will be for uniforms soon). NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_wm_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen7_wm_surface_state.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index db04253af9c..484afcd2502 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -383,11 +383,13 @@ static void
gen7_create_constant_surface(struct brw_context *brw,
drm_intel_bo *bo,
uint32_t offset,
- int width,
+ uint32_t size,
uint32_t *out_offset)
{
struct intel_context *intel = &brw->intel;
- const GLint w = width - 1;
+ uint32_t stride = 16;
+ uint32_t elements = ALIGN(size, stride) / stride;
+ const GLint w = elements - 1;
uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
8 * 4, 32, out_offset);
@@ -403,7 +405,7 @@ gen7_create_constant_surface(struct brw_context *brw,
surf[2] = SET_FIELD(w & 0x7f, GEN7_SURFACE_WIDTH) |
SET_FIELD((w >> 7) & 0x1fff, GEN7_SURFACE_HEIGHT);
surf[3] = SET_FIELD((w >> 20) & 0x7f, BRW_SURFACE_DEPTH) |
- (16 - 1); /* stride between samples */
+ (stride - 1);
if (intel->is_haswell) {
surf[7] = SET_FIELD(HSW_SCS_RED, GEN7_SURFACE_SCS_R) |