diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-09 20:12:03 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-04-09 20:15:41 +0100 |
commit | 6c07f467a347ea35b682fe4d21c5071adcf4e2aa (patch) | |
tree | 229c36a4f5bc61b15299bc4624862a6402c1edc2 | |
parent | d08221edabc58bf7aab27931235d1746407bacb0 (diff) |
sna: Apply the precomputed BLT colors for SRC reductions
Eek, after computing what the resultant color should be, we should
endeavour to use it!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_blt.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index ff2bdc87..d7441ada 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -2598,6 +2598,7 @@ sna_blt_composite(struct sna *sna, clear: if (was_clear && sna_pixmap(tmp->dst.pixmap)->clear_color == 0) { sna_pixmap(tmp->dst.pixmap)->clear = true; +nop: return prepare_blt_nop(sna, tmp); } @@ -2652,22 +2653,32 @@ clear: if (sna_pixmap(tmp->dst.pixmap)->clear_color == 0) op = PictOpSrc; if (op == PictOpOver) { + unsigned dst_color = solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color); color = over(get_solid_color(src, PICT_a8r8g8b8), - solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color)); + dst_color); op = PictOpSrc; DBG(("%s: precomputing solid OVER (%08x, %08x) -> %08x\n", __FUNCTION__, get_solid_color(src, PICT_a8r8g8b8), solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color), color)); + if (color == dst_color) + goto nop; + else + goto fill; } if (op == PictOpAdd) { + unsigned dst_color = solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color); color = add(get_solid_color(src, PICT_a8r8g8b8), - solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color)); + dst_color); op = PictOpSrc; DBG(("%s: precomputing solid ADD (%08x, %08x) -> %08x\n", __FUNCTION__, get_solid_color(src, PICT_a8r8g8b8), solid_color(dst->format, sna_pixmap(tmp->dst.pixmap)->clear_color), color)); + if (color == dst_color) + goto nop; + else + goto fill; } } if (op == PictOpOutReverse && is_opaque_solid(src)) |