sna: Tidy up fallback from render composite to blt composite
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 22 Nov 2013 12:07:06 +0000 (12:07 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 22 Nov 2013 12:13:30 +0000 (12:13 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/gen2_render.c
src/sna/gen3_render.c
src/sna/gen4_render.c
src/sna/gen5_render.c
src/sna/gen6_render.c
src/sna/gen7_render.c

index 1a4c36a..3e90740 100644 (file)
@@ -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
index 9d9f627..e841396 100644 (file)
@@ -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,
index c6a1e6d..2da0137 100644 (file)
@@ -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
index 1e90413..247dc97 100644 (file)
@@ -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
index f03b893..103b959 100644 (file)
@@ -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
index 72861cc..65c7134 100644 (file)
@@ -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