<commit_before>From aafa4d1550699ce154d517a8d7f55cc376d3383b Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Thu, 21 Sep 2017 12:39:44 -0700
Subject: [PATCH 1/1] Provide access to linuxfb dri fd through platform

---
 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(-)

--- a/src/platformsupport/fbconvenience/qfbscreen_p.h
+++ b/src/platformsupport/fbconvenience/qfbscreen_p.h
@@ -76,6 +76,8 @@ public:
     QFbScreen();
     ~QFbScreen();
 
+    virtual int fd() const { return -1; }
+
     virtual bool initialize();
 
     QRect geometry() const override { return mGeometry; }
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
@@ -465,4 +465,9 @@ QPixmap QLinuxFbDrmScreen::grabWindow(WI
     return QPixmap();
 }
 
+int QLinuxFbDrmScreen::fd() const
+{
+    return m_device->fd();
+}
+
 QT_END_NAMESPACE
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h
@@ -57,6 +57,7 @@ public:
     bool initialize() override;
     QRegion doRedraw() override;
     QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;
+    int fd() const;
 
 private:
     QKmsScreenConfig *m_screenConfig;
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -172,9 +172,26 @@ void QLinuxFbIntegration::createInputHan
 #endif
 }
 
+class FbPlatformInterface : public QPlatformNativeInterface
+{
+public:
+	FbPlatformInterface(QFbScreen *primaryScreen)
+		: m_primaryScreen(primaryScreen)
+	{}
+
+	void *nativeResourceForIntegration(const QByteArray &resource)
+	{
+		if (resource == QByteArrayLiteral("dri_fd"))
+			return (void *) (qintptr)m_primaryScreen->fd();
+		return nullptr;
+	}
+
+	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
-<commit_msg>qtbase: Fix compilation issue for QT5.12.2<commit_after>From df007a9d0dcfa9ec3621c2814fc84d7797e8fc07 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Fri, 17 May 2019 11:34:25 +0300
Subject: [PATCH] Provide access to linuxfb dri fd through platform

Signed-off-by: <NAME> <<EMAIL>>
[<EMAIL>]: Ported on 5.12.2
Signed-off-by: <NAME> <<EMAIL>>
---
 .../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,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,8 @@ QPixmap QLinuxFbDrmScreen::grabWindow(WId wid, int x, int y, int width, int heig
     return QPixmap();
 }
 
+int QLinuxFbDrmScreen::fd() const
+{
+    return m_device->fd();
+}
 QT_END_NAMESPACE
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h
index 50a9576798..dc26c8f941 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.h
@@ -57,6 +57,7 @@ public:
     bool initialize() override;
     QRegion doRedraw() override;
     QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;
+    int fd() const;
 
 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:
+	FbPlatformInterface(QFbScreen *primaryScreen)
+		: m_primaryScreen(primaryScreen)
+	{}
+
+	void *nativeResourceForIntegration(const QByteArray &resource)
+	{
+		if (resource == QByteArrayLiteral("dri_fd"))
+			return (void *) (qintptr)m_primaryScreen->fd();
+		return nullptr;
+	}
+
+	QFbScreen *m_primaryScreen;
+};
+
+
 QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const
 {
-    return const_cast<QLinuxFbIntegration *>(this);
+	return new FbPlatformInterface(m_primaryScreen);
 }
 
 QFunctionPointer QLinuxFbIntegration::platformFunction(const QByteArray &function) const
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.h b/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
index c7ce455e6a..afa53d52d4 100644
--- 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;
-- 
2.21.0

{'fraction_non_alphanumeric': 0.14253968253968255, 'fraction_numerical': 0.049206349206349205, 'mean_word_length': 4.380871050384287, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5401703', 'n_tokens_mistral': 2584, 'n_tokens_neox': 2364, 'n_words': 404}