From f1783ad5fa3cbc598d75d61b806eb24dcbb52cf0 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 8 Feb 2017 09:30:22 +0100 Subject: [PATCH 1/7] CFbAccelCSNevis: Add paintHLineRel() & paintVLineRel() functions - Remove unused debug output Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/10e82c0ece74be444b047957204fd7321d55a771 Author: Michael Liebmann Date: 2017-02-08 (Wed, 08 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 2 ++ src/driver/fb_accel_cs_nevis.cpp | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 92f865f32..f1ef8bbd5 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -97,6 +97,8 @@ class CFbAccelCSNevis 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); + inline void paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { paintLine(x, y, x+dx, y, col); }; + inline void paintVLineRel(int x, int y, int dy, const fb_pixel_t col) { paintLine(x, y, x, y+dy, col); }; void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); 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 blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); diff --git a/src/driver/fb_accel_cs_nevis.cpp b/src/driver/fb_accel_cs_nevis.cpp index d13819675..c083d0629 100644 --- a/src/driver/fb_accel_cs_nevis.cpp +++ b/src/driver/fb_accel_cs_nevis.cpp @@ -207,6 +207,8 @@ void CFbAccelCSNevis::paintPixel(const int x, const int y, const fb_pixel_t col) void CFbAccelCSNevis::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col) { + if (!getActive()) + return; OpenThreads::ScopedLock m_lock(mutex); /* draw a single vertical line from point xa/ya to xb/yb */ unsigned int cmd = GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(2) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA; @@ -247,7 +249,6 @@ void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const while (line < dy) { int ofl, ofr; if (calcCorners(NULL, &ofl, &ofr, dy, line, radius, type)) { - //printf("3: x %d y %d dx %d dy %d rad %d line %d\n", x, y, dx, dy, radius, line); int rect_height_mult = ((type & CORNER_TOP) && (type & CORNER_BOTTOM)) ? 2 : 1; _write_gxa(gxa_base, GXA_BLT_CONTROL_REG, 0); _write_gxa(gxa_base, cmd, GXA_POINT(x, y + line)); /* destination x/y */ @@ -293,7 +294,6 @@ void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uin void *uKva; uKva = cs_phys_addr(fbbuff); - //printf("CFbAccelCSNevis::blit2FB: data %x Kva %x\n", (int) fbbuff, (int) uKva); if (uKva != NULL) { OpenThreads::ScopedLock m_lock(mutex); @@ -305,11 +305,9 @@ void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uin _write_gxa(gxa_base, cmd, GXA_POINT(xoff, yoff)); /* destination pos */ _write_gxa(gxa_base, cmd, GXA_POINT(xc, yc)); /* source width, FIXME real or adjusted xc, yc ? */ _write_gxa(gxa_base, cmd, GXA_POINT(xp, yp)); /* source pos */ -//printf(">>>>>[%s:%d] Use HW accel\n", __func__, __LINE__); return; } CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); -//printf(">>>>>[%s:%d] NO HW accel\n", __func__, __LINE__); } void CFbAccelCSNevis::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) @@ -330,11 +328,9 @@ void CFbAccelCSNevis::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint3 _write_gxa(gxa_base, cmd, GXA_POINT(xc, yc)); _write_gxa(gxa_base, cmd, GXA_POINT(0, 0)); add_gxa_sync_marker(); -//printf(">>>>>[%s:%d] Use HW accel\n", __func__, __LINE__); return; } CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); -//printf(">>>>>[%s:%d] NO HW accel\n", __func__, __LINE__); } void CFbAccelCSNevis::setupGXA() From e33fdc1708f74aedd52605ddab982b9a1b67b110 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 8 Feb 2017 09:30:25 +0100 Subject: [PATCH 2/7] CFbAccelCSApollo: Add paintHLineRel() & paintVLineRel() functions - Remove unused debug output Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/35b48372f897f44c309e76bea34439876e0d0065 Author: Michael Liebmann Date: 2017-02-08 (Wed, 08 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 4 ++-- src/driver/fb_accel_cs_apollo.cpp | 40 +++++++++++++++++-------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index f1ef8bbd5..fe085b759 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -120,8 +120,8 @@ class CFbAccelCSApollo CFbAccelCSApollo(); // ~CFbAccelCSApollo(); int setMode(unsigned int xRes, unsigned int yRes, unsigned int bpp); - - void paintHLineRelInternal(int x, int dx, int y, const fb_pixel_t col); + void paintHLineRel(int x, int dx, int y, const fb_pixel_t col); + void paintVLineRel(int x, int y, int dy, const fb_pixel_t col); void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); 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 blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); diff --git a/src/driver/fb_accel_cs_apollo.cpp b/src/driver/fb_accel_cs_apollo.cpp index 73dc19d7c..34a07c447 100644 --- a/src/driver/fb_accel_cs_apollo.cpp +++ b/src/driver/fb_accel_cs_apollo.cpp @@ -56,8 +56,11 @@ CFbAccelCSApollo::~CFbAccelCSApollo() } */ -void CFbAccelCSApollo::paintHLineRelInternal(int x, int dx, int y, const fb_pixel_t col) +void CFbAccelCSApollo::paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { + if (!getActive()) + return; + if (dx >= 10) { fb_fillrect fillrect; fillrect.dx = x; @@ -69,16 +72,26 @@ void CFbAccelCSApollo::paintHLineRelInternal(int x, int dx, int y, const fb_pixe ioctl(fd, FBIO_FILL_RECT, &fillrect); return; } - uint8_t * pos = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y; - fb_pixel_t * dest = (fb_pixel_t *)pos; - for (int i = 0; i < dx; i++) - *(dest++) = col; + CFrameBuffer::paintHLineRelInternal(x, dx, y, col); +} + +void CFbAccelCSApollo::paintVLineRel(int x, int y, int dy, const fb_pixel_t col) +{ + if (!getActive()) + return; + + fb_fillrect fillrect; + fillrect.dx = x; + fillrect.dy = y; + fillrect.width = 1; + fillrect.height = dy; + fillrect.color = col; + fillrect.rop = ROP_COPY; + ioctl(fd, FBIO_FILL_RECT, &fillrect); } void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type) { - /* draw a filled rectangle (with additional round corners) */ - if (!getActive()) return; @@ -103,7 +116,6 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const while (line < dy) { int ofl, ofr; if (calcCorners(NULL, &ofl, &ofr, dy, line, radius, type)) { - //printf("3: x %d y %d dx %d dy %d rad %d line %d\n", x, y, dx, dy, radius, line); int rect_height_mult = ((type & CORNER_TOP) && (type & CORNER_BOTTOM)) ? 2 : 1; fillrect.dx = x; fillrect.dy = y + line; @@ -125,7 +137,7 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const line++; continue; } - paintHLineRelInternal(x+ofl, dx-ofl-ofr, y+line, col); + paintHLineRel(x+ofl, dx-ofl-ofr, y+line, col); line++; } } else { @@ -139,13 +151,9 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const checkFbArea(x, y, dx, dy, false); return; } - int swidth = stride / sizeof(fb_pixel_t); - fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y); int line = 0; while (line < dy) { - for (int pos = x; pos < x + dx; pos++) - *(fbp + pos) = col; - fbp += swidth; + CFrameBuffer::paintHLineRelInternal(x, dx, y+line, col); line++; } } @@ -168,11 +176,9 @@ void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, ui image.depth = 32; image.data = (const char*)fbbuff; ioctl(fd, FBIO_IMAGE_BLT, &image); -//printf(">>>>>[%s:%d] Use HW accel\n", __func__, __LINE__); return; } CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); -//printf(">>>>>[%s:%d] NO HW accel\n", __func__, __LINE__); } void CFbAccelCSApollo::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) @@ -193,11 +199,9 @@ void CFbAccelCSApollo::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint image.depth = 32; image.data = (const char*)boxBuf; ioctl(fd, FBIO_IMAGE_BLT, &image); -//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; } CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); -//printf("\033[31m>>>>\033[0m [%s:%s:%d] Not use FB_HW_ACCELERATION x: %d, y: %d, w: %d, h: %d\n", __file__, __func__, __LINE__, xoff, yoff, xc, yc); } int CFbAccelCSApollo::setMode(unsigned int, unsigned int, unsigned int) From bf4f72f3cc976c59e0a8e5506333ba852a7b2993 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 8 Feb 2017 12:17:09 +0100 Subject: [PATCH 3/7] fb_accel: Rename CFbAccelCSNevis class => CFbAccelCSHD1 Rename fb_accel_cs_nevis.cpp => fb_accel_cs_hd1.cpp Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/58bd8a4a634117bc5577b4127aea8f1694754de4 Author: Michael Liebmann Date: 2017-02-08 (Wed, 08 Feb 2017) Origin message was: ------------------ fb_accel: Rename CFbAccelCSNevis class => CFbAccelCSHD1 Rename fb_accel_cs_nevis.cpp => fb_accel_cs_hd1.cpp ------------------ This commit was generated by Migit --- src/driver/Makefile.am | 2 +- src/driver/fb_accel.h | 6 +-- ...accel_cs_nevis.cpp => fb_accel_cs_hd1.cpp} | 42 +++++++++---------- src/driver/fb_generic.cpp | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) rename src/driver/{fb_accel_cs_nevis.cpp => fb_accel_cs_hd1.cpp} (87%) diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 5cc0574bf..8418b9ed9 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -52,7 +52,7 @@ libneutrino_driver_a_SOURCES += \ vfd.cpp else libneutrino_driver_a_SOURCES += \ - fb_accel_cs_nevis.cpp \ + fb_accel_cs_hd1.cpp \ vfd.cpp endif endif diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index fe085b759..dd2072ce2 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -78,7 +78,7 @@ class CFbAccelSTi void setBlendLevel(int); }; -class CFbAccelCSNevis +class CFbAccelCSHD1 : public CFbAccel { private: @@ -90,8 +90,8 @@ class CFbAccelCSNevis void run(void); fb_pixel_t *backbuffer; public: - CFbAccelCSNevis(); - ~CFbAccelCSNevis(); + CFbAccelCSHD1(); + ~CFbAccelCSHD1(); void init(const char * const); int setMode(unsigned int xRes, unsigned int yRes, unsigned int bpp); void paintPixel(int x, int y, const fb_pixel_t col); diff --git a/src/driver/fb_accel_cs_nevis.cpp b/src/driver/fb_accel_cs_hd1.cpp similarity index 87% rename from src/driver/fb_accel_cs_nevis.cpp rename to src/driver/fb_accel_cs_hd1.cpp index c083d0629..3cac06001 100644 --- a/src/driver/fb_accel_cs_nevis.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -95,7 +95,7 @@ static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, u /* this adds a tagged marker into the GXA queue. Once this comes out of the other end of the queue, all commands before it are finished */ -void CFbAccelCSNevis::add_gxa_sync_marker(void) +void CFbAccelCSHD1::add_gxa_sync_marker(void) { unsigned int cmd = GXA_CMD_QMARK | GXA_PARAM_COUNT(1); // TODO: locking? @@ -106,7 +106,7 @@ void CFbAccelCSNevis::add_gxa_sync_marker(void) } /* wait until the current marker comes out of the GXA command queue */ -void CFbAccelCSNevis::waitForIdle(const char *func) +void CFbAccelCSHD1::waitForIdle(const char *func) { unsigned int cfg, count = 0; do { @@ -124,12 +124,12 @@ void CFbAccelCSNevis::waitForIdle(const char *func) fprintf(stderr, LOGTAG "waitForIdle: count is big (%d) [%s]!\n", count, func?func:""); } -CFbAccelCSNevis::CFbAccelCSNevis() +CFbAccelCSHD1::CFbAccelCSHD1() { fb_name = "Coolstream NEVIS GXA framebuffer"; } -void CFbAccelCSNevis::init(const char * const) +void CFbAccelCSHD1::init(const char * const) { fprintf(stderr, ">FBACCEL::INIT\n"); CFrameBuffer::init(); @@ -163,7 +163,7 @@ fprintf(stderr, ">FBACCEL::INIT\n"); ; }; -CFbAccelCSNevis::~CFbAccelCSNevis() +CFbAccelCSHD1::~CFbAccelCSHD1() { if (gxa_base != MAP_FAILED) munmap((void *)gxa_base, 0x40000); @@ -175,7 +175,7 @@ CFbAccelCSNevis::~CFbAccelCSNevis() close(fd); } -void CFbAccelCSNevis::setColor(fb_pixel_t col) +void CFbAccelCSHD1::setColor(fb_pixel_t col) { if (col == lastcol) return; @@ -183,7 +183,7 @@ void CFbAccelCSNevis::setColor(fb_pixel_t col) lastcol = col; } -void CFbAccelCSNevis::paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col) +void CFbAccelCSHD1::paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col) { OpenThreads::ScopedLock m_lock(mutex); unsigned int cmd = GXA_CMD_BLT | GXA_CMD_NOT_TEXT | GXA_CMD_NOT_ALPHA | @@ -200,12 +200,12 @@ void CFbAccelCSNevis::paintRect(const int x, const int y, const int dx, const in add_gxa_sync_marker(); } -void CFbAccelCSNevis::paintPixel(const int x, const int y, const fb_pixel_t col) +void CFbAccelCSHD1::paintPixel(const int x, const int y, const fb_pixel_t col) { paintLine(x, y, x + 1, y, col); } -void CFbAccelCSNevis::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col) +void CFbAccelCSHD1::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col) { if (!getActive()) return; @@ -219,7 +219,7 @@ void CFbAccelCSNevis::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t _write_gxa(gxa_base, cmd, GXA_POINT(xa, ya)); /* start point */ } -void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type) +void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type) { /* draw a filled rectangle (with additional round corners) */ @@ -227,11 +227,11 @@ void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const return; if (dx == 0 || dy == 0) { - dprintf(DEBUG_DEBUG, "[CFbAccelCSNevis] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy); + dprintf(DEBUG_DEBUG, "[CFbAccelCSHD1] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy); return; } if (radius < 0) - dprintf(DEBUG_NORMAL, "[CFbAccelCSNevis] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); + dprintf(DEBUG_NORMAL, "[CFbAccelCSHD1] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); checkFbArea(x, y, dx, dy, true); @@ -259,9 +259,9 @@ void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const if (dx-ofr-ofl < 1) { if (dx-ofr-ofl == 0){ - dprintf(DEBUG_INFO, "[CFbAccelCSNevis] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx-ofr-ofl, y+line); + dprintf(DEBUG_INFO, "[CFbAccelCSHD1] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx-ofr-ofl, y+line); }else{ - dprintf(DEBUG_INFO, "[CFbAccelCSNevis] [%s - %04d]: Calculated width: %d\n (radius %d, dx %d, offsetLeft %d, offsetRight %d).\n Width can not be less than 0, abort.\n", + dprintf(DEBUG_INFO, "[CFbAccelCSHD1] [%s - %04d]: Calculated width: %d\n (radius %d, dx %d, offsetLeft %d, offsetRight %d).\n Width can not be less than 0, abort.\n", __func__, __LINE__, dx-ofr-ofl, radius, dx, ofl, ofr); } line++; @@ -285,7 +285,7 @@ void CFbAccelCSNevis::paintBoxRel(const int x, const int y, const int dx, const checkFbArea(x, y, dx, dy, false); } -void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) +void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; xc = (width > xRes) ? xRes : width; @@ -310,7 +310,7 @@ void CFbAccelCSNevis::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uin CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); } -void CFbAccelCSNevis::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) +void CFbAccelCSHD1::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) { if(width <1 || height <1 || !boxBuf ) return; @@ -333,7 +333,7 @@ void CFbAccelCSNevis::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint3 CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); } -void CFbAccelCSNevis::setupGXA() +void CFbAccelCSHD1::setupGXA() { // We (re)store the GXA regs here in case DFB override them and was not // able to restore them. @@ -349,7 +349,7 @@ void CFbAccelCSNevis::setupGXA() } /* wrong name... */ -int CFbAccelCSNevis::setMode(unsigned int, unsigned int, unsigned int) +int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) { fb_fix_screeninfo _fix; @@ -375,18 +375,18 @@ int CFbAccelCSNevis::setMode(unsigned int, unsigned int, unsigned int) return 0; /* dont fail because of this */ } -fb_pixel_t * CFbAccelCSNevis::getBackBufferPointer() const +fb_pixel_t * CFbAccelCSHD1::getBackBufferPointer() const { return backbuffer; } -void CFbAccelCSNevis::setBlendMode(uint8_t mode) +void CFbAccelCSHD1::setBlendMode(uint8_t mode) { if (ioctl(fd, FBIO_SETBLENDMODE, mode)) printf("FBIO_SETBLENDMODE failed.\n"); } -void CFbAccelCSNevis::setBlendLevel(int level) +void CFbAccelCSHD1::setBlendLevel(int level) { unsigned char value = 0xFF; if (level >= 0 && level <= 100) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 90ac9ad5f..4fa47fa8e 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -127,7 +127,7 @@ CFrameBuffer* CFrameBuffer::getInstance() #ifdef BOXMODEL_APOLLO frameBuffer = new CFbAccelCSApollo(); #else - frameBuffer = new CFbAccelCSNevis(); + frameBuffer = new CFbAccelCSHD1(); #endif #endif #if HAVE_GENERIC_HARDWARE From 824f78dd3ded0070aa923b51dbe0fd2092ff32cc Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 8 Feb 2017 12:33:45 +0100 Subject: [PATCH 4/7] fb_accel: Rename CFbAccelCSApollo class => CFbAccelCSHD2 Rename fb_accel_cs_apollo.cpp => fb_accel_cs_hd2.cpp Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a4afe1e8e00115cb8b84a772cd6f8fd6cc9c620e Author: Michael Liebmann Date: 2017-02-08 (Wed, 08 Feb 2017) Origin message was: ------------------ fb_accel: Rename CFbAccelCSApollo class => CFbAccelCSHD2 Rename fb_accel_cs_apollo.cpp => fb_accel_cs_hd2.cpp ------------------ This commit was generated by Migit --- src/driver/Makefile.am | 2 +- src/driver/fb_accel.h | 6 ++-- ...ccel_cs_apollo.cpp => fb_accel_cs_hd2.cpp} | 28 +++++++++---------- src/driver/fb_generic.cpp | 7 +++-- 4 files changed, 22 insertions(+), 21 deletions(-) rename src/driver/{fb_accel_cs_apollo.cpp => fb_accel_cs_hd2.cpp} (78%) diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 8418b9ed9..cb2a5ef11 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -48,7 +48,7 @@ libneutrino_driver_a_SOURCES = \ if BOXTYPE_COOL if BOXMODEL_APOLLO libneutrino_driver_a_SOURCES += \ - fb_accel_cs_apollo.cpp \ + fb_accel_cs_hd2.cpp \ vfd.cpp else libneutrino_driver_a_SOURCES += \ diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index dd2072ce2..148c9f591 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -110,15 +110,15 @@ class CFbAccelCSHD1 void setupGXA(void); }; -class CFbAccelCSApollo +class CFbAccelCSHD2 : public CFbAccel { private: fb_pixel_t *backbuffer; public: - CFbAccelCSApollo(); -// ~CFbAccelCSApollo(); + CFbAccelCSHD2(); +// ~CFbAccelCSHD2(); int setMode(unsigned int xRes, unsigned int yRes, unsigned int bpp); void paintHLineRel(int x, int dx, int y, const fb_pixel_t col); void paintVLineRel(int x, int y, int dy, const fb_pixel_t col); diff --git a/src/driver/fb_accel_cs_apollo.cpp b/src/driver/fb_accel_cs_hd2.cpp similarity index 78% rename from src/driver/fb_accel_cs_apollo.cpp rename to src/driver/fb_accel_cs_hd2.cpp index 34a07c447..912a83bbe 100644 --- a/src/driver/fb_accel_cs_apollo.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -45,18 +45,18 @@ #define LOGTAG "[fb_accel_apollo] " -CFbAccelCSApollo::CFbAccelCSApollo() +CFbAccelCSHD2::CFbAccelCSHD2() { fb_name = "Coolstream APOLLO framebuffer"; } /* -CFbAccelCSApollo::~CFbAccelCSApollo() +CFbAccelCSHD2::~CFbAccelCSHD2() { } */ -void CFbAccelCSApollo::paintHLineRel(int x, int dx, int y, const fb_pixel_t col) +void CFbAccelCSHD2::paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { if (!getActive()) return; @@ -75,7 +75,7 @@ void CFbAccelCSApollo::paintHLineRel(int x, int dx, int y, const fb_pixel_t col) CFrameBuffer::paintHLineRelInternal(x, dx, y, col); } -void CFbAccelCSApollo::paintVLineRel(int x, int y, int dy, const fb_pixel_t col) +void CFbAccelCSHD2::paintVLineRel(int x, int y, int dy, const fb_pixel_t col) { if (!getActive()) return; @@ -90,17 +90,17 @@ void CFbAccelCSApollo::paintVLineRel(int x, int y, int dy, const fb_pixel_t col) ioctl(fd, FBIO_FILL_RECT, &fillrect); } -void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type) +void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius, int type) { if (!getActive()) return; if (dx == 0 || dy == 0) { - dprintf(DEBUG_DEBUG, "[CFbAccelCSApollo] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy); + dprintf(DEBUG_DEBUG, "[CFbAccelCSHD2] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx, y+dy); return; } if (radius < 0) - dprintf(DEBUG_NORMAL, "[CFbAccelCSApollo] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); + dprintf(DEBUG_NORMAL, "[CFbAccelCSHD2] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); checkFbArea(x, y, dx, dy, true); @@ -129,9 +129,9 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const if (dx-ofr-ofl < 1) { if (dx-ofr-ofl == 0){ - dprintf(DEBUG_INFO, "[CFbAccelCSApollo] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx-ofr-ofl, y+line); + dprintf(DEBUG_INFO, "[CFbAccelCSHD2] [%s - %d]: radius %d, start x %d y %d end x %d y %d\n", __func__, __LINE__, radius, x, y, x+dx-ofr-ofl, y+line); }else{ - dprintf(DEBUG_INFO, "[CFbAccelCSApollo] [%s - %04d]: Calculated width: %d\n (radius %d, dx %d, offsetLeft %d, offsetRight %d).\n Width can not be less than 0, abort.\n", + dprintf(DEBUG_INFO, "[CFbAccelCSHD2] [%s - %04d]: Calculated width: %d\n (radius %d, dx %d, offsetLeft %d, offsetRight %d).\n Width can not be less than 0, abort.\n", __func__, __LINE__, dx-ofr-ofl, radius, dx, ofl, ofr); } line++; @@ -160,7 +160,7 @@ void CFbAccelCSApollo::paintBoxRel(const int x, const int y, const int dx, const checkFbArea(x, y, dx, dy, false); } -void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) +void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; xc = (width > xRes) ? xRes : width; @@ -181,7 +181,7 @@ void CFbAccelCSApollo::blit2FB(void *fbbuff, uint32_t width, uint32_t height, ui CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); } -void CFbAccelCSApollo::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) +void CFbAccelCSHD2::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff) { if(width <1 || height <1 || !boxBuf ) return; @@ -204,7 +204,7 @@ void CFbAccelCSApollo::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); } -int CFbAccelCSApollo::setMode(unsigned int, unsigned int, unsigned int) +int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) { fb_fix_screeninfo _fix; @@ -230,13 +230,13 @@ int CFbAccelCSApollo::setMode(unsigned int, unsigned int, unsigned int) return 0; /* dont fail because of this */ } -void CFbAccelCSApollo::setBlendMode(uint8_t mode) +void CFbAccelCSHD2::setBlendMode(uint8_t mode) { if (ioctl(fd, FBIO_SETBLENDMODE, mode)) printf("FBIO_SETBLENDMODE failed.\n"); } -void CFbAccelCSApollo::setBlendLevel(int level) +void CFbAccelCSHD2::setBlendLevel(int level) { unsigned char value = 0xFF; if (level >= 0 && level <= 100) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 4fa47fa8e..b7b989373 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -124,11 +124,12 @@ CFrameBuffer* CFrameBuffer::getInstance() frameBuffer = new CFbAccelSTi(); #endif #if HAVE_COOL_HARDWARE -#ifdef BOXMODEL_APOLLO - frameBuffer = new CFbAccelCSApollo(); -#else +#ifdef BOXMODEL_NEVIS frameBuffer = new CFbAccelCSHD1(); #endif +#ifdef BOXMODEL_APOLLO + frameBuffer = new CFbAccelCSHD2(); +#endif #endif #if HAVE_GENERIC_HARDWARE frameBuffer = new CFbAccelGLFB(); From 8cd23f3f8926e0434056291d10cffd2d057746e3 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 8 Feb 2017 13:30:33 +0100 Subject: [PATCH 5/7] fb_accel: Some renaming nevis => hd1 & apollo => hd2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f94afc1593d0a500694cebf71ca520967c7559b3 Author: Michael Liebmann Date: 2017-02-08 (Wed, 08 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel_cs_hd1.cpp | 6 +++--- src/driver/fb_accel_cs_hd2.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index 3cac06001..aae21d3ed 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -78,7 +78,7 @@ #define GXA_CFG_REG 0x0030 #define GXA_CFG2_REG 0x00FC -#define LOGTAG "[fb_accel_gxa] " +#define LOGTAG "[fb_accel_cs_hd1] " /* static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int offset) { @@ -126,7 +126,7 @@ void CFbAccelCSHD1::waitForIdle(const char *func) CFbAccelCSHD1::CFbAccelCSHD1() { - fb_name = "Coolstream NEVIS GXA framebuffer"; + fb_name = "Coolstream HD1 framebuffer"; } void CFbAccelCSHD1::init(const char * const) @@ -363,7 +363,7 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) xRes = screeninfo.xres; yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; - printf(LOGTAG "%dx%dx%d line length %d. using nevis gxa graphics accelerator.\n", xRes, yRes, bpp, stride); + printf(LOGTAG "%dx%dx%d line length %d. using hd1 graphics accelerator.\n", xRes, yRes, bpp, stride); int needmem = stride * yRes * 2; if (available >= needmem) { diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 912a83bbe..6cb115dfc 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -1,6 +1,6 @@ /* Framebuffer acceleration hardware abstraction functions. - The hardware dependent acceleration functions for coolstream apollo graphic chips + The hardware dependent acceleration functions for coolstream hd2 graphic chips are represented in this class. (C) 2017 M. Liebmann @@ -43,11 +43,11 @@ #include #include -#define LOGTAG "[fb_accel_apollo] " +#define LOGTAG "[fb_accel_cs_hd2] " CFbAccelCSHD2::CFbAccelCSHD2() { - fb_name = "Coolstream APOLLO framebuffer"; + fb_name = "Coolstream HD2 framebuffer"; } /* @@ -218,7 +218,7 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) xRes = screeninfo.xres; yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; - printf(LOGTAG "%dx%dx%d line length %d. using apollo graphics accelerator.\n", xRes, yRes, bpp, stride); + printf(LOGTAG "%dx%dx%d line length %d. using hd2 graphics accelerator.\n", xRes, yRes, bpp, stride); int needmem = stride * yRes * 2; if (available >= needmem) { From c255a465f356fa92dc0296de36131ec99516e12c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 8 Feb 2017 18:47:17 +0100 Subject: [PATCH 6/7] fb_accel_cs_hdx: remove dub includes, add includes into common header file Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8fe7504007380551ae421b52b14603877da8aa85 Author: Thilo Graf Date: 2017-02-08 (Wed, 08 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel_cs_hd1.cpp | 21 +-------------- src/driver/fb_accel_cs_hd2.cpp | 21 +-------------- src/driver/fb_accel_cs_hdx_inc.h | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 40 deletions(-) create mode 100644 src/driver/fb_accel_cs_hdx_inc.h diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index aae21d3ed..0fc772ab9 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -22,26 +22,7 @@ along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include "fb_accel_cs_hdx_inc.h" /*******************************************************************************/ #define GXA_POINT(x, y) (((y) & 0x0FFF) << 16) | ((x) & 0x0FFF) diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 6cb115dfc..393e6396c 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -22,26 +22,7 @@ along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include +#include "fb_accel_cs_hdx_inc.h" #define LOGTAG "[fb_accel_cs_hd2] " diff --git a/src/driver/fb_accel_cs_hdx_inc.h b/src/driver/fb_accel_cs_hdx_inc.h new file mode 100644 index 000000000..b1d31988e --- /dev/null +++ b/src/driver/fb_accel_cs_hdx_inc.h @@ -0,0 +1,45 @@ +/* + Framebuffer acceleration hardware abstraction functions. + The hardware dependent acceleration functions for coolstream hdx graphic chips + are represented in this class. + + (C) 2017 M. Liebmann + (C) 2017 Thilo Graf 'dbt' + Derived from old neutrino-hd framebuffer code + + 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 . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include From cb34896b6fba566f9c4cf904e5c6075ff473569d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 8 Feb 2017 19:07:36 +0100 Subject: [PATCH 7/7] fb_accel_cs_hdx_inc.h: remove unused includes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9ddb4fc9c3156eff394d5fe1ffc875510b27b25e Author: Thilo Graf Date: 2017-02-08 (Wed, 08 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel_cs_hdx_inc.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/driver/fb_accel_cs_hdx_inc.h b/src/driver/fb_accel_cs_hdx_inc.h index b1d31988e..cd38baa72 100644 --- a/src/driver/fb_accel_cs_hdx_inc.h +++ b/src/driver/fb_accel_cs_hdx_inc.h @@ -23,21 +23,14 @@ along with this program. If not, see . */ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include -#include -#include #include #include #include #include -#include -#include #include #include