diff options
author | Tan Hu <tan.hu@zte.com.cn> | 2016-05-27 17:05:15 +0800 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-06-01 18:17:16 +0900 |
commit | 0945db4d902056bda3d9ad4a4de2dfa685d10a70 (patch) | |
tree | 757ff9c56e06a50cd60a20641184b53046a97c65 /src/r6xx_accel.c | |
parent | 9b9ad669c748f53247e53fa3f3b03a77da5e5cb3 (diff) |
EXA/6xx/7xx: accelerate PictOpOver with component alpha
Subpixel text rendering is typically done with a solid src and
a pixmap mask. Traditionally, this cannot be accelerated in a single
pass and requires two passes [1]. However, we can cheat a little
with a constant blend color.
We can use:
const.A = src.A / src.A
const.R = src.R / src.A
const.G = src.G / src.A
const.B = src.B / src.A
dst.A = const.A * (src.A * mask.A) + (1 - (src.A * mask.A)) * dst.A
dst.R = const.R * (src.A * mask.R) + (1 - (src.A * mask.R)) * dst.R
dst.G = const.G * (src.A * mask.G) + (1 - (src.A * mask.G)) * dst.G
dst.B = const.B * (src.A * mask.B) + (1 - (src.A * mask.B)) * dst.B
This only needs a single source value. src.A is cancelled down in
the right places.
[1] http://anholt.livejournal.com/32058.html
r6xx still be used on some machine,
Ported from commit 4375a6e75e5d41139be7031a0dee58c057ecbd07.
Signed-off-by: Tan Hu <tan.hu@zte.com.cn>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Diffstat (limited to 'src/r6xx_accel.c')
-rw-r--r-- | src/r6xx_accel.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c index a97c84b3..1f5c0523 100644 --- a/src/r6xx_accel.c +++ b/src/r6xx_accel.c @@ -174,6 +174,20 @@ r600_sq_setup(ScrnInfoPtr pScrn, sq_config_t *sq_conf) END_BATCH(); } +void r600_set_blend_color(ScrnInfoPtr pScrn, float *color) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + BEGIN_BATCH(2 + 4); + PACK0(CB_BLEND_RED, 4); + EFLOAT(color[0]); /* R */ + EFLOAT(color[1]); /* G */ + EFLOAT(color[2]); /* B */ + EFLOAT(color[3]); /* A */ + END_BATCH(); +} + + void r600_set_render_target(ScrnInfoPtr pScrn, cb_config_t *cb_conf, uint32_t domain) { |