summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/gen2_render.c19
-rw-r--r--src/sna/gen3_render.c19
-rw-r--r--src/sna/gen4_render.c11
-rw-r--r--src/sna/gen5_render.c27
-rw-r--r--src/sna/gen6_render.c27
-rw-r--r--src/sna/gen7_render.c27
-rw-r--r--src/sna/sna_accel.c29
-rw-r--r--src/sna/sna_blt.c27
-rw-r--r--src/sna/sna_render.h3
9 files changed, 167 insertions, 22 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index 6b300697..98360b8c 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -2038,6 +2038,24 @@ gen2_render_fill_blt(struct sna *sna,
VERTEX(y);
}
+fastcall static void
+gen2_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ if (!gen2_get_rectangles(sna, &op->base, 1)) {
+ gen2_emit_fill_state(sna, &op->base);
+ gen2_get_rectangles(sna, &op->base, 1);
+ }
+
+ VERTEX(box->x2);
+ VERTEX(box->y2);
+ VERTEX(box->x1);
+ VERTEX(box->y2);
+ VERTEX(box->x1);
+ VERTEX(box->y1);
+}
+
static void
gen2_render_fill_done(struct sna *sna, const struct sna_fill_op *op)
{
@@ -2096,6 +2114,7 @@ gen2_render_fill(struct sna *sna, uint8_t alu,
}
tmp->blt = gen2_render_fill_blt;
+ tmp->box = gen2_render_fill_box;
tmp->done = gen2_render_fill_done;
gen2_emit_fill_state(sna, &tmp->base);
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 90797d70..6d91f32b 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3793,6 +3793,24 @@ gen3_render_fill_blt(struct sna *sna,
OUT_VERTEX(y);
}
+fastcall static void
+gen3_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ if (!gen3_get_rectangles(sna, &op->base, 1)) {
+ gen3_emit_composite_state(sna, &op->base);
+ gen3_get_rectangles(sna, &op->base, 1);
+ }
+
+ OUT_VERTEX(box->x2);
+ OUT_VERTEX(box->y2);
+ OUT_VERTEX(box->x1);
+ OUT_VERTEX(box->y2);
+ OUT_VERTEX(box->x1);
+ OUT_VERTEX(box->y1);
+}
+
static void
gen3_render_fill_done(struct sna *sna, const struct sna_fill_op *op)
{
@@ -3852,6 +3870,7 @@ gen3_render_fill(struct sna *sna, uint8_t alu,
kgem_submit(&sna->kgem);
tmp->blt = gen3_render_fill_blt;
+ tmp->box = gen3_render_fill_box;
tmp->done = gen3_render_fill_done;
gen3_emit_composite_state(sna, &tmp->base);
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 2c988ff8..f099fbf0 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -2503,6 +2503,16 @@ gen4_render_fill_blt(struct sna *sna, const struct sna_fill_op *op,
gen4_render_fill_rectangle(sna, &op->base, x, y, w, h);
}
+fastcall static void
+gen4_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ gen4_render_fill_rectangle(sna, &op->base,
+ box->x1, box->y1,
+ box->x2-box->x1, box->y2-box->y1);
+}
+
static void
gen4_render_fill_done(struct sna *sna, const struct sna_fill_op *op)
{
@@ -2568,6 +2578,7 @@ gen4_render_fill(struct sna *sna, uint8_t alu,
gen4_align_vertex(sna, &op->base);
op->blt = gen4_render_fill_blt;
+ op->box = gen4_render_fill_box;
op->done = gen4_render_fill_done;
return TRUE;
}
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index d246d011..db69f067 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -2504,6 +2504,32 @@ gen5_render_fill_blt(struct sna *sna,
OUT_VERTEX_F(0);
}
+fastcall static void
+gen5_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ DBG(("%s: (%d, %d),(%d, %d)\n", __FUNCTION__,
+ box->x1, box->y1, box->x2, box->y2));
+
+ if (!gen5_get_rectangles(sna, &op->base, 1)) {
+ gen5_fill_bind_surfaces(sna, &op->base);
+ gen5_get_rectangles(sna, &op->base, 1);
+ }
+
+ OUT_VERTEX(box->x2, box->y2);
+ OUT_VERTEX_F(1);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y2);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y1);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(0);
+}
+
static void
gen5_render_fill_done(struct sna *sna,
const struct sna_fill_op *op)
@@ -2567,6 +2593,7 @@ gen5_render_fill(struct sna *sna, uint8_t alu,
gen5_align_vertex(sna, &op->base);
op->blt = gen5_render_fill_blt;
+ op->box = gen5_render_fill_box;
op->done = gen5_render_fill_done;
return TRUE;
}
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index badade09..fc2fc471 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2720,6 +2720,32 @@ gen6_render_fill_blt(struct sna *sna,
OUT_VERTEX_F(0);
}
+fastcall static void
+gen6_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ DBG(("%s: (%d, %d),(%d, %d)\n", __FUNCTION__,
+ box->x1, box->y1, box->x2, box->y2));
+
+ if (!gen6_get_rectangles(sna, &op->base, 1)) {
+ gen6_emit_fill_state(sna, &op->base);
+ gen6_get_rectangles(sna, &op->base, 1);
+ }
+
+ OUT_VERTEX(box->x2, box->y2);
+ OUT_VERTEX_F(1);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y2);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y1);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(0);
+}
+
static void
gen6_render_fill_done(struct sna *sna, const struct sna_fill_op *op)
{
@@ -2791,6 +2817,7 @@ gen6_render_fill(struct sna *sna, uint8_t alu,
gen6_align_vertex(sna, &op->base);
op->blt = gen6_render_fill_blt;
+ op->box = gen6_render_fill_box;
op->done = gen6_render_fill_done;
return TRUE;
}
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 16c14621..ae773206 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2870,6 +2870,32 @@ gen7_render_fill_blt(struct sna *sna,
OUT_VERTEX_F(0);
}
+fastcall static void
+gen7_render_fill_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ DBG(("%s: (%d, %d),(%d, %d)\n", __FUNCTION__,
+ box->x1, box->y1, box->x2, box->y2));
+
+ if (!gen7_get_rectangles(sna, &op->base, 1)) {
+ gen7_emit_fill_state(sna, &op->base);
+ gen7_get_rectangles(sna, &op->base, 1);
+ }
+
+ OUT_VERTEX(box->x2, box->y2);
+ OUT_VERTEX_F(1);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y2);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(1);
+
+ OUT_VERTEX(box->x1, box->y1);
+ OUT_VERTEX_F(0);
+ OUT_VERTEX_F(0);
+}
+
static void
gen7_render_fill_done(struct sna *sna, const struct sna_fill_op *op)
{
@@ -2941,6 +2967,7 @@ gen7_render_fill(struct sna *sna, uint8_t alu,
gen7_align_vertex(sna, &op->base);
op->blt = gen7_render_fill_blt;
+ op->box = gen7_render_fill_box;
op->done = gen7_render_fill_done;
return TRUE;
}
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 648f9288..4b59b55b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2298,9 +2298,7 @@ sna_poly_line_blt(DrawablePtr drawable,
DBG(("%s: blt (%d, %d), (%d, %d)\n",
__FUNCTION__,
r.x1, r.y1, r.x2, r.y2));
- fill.blt(sna, &fill,
- r.x1, r.y1,
- r.x2-r.x1, r.y2-r.y1);
+ fill.box(sna, &fill, &r);
if (damage) {
assert_pixmap_contains_box(pixmap, &r);
sna_damage_add_box(damage, &r);
@@ -2361,9 +2359,7 @@ sna_poly_line_blt(DrawablePtr drawable,
DBG(("%s: blt (%d, %d), (%d, %d)\n",
__FUNCTION__,
r.x1, r.y1, r.x2, r.y2));
- fill.blt(sna, &fill,
- r.x1, r.y1,
- r.x2-r.x1, r.y2-r.y1);
+ fill.box(sna, &fill, &r);
if (damage) {
assert_pixmap_contains_box(pixmap, &r);
sna_damage_add_box(damage, &r);
@@ -2681,9 +2677,7 @@ sna_poly_segment_blt(DrawablePtr drawable,
r.x2 += dx;
r.y1 += dy;
r.y2 += dy;
- fill.blt(sna, &fill,
- r.x1, r.y1,
- r.x2-r.x1, r.y2-r.y1);
+ fill.box(sna, &fill, &r);
if (damage) {
assert_pixmap_contains_box(pixmap, &r);
sna_damage_add_box(damage, &r);
@@ -3047,9 +3041,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
r.x2 += dx;
r.y1 += dy;
r.y2 += dy;
- fill.blt(sna, &fill,
- r.x1, r.y1,
- r.x2-r.x1, r.y2-r.y1);
+ fill.box(sna, &fill, &r);
if (damage) {
assert_pixmap_contains_box(pixmap, &r);
sna_damage_add_box(damage, &r);
@@ -3078,9 +3070,7 @@ sna_poly_fill_rect_blt(DrawablePtr drawable,
box->x2 += dx;
box->y1 += dy;
box->y2 += dy;
- fill.blt(sna, &fill,
- box->x1, box->y1,
- box->x2-box->x1, box->y2-box->y1);
+ fill.box(sna, &fill, box);
if (damage) {
assert_pixmap_contains_box(pixmap, box);
sna_damage_add_box(damage, box);
@@ -3155,9 +3145,7 @@ sna_poly_fill_rect_tiled(DrawablePtr drawable,
r.x2 += dx;
r.y1 += dy;
r.y2 += dy;
- fill.blt(sna, &fill,
- r.x1, r.y1,
- r.x2-r.x1, r.y2-r.y1);
+ fill.box(sna, &fill, &r);
if (damage) {
assert_pixmap_contains_box(pixmap, &r);
sna_damage_add_box(damage, &r);
@@ -3186,10 +3174,7 @@ sna_poly_fill_rect_tiled(DrawablePtr drawable,
box->x2 += dx;
box->y1 += dy;
box->y2 += dy;
- fill.blt(sna, &fill,
- box->x1, box->y1,
- box->x2-box->x1,
- box->y2-box->y1);
+ fill.box(sna, &fill, box);
if (damage) {
assert_pixmap_contains_box(pixmap, box);
sna_damage_add_box(damage, box);
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 2343838e..b317e9e0 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1272,6 +1272,32 @@ static void sna_blt_fill_op_blt(struct sna *sna,
sna_blt_fill_one(sna, &op->base.u.blt, x, y, width, height);
}
+fastcall static void sna_blt_fill_op_box(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box)
+{
+ struct kgem *kgem = &sna->kgem;
+ uint32_t *b;
+
+ DBG(("%s: (%d, %d), (%d, %d): %08x\n", __FUNCTION__,
+ box->x1, box->y1, box->x2, box->y2,
+ op->base.u.blt.pixel));
+
+ assert(box->x1 >= 0);
+ assert(box->y1 >= 0);
+ assert(box->y2 * op->base.u.blt.bo[0]->pitch <= op->base.u.blt.bo[0]->size);
+
+ if (!kgem_check_batch(kgem, 3))
+ sna_blt_fill_begin(sna, &op->base.u.blt);
+
+ b = kgem->batch + kgem->nbatch;
+ kgem->nbatch += 3;
+
+ b[0] = op->base.u.blt.cmd;
+ b[1] = box->y1 << 16 | box->x1;
+ b[2] = box->y2 << 16 | box->x2;
+}
+
static void sna_blt_fill_op_done(struct sna *sna,
const struct sna_fill_op *fill)
{
@@ -1300,6 +1326,7 @@ bool sna_blt_fill(struct sna *sna, uint8_t alu,
return FALSE;
fill->blt = sna_blt_fill_op_blt;
+ fill->box = sna_blt_fill_op_box;
fill->done = sna_blt_fill_op_done;
return TRUE;
}
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index 0f174f67..d30c0b67 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -157,6 +157,9 @@ struct sna_fill_op {
void (*blt)(struct sna *sna, const struct sna_fill_op *op,
int16_t x, int16_t y, int16_t w, int16_t h);
+ fastcall void (*box)(struct sna *sna,
+ const struct sna_fill_op *op,
+ const BoxRec *box);
void (*done)(struct sna *sna, const struct sna_fill_op *op);
};