From 62ee5185b5f9b191d0548517d5c8d4b4b4749c1d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 13 Feb 2017 00:03:58 +0100 Subject: [PATCH 1/7] acinclude: only set default model to hd1 if boxtype=coolstream --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3eadaaff4..f5b22cab2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -511,7 +511,7 @@ AC_ARG_WITH(boxmodel, *) AC_MSG_ERROR([unsupported value $withval for --with-boxmodel]) ;; - esac], [BOXMODEL="hd1"] + esac], [test "$BOXTYPE" = "coolstream" && BOXMODEL="hd1" || true] [if test "$BOXTYPE" = "dreambox" -o "$BOXTYPE" = "ipbox" && test -z "$BOXMODEL"; then AC_MSG_ERROR([Dreambox/IPBox needs --with-boxmodel]) fi]) From 7fdc4c7178f44eafdc73235a52c196c1d4708aa4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:06:47 +0100 Subject: [PATCH 2/7] fb_generic: remove hardware specific #ifdef --- src/driver/fb_generic.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 5b2a24402..e863528ab 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -184,10 +184,7 @@ class CFrameBuffer : public sigc::trackable 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 + virtual void setupGXA() { return; }; // reinitialize stuff void setTransparency( int tr = 0 ); virtual void setBlendMode(uint8_t mode = 1); From b6909fb815c9e54a7a4626f1c13139402918fe63 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:09:33 +0100 Subject: [PATCH 3/7] implement getWidth4FB_HW_ACC in fb_accel class This helper to determine alignment for hardware blitting is now in system/helpers.h, where it does not really belong. Put it into the framebuffer class instead. Framebuffers that don't need it will just get a dummy function, the cs_hd2 framebuffer gets the real thing. Also add a bool function that indicates the need for alignment. --- src/driver/fb_accel.h | 2 ++ src/driver/fb_accel_cs_hd2.cpp | 17 +++++++++++++++++ src/driver/fb_generic.cpp | 8 ++++++-- src/driver/fb_generic.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 54736d331..e3eceaab5 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -127,6 +127,8 @@ class CFbAccelCSHD2 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); + uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); + bool needAlign4Blit() { return true; }; }; class CFbAccelGLFB diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 393e6396c..256a9c729 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -228,3 +228,20 @@ void CFbAccelCSHD2::setBlendLevel(int level) if (level == 100) // TODO: sucks. usleep(20000); } + +/* align for hw blit */ +uint32_t CFbAccelCSHD2::getWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max) +{ + uint32_t ret = _w; + if ((_x + ret) >= xRes) + ret = xRes-_x-1; + if (ret%4 == 0) + return ret; + + int add = (max) ? 3 : 0; + ret = ((ret + add) / 4) * 4; + if ((_x + ret) >= xRes) + ret -= 4; + + return ret; +} diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 9377d77da..1160b9c44 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -514,7 +513,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, co #ifdef BOXMODEL_CS_HD2 if (_dx%4 != 0) { - w_align = GetWidth4FB_HW_ACC(x, _dx, true); + w_align = getWidth4FB_HW_ACC(x, _dx, true); if (w_align < _dx) _dx = w_align; offs_align = w_align - _dx; @@ -1770,3 +1769,8 @@ bool CFrameBuffer::_checkFbArea(int _x, int _y, int _dx, int _dy, bool prev) void CFrameBuffer::mark(int , int , int , int ) { } + +uint32_t CFrameBuffer::getWidth4FB_HW_ACC(const uint32_t /*x*/, const uint32_t w, const bool /*max*/) +{ + return w; +} diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index e863528ab..fdd9cc8d5 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -185,6 +185,8 @@ class CFrameBuffer : public sigc::trackable bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? virtual void setupGXA() { return; }; // reinitialize stuff + virtual bool needAlign4Blit() { return false; }; + virtual uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); void setTransparency( int tr = 0 ); virtual void setBlendMode(uint8_t mode = 1); From c9e1072b94e3327c5ded71eada4533489572899a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:14:30 +0100 Subject: [PATCH 4/7] remove hardware specific code from gui Use the framebuffer's getWidth4FB_HW_ACC() instead of system/helpers. The use in cc_item_picture was guarded by a hardware #ifdef, use needAlign4Blit() instead. This needs testing on the affected hardware, which I do not have :-) --- src/gui/components/cc_item_picture.cpp | 8 +++----- src/gui/movieplayer.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index bcaccf6c7..1870092af 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -33,7 +33,6 @@ #include "cc_item_picture.h" #include #include -#include #include extern CPictureViewer * g_PicViewer; @@ -222,10 +221,9 @@ void CComponentsPicture::initCCItem() { float h_ratio = float(height)*100/(float)dy; width = int(h_ratio*(float)dx/100); -#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 + if (frameBuffer->needAlign4Blit() && + do_scale && (width > 10 || height > 10)) + width = frameBuffer->getWidth4FB_HW_ACC(x+fr_thickness, width-2*fr_thickness)+2*fr_thickness; keep_dx_aspect = false; } if (keep_dy_aspect && dx) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index ec9379fc9..0fda64768 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2448,7 +2448,7 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) int xoff = (double) sub->rects[i]->x * xc; int yoff = (double) sub->rects[i]->y * yc; - int nw = GetWidth4FB_HW_ACC(xoff, (double) sub->rects[i]->w * xc); + int nw = frameBuffer->getWidth4FB_HW_ACC(xoff, (double) sub->rects[i]->w * xc); int nh = (double) sub->rects[i]->h * yc; printf("Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, From e1e2052edb2f3c5890206da5f58bb43a5b57bf85 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:15:11 +0100 Subject: [PATCH 5/7] system/helpers: disable GetWidth4FB_HW_ACC() ...will be removed later --- src/system/helpers.cpp | 4 +++- src/system/helpers.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 46ae17fa0..e6e4a1e2e 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -47,7 +47,7 @@ #include "debug.h" #include #include -#include +//#include #include #include using namespace std; @@ -1113,6 +1113,7 @@ bool split_config_string(const std::string &str, std::map split(const std::string &s, char delim) { diff --git a/src/system/helpers.h b/src/system/helpers.h index dd23280a3..e117e011e 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -116,7 +116,9 @@ class CFileHelpers static uint64_t getDirSize(const std::string& dir){return getDirSize(dir.c_str());}; }; +#if 0 uint32_t GetWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max=true); +#endif #if __cplusplus < 201103L std::string to_string(int); From de80748cac920d7bea98ed739ff5d32d7a1ad53c Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 14 Feb 2017 16:30:20 +0100 Subject: [PATCH 6/7] fb_generic.h: Add missing function add_gxa_sync_marker() - is required for cs hd1 --- src/driver/fb_generic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index fdd9cc8d5..9ef472740 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -185,6 +185,7 @@ class CFrameBuffer : public sigc::trackable bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? virtual void setupGXA() { return; }; // reinitialize stuff + virtual void add_gxa_sync_marker() { return; }; virtual bool needAlign4Blit() { return false; }; virtual uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); From e8ec4540ca3ed77c4ce59c145609d13dbf7b1ca6 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 14 Feb 2017 19:57:28 +0100 Subject: [PATCH 7/7] fb_generic: make blitBox2FB virtual --- src/driver/fb_generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 9ef472740..412a3df29 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -267,7 +267,7 @@ class CFrameBuffer : public sigc::trackable void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); virtual 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); + virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); virtual void mark(int x, int y, int dx, int dy);