From 1a1a703fe945977aa80262aac4a46ad303b8946d Mon Sep 17 00:00:00 2001 From: Dolphin von Chips Date: Sun, 24 Nov 2019 17:46:56 +0500 Subject: [PATCH] samsung-j1mini3g: fix X11 and framebuffer colors (!753) [ci:skip-build]: already built successfully in CI --- device/linux-samsung-j1mini3g/APKBUILD | 10 +++++--- ...3g.armhf => config-samsung-j1mini3g.armv7} | 0 .../sprdfb-check-for-buffering.patch | 24 +++++++++++++++++++ .../sprdfb-fix-swapped-colors.patch | 15 ++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) rename device/linux-samsung-j1mini3g/{config-samsung-j1mini3g.armhf => config-samsung-j1mini3g.armv7} (100%) create mode 100755 device/linux-samsung-j1mini3g/sprdfb-check-for-buffering.patch create mode 100755 device/linux-samsung-j1mini3g/sprdfb-fix-swapped-colors.patch diff --git a/device/linux-samsung-j1mini3g/APKBUILD b/device/linux-samsung-j1mini3g/APKBUILD index a97b56646..e1f2762c3 100644 --- a/device/linux-samsung-j1mini3g/APKBUILD +++ b/device/linux-samsung-j1mini3g/APKBUILD @@ -3,7 +3,7 @@ pkgname="linux-samsung-j1mini3g" pkgver=3.10.106 -pkgrel=0 +pkgrel=1 pkgdesc="Samsung Galaxy J1 mini kernel fork" arch="armv7" _carch="arm" @@ -27,6 +27,8 @@ source=" gcc7-give-up-on-ilog2-const-optimizations.patch gcc8-fix-put-user.patch fix-dts.patch + sprdfb-fix-swapped-colors.patch + sprdfb-check-for-buffering.patch " builddir="$srcdir/${_repository}-${_commit}" @@ -69,7 +71,9 @@ package() { } sha512sums="f1686df6ee6e1f24c6460295c830b67b2146ab5b34ead2291fa92c3f83ba12884db875b0c6e31ff305ff64a82636648ee237c13f09c99e158449457285352388 linux-samsung-j1mini3g-6a377f7c43a84b578df39300dcce9fb9cb387a21.tar.gz -6828c7c82b11f98bfc185b50c186922ca555026a2c648cfd460a5262f879e278f32aa467b8bdfdca2827d7f0c8fc9342a859b105fa76ea9345ff640b2064cd26 config-samsung-j1mini3g.armhf +6828c7c82b11f98bfc185b50c186922ca555026a2c648cfd460a5262f879e278f32aa467b8bdfdca2827d7f0c8fc9342a859b105fa76ea9345ff640b2064cd26 config-samsung-j1mini3g.armv7 77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch 197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch -a4c04f8f0bd70ab8090faf08fe17592fe275a6be6d5a052f3dc3405062b8d11f08aba637d2ca5cecefcfecf64738a1e1704042ef747ecbef845579dba9b43b5d fix-dts.patch" +a4c04f8f0bd70ab8090faf08fe17592fe275a6be6d5a052f3dc3405062b8d11f08aba637d2ca5cecefcfecf64738a1e1704042ef747ecbef845579dba9b43b5d fix-dts.patch +6836001b24508d413a059f19b0c6f6f547037f68886c22159ad51be91d1a089e3d1d9ed79c3c62724648df7f810cd81d96a83f4a34368b373524b649e5539656 sprdfb-fix-swapped-colors.patch +e33ed12de874c1c8bc9231aea3b0389b18ee0ff804e39c0f47d9cbf657ea19015370d6114846c2d142fbdb88f472f0e65811c53b9b335feb8ae2f30dffdf4846 sprdfb-check-for-buffering.patch" diff --git a/device/linux-samsung-j1mini3g/config-samsung-j1mini3g.armhf b/device/linux-samsung-j1mini3g/config-samsung-j1mini3g.armv7 similarity index 100% rename from device/linux-samsung-j1mini3g/config-samsung-j1mini3g.armhf rename to device/linux-samsung-j1mini3g/config-samsung-j1mini3g.armv7 diff --git a/device/linux-samsung-j1mini3g/sprdfb-check-for-buffering.patch b/device/linux-samsung-j1mini3g/sprdfb-check-for-buffering.patch new file mode 100755 index 000000000..b6b03cc76 --- /dev/null +++ b/device/linux-samsung-j1mini3g/sprdfb-check-for-buffering.patch @@ -0,0 +1,24 @@ +sprdfb_check_var() has two problems: +I) it is not buffering-aware, which all Spreadtrum devices use; +II) it checks values that are already in yres_virtual, not those that we +are trying to overwrite. +Those problems stop X11 and charging-sdl from working properly. +X11 error: +(EE) FBDEV(0): FBIOPUT_VSCREENINFO: Invalid argument +This patch fixes first problem, however, the correct way is fixing +the second one, as this might have less side effects. + +diff --git a/drivers/video/sprdfb/sprdfb_main.c b/drivers/video/sprdfb/sprdfb_main.c +index 43876285..751616a1 100644 +--- a/drivers/video/sprdfb/sprdfb_main.c ++++ b/drivers/video/sprdfb/sprdfb_main.c +@@ -531,7 +531,8 @@ static int sprdfb_check_var(struct fb_var_screeninfo *var, struct fb_info *fb) + if ((var->xres != fb->var.xres) || + (var->yres != fb->var.yres) || + (var->xres_virtual != fb->var.xres_virtual) || +- (var->yres_virtual != fb->var.yres_virtual) || ++ // (var->yres_virtual != fb->var.yres_virtual) || ++ (fb->var.yres_virtual % var->yres_virtual != 0) || + (var->xoffset != fb->var.xoffset) || + #ifndef BIT_PER_PIXEL_SURPPORT + (var->bits_per_pixel != fb->var.bits_per_pixel) || diff --git a/device/linux-samsung-j1mini3g/sprdfb-fix-swapped-colors.patch b/device/linux-samsung-j1mini3g/sprdfb-fix-swapped-colors.patch new file mode 100755 index 000000000..4cd35760c --- /dev/null +++ b/device/linux-samsung-j1mini3g/sprdfb-fix-swapped-colors.patch @@ -0,0 +1,15 @@ +By default, color channels on Spreadtrum devices are swapped. This patch makes kernel use BGR565, which has normal color channels. + +diff --git a/drivers/video/sprdfb/sprdfb_main.c b/drivers/video/sprdfb/sprdfb_main.c +index 3e6c70d..80fceb9 100644 +--- a/drivers/video/sprdfb/sprdfb_main.c ++++ b/drivers/video/sprdfb/sprdfb_main.c +@@ -51,7 +51,7 @@ enum{ + SPRD_IN_DATA_TYPE_LIMIT + }; + +-#define SPRDFB_IN_DATA_TYPE SPRD_IN_DATA_TYPE_ABGR888 ++#define SPRDFB_IN_DATA_TYPE SPRD_IN_DATA_TYPE_BGR565 + + #ifdef CONFIG_FB_TRIPLE_FRAMEBUFFER + #define FRAMEBUFFER_NR (3)