From aa5a5684ebada60a1b103624a9b49aa085a406c1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 13 Nov 2013 16:25:54 +0000 Subject: [PATCH] sna/gen6+: Only substitute SRC for CLEAR if using the correct source If the source has not been verified to be clear, then using the SRC operator will paint the wrong color. Signed-off-by: Chris Wilson --- src/sna/gen6_render.c | 2 +- src/sna/gen7_render.c | 2 +- src/sna/sna_trapezoids_boxes.c | 3 +++ src/sna/sna_trapezoids_mono.c | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 8c57000..a2b4082 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -2159,7 +2159,7 @@ gen6_render_composite(struct sna *sna, width, height, tmp); - if (op == PictOpClear) + if (op == PictOpClear && src == sna->clear) op = PictOpSrc; tmp->op = op; if (!gen6_composite_set_target(sna, tmp, dst, diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 82c785f..f940803 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -2437,7 +2437,7 @@ gen7_render_composite(struct sna *sna, width, height, tmp); - if (op == PictOpClear) + if (op == PictOpClear && src == sna->clear) op = PictOpSrc; tmp->op = op; if (!gen7_composite_set_target(sna, tmp, dst, diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c index 4b0346b..23a3b45 100644 --- a/src/sna/sna_trapezoids_boxes.c +++ b/src/sna/sna_trapezoids_boxes.c @@ -197,6 +197,9 @@ composite_aligned_boxes(struct sna *sna, goto done; } + if (op == PictOpClear && sna->clear) + src = sna->clear; + if (force_fallback || !sna->render.composite(sna, op, src, NULL, dst, src_x, src_y, diff --git a/src/sna/sna_trapezoids_mono.c b/src/sna/sna_trapezoids_mono.c index f7b9a1c..40d0381 100644 --- a/src/sna/sna_trapezoids_mono.c +++ b/src/sna/sna_trapezoids_mono.c @@ -803,6 +803,9 @@ mono_trapezoids_span_converter(struct sna *sna, unbounded = (!sna_drawable_is_clear(dst->pDrawable) && !operator_is_bounded(op)); + if (op == PictOpClear && mono.sna->clear) + src = mono.sna->clear; + mono.sna = sna; if (!mono.sna->render.composite(mono.sna, op, src, NULL, dst, src_x + mono.clip.extents.x1 - dst_x - dx, -- 2.7.4