diff --git a/projects/WeTek_Hub/initramfs/platform_init b/projects/WeTek_Hub/initramfs/platform_init index e007d26459..576e0425a7 100755 --- a/projects/WeTek_Hub/initramfs/platform_init +++ b/projects/WeTek_Hub/initramfs/platform_init @@ -17,7 +17,7 @@ # along with OpenELEC. If not, see . ################################################################################ -hdmimode=720p +hdmimode=1080p60hz # Parse command line arguments for arg in $(cat /proc/cmdline); do @@ -37,8 +37,6 @@ for arg in $(cat /proc/cmdline); do esac done -# echo "$hdmimode" > /sys/class/display/mode - # Enable first framebuffer echo 0 > /sys/class/graphics/fb0/blank @@ -47,18 +45,31 @@ echo 1 > /sys/class/graphics/fb1/blank # Disable framebuffer scaling echo 0 > /sys/class/graphics/fb0/free_scale +echo 0 > /sys/class/graphics/fb1/free_scale # set initial video state echo 1 > /sys/class/video/disable_video # Set framebuffer geometry to match the resolution -case "$hdmimode" in - 720*) - fbset -fb /dev/fb0 -g 1280 720 1920 2160 32 - ;; - 1080*) - fbset -fb /dev/fb0 -g 1920 1080 1920 2160 32 - ;; +case $hdmimode in + 480*) X=720 Y=480 ;; + 576*) X=720 Y=576 ;; + 720p*) X=1280 Y=720 ;; + *) X=1920 Y=1080 ;; +esac + +fbset -fb /dev/fb0 -g $X $Y 1920 2160 32 +fbset -fb /dev/fb1 -g 32 32 32 32 32 + +# Enable scaling for 4K output +case $hdmimode in + 4k*|smpte*|2160*) + echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis + echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis + echo 1920 > /sys/class/graphics/fb0/scale_width + echo 1080 > /sys/class/graphics/fb0/scale_height + echo 0x10001 > /sys/class/graphics/fb0/free_scale + ;; esac # Include deinterlacer into default VFM map diff --git a/projects/WeTek_Hub/patches/kodi/0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch b/projects/WeTek_Hub/patches/kodi/0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch new file mode 100644 index 0000000000..728e967992 --- /dev/null +++ b/projects/WeTek_Hub/patches/kodi/0003-EGLNativeTypeAmlogic-Enable-GUI-free_scale-when-framebuffer-size-is-less-than-output.patch @@ -0,0 +1,89 @@ +From a348ef744e260f76e1e4e1299f9181ae40352eb5 Mon Sep 17 00:00:00 2001 +From: kszaq +Date: Mon, 22 Aug 2016 06:55:00 +0200 +Subject: [PATCH] EGLNativeTypeAmlogic: Enable GUI free_scale when framebuffer + size is less than output resolution + +For 4K output Kodi renders GUI at 1080p and this results in GUI covering only 1/4 screen. +This patch enables hardware upscaling if output resolution is greater than rendered GUI +resolution. +--- + xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 33 ++++++++++++++++++++++++++--- + xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 2 ++ + 2 files changed, 32 insertions(+), 3 deletions(-) + +diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +index 88cd385..3cbb604 100644 +--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp ++++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +@@ -133,6 +133,8 @@ bool CEGLNativeTypeAmlogic::GetNativeResolution(RESOLUTION_INFO *res) const + + bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) + { ++ bool result = false; ++ + #if defined(_FBDEV_WINDOW_H_) + if (m_nativeWindow) + { +@@ -144,10 +146,12 @@ bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res) + // Don't set the same mode as current + std::string mode; + SysfsUtils::GetString("/sys/class/display/mode", mode); +- if (res.strId == mode) +- return false; ++ if (res.strId != mode) ++ result = SetDisplayResolution(res.strId.c_str()); ++ ++ DealWithScale(res); + +- return SetDisplayResolution(res.strId.c_str()); ++ return result; + } + + bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector &resolutions) +@@ -220,6 +224,29 @@ void CEGLNativeTypeAmlogic::SetupVideoScaling(const char *mode) + SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 0); + } + ++void CEGLNativeTypeAmlogic::DealWithScale(const RESOLUTION_INFO &res) ++{ ++ if (res.iScreenWidth > res.iWidth && res.iScreenHeight > res.iHeight) ++ EnableFreeScale(res); ++ else ++ DisableFreeScale(); ++} ++ ++void CEGLNativeTypeAmlogic::EnableFreeScale(const RESOLUTION_INFO &res) ++{ ++ char fsaxis_str[256] = {0}; ++ sprintf(fsaxis_str, "0 0 %d %d", res.iWidth-1, res.iHeight-1); ++ char waxis_str[256] = {0}; ++ sprintf(waxis_str, "0 0 %d %d", res.iScreenWidth-1, res.iScreenHeight-1); ++ ++ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0); ++ SysfsUtils::SetString("/sys/class/graphics/fb0/free_scale_axis", fsaxis_str); ++ SysfsUtils::SetString("/sys/class/graphics/fb0/window_axis", waxis_str); ++ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_width", res.iWidth); ++ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_height", res.iHeight); ++ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0x10001); ++} ++ + void CEGLNativeTypeAmlogic::DisableFreeScale() + { + // turn off frame buffer freescale +diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h +index cfb33ca..96aa6f7 100644 +--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h ++++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h +@@ -53,6 +53,8 @@ public: + protected: + bool SetDisplayResolution(const char *resolution); + void SetupVideoScaling(const char *mode); ++ void DealWithScale(const RESOLUTION_INFO &res); ++ void EnableFreeScale(const RESOLUTION_INFO &res); + void DisableFreeScale(); + + private: +-- +1.8.3.1 + diff --git a/projects/WeTek_Hub/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch b/projects/WeTek_Hub/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch deleted file mode 100644 index 535c377f8b..0000000000 --- a/projects/WeTek_Hub/patches/kodi/0003-aml-Add-support-for-4k-resolutions.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 46aab0b0856eeaa855c430ddd36ac97203afa43b Mon Sep 17 00:00:00 2001 -From: Alex Deryskyba -Date: Wed, 1 Jul 2015 23:37:11 +0200 -Subject: [PATCH 3/5] [aml] Add support for 4k resolutions - ---- - xbmc/utils/AMLUtils.cpp | 16 ++++++++-------- - xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 23 +++++++++++++++++++---- - xbmc/windowing/egl/EGLNativeTypeAmlogic.h | 2 ++ - 3 files changed, 29 insertions(+), 12 deletions(-) - -diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp -index 80fb453..65286de 100644 ---- a/xbmc/utils/AMLUtils.cpp -+++ b/xbmc/utils/AMLUtils.cpp -@@ -463,8 +463,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2ksmpte") || StringUtils::EqualsNoCase(fromMode, "smpte24hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 4096; -+ res->iHeight= 2160; - res->iScreenWidth = 4096; - res->iScreenHeight= 2160; - res->fRefreshRate = 24; -@@ -481,8 +481,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k24hz") || StringUtils::EqualsNoCase(fromMode, "2160p24hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 24; -@@ -490,8 +490,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k25hz") || StringUtils::EqualsNoCase(fromMode, "2160p25hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 25; -@@ -508,8 +508,8 @@ bool aml_mode_to_resolution(const char *mode, RESOLUTION_INFO *res) - } - else if (StringUtils::EqualsNoCase(fromMode, "4k2k30hz") || StringUtils::EqualsNoCase(fromMode, "2160p30hz")) - { -- res->iWidth = 1920; -- res->iHeight= 1080; -+ res->iWidth = 3840; -+ res->iHeight= 2160; - res->iScreenWidth = 3840; - res->iScreenHeight= 2160; - res->fRefreshRate = 30; -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -index 88cd385..3bfb0c6 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp -@@ -64,7 +64,22 @@ void CEGLNativeTypeAmlogic::Initialize() - { - aml_permissions(); - DisableFreeScale(); -+ GetMaxResolution(m_maxResolution); - } -+ -+void CEGLNativeTypeAmlogic::GetMaxResolution(RESOLUTION_INFO &maxResolution) -+{ -+ std::vector resolutions; -+ ProbeResolutions(resolutions); -+ -+ maxResolution = {0}; -+ for (size_t i = 0; i < resolutions.size(); i++) -+ { -+ if (resolutions[i].iScreenWidth > maxResolution.iScreenWidth || resolutions[i].iScreenHeight > maxResolution.iScreenHeight) -+ maxResolution = resolutions[i]; -+ } -+} -+ - void CEGLNativeTypeAmlogic::Destroy() - { - return; -@@ -83,8 +98,8 @@ bool CEGLNativeTypeAmlogic::CreateNativeWindow() - if (!nativeWindow) - return false; - -- nativeWindow->width = 1920; -- nativeWindow->height = 1080; -+ nativeWindow->width = m_maxResolution.iScreenWidth; -+ nativeWindow->height = m_maxResolution.iScreenHeight; - m_nativeWindow = nativeWindow; - - SetFramebufferResolution(nativeWindow->width, nativeWindow->height); -@@ -244,8 +259,8 @@ void CEGLNativeTypeAmlogic::SetFramebufferResolution(int width, int height) cons - { - vinfo.xres = width; - vinfo.yres = height; -- vinfo.xres_virtual = 1920; -- vinfo.yres_virtual = 2160; -+ vinfo.xres_virtual = m_maxResolution.iScreenWidth; -+ vinfo.yres_virtual = m_maxResolution.iScreenHeight * 2; - vinfo.bits_per_pixel = 32; - vinfo.activate = FB_ACTIVATE_ALL; - ioctl(fd0, FBIOPUT_VSCREENINFO, &vinfo); -diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -index cfb33ca..cf60134 100644 ---- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.h -@@ -58,6 +58,8 @@ protected: - private: - void SetFramebufferResolution(const RESOLUTION_INFO &res) const; - void SetFramebufferResolution(int width, int height) const; -+ void GetMaxResolution(RESOLUTION_INFO &maxResolution); - - std::string m_framebuffer_name; -+ RESOLUTION_INFO m_maxResolution; - }; --- -1.7.10.4 - diff --git a/projects/WeTek_Hub/patches/kodi/0006-fix-resolution-fallback.patch b/projects/WeTek_Hub/patches/kodi/0006-fix-resolution-fallback.patch new file mode 100644 index 0000000000..b644151d30 --- /dev/null +++ b/projects/WeTek_Hub/patches/kodi/0006-fix-resolution-fallback.patch @@ -0,0 +1,13 @@ +diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +index cad677a..ad7be0b 100644 +--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp ++++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp +@@ -178,7 +178,7 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const + if (!GetNativeResolution(res)) + { + // punt to 720p if we get nothing +- aml_mode_to_resolution("720p", res); ++ aml_mode_to_resolution("720p60hz", res); + } + + return true; diff --git a/projects/WeTek_Hub/patches/linux/increase_framebuffer_menory_to_be_enough_for_4k.patch b/projects/WeTek_Hub/patches/linux/increase_framebuffer_menory_to_be_enough_for_4k.patch deleted file mode 100644 index e05d33d66f..0000000000 --- a/projects/WeTek_Hub/patches/linux/increase_framebuffer_menory_to_be_enough_for_4k.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dts b/arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dts -index 26d381c..e8573af 100644 ---- a/arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dts -+++ b/arch/arm64/boot/dts/amlogic/gxbb_p200_1G_wetek_hub.dts -@@ -57,7 +57,7 @@ - }; - fb_reserved:linux,meson-fb { - compatible = "amlogic, fb-memory"; -- size = <0x0 0x1900000>; -+ size = <0x0 0x4480000>; - no-map; - }; - -@@ -141,7 +141,7 @@ - interrupts = <0 3 1 - 0 89 1>; - interrupt-names = "viu-vsync", "rdma"; -- mem_size = <0x01800000 0x00100000>; /* fb0/fb1 memory size */ -+ mem_size = <0x04380000 0x00100000>; /* fb0/fb1 memory size */ - display_mode_default = "1080p60hz"; - scale_mode = <1>; /** 0:VPU free scale 1:OSD free scale 2:OSD super scale */ - display_size_default = <1920 1080 1920 3240 32>; //1920*1080*4*3 = 0x17BB000