From: Andreas Monzner Date: Mon, 10 Dec 2007 23:25:32 +0000 (+0000) Subject: add support for manual blit X-Git-Tag: 2.6.0~1674 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/f4f8f9a2775fa1794de6935756f30bf4d99f33e8 add support for manual blit --- diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp index 5d895901..adf06a2c 100644 --- a/lib/gdi/fb.cpp +++ b/lib/gdi/fb.cpp @@ -13,6 +13,10 @@ #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; +} + diff --git a/lib/gdi/fb.h b/lib/gdi/fb.h index c83e7571..2b0d95b5 100644 --- a/lib/gdi/fb.h +++ b/lib/gdi/fb.h @@ -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; } diff --git a/lib/gdi/gfbdc.cpp b/lib/gdi/gfbdc.cpp index 75efe891..b6cbc9b0 100644 --- a/lib/gdi/gfbdc.cpp +++ b/lib/gdi/gfbdc.cpp @@ -134,6 +134,9 @@ void gFBDC::exec(gOpcode *o) fb->waitVSync(); break; } + case gOpcode::flush: + fb->blit(); + break; default: gDC::exec(o); break; diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 76c02d2d..a46b218c 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -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() ) diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 555f2ffb..84f8ad6c 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -249,8 +249,6 @@ public: void clip(const gRegion &clip); void clippop(); - void flush(); - void waitVSync(); void flip(); void notify(); diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index 9e483083..78c9fbcf 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -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(); } diff --git a/main/bsod.cpp b/main/bsod.cpp index b273eacf..5eb6b129 100644 --- a/main/bsod.cpp +++ b/main/bsod.cpp @@ -136,7 +136,6 @@ void bsodFatal() p.renderText(usable_area, lines.substr(start), gPainter::RT_HALIGN_LEFT); - p.flush(); sleep(10); } diff --git a/main/enigma.cpp b/main/enigma.cpp index 72087c92..6c5169d2 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -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;