From f0021ab2a66fb7c84758ad482f47f023b862360b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 22 Nov 2013 12:07:06 +0000 Subject: [PATCH] sna: Tidy up fallback from render composite to blt composite Signed-off-by: Chris Wilson --- src/sna/gen2_render.c | 26 +++++++++++++++++++------- src/sna/gen3_render.c | 14 ++++++++++---- src/sna/gen4_render.c | 25 +++++++++++++++++++------ src/sna/gen5_render.c | 25 +++++++++++++++++++------ src/sna/gen6_render.c | 31 +++++++++++++++++++------------ src/sna/gen7_render.c | 31 +++++++++++++++++++------------ 6 files changed, 105 insertions(+), 47 deletions(-) diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 1a4c36a..3e90740 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -1869,7 +1869,7 @@ gen2_render_composite(struct sna *sna, return true; if (gen2_composite_fallback(sna, src, mask, dst)) - return false; + goto fallback; if (need_tiling(sna, width, height)) return sna_tiling_composite(op, src, mask, dst, @@ -1883,7 +1883,7 @@ gen2_render_composite(struct sna *sna, dst_x, dst_y, width, height)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); - return false; + goto fallback; } tmp->op = op; @@ -1894,7 +1894,7 @@ gen2_render_composite(struct sna *sna, if (!sna_render_composite_redirect(sna, tmp, dst_x, dst_y, width, height, op > PictOpSrc || dst->pCompositeClip->data != NULL)) - return false; + goto fallback; } switch (gen2_composite_picture(sna, src, &tmp->src, @@ -2057,15 +2057,27 @@ gen2_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); - return false; + tmp->redirect.real_bo = NULL; + } +fallback: + return (mask == NULL && + sna_blt_composite(sna, op, src, dst, + src_x, src_y, + dst_x, dst_y, + width, height, + tmp, true)); } fastcall static void diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 9d9f627..e841396 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -3515,7 +3515,7 @@ gen3_render_composite(struct sna *sna, dst_x, dst_y, width, height)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); - return false; + goto fallback; } tmp->op = op; @@ -3819,14 +3819,20 @@ gen3_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); + tmp->redirect.real_bo = NULL; + } fallback: return (mask == NULL && sna_blt_composite(sna, diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index c6a1e6d..2da0137 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -1864,7 +1864,7 @@ gen4_render_composite(struct sna *sna, return true; if (gen4_composite_fallback(sna, src, mask, dst)) - return false; + goto fallback; if (need_tiling(sna, width, height)) return sna_tiling_composite(op, src, mask, dst, @@ -1878,7 +1878,7 @@ gen4_render_composite(struct sna *sna, dst_x, dst_y, width, height, op > PictOpSrc || dst->pCompositeClip->data)) { DBG(("%s: failed to set composite target\n", __FUNCTION__)); - return false; + goto fallback; } tmp->op = op; @@ -1988,15 +1988,28 @@ gen4_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); - return false; + tmp->redirect.real_bo = NULL; + } +fallback: + return (mask == NULL && + sna_blt_composite(sna, op, + src, dst, + src_x, src_y, + dst_x, dst_y, + width, height, + tmp, true)); } #if !NO_COMPOSITE_SPANS diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 1e90413..247dc97 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -1850,7 +1850,7 @@ gen5_render_composite(struct sna *sna, return true; if (gen5_composite_fallback(sna, src, mask, dst)) - return false; + goto fallback; if (need_tiling(sna, width, height)) return sna_tiling_composite(op, src, mask, dst, @@ -1864,7 +1864,7 @@ gen5_render_composite(struct sna *sna, dst_x, dst_y, width, height, op > PictOpSrc || dst->pCompositeClip->data)) { DBG(("%s: failed to set composite target\n", __FUNCTION__)); - return false; + goto fallback; } DBG(("%s: preparing source\n", __FUNCTION__)); @@ -1970,15 +1970,28 @@ gen5_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); - return false; + tmp->redirect.real_bo = NULL; + } +fallback: + return (mask == NULL && + sna_blt_composite(sna, op, + src, dst, + src_x, src_y, + dst_x, dst_y, + width, height, + tmp, true)); } #if !NO_COMPOSITE_SPANS diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index f03b893..103b959 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2143,13 +2143,7 @@ gen6_render_composite(struct sna *sna, return true; if (gen6_composite_fallback(sna, src, mask, dst)) - return (mask == NULL && - sna_blt_composite(sna, op, - src, dst, - src_x, src_y, - dst_x, dst_y, - width, height, - tmp, true)); + goto fallback; if (need_tiling(sna, width, height)) return sna_tiling_composite(op, src, mask, dst, @@ -2165,7 +2159,7 @@ gen6_render_composite(struct sna *sna, if (!gen6_composite_set_target(sna, tmp, dst, dst_x, dst_y, width, height, op > PictOpSrc || dst->pCompositeClip->data)) - return false; + goto fallback; switch (gen6_composite_picture(sna, src, &tmp->src, src_x, src_y, @@ -2280,15 +2274,28 @@ gen6_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); - return false; + tmp->redirect.real_bo = NULL; + } +fallback: + return (mask == NULL && + sna_blt_composite(sna, op, + src, dst, + src_x, src_y, + dst_x, dst_y, + width, height, + tmp, true)); } #if !NO_COMPOSITE_SPANS diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 72861cc..65c7134 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2425,13 +2425,7 @@ gen7_render_composite(struct sna *sna, return true; if (gen7_composite_fallback(sna, src, mask, dst)) - return (mask == NULL && - sna_blt_composite(sna, op, - src, dst, - src_x, src_y, - dst_x, dst_y, - width, height, - tmp, true)); + goto fallback; if (need_tiling(sna, width, height)) return sna_tiling_composite(op, src, mask, dst, @@ -2447,7 +2441,7 @@ gen7_render_composite(struct sna *sna, if (!gen7_composite_set_target(sna, tmp, dst, dst_x, dst_y, width, height, op > PictOpSrc || dst->pCompositeClip->data)) - return false; + goto fallback; switch (gen7_composite_picture(sna, src, &tmp->src, src_x, src_y, @@ -2562,15 +2556,28 @@ gen7_render_composite(struct sna *sna, return true; cleanup_mask: - if (tmp->mask.bo) + if (tmp->mask.bo) { kgem_bo_destroy(&sna->kgem, tmp->mask.bo); + tmp->mask.bo = NULL; + } cleanup_src: - if (tmp->src.bo) + if (tmp->src.bo) { kgem_bo_destroy(&sna->kgem, tmp->src.bo); + tmp->src.bo = NULL; + } cleanup_dst: - if (tmp->redirect.real_bo) + if (tmp->redirect.real_bo) { kgem_bo_destroy(&sna->kgem, tmp->dst.bo); - return false; + tmp->redirect.real_bo = NULL; + } +fallback: + return (mask == NULL && + sna_blt_composite(sna, op, + src, dst, + src_x, src_y, + dst_x, dst_y, + width, height, + tmp, true)); } #if !NO_COMPOSITE_SPANS -- 2.7.4