framebuffer/fbaccel: merge NI code

Origin commit data
------------------
Commit: 8823cc5210
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-26 (Fri, 26 Aug 2016)

Origin message was:
------------------
- framebuffer/fbaccel: merge NI code
This commit is contained in:
vanhofen
2016-08-26 23:13:52 +02:00
parent f1adbec7b2
commit ad217fc956
4 changed files with 43 additions and 8 deletions

View File

@@ -625,12 +625,18 @@ void CFbAccel::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col)
} }
#if !HAVE_TRIPLEDRAGON #if !HAVE_TRIPLEDRAGON
void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI
{ {
#if !HAVE_SPARK_HARDWARE #if !HAVE_SPARK_HARDWARE
int xc, yc; int xc, yc;
xc = (width > fb->xRes) ? fb->xRes : width; xc = (width > fb->xRes) ? fb->xRes : width;
yc = (height > fb->yRes) ? fb->yRes : height; yc = (height > fb->yRes) ? fb->yRes : height;
//NI
if (unscaled_w != 0 && (int)unscaled_w < xc)
xc = unscaled_w;
if (unscaled_h != 0 && (int)unscaled_h < yc)
yc = unscaled_h;
#endif #endif
#if defined(FB_HW_ACCELERATION) #if defined(FB_HW_ACCELERATION)
if(!(width%4)) { if(!(width%4)) {
@@ -641,8 +647,19 @@ void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t x
image.height = yc; image.height = yc;
image.cmap.len = 0; image.cmap.len = 0;
image.depth = 32; image.depth = 32;
if (unscaled_w == 0 && unscaled_h == 0) { //NI
image.data = (const char*)fbbuff; image.data = (const char*)fbbuff;
ioctl(fb->fd, FBIO_IMAGE_BLT, &image); ioctl(fb->fd, FBIO_IMAGE_BLT, &image);
} else { //NI
for (int count = 0; count < yc; count++ ) {
fb_pixel_t* data = (fb_pixel_t *) fbbuff;
fb_pixel_t *pixpos = &data[(count + yp) * width];
image.data = (const char*) pixpos; //fbbuff +(count + yp)*width;
image.dy = yoff+count;
image.height = 1;
ioctl(fb->fd, FBIO_IMAGE_BLT, &image);
}
} //NI
//printf("\033[33m>>>>\033[0m [%s:%s:%d] FB_HW_ACCELERATION x: %d, y: %d, w: %d, h: %d\n", __file__, __func__, __LINE__, xoff, yoff, xc, yc); //printf("\033[33m>>>>\033[0m [%s:%s:%d] FB_HW_ACCELERATION x: %d, y: %d, w: %d, h: %d\n", __file__, __func__, __LINE__, xoff, yoff, xc, yc);
return; return;
} }
@@ -750,7 +767,7 @@ void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t x
#endif #endif
} }
#else #else
void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) void CFbAccel::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI
{ {
DFBRectangle src; DFBRectangle src;
DFBResult err; DFBResult err;

View File

@@ -82,7 +82,8 @@ class CFbAccel
void paintPixel(int x, int y, const fb_pixel_t col); 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 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 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); //NI 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 blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI
void waitForIdle(void); void waitForIdle(void);
void mark(int x, int y, int dx, int dy); void mark(int x, int y, int dx, int dy);
void update(); void update();

View File

@@ -253,9 +253,9 @@ void CFrameBuffer::init(const char * const)
} }
CFrameBuffer::~CFrameBuffer() //NI
void CFrameBuffer::clearIconCache()
{ {
active = false; /* keep people/infoclocks from accessing */
std::map<std::string, rawIcon>::iterator it; std::map<std::string, rawIcon>::iterator it;
for(it = icon_cache.begin(); it != icon_cache.end(); ++it) { for(it = icon_cache.begin(); it != icon_cache.end(); ++it) {
@@ -263,6 +263,12 @@ CFrameBuffer::~CFrameBuffer()
cs_free_uncached(it->second.data); cs_free_uncached(it->second.data);
} }
icon_cache.clear(); icon_cache.clear();
}
CFrameBuffer::~CFrameBuffer()
{
active = false; /* keep people/infoclocks from accessing */
clearIconCache(); //NI
if (background) { if (background) {
delete[] background; delete[] background;
@@ -1300,13 +1306,19 @@ void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, uns
return int_convertRGB2FB(rgbbuff, x, y, 0, true); return int_convertRGB2FB(rgbbuff, x, y, 0, true);
} }
void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp, uint32_t unscaled_w, uint32_t unscaled_h) //NI
{ {
checkFbArea(xoff, yoff, width, height, true); checkFbArea(xoff, yoff, width, height, true);
accel->blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); accel->blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp, unscaled_w, unscaled_h); //NI
checkFbArea(xoff, yoff, width, height, false); checkFbArea(xoff, yoff, width, height, false);
} }
//NI
void CFrameBuffer::blit2FB_unscaled(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t unscaled_w, uint32_t unscaled_h, uint32_t xp, uint32_t yp, bool transp)
{
return blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp, unscaled_w, unscaled_h);
}
void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff)
{ {
checkFbArea(xoff, yoff, width, height, true); checkFbArea(xoff, yoff, width, height, true);

View File

@@ -259,9 +259,14 @@ class CFrameBuffer : public sigc::trackable
void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF); void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF);
void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y);
void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF);
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); //NI 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, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0); //NI
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
//NI
void blit2FB_unscaled(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t unscaled_w = 0, uint32_t unscaled_h = 0, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void clearIconCache();
void mark(int x, int y, int dx, int dy); void mark(int x, int y, int dx, int dy);
enum enum