Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa
This commit is contained in:
commit
f8bee0e412
|
@ -68,64 +68,48 @@ pixel_to_float4(Pixel pixel, float *color)
|
||||||
color[3] = ((float)a) / 255.;
|
color[3] = ((float)a) / 255.;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct acceleration_info {
|
static boolean
|
||||||
int op : 16;
|
blend_for_op(struct xorg_composite_blend *blend,
|
||||||
};
|
int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||||
static const struct acceleration_info accelerated_ops[] = {
|
|
||||||
{PictOpClear, },
|
|
||||||
{PictOpSrc, },
|
|
||||||
{PictOpDst, },
|
|
||||||
{PictOpOver, },
|
|
||||||
{PictOpOverReverse, },
|
|
||||||
{PictOpIn, },
|
|
||||||
{PictOpInReverse, },
|
|
||||||
{PictOpOut, },
|
|
||||||
{PictOpOutReverse, },
|
|
||||||
{PictOpAtop, },
|
|
||||||
{PictOpAtopReverse, },
|
|
||||||
{PictOpXor, },
|
|
||||||
{PictOpAdd, },
|
|
||||||
{PictOpSaturate, },
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct xorg_composite_blend
|
|
||||||
blend_for_op(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
|
||||||
PicturePtr pDstPicture)
|
PicturePtr pDstPicture)
|
||||||
{
|
{
|
||||||
const int num_blends =
|
const int num_blends =
|
||||||
sizeof(xorg_blends)/sizeof(struct xorg_composite_blend);
|
sizeof(xorg_blends)/sizeof(struct xorg_composite_blend);
|
||||||
int i;
|
int i;
|
||||||
struct xorg_composite_blend blend = xorg_blends[BLEND_OP_OVER];
|
boolean supported = FALSE;
|
||||||
|
|
||||||
|
/* our default in case something goes wrong */
|
||||||
|
*blend = xorg_blends[BLEND_OP_OVER];
|
||||||
|
|
||||||
for (i = 0; i < num_blends; ++i) {
|
for (i = 0; i < num_blends; ++i) {
|
||||||
if (xorg_blends[i].op == op)
|
if (xorg_blends[i].op == op) {
|
||||||
blend = xorg_blends[i];
|
*blend = xorg_blends[i];
|
||||||
|
supported = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's no dst alpha channel, adjust the blend op so that we'll treat
|
/* If there's no dst alpha channel, adjust the blend op so that we'll treat
|
||||||
* it as always 1.
|
* it as always 1. */
|
||||||
*/
|
|
||||||
if (pDstPicture &&
|
if (pDstPicture &&
|
||||||
PICT_FORMAT_A(pDstPicture->format) == 0 && blend.alpha_dst) {
|
PICT_FORMAT_A(pDstPicture->format) == 0 && blend->alpha_dst) {
|
||||||
if (blend.rgb_src == PIPE_BLENDFACTOR_DST_ALPHA)
|
if (blend->rgb_src == PIPE_BLENDFACTOR_DST_ALPHA)
|
||||||
blend.rgb_src = PIPE_BLENDFACTOR_ONE;
|
blend->rgb_src = PIPE_BLENDFACTOR_ONE;
|
||||||
else if (blend.rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA)
|
else if (blend->rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA)
|
||||||
blend.rgb_src = PIPE_BLENDFACTOR_ZERO;
|
blend->rgb_src = PIPE_BLENDFACTOR_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the source alpha is being used, then we should only be in a case where
|
/* If the source alpha is being used, then we should only be in a case where
|
||||||
* the source blend factor is 0, and the source blend value is the mask
|
* the source blend factor is 0, and the source blend value is the mask
|
||||||
* channels multiplied by the source picture's alpha.
|
* channels multiplied by the source picture's alpha. */
|
||||||
*/
|
|
||||||
if (pMaskPicture && pMaskPicture->componentAlpha &&
|
if (pMaskPicture && pMaskPicture->componentAlpha &&
|
||||||
PICT_FORMAT_RGB(pMaskPicture->format) && blend.alpha_src) {
|
PICT_FORMAT_RGB(pMaskPicture->format) && blend->alpha_src) {
|
||||||
if (blend.rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) {
|
if (blend->rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) {
|
||||||
blend.rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR;
|
blend->rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR;
|
||||||
} else if (blend.rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) {
|
} else if (blend->rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) {
|
||||||
blend.rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR;
|
blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return blend;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int
|
static INLINE int
|
||||||
|
@ -191,9 +175,7 @@ boolean xorg_composite_accelerated(int op,
|
||||||
ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
|
ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
modesettingPtr ms = modesettingPTR(pScrn);
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
unsigned i;
|
struct xorg_composite_blend blend;
|
||||||
unsigned accel_ops_count =
|
|
||||||
sizeof(accelerated_ops)/sizeof(struct acceleration_info);
|
|
||||||
|
|
||||||
if (!is_filter_accelerated(pSrcPicture) ||
|
if (!is_filter_accelerated(pSrcPicture) ||
|
||||||
!is_filter_accelerated(pMaskPicture)) {
|
!is_filter_accelerated(pMaskPicture)) {
|
||||||
|
@ -205,24 +187,18 @@ boolean xorg_composite_accelerated(int op,
|
||||||
XORG_FALLBACK("Gradients not enabled (haven't been well tested)");
|
XORG_FALLBACK("Gradients not enabled (haven't been well tested)");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < accel_ops_count; ++i) {
|
if (blend_for_op(&blend, op,
|
||||||
if (op == accelerated_ops[i].op) {
|
pSrcPicture, pMaskPicture, pDstPicture)) {
|
||||||
struct xorg_composite_blend blend = blend_for_op(op,
|
/* Check for component alpha */
|
||||||
pSrcPicture,
|
if (pMaskPicture && pMaskPicture->componentAlpha &&
|
||||||
pMaskPicture,
|
PICT_FORMAT_RGB(pMaskPicture->format)) {
|
||||||
pDstPicture);
|
if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) {
|
||||||
/* Check for component alpha */
|
XORG_FALLBACK("Component alpha not supported with source "
|
||||||
if (pMaskPicture && pMaskPicture->componentAlpha &&
|
"alpha and source value blending. (op=%d)",
|
||||||
PICT_FORMAT_RGB(pMaskPicture->format)) {
|
op);
|
||||||
if (blend.alpha_src &&
|
|
||||||
blend.rgb_src != PIPE_BLENDFACTOR_ZERO) {
|
|
||||||
XORG_FALLBACK("Component alpha not supported with source "
|
|
||||||
"alpha and source value blending. (op=%d)",
|
|
||||||
op);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
XORG_FALLBACK("Unsupported composition operation = %d", op);
|
XORG_FALLBACK("Unsupported composition operation = %d", op);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +212,7 @@ bind_blend_state(struct exa_context *exa, int op,
|
||||||
struct xorg_composite_blend blend_opt;
|
struct xorg_composite_blend blend_opt;
|
||||||
struct pipe_blend_state blend;
|
struct pipe_blend_state blend;
|
||||||
|
|
||||||
blend_opt = blend_for_op(op, pSrcPicture, pMaskPicture, pDstPicture);
|
blend_for_op(&blend_opt, op, pSrcPicture, pMaskPicture, pDstPicture);
|
||||||
|
|
||||||
memset(&blend, 0, sizeof(struct pipe_blend_state));
|
memset(&blend, 0, sizeof(struct pipe_blend_state));
|
||||||
blend.blend_enable = 1;
|
blend.blend_enable = 1;
|
||||||
|
|
Loading…
Reference in New Issue