add support for manual blit
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 10 Dec 2007 23:25:32 +0000 (23:25 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 10 Dec 2007 23:25:32 +0000 (23:25 +0000)
lib/gdi/fb.cpp
lib/gdi/fb.h
lib/gdi/gfbdc.cpp
lib/gdi/grc.cpp
lib/gdi/grc.h
lib/gui/ewidgetdesktop.cpp
main/bsod.cpp
main/enigma.cpp

index 5d89590..adf06a2 100644 (file)
 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
 #endif
 
+#ifndef FBIO_BLIT
+#define FBIO_SET_MANUAL_BLIT _IOW('F', 0x21, __u8)
+#define FBIO_BLIT 0x22
+#endif
 
 fbClass *fbClass::instance;
 
@@ -23,6 +27,7 @@ fbClass *fbClass::getInstance()
 
 fbClass::fbClass(const char *fb)
 {
+       m_manual_blit=0;
        instance=this;
        locked=0;
        available=0;
@@ -39,6 +44,8 @@ fbClass::fbClass(const char *fb)
                perror(fb);
                goto nolfb;
        }
+
+
        if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo)<0)
        {
                perror("FBIOGET_VSCREENINFO");
@@ -64,6 +71,8 @@ fbClass::fbClass(const char *fb)
        }
 
        showConsole(0);
+
+       enableManualBlit();
        return;
 nolfb:
        lfb=0;
@@ -146,6 +155,14 @@ int fbClass::waitVSync()
        return ioctl(fd, FBIO_WAITFORVSYNC, &c);
 }
 
+void fbClass::blit()
+{
+       if (m_manual_blit) {
+               if (ioctl(fd, FBIO_BLIT) < 0)
+                       perror("FBIO_BLIT");
+       }
+}
+
 fbClass::~fbClass()
 {
        if (available)
@@ -153,6 +170,7 @@ fbClass::~fbClass()
        if (lfb)
                munmap(lfb, available);
        showConsole(1);
+       disableManualBlit();
 }
 
 int fbClass::PutCMAP()
@@ -176,3 +194,22 @@ void fbClass::unlock()
        SetMode(xRes, yRes, bpp);
        PutCMAP();
 }
+
+void fbClass::enableManualBlit()
+{
+       unsigned char tmp = 1;
+       if (ioctl(fd,FBIO_SET_MANUAL_BLIT, &tmp)<0)
+               perror("FBIO_SET_MANUAL_BLIT");
+       else
+               m_manual_blit = 1;
+}
+
+void fbClass::disableManualBlit()
+{
+       unsigned char tmp = 0;
+       if (ioctl(fd,FBIO_SET_MANUAL_BLIT, &tmp)<0) 
+               perror("FBIO_SET_MANUAL_BLIT");
+       else
+               m_manual_blit = 0;
+}
+
index c83e757..2b0d95b 100644 (file)
@@ -14,7 +14,8 @@ class fbClass
        __u16 red[256], green[256], blue[256], trans[256];
        static fbClass *instance;
        int locked;
-       
+
+       int m_manual_blit;
        int m_number_of_pages;
 #ifdef SWIG
        fbClass(const char *fb="/dev/fb/0");
@@ -23,6 +24,8 @@ public:
 #else
 public:
        unsigned char *lfb;
+       void enableManualBlit();
+       void disableManualBlit();
        int showConsole(int state);
        int SetMode(unsigned int xRes, unsigned int yRes, unsigned int bpp);
        int Available() { return available; }
@@ -31,6 +34,7 @@ public:
        
        int setOffset(int off);
        int waitVSync();
+       void blit();
        unsigned int Stride() { return stride; }
        fb_cmap *CMAP() { return &cmap; }
 
index 75efe89..b6cbc9b 100644 (file)
@@ -134,6 +134,9 @@ void gFBDC::exec(gOpcode *o)
                fb->waitVSync();
                break;
        }
+       case gOpcode::flush:
+               fb->blit();
+               break;
        default:
                gDC::exec(o);
                break;
index 76c02d2..a46b218 100644 (file)
@@ -207,7 +207,8 @@ void gRC::enableSpinner()
        o.opcode = m_spinner_enabled ? gOpcode::incrementSpinner : gOpcode::enableSpinner;
        m_spinner_dc->exec(&o);
        m_spinner_enabled = 1;
-
+       o.opcode = gOpcode::flush;
+       m_spinner_dc->exec(&o);
 }
 
 void gRC::disableSpinner()
@@ -226,6 +227,8 @@ void gRC::disableSpinner()
        gOpcode o;
        o.opcode = gOpcode::disableSpinner;
        m_spinner_dc->exec(&o);
+       o.opcode = gOpcode::flush;
+       m_spinner_dc->exec(&o);
 }
 
 static int gPainter_instances;
@@ -520,16 +523,6 @@ void gPainter::clippop()
        m_rc->submit(o);
 }
 
-void gPainter::flush()
-{
-       if ( m_dc->islocked() )
-               return;
-       gOpcode o;
-       o.opcode = gOpcode::flush;
-       o.dc = m_dc.grabRef();
-       m_rc->submit(o);
-}
-
 void gPainter::waitVSync()
 {
        if ( m_dc->islocked() )
index 555f2ff..84f8ad6 100644 (file)
@@ -249,8 +249,6 @@ public:
        void clip(const gRegion &clip);
        void clippop();
 
-       void flush();
-       
        void waitVSync();
        void flip();
        void notify();
index 9e48308..78c9fbc 100644 (file)
@@ -227,7 +227,6 @@ void eWidgetDesktop::paintBackground(eWidgetDesktopCompBuffer *comp)
        painter.resetClip(comp->m_dirty_region);
        painter.setBackgroundColor(comp->m_background_color);
        painter.clear();
-       painter.flush();
        
        comp->m_dirty_region = gRegion();
 }
index b273eac..5eb6b12 100644 (file)
@@ -136,7 +136,6 @@ void bsodFatal()
        
                p.renderText(usable_area, 
                        lines.substr(start), gPainter::RT_HALIGN_LEFT);
-               p.flush();
                sleep(10);
        }
 
index 72087c9..6c5169d 100644 (file)
@@ -258,7 +258,6 @@ int main(int argc, char **argv)
                gPainter p(my_lcd_dc);
                p.resetClip(eRect(0, 0, 132, 64));
                p.clear();
-               p.flush();
        }
 
        return exit_code;