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 5d8959011a3343d4d4258ceec6f5c83fb96812e0..adf06a2c12ea2033ad640f46de06dccab30c6f3f 100644 (file)
 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
 #endif
 
 #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;
 
 
 fbClass *fbClass::instance;
 
@@ -23,6 +27,7 @@ fbClass *fbClass::getInstance()
 
 fbClass::fbClass(const char *fb)
 {
 
 fbClass::fbClass(const char *fb)
 {
+       m_manual_blit=0;
        instance=this;
        locked=0;
        available=0;
        instance=this;
        locked=0;
        available=0;
@@ -39,6 +44,8 @@ fbClass::fbClass(const char *fb)
                perror(fb);
                goto nolfb;
        }
                perror(fb);
                goto nolfb;
        }
+
+
        if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo)<0)
        {
                perror("FBIOGET_VSCREENINFO");
        if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo)<0)
        {
                perror("FBIOGET_VSCREENINFO");
@@ -64,6 +71,8 @@ fbClass::fbClass(const char *fb)
        }
 
        showConsole(0);
        }
 
        showConsole(0);
+
+       enableManualBlit();
        return;
 nolfb:
        lfb=0;
        return;
 nolfb:
        lfb=0;
@@ -146,6 +155,14 @@ int fbClass::waitVSync()
        return ioctl(fd, FBIO_WAITFORVSYNC, &c);
 }
 
        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)
 fbClass::~fbClass()
 {
        if (available)
@@ -153,6 +170,7 @@ fbClass::~fbClass()
        if (lfb)
                munmap(lfb, available);
        showConsole(1);
        if (lfb)
                munmap(lfb, available);
        showConsole(1);
+       disableManualBlit();
 }
 
 int fbClass::PutCMAP()
 }
 
 int fbClass::PutCMAP()
@@ -176,3 +194,22 @@ void fbClass::unlock()
        SetMode(xRes, yRes, bpp);
        PutCMAP();
 }
        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 c83e75714d82099b3adb65a0aeb005c417b43760..2b0d95b5d135ab2454d445d4f016ec67964f8274 100644 (file)
@@ -14,7 +14,8 @@ class fbClass
        __u16 red[256], green[256], blue[256], trans[256];
        static fbClass *instance;
        int locked;
        __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");
        int m_number_of_pages;
 #ifdef SWIG
        fbClass(const char *fb="/dev/fb/0");
@@ -23,6 +24,8 @@ public:
 #else
 public:
        unsigned char *lfb;
 #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; }
        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();
        
        int setOffset(int off);
        int waitVSync();
+       void blit();
        unsigned int Stride() { return stride; }
        fb_cmap *CMAP() { return &cmap; }
 
        unsigned int Stride() { return stride; }
        fb_cmap *CMAP() { return &cmap; }
 
index 75efe891af5e82b4f9f0856c29d2636170d3cb36..b6cbc9b003bd7b39b5c1bacff9c6a94469de3ba9 100644 (file)
@@ -134,6 +134,9 @@ void gFBDC::exec(gOpcode *o)
                fb->waitVSync();
                break;
        }
                fb->waitVSync();
                break;
        }
+       case gOpcode::flush:
+               fb->blit();
+               break;
        default:
                gDC::exec(o);
                break;
        default:
                gDC::exec(o);
                break;
index 76c02d2d894e8e5ad310004f7891aeb5722977f5..a46b218c3d74a4169b38a70c1c6bf6712fb6d7fc 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 = 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()
 }
 
 void gRC::disableSpinner()
@@ -226,6 +227,8 @@ void gRC::disableSpinner()
        gOpcode o;
        o.opcode = gOpcode::disableSpinner;
        m_spinner_dc->exec(&o);
        gOpcode o;
        o.opcode = gOpcode::disableSpinner;
        m_spinner_dc->exec(&o);
+       o.opcode = gOpcode::flush;
+       m_spinner_dc->exec(&o);
 }
 
 static int gPainter_instances;
 }
 
 static int gPainter_instances;
@@ -520,16 +523,6 @@ void gPainter::clippop()
        m_rc->submit(o);
 }
 
        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() )
 void gPainter::waitVSync()
 {
        if ( m_dc->islocked() )
index 555f2ffb9485e6e0f1d0cfe5b8d12bf9450710de..84f8ad6cd7558c31007dadf4345302df754b8826 100644 (file)
@@ -249,8 +249,6 @@ public:
        void clip(const gRegion &clip);
        void clippop();
 
        void clip(const gRegion &clip);
        void clippop();
 
-       void flush();
-       
        void waitVSync();
        void flip();
        void notify();
        void waitVSync();
        void flip();
        void notify();
index 9e4830830e3266cc2624c73de058dfc34351a253..78c9fbcfec4123f947b8932383e86ab1baab04e1 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.resetClip(comp->m_dirty_region);
        painter.setBackgroundColor(comp->m_background_color);
        painter.clear();
-       painter.flush();
        
        comp->m_dirty_region = gRegion();
 }
        
        comp->m_dirty_region = gRegion();
 }
index b273eacf61729593b844e4dc465adbf438027e2b..5eb6b129681a0d0801f699dbf51592c85f66b90e 100644 (file)
@@ -136,7 +136,6 @@ void bsodFatal()
        
                p.renderText(usable_area, 
                        lines.substr(start), gPainter::RT_HALIGN_LEFT);
        
                p.renderText(usable_area, 
                        lines.substr(start), gPainter::RT_HALIGN_LEFT);
-               p.flush();
                sleep(10);
        }
 
                sleep(10);
        }
 
index 72087c92144655f63cf6f2b981c92859cdece004..6c5169d2e23dab04b66a559ca13aafce56e35cdc 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();
                gPainter p(my_lcd_dc);
                p.resetClip(eRect(0, 0, 132, 64));
                p.clear();
-               p.flush();
        }
 
        return exit_code;
        }
 
        return exit_code;