summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-07-12 23:57:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-07-13 00:01:08 +0100
commit0230ef72cbb2d3bcf7157548ddd52a71c0c771c5 (patch)
treefaddb5936e645583f1efd88c2c1f99e9a8e7a494
parent2b16eaefb38b4a6efe50a397e68793ab9a1cb2ef (diff)
sna: Skip copying to the intermediate target if we will completely overwrite it
Occasionally when forced to use an intermediate destination surface, we know that we will completely overwrite the contents of the surface and so we can forgo the initial copy from the target. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/gen2_render.c9
-rw-r--r--src/sna/gen3_render.c9
-rw-r--r--src/sna/gen4_render.c13
-rw-r--r--src/sna/gen5_render.c14
-rw-r--r--src/sna/gen6_render.c16
-rw-r--r--src/sna/gen7_render.c16
-rw-r--r--src/sna/sna_render.c6
-rw-r--r--src/sna/sna_render.h3
8 files changed, 55 insertions, 31 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index ba57643b..385a5fd4 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1889,7 +1889,8 @@ gen2_render_composite(struct sna *sna,
if (too_large(tmp->dst.width, tmp->dst.height) ||
tmp->dst.bo->pitch > MAX_3D_PITCH) {
if (!sna_render_composite_redirect(sna, tmp,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data != NULL))
return false;
}
@@ -2551,7 +2552,8 @@ gen2_render_composite_spans(struct sna *sna,
if (too_large(tmp->base.dst.width, tmp->base.dst.height) ||
tmp->base.dst.bo->pitch > MAX_3D_PITCH) {
if (!sna_render_composite_redirect(sna, &tmp->base,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ true))
return false;
}
@@ -3256,7 +3258,8 @@ fallback:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ alu != GXcopy || n > 1))
goto fallback_tiled;
}
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 8d65e6e8..c7f95124 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -3550,7 +3550,8 @@ gen3_render_composite(struct sna *sna,
if (too_large(tmp->dst.width, tmp->dst.height) ||
!gen3_check_pitch_3d(tmp->dst.bo)) {
if (!sna_render_composite_redirect(sna, tmp,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data))
return false;
}
@@ -4895,7 +4896,8 @@ gen3_render_composite_spans(struct sna *sna,
if (too_large(tmp->base.dst.width, tmp->base.dst.height) ||
!gen3_check_pitch_3d(tmp->base.dst.bo)) {
if (!sna_render_composite_redirect(sna, &tmp->base,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ true))
return false;
}
@@ -5675,7 +5677,8 @@ fallback_blt:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
goto fallback_tiled;
}
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 8e039102..cc6ee1dd 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1585,7 +1585,8 @@ static bool
gen4_composite_set_target(struct sna *sna,
struct sna_composite_op *op,
PicturePtr dst,
- int x, int y, int w, int h)
+ int x, int y, int w, int h,
+ bool partial)
{
BoxRec box;
@@ -1621,7 +1622,7 @@ gen4_composite_set_target(struct sna *sna,
assert(op->dst.bo->proxy == NULL);
if (too_large(op->dst.width, op->dst.height) &&
- !sna_render_composite_redirect(sna, op, x, y, w, h))
+ !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
return false;
return true;
@@ -1903,7 +1904,8 @@ gen4_render_composite(struct sna *sna,
tmp);
if (!gen4_composite_set_target(sna, tmp, dst,
- dst_x, dst_y, width, height)) {
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data)) {
DBG(("%s: failed to set composite target\n", __FUNCTION__));
return false;
}
@@ -2203,7 +2205,7 @@ gen4_render_composite_spans(struct sna *sna,
tmp->base.op = op;
if (!gen4_composite_set_target(sna, &tmp->base, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height, true))
return false;
switch (gen4_composite_picture(sna, src, &tmp->base.src,
@@ -2389,7 +2391,8 @@ fallback_blt:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
goto fallback_tiled;
}
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 2b75ff6b..4fa44c01 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1541,7 +1541,8 @@ static bool
gen5_composite_set_target(struct sna *sna,
struct sna_composite_op *op,
PicturePtr dst,
- int x, int y, int w, int h)
+ int x, int y, int w, int h,
+ bool partial)
{
BoxRec box;
@@ -1577,7 +1578,7 @@ gen5_composite_set_target(struct sna *sna,
assert(op->dst.bo->proxy == NULL);
if (too_large(op->dst.width, op->dst.height) &&
- !sna_render_composite_redirect(sna, op, x, y, w, h))
+ !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
return false;
return true;
@@ -1862,7 +1863,8 @@ gen5_render_composite(struct sna *sna,
tmp);
if (!gen5_composite_set_target(sna, tmp, dst,
- dst_x, dst_y, width, height)) {
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data)) {
DBG(("%s: failed to set composite target\n", __FUNCTION__));
return false;
}
@@ -2149,7 +2151,8 @@ gen5_render_composite_spans(struct sna *sna,
tmp->base.op = op;
if (!gen5_composite_set_target(sna, &tmp->base, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ true))
return false;
switch (gen5_composite_picture(sna, src, &tmp->base.src,
@@ -2320,7 +2323,8 @@ fallback_blt:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
goto fallback_tiled;
}
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index d87ac127..9b45d798 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1823,7 +1823,8 @@ static bool
gen6_composite_set_target(struct sna *sna,
struct sna_composite_op *op,
PicturePtr dst,
- int x, int y, int w, int h)
+ int x, int y, int w, int h,
+ bool partial)
{
BoxRec box;
@@ -1860,7 +1861,7 @@ gen6_composite_set_target(struct sna *sna,
assert(op->dst.bo->proxy == NULL);
if (too_large(op->dst.width, op->dst.height) &&
- !sna_render_composite_redirect(sna, op, x, y, w, h))
+ !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
return false;
return true;
@@ -2196,7 +2197,8 @@ gen6_render_composite(struct sna *sna,
op = PictOpSrc;
tmp->op = op;
if (!gen6_composite_set_target(sna, tmp, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data))
return false;
switch (gen6_composite_picture(sna, src, &tmp->src,
@@ -2490,7 +2492,7 @@ gen6_render_composite_spans(struct sna *sna,
tmp->base.op = op;
if (!gen6_composite_set_target(sna, &tmp->base, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height, true))
return false;
switch (gen6_composite_picture(sna, src, &tmp->base.src,
@@ -2745,7 +2747,8 @@ fallback_blt:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
goto fallback_tiled;
dst_dx += tmp.dst.x;
@@ -3102,7 +3105,8 @@ gen6_render_fill_boxes(struct sna *sna,
if (!sna_render_composite_redirect(sna, &tmp,
extents.x1, extents.y1,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
return sna_tiling_fill_boxes(sna, op, format, color,
dst, dst_bo, box, n);
}
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index a36ecf71..7d4d85f4 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2029,7 +2029,8 @@ static bool
gen7_composite_set_target(struct sna *sna,
struct sna_composite_op *op,
PicturePtr dst,
- int x, int y, int w, int h)
+ int x, int y, int w, int h,
+ bool partial)
{
BoxRec box;
@@ -2067,7 +2068,7 @@ gen7_composite_set_target(struct sna *sna,
assert(op->dst.bo->proxy == NULL);
if (too_large(op->dst.width, op->dst.height) &&
- !sna_render_composite_redirect(sna, op, x, y, w, h))
+ !sna_render_composite_redirect(sna, op, x, y, w, h, partial))
return false;
return true;
@@ -2403,7 +2404,8 @@ gen7_render_composite(struct sna *sna,
op = PictOpSrc;
tmp->op = op;
if (!gen7_composite_set_target(sna, tmp, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height,
+ op > PictOpSrc || dst->pCompositeClip->data))
return false;
switch (gen7_composite_picture(sna, src, &tmp->src,
@@ -2677,7 +2679,7 @@ gen7_render_composite_spans(struct sna *sna,
tmp->base.op = op;
if (!gen7_composite_set_target(sna, &tmp->base, dst,
- dst_x, dst_y, width, height))
+ dst_x, dst_y, width, height, true))
return false;
switch (gen7_composite_picture(sna, src, &tmp->base.src,
@@ -2928,7 +2930,8 @@ fallback_blt:
extents.x1 + dst_dx,
extents.y1 + dst_dy,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
goto fallback_tiled;
dst_dx += tmp.dst.x;
@@ -3273,7 +3276,8 @@ gen7_render_fill_boxes(struct sna *sna,
if (!sna_render_composite_redirect(sna, &tmp,
extents.x1, extents.y1,
extents.x2 - extents.x1,
- extents.y2 - extents.y1))
+ extents.y2 - extents.y1,
+ n > 1))
return sna_tiling_fill_boxes(sna, op, format, color,
dst, dst_bo, box, n);
}
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 032dba7d..139081db 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1883,7 +1883,8 @@ sna_render_picture_convert(struct sna *sna,
bool
sna_render_composite_redirect(struct sna *sna,
struct sna_composite_op *op,
- int x, int y, int width, int height)
+ int x, int y, int width, int height,
+ bool partial)
{
struct sna_composite_redirect *t = &op->redirect;
int bpp = op->dst.pixmap->drawable.bitsPerPixel;
@@ -2026,7 +2027,8 @@ sna_render_composite_redirect(struct sna *sna,
DBG(("%s: original box (%d, %d), (%d, %d)\n",
__FUNCTION__, t->box.x1, t->box.y1, t->box.x2, t->box.y2));
- if (!sna_blt_copy_boxes(sna, GXcopy,
+ if (partial &&
+ !sna_blt_copy_boxes(sna, GXcopy,
op->dst.bo, 0, 0,
bo, -t->box.x1, -t->box.y1,
bpp, &t->box, 1)) {
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index ab69fe02..aace869e 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -727,7 +727,8 @@ inline static void sna_render_composite_redirect_init(struct sna_composite_op *o
bool
sna_render_composite_redirect(struct sna *sna,
struct sna_composite_op *op,
- int x, int y, int width, int height);
+ int x, int y, int width, int height,
+ bool partial);
void
sna_render_composite_redirect_done(struct sna *sna,