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>
This commit is contained in:
Chris Wilson 2013-07-12 23:57:42 +01:00
parent 2b16eaefb3
commit 0230ef72cb
8 changed files with 55 additions and 31 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)) {

View File

@ -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,