Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sun don't wait for the blitter unless we want to sen...



details:   https://anonhg.NetBSD.org/src/rev/c5ca8c9cf1d5
branches:  trunk
changeset: 780080:c5ca8c9cf1d5
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Jul 11 16:59:55 2012 +0000

description:
don't wait for the blitter unless we want to send another command and the
pipeline is full

diffstat:

 sys/dev/sun/cgsix.c |  64 +++++++++++++++++++++++++++-------------------------
 1 files changed, 33 insertions(+), 31 deletions(-)

diffs (200 lines):

diff -r e2780f43e044 -r c5ca8c9cf1d5 sys/dev/sun/cgsix.c
--- a/sys/dev/sun/cgsix.c       Wed Jul 11 16:41:16 2012 +0000
+++ b/sys/dev/sun/cgsix.c       Wed Jul 11 16:59:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgsix.c,v 1.55 2012/07/11 15:03:14 macallan Exp $ */
+/*     $NetBSD: cgsix.c,v 1.56 2012/07/11 16:59:55 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.55 2012/07/11 15:03:14 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.56 2012/07/11 16:59:55 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -281,22 +281,14 @@
 )
 
 /*
- * Wait for a blit to finish.
- * 0x8000000 bit: function unknown; 0x20000000 bit: GX_BLT_INPROGRESS
+ * Run a blitter command
  */
-#define CG6_BLIT_WAIT(fbc) do {                                                \
-       while (((fbc)->fbc_blit & 0xa0000000) == 0xa0000000)            \
-               /*EMPTY*/;                                              \
-} while (0)
+#define CG6_BLIT(f) { volatile uint32_t foo; foo = f->fbc_blit; }
 
 /*
- * Wait for a drawing operation to finish, or at least get queued.
- * 0x8000000 bit: function unknown; 0x20000000 bit: GX_FULL
+ * Run a drawing command
  */
-#define CG6_DRAW_WAIT(fbc) do {                                                \
-               while (((fbc)->fbc_draw & 0xa0000000) == 0xa0000000)            \
-               /*EMPTY*/;                                              \
-} while (0)
+#define CG6_DRAW(f) { volatile uint32_t foo; foo = f->fbc_draw; }
 
 /*
  * Wait for the whole engine to go idle.  This may not matter in our case;
@@ -305,7 +297,12 @@
  * 0x10000000 bit: GX_INPROGRESS
  */
 #define CG6_DRAIN(fbc) do {                                            \
-       while ((fbc)->fbc_s & 0x10000000)                               \
+       while ((fbc)->fbc_s & GX_INPROGRESS)                            \
+               /*EMPTY*/;                                              \
+} while (0)
+
+#define CG6_WAIT_READY(fbc) do {                                       \
+               while (((fbc)->fbc_s & GX_FULL) != 0)                           \
                /*EMPTY*/;                                              \
 } while (0)
 
@@ -367,6 +364,8 @@
        src *= ri->ri_font->fontheight;
        dst *= ri->ri_font->fontheight;
 
+       CG6_WAIT_READY(fbc);
+
        fbc->fbc_alu = CG6_ALU_COPY;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
 
@@ -378,8 +377,7 @@
        fbc->fbc_y2 = ri->ri_yorigin + dst;
        fbc->fbc_x3 = ri->ri_xorigin + ri->ri_emuwidth - 1;
        fbc->fbc_y3 = ri->ri_yorigin + dst + n - 1;
-       CG6_BLIT_WAIT(fbc);
-       CG6_DRAIN(fbc);
+       CG6_BLIT(fbc);
 }
 
 static void
@@ -413,6 +411,8 @@
        dst *= ri->ri_font->fontwidth;
        row *= ri->ri_font->fontheight;
 
+       CG6_WAIT_READY(fbc);
+
        fbc->fbc_alu = CG6_ALU_COPY;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
 
@@ -426,8 +426,7 @@
        fbc->fbc_x3 = ri->ri_xorigin + dst + n - 1;
        fbc->fbc_y3 = ri->ri_yorigin + row + 
            ri->ri_font->fontheight - 1;
-       CG6_BLIT_WAIT(fbc);
-       CG6_DRAIN(fbc);
+       CG6_BLIT(fbc);
 }
 
 static void
@@ -452,6 +451,7 @@
        col *= ri->ri_font->fontwidth;
        row *= ri->ri_font->fontheight;
 
+       CG6_WAIT_READY(fbc);
        fbc->fbc_alu = CG6_ALU_FILL;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
 
@@ -461,8 +461,7 @@
        fbc->fbc_arecty = ri->ri_yorigin + row + 
            ri->ri_font->fontheight - 1;
        fbc->fbc_arectx = ri->ri_xorigin + col + n - 1;
-       CG6_DRAW_WAIT(fbc);
-       CG6_DRAIN(fbc);
+       CG6_DRAW(fbc);
 }
 
 static void
@@ -482,6 +481,7 @@
        if (n <= 0)
                return;
 
+       CG6_WAIT_READY(fbc);
        fbc->fbc_alu = CG6_ALU_FILL;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
 
@@ -499,8 +499,7 @@
                    (n * ri->ri_font->fontheight) - 1;
                fbc->fbc_arectx = ri->ri_xorigin + ri->ri_emuwidth - 1;
        }
-       CG6_DRAW_WAIT(fbc);
-       CG6_DRAIN(fbc);
+       CG6_DRAW(fbc);
 }
 
 #if defined(RASTERCONSOLE) && defined(CG6_BLIT_CURSOR)
@@ -1275,8 +1274,8 @@
     uint32_t col)
 {
        volatile struct cg6_fbc *fbc = sc->sc_fbc;
-       
-       CG6_DRAIN(fbc);
+
+       CG6_WAIT_READY(fbc);
 
        fbc->fbc_alu = CG6_ALU_FILL;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
@@ -1286,7 +1285,7 @@
        fbc->fbc_arectx = xs;
        fbc->fbc_arecty = ys + he - 1;
        fbc->fbc_arectx = xs + wi - 1;
-       CG6_DRAW_WAIT(fbc);
+       CG6_DRAW(fbc);
 }
 
 void 
@@ -1294,7 +1293,9 @@
     uint32_t fg, uint32_t bg) 
 {
        volatile struct cg6_fbc *fbc=sc->sc_fbc;
-       CG6_DRAIN(fbc);
+
+       CG6_WAIT_READY(fbc);
+
        fbc->fbc_x0 = x;
        fbc->fbc_x1 = x + wi - 1;
        fbc->fbc_y0 = y;
@@ -1432,7 +1433,7 @@
        if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
                volatile struct cg6_fbc *fbc = sc->sc_fbc;
                
-               CG6_DRAIN(fbc);
+               CG6_WAIT_READY(fbc);
 
                fbc->fbc_alu = CG6_ALU_FILL;
                fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
@@ -1442,7 +1443,7 @@
                fbc->fbc_arecty = 0;
                fbc->fbc_arectx = ri->ri_width - 1;
                fbc->fbc_arecty = ri->ri_height - 1;
-               CG6_DRAW_WAIT(fbc);
+               CG6_DRAW(fbc);
        }
 }
 
@@ -1454,14 +1455,15 @@
 {
        volatile struct cg6_fbc *fbc = sc->sc_fbc;
        
-       CG6_DRAIN(fbc);
+       CG6_WAIT_READY(fbc);
+
        fbc->fbc_alu = CG6_ALU_FLIP;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
        fbc->fbc_arecty = y;
        fbc->fbc_arectx = x;
        fbc->fbc_arecty = y + he - 1;
        fbc->fbc_arectx = x + wi - 1;
-       CG6_DRAW_WAIT(fbc);
+       CG6_DRAW(fbc);
 }
 
 #endif



Home | Main Index | Thread Index | Old Index