fbaccel: factor out private stuff into own header

This commit is contained in:
Stefan Seyfried
2013-11-09 13:09:39 +01:00
parent 4599172b0e
commit 5a462721cb
4 changed files with 90 additions and 46 deletions

View File

@@ -30,6 +30,7 @@
#endif #endif
#include <driver/framebuffer_ng.h> #include <driver/framebuffer_ng.h>
#include <driver/fbaccel.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>

78
src/driver/fbaccel.h Normal file
View File

@@ -0,0 +1,78 @@
/*
Copyright (C) 2007-2013 Stefan Seyfried
License: GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
private functions for the fbaccel class (only used in CFrameBuffer)
*/
#ifndef __fbaccel__
#define __fbaccel__
#include <config.h>
#include <stdint.h>
#include <linux/fb.h>
#include <linux/vt.h>
#include <string>
#include <map>
#include <vector>
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Thread>
#include <OpenThreads/Condition>
class CFrameBuffer;
class CFbAccel
: public OpenThreads::Thread
{
private:
CFrameBuffer *fb;
fb_pixel_t lastcol;
OpenThreads::Mutex mutex;
#ifdef USE_NEVIS_GXA
int devmem_fd; /* to access the GXA register we use /dev/mem */
unsigned int smem_start; /* as aquired from the fbdev, the framebuffers physical start address */
volatile uint8_t *gxa_base; /* base address for the GXA's register access */
void add_gxa_sync_marker(void);
#endif /* USE_NEVIS_GXA */
void setColor(fb_pixel_t col);
void run(void);
void _blit(void);
bool blit_thread;
bool blit_pending;
OpenThreads::Condition blit_cond;
OpenThreads::Mutex blit_mutex;
public:
fb_pixel_t *backbuffer;
fb_pixel_t *lbb;
CFbAccel(CFrameBuffer *fb);
~CFbAccel();
void paintPixel(int x, int y, const fb_pixel_t col);
void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col);
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
void waitForIdle(void);
void mark(int x, int y, int dx, int dy);
void blit();
void update();
#ifdef USE_NEVIS_GXA
void setupGXA(void);
#endif
};
#endif

View File

@@ -26,6 +26,7 @@
#endif #endif
#include <driver/framebuffer_ng.h> #include <driver/framebuffer_ng.h>
#include <driver/fbaccel.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
@@ -1341,3 +1342,9 @@ bool CFrameBuffer::_checkFbArea(int _x, int _y, int _dx, int _dy, bool prev)
return true; return true;
} }
/* TODO: can we get rid of that? */
void CFrameBuffer::mark(int x, int y, int dx, int dy)
{
accel->mark(x, y, dx, dy);
};

View File

@@ -23,8 +23,8 @@
*/ */
#ifndef __framebuffer__ #ifndef __framebuffer_ng__
#define __framebuffer__ #define __framebuffer_ng__
#include <config.h> #include <config.h>
#include <stdint.h> #include <stdint.h>
@@ -34,10 +34,6 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Thread>
#include <OpenThreads/Condition>
#define fb_pixel_t uint32_t #define fb_pixel_t uint32_t
@@ -65,45 +61,7 @@ typedef struct fb_var_screeninfo t_fb_var_screeninfo;
#define USE_OPENGL 1 #define USE_OPENGL 1
#endif #endif
class CFrameBuffer; class CFbAccel;
class CFbAccel
: public OpenThreads::Thread
{
private:
CFrameBuffer *fb;
fb_pixel_t lastcol;
OpenThreads::Mutex mutex;
#ifdef USE_NEVIS_GXA
int devmem_fd; /* to access the GXA register we use /dev/mem */
unsigned int smem_start; /* as aquired from the fbdev, the framebuffers physical start address */
volatile uint8_t *gxa_base; /* base address for the GXA's register access */
void add_gxa_sync_marker(void);
#endif /* USE_NEVIS_GXA */
void setColor(fb_pixel_t col);
void run(void);
void _blit(void);
bool blit_thread;
bool blit_pending;
OpenThreads::Condition blit_cond;
OpenThreads::Mutex blit_mutex;
public:
fb_pixel_t *backbuffer;
fb_pixel_t *lbb;
CFbAccel(CFrameBuffer *fb);
~CFbAccel();
void paintPixel(int x, int y, const fb_pixel_t col);
void paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col);
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
void waitForIdle(void);
void mark(int x, int y, int dx, int dy);
void blit();
void update();
#ifdef USE_NEVIS_GXA
void setupGXA(void);
#endif
};
/** Ausfuehrung als Singleton */ /** Ausfuehrung als Singleton */
class CFrameBuffer class CFrameBuffer
{ {
@@ -269,7 +227,7 @@ class CFrameBuffer
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
bool blitToPrimary(unsigned int * data, int dx, int dy, int sw, int sh); bool blitToPrimary(unsigned int * data, int dx, int dy, int sw, int sh);
void mark(int x, int y, int dx, int dy) { accel->mark(x, y, dx, dy); }; void mark(int x, int y, int dx, int dy);
void paintMuteIcon(bool paint, int ax, int ay, int dx, int dy, bool paintFrame=true); void paintMuteIcon(bool paint, int ax, int ay, int dx, int dy, bool paintFrame=true);
enum enum