X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/036d2ec4dc7a66f9d591c00f65fa54bbddb24769..fed93ee95ab650551d8ef5d0d03e4e57b7f058cc:/lib/gdi/fb.cpp diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp index 727042dd..8e8221c3 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=-1; 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; @@ -111,6 +120,8 @@ int fbClass::SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp) m_number_of_pages = screeninfo.yres_virtual / nyRes; + ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo); + if ((screeninfo.xres!=nxRes) && (screeninfo.yres!=nyRes) && (screeninfo.bits_per_pixel!=nbpp)) { eDebug("SetMode failed: wanted: %dx%dx%d, got %dx%dx%d", @@ -144,6 +155,14 @@ int fbClass::waitVSync() return ioctl(fd, FBIO_WAITFORVSYNC, &c); } +void fbClass::blit() +{ + if (m_manual_blit == 1) { + if (ioctl(fd, FBIO_BLIT) < 0) + perror("FBIO_BLIT"); + } +} + fbClass::~fbClass() { if (available) @@ -151,6 +170,7 @@ fbClass::~fbClass() if (lfb) munmap(lfb, available); showConsole(1); + disableManualBlit(); } int fbClass::PutCMAP() @@ -162,7 +182,13 @@ int fbClass::lock() { if (locked) return -1; - locked=1; + if (m_manual_blit == 1) + { + locked = 2; + disableManualBlit(); + } + else + locked = 1; return fd; } @@ -170,7 +196,28 @@ void fbClass::unlock() { if (!locked) return; + if (locked == 2) // re-enable manualBlit + enableManualBlit(); locked=0; 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; +} +