summaryrefslogtreecommitdiff
path: root/src/evergreen_accel.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2013-07-22 02:30:28 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2013-07-22 05:05:48 +0200
commit4375a6e75e5d41139be7031a0dee58c057ecbd07 (patch)
tree90bb91b0354a4ac421fbc5c1924334930f6e5d4f /src/evergreen_accel.c
parent94d0d14914a025525a0766669b556eaa6681def7 (diff)
EXA/evergreen/ni: 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
Diffstat (limited to 'src/evergreen_accel.c')
-rw-r--r--src/evergreen_accel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/evergreen_accel.c b/src/evergreen_accel.c
index 10f2e511..e25010b8 100644
--- a/src/evergreen_accel.c
+++ b/src/evergreen_accel.c
@@ -335,7 +335,19 @@ evergreen_set_render_target(ScrnInfoPtr pScrn, cb_config_t *cb_conf, uint32_t do
(CB_NORMAL << CB_COLOR_CONTROL__MODE_shift)));
EREG(CB_BLEND0_CONTROL, cb_conf->blendcntl);
END_BATCH();
+}
+void evergreen_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();
}
static void