neutrino: remove glthread, use GLFramebuffer instead

now that libstb-hal provides an easy to use virtual framebuffer,
use it instead of the glthread implementation.
This commit is contained in:
Stefan Seyfried
2013-05-04 13:07:52 +02:00
parent a7e587e3cb
commit e388b08dfe
9 changed files with 29 additions and 703 deletions

View File

@@ -25,7 +25,7 @@
#include <config.h>
#endif
#include <driver/framebuffer.h>
#include <driver/framebuffer_ng.h>
#include <stdio.h>
#include <fcntl.h>
@@ -38,12 +38,9 @@
#include <linux/kd.h>
//#include <stdint.h>
#ifdef USE_OPENGL
#include <GL/glew.h>
#include "rcinput.h"
#include "glthread.h"
#include <glfb.h>
extern GLFramebuffer *glfb;
#endif
#include <gui/color.h>
@@ -117,9 +114,6 @@ CFrameBuffer::CFrameBuffer()
memset(green, 0, 256*sizeof(__u16));
memset(blue, 0, 256*sizeof(__u16));
memset(trans, 0, 256*sizeof(__u16));
#ifdef USE_OPENGL
mpGLThreadObj = NULL;
#endif
}
CFrameBuffer* CFrameBuffer::getInstance()
@@ -141,42 +135,22 @@ void CFrameBuffer::setupGXA(void)
accel->setupGXA();
}
#endif
void CFrameBuffer::init(const char * const fbDevice)
{
int tr = 0xFF;
#ifdef USE_OPENGL
(void)fbDevice;
fd = -1;
if(!mpGLThreadObj)
{
screeninfo.bits_per_pixel = 32;
screeninfo.xres = 720;
screeninfo.xres_virtual = screeninfo.xres;
screeninfo.yres = 576;
screeninfo.yres_virtual = screeninfo.yres;
screeninfo.bits_per_pixel = 32;
screeninfo.blue.length = 8;
screeninfo.blue.offset = 0;
screeninfo.green.length = 8;
screeninfo.green.offset = 8;
screeninfo.red.length = 8;
screeninfo.red.offset = 16;
screeninfo.transp.length = 8;
screeninfo.transp.offset = 24;
stride = 4 * screeninfo.xres;
available = stride * screeninfo.yres * 2; /* allocated in glthread */
mpGLThreadObj = new GLThreadObj(screeninfo.xres, screeninfo.yres);
if(mpGLThreadObj)
{ /* kick off the GL thread for the window */
mpGLThreadObj->Start();
mpGLThreadObj->waitInit();
}
else
goto nolfb;
if (!glfb) {
fprintf(stderr, "CFrameBuffer::init: GL Framebuffer is not set up? we are doomed...\n");
goto nolfb;
}
lfb = reinterpret_cast<fb_pixel_t*>(mpGLThreadObj->getOSDBuffer());
memset(lfb, 0x7f, screeninfo.xres * screeninfo.yres * 4);
screeninfo = glfb->getScreenInfo();
stride = 4 * screeninfo.xres;
available = glfb->getOSDBuffer()->size(); /* allocated in glfb constructor */
lfb = reinterpret_cast<fb_pixel_t*>(glfb->getOSDBuffer()->data());
memset(lfb, 0x7f, stride * screeninfo.yres);
#else
fd = open(fbDevice, O_RDWR);
if(!fd) fd = open(fbDevice, O_RDWR);
@@ -246,6 +220,7 @@ nolfb:
CFrameBuffer::~CFrameBuffer()
{
active = false; /* keep people/infoclocks from accessing */
std::map<std::string, rawIcon>::iterator it;
for(it = icon_cache.begin(); it != icon_cache.end(); ++it) {
@@ -272,14 +247,7 @@ CFrameBuffer::~CFrameBuffer()
virtual_fb = NULL;
}
delete accel;
#ifdef USE_OPENGL
active = false; /* keep people/infoclocks from accessing */
mpGLThreadObj->shutDown();
mpGLThreadObj->join();
#else
close(fd);
close(tty);
#endif
}
int CFrameBuffer::getFileHandle() const