Mesa (master): exa: check whether the op is accelerated

Zack Rusin zack at kemper.freedesktop.org
Tue Aug 25 17:18:30 UTC 2009


Module: Mesa
Branch: master
Commit: c7653a83330e5ea63ad3a566da15155e216c6cb4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7653a83330e5ea63ad3a566da15155e216c6cb4

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Aug 25 13:22:20 2009 -0400

exa: check whether the op is accelerated

---

 src/gallium/state_trackers/xorg/xorg_composite.c |   57 ++++++++++++++++++++++
 src/gallium/state_trackers/xorg/xorg_exa_tgsi.c  |   21 --------
 2 files changed, 57 insertions(+), 21 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 05143ad..bf9c82a 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;
 }
 
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 85451e4..9896d06 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -33,33 +33,12 @@ struct shader_id {
  * IN[2]    = pos mask
  * CONST[0] = (0, 0, 0, 1)
  */
-struct xorg_render_ops_tgsi {
-   int op;
-};
-
 
 static const char over_op[] =
    "SUB TEMP[3], CONST[0].wwww, TEMP[1].wwww\n"
    "MUL TEMP[3], TEMP[0], TEMP[3]\n"
    "ADD TEMP[0], TEMP[3], TEMP[0]\n";
 
-static const struct xorg_render_ops_tgsi ops_map[] = {
-   {PictOpClear},
-   {PictOpSrc},
-   {PictOpDst},
-   {PictOpOver},
-   {PictOpOverReverse},
-   {PictOpIn},
-   {PictOpInReverse},
-   {PictOpOut},
-   {PictOpOutReverse},
-   {PictOpAtop},
-   {PictOpAtopReverse},
-   {PictOpXor},
-   {PictOpAdd},
-   {PictOpSaturate},
-};
-
 
 static INLINE void
 create_preamble(struct ureg_program *ureg)




More information about the mesa-commit mailing list