- disable console, remove ancient calls, add vsync and setoffset calls
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 31 Aug 2005 02:59:51 +0000 (02:59 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 31 Aug 2005 02:59:51 +0000 (02:59 +0000)
lib/gdi/fb.cpp
lib/gdi/fb.h

index 38ae37dd1df622196aafaed2a4e33217f2160f3f..4a801bfedcaaf539e9fadd341389c5d16e842e88 100644 (file)
 #include <lib/base/econfig.h>
 #include <lib/gdi/fb.h>
 
+#ifndef FBIO_WAITFORVSYNC
+#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
+#endif
+
+
 fbClass *fbClass::instance;
 
 fbClass *fbClass::getInstance()
@@ -59,7 +64,7 @@ fbClass::fbClass(const char *fb)
                goto nolfb;
        }
 
-//     showConsole(0);
+       showConsole(0);
        return;
 nolfb:
        lfb=0;
@@ -84,7 +89,7 @@ int fbClass::showConsole(int state)
 int fbClass::SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
 {
        screeninfo.xres_virtual=screeninfo.xres=nxRes;
-       screeninfo.yres_virtual=screeninfo.yres=nyRes;
+       screeninfo.yres_virtual=(screeninfo.yres=nyRes)*2;
        screeninfo.height=0;
        screeninfo.width=0;
        screeninfo.xoffset=screeninfo.yoffset=0;
@@ -115,6 +120,19 @@ int fbClass::SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
        return 0;
 }
 
+int fbClass::setOffset(int off)
+{
+       screeninfo.xoffset = 0;
+       screeninfo.yoffset = off;
+       return ioctl(fd, FBIOPAN_DISPLAY, &screeninfo);
+}
+
+int fbClass::waitVSync()
+{
+       int c = 0;
+       return ioctl(fd, FBIO_WAITFORVSYNC, &c);
+}
+
 fbClass::~fbClass()
 {
        if (available)
@@ -129,49 +147,6 @@ int fbClass::PutCMAP()
        return ioctl(fd, FBIOPUTCMAP, &cmap);
 }
 
-void fbClass::Box(int x, int y, int width, int height, int color, int backcolor)
-{
-       if (width<=2 || locked)
-               return;
-       int offset=y*stride+x/2;
-       int first=0xF0|((color&0xF0)>>4);
-       int last= 0xF0|((backcolor&0xF0)>>4);
-       color=(color&0xF)*0x11;
-       int halfwidth=width/2;
-       for (int ay=y; ay<(y+height); ay++)
-       {
-               lfb[offset]=first;
-               memset(lfb+offset+1, color, halfwidth-2);
-               lfb[offset+halfwidth-1]=last;
-               offset+=stride;
-       }
-}
-
-void fbClass::NBox(int x, int y, int width, int height, int color)
-{
-       if (locked)
-               return;
-       int offset=y*stride+x/2;
-       int halfwidth=width/2;
-       for (int ay=y; ay<(y+height); ay++)
-       {
-               memset(lfb+offset, color, halfwidth);
-               offset+=stride;
-       }
-}
-
-void fbClass::VLine(int x, int y, int sy, int color)
-{
-       if (locked)
-               return;
-       int offset=y*stride+x/2;
-       while (sy--)
-       {
-               lfb[offset]=color;
-               offset+=stride;
-       }
-}
-
 int fbClass::lock()
 {
        if (locked)
index ab801662bce71868e5de1c58368695d68bb49494..f29c859573e0a9c02a786b52cae1740777ddc4ee 100644 (file)
@@ -14,11 +14,14 @@ class fbClass
        __u16 red[256], green[256], blue[256], trans[256];
        static fbClass *instance;
        int locked;
+       
 public:
        unsigned char *lfb;
        int showConsole(int state);
        int SetMode(unsigned int xRes, unsigned int yRes, unsigned int bpp);
        int Available() { return available; }
+       int setOffset(int off);
+       int waitVSync();
        unsigned int Stride() { return stride; }
        fb_cmap *CMAP() { return &cmap; }
 
@@ -30,11 +33,6 @@ public:
                                // low level gfx stuff
        int PutCMAP();
 
-                               // gfx stuff (colors are 8bit!)
-       void Box(int x, int y, int width, int height, int color, int backcolor=0);
-       void NBox(int x, int y, int width, int height, int color);
-       void VLine(int x, int y, int sy, int color);
-       
        int lock();
        void unlock();
        int islocked() { return locked; }