From 38dbafb98e2c751c112392ffa1dd05a4524b3b74 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sat, 23 Mar 2019 13:41:36 +0100 Subject: [PATCH] oneplus-one: fix swapped red and blue (!287) The problem behind swapped red and blue is inverted byte order in framebuffer driver pixel format. This patch sets the correct byte order in the framebuffer driver. The previous workaround patch is removed because it fixes improperly the red-screen issue, causing the swapped red and blue problem that this commit solves [ci:skip-build]: already built successfully in CI --- .../0001-fix-video-argb-setting.patch | 91 +++++++++++++++++++ .../06_fix_mdss_fb_rgb_mode.patch | 13 --- device/linux-oneplus-bacon/APKBUILD | 6 +- 3 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 device/linux-oneplus-bacon/0001-fix-video-argb-setting.patch delete mode 100644 device/linux-oneplus-bacon/06_fix_mdss_fb_rgb_mode.patch diff --git a/device/linux-oneplus-bacon/0001-fix-video-argb-setting.patch b/device/linux-oneplus-bacon/0001-fix-video-argb-setting.patch new file mode 100644 index 000000000..68983c505 --- /dev/null +++ b/device/linux-oneplus-bacon/0001-fix-video-argb-setting.patch @@ -0,0 +1,91 @@ +From a23d549c51e38ad9fc481859326a786bc00baad8 Mon Sep 17 00:00:00 2001 +From: Federico Amedeo Izzo +Date: Fri, 22 Mar 2019 19:37:07 +0100 +Subject: [PATCH] fix video argb setting + +--- + drivers/video/msm/mdss/mdss_fb.c | 34 ++++++++++++++++---------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c +index 835f6fc9687..a598cbd72dc 100644 +--- a/drivers/video/msm/mdss/mdss_fb.c ++++ b/drivers/video/msm/mdss/mdss_fb.c +@@ -1767,16 +1767,16 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd) + fix->xpanstep = 1; + fix->ypanstep = 1; + var->vmode = FB_VMODE_NONINTERLACED; +- var->blue.offset = 0; +- var->green.offset = 8; +- var->red.offset = 16; ++ var->blue.offset = 24; ++ var->green.offset = 16; ++ var->red.offset = 8; + var->blue.length = 8; + var->green.length = 8; + var->red.length = 8; + var->blue.msb_right = 0; + var->green.msb_right = 0; + var->red.msb_right = 0; +- var->transp.offset = 24; ++ var->transp.offset = 0; + var->transp.length = 8; + bpp = 4; + break; +@@ -1786,16 +1786,16 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd) + fix->xpanstep = 1; + fix->ypanstep = 1; + var->vmode = FB_VMODE_NONINTERLACED; +- var->blue.offset = 8; +- var->green.offset = 16; +- var->red.offset = 24; ++ var->blue.offset = 16; ++ var->green.offset = 8; ++ var->red.offset = 0; + var->blue.length = 8; + var->green.length = 8; + var->red.length = 8; + var->blue.msb_right = 0; + var->green.msb_right = 0; + var->red.msb_right = 0; +- var->transp.offset = 0; ++ var->transp.offset = 24; + var->transp.length = 8; + bpp = 4; + break; +@@ -2723,15 +2723,15 @@ static int mdss_fb_check_var(struct fb_var_screeninfo *var, + /* Figure out if the user meant RGBA or ARGB + and verify the position of the RGB components */ + +- if (var->transp.offset == 24) { +- if ((var->blue.offset != 0) || +- (var->green.offset != 8) || +- (var->red.offset != 16)) +- return -EINVAL; +- } else if (var->transp.offset == 0) { +- if ((var->blue.offset != 8) || ++ if (var->transp.offset == 0) { ++ if ((var->blue.offset != 24) || + (var->green.offset != 16) || +- (var->red.offset != 24)) ++ (var->red.offset != 8)) ++ return -EINVAL; ++ } else if (var->transp.offset == 24) { ++ if ((var->blue.offset != 16) || ++ (var->green.offset != 8) || ++ (var->red.offset != 0)) + return -EINVAL; + } else + return -EINVAL; +@@ -2821,7 +2821,7 @@ static int mdss_fb_set_par(struct fb_info *info) + break; + + case 32: +- if (var->transp.offset == 24) ++ if (var->transp.offset == 0) + mfd->fb_imgType = MDP_ARGB_8888; + else + mfd->fb_imgType = MDP_RGBA_8888; +-- +2.21.0 + diff --git a/device/linux-oneplus-bacon/06_fix_mdss_fb_rgb_mode.patch b/device/linux-oneplus-bacon/06_fix_mdss_fb_rgb_mode.patch deleted file mode 100644 index 7e65062f4..000000000 --- a/device/linux-oneplus-bacon/06_fix_mdss_fb_rgb_mode.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c -index 835f6fc9687..1e792e0d519 100644 ---- a/drivers/video/msm/mdss/mdss_fb.c -+++ b/drivers/video/msm/mdss/mdss_fb.c -@@ -625,7 +625,7 @@ static int mdss_fb_probe(struct platform_device *pdev) - mfd->bl_scale = 1024; - mfd->bl_min_lvl = 0; - mfd->ad_bl_level = 0; -- mfd->fb_imgType = MDP_RGBA_8888; -+ mfd->fb_imgType = MDP_RGB_888; - - mfd->pdev = pdev; - if (pdata->next) diff --git a/device/linux-oneplus-bacon/APKBUILD b/device/linux-oneplus-bacon/APKBUILD index 59c0dde96..508476f2e 100644 --- a/device/linux-oneplus-bacon/APKBUILD +++ b/device/linux-oneplus-bacon/APKBUILD @@ -22,7 +22,7 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=11 +pkgrel=12 arch="armhf" pkgdesc="LineageOS 14.1 kernel for OnePlus One (bacon)" url="https://github.com/LineageOS/android_kernel_oneplus_msm8974" @@ -35,7 +35,7 @@ source=" ${_config} compiler-gcc6.h 02_gpu-msm-fix-gcc5-compile.patch - 06_fix_mdss_fb_rgb_mode.patch + 0001-fix-video-argb-setting.patch " subpackages="" license="GPL2" @@ -126,4 +126,4 @@ sha512sums="94d0048439e70b11637a7a122e8652d4e997ee413d6e54ea0aed7f2c68e137fcc19b 5af9714a0cb47d5e1f72d4b691de7f52bcc1cb7907bd2f939409c626a7b2950e2dfe1c1b31adaf0b6ae3a7078554a7b52f0e73b600641507a5962168bee3641f config-oneplus-bacon.armhf d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h 7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 02_gpu-msm-fix-gcc5-compile.patch -839062f4d8c4fafdd29039ed1c960bdcd4e649230318cd3476661cba49e3a737c0cbe63afa760b37f970e68b57910bba2a3ec3f64b729b5ad53940bef2b1ee85 06_fix_mdss_fb_rgb_mode.patch" +a48336bbfead6ad0c84d2fce0c40a3f5530aebdff356a6835cceaf59a50a6f860d2f8027703a92927955fbb18857ba78788e010d017bf67730f069b36e96fe87 0001-fix-video-argb-setting.patch"