summaryrefslogtreecommitdiff
path: root/src/sna/gen3_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-08-19 19:17:35 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-19 20:56:13 +0100
commit7bf7a5ad1057f1aeb5b261da6dc501323c022287 (patch)
tree9400c6c613cc450b4c69218ef09b13144ac91385 /src/sna/gen3_render.c
parentd1b808fd72b477bde96f7c6737a993bd1a20baf2 (diff)
sna/gen3: Tidy vbo discard
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen3_render.c')
-rw-r--r--src/sna/gen3_render.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 5b0894ec..48f104e4 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -1652,6 +1652,7 @@ static int gen3_vertex_finish(struct sna *sna)
sna->render.vbo = NULL;
return 0;
}
+ assert(sna->render.vbo->snoop == false);
if (sna->render.vertex_used) {
memcpy(sna->render.vertices,
@@ -1710,10 +1711,12 @@ static void gen3_vertex_close(struct sna *sna)
sna->render.vertex_used));
bo = kgem_create_linear(&sna->kgem,
4*sna->render.vertex_used, 0);
- if (bo)
+ if (bo) {
+ assert(sna->render.vbo->snoop == false);
kgem_bo_write(&sna->kgem, bo,
sna->render.vertex_data,
4*sna->render.vertex_used);
+ }
free_bo = bo;
}
}
@@ -1967,9 +1970,10 @@ gen3_render_reset(struct sna *sna)
state->last_vertex_offset = 0;
state->vertex_offset = 0;
- if (sna->render.vbo &&
+ if (sna->render.vbo != NULL &&
!kgem_bo_is_mappable(&sna->kgem, sna->render.vbo)) {
- DBG(("%s: discarding unmappable vbo\n", __FUNCTION__));
+ DBG(("%s: discarding vbo as next access will stall: %d\n",
+ __FUNCTION__, sna->render.vbo->presumed_offset));
discard_vbo(sna);
}
}
@@ -1980,7 +1984,8 @@ gen3_render_retire(struct kgem *kgem)
struct sna *sna;
sna = container_of(kgem, struct sna, kgem);
- if (kgem->nbatch == 0 && sna->render.vbo && !kgem_bo_is_busy(sna->render.vbo)) {
+ if (sna->render.vertex_reloc[0] == 0 &&
+ sna->render.vbo && !kgem_bo_is_busy(sna->render.vbo)) {
DBG(("%s: resetting idle vbo\n", __FUNCTION__));
sna->render.vertex_used = 0;
sna->render.vertex_index = 0;