summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen3_render.c49
-rw-r--r--src/sna/gen4_render.c28
-rw-r--r--src/sna/gen4_vertex.c23
-rw-r--r--src/sna/gen4_vertex.h1
-rw-r--r--src/sna/gen5_render.c28
-rw-r--r--src/sna/gen6_render.c30
-rw-r--r--src/sna/gen7_render.c65
7 files changed, 124 insertions, 100 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index ebe108de..2445b91a 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3123,20 +3123,29 @@ static void
gen3_align_vertex(struct sna *sna,
const struct sna_composite_op *op)
{
- if (op->floats_per_vertex != sna->render_state.gen3.last_floats_per_vertex) {
- if (sna->render.vertex_size - sna->render.vertex_used < 2*op->floats_per_rect)
- gen3_vertex_finish(sna);
-
- DBG(("aligning vertex: was %d, now %d floats per vertex, %d->%d\n",
- sna->render_state.gen3.last_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;
- assert(sna->render.vertex_used < sna->render.vertex_size - op->floats_per_rect);
- sna->render_state.gen3.last_floats_per_vertex = op->floats_per_vertex;
+ int vertex_index;
+
+ if (op->floats_per_vertex == sna->render_state.gen3.last_floats_per_vertex)
+ return;
+
+ DBG(("aligning vertex: was %d, now %d floats per vertex\n",
+ sna->render_state.gen3.last_floats_per_vertex,
+ op->floats_per_vertex));
+
+ assert(op->floats_per_rect == 3*op->floats_per_vertex);
+
+ vertex_index = (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex;
+ if ((int)sna->render.vertex_size - vertex_index * op->floats_per_vertex < 2*op->floats_per_rect) {
+ DBG(("%s: flushing vertex buffer: new index=%d, max=%d\n",
+ __FUNCTION__, vertex_index, sna->render.vertex_size / op->floats_per_vertex));
+ if (gen3_vertex_finish(sna) < op->floats_per_vertex)
+ kgem_submit(&sna->kgem);
+
+ vertex_index = (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex;
}
+
+ sna->render.vertex_index = vertex_index;
+ sna->render.vertex_used = vertex_index * op->floats_per_vertex;
}
static bool
@@ -3806,8 +3815,8 @@ gen3_render_composite(struct sna *sna,
goto cleanup_mask;
}
- gen3_emit_composite_state(sna, tmp);
gen3_align_vertex(sna, tmp);
+ gen3_emit_composite_state(sna, tmp);
return true;
cleanup_mask:
@@ -5021,8 +5030,8 @@ gen3_render_composite_spans(struct sna *sna,
goto cleanup_src;
}
- gen3_emit_composite_state(sna, &tmp->base);
gen3_align_vertex(sna, &tmp->base);
+ gen3_emit_composite_state(sna, &tmp->base);
return true;
cleanup_src:
@@ -5665,8 +5674,8 @@ fallback_blt:
dst_dy += tmp.dst.y;
tmp.dst.x = tmp.dst.y = 0;
- gen3_emit_composite_state(sna, &tmp);
gen3_align_vertex(sna, &tmp);
+ gen3_emit_composite_state(sna, &tmp);
do {
int n_this_time;
@@ -5803,8 +5812,8 @@ fallback:
tmp->blt = gen3_render_copy_blt;
tmp->done = gen3_render_copy_done;
- gen3_emit_composite_state(sna, &tmp->base);
gen3_align_vertex(sna, &tmp->base);
+ gen3_emit_composite_state(sna, &tmp->base);
return true;
}
@@ -5943,8 +5952,8 @@ gen3_render_fill_boxes(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen3_emit_composite_state(sna, &tmp);
gen3_align_vertex(sna, &tmp);
+ gen3_emit_composite_state(sna, &tmp);
do {
int n_this_time;
@@ -6094,8 +6103,8 @@ gen3_render_fill(struct sna *sna, uint8_t alu,
tmp->boxes = gen3_render_fill_op_boxes;
tmp->done = gen3_render_fill_op_done;
- gen3_emit_composite_state(sna, &tmp->base);
gen3_align_vertex(sna, &tmp->base);
+ gen3_emit_composite_state(sna, &tmp->base);
return true;
}
@@ -6172,8 +6181,8 @@ gen3_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
return true;
}
- gen3_emit_composite_state(sna, &tmp);
gen3_align_vertex(sna, &tmp);
+ gen3_emit_composite_state(sna, &tmp);
gen3_get_rectangles(sna, &tmp, 1);
DBG((" (%d, %d), (%d, %d): %x\n", x1, y1, x2, y2, color));
OUT_VERTEX(x2);
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 416452b4..48a8852d 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -827,16 +827,10 @@ gen4_align_vertex(struct sna *sna, const struct sna_composite_op *op)
{
assert(op->floats_per_rect == 3*op->floats_per_vertex);
if (op->floats_per_vertex != sna->render_state.gen4.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.gen4.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.gen4.floats_per_vertex = op->floats_per_vertex;
}
}
@@ -1396,8 +1390,8 @@ gen4_render_video(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL));
}
- gen4_video_bind_surfaces(sna, &tmp);
gen4_align_vertex(sna, &tmp);
+ gen4_video_bind_surfaces(sna, &tmp);
/* Set up the offset for translating from the given region (in screen
* coordinates) to the backing pixmap.
@@ -1987,8 +1981,8 @@ gen4_render_composite(struct sna *sna,
goto cleanup_mask;
}
- gen4_bind_surfaces(sna, tmp);
gen4_align_vertex(sna, tmp);
+ gen4_bind_surfaces(sna, tmp);
return true;
cleanup_mask:
@@ -2226,8 +2220,8 @@ gen4_render_composite_spans(struct sna *sna,
goto cleanup_src;
}
- gen4_bind_surfaces(sna, &tmp->base);
gen4_align_vertex(sna, &tmp->base);
+ gen4_bind_surfaces(sna, &tmp->base);
return true;
cleanup_src:
@@ -2428,8 +2422,8 @@ fallback_blt:
src_dx += tmp.src.offset[0];
src_dy += tmp.src.offset[1];
- gen4_copy_bind_surfaces(sna, &tmp);
gen4_align_vertex(sna, &tmp);
+ gen4_copy_bind_surfaces(sna, &tmp);
do {
gen4_render_copy_one(sna, &tmp,
@@ -2558,8 +2552,8 @@ fallback:
return true;
}
- gen4_copy_bind_surfaces(sna, &op->base);
gen4_align_vertex(sna, &op->base);
+ gen4_copy_bind_surfaces(sna, &op->base);
op->blt = gen4_render_copy_blt;
op->done = gen4_render_copy_done;
@@ -2664,8 +2658,8 @@ gen4_render_fill_boxes(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen4_bind_surfaces(sna, &tmp);
gen4_align_vertex(sna, &tmp);
+ gen4_bind_surfaces(sna, &tmp);
do {
gen4_render_fill_rectangle(sna, &tmp,
@@ -2769,8 +2763,8 @@ gen4_render_fill(struct sna *sna, uint8_t alu,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen4_bind_surfaces(sna, &op->base);
gen4_align_vertex(sna, &op->base);
+ gen4_bind_surfaces(sna, &op->base);
op->blt = gen4_render_fill_op_blt;
op->box = gen4_render_fill_op_box;
@@ -2853,8 +2847,8 @@ gen4_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
}
}
- gen4_bind_surfaces(sna, &tmp);
gen4_align_vertex(sna, &tmp);
+ gen4_bind_surfaces(sna, &tmp);
gen4_render_fill_rectangle(sna, &tmp, x1, y1, x2 - x1, y2 - y1);
diff --git a/src/sna/gen4_vertex.c b/src/sna/gen4_vertex.c
index e2a48083..0585c4ce 100644
--- a/src/sna/gen4_vertex.c
+++ b/src/sna/gen4_vertex.c
@@ -38,6 +38,29 @@
#define sse2
#endif
+void gen4_vertex_align(struct sna *sna, const struct sna_composite_op *op)
+{
+ int vertex_index;
+
+ assert(op->floats_per_rect == 3*op->floats_per_vertex);
+
+ vertex_index = (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex;
+ if ((int)sna->render.vertex_size - vertex_index * op->floats_per_vertex < 2*op->floats_per_rect) {
+ DBG(("%s: flushing vertex buffer: new index=%d, max=%d\n",
+ __FUNCTION__, vertex_index, sna->render.vertex_size / op->floats_per_vertex));
+ if (gen4_vertex_finish(sna) < op->floats_per_rect) {
+ kgem_submit(&sna->kgem);
+ _kgem_set_mode(&sna->kgem, KGEM_RENDER);
+ }
+
+ vertex_index = (sna->render.vertex_used + op->floats_per_vertex - 1) / op->floats_per_vertex;
+ assert(vertex_index * op->floats_per_vertex <= sna->render.vertex_size);
+ }
+
+ sna->render.vertex_index = vertex_index;
+ sna->render.vertex_used = vertex_index * op->floats_per_vertex;
+}
+
void gen4_vertex_flush(struct sna *sna)
{
DBG(("%s[%x] = %d\n", __FUNCTION__,
diff --git a/src/sna/gen4_vertex.h b/src/sna/gen4_vertex.h
index 1494ba14..03ba2f87 100644
--- a/src/sna/gen4_vertex.h
+++ b/src/sna/gen4_vertex.h
@@ -6,6 +6,7 @@
#include "sna.h"
#include "sna_render.h"
+void gen4_vertex_align(struct sna *sna, const struct sna_composite_op *op);
void gen4_vertex_flush(struct sna *sna);
int gen4_vertex_finish(struct sna *sna);
void gen4_vertex_close(struct sna *sna);
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 2bd818a4..ca41a9a8 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -796,16 +796,10 @@ gen5_align_vertex(struct sna *sna, const struct sna_composite_op *op)
{
assert(op->floats_per_rect == 3*op->floats_per_vertex);
if (op->floats_per_vertex != sna->render_state.gen5.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.gen5.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.gen5.floats_per_vertex = op->floats_per_vertex;
}
}
@@ -1394,8 +1388,8 @@ gen5_render_video(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL));
}
- gen5_video_bind_surfaces(sna, &tmp);
gen5_align_vertex(sna, &tmp);
+ gen5_video_bind_surfaces(sna, &tmp);
/* Set up the offset for translating from the given region (in screen
* coordinates) to the backing pixmap.
@@ -1969,8 +1963,8 @@ gen5_render_composite(struct sna *sna,
goto cleanup_mask;
}
- gen5_bind_surfaces(sna, tmp);
gen5_align_vertex(sna, tmp);
+ gen5_bind_surfaces(sna, tmp);
return true;
cleanup_mask:
@@ -2198,8 +2192,8 @@ gen5_render_composite_spans(struct sna *sna,
goto cleanup_src;
}
- gen5_bind_surfaces(sna, &tmp->base);
gen5_align_vertex(sna, &tmp->base);
+ gen5_bind_surfaces(sna, &tmp->base);
return true;
cleanup_src:
@@ -2388,8 +2382,8 @@ fallback_blt:
src_dx += tmp.src.offset[0];
src_dy += tmp.src.offset[1];
- gen5_copy_bind_surfaces(sna, &tmp);
gen5_align_vertex(sna, &tmp);
+ gen5_copy_bind_surfaces(sna, &tmp);
do {
int n_this_time;
@@ -2553,8 +2547,8 @@ fallback:
return true;
}
- gen5_copy_bind_surfaces(sna, &op->base);
gen5_align_vertex(sna, &op->base);
+ gen5_copy_bind_surfaces(sna, &op->base);
op->blt = gen5_render_copy_blt;
op->done = gen5_render_copy_done;
@@ -2694,8 +2688,8 @@ gen5_render_fill_boxes(struct sna *sna,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen5_fill_bind_surfaces(sna, &tmp);
gen5_align_vertex(sna, &tmp);
+ gen5_fill_bind_surfaces(sna, &tmp);
do {
int n_this_time;
@@ -2864,8 +2858,8 @@ gen5_render_fill(struct sna *sna, uint8_t alu,
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
}
- gen5_fill_bind_surfaces(sna, &op->base);
gen5_align_vertex(sna, &op->base);
+ gen5_fill_bind_surfaces(sna, &op->base);
op->blt = gen5_render_fill_op_blt;
op->box = gen5_render_fill_op_box;
@@ -2959,8 +2953,8 @@ gen5_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
assert(kgem_check_bo(&sna->kgem, bo, NULL));
}
- gen5_fill_bind_surfaces(sna, &tmp);
gen5_align_vertex(sna, &tmp);
+ gen5_fill_bind_surfaces(sna, &tmp);
gen5_get_rectangles(sna, &tmp, 1, gen5_fill_bind_surfaces);
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);
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 4b60f531..30e1cc1b 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1097,36 +1097,48 @@ gen7_emit_state(struct sna *sna,
const struct sna_composite_op *op,
uint16_t wm_binding_table)
{
+ bool need_invalidate;
+ bool need_flush;
bool need_stall;
assert(op->dst.bo->exec);
- gen7_emit_cc(sna, GEN7_BLEND(op->u.gen7.flags));
- gen7_emit_sampler(sna, GEN7_SAMPLER(op->u.gen7.flags));
- gen7_emit_sf(sna, GEN7_VERTEX(op->u.gen7.flags) >> 2);
- gen7_emit_wm(sna, GEN7_KERNEL(op->u.gen7.flags));
- gen7_emit_vertex_elements(sna, op);
+ need_invalidate = kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo);
+ if (ALWAYS_INVALIDATE)
+ need_invalidate = true;
- need_stall = gen7_emit_binding_table(sna, wm_binding_table);
+ need_flush = sna->render_state.gen7.emit_flush;
+ if (ALWAYS_FLUSH)
+ need_flush = true;
+
+ need_stall = sna->render_state.gen7.surface_table != wm_binding_table;
need_stall &= gen7_emit_drawing_rectangle(sna, op);
if (ALWAYS_STALL)
need_stall = true;
- if (ALWAYS_INVALIDATE || kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
+ if (need_invalidate) {
gen7_emit_pipe_invalidate(sna);
kgem_clear_dirty(&sna->kgem);
assert(op->dst.bo->exec);
kgem_bo_mark_dirty(op->dst.bo);
- sna->render_state.gen7.emit_flush = false;
+
+ need_flush = false;
need_stall = false;
}
- if (ALWAYS_FLUSH || (sna->render_state.gen7.emit_flush && GEN7_READS_DST(op->u.gen7.flags))) {
+ if (need_flush) {
gen7_emit_pipe_flush(sna, need_stall);
need_stall = false;
}
if (need_stall)
gen7_emit_pipe_stall(sna);
+ gen7_emit_cc(sna, GEN7_BLEND(op->u.gen7.flags));
+ gen7_emit_sampler(sna, GEN7_SAMPLER(op->u.gen7.flags));
+ gen7_emit_sf(sna, GEN7_VERTEX(op->u.gen7.flags) >> 2);
+ gen7_emit_wm(sna, GEN7_KERNEL(op->u.gen7.flags));
+ gen7_emit_vertex_elements(sna, op);
+ gen7_emit_binding_table(sna, wm_binding_table);
+
sna->render_state.gen7.emit_flush = GEN7_READS_DST(op->u.gen7.flags);
}
@@ -1522,16 +1534,9 @@ static void
gen7_align_vertex(struct sna *sna, const struct sna_composite_op *op)
{
if (op->floats_per_vertex != sna->render_state.gen7.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",
- sna->render_state.gen7.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;
+ DBG(("aligning vertex: was %d, now %d floats per vertex\n",
+ sna->render_state.gen7.floats_per_vertex, op->floats_per_vertex));
+ gen4_vertex_align(sna, op);
sna->render_state.gen7.floats_per_vertex = op->floats_per_vertex;
}
}
@@ -1865,8 +1870,8 @@ gen7_render_video(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_video_state(sna, &tmp);
gen7_align_vertex(sna, &tmp);
+ gen7_emit_video_state(sna, &tmp);
/* Set up the offset for translating from the given region (in screen
* coordinates) to the backing pixmap.
@@ -2654,8 +2659,8 @@ gen7_render_composite(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_composite_state(sna, tmp);
gen7_align_vertex(sna, tmp);
+ gen7_emit_composite_state(sna, tmp);
return true;
cleanup_mask:
@@ -2867,8 +2872,8 @@ gen7_render_composite_spans(struct sna *sna,
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_composite_state(sna, &tmp->base);
gen7_align_vertex(sna, &tmp->base);
+ gen7_emit_composite_state(sna, &tmp->base);
return true;
cleanup_src:
@@ -3141,8 +3146,8 @@ fallback_blt:
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_copy_state(sna, &tmp);
gen7_align_vertex(sna, &tmp);
+ gen7_emit_copy_state(sna, &tmp);
do {
int16_t *v;
@@ -3295,8 +3300,8 @@ fallback:
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_copy_state(sna, &op->base);
gen7_align_vertex(sna, &op->base);
+ gen7_emit_copy_state(sna, &op->base);
op->blt = gen7_render_copy_blt;
op->done = gen7_render_copy_done;
@@ -3458,10 +3463,11 @@ gen7_render_fill_boxes(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ _kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_fill_state(sna, &tmp);
gen7_align_vertex(sna, &tmp);
+ gen7_emit_fill_state(sna, &tmp);
do {
int n_this_time;
@@ -3632,10 +3638,11 @@ gen7_render_fill(struct sna *sna, uint8_t alu,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ _kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_fill_state(sna, &op->base);
gen7_align_vertex(sna, &op->base);
+ gen7_emit_fill_state(sna, &op->base);
op->blt = gen7_render_fill_op_blt;
op->box = gen7_render_fill_op_box;
@@ -3713,10 +3720,11 @@ gen7_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
kgem_bo_destroy(&sna->kgem, tmp.src.bo);
return false;
}
+ _kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_fill_state(sna, &tmp);
gen7_align_vertex(sna, &tmp);
+ gen7_emit_fill_state(sna, &tmp);
gen7_get_rectangles(sna, &tmp, 1, gen7_emit_fill_state);
@@ -3797,10 +3805,11 @@ gen7_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo)
kgem_bo_destroy(&sna->kgem, tmp.src.bo);
return false;
}
+ _kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
- gen7_emit_fill_state(sna, &tmp);
gen7_align_vertex(sna, &tmp);
+ gen7_emit_fill_state(sna, &tmp);
gen7_get_rectangles(sna, &tmp, 1, gen7_emit_fill_state);