summaryrefslogtreecommitdiff
path: root/src/sna/gen6_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-05-07 10:23:19 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-05-08 14:30:46 +0100
commitca4d2296e6e42e837627756790b262cae0fd3b6c (patch)
treee19b474ba4ecf026fc66c87518310d2ab1a36d02 /src/sna/gen6_render.c
parent9281b80644ce76ad9e0f3f8f812cbae97c10814a (diff)
sna: Expand batch buffers
As batch buffers are compacted to fit into the smallest bo, the only cost is the larger static array allocation (and presumably cache misses). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen6_render.c')
-rw-r--r--src/sna/gen6_render.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 55673bf3..1613749f 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1198,21 +1198,16 @@ gen6_bind_bo(struct sna *sna,
DBG(("[%x] bo(handle=%d), format=%d, reuse %s binding\n",
offset, bo->handle, format,
domains & 0xffff ? "render" : "sampler"));
- return offset;
+ return offset * sizeof(uint32_t);
}
- offset = sna->kgem.surface - sizeof(struct gen6_surface_state_padded) / sizeof(uint32_t);
- offset *= sizeof(uint32_t);
-
- sna->kgem.surface -=
+ offset = sna->kgem.surface -=
sizeof(struct gen6_surface_state_padded) / sizeof(uint32_t);
- ss = sna->kgem.batch + sna->kgem.surface;
+ ss = sna->kgem.batch + offset;
ss[0] = (GEN6_SURFACE_2D << GEN6_SURFACE_TYPE_SHIFT |
GEN6_SURFACE_BLEND_ENABLED |
format << GEN6_SURFACE_FORMAT_SHIFT);
- ss[1] = kgem_add_reloc(&sna->kgem,
- sna->kgem.surface + 1,
- bo, domains, 0);
+ ss[1] = kgem_add_reloc(&sna->kgem, offset + 1, bo, domains, 0);
ss[2] = ((width - 1) << GEN6_SURFACE_WIDTH_SHIFT |
(height - 1) << GEN6_SURFACE_HEIGHT_SHIFT);
assert(bo->pitch <= (1 << 18));
@@ -1228,7 +1223,7 @@ gen6_bind_bo(struct sna *sna,
format, width, height, bo->pitch, bo->tiling,
domains & 0xffff ? "render" : "sampler"));
- return offset;
+ return offset * sizeof(uint32_t);
}
fastcall static void