summaryrefslogtreecommitdiff
path: root/src/sna/gen4_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/gen4_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/gen4_render.c')
-rw-r--r--src/sna/gen4_render.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 01651a51..86e9ff86 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -745,7 +745,7 @@ static bool gen4_check_repeat(PicturePtr picture)
* Sets up the common fields for a surface state buffer for the given
* picture in the given surface state buffer.
*/
-static int
+static uint32_t
gen4_bind_bo(struct sna *sna,
struct kgem_bo *bo,
uint32_t width,
@@ -766,14 +766,11 @@ gen4_bind_bo(struct sna *sna,
offset = kgem_bo_get_binding(bo, format);
if (offset)
- return offset;
-
- offset = sna->kgem.surface - sizeof(struct gen4_surface_state_padded) / sizeof(uint32_t);
- offset *= sizeof(uint32_t);
+ return offset * sizeof(uint32_t);
- sna->kgem.surface -=
+ offset = sna->kgem.surface -=
sizeof(struct gen4_surface_state_padded) / sizeof(uint32_t);
- ss = memset(sna->kgem.batch + sna->kgem.surface, 0, sizeof(*ss));
+ ss = memset(sna->kgem.batch + offset, 0, sizeof(*ss));
ss->ss0.surface_type = GEN4_SURFACE_2D;
ss->ss0.surface_format = format;
@@ -781,9 +778,7 @@ gen4_bind_bo(struct sna *sna,
ss->ss0.data_return_format = GEN4_SURFACERETURNFORMAT_FLOAT32;
ss->ss0.color_blend = 1;
ss->ss1.base_addr =
- kgem_add_reloc(&sna->kgem,
- sna->kgem.surface + 1,
- bo, domains, 0);
+ kgem_add_reloc(&sna->kgem, offset + 1, bo, domains, 0);
ss->ss2.height = height - 1;
ss->ss2.width = width - 1;
@@ -798,7 +793,7 @@ gen4_bind_bo(struct sna *sna,
ss->ss0.surface_format, width, height, bo->pitch, bo->tiling,
domains & 0xffff ? "render" : "sampler"));
- return offset;
+ return offset * sizeof(uint32_t);
}
fastcall static void