aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/gfbdc.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-08-31 03:03:49 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-08-31 03:03:49 +0000
commit54b9e2790954b623c99823ab64782d4e39c128bf (patch)
treee9e0a4e2d66c5b13b1d17f7454be62ecc9b1c8da /lib/gdi/gfbdc.cpp
parent966258dd4ca61e0fc632dba295cd0ced1ad0364e (diff)
downloadenigma2-54b9e2790954b623c99823ab64782d4e39c128bf.tar.gz
enigma2-54b9e2790954b623c99823ab64782d4e39c128bf.zip
- add double buffering, flip, sync grc opcode, add render-idle-notify.\n - add (disabled by default) accel hooks.
Diffstat (limited to 'lib/gdi/gfbdc.cpp')
-rw-r--r--lib/gdi/gfbdc.cpp62
1 files changed, 57 insertions, 5 deletions
diff --git a/lib/gdi/gfbdc.cpp b/lib/gdi/gfbdc.cpp
index 8dc0a7d2..08b4586a 100644
--- a/lib/gdi/gfbdc.cpp
+++ b/lib/gdi/gfbdc.cpp
@@ -4,6 +4,10 @@
#include <lib/base/init_num.h>
#include <lib/base/econfig.h>
+#include <lib/gdi/accel.h>
+
+#include <time.h>
+
gFBDC *gFBDC::instance;
gFBDC::gFBDC()
@@ -26,8 +30,34 @@ gFBDC::gFBDC()
surface.bypp = 4;
surface.stride = fb->Stride();
surface.data = fb->lfb;
- surface.clut.colors=256;
- surface.clut.data=new gRGB[surface.clut.colors];
+ surface.offset = 0;
+
+ 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;
+
+ fb_size *= 2;
+
+ eDebug("%dkB available for acceleration surfaces.", (fb->Available() - fb_size)/1024);
+
+ if (gAccel::getInstance())
+ gAccel::getInstance()->setAccelMemorySpace(fb->lfb + fb_size, surface.data_phys + fb_size, fb->Available() - fb_size);
+
+ surface.clut.colors = 256;
+ surface.clut.data = new gRGB[surface.clut.colors];
+
+ surface_back.clut = surface.clut;
m_pixmap = new gPixmap(&surface);
@@ -38,6 +68,8 @@ gFBDC::gFBDC()
gFBDC::~gFBDC()
{
delete fb;
+
+ delete[] surface.clut.data;
instance=0;
}
@@ -91,8 +123,6 @@ void gFBDC::setPalette()
fb->CMAP()->green[i]=ramp[surface.clut.data[i].g]<<8;
fb->CMAP()->blue[i]=ramp[surface.clut.data[i].b]<<8;
fb->CMAP()->transp[i]=rampalpha[surface.clut.data[i].a]<<8;
- if (!fb->CMAP()->red[i])
- fb->CMAP()->red[i]=0x100;
}
fb->PutCMAP();
}
@@ -107,6 +137,29 @@ void gFBDC::exec(gOpcode *o)
setPalette();
break;
}
+ case gOpcode::flip:
+ {
+ gSurface s(surface);
+ surface = surface_back;
+ surface_back = s;
+
+ fb->setOffset(surface_back.offset);
+ break;
+ }
+ case gOpcode::waitVSync:
+ {
+ static timeval l;
+ timeval now;
+ gettimeofday(&now, 0);
+
+ int diff = (now.tv_sec - l.tv_sec) * 1000 + (now.tv_usec - l.tv_usec) / 1000;
+ eDebug("%d ms latency (%d fps)", diff, 1000 / diff ?: 1);
+
+ l = now;
+
+ fb->waitVSync();
+ break;
+ }
default:
gDC::exec(o);
break;
@@ -161,4 +214,3 @@ void gFBDC::reloadSettings()
#ifndef SDLDC
eAutoInitPtr<gFBDC> init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC");
#endif
-