xf86-video-intel: 2 commits - src/i915_render.c uxa/uxa-render.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri May 14 13:17:53 PDT 2010
src/i915_render.c | 123 +++++++++++++++++++++---------------------------------
uxa/uxa-render.c | 31 ++++++++-----
2 files changed, 69 insertions(+), 85 deletions(-)
New commits:
commit 4be8d7eb89e61ffb2ceb19f1f84260e581187692
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 14 21:13:21 2010 +0100
i915: Don't force alpha=1 for RGB drawables in the shader.
I was blindly fixing rendercheck without thinking. We need to force the
alpha value to be in the blend unit and not before -- otherwise we
generate the incorrect result whilst blending. D'oh.
diff --git a/src/i915_render.c b/src/i915_render.c
index ad21a7c..1d89746 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -492,7 +492,6 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
uint32_t blendctl, tiling_bits;
Bool is_affine_src, is_affine_mask;
Bool is_solid_src, is_solid_mask;
- Bool dst_has_alpha = PICT_FORMAT_A(dest_picture->format);
int tex_count, t;
intel->needs_render_state_emit = FALSE;
@@ -610,13 +609,10 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
{
FS_LOCALS(20);
- int src_reg, mask_reg, out_reg = FS_OC;
+ int src_reg, mask_reg;
FS_BEGIN();
- if (dst_format == COLR_BUF_8BIT)
- out_reg = FS_U0;
-
/* Declare the registers necessary for our program. */
t = 0;
if (is_solid_src) {
@@ -627,23 +623,11 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
i915_fs_dcl(FS_S0);
t++;
}
- if (mask) {
- if (is_solid_mask) {
- i915_fs_dcl(FS_T9);
- mask_reg = FS_T9;
- } else {
- i915_fs_dcl(FS_T0 + t);
- i915_fs_dcl(FS_S0 + t);
- }
- }
-
if (!mask) {
/* No mask, so load directly to output color */
if (! is_solid_src) {
if (dst_format == COLR_BUF_8BIT)
src_reg = FS_R0;
- else if (dst_has_alpha)
- src_reg = FS_OC;
else
src_reg = FS_R0;
if (is_affine_src)
@@ -654,12 +638,17 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
if (src_reg != FS_OC) {
if (dst_format == COLR_BUF_8BIT)
i915_fs_mov(FS_OC, i915_fs_operand(src_reg, W, W, W, W));
- else if (dst_has_alpha)
- i915_fs_mov(FS_OC, i915_fs_operand_reg(src_reg));
else
- i915_fs_mov(FS_OC, i915_fs_operand(src_reg, X, Y, Z, ONE));
+ i915_fs_mov(FS_OC, i915_fs_operand_reg(src_reg));
}
} else {
+ if (is_solid_mask) {
+ i915_fs_dcl(FS_T9);
+ mask_reg = FS_T9;
+ } else {
+ i915_fs_dcl(FS_T0 + t);
+ i915_fs_dcl(FS_S0 + t);
+ }
if (! is_solid_src) {
/* Load the source_picture texel */
if (is_affine_src) {
@@ -671,61 +660,49 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
src_reg = FS_R0;
}
- if (! is_solid_mask) {
- /* Load the mask_picture texel */
- if (is_affine_mask) {
- i915_fs_texld(FS_R1, FS_S0 + t, FS_T0 + t);
- } else {
- i915_fs_texldp(FS_R1, FS_S0 + t, FS_T0 + t);
- }
-
- mask_reg = FS_R1;
- }
+ if (! is_solid_mask) {
+ /* Load the mask_picture texel */
+ if (is_affine_mask) {
+ i915_fs_texld(FS_R1, FS_S0 + t, FS_T0 + t);
+ } else {
+ i915_fs_texldp(FS_R1, FS_S0 + t, FS_T0 + t);
+ }
- /* If component alpha is active in the mask and the blend
- * operation uses the source alpha, then we know we don't
- * need the source value (otherwise we would have hit a
- * fallback earlier), so we provide the source alpha (src.A *
- * mask.X) as output color.
- * Conversely, if CA is set and we don't need the source alpha,
- * then we produce the source value (src.X * mask.X) and the
- * source alpha is unused. Otherwise, we provide the non-CA
- * source value (src.X * mask.A).
- */
- if (mask_picture->componentAlpha &&
- PICT_FORMAT_RGB(mask_picture->format)) {
- if (i915_blend_op[op].src_alpha) {
- if (dst_has_alpha)
- i915_fs_mul(out_reg,
- i915_fs_operand(src_reg, W, W, W, W),
- i915_fs_operand_reg(mask_reg));
- else
- i915_fs_mul(out_reg,
- i915_fs_operand(src_reg, W, W, W, ONE),
- i915_fs_operand(mask_reg, X, Y, Z, ONE));
- } else {
- if (dst_has_alpha)
- i915_fs_mul(out_reg,
- i915_fs_operand_reg(src_reg),
- i915_fs_operand_reg(mask_reg));
- else
- i915_fs_mul(out_reg,
- i915_fs_operand(src_reg, X, Y, Z, ONE),
- i915_fs_operand(mask_reg, X, Y, Z, ONE));
- }
- } else {
- if (dst_has_alpha)
- i915_fs_mul(out_reg,
- i915_fs_operand_reg(src_reg),
- i915_fs_operand(mask_reg, W, W, W, W));
- else
- i915_fs_mul(out_reg,
- i915_fs_operand(src_reg, X, Y, Z, ONE),
- i915_fs_operand(mask_reg, W, W, W, ONE));
- }
+ mask_reg = FS_R1;
+ }
- if (dst_format == COLR_BUF_8BIT)
- i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
+ if (dst_format == COLR_BUF_8BIT) {
+ i915_fs_mul(FS_OC,
+ i915_fs_operand(src_reg, W, W, W, W),
+ i915_fs_operand(mask_reg, W, W, W, W));
+ } else {
+ /* If component alpha is active in the mask and the blend
+ * operation uses the source alpha, then we know we don't
+ * need the source value (otherwise we would have hit a
+ * fallback earlier), so we provide the source alpha (src.A *
+ * mask.X) as output color.
+ * Conversely, if CA is set and we don't need the source alpha,
+ * then we produce the source value (src.X * mask.X) and the
+ * source alpha is unused. Otherwise, we provide the non-CA
+ * source value (src.X * mask.A).
+ */
+ if (mask_picture->componentAlpha &&
+ PICT_FORMAT_RGB(mask_picture->format)) {
+ if (i915_blend_op[op].src_alpha) {
+ i915_fs_mul(FS_OC,
+ i915_fs_operand(src_reg, W, W, W, W),
+ i915_fs_operand_reg(mask_reg));
+ } else {
+ i915_fs_mul(FS_OC,
+ i915_fs_operand_reg(src_reg),
+ i915_fs_operand_reg(mask_reg));
+ }
+ } else {
+ i915_fs_mul(FS_OC,
+ i915_fs_operand_reg(src_reg),
+ i915_fs_operand(mask_reg, W, W, W, W));
+ }
+ }
}
FS_END();
commit b9a5e36f957e42eaf0387ad15f2298d3e9538b05
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 14 20:52:48 2010 +0100
uxa: enable solid rects for backends that require pixmaps
Convert the color into a (cached) pixmap if the backend cannot handle
the SolidFill natively.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 39793ba..cf643e3 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -860,7 +860,7 @@ uxa_solid_rects (CARD8 op,
{
ScreenPtr screen = dst->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
- PixmapPtr pixmap;
+ PixmapPtr pixmap, src_pixmap = NULL;
int dst_x, dst_y;
PicturePtr src;
int error;
@@ -872,17 +872,12 @@ uxa_solid_rects (CARD8 op,
if (dst->alphaMap)
goto fallback;
- if (!uxa_screen->info->check_composite_texture)
- goto fallback;
-
pixmap = uxa_get_offscreen_pixmap(dst->pDrawable, &dst_x, &dst_y);
if (!pixmap)
goto fallback;
if (op == PictOpClear)
color->red = color->green = color->blue = color->alpha = 0;
- if (PICT_FORMAT_A(dst->format) == 0)
- color->alpha = 0xffff;
if (color->alpha >= 0xff00 && op == PictOpOver)
op = PictOpSrc;
@@ -890,17 +885,27 @@ uxa_solid_rects (CARD8 op,
if (!src)
goto fallback;
- if (!uxa_screen->info->check_composite(op, src, NULL, dst) ||
+ if (!uxa_screen->info->check_composite(op, src, NULL, dst))
+ goto err_src;
+
+ if (!uxa_screen->info->check_composite_texture ||
!uxa_screen->info->check_composite_texture(screen, src)) {
- FreePicture(src, 0);
- goto fallback;
- }
+ PicturePtr solid;
+ int src_off_x, src_off_y;
- if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, NULL, NULL, pixmap)) {
+ solid = uxa_acquire_solid(screen, src->pSourcePict);
FreePicture(src, 0);
- goto fallback;
+
+ src = solid;
+ src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
+ &src_off_x, &src_off_y);
+ if (!src_pixmap)
+ goto err_src;
}
+ if (!uxa_screen->info->prepare_composite(op, src, NULL, dst, src_pixmap, NULL, pixmap))
+ goto err_src;
+
while (num_rects--) {
uxa_screen->info->composite(pixmap,
0, 0, 0, 0,
@@ -916,6 +921,8 @@ uxa_solid_rects (CARD8 op,
return;
+err_src:
+ FreePicture(src, 0);
fallback:
uxa_screen->SavedCompositeRects(op, dst, color, num_rects, rects);
}
More information about the xorg-commit
mailing list