aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-benchmark/glmark2/files/0001-fix-dispmanx-build.patch
blob: e9b880c26070d480e46f3c516a18315c355ac5fd (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From 56e4959f0bc3e442c813d78e8ab6b3bf64b4ac66 Mon Sep 17 00:00:00 2001
From: OpenEmbedded <oe.patch@oe>
Date: Wed, 2 Dec 2020 20:27:42 +0000
Subject: [PATCH] fix dispmanx build

For when the user is building "--with-flavors dispmanx-glesv2", fixes a bunch
of "redeclared as different kind of symbol" problems.

This patch is almost entirely from:
	https://github.com/glmark2/glmark2/commit/3b1a0f78d03ae126b78ee52a7c434809115e5993

Which was created by: Alexandros Frantzis <alexandros.frantzis@collabora.com>

See:
	https://github.com/glmark2/glmark2/issues/80

My contribution is to tweak the wscript to link all the required libraries.

Upstream-status: submitted [https://github.com/glmark2/glmark2/pull/135]
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 src/native-state-dispmanx.cpp | 22 +++++++++++++++++-----
 src/native-state-dispmanx.h   |  7 +++----
 wscript                       |  2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/native-state-dispmanx.cpp b/src/native-state-dispmanx.cpp
index 2117386..49f74e7 100644
--- a/src/native-state-dispmanx.cpp
+++ b/src/native-state-dispmanx.cpp
@@ -23,13 +23,25 @@
 #include "native-state-dispmanx.h"
 #include "log.h"
 
+#include "EGL/egl.h"
+
 #include <cstring>
 #include <csignal>
 
+struct NativeStateDispmanx::Private
+{
+    Private()
+    {
+	memset(&egl_dispmanx_window, 0, sizeof(egl_dispmanx_window));
+    }
+
+    EGL_DISPMANX_WINDOW_T egl_dispmanx_window;
+};
+
 NativeStateDispmanx::NativeStateDispmanx()
+    : priv{std::make_unique<Private>()}
 {
     memset(&properties_, 0, sizeof(properties_));
-    memset(&egl_dispmanx_window, 0, sizeof(egl_dispmanx_window));
 }
 
 NativeStateDispmanx::~NativeStateDispmanx()
@@ -99,9 +111,9 @@ NativeStateDispmanx::create_window(WindowProperties const& properties)
 					       0 /*clamp*/,
 					       DISPMANX_NO_ROTATE);
 
-    egl_dispmanx_window.element = dispmanx_element;
-    egl_dispmanx_window.width = dst_rect.width;
-    egl_dispmanx_window.height = dst_rect.height;
+    priv->egl_dispmanx_window.element = dispmanx_element;
+    priv->egl_dispmanx_window.width = dst_rect.width;
+    priv->egl_dispmanx_window.height = dst_rect.height;
     vc_dispmanx_update_submit_sync(dispmanx_update);
 
     return true;
@@ -111,7 +123,7 @@ void*
 NativeStateDispmanx::window(WindowProperties &properties)
 {
     properties = properties_;
-    return &egl_dispmanx_window;
+    return &priv->egl_dispmanx_window;
 }
 
 void
diff --git a/src/native-state-dispmanx.h b/src/native-state-dispmanx.h
index a6ed3d4..794b2d3 100644
--- a/src/native-state-dispmanx.h
+++ b/src/native-state-dispmanx.h
@@ -24,10 +24,8 @@
 #define GLMARK2_NATIVE_STATE_DISPMANX_H_
 
 #include <vector>
+#include <memory>
 #include "bcm_host.h"
-#include "GLES/gl.h"
-#include "EGL/egl.h"
-#include "EGL/eglext.h"
 
 #include "native-state.h"
 
@@ -46,11 +44,12 @@ public:
     void flip();
 
 private:
+    struct Private;
     DISPMANX_DISPLAY_HANDLE_T dispmanx_display;
     DISPMANX_UPDATE_HANDLE_T dispmanx_update;
     DISPMANX_ELEMENT_HANDLE_T dispmanx_element;
-    EGL_DISPMANX_WINDOW_T egl_dispmanx_window;
     WindowProperties properties_;
+    std::unique_ptr<Private> priv;
 };
 
 #endif /* GLMARK2_NATIVE_STATE_DISPMANX_H_ */
diff --git a/wscript b/wscript
index e09fa78..6c3869c 100644
--- a/wscript
+++ b/wscript
@@ -205,7 +205,7 @@ def configure_linux(ctx):
 
         ctx.check_cxx(lib = 'brcmGLESv2', uselib_store = 'glesv2', libpath='/opt/vc/lib')
         ctx.check_cxx(lib = ['brcmEGL', 'brcmGLESv2'], uselib_store = 'egl', libpath='/opt/vc/lib')
-        ctx.check_cxx(lib = ['bcm_host', 'vcos', 'vchiq_arm'], uselib_store = 'dispmanx', libpath='/opt/vc/lib')
+        ctx.check_cxx(lib = ['brcmEGL', 'brcmGLESv2', 'vchostif', 'bcm_host', 'vcos', 'vchiq_arm'], uselib_store = 'dispmanx', libpath='/opt/vc/lib')
 
     # Check optional packages
     opt_pkgs = [('x11', 'x11', None, list_contains(ctx.options.flavors, 'x11')),
-- 
2.28.0.497.g54e85e7af1