diff --git a/acinclude.m4 b/acinclude.m4 index 48a891434..308d1619e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -478,17 +478,29 @@ AC_ARG_WITH(boxtype, esac], [BOXTYPE="coolstream"]) AC_ARG_WITH(boxmodel, - [ --with-boxmodel valid for coolstream: nevis, apollo + [ --with-boxmodel valid for coolstream: hd1, hd2 valid for dreambox: dm500, dm500plus, dm600pvr, dm56x0, dm7000, dm7020, dm7025 valid for ipbox: ip200, ip250, ip350, ip400], [case "${withval}" in - nevis|apollo) + hd1|hd2) if test "$BOXTYPE" = "coolstream"; then BOXMODEL="$withval" else AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) fi ;; + nevis|apollo) + if test "$BOXTYPE" = "coolstream"; then + if test "$withval" = "nevis"; then + BOXMODEL="hd1" + fi + if test "$withval" = "apollo"; then + BOXMODEL="hd2" + fi + else + AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) + fi + ;; dm500|dm500plus|dm600pvr|dm56x0|dm7000|dm7020|dm7025) if test "$BOXTYPE" = "dreambox"; then BOXMODEL="$withval" @@ -513,7 +525,7 @@ AC_ARG_WITH(boxmodel, *) AC_MSG_ERROR([unsupported value $withval for --with-boxmodel]) ;; - esac], [BOXMODEL="nevis"] + esac], [BOXMODEL="hd1"] [if test "$BOXTYPE" = "dreambox" -o "$BOXTYPE" = "ipbox" && test -z "$BOXMODEL"; then AC_MSG_ERROR([Dreambox/IPBox needs --with-boxmodel]) fi]) @@ -530,8 +542,8 @@ AM_CONDITIONAL(BOXTYPE_COOL, test "$BOXTYPE" = "coolstream") AM_CONDITIONAL(BOXTYPE_SPARK, test "$BOXTYPE" = "spark") AM_CONDITIONAL(BOXTYPE_GENERIC, test "$BOXTYPE" = "generic") -AM_CONDITIONAL(BOXMODEL_NEVIS,test "$BOXMODEL" = "nevis") -AM_CONDITIONAL(BOXMODEL_APOLLO,test "$BOXMODEL" = "apollo") +AM_CONDITIONAL(BOXMODEL_CS_HD1,test "$BOXMODEL" = "hd1") +AM_CONDITIONAL(BOXMODEL_CS_HD2,test "$BOXMODEL" = "hd2") AM_CONDITIONAL(BOXMODEL_DM500,test "$BOXMODEL" = "dm500") AM_CONDITIONAL(BOXMODEL_DM500PLUS,test "$BOXMODEL" = "dm500plus") @@ -565,10 +577,10 @@ elif test "$BOXTYPE" = "generic"; then fi # TODO: do we need more defines? -if test "$BOXMODEL" = "nevis"; then - AC_DEFINE(BOXMODEL_NEVIS, 1, [coolstream hd1/neo/neo2/zee]) -elif test "$BOXMODEL" = "apollo"; then - AC_DEFINE(BOXMODEL_APOLLO, 1, [coolstream tank]) +if test "$BOXMODEL" = "hd1"; then + AC_DEFINE(BOXMODEL_CS_HD1, 1, [coolstream hd1/neo/neo2/zee]) +elif test "$BOXMODEL" = "hd2"; then + AC_DEFINE(BOXMODEL_CS_HD2, 1, [coolstream tank/trinity/trinity v2/trinity duo/zeeČ/link]) elif test "$BOXMODEL" = "dm500"; then AC_DEFINE(BOXMODEL_DM500, 1, [dreambox 500]) elif test "$BOXMODEL" = "ip200"; then diff --git a/configure.ac b/configure.ac index 13202d6d7..49409f994 100644 --- a/configure.ac +++ b/configure.ac @@ -289,7 +289,7 @@ if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then fi HWLIB_CFLAGS='-I$(top_srcdir)/lib/libcoolstream -I$(top_srcdir)/src/zapit/include/private' -if test "$BOXMODEL" = "apollo"; then +if test "$BOXMODEL" = "hd2"; then if test -e ${srcdir}/lib/libcoolstream2/cs_ir_generic.h; then AC_DEFINE(HAVE_COOLSTREAM_CS_IR_GENERIC_H,1,[Define to 1 if you have the header file.]) fi diff --git a/data/fonts/Makefile.am b/data/fonts/Makefile.am index 7f822c6b1..6325ef80f 100644 --- a/data/fonts/Makefile.am +++ b/data/fonts/Makefile.am @@ -11,6 +11,6 @@ install_DATA = \ tuxtxt.ttf \ tuxtxt.otb -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 install_DATA += UnDotum.ttf endif diff --git a/src/Makefile.am b/src/Makefile.am index e2f8a3ba6..388ff1f28 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -61,7 +61,7 @@ endif AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64 -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 MTDUTILSLIBS = \ system/mtdutils/libneutrino_system_mtdutils.a \ system/mtdutils/lib/libneutrino_system_mtdutils_lib.a @@ -147,14 +147,14 @@ neutrino_LDADD += \ neutrino_LDADD += -lcoolstream-mt -lca-sc if ENABLE_TMSDK else -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 neutrino_LDADD += -lca-ci -llnxtmvssUsr -llnxUKAL -llnxplatUsr -llnxtmasUsr -llnxdvbciUsr -llnxpvrUsr -llnxcssUsr -llnxnotifyqUsr -ltmpvrDataManager-cst -ltmpvrIndexStorage -llnxscsUsr else neutrino_LDADD += -lnxp endif endif -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 neutrino_LDADD += -liconv endif @@ -193,7 +193,7 @@ endif if BOXTYPE_COOL bin_PROGRAMS += uncooloff uncooloff_SOURCES = uncooloff.c -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 else noinst_PROGRAMS = uncoolinit uncoolinit_SOURCES = uncoolinit.cpp diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 68bc2ed46..d448fe801 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -46,9 +46,15 @@ libneutrino_driver_a_SOURCES = \ volume.cpp if BOXTYPE_COOL +if BOXMODEL_CS_HD2 libneutrino_driver_a_SOURCES += \ - fb_accel_cs.cpp \ + fb_accel_cs_hd2.cpp \ vfd.cpp +else +libneutrino_driver_a_SOURCES += \ + fb_accel_cs_hd1.cpp \ + vfd.cpp +endif endif if BOXTYPE_TRIPLE diff --git a/src/driver/fade.cpp b/src/driver/fade.cpp index a7bd27acf..3af188521 100644 --- a/src/driver/fade.cpp +++ b/src/driver/fade.cpp @@ -55,14 +55,14 @@ void COSDFader::StartFadeIn() fadeIn = true; fadeOut = false; fadeValue = 100; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha #endif frameBuffer->setBlendLevel(fadeValue); -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) usleep(60000); #endif fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); @@ -79,7 +79,7 @@ bool COSDFader::StartFadeOut() if ((!fadeOut) && g_settings.widget_fade) { fadeOut = true; fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha @@ -93,12 +93,12 @@ void COSDFader::StopFade() { if ( fadeIn || fadeOut ) { g_RCInput->killTimer(fadeTimer); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha #endif -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) usleep(60000); #endif fadeIn = fadeOut = false; @@ -124,12 +124,12 @@ bool COSDFader::FadeDone() fadeValue = max_alpha; g_RCInput->killTimer (fadeTimer); fadeIn = false; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha #endif -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) usleep(60000); #endif } else diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index b0a11a334..54736d331 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -32,10 +32,6 @@ #if HAVE_SPARK_HARDWARE #define PARTIAL_BLIT 1 #endif -#if HAVE_COOL_HARDWARE -/* not needed -- if you don't want acceleration, don't call CFbAccel ;) */ -#define USE_NEVIS_GXA 1 -#endif class CFbAccel : public CFrameBuffer @@ -82,7 +78,7 @@ class CFbAccelSTi void setBlendLevel(int); }; -class CFbAccelCS +class CFbAccelCSHD1 : public CFbAccel { private: @@ -90,24 +86,47 @@ class CFbAccelCS 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); - void setupGXA(void); void setColor(fb_pixel_t col); void run(void); fb_pixel_t *backbuffer; public: - CFbAccelCS(); - ~CFbAccelCS(); + 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); 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); + 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); void waitForIdle(const char *func = NULL); fb_pixel_t * getBackBufferPointer() const; void setBlendMode(uint8_t); void setBlendLevel(int); + void add_gxa_sync_marker(void); + void setupGXA(void); +}; + +class CFbAccelCSHD2 + : public CFbAccel +{ + private: + fb_pixel_t *backbuffer; + + public: + 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); + 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); + void setBlendMode(uint8_t); + void setBlendLevel(int); }; class CFbAccelGLFB diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp new file mode 100644 index 000000000..4b3df3d20 --- /dev/null +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -0,0 +1,374 @@ +/* + Framebuffer acceleration hardware abstraction functions. + The hardware dependent acceleration functions for coolstream GXA chips + are represented in this class. + + (C) 2017 Stefan Seyfried + 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 . +*/ + +#include "fb_accel_cs_hdx_inc.h" + +/*******************************************************************************/ +#define GXA_POINT(x, y) (((y) & 0x0FFF) << 16) | ((x) & 0x0FFF) +#define GXA_SRC_BMP_SEL(x) (x << 8) +#define GXA_DST_BMP_SEL(x) (x << 5) +#define GXA_PARAM_COUNT(x) (x << 2) + +#define GXA_CMD_REG 0x001C +#define GXA_FG_COLOR_REG 0x0020 +#define GXA_BG_COLOR_REG 0x0024 +#define GXA_LINE_CONTROL_REG 0x0038 +#define GXA_BMP1_TYPE_REG 0x0048 +#define GXA_BMP1_ADDR_REG 0x004C +#define GXA_BMP2_TYPE_REG 0x0050 +#define GXA_BMP2_ADDR_REG 0x0054 +#define GXA_BMP3_TYPE_REG 0x0058 +#define GXA_BMP3_ADDR_REG 0x005C +#define GXA_BMP4_TYPE_REG 0x0060 +#define GXA_BMP4_ADDR_REG 0x0064 +#define GXA_BMP5_TYPE_REG 0x0068 +#define GXA_BMP5_ADDR_REG 0x006C +#define GXA_BMP6_TYPE_REG 0x0070 +#define GXA_BMP7_TYPE_REG 0x0078 +#define GXA_DEPTH_REG 0x00F4 +#define GXA_CONTENT_ID_REG 0x0144 +#define GXA_BLT_CONTROL_REG 0x0034 + +#define GXA_CMD_BLT 0x00010800 +#define GXA_CMD_NOT_ALPHA 0x00011000 +#define GXA_CMD_NOT_TEXT 0x00018000 +#define GXA_CMD_QMARK 0x00001000 + +#define GXA_BLEND_CFG_REG 0x003C +#define GXA_CFG_REG 0x0030 +#define GXA_CFG2_REG 0x00FC + +#define LOGTAG "[fb_accel_cs_hd1] " +/* +static unsigned int _read_gxa(volatile unsigned char *base_addr, unsigned int offset) +{ + return *(volatile unsigned int *)(base_addr + offset); +} +*/ +static unsigned int _mark = 0; + +static void _write_gxa(volatile unsigned char *base_addr, unsigned int offset, unsigned int value) +{ + while ((*(volatile unsigned int *)(base_addr + GXA_DEPTH_REG)) & 0x40000000) {}; + *(volatile unsigned int *)(base_addr + offset) = value; +} + +/* 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 CFbAccelCSHD1::add_gxa_sync_marker(void) +{ + unsigned int cmd = GXA_CMD_QMARK | GXA_PARAM_COUNT(1); + // TODO: locking? + _mark++; + _mark &= 0x0000001F; /* bit 0x20 crashes the kernel, if set */ + _write_gxa(gxa_base, cmd, _mark); + //fprintf(stderr, "%s: wrote %02x\n", __FUNCTION__, _mark); +} + +/* wait until the current marker comes out of the GXA command queue */ +void CFbAccelCSHD1::waitForIdle(const char *func) +{ + unsigned int cfg, count = 0; + do { + cfg = *(volatile unsigned int *)(gxa_base + GXA_CMD_REG); + cfg >>= 24; /* the token is stored in bits 31...24 */ + if (cfg == _mark) + break; + /* usleep is too coarse, because of CONFIG_HZ=100 in kernel + so use sched_yield to at least give other threads a chance to run */ + sched_yield(); + //fprintf(stderr, "%s: read %02x, expected %02x\n", __FUNCTION__, cfg, _mark); + } while(++count < 8192); /* don't deadlock here if there is an error */ + + if (count > 2048) /* more than 2000 are unlikely, even for large BMP6 blits */ + fprintf(stderr, LOGTAG "waitForIdle: count is big (%d) [%s]!\n", count, func?func:""); +} + +CFbAccelCSHD1::CFbAccelCSHD1() +{ + fb_name = "Coolstream HD1 framebuffer"; +} + +void CFbAccelCSHD1::init(const char * const) +{ +fprintf(stderr, ">FBACCEL::INIT\n"); + CFrameBuffer::init(); + if (lfb == NULL) { + printf(LOGTAG "CFrameBuffer::init() failed.\n"); + return; /* too bad... */ + } + available = fix.smem_len; + printf(LOGTAG "%dk video mem\n", available / 1024); + memset(lfb, 0, available); + lastcol = 0xffffffff; + lbb = lfb; /* the memory area to draw to... */ + + /* Open /dev/mem for HW-register access */ + devmem_fd = open("/dev/mem", O_RDWR | O_SYNC | O_CLOEXEC); + if (devmem_fd < 0) { + perror("CFbAccel open /dev/mem"); + goto error; + } + + /* mmap the GXA's base address */ + gxa_base = (volatile unsigned char*)mmap(0, 0x00040000, PROT_READ|PROT_WRITE, MAP_SHARED, devmem_fd, 0xE0600000); + if (gxa_base == (void *)-1) { + perror("CFbAccel mmap /dev/mem"); + goto error; + } + + setupGXA(); + error: + /* TODO: what to do here? does this really happen? */ + ; +}; + +CFbAccelCSHD1::~CFbAccelCSHD1() +{ + if (gxa_base != MAP_FAILED) + munmap((void *)gxa_base, 0x40000); + if (devmem_fd != -1) + close(devmem_fd); +} + +void CFbAccelCSHD1::setColor(fb_pixel_t col) +{ + if (col == lastcol) + return; + _write_gxa(gxa_base, GXA_FG_COLOR_REG, (unsigned int)col); /* setup the drawing color */ + lastcol = 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 | + GXA_SRC_BMP_SEL(6) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2); + + _write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int)col); /* setup the drawing color */ + _write_gxa(gxa_base, GXA_BMP6_TYPE_REG, (3 << 16) | (1 << 27)); /* 3 == 32bpp, 1<<27 == fill */ + _write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* destination pos */ + _write_gxa(gxa_base, cmd, GXA_POINT(dx, dy)); /* destination size */ + _write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int)backgroundColor); + + /* the GXA seems to do asynchronous rendering, so we add a sync marker + to which the fontrenderer code can synchronize */ + add_gxa_sync_marker(); +} + +void CFbAccelCSHD1::paintPixel(const int x, const int y, const fb_pixel_t col) +{ + paintLine(x, y, x + 1, y, col); +} + +void CFbAccelCSHD1::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; + + setColor(col); + _write_gxa(gxa_base, GXA_LINE_CONTROL_REG, 0x00000404); /* X is major axis, skip last pixel */ + _write_gxa(gxa_base, cmd, GXA_POINT(xb, yb)); /* end point */ + _write_gxa(gxa_base, cmd, GXA_POINT(xa, ya)); /* start point */ +} + +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) */ + + if (!getActive()) + return; + + if (dx == 0 || dy == 0) { + 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, "[CFbAccelCSHD1] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); + + checkFbArea(x, y, dx, dy, true); + + if (!fb_no_check) + OpenThreads::ScopedLock m_lock(mutex); + /* solid fill with background color */ + unsigned int cmd = GXA_CMD_BLT | GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(7) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(2) | GXA_CMD_NOT_ALPHA; + _write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) col); /* setup the drawing color */ + + if (type && radius) { + setCornerFlags(type); + radius = limitRadius(dx, dy, radius); + + int line = 0; + while (line < dy) { + int ofl, ofr; + if (calcCorners(NULL, &ofl, &ofr, dy, line, radius, type)) { + 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 */ + _write_gxa(gxa_base, cmd, GXA_POINT(dx, dy - (radius * rect_height_mult))); /* width/height */ + line += dy - (radius * rect_height_mult); + continue; + } + + if (dx-ofr-ofl < 1) { + if (dx-ofr-ofl == 0){ + 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, "[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++; + continue; + } + _write_gxa(gxa_base, GXA_BLT_CONTROL_REG, 0); + _write_gxa(gxa_base, cmd, GXA_POINT(x + ofl, y + line)); /* destination x/y */ + _write_gxa(gxa_base, cmd, GXA_POINT(dx-ofl-ofr, 1)); /* width/height */ + line++; + } + } else { + _write_gxa(gxa_base, GXA_BLT_CONTROL_REG, 0); + _write_gxa(gxa_base, cmd, GXA_POINT(x, y)); /* destination x/y */ + _write_gxa(gxa_base, cmd, GXA_POINT(dx, dy)); /* width/height */ + } + _write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int) backgroundColor); //FIXME needed ? + /* the GXA seems to do asynchronous rendering, so we add a sync marker + * to which the fontrenderer code can synchronize + */ + add_gxa_sync_marker(); + checkFbArea(x, y, dx, dy, false); +} + +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; + yc = (height > yRes) ? yRes : height; + u32 cmd; + void *uKva; + + uKva = cs_phys_addr(fbbuff); + + if (uKva != NULL) { + OpenThreads::ScopedLock m_lock(mutex); + cmd = GXA_CMD_BLT | GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(1) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(3); + + _write_gxa(gxa_base, GXA_BMP1_TYPE_REG, (3 << 16) | width); + _write_gxa(gxa_base, GXA_BMP1_ADDR_REG, (unsigned int)uKva); + + _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 */ + return; + } + CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); +} + +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; + + uint32_t xc = (width > xRes) ? (uint32_t)xRes : width; + uint32_t yc = (height > yRes) ? (uint32_t)yRes : height; + + void* uKva = cs_phys_addr((void*)boxBuf); + if(uKva != NULL) { + OpenThreads::ScopedLock m_lock(mutex); + u32 cmd = GXA_CMD_BLT | GXA_CMD_NOT_TEXT | GXA_SRC_BMP_SEL(1) | GXA_DST_BMP_SEL(2) | GXA_PARAM_COUNT(3); + _write_gxa(gxa_base, GXA_BMP1_TYPE_REG, (3 << 16) | width); + _write_gxa(gxa_base, GXA_BMP1_ADDR_REG, (unsigned int) uKva); + _write_gxa(gxa_base, cmd, GXA_POINT(xoff, yoff)); + _write_gxa(gxa_base, cmd, GXA_POINT(xc, yc)); + _write_gxa(gxa_base, cmd, GXA_POINT(0, 0)); + add_gxa_sync_marker(); + return; + } + CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); +} + +void CFbAccelCSHD1::setupGXA() +{ + // We (re)store the GXA regs here in case DFB override them and was not + // able to restore them. + _write_gxa(gxa_base, GXA_BMP2_TYPE_REG, (3 << 16) | (unsigned int)screeninfo.xres); + _write_gxa(gxa_base, GXA_BMP2_ADDR_REG, (unsigned int) fix.smem_start); + _write_gxa(gxa_base, GXA_BLEND_CFG_REG, 0x00089064); + // TODO check mono-flip, bit 8 + _write_gxa(gxa_base, GXA_CFG_REG, 0x100 | (1 << 12) | (1 << 29)); + _write_gxa(gxa_base, GXA_CFG2_REG, 0x1FF); + _write_gxa(gxa_base, GXA_BG_COLOR_REG, (unsigned int)backgroundColor); + _write_gxa(gxa_base, GXA_BMP7_TYPE_REG, (3 << 16) | (unsigned int)screeninfo.xres | (1 << 27)); + add_gxa_sync_marker(); +} + +/* wrong name... */ +int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) +{ + fb_fix_screeninfo _fix; + + if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) { + perror("FBIOGET_FSCREENINFO"); + return -1; + } + stride = _fix.line_length; + if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) + printf("screen unblanking failed\n"); + xRes = screeninfo.xres; + yRes = screeninfo.yres; + bpp = screeninfo.bits_per_pixel; + printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id); + int needmem = stride * yRes * 2; + if (available >= needmem) + { + backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + return 0; + } + fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem); + backbuffer = lfb; /* will not work well, but avoid crashes */ + return 0; /* dont fail because of this */ +} + +fb_pixel_t * CFbAccelCSHD1::getBackBufferPointer() const +{ + return backbuffer; +} + +void CFbAccelCSHD1::setBlendMode(uint8_t mode) +{ + if (ioctl(fd, FBIO_SETBLENDMODE, mode)) + printf("FBIO_SETBLENDMODE failed.\n"); +} + +void CFbAccelCSHD1::setBlendLevel(int level) +{ + unsigned char value = 0xFF; + if (level >= 0 && level <= 100) + value = convertSetupAlpha2Alpha(level); + + if (ioctl(fd, FBIO_SETOPACITY, value)) + printf("FBIO_SETOPACITY failed.\n"); +} diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp new file mode 100644 index 000000000..393e6396c --- /dev/null +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -0,0 +1,230 @@ +/* + Framebuffer acceleration hardware abstraction functions. + The hardware dependent acceleration functions for coolstream hd2 graphic chips + are represented in this class. + + (C) 2017 M. Liebmann + 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 . +*/ + +#include "fb_accel_cs_hdx_inc.h" + +#define LOGTAG "[fb_accel_cs_hd2] " + +CFbAccelCSHD2::CFbAccelCSHD2() +{ + fb_name = "Coolstream HD2 framebuffer"; +} + +/* +CFbAccelCSHD2::~CFbAccelCSHD2() +{ +} +*/ + +void CFbAccelCSHD2::paintHLineRel(int x, int dx, int y, const fb_pixel_t col) +{ + if (!getActive()) + return; + + if (dx >= 10) { + fb_fillrect fillrect; + fillrect.dx = x; + fillrect.dy = y; + fillrect.width = dx; + fillrect.height = 1; + fillrect.color = col; + fillrect.rop = ROP_COPY; + ioctl(fd, FBIO_FILL_RECT, &fillrect); + return; + } + CFrameBuffer::paintHLineRelInternal(x, dx, y, col); +} + +void CFbAccelCSHD2::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 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, "[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, "[CFbAccelCSHD2] [%s - %d]: WARNING! radius < 0 [%d] FIXME\n", __func__, __LINE__, radius); + + checkFbArea(x, y, dx, dy, true); + + fb_fillrect fillrect; + fillrect.color = col; + fillrect.rop = ROP_COPY; + + if (type && radius) { + setCornerFlags(type); + radius = limitRadius(dx, dy, radius); + + int line = 0; + while (line < dy) { + int ofl, ofr; + if (calcCorners(NULL, &ofl, &ofr, dy, line, radius, type)) { + int rect_height_mult = ((type & CORNER_TOP) && (type & CORNER_BOTTOM)) ? 2 : 1; + fillrect.dx = x; + fillrect.dy = y + line; + fillrect.width = dx; + fillrect.height = dy - (radius * rect_height_mult); + + ioctl(fd, FBIO_FILL_RECT, &fillrect); + line += dy - (radius * rect_height_mult); + continue; + } + + if (dx-ofr-ofl < 1) { + if (dx-ofr-ofl == 0){ + 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, "[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++; + continue; + } + paintHLineRel(x+ofl, dx-ofl-ofr, y+line, col); + line++; + } + } else { + /* FIXME small size faster to do by software */ + if (dx > 10 || dy > 10) { + fillrect.dx = x; + fillrect.dy = y; + fillrect.width = dx; + fillrect.height = dy; + ioctl(fd, FBIO_FILL_RECT, &fillrect); + checkFbArea(x, y, dx, dy, false); + return; + } + int line = 0; + while (line < dy) { + CFrameBuffer::paintHLineRelInternal(x, dx, y+line, col); + line++; + } + } + checkFbArea(x, y, dx, dy, false); +} + +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; + yc = (height > yRes) ? yRes : height; + + if(!(width%4)) { + fb_image image; + image.dx = xoff; + image.dy = yoff; + image.width = xc; + image.height = yc; + image.cmap.len = 0; + image.depth = 32; + image.data = (const char*)fbbuff; + ioctl(fd, FBIO_IMAGE_BLT, &image); + return; + } + CFrameBuffer::blit2FB(fbbuff, width, height, xoff, yoff, xp, yp, transp); +} + +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; + + uint32_t xc = (width > xRes) ? (uint32_t)xRes : width; + uint32_t yc = (height > yRes) ? (uint32_t)yRes : height; + + if (!(width%4)) { + fb_image image; + image.dx = xoff; + image.dy = yoff; + image.width = xc; + image.height = yc; + image.cmap.len = 0; + image.depth = 32; + image.data = (const char*)boxBuf; + ioctl(fd, FBIO_IMAGE_BLT, &image); + return; + } + CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); +} + +int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) +{ + fb_fix_screeninfo _fix; + + if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) { + perror("FBIOGET_FSCREENINFO"); + return -1; + } + stride = _fix.line_length; + if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) + printf("screen unblanking failed\n"); + xRes = screeninfo.xres; + yRes = screeninfo.yres; + bpp = screeninfo.bits_per_pixel; + 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) + { + backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + return 0; + } + fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem); + backbuffer = lfb; /* will not work well, but avoid crashes */ + return 0; /* dont fail because of this */ +} + +void CFbAccelCSHD2::setBlendMode(uint8_t mode) +{ + if (ioctl(fd, FBIO_SETBLENDMODE, mode)) + printf("FBIO_SETBLENDMODE failed.\n"); +} + +void CFbAccelCSHD2::setBlendLevel(int level) +{ + unsigned char value = 0xFF; + if (level >= 0 && level <= 100) + value = convertSetupAlpha2Alpha(level); + + if (ioctl(fd, FBIO_SETOPACITY, value)) + printf("FBIO_SETOPACITY failed.\n"); + if (level == 100) // TODO: sucks. + usleep(20000); +} 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..cd38baa72 --- /dev/null +++ b/src/driver/fb_accel_cs_hdx_inc.h @@ -0,0 +1,38 @@ +/* + 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 . +*/ + + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 999b3d2b5..9377d77da 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -126,7 +126,12 @@ CFrameBuffer* CFrameBuffer::getInstance() frameBuffer = new CFbAccelSTi(); #endif #if HAVE_COOL_HARDWARE - frameBuffer = new CFbAccelCS(); +#ifdef BOXMODEL_CS_HD1 + frameBuffer = new CFbAccelCSHD1(); +#endif +#ifdef BOXMODEL_CS_HD2 + frameBuffer = new CFbAccelCSHD2(); +#endif #endif #if HAVE_GENERIC_HARDWARE frameBuffer = new CFbAccelGLFB(); @@ -347,7 +352,7 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign } return 0; } -#if 0 +#if 0 //never used void CFrameBuffer::setTransparency( int /*tr*/ ) { @@ -361,7 +366,7 @@ void CFrameBuffer::setBlendLevel(int /*level*/) { } -#if 0 +#if 0 //never used void CFrameBuffer::setAlphaFade(int in, int num, int tr) { @@ -507,7 +512,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, co int w_align; int offs_align; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (_dx%4 != 0) { w_align = GetWidth4FB_HW_ACC(x, _dx, true); if (w_align < _dx) @@ -1190,7 +1195,7 @@ void CFrameBuffer::paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t co } mark(xa, ya, xb, yb); } -#if 0 +#if 0 //never used void CFrameBuffer::setBackgroundColor(const fb_pixel_t color) { @@ -1538,9 +1543,9 @@ void * CFrameBuffer::int_convertRGB2FB(unsigned char *rgbbuff, unsigned long x, if (alpha) { for(i = 0; i < count ; i++) - fbbuff[i] = ((rgbbuff[i*4+3] << 24) & 0xFF000000) | - ((rgbbuff[i*4] << 16) & 0x00FF0000) | - ((rgbbuff[i*4+1] << 8) & 0x0000FF00) | + fbbuff[i] = ((rgbbuff[i*4+3] << 24) & 0xFF000000) | + ((rgbbuff[i*4] << 16) & 0x00FF0000) | + ((rgbbuff[i*4+1] << 8) & 0x0000FF00) | ((rgbbuff[i*4+2]) & 0x000000FF); } else { switch (m_transparent) { diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 67ef515f6..5b2a24402 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -122,6 +122,7 @@ class CFrameBuffer : public sigc::trackable int kd_mode; struct vt_mode vt_mode; bool active; + bool fb_no_check; static void switch_signal (int); fb_fix_screeninfo fix; bool locked; @@ -175,14 +176,18 @@ class CFrameBuffer : public sigc::trackable virtual fb_pixel_t * getBackBufferPointer() const; // pointer to backbuffer virtual unsigned int getStride() const; // size of a single line in the framebuffer (in bytes) unsigned int getScreenWidth(bool real = false); - unsigned int getScreenHeight(bool real = false); + unsigned int getScreenHeight(bool real = false); unsigned int getScreenWidthRel(bool force_small = false); unsigned int getScreenHeightRel(bool force_small = false); unsigned int getScreenX(); unsigned int getScreenY(); - + bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? +#ifdef BOXMODEL_CS_HD1 + virtual void setupGXA() {}; + virtual void add_gxa_sync_marker() {}; +#endif void setTransparency( int tr = 0 ); virtual void setBlendMode(uint8_t mode = 1); @@ -223,7 +228,7 @@ class CFrameBuffer : public sigc::trackable void getIconSize(const char * const filename, int* width, int *height); /* h is the height of the target "window", if != 0 the icon gets centered in that window */ - bool paintIcon (const std::string & filename, const int x, const int y, + bool paintIcon (const std::string & filename, const int x, const int y, const int h = 0, const unsigned char offset = 1, bool paint = true, bool paintBg = false, const fb_pixel_t colBg = 0); bool paintIcon8(const std::string & filename, const int x, const int y, const unsigned char offset = 0); void loadPal (const std::string & filename, const unsigned char offset = 0, const unsigned char endidx = 255); @@ -266,7 +271,7 @@ class CFrameBuffer : public sigc::trackable virtual void mark(int x, int y, int dx, int dy); - enum + enum { TM_EMPTY = 0, TM_NONE = 1, @@ -296,7 +301,6 @@ class CFrameBuffer : public sigc::trackable typedef std::vector v_fbarea_t; typedef v_fbarea_t::iterator fbarea_iterator_t; v_fbarea_t v_fbarea; - bool fb_no_check; bool do_paint_mute_icon; bool _checkFbArea(int _x, int _y, int _dx, int _dy, bool prev); diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 7911f22df..20ff5a506 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -63,7 +63,7 @@ extern CPictureViewer * g_PicViewer; #define BACKGROUNDIMAGEWIDTH 720 -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #ifndef FB_HW_ACCELERATION #define FB_HW_ACCELERATION #endif @@ -582,7 +582,7 @@ void CFrameBuffer::setBlendLevel(int level) if (ioctl(fd, FBIO_SETOPACITY, value)) printf("FBIO_SETOPACITY failed.\n"); -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 if(level == 100) // TODO: sucks. usleep(20000); #endif @@ -735,7 +735,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, co int w_align; int offs_align; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (_dx%4 != 0) { w_align = GetWidth4FB_HW_ACC(x, _dx, true); if (w_align < _dx) diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 2f4a3722c..80b40377e 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -142,7 +142,7 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/) if (initRenderClass) { if (g_fontRenderer != NULL) delete g_fontRenderer; - g_fontRenderer = new FBFontRenderClass(72 * g_settings.screen_xres / 100, 72 * g_settings.screen_yres / 100); + g_fontRenderer = new FBFontRenderClass(72 * g_settings.font_scaling_x / 100, 72 * g_settings.font_scaling_y / 100); old_fontDescr.size_offset = fontDescr.size_offset; old_fontDescr.filename = fontDescr.filename; diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 4bb9a63cf..84f2fc7a6 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -856,7 +856,7 @@ bool CPictureViewer::checkfreemem(size_t bufsize) { struct sysinfo info; sysinfo( &info ); - if(bufsize + 4096 > (size_t)info.freeram + (size_t)info.freeswap){ + if(bufsize*2 + 4096 > (size_t)info.freeram + (size_t)info.freeswap){ dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: Out of memory\n", __func__, __LINE__); return false; } diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 52cac1aa0..4bd580f3f 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -39,7 +39,7 @@ #include #include -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H #include #endif diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index ede15cb12..016e5e28a 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -78,7 +78,7 @@ bool CScreenShot::GetData() bool res = false; mutex.lock(); -#ifdef USE_NEVIS_GXA +#ifdef BOXMODEL_CS_HD1 CFrameBuffer::getInstance()->setActive(false); #endif if (videoDecoder->getBlank()) @@ -87,7 +87,7 @@ bool CScreenShot::GetData() res = videoDecoder->GetScreenImage(pixel_data, xres, yres, get_video, get_osd, scale_to_video); #endif -#ifdef USE_NEVIS_GXA +#ifdef BOXMODEL_CS_HD1 /* sort of hack. GXA used to transfer/convert live image to RGB, * so setup GXA back */ CFrameBuffer::getInstance()->setupGXA(); @@ -216,7 +216,7 @@ bool CScreenShot::SavePng() png_set_compression_level(png_ptr, Z_BEST_SPEED); png_set_bgr(png_ptr); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 png_set_invert_alpha(png_ptr); #endif png_write_info(png_ptr, info_ptr); diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 6f51f6346..b081d5b62 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -71,7 +71,7 @@ CVFD::CVFD() has_led_segment = false; } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (fd >= 0) { int ret = ioctl(fd, IOC_FP_GET_DISPLAY_CAPS, &caps); if (ret < 0) { @@ -372,7 +372,7 @@ void CVFD::showTime(bool force) ShowText(timestr); } else if (support_numbers && has_led_segment) { ShowNumber((t->tm_hour*100) + t->tm_min); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 ioctl(fd, IOC_FP_SET_COLON, 0x01); #endif } @@ -564,7 +564,7 @@ void CVFD::setMode(const MODES m, const char * const title) if(fd < 0) return; // Clear colon in display if it is still there -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (support_numbers && has_led_segment) ioctl(fd, IOC_FP_SET_COLON, 0x00); #endif @@ -819,7 +819,7 @@ void CVFD::ShowNumber(int number) if (number < 0) return; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 int ret = ioctl(fd, IOC_FP_SET_NUMBER, number); if(ret < 0) { support_numbers = false; diff --git a/src/driver/vfd.h b/src/driver/vfd.h index 9664f1aa0..84039020d 100644 --- a/src/driver/vfd.h +++ b/src/driver/vfd.h @@ -76,7 +76,7 @@ class CVFD private: -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 fp_display_caps_t caps; #endif MODES mode; diff --git a/src/drivertool.c b/src/drivertool.c index c36e681bc..d756af2af 100644 --- a/src/drivertool.c +++ b/src/drivertool.c @@ -32,7 +32,7 @@ #include -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H #include #endif diff --git a/src/eitd/edvbstring.cpp b/src/eitd/edvbstring.cpp index 9267630da..3ddff948a 100644 --- a/src/eitd/edvbstring.cpp +++ b/src/eitd/edvbstring.cpp @@ -198,7 +198,7 @@ static unsigned long iso6937[96]={ 0x0138, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0140, 0x0142, 0x00F8, 0x0153, 0x00DF, 0x00FE, 0x0167, 0x014B, 0x00AD }; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 const unsigned short cGB2312UNI[] = { // Start at 0xA100.so index have to be reduced. Maybe this can be optimized by removing the starts but for // now just 'make it work' :). @@ -2020,7 +2020,7 @@ std::string convertDVBUTF8(const char *data, int len, int table, int tsidonid) { int newtable = 0; bool twochar = false; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 bool gb2312 = false; #endif if (!len) @@ -2070,7 +2070,7 @@ std::string convertDVBUTF8(const char *data, int len, int table, int tsidonid) break; case 0x13: ++i; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 //printf("GB-2312-1980 enc.\n"); gb2312 = true; #endif @@ -2116,7 +2116,7 @@ std::string convertDVBUTF8(const char *data, int len, int table, int tsidonid) //dprintf("recode:::: doVideoTexSuppl code %lX\n", code); } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 // GB2312 -> Unicode if (gb2312 && !code) { if (data[i] >= 0xA1) { diff --git a/src/gui/audio_setup.cpp b/src/gui/audio_setup.cpp index 48d4f8637..9f81e5fca 100644 --- a/src/gui/audio_setup.cpp +++ b/src/gui/audio_setup.cpp @@ -94,7 +94,7 @@ const CMenuOptionChooser::keyval AUDIOMENU_ANALOGOUT_OPTIONS[AUDIOMENU_ANALOGOUT { 2, LOCALE_AUDIOMENU_MONORIGHT } }; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #define AUDIOMENU_SRS_OPTION_COUNT 3 #else #define AUDIOMENU_SRS_OPTION_COUNT 2 @@ -103,7 +103,7 @@ const CMenuOptionChooser::keyval AUDIOMENU_SRS_OPTIONS[AUDIOMENU_SRS_OPTION_COUN { { 0 , LOCALE_AUDIO_SRS_ALGO_LIGHT }, { 1 , LOCALE_AUDIO_SRS_ALGO_NORMAL }, -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 { 2 , LOCALE_AUDIO_SRS_ALGO_HEAVY } #endif }; @@ -244,7 +244,7 @@ int CAudioSetup::showAudioSetup() audioSettings->addItem(GenericMenuSeparatorLine); audioSettings->addItem(as_oj_srsonoff); audioSettings->addItem(as_oj_algo); -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 audioSettings->addItem(as_oj_noise); #endif audioSettings->addItem(as_oj_volrev); @@ -262,7 +262,7 @@ int CAudioSetup::showAudioSetup() int res = audioSettings->exec(NULL, ""); selected = audioSettings->getSelected(); delete audioSettings; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 delete as_oj_noise; #endif if (!g_settings.easymenu) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 2261c7d57..9b2a9755a 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -108,7 +108,7 @@ int CCAMMenuHandler::doMainMenu() CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS); cammenu->addIntroItems(); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 int fecount = CFEManager::getInstance()->getFrontendCount(); char fename[fecount+1][255]; #endif @@ -120,7 +120,7 @@ int CCAMMenuHandler::doMainMenu() cammenu->addItem( new CMenuOptionChooser(LOCALE_CI_IGNORE_MSG, &g_settings.ci_ignore_messages, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); cammenu->addItem( new CMenuOptionChooser(LOCALE_CI_SAVE_PINCODE, &g_settings.ci_save_pincode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 CMenuOptionChooser::keyval_ext feselect[fecount+1]; feselect[0].key = -1; feselect[0].value = NONEXISTANT_LOCALE; diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index a303038bc..bcaccf6c7 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -222,7 +222,7 @@ void CComponentsPicture::initCCItem() { float h_ratio = float(height)*100/(float)dy; width = int(h_ratio*(float)dx/100); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (do_scale && (width > 10 || height > 10)) width = GetWidth4FB_HW_ACC(x+fr_thickness, width-2*fr_thickness)+2*fr_thickness; #endif diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 1226c3345..fb6030073 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1822,7 +1822,7 @@ void CMoviePlayerGui::addAudioFormat(int count, std::string &apidtitle, bool& en apidtitle.append(" (DTS)"); if (apidtitle.find("DTS") == std::string::npos) apidtitle.append(" (DTS)"); -#if ! defined(HAVE_SPARK_HARDWARE) && ! defined (BOXMODEL_APOLLO) +#if ! defined(HAVE_SPARK_HARDWARE) && ! defined (BOXMODEL_CS_HD2) enabled = false; #endif break; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index d47d08b94..0ad6d892b 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -269,26 +269,26 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) return res; } else if (actionKey == "font_scaling") { - int xre = g_settings.screen_xres; - int yre = g_settings.screen_yres; + int fs_x = g_settings.font_scaling_x; + int fs_y = g_settings.font_scaling_y; CMenuWidget fontscale(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_COLORS, width, MN_WIDGET_ID_OSDSETUP_FONTSCALE); fontscale.addIntroItems(LOCALE_FONTMENU_SCALING); - CMenuOptionNumberChooser* mc = new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_X, &g_settings.screen_xres, true, 50, 200, this); + CMenuOptionNumberChooser* mc = new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_X, &g_settings.font_scaling_x, true, 50, 200, this); mc->setNumericInput(true); mc->setNumberFormat("%d%%"); fontscale.addItem(mc); - mc = new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_Y, &g_settings.screen_yres, true, 50, 200, this); + mc = new CMenuOptionNumberChooser(LOCALE_FONTMENU_SCALING_Y, &g_settings.font_scaling_y, true, 50, 200, this); mc->setNumericInput(true); mc->setNumberFormat("%d%%"); fontscale.addItem(mc); res = fontscale.exec(NULL, ""); - if (xre != g_settings.screen_xres || yre != g_settings.screen_yres) { - printf("[neutrino] new font scale settings x: %d%% y: %d%%\n", g_settings.screen_xres, g_settings.screen_yres); + if (fs_x != g_settings.font_scaling_x || fs_y != g_settings.font_scaling_y) { + printf("[neutrino] new font scale settings x: %d%% y: %d%%\n", g_settings.font_scaling_x, g_settings.font_scaling_y); CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT | CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT_INST | CNeutrinoFonts::FONTSETUP_DYN_FONT); if (CNeutrinoApp::getInstance()->channelList) CNeutrinoApp::getInstance()->channelList->ResetModules(); //force re init of all modules diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 18db834ec..f44432096 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -77,7 +77,7 @@ int CPluginList::run() g_PluginList->startPlugin(number); if (!g_PluginList->getScriptOutput().empty()) { hide(); - ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_SHELL); + ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_SHELL, 320, g_settings.timing[SNeutrinoSettings::TIMING_STATIC_MESSAGES]); } return menu_return::RETURN_REPAINT; } diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 7bf9a3e9d..6471856cd 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/src/gui/update.cpp b/src/gui/update.cpp index e06b4d587..691a9a82c 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -90,7 +90,7 @@ extern int allow_flash; #define FILEBROWSER_UPDATE_FILTER "img" #define MTD_OF_WHOLE_IMAGE 0 -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #define MTD_DEVICE_OF_UPDATE_PART "/dev/mtd0" #else #define MTD_DEVICE_OF_UPDATE_PART "/dev/mtd3" @@ -321,7 +321,7 @@ bool CFlashUpdate::selectHttpImage(void) newVersion = versions[selected]; file_md5 = md5s[selected]; fileType = fileTypes[selected]; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if(fileType < '3') { int esize = CMTDInfo::getInstance()->getMTDEraseSize(sysfs); printf("[update] erase size is %x\n", esize); @@ -557,7 +557,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) if(fileType < '3') { //flash it... #if ENABLE_EXTUPDATE -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 if (g_settings.apply_settings) { if (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) == CMsgBox::mbrYes) if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE)) { @@ -626,7 +626,7 @@ CFlashExpert::CFlashExpert() { selectedMTD = -1; width = 40; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 forceOtherFilename = false; otherFilename = ""; createimage_other = 0; @@ -643,7 +643,7 @@ CFlashExpert* CFlashExpert::getInstance() bool CFlashExpert::checkSize(int mtd, std::string &backupFile) { -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 if (mtd < 0) return false; #endif char errMsg[1024] = {0}; @@ -657,7 +657,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile) uint64_t btotal = 0, bused = 0; long bsize = 0; uint64_t backupRequiredSize = 0; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (mtd == -1) { // check disk space for image creation if (!get_fs_usage("/", btotal, bused, &bsize)) { snprintf(errMsg, sizeof(errMsg)-1, g_Locale->getText(LOCALE_FLASHUPDATE_READ_VOLUME_ERROR), "root0"); @@ -693,7 +693,7 @@ bool CFlashExpert::checkSize(int mtd, std::string &backupFile) return true; } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 bool CFlashExpert::readDevtableFile(std::string &devtableFile, CMkfsJFFS2::v_devtable_t &v_devtable) { FILE *fd = fopen(devtableFile.c_str(), "r"); @@ -779,7 +779,7 @@ void CFlashExpert::readmtd(int preadmtd) std::string tankStr = ""; #if ENABLE_EXTUPDATE -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 int eSize = CMTDInfo::getInstance()->getMTDEraseSize(CMTDInfo::getInstance()->findMTDsystem()); if (preadmtd == 0) { if (createimage_other == 0) { @@ -798,7 +798,7 @@ void CFlashExpert::readmtd(int preadmtd) #endif filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd) + timeStr + tankStr + ".img"; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 std::string title = " (" + CMTDInfo::getInstance()->getMTDName(preadmtd) + ")"; std::string mountp = getJFFS2MountPoint(preadmtd); if (preadmtd == 0) { @@ -822,7 +822,7 @@ void CFlashExpert::readmtd(int preadmtd) } bool skipCheck = false; -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 if ((std::string)g_settings.update_dir == "/tmp") skipCheck = true; #else @@ -850,7 +850,7 @@ void CFlashExpert::readmtd(int preadmtd) sprintf(message, g_Locale->getText(LOCALE_FLASHUPDATE_SAVESUCCESS), filename.c_str()); sleep(1); hide(); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (!forceOtherFilename) ShowHint(LOCALE_MESSAGEBOX_INFO, message); #else @@ -912,7 +912,7 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) for(int lx=0;lxgetMTDCount();lx++) { char sActionKey[20]; bool enabled = true; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 // disable write uboot / uldr / env if ((actionkey == "writemtd") && (lx == mtdInfo->findMTDNumberFromName("u-boot") || lx == mtdInfo->findMTDNumberFromName("uldr") || @@ -936,7 +936,7 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) mtdselector->addItem(new CMenuForwarder(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++))); } #if ENABLE_EXTUPDATE -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 if (actionkey == "writemtd") mtdselector->addItem(new CMenuForwarder("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); #endif @@ -1029,7 +1029,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) return res; } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 CFlashExpertSetup::CFlashExpertSetup() { width = 40; @@ -1197,4 +1197,4 @@ g_settings.flashupdate_createimage_add_spare = 0; cfe->createimage_other = 0; return res; } -#endif // BOXMODEL_APOLLO +#endif // BOXMODEL_CS_HD2 diff --git a/src/gui/update.h b/src/gui/update.h index 94da38ea2..dc8d3584b 100644 --- a/src/gui/update.h +++ b/src/gui/update.h @@ -38,7 +38,7 @@ #include -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #include #endif @@ -80,13 +80,13 @@ class CFlashExpert : public CProgressWindow int showFileSelector(const std::string & actionkey); bool checkSize(int mtd, std::string &backupFile); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 bool readDevtableFile(std::string &devtableFile, CMkfsJFFS2::v_devtable_t &v_devtable); void readmtdJFFS2(std::string &filename, std::string title="", std::string path="/", bool makeDevTable=true); #endif public: -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 bool forceOtherFilename; std::string otherFilename; int createimage_other; @@ -99,7 +99,7 @@ class CFlashExpert : public CProgressWindow }; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 class CFlashExpertSetup : public CMenuTarget { private: @@ -114,6 +114,6 @@ class CFlashExpertSetup : public CMenuTarget int exec(CMenuTarget* parent, const std::string &actionKey); }; -#endif // BOXMODEL_APOLLO +#endif // BOXMODEL_CS_HD2 #endif diff --git a/src/gui/update_ext.cpp b/src/gui/update_ext.cpp index f92df2c7d..0792a90f4 100644 --- a/src/gui/update_ext.cpp +++ b/src/gui/update_ext.cpp @@ -233,7 +233,7 @@ bool CExtUpdate::applySettings() if (mtdFilename.empty()) return ErrorReset(0, "error system mtd not found"); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 uint64_t mtdSize = 65536*1024; // FIXME hack, mtd size more than free RAM #else uint64_t mtdSize = mtdInfo->getMTDSize(mtdFilename); diff --git a/src/gui/update_menue.cpp b/src/gui/update_menue.cpp index e0af074e7..598ecdc10 100644 --- a/src/gui/update_menue.cpp +++ b/src/gui/update_menue.cpp @@ -124,7 +124,7 @@ int CSoftwareUpdate::showSoftwareUpdate() #endif } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 softUpdate.addItem(GenericMenuSeparatorLine); if (g_settings.easymenu) diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index 26872a18c..506240f8a 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -134,7 +134,7 @@ int CUpdateSettings::initMenu() CMenuOptionChooser *name_backup = new CMenuOptionChooser(LOCALE_FLASHUPDATE_NAMEMODE2, &g_settings.softupdate_name_mode_backup, SOFTUPDATE_NAME_MODE2_OPTIONS, SOFTUPDATE_NAME_MODE2_OPTION_COUNT, true); // name_backup->setHint("", LOCALE_MENU_HINT_XXX); -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 CMenuOptionChooser *apply_settings = new CMenuOptionChooser(LOCALE_FLASHUPDATE_MENU_APPLY_SETTINGS, &g_settings.apply_settings, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); // apply_settings->setHint("", LOCALE_MENU_HINT_XXX); @@ -157,7 +157,7 @@ int CUpdateSettings::initMenu() w_upsettings.addItem(fw_url); #if ENABLE_EXTUPDATE w_upsettings.addItem(name_backup); -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 w_upsettings.addItem(GenericMenuSeparatorLine); w_upsettings.addItem(apply_settings); w_upsettings.addItem(name_apply); diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index d4de6c343..f9bb20f2f 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -110,7 +110,7 @@ int CVideoSettings::exec(CMenuTarget* parent, const std::string &/*actionKey*/) const CMenuOptionChooser::keyval VIDEOMENU_43MODE_OPTIONS[] = { { DISPLAY_AR_MODE_PANSCAN, LOCALE_VIDEOMENU_PANSCAN }, -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 { DISPLAY_AR_MODE_PANSCAN2, LOCALE_VIDEOMENU_PANSCAN2 }, #endif { DISPLAY_AR_MODE_LETTERBOX, LOCALE_VIDEOMENU_LETTERBOX }, @@ -233,7 +233,7 @@ CMenuOptionChooser::keyval_ext VIDEOMENU_VIDEOMODE_OPTIONS[VIDEOMENU_VIDEOMODE_O { VIDEO_STD_576P, NONEXISTANT_LOCALE, "576p" }, { VIDEO_STD_720P50, NONEXISTANT_LOCALE, "720p 50Hz" }, { VIDEO_STD_1080I50, NONEXISTANT_LOCALE, "1080i 50Hz" }, -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 { VIDEO_STD_1080P50, NONEXISTANT_LOCALE, "1080p 50Hz" }, #else { -1, NONEXISTANT_LOCALE, "1080p 50Hz" }, @@ -244,7 +244,7 @@ CMenuOptionChooser::keyval_ext VIDEOMENU_VIDEOMODE_OPTIONS[VIDEOMENU_VIDEOMODE_O { VIDEO_STD_480P, NONEXISTANT_LOCALE, "480p" }, { VIDEO_STD_720P60, NONEXISTANT_LOCALE, "720p 60Hz" }, { VIDEO_STD_1080I60, NONEXISTANT_LOCALE, "1080i 60Hz" }, -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 /* TODO: fix this crap */ { VIDEO_STD_1080P60, NONEXISTANT_LOCALE, "1080p 60Hz" }, { VIDEO_STD_1080P2397, NONEXISTANT_LOCALE, "1080p 23.97Hz"}, @@ -341,7 +341,7 @@ int CVideoSettings::showVideoSetup() } else if (system_rev > 0x06) { -#if defined(BOXMODEL_APOLLO) && defined(ANALOG_MODE) +#if defined(BOXMODEL_CS_HD2) && defined(ANALOG_MODE) vs_analg_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_ANALOG_MODE, &g_settings.analog_mode1, VIDEOMENU_VIDEOSIGNAL_HD2_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD2_OPTION_COUNT, true, this); vs_analg_ch->setHint("", LOCALE_MENU_HINT_VIDEO_ANALOG_MODE); #else @@ -374,7 +374,7 @@ int CVideoSettings::showVideoSetup() CMenuOptionChooser *vs_dbdropt_ch = NULL; CMenuWidget videomodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 CMenuForwarder * vs_automodes_fw = NULL; CMenuWidget automodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); #endif @@ -400,7 +400,7 @@ int CVideoSettings::showVideoSetup() vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, &videomodes, NULL, CRCInput::RC_red); vs_videomodes_fw->setHint("", LOCALE_MENU_HINT_VIDEO_MODES); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 automodes.addIntroItems(LOCALE_VIDEOMENU_ENABLED_MODES_AUTO); for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT - 1; i++) @@ -437,12 +437,12 @@ int CVideoSettings::showVideoSetup() videosetup->addItem(vs_dbdropt_ch); //dbdr options if (vs_videomodes_fw != NULL) videosetup->addItem(vs_videomodes_fw); //video modes submenue -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 videosetup->addItem(vs_automodes_fw); //video auto modes submenue #endif } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (!g_settings.easymenu) { /* values are from -128 to 127, but brightness really no sense after +/- 40. changeNotify multiply contrast and saturation to 3 */ CMenuOptionNumberChooser * bcont = new CMenuOptionNumberChooser(LOCALE_VIDEOMENU_BRIGHTNESS, &g_settings.brightness, true, -42, 42, this); @@ -485,7 +485,7 @@ void CVideoSettings::setVideoSettings() videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode1); videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode2); #endif -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 changeNotify(LOCALE_VIDEOMENU_ANALOG_MODE, NULL); #else unsigned int system_rev = cs_get_revision(); @@ -510,7 +510,7 @@ void CVideoSettings::setVideoSettings() videoDecoder->SetDBDR(g_settings.video_dbdr); CAutoModeNotifier anotify; anotify.changeNotify(NONEXISTANT_LOCALE, 0); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 changeNotify(LOCALE_VIDEOMENU_BRIGHTNESS, NULL); changeNotify(LOCALE_VIDEOMENU_CONTRAST, NULL); changeNotify(LOCALE_VIDEOMENU_SATURATION, NULL); @@ -584,7 +584,7 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void * /* setupVideoSystem(true/*ask*/); return true; } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_BRIGHTNESS)) { videoDecoder->SetControl(VIDEO_CONTROL_BRIGHTNESS, g_settings.brightness); diff --git a/src/gui/widget/buttons.cpp b/src/gui/widget/buttons.cpp index 1dbabe9ba..1c5049e6a 100644 --- a/src/gui/widget/buttons.cpp +++ b/src/gui/widget/buttons.cpp @@ -33,7 +33,6 @@ #include - /* paintButtons usage, use this function for painting icons with captions in horizontal or vertical direction. Icons automatically use the available maxwidth. diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1e5bce7b6..905879857 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -744,8 +744,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.channellist_show_numbers = configfile.getInt32("channellist_show_numbers", 1); //screen configuration - g_settings.screen_xres = configfile.getInt32("screen_xres", 100); - g_settings.screen_yres = configfile.getInt32("screen_yres", 100); g_settings.screen_StartX_crt = configfile.getInt32( "screen_StartX_crt", DEFAULT_X_START_SD); g_settings.screen_StartY_crt = configfile.getInt32( "screen_StartY_crt", DEFAULT_Y_START_SD ); g_settings.screen_EndX_crt = configfile.getInt32( "screen_EndX_crt", DEFAULT_X_END_SD); @@ -766,8 +764,14 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt; g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt; - g_settings.screen_width = configfile.getInt32("screen_width", 0); - g_settings.screen_height = configfile.getInt32("screen_height", 0); + g_settings.screen_width = frameBuffer->getScreenWidth(true); + g_settings.screen_height = frameBuffer->getScreenHeight(true); + + // avoid configuration mismatch + if (g_settings.screen_EndX > g_settings.screen_width) + g_settings.screen_EndX = g_settings.screen_width; + if (g_settings.screen_EndY > g_settings.screen_height) + g_settings.screen_EndY = g_settings.screen_height; g_settings.bigFonts = configfile.getInt32("bigFonts", 1); g_settings.window_size = configfile.getInt32("window_size", 100); @@ -816,6 +820,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.ttx_font_file = configfile.getString( "ttx_font_file", FONTDIR"/DejaVuLGCSansMono-Bold.ttf"); ttx_font_file = g_settings.ttx_font_file.c_str(); + g_settings.font_scaling_x = configfile.getInt32("font_scaling_x", 100); + g_settings.font_scaling_y = configfile.getInt32("font_scaling_y", 100); + g_settings.update_dir = configfile.getString("update_dir", "/tmp"); g_settings.update_dir_opkg = configfile.getString("update_dir_opkg", g_settings.update_dir); @@ -938,18 +945,7 @@ int CNeutrinoApp::loadSetup(const char * fname) erg = 2; } - /* in case FB resolution changed */ - if((g_settings.screen_width && g_settings.screen_width != (int) frameBuffer->getScreenWidth(true)) - || (g_settings.screen_height && g_settings.screen_height != (int) frameBuffer->getScreenHeight(true))) { - g_settings.screen_StartX = g_settings.screen_preset ? DEFAULT_X_START_HD : DEFAULT_X_START_SD; - g_settings.screen_StartY = g_settings.screen_preset ? DEFAULT_Y_START_HD : DEFAULT_Y_START_SD; - g_settings.screen_EndX = g_settings.screen_preset ? DEFAULT_X_END_HD : DEFAULT_X_END_SD; - g_settings.screen_EndY = g_settings.screen_preset ? DEFAULT_Y_END_HD : DEFAULT_Y_END_SD; - - g_settings.screen_width = frameBuffer->getScreenWidth(true); - g_settings.screen_height = frameBuffer->getScreenHeight(true); - } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 g_settings.brightness = configfile.getInt32("brightness", 0); g_settings.contrast = configfile.getInt32("contrast", 0); g_settings.saturation = configfile.getInt32("saturation", 0); @@ -1020,6 +1016,23 @@ void CNeutrinoApp::upgradeSetup(const char * fname) configfile.deleteKey("progressbar_timescale_yellow"); configfile.deleteKey("progressbar_timescale_invert"); } + if (g_settings.version_pseudo < "20170209181001") + { + //convert screen_x/yres keys to font_scaling_x/y + + g_settings.font_scaling_x = configfile.getInt32("screen_xres", 100); + g_settings.font_scaling_y = configfile.getInt32("screen_yres", 100); + + configfile.deleteKey("screen_xres"); + configfile.deleteKey("screen_yres"); + } + if (g_settings.version_pseudo < "20170209181002") + { + //remove screen_width/height keys + + configfile.deleteKey("screen_width"); + configfile.deleteKey("screen_height"); + } g_settings.version_pseudo = NEUTRINO_VERSION_PSEUDO; configfile.setString("version_pseudo", g_settings.version_pseudo); @@ -1330,8 +1343,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("channellist_show_numbers", g_settings.channellist_show_numbers); //screen configuration - configfile.setInt32( "screen_xres", g_settings.screen_xres); - configfile.setInt32( "screen_yres", g_settings.screen_yres); configfile.setInt32( "screen_StartX_lcd", g_settings.screen_StartX_lcd ); configfile.setInt32( "screen_StartY_lcd", g_settings.screen_StartY_lcd ); configfile.setInt32( "screen_EndX_lcd", g_settings.screen_EndX_lcd ); @@ -1341,8 +1352,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "screen_EndX_crt", g_settings.screen_EndX_crt ); configfile.setInt32( "screen_EndY_crt", g_settings.screen_EndY_crt ); configfile.setInt32( "screen_preset", g_settings.screen_preset ); - configfile.setInt32( "screen_width", g_settings.screen_width); - configfile.setInt32( "screen_height", g_settings.screen_height); //Software-update configfile.setInt32 ("softupdate_mode" , g_settings.softupdate_mode ); @@ -1371,6 +1380,9 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setString("font_file", g_settings.font_file); configfile.setString("ttx_font_file", g_settings.ttx_font_file); + configfile.setInt32( "font_scaling_x", g_settings.font_scaling_x); + configfile.setInt32( "font_scaling_y", g_settings.font_scaling_y); + //parentallock configfile.setInt32( "parentallock_prompt", g_settings.parentallock_prompt ); configfile.setInt32( "parentallock_lockage", g_settings.parentallock_lockage ); @@ -1457,7 +1469,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("window_size", g_settings.window_size); configfile.setInt32("window_width", g_settings.window_width); configfile.setInt32("window_height", g_settings.window_height); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 configfile.setInt32("brightness", g_settings.brightness ); configfile.setInt32("contrast", g_settings.contrast ); configfile.setInt32("enable_sd_osd", g_settings.enable_sd_osd ); diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index d58b79406..075d139e3 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -852,7 +852,7 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) if( boxname == "Armas ") boxname += "TripleDragon"; break; -#ifdef BOXMODEL_NEVIS +#ifdef BOXMODEL_CS_HD1 case 6: boxname += "HD1"; break; @@ -868,7 +868,7 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) boxname += "Zee"; break; #endif -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 case 9: boxname += "Tank"; break; @@ -916,7 +916,7 @@ std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) switch(system_rev) { -#ifdef BOXMODEL_NEVIS +#ifdef BOXMODEL_CS_HD1 case 6: case 7: case 8: @@ -924,7 +924,7 @@ std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) boxmodel = "Nevis"; break; #endif -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 case 9: boxmodel = "Apollo"; break; diff --git a/src/system/Makefile.am b/src/system/Makefile.am index 184f688bf..bfdd80b24 100644 --- a/src/system/Makefile.am +++ b/src/system/Makefile.am @@ -1,4 +1,4 @@ -if BOXMODEL_APOLLO +if BOXMODEL_CS_HD2 SUBDIRS = mtdutils endif diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 1e9c5cb26..575da3891 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -182,7 +182,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra std::string flashfile; bool skipCopy = false; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (strcmp(dn, "/tmp") != 0) { uint64_t btotal = 0, bused = 0; long bsize = 0; @@ -689,7 +689,7 @@ int CMTDInfo::getMTDEraseSize( const std::string & filename ) std::string CMTDInfo::findMTDsystem() { -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 std::string sysfs = "root0"; #else std::string sysfs = "systemFS"; diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 4d155f18c..cc728fd7a 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -537,7 +537,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CServiceManager::getInstance()->SatelliteList().clear(); CZapit::getInstance()->LoadSettings(); CZapit::getInstance()->GetConfig(zapitCfg); -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 /* flag file to erase /var partition on factory reset, will be done by init scripts */ FILE * fp = fopen("/var_init/etc/.reset", "w"); @@ -576,7 +576,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK void CFanControlNotifier::setSpeed(unsigned int speed) { printf("FAN Speed %d\n", speed); -#ifndef BOXMODEL_APOLLO +#ifndef BOXMODEL_CS_HD2 int cfd = open("/dev/cs_control", O_RDONLY); if(cfd < 0) { perror("Cannot open /dev/cs_control"); @@ -635,7 +635,7 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi i, VIDEOMENU_VIDEOMODE_OPTIONS[i].key, VIDEO_STD_MAX); continue; } -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_auto_modes[i]; #else modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_video_modes[i]; diff --git a/src/system/settings.h b/src/system/settings.h index fb9398240..b56e1240a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -46,7 +46,7 @@ #include #include -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 #define VIDEOMENU_VIDEOMODE_OPTION_COUNT 16 #else #define VIDEOMENU_VIDEOMODE_OPTION_COUNT 13 @@ -177,7 +177,7 @@ struct SNeutrinoSettings int analog_mode1; int analog_mode2; int video_43mode; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 int brightness; int contrast; int saturation; @@ -623,8 +623,6 @@ struct SNeutrinoSettings int screen_preset; int screen_width; int screen_height; - int screen_xres; - int screen_yres; //Software-update int softupdate_mode; @@ -782,9 +780,13 @@ struct SNeutrinoSettings int zap_cycle; int sms_channel; int sms_movie; + std::string font_file; std::string ttx_font_file; + int font_scaling_x; + int font_scaling_y; + int livestreamResolution; std::string livestreamScriptPath; diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp index bd68da1c8..1f21a5dbc 100644 --- a/src/zapit/src/capmt.cpp +++ b/src/zapit/src/capmt.cpp @@ -307,7 +307,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if (channel_map.size() > 1) list = CCam::CAPMT_ADD; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 int ci_use_count = 0; for (it = channel_map.begin(); it != channel_map.end(); ++it) { @@ -364,7 +364,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start void CCamManager::SetCITuner(int tuner) { tunerno = tuner; -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (tunerno >= 0) cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)tunerno); #endif diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 762a99261..117997e8c 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -327,7 +327,7 @@ void CFrontend::getFEInfo(void) switch (info.type) { case FE_QPSK: deliverySystemMask |= DVB_S; -#ifndef BOXMODEL_NEVIS +#ifndef BOXMODEL_CS_HD1 if (info.caps & FE_CAN_2G_MODULATION) #endif deliverySystemMask |= DVB_S2; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 2dd528e43..7f4e10ae7 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -606,7 +606,7 @@ bool CZapit::ZapIt(const t_channel_id channel_id, bool forupdate, bool startplay StopPip(); #endif -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 if (CCamManager::getInstance()->GetCITuner() < 0) cCA::GetInstance()->SetTS((CA_DVBCI_TS_INPUT)live_fe->getNumber()); #endif @@ -2477,7 +2477,7 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) /* FIXME until proper demux management */ int dnum = 1; #endif -#ifdef BOXMODEL_APOLLO +#ifdef BOXMODEL_CS_HD2 videoDecoder = cVideo::GetDecoder(0); audioDecoder = cAudio::GetDecoder(0); diff --git a/version_pseudo.h b/version_pseudo.h index bdfc25f5d..f72f31607 100644 --- a/version_pseudo.h +++ b/version_pseudo.h @@ -1 +1 @@ -#define NEUTRINO_VERSION_PSEUDO "20162912080000" +#define NEUTRINO_VERSION_PSEUDO "20170209181002"