summaryrefslogtreecommitdiff
path: root/src/sna/gen6_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-09 10:32:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-09 11:15:24 +0100
commitd1cb39d0a86390b7ef704422a5b91f9a012d24a5 (patch)
treea61508cbaedb2bf9bb0320f72086bcec9f9c005d /src/sna/gen6_render.c
parent38333443b804b9ac6517a7998551b229dc4d5c6c (diff)
sna/gen3+: Flush vertex buffer after computing resize
Upon aligning the buffer, we may enlarge the vbo to accomodate the vertex alignment and push the current index past the end of the buffer. Move the space check from before the alignment computation to afterwards. Reported-by: Jiri Slaby <jirislaby@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=47597 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.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index e5e07ce1..ee1686fc 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1312,16 +1312,10 @@ gen6_align_vertex(struct sna *sna, const struct sna_composite_op *op)
{
assert (sna->render.vertex_offset == 0);
if (op->floats_per_vertex != sna->render_state.gen6.floats_per_vertex) {
- if (sna->render.vertex_size - sna->render.vertex_used < 2*op->floats_per_rect)
- gen4_vertex_finish(sna);
-
- DBG(("aligning vertex: was %d, now %d floats per vertex, %d->%d\n",
+ DBG(("aligning vertex: was %d, now %d floats per vertex\n",
sna->render_state.gen6.floats_per_vertex,
- op->floats_per_vertex,
- sna->render.vertex_index,
- (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex));
- sna->render.vertex_index = (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex;
- sna->render.vertex_used = sna->render.vertex_index * op->floats_per_vertex;
+ op->floats_per_vertex));
+ gen4_vertex_align(sna, op);
sna->render_state.gen6.floats_per_vertex = op->floats_per_vertex;
}
assert((sna->render.vertex_used % op->floats_per_vertex) == 0);
@@ -1649,8 +1643,8 @@ gen6_render_video(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen6_emit_video_state(sna, &tmp);
gen6_align_vertex(sna, &tmp);
+ gen6_emit_video_state(sna, &tmp);
/* Set up the offset for translating from the given region (in screen
* coordinates) to the backing pixmap.
@@ -2399,8 +2393,8 @@ gen6_render_composite(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen6_emit_composite_state(sna, tmp);
gen6_align_vertex(sna, tmp);
+ gen6_emit_composite_state(sna, tmp);
return true;
cleanup_mask:
@@ -2632,8 +2626,8 @@ gen6_render_composite_spans(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen6_emit_composite_state(sna, &tmp->base);
gen6_align_vertex(sna, &tmp->base);
+ gen6_emit_composite_state(sna, &tmp->base);
return true;
cleanup_src:
@@ -2916,8 +2910,8 @@ fallback_blt:
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen6_emit_copy_state(sna, &tmp);
gen6_align_vertex(sna, &tmp);
+ gen6_emit_copy_state(sna, &tmp);
do {
int16_t *v;
@@ -3075,8 +3069,8 @@ fallback:
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen6_emit_copy_state(sna, &op->base);
gen6_align_vertex(sna, &op->base);
+ gen6_emit_copy_state(sna, &op->base);
op->blt = gen6_render_copy_blt;
op->done = gen6_render_copy_done;
@@ -3241,8 +3235,8 @@ gen6_render_fill_boxes(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen6_emit_fill_state(sna, &tmp);
gen6_align_vertex(sna, &tmp);
+ gen6_emit_fill_state(sna, &tmp);
do {
int n_this_time;
@@ -3421,8 +3415,8 @@ gen6_render_fill(struct sna *sna, uint8_t alu,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen6_emit_fill_state(sna, &op->base);
gen6_align_vertex(sna, &op->base);
+ gen6_emit_fill_state(sna, &op->base);
op->blt = gen6_render_op_fill_blt;
op->box = gen6_render_op_fill_box;
@@ -3505,8 +3499,8 @@ gen6_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
}
}
- gen6_emit_fill_state(sna, &tmp);
gen6_align_vertex(sna, &tmp);
+ gen6_emit_fill_state(sna, &tmp);
gen6_get_rectangles(sna, &tmp, 1, gen6_emit_fill_state);
@@ -3592,8 +3586,8 @@ gen6_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo)
}
}
- gen6_emit_fill_state(sna, &tmp);
gen6_align_vertex(sna, &tmp);
+ gen6_emit_fill_state(sna, &tmp);
gen6_get_rectangles(sna, &tmp, 1, gen6_emit_fill_state);