-From aafa4d1550699ce154d517a8d7f55cc376d3383b Mon Sep 17 00:00:00 2001
+From df007a9d0dcfa9ec3621c2814fc84d7797e8fc07 Mon Sep 17 00:00:00 2001
 From: Joshua Henderson <joshua.henderson@microchip.com>
-Date: Thu, 21 Sep 2017 12:39:44 -0700
-Subject: [PATCH 1/1] Provide access to linuxfb dri fd through platform
+Date: Fri, 17 May 2019 11:34:25 +0300
+Subject: [PATCH] Provide access to linuxfb dri fd through platform
 
+Signed-off-by: Joshua Henderson <joshua.henderson@microchip.com>
+[eugen.hristev@microchip.com]: Ported on 5.12.2
+Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
 ---
- src/platformsupport/fbconvenience/qfbscreen_p.h       |  2 ++
- src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp   |  5 +++++
- src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h     |  1 +
- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 19 ++++++++++++++++++-
- src/plugins/platforms/linuxfb/qlinuxfbscreen.h        |  3 ++-
- 5 files changed, 28 insertions(+), 2 deletions(-)
+ .../fbconvenience/qfbscreen_p.h               |  1 +
+ .../platforms/linuxfb/qlinuxfbdrmscreen.cpp   |  4 ++++
+ .../platforms/linuxfb/qlinuxfbdrmscreen.h     |  1 +
+ .../platforms/linuxfb/qlinuxfbintegration.cpp | 21 ++++++++++++++++++-
+ .../platforms/linuxfb/qlinuxfbscreen.h        |  2 ++
+ 5 files changed, 28 insertions(+), 1 deletion(-)
 
+diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h
+index eed615de36..b209034c79 100644
 --- a/src/platformsupport/fbconvenience/qfbscreen_p.h
 +++ b/src/platformsupport/fbconvenience/qfbscreen_p.h
-@@ -76,6 +76,8 @@ public:
+@@ -76,6 +76,7 @@ public:
      QFbScreen();
      ~QFbScreen();
  
 +    virtual int fd() const { return -1; }
-+
      virtual bool initialize();
  
      QRect geometry() const override { return mGeometry; }
+diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
+index dcc1ef2790..7f1cd2820a 100644
 --- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
 +++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
-@@ -465,4 +465,9 @@ QPixmap QLinuxFbDrmScreen::grabWindow(WI
+@@ -465,4 +465,8 @@ QPixmap QLinuxFbDrmScreen::grabWindow(WId wid, int x, int y, int width, int heig
      return QPixmap();
  }
  

+	QFbScreen *m_primaryScreen;
+};
+
 QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const
 {
-    return m_nativeInterface.data();
+	return new FbPlatformInterface(m_primaryScreen);
 }
 
 QT_END_NAMESPACE
--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
@@ -60,6 +60,8 @@ public:
 
     QRegion doRedraw() override;
 
+    int fd() const { return mFbFd; }
+
 private:
     QStringList mArgs;
     int mFbFd;
@@ -80,4 +82,3 @@ private:
 QT_END_NAMESPACE
 
 #endif // QLINUXFBSCREEN_H
-

 
 private:
     QKmsScreenConfig *m_screenConfig;
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 9e38900bcd..1584f18392 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -173,9 +173,28 @@ void QLinuxFbIntegration::createInputHandlers()
 #endif
 }
 
+
+class FbPlatformInterface : public QPlatformNativeInterface
+{
+public:
