Enlightenment CVS committal

Author  : raster
Project : e17
Module  : proto

Dir     : e17/proto/gfx_routines


Modified Files:
        blend.c mmx.h pixel_op.c 
Added Files:
        pixel_op_fill.c pixel_op_fill_i386.c pixel_op_fill_ppc.c 


Log Message:


solid color fill routines - actually managing to beat memset by quite a
margin with the sse code :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/gfx_routines/blend.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- blend.c     27 Jan 2006 11:55:03 -0000      1.6
+++ blend.c     28 Jan 2006 04:25:54 -0000      1.7
@@ -668,6 +668,7 @@
             memcpy(dst, dstsrc, w * h * sizeof(DATA32));
             PO_INIT(&pp);
             pp.l = w * h;
+            pp.op = pop;
             pp.src.p = src;
             pp.dst.p = dst;
             pp.src.alpha = srcalpha;
@@ -684,6 +685,70 @@
 }
 
 int
+test_c_p32(DATA32 col, DATA32 *dst, DATA32 *dstsrc, int w, int h,
+          Pixel_Op pop, int dstalpha,
+          int loops, char *name, int tnum)
+{
+   char buf[4096];
+   int i, j, c;
+   double t1, t2;
+   Pixel_Op_Func fn;
+   Pixel_Op_Params pp;
+   char *cpu;
+   
+   PO_INIT(&pp);
+   pp.l = w;
+   pp.op = pop;
+   pp.src.c = col;
+   pp.dst.p = dst;
+   pp.dst.alpha = dstalpha;
+   for (c = 0; c < 5; c++)
+     {
+       fn = pixel_op_get(&pp, c);
+       if (!fn)
+         {
+            printf("[%02i] %38s            : NO FUNCTION\n", tnum, name);
+         }
+       else
+         {
+            pp.l = w;
+            memcpy(dst, dstsrc, w * h * sizeof(DATA32));
+            t1 = get_time();
+            for (i = 0; i < loops; i++)
+              {
+                 for (j = 0; j < h; j++)
+                   {
+                      pp.dst.p = dst + (w * j);
+                      fn(&pp);
+                   }
+              }
+            pixel_op_end();
+            t2 = get_time();
+            if      (c == 0) cpu = "C";
+            else if (c == 1) cpu = "OS";
+            else if (c == 2) cpu = "MMX/ALTIVEC";
+            else if (c == 3) cpu = "SSE";
+            else if (c == 4) cpu = "SSE2";
+            printf("[%02i] %38s %11s: %3.3f mpix/sec\n", tnum, name, cpu,
+                   (double)((w * h * loops) / 1000000.0) / (t2 - t1));
+            memcpy(dst, dstsrc, w * h * sizeof(DATA32));
+            PO_INIT(&pp);
+            pp.l = w * h;
+            pp.op = pop;
+            pp.src.c = col;
+            pp.dst.p = dst;
+            pp.dst.alpha = dstalpha;
+            fn(&pp);
+            pixel_op_end();
+            snprintf(buf, sizeof(buf), "out_%02i.png", tnum);
+            save_image_premul(dst, w, h, buf, 0);
+         }
+       tnum++;
+     }
+   return tnum;
+}
+
+int
 main(int argc, char **argv)
 {
    int w, h;
@@ -719,6 +784,12 @@
    test = 0;
    test = test_p32_p32(src, dst, solid_dst, w, h, PIXEL_OP_COPY, 0, 0, 0, 
loops,
                       "copy", test);
+   test = test_c_p32(0xffffffff, dst, solid_dst, w, h, PIXEL_OP_COPY, 0, loops,
+                    "set_white", test);
+   test = test_c_p32(0x00000000, dst, solid_dst, w, h, PIXEL_OP_COPY, 0, loops,
+                    "set_black", test);
+   test = test_c_p32(0x12345678, dst, solid_dst, w, h, PIXEL_OP_COPY, 0, loops,
+                    "set_color", test);
    /* FIXME: remember all ops could have an alpha mask as a destination */
    /* FIXME: test solid alpha mask fills */
    /* FIXME: test solid color fills */
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/gfx_routines/mmx.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- mmx.h       8 Jan 2006 11:53:10 -0000       1.1
+++ mmx.h       28 Jan 2006 04:25:54 -0000      1.2
@@ -648,6 +648,10 @@
        __asm__ __volatile__ ( \
                                 "pshuflw $" #imm ", %" #r1 ", %" #r2 " \n" \
                                 );
+#define pshufd(r1, r2, imm) \
+       __asm__ __volatile__ ( \
+                                "pshufd $" #imm ", %" #r1 ", %" #r2 " \n" \
+                                );
 
 /*     1x238 MOVE Doouble Quadword
        (this is both a load and a store...
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/gfx_routines/pixel_op.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pixel_op.c  28 Jan 2006 02:46:33 -0000      1.2
+++ pixel_op.c  28 Jan 2006 04:25:54 -0000      1.3
@@ -31,6 +31,26 @@
 #define OPFN(n) static void n(Pixel_Op_Params *p)
 #define OPREG(n, op, sp, sm, sc, sa, dpm, da, cpu) 
op_table[op][sp][sm][sc][sa][dpm][da][cpu] = n
 
+/* this is only here instead of autfoo checks - not perfect */
+#if defined(__POWERPC__) || defined(__powerpc__) || defined(__sparc__) || 
defined(sparc) ||  defined(__sparc64__) || defined(__mips__) || defined(m68k)
+# define WORDS_BIGENDIAN
+#else
+# undef WORDS_BIGENDIAN
+#endif
+
+#ifndef WORDS_BIGENDIAN
+# define A_VAL(p) ((DATA8 *)(p))[3]
+# define R_VAL(p) ((DATA8 *)(p))[2]
+# define G_VAL(p) ((DATA8 *)(p))[1]
+# define B_VAL(p) ((DATA8 *)(p))[0]
+#else
+# define A_VAL(p) ((DATA8 *)(p))[0]
+# define R_VAL(p) ((DATA8 *)(p))[1]
+# define G_VAL(p) ((DATA8 *)(p))[2]
+# define B_VAL(p) ((DATA8 *)(p))[3]
+#endif
+
+/* this is only here instead of autfoo checks - not perfect */
 #if defined(i386) || defined(__x86__) || defined(__x86_64__) || 
defined(__i386__) || defined(__386__) || defined(__i386)
 # define ARCH_X86
 
@@ -44,11 +64,14 @@
 
 # define OP_FN
 # include "pixel_op_copy.c"
+# include "pixel_op_fill.c"
 # include "pixel_op_copy_i386.c"
+# include "pixel_op_fill_i386.c"
 # undef OP_FN
 
 #endif
 
+/* this is only here instead of autfoo checks - not perfect */
 #if (defined(__POWERPC__) || defined(__powerpc__)) && defined(__VEC__)
 # define ARCH_PPC
 
@@ -58,7 +81,9 @@
 
 # define OP_FN
 # include "pixel_op_copy.c"
+# include "pixel_op_fill.c"
 # include "pixel_op_copy_ppc.c"
+# include "pixel_op_fill_ppc.c"
 # undef OP_FN
 
 #endif
@@ -163,11 +188,14 @@
    
 # define OP_REG
 # include "pixel_op_copy.c"
+# include "pixel_op_fill.c"
 # ifdef ARCH_X86
 #  include "pixel_op_copy_i386.c"
+#  include "pixel_op_fill_i386.c"
 # endif   
 # ifdef ARCH_PPC
 #  include "pixel_op_copy_ppc.c"
+#  include "pixel_op_fill_ppc.c"
 # endif   
 # undef OP_REG
 
@@ -198,8 +226,9 @@
    DATA8 dpm = D_P, da = D_AN;
    
    if (params->src.c == 0xffffffff) sc = S_CN;
-   else if ((params->src.c & 0xff000000) == 0x00000000) return NULL;
-   else if ((params->src.c & 0x00ffffff) == 0x00ffffff) src = S_CA;
+   else if (((params->src.c & 0xff000000) == 0x00000000) &&
+           (params->op != PIXEL_OP_COPY)) return NULL;
+   else if ((params->src.c & 0x00ffffff) == 0x00ffffff) sc = S_CA;
    if (params->src.p) sp = S_P1;
    if (params->src.m) sm = S_M1;
    sa += params->src.alpha;




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to