- Change the amount of memory allocated to fb:
diff --git a/arch/arm64/boot/dts/amlogic/vero3_2g_16g.dts b/arch/arm64/boot/dts/amlogic/vero3_2g_16g.dts
index 97fde3d..a6df7a8 100644
--- a/arch/arm64/boot/dts/amlogic/vero3_2g_16g.dts
+++ b/arch/arm64/boot/dts/amlogic/vero3_2g_16g.dts
@@ -69,7 +69,7 @@
};
fb_reserved:linux,meson-fb {
compatible = "amlogic, fb-memory";
- size = <0x0 0x2000000>;
+ size = <0x0 0x4480000>;
no-map;
};
@@ -157,7 +157,7 @@
interrupts = <0 3 1
0 89 1>;
interrupt-names = "viu-vsync", "rdma";
- mem_size = <0x01800000 0x00100000>; /* fb0/fb1 memory size */
+ mem_size = <0x0 0x4480000>; /* 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
- Make sure the initramfs doesn’t configure scaling for 4K video modes:
diff --git a/package/kernel-osmc/initramfs-src/init.d/vero364 b/package/kernel-osmc/initramfs-src/init.d/vero364
index 06bbf16..8f3b553 100644
--- a/package/kernel-osmc/initramfs-src/init.d/vero364
+++ b/package/kernel-osmc/initramfs-src/init.d/vero364
@@ -40,30 +40,20 @@ fi
# Configure framebuffer X and Y size
case $hdmimode in
- 480*) X=720 Y=480 ;;
- 576*) X=720 Y=576 ;;
720p*) X=1280 Y=720 ;;
- *) X=1920 Y=1080 ;;
+ 1080p*) X=1920 Y=1080 ;;
esac
-/bin/busybox fbset -fb /dev/fb0 -g $X $Y 1920 2160 32
-/bin/busybox fbset -fb /dev/fb1 -g 32 32 32 32 32
+if [ ! -z "$X" ] && [ ! -z "$Y" ]
+then
+ /bin/busybox fbset -fb /dev/fb0 -g $X $Y 1920 2160 32
+ /bin/busybox fbset -fb /dev/fb1 -g 32 32 32 32 32
+fi
echo 0 > /sys/class/graphics/fb0/free_scale
echo 0 > /sys/class/graphics/fb1/free_scale
echo 1 > /sys/class/video/disable_video
-# 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
-
# Enable framebuffer device
echo 0 > /sys/class/graphics/fb0/blank
- Remove this Kodi scaling patch:
From 46aab0b0856eeaa855c430ddd36ac97203afa43b Mon Sep 17 00:00:00 2001
From: Alex Deryskyba <alex@codesnake.com>
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<RESOLUTION_INFO> 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