Converter/Poll.py: fix suspend
[enigma2.git] / lib / gdi / fb.cpp
index adf06a2..cde3e35 100644 (file)
@@ -27,7 +27,7 @@ fbClass *fbClass::getInstance()
 
 fbClass::fbClass(const char *fb)
 {
 
 fbClass::fbClass(const char *fb)
 {
-       m_manual_blit=0;
+       m_manual_blit=-1;
        instance=this;
        locked=0;
        available=0;
        instance=this;
        locked=0;
        available=0;
@@ -62,6 +62,7 @@ fbClass::fbClass(const char *fb)
        }
 
        available=fix.smem_len;
        }
 
        available=fix.smem_len;
+       m_phys_mem = fix.smem_start;
        eDebug("%dk video mem", available/1024);
        lfb=(unsigned char*)mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0);
        if (!lfb)
        eDebug("%dk video mem", available/1024);
        lfb=(unsigned char*)mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0);
        if (!lfb)
@@ -102,7 +103,32 @@ int fbClass::SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
        screeninfo.width=0;
        screeninfo.xoffset=screeninfo.yoffset=0;
        screeninfo.bits_per_pixel=nbpp;
        screeninfo.width=0;
        screeninfo.xoffset=screeninfo.yoffset=0;
        screeninfo.bits_per_pixel=nbpp;
-       
+
+       switch (nbpp) {
+       case 16:
+               // ARGB 1555
+               screeninfo.transp.offset = 15;
+               screeninfo.transp.length = 1;
+               screeninfo.red.offset = 10;
+               screeninfo.red.length = 5;
+               screeninfo.green.offset = 5;
+               screeninfo.green.length = 5;
+               screeninfo.blue.offset = 0;
+               screeninfo.blue.length = 5;
+               break;
+       case 32:
+               // ARGB 8888
+               screeninfo.transp.offset = 24;
+               screeninfo.transp.length = 8;
+               screeninfo.red.offset = 16;
+               screeninfo.red.length = 8;
+               screeninfo.green.offset = 8;
+               screeninfo.green.length = 8;
+               screeninfo.blue.offset = 0;
+               screeninfo.blue.length = 8;
+               break;
+       }
+
        if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
        {
                // try single buffering
        if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
        {
                // try single buffering
@@ -157,7 +183,7 @@ int fbClass::waitVSync()
 
 void fbClass::blit()
 {
 
 void fbClass::blit()
 {
-       if (m_manual_blit) {
+       if (m_manual_blit == 1) {
                if (ioctl(fd, FBIO_BLIT) < 0)
                        perror("FBIO_BLIT");
        }
                if (ioctl(fd, FBIO_BLIT) < 0)
                        perror("FBIO_BLIT");
        }
@@ -182,7 +208,13 @@ int fbClass::lock()
 {
        if (locked)
                return -1;
 {
        if (locked)
                return -1;
-       locked=1;
+       if (m_manual_blit == 1)
+       {
+               locked = 2;
+               disableManualBlit();
+       }
+       else
+               locked = 1;
        return fd;
 }
 
        return fd;
 }
 
@@ -190,6 +222,8 @@ void fbClass::unlock()
 {
        if (!locked)
                return;
 {
        if (!locked)
                return;
+       if (locked == 2)  // re-enable manualBlit
+               enableManualBlit();
        locked=0;
        SetMode(xRes, yRes, bpp);
        PutCMAP();
        locked=0;
        SetMode(xRes, yRes, bpp);
        PutCMAP();