From 9c04dc4a1be8e73040327e8a386656836cacb4a0 Mon Sep 17 00:00:00 2001
From: Federico Amedeo Izzo <federico.izzo42@gmail.com>
Date: Fri, 15 Mar 2019 11:42:38 +0100
Subject: [PATCH] kde/kwin: add patch to handle fbdev properly (!279)

This patch applies commit 93b7eea67db418751e7fe4a86bc19430c153588b
from upstream kwin. Remove this patch once kwin stable used by
postmarketOS will include the upstream commit.

[ci:skip-build]: already built successfully
---
 ...r-fix-until-commit-93b7eea-is-merged.patch | 27 +++++++++++++++++++
 kde/kwin/APKBUILD                             |  8 +++---
 2 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 kde/kwin/0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch

diff --git a/kde/kwin/0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch b/kde/kwin/0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch
new file mode 100644
index 000000000..df9fabc4a
--- /dev/null
+++ b/kde/kwin/0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch
@@ -0,0 +1,27 @@
+diff --git a/plugins/platforms/fbdev/fb_backend.cpp b/plugins/platforms/fbdev/fb_backend.cpp
+--- a/plugins/platforms/fbdev/fb_backend.cpp
++++ b/plugins/platforms/fbdev/fb_backend.cpp
+@@ -126,20 +126,8 @@
+         return false;
+     }
+ 
+-    // correct the color info, and try to turn on screens, assuming this is a non-primary framebuffer device
+-    varinfo.grayscale = 0;
+-    varinfo.transp.offset = 24;
+-    varinfo.transp.length = 8;
+-    varinfo.transp.msb_right = 0;
+-    varinfo.red.offset = 16;
+-    varinfo.red.length = 8;
+-    varinfo.red.msb_right = 0;
+-    varinfo.green.offset = 8;
+-    varinfo.green.length = 8;
+-    varinfo.green.msb_right = 0;
+-    varinfo.blue.offset = 0;
+-    varinfo.blue.length = 8;
+-    varinfo.blue.msb_right = 0;
++    // Activate the framebuffer device, assuming this is a non-primary framebuffer device
++    varinfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
+     ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo);
+ 
+     // Probe the device for new screen information.
+
diff --git a/kde/kwin/APKBUILD b/kde/kwin/APKBUILD
index 9a4e3f1a1..a45d4a159 100644
--- a/kde/kwin/APKBUILD
+++ b/kde/kwin/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Bart Ribbers <bribbers@disroot.org>
 pkgname=kwin
 pkgver=5.15.2
-pkgrel=0
+pkgrel=1
 pkgdesc="An easy to use, but flexible, composited Window Manager"
 arch="all"
 url="https://www.kde.org/workspaces/plasmadesktop/"
@@ -14,7 +14,8 @@ makedepends="$depends_dev extra-cmake-modules qt5-qttools-dev kdoctools-dev libx
 source="https://download.kde.org/stable/plasma/$pkgver/$pkgname-$pkgver.tar.xz
 	0001-Revert-udev-Only-handle-devices-from-the-current-sea.patch
 	0002-Revert-libinput-connection-Don-t-hardcode-seat0-anym.patch
-	0001-Disable-finding-of-qml-modules.patch"
+	0001-Disable-finding-of-qml-modules.patch
+	0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
 options="!check" # Fails due to requiring running X11
 
@@ -39,4 +40,5 @@ package() {
 sha512sums="85d4efb79e8ad5edbeba1411d8696415b74ab23e9f814c029d9bb8b913eb697da24fbd1e2c63ad25a0662e749650a6402ef074f4218c2409e9702016f49ea900  kwin-5.15.2.tar.xz
 a34ff6926f020117fafd8a31c18a183eecb3e0a5fe6c3f2784f531171552350615fb06cbac2f3a1248011eb83ec32fc9df4b64f82443dee1d8e90c1be49e2690  0001-Revert-udev-Only-handle-devices-from-the-current-sea.patch
 a534a3d388f066f84813148743eda1da1be000907ddf2c762c098a7ce38fcc1992eaa74763c47d98e82b83e38a03a828f4f3368e7e7ab733714f993646af7c8b  0002-Revert-libinput-connection-Don-t-hardcode-seat0-anym.patch
-d9e5900b4349d2869be51e89ebcf8e9ea73a830196f40f682ea9d6f56719ae9f54025d7f33c68e71c56e128aa7c6014388d18a6572c1a8c33341c405285156b2  0001-Disable-finding-of-qml-modules.patch"
+d9e5900b4349d2869be51e89ebcf8e9ea73a830196f40f682ea9d6f56719ae9f54025d7f33c68e71c56e128aa7c6014388d18a6572c1a8c33341c405285156b2  0001-Disable-finding-of-qml-modules.patch
+240a23fe4499d4a81f78960696ff99199c1f0e87b5d486422ccf4e90c8fdcf49c42af1abf92355bb728ffc61269b901e7abd6a7e5ff9ad88e432d0aa75ac00e7  0003-Apply-kwin-framebuffer-fix-until-commit-93b7eea-is-merged.patch"