summaryrefslogtreecommitdiff
path: root/src/sna/gen4_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-08-01 01:17:50 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-01 11:01:38 +0100
commit33c028f8be829caa4fdb9416ff177dc71f24b68e (patch)
tree74b241ab22a36167f6b26c9ae224deb74780c72b /src/sna/gen4_render.c
parent9b2873d3d97b6780d878bd9b821fba0302470f9f (diff)
sna/gen6+: Reduce floats-per-vertex for spans
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.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index d8beed97..35dacd0c 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -279,6 +279,7 @@ static int gen4_vertex_finish(struct sna *sna)
unsigned int i;
assert(sna->render.vertex_used);
+ assert(sna->render.nvertex_reloc);
/* Note: we only need dword alignment (currently) */
@@ -286,21 +287,18 @@ static int gen4_vertex_finish(struct sna *sna)
if (bo) {
gen4_vertex_flush(sna);
- for (i = 0; i < ARRAY_SIZE(sna->render.vertex_reloc); i++) {
- if (sna->render.vertex_reloc[i]) {
- DBG(("%s: reloc[%d] = %d\n", __FUNCTION__,
- i, sna->render.vertex_reloc[i]));
-
- sna->kgem.batch[sna->render.vertex_reloc[i]] =
- kgem_add_reloc(&sna->kgem,
- sna->render.vertex_reloc[i],
- bo,
- I915_GEM_DOMAIN_VERTEX << 16,
- 0);
- sna->render.vertex_reloc[i] = 0;
- }
+ for (i = 0; i < sna->render.nvertex_reloc; i++) {
+ DBG(("%s: reloc[%d] = %d\n", __FUNCTION__,
+ i, sna->render.vertex_reloc[i]));
+
+ sna->kgem.batch[sna->render.vertex_reloc[i]] =
+ kgem_add_reloc(&sna->kgem,
+ sna->render.vertex_reloc[i], bo,
+ I915_GEM_DOMAIN_VERTEX << 16,
+ 0);
}
+ sna->render.nvertex_reloc = 0;
sna->render.vertex_used = 0;
sna->render.vertex_index = 0;
sna->render_state.gen4.vb_id = 0;
@@ -335,13 +333,12 @@ static void gen4_vertex_close(struct sna *sna)
unsigned int i, delta = 0;
assert(sna->render_state.gen4.vertex_offset == 0);
+ if (!sna->render_state.gen4.vb_id)
+ return;
DBG(("%s: used=%d, vbo active? %d\n",
__FUNCTION__, sna->render.vertex_used, sna->render.vbo != NULL));
- if (!sna->render.vertex_used)
- return;
-
bo = sna->render.vbo;
if (bo) {
if (sna->render.vertex_size - sna->render.vertex_used < 64) {
@@ -386,20 +383,18 @@ static void gen4_vertex_close(struct sna *sna)
}
}
- for (i = 0; i < ARRAY_SIZE(sna->render.vertex_reloc); i++) {
- if (sna->render.vertex_reloc[i]) {
- DBG(("%s: reloc[%d] = %d\n", __FUNCTION__,
- i, sna->render.vertex_reloc[i]));
+ assert(sna->render.nvertex_reloc);
+ for (i = 0; i < sna->render.nvertex_reloc; i++) {
+ DBG(("%s: reloc[%d] = %d\n", __FUNCTION__,
+ i, sna->render.vertex_reloc[i]));
- sna->kgem.batch[sna->render.vertex_reloc[i]] =
- kgem_add_reloc(&sna->kgem,
- sna->render.vertex_reloc[i],
- bo,
- I915_GEM_DOMAIN_VERTEX << 16,
- delta);
- sna->render.vertex_reloc[i] = 0;
- }
+ sna->kgem.batch[sna->render.vertex_reloc[i]] =
+ kgem_add_reloc(&sna->kgem,
+ sna->render.vertex_reloc[i], bo,
+ I915_GEM_DOMAIN_VERTEX << 16,
+ delta);
}
+ sna->render.nvertex_reloc = 0;
if (sna->render.vbo == NULL) {
sna->render.vertex_used = 0;
@@ -990,7 +985,7 @@ static void gen4_emit_vertex_buffer(struct sna *sna,
OUT_BATCH(GEN4_3DSTATE_VERTEX_BUFFERS | 3);
OUT_BATCH((id << VB0_BUFFER_INDEX_SHIFT) | VB0_VERTEXDATA |
(4*op->floats_per_vertex << VB0_BUFFER_PITCH_SHIFT));
- sna->render.vertex_reloc[id] = sna->kgem.nbatch;
+ sna->render.vertex_reloc[sna->render.nvertex_reloc++] = sna->kgem.nbatch;
OUT_BATCH(0);
OUT_BATCH(0);
OUT_BATCH(0);