summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/xorg/xorg_composite.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2009-08-25 13:22:20 -0400
committerZack Rusin <zackr@vmware.com>2009-08-25 13:23:08 -0400
commitc7653a83330e5ea63ad3a566da15155e216c6cb4 (patch)
treef77657ca181cddbc8701bfb276af1a2aca3e9b8b /src/gallium/state_trackers/xorg/xorg_composite.c
parentc3374bf97ecd82b915fb29c7c04951e2b75d4dbc (diff)
exa: check whether the op is accelerated
Diffstat (limited to 'src/gallium/state_trackers/xorg/xorg_composite.c')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 05143ad11a..bf9c82a707 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -32,11 +32,68 @@ static const struct xorg_composite_blend xorg_blends[] = {
PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA },
};
+struct acceleration_info {
+ int op : 16;
+ int with_mask : 1;
+ int component_alpha : 1;
+};
+static const struct acceleration_info accelerated_ops[] = {
+ {PictOpClear, 1, 0},
+ {PictOpSrc, 1, 0},
+ {PictOpDst, 1, 0},
+ {PictOpOver, 1, 0},
+ {PictOpOverReverse, 1, 0},
+ {PictOpIn, 1, 0},
+ {PictOpInReverse, 1, 0},
+ {PictOpOut, 1, 0},
+ {PictOpOutReverse, 1, 0},
+ {PictOpAtop, 1, 0},
+ {PictOpAtopReverse, 1, 0},
+ {PictOpXor, 1, 0},
+ {PictOpAdd, 1, 0},
+ {PictOpSaturate, 1, 0},
+};
+
+static void
+draw_texture(struct exa_context *exa)
+{
+#if 0
+ if (buf) {
+ util_draw_vertex_buffer(pipe, buf, 0,
+ PIPE_PRIM_TRIANGLE_FAN,
+ 4, /* verts */
+ 2); /* attribs/vert */
+
+ pipe_buffer_reference(&buf, NULL);
+ }
+#endif
+}
+
boolean xorg_composite_accelerated(int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
+ unsigned i;
+ unsigned accel_ops_count =
+ sizeof(accelerated_ops)/sizeof(struct acceleration_info);
+
+ if (pSrcPicture) {
+ /* component alpha not supported */
+ if (pSrcPicture->componentAlpha)
+ return FALSE;
+ /* fills not supported */
+ if (pSrcPicture->pSourcePict)
+ return FALSE;
+ }
+
+ for (i = 0; i < accel_ops_count; ++i) {
+ if (op == accelerated_ops[i].op) {
+ if (pMaskPicture && !accelerated_ops[i].with_mask)
+ return FALSE;
+ return TRUE;
+ }
+ }
return FALSE;
}