hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From c35fe6d319635610fb73150aeb9b5e2296daa349 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Thu, 14 Mar 2019 20:28:34 +0800
Subject: [PATCH 16/31] eglfs_kms: Support EGL platform display
 
Conflicts:
    src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
---
 .../eglfs/api/qeglfsdeviceintegration.cpp      | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
 
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index b985386a..a9a9521f 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -192,7 +192,23 @@ EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay() const
 
 EGLDisplay QEglFSDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)
 {
-    return eglGetDisplay(nativeDisplay);
+    EGLDisplay display;
+
+    PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display =
+        reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
+
+    if (get_platform_display) {
+        display = get_platform_display(EGL_PLATFORM_GBM_KHR,
+                                       nativeDisplay, Q_NULLPTR);
+    } else {
+        qWarning("EGL_EXT_platform_device not available, falling back to legacy path!");
+        display = eglGetDisplay(nativeDisplay);
+    }
+
+    if (Q_UNLIKELY(display == EGL_NO_DISPLAY))
+        qFatal("Could not get EGL display");
+
+    return display;
 }
 
 bool QEglFSDeviceIntegration::usesDefaultScreen()
-- 
2.20.1