summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/xorg/xorg_composite.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2009-11-23 01:00:34 -0500
committerZack Rusin <zackr@vmware.com>2009-11-25 10:20:08 -0500
commitc712f3374626d96f9c08c3571a5572bcee60a5f2 (patch)
tree052ca2a98a7f83895b4d669c71a9e18eec2c774d /src/gallium/state_trackers/xorg/xorg_composite.c
parentd228e3cc8e7b6a3d4c6d554c5d9aed5e26be7ff0 (diff)
st/xorg: accelerate src luminance
Diffstat (limited to 'src/gallium/state_trackers/xorg/xorg_composite.c')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 4dbb490ca5..f16816b2a7 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -232,15 +232,25 @@ bind_blend_state(struct exa_context *exa, int op,
}
static unsigned
-picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, boolean mask)
+picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, boolean mask,
+ PicturePtr pDstPicture)
{
boolean set_alpha = FALSE;
boolean swizzle = FALSE;
unsigned ret = 0;
if (pSrc->picture_format == pSrcPicture->format) {
- if (pSrc->picture_format == PICT_a8)
- return mask ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE;
+ if (pSrc->picture_format == PICT_a8) {
+ if (mask)
+ return FS_MASK_LUMINANCE;
+ else if (pDstPicture->format != PICT_a8) {
+ /* if both dst and src are luminance then
+ * we don't want to swizzle the alpha (X) of the
+ * source into W component of the dst because
+ * it will break our destination */
+ return FS_SRC_LUMINANCE;
+ }
+ }
return 0;
}
@@ -285,7 +295,7 @@ picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, bool
static void
bind_shaders(struct exa_context *exa, int op,
- PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture,
struct exa_pixmap_priv *pSrc, struct exa_pixmap_priv *pMask)
{
unsigned vs_traits = 0, fs_traits = 0;
@@ -313,7 +323,7 @@ bind_shaders(struct exa_context *exa, int op,
vs_traits |= VS_COMPOSITE;
}
- fs_traits |= picture_format_fixups(pSrc, pSrcPicture, FALSE);
+ fs_traits |= picture_format_fixups(pSrc, pSrcPicture, FALSE, pDstPicture);
}
if (pMaskPicture) {
@@ -331,7 +341,7 @@ bind_shaders(struct exa_context *exa, int op,
fs_traits |= FS_CA_FULL;
}
- fs_traits |= picture_format_fixups(pMask, pMaskPicture, TRUE);
+ fs_traits |= picture_format_fixups(pMask, pMaskPicture, TRUE, pDstPicture);
}
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
@@ -497,7 +507,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
renderer_bind_viewport(exa->renderer, pDst);
bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture);
renderer_bind_rasterizer(exa->renderer);
- bind_shaders(exa, op, pSrcPicture, pMaskPicture, pSrc, pMask);
+ bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask);
bind_samplers(exa, op, pSrcPicture, pMaskPicture,
pDstPicture, pSrc, pMask, pDst);
setup_constant_buffers(exa, pDst);