aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-08-31 14:19:02 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-08-31 14:19:02 +0000
commit9bc92cbd0be7b1973960e88808feaca26a00aecd (patch)
treef130433372ad4bb83c60b1bcfaba63e4f311dd28 /lib/gdi
parentc692d6151aa59eb1823e131c6f97e51659c87ee8 (diff)
downloadenigma2-9bc92cbd0be7b1973960e88808feaca26a00aecd.tar.gz
enigma2-9bc92cbd0be7b1973960e88808feaca26a00aecd.zip
- fix when not enough framebuffer memory available
Diffstat (limited to 'lib/gdi')
-rw-r--r--lib/gdi/fb.cpp20
-rw-r--r--lib/gdi/fb.h4
-rw-r--r--lib/gdi/gfbdc.cpp37
-rw-r--r--lib/gdi/gfbdc.h3
4 files changed, 45 insertions, 19 deletions
diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp
index 4a801bfe..c8fd94be 100644
--- a/lib/gdi/fb.cpp
+++ b/lib/gdi/fb.cpp
@@ -94,12 +94,24 @@ 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;
+
if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
{
- perror("FBIOPUT_VSCREENINFO");
- printf("fb failed\n");
- return -1;
- }
+ // try single buffering
+ screeninfo.yres_virtual=screeninfo.yres=nyRes;
+
+ if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
+ {
+ perror("FBIOPUT_VSCREENINFO");
+ printf("fb failed\n");
+ return -1;
+ }
+ eDebug(" - double buffering not available.");
+ } else
+ eDebug(" - double buffering available!");
+
+ m_number_of_pages = screeninfo.yres_virtual / nyRes;
+
if ((screeninfo.xres!=nxRes) && (screeninfo.yres!=nyRes) && (screeninfo.bits_per_pixel!=nbpp))
{
eDebug("SetMode failed: wanted: %dx%dx%d, got %dx%dx%d",
diff --git a/lib/gdi/fb.h b/lib/gdi/fb.h
index f29c8595..332819fd 100644
--- a/lib/gdi/fb.h
+++ b/lib/gdi/fb.h
@@ -15,11 +15,15 @@ class fbClass
static fbClass *instance;
int locked;
+ int m_number_of_pages;
public:
unsigned char *lfb;
int showConsole(int state);
int SetMode(unsigned int xRes, unsigned int yRes, unsigned int bpp);
int Available() { return available; }
+
+ int getNumPages() { return m_number_of_pages; }
+
int setOffset(int off);
int waitVSync();
unsigned int Stride() { return stride; }
diff --git a/lib/gdi/gfbdc.cpp b/lib/gdi/gfbdc.cpp
index a1f4c981..ee2227cf 100644
--- a/lib/gdi/gfbdc.cpp
+++ b/lib/gdi/gfbdc.cpp
@@ -34,20 +34,24 @@ gFBDC::gFBDC()
surface.data_phys = 50*1024*1024; // FIXME
- surface_back.type = 0;
- surface_back.x = 720;
- surface_back.y = 576;
- surface_back.bpp = 32;
- surface_back.bypp = 4;
- surface_back.stride = fb->Stride();
- surface_back.offset = surface.y;
-
int fb_size = surface.stride * surface.y;
- surface_back.data = fb->lfb + fb_size;
- surface_back.data_phys = surface.data_phys + fb_size;
+ if (fb->getNumPages() > 1)
+ {
+ m_enable_double_buffering = 1;
+ surface_back.type = 0;
+ surface_back.x = 720;
+ surface_back.y = 576;
+ surface_back.bpp = 32;
+ surface_back.bypp = 4;
+ surface_back.stride = fb->Stride();
+ surface_back.offset = surface.y;
+ surface_back.data = fb->lfb + fb_size;
+ surface_back.data_phys = surface.data_phys + fb_size;
- fb_size *= 2;
+ fb_size *= 2;
+ } else
+ m_enable_double_buffering = 0;
eDebug("%dkB available for acceleration surfaces.", (fb->Available() - fb_size)/1024);
@@ -139,11 +143,14 @@ void gFBDC::exec(gOpcode *o)
}
case gOpcode::flip:
{
- gSurface s(surface);
- surface = surface_back;
- surface_back = s;
+ if (m_enable_double_buffering)
+ {
+ gSurface s(surface);
+ surface = surface_back;
+ surface_back = s;
- fb->setOffset(surface_back.offset);
+ fb->setOffset(surface_back.offset);
+ }
break;
}
case gOpcode::waitVSync:
diff --git a/lib/gdi/gfbdc.h b/lib/gdi/gfbdc.h
index b8ba4c7f..16260fb2 100644
--- a/lib/gdi/gfbdc.h
+++ b/lib/gdi/gfbdc.h
@@ -15,6 +15,7 @@ class gFBDC: public gDC
void calcRamp();
void setPalette();
gSurface surface, surface_back;
+ int m_enable_double_buffering;
public:
void reloadSettings();
void setAlpha(int alpha);
@@ -25,6 +26,8 @@ public:
int getBrightness() { return brightness; }
int getGamma() { return gamma; }
+ int haveDoubleBuffering() { return m_enable_double_buffering; }
+
void saveSettings();
gFBDC();