diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 11:04:05 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 11:18:01 +0000 |
commit | f6474883d325cff443da9ceaa99ec734e6cdc1d6 (patch) | |
tree | 17515997c2af8bf688faaa924d2e53f70c8325cf | |
parent | 2ae3cd36ae98fa43716ef482e70364e7563cf1ea (diff) |
sna/gen2+: Use the reduced operator from CompositeRectangles
Do not attempt to further reduce the operator locally in each backend as
the reduction is already performed in the upper layer.
References: https://bugs.freedesktop.org/show_bug.cgi?id=42606
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/gen2_render.c | 26 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 39 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 31 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 31 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 31 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 31 |
6 files changed, 74 insertions, 115 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index 597d5f3d..6907dd61 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -2348,30 +2348,24 @@ gen2_render_fill_boxes_try_blt(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo, const BoxRec *box, int n) { - uint8_t alu = GXcopy; + uint8_t alu; uint32_t pixel; - if (!sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format)) + if (op > PictOpSrc) return FALSE; if (op == PictOpClear) { alu = GXclear; pixel = 0; - op = PictOpSrc; - } - - if (op == PictOpOver) { - if ((pixel & 0xff000000) == 0xff000000) - op = PictOpSrc; - } - - if (op != PictOpSrc) + } else if (!sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) return FALSE; + else + alu = GXcopy; return sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 2a18631c..d3ed2ef7 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -4153,7 +4153,7 @@ gen3_render_fill_boxes_try_blt(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo, const BoxRec *box, int n) { - uint8_t alu = GXcopy; + uint8_t alu; uint32_t pixel; if (dst_bo->tiling == I915_TILING_Y) { @@ -4162,36 +4162,21 @@ gen3_render_fill_boxes_try_blt(struct sna *sna, return FALSE; } - if (color->alpha >= 0xff00) { - if (op == PictOpOver) - op = PictOpSrc; - else if (op == PictOpOutReverse) - op = PictOpClear; - else if (op == PictOpAdd && - (color->red & color->green & color->blue) >= 0xff00) - op = PictOpSrc; - } + if (op > PictOpSrc) + return FALSE; - pixel = 0; if (op == PictOpClear) { alu = GXclear; - } else if (op == PictOpSrc) { - if (color->alpha <= 0x00ff) - alu = GXclear; - else if (!sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format)) { - DBG(("%s: unknown format %x\n", __FUNCTION__, - (uint32_t)format)); - return FALSE; - } - } else { - DBG(("%s: unhandle op %d\n", __FUNCTION__, alu)); + pixel = 0; + } else if (!sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) return FALSE; - } + else + alu = GXcopy; return sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 02454b21..a69852e0 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -2901,29 +2901,24 @@ gen4_render_fill_boxes(struct sna *sna, return FALSE; } - if (prefer_blt(sna) || - too_large(dst->drawable.width, dst->drawable.height) || - !gen4_check_dst_format(format)) { + if (op <= PictOpSrc && + (prefer_blt(sna) || + too_large(dst->drawable.width, dst->drawable.height) || + !gen4_check_dst_format(format))) { uint8_t alu = -1; - if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00)) + pixel = 0; + if (op == PictOpClear) alu = GXclear; - - if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) { + else if (sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) alu = GXcopy; - if (color->alpha <= 0x00ff) - alu = GXclear; - } - pixel = 0; - if ((alu == GXclear || - (alu == GXcopy && - sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format))) && + if (alu != -1 && sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, pixel, box, n)) diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 6763edf4..01604ef9 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -3241,29 +3241,24 @@ gen5_render_fill_boxes(struct sna *sna, return FALSE; } - if (prefer_blt_fill(sna) || - too_large(dst->drawable.width, dst->drawable.height) || - !gen5_check_dst_format(format)) { + if (op <= PictOpSrc && + (prefer_blt_fill(sna) || + too_large(dst->drawable.width, dst->drawable.height) || + !gen5_check_dst_format(format))) { uint8_t alu = -1; - if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00)) + pixel = 0; + if (op == PictOpClear) alu = GXclear; - - if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) { + else if (sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) alu = GXcopy; - if (color->alpha <= 0x00ff) - alu = GXclear; - } - pixel = 0; - if ((alu == GXclear || - (alu == GXcopy && - sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format))) && + if (alu != -1 && sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, pixel, box, n)) diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 390cb0a9..764b6293 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -3655,29 +3655,24 @@ gen6_render_fill_boxes(struct sna *sna, return FALSE; } - if (prefer_blt_fill(sna, dst_bo) || - too_large(dst->drawable.width, dst->drawable.height) || - !gen6_check_dst_format(format)) { + if (op <= PictOpSrc && + (prefer_blt_fill(sna, dst_bo) || + too_large(dst->drawable.width, dst->drawable.height) || + !gen6_check_dst_format(format))) { uint8_t alu = -1; - if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00)) + pixel = 0; + if (op == PictOpClear) alu = GXclear; - - if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) { + else if (sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) alu = GXcopy; - if (color->alpha <= 0x00ff) - alu = GXclear; - } - pixel = 0; - if ((alu == GXclear || - (alu == GXcopy && - sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format))) && + if (alu != -1 && sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, pixel, box, n)) diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 2b3f67b4..36ea8a1e 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -3738,29 +3738,24 @@ gen7_render_fill_boxes(struct sna *sna, return FALSE; } - if (prefer_blt_fill(sna, dst_bo) || - too_large(dst->drawable.width, dst->drawable.height) || - !gen7_check_dst_format(format)) { + if (op <= PictOpSrc && + (prefer_blt_fill(sna, dst_bo) || + too_large(dst->drawable.width, dst->drawable.height) || + !gen7_check_dst_format(format))) { uint8_t alu = -1; - if (op == PictOpClear || (op == PictOpOutReverse && color->alpha >= 0xff00)) + pixel = 0; + if (op == PictOpClear) alu = GXclear; - - if (op == PictOpSrc || (op == PictOpOver && color->alpha >= 0xff00)) { + else if (sna_get_pixel_from_rgba(&pixel, + color->red, + color->green, + color->blue, + color->alpha, + format)) alu = GXcopy; - if (color->alpha <= 0x00ff) - alu = GXclear; - } - pixel = 0; - if ((alu == GXclear || - (alu == GXcopy && - sna_get_pixel_from_rgba(&pixel, - color->red, - color->green, - color->blue, - color->alpha, - format))) && + if (alu != -1 && sna_blt_fill_boxes(sna, alu, dst_bo, dst->drawable.bitsPerPixel, pixel, box, n)) |