blob: e9b880c26070d480e46f3c516a18315c355ac5fd [file] [log] [blame]
Andrew Geissler8fc454f2020-12-11 16:27:59 -06001From 56e4959f0bc3e442c813d78e8ab6b3bf64b4ac66 Mon Sep 17 00:00:00 2001
2From: OpenEmbedded <oe.patch@oe>
3Date: Wed, 2 Dec 2020 20:27:42 +0000
4Subject: [PATCH] fix dispmanx build
5
6For when the user is building "--with-flavors dispmanx-glesv2", fixes a bunch
7of "redeclared as different kind of symbol" problems.
8
9This patch is almost entirely from:
10 https://github.com/glmark2/glmark2/commit/3b1a0f78d03ae126b78ee52a7c434809115e5993
11
12Which was created by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
13
14See:
15 https://github.com/glmark2/glmark2/issues/80
16
17My contribution is to tweak the wscript to link all the required libraries.
18
19Upstream-status: submitted [https://github.com/glmark2/glmark2/pull/135]
20Signed-off-by: Trevor Woerner <twoerner@gmail.com>
21---
22 src/native-state-dispmanx.cpp | 22 +++++++++++++++++-----
23 src/native-state-dispmanx.h | 7 +++----
24 wscript | 2 +-
25 3 files changed, 21 insertions(+), 10 deletions(-)
26
27diff --git a/src/native-state-dispmanx.cpp b/src/native-state-dispmanx.cpp
28index 2117386..49f74e7 100644
29--- a/src/native-state-dispmanx.cpp
30+++ b/src/native-state-dispmanx.cpp
31@@ -23,13 +23,25 @@
32 #include "native-state-dispmanx.h"
33 #include "log.h"
34
35+#include "EGL/egl.h"
36+
37 #include <cstring>
38 #include <csignal>
39
40+struct NativeStateDispmanx::Private
41+{
42+ Private()
43+ {
44+ memset(&egl_dispmanx_window, 0, sizeof(egl_dispmanx_window));
45+ }
46+
47+ EGL_DISPMANX_WINDOW_T egl_dispmanx_window;
48+};
49+
50 NativeStateDispmanx::NativeStateDispmanx()
51+ : priv{std::make_unique<Private>()}
52 {
53 memset(&properties_, 0, sizeof(properties_));
54- memset(&egl_dispmanx_window, 0, sizeof(egl_dispmanx_window));
55 }
56
57 NativeStateDispmanx::~NativeStateDispmanx()
58@@ -99,9 +111,9 @@ NativeStateDispmanx::create_window(WindowProperties const& properties)
59 0 /*clamp*/,
60 DISPMANX_NO_ROTATE);
61
62- egl_dispmanx_window.element = dispmanx_element;
63- egl_dispmanx_window.width = dst_rect.width;
64- egl_dispmanx_window.height = dst_rect.height;
65+ priv->egl_dispmanx_window.element = dispmanx_element;
66+ priv->egl_dispmanx_window.width = dst_rect.width;
67+ priv->egl_dispmanx_window.height = dst_rect.height;
68 vc_dispmanx_update_submit_sync(dispmanx_update);
69
70 return true;
71@@ -111,7 +123,7 @@ void*
72 NativeStateDispmanx::window(WindowProperties &properties)
73 {
74 properties = properties_;
75- return &egl_dispmanx_window;
76+ return &priv->egl_dispmanx_window;
77 }
78
79 void
80diff --git a/src/native-state-dispmanx.h b/src/native-state-dispmanx.h
81index a6ed3d4..794b2d3 100644
82--- a/src/native-state-dispmanx.h
83+++ b/src/native-state-dispmanx.h
84@@ -24,10 +24,8 @@
85 #define GLMARK2_NATIVE_STATE_DISPMANX_H_
86
87 #include <vector>
88+#include <memory>
89 #include "bcm_host.h"
90-#include "GLES/gl.h"
91-#include "EGL/egl.h"
92-#include "EGL/eglext.h"
93
94 #include "native-state.h"
95
96@@ -46,11 +44,12 @@ public:
97 void flip();
98
99 private:
100+ struct Private;
101 DISPMANX_DISPLAY_HANDLE_T dispmanx_display;
102 DISPMANX_UPDATE_HANDLE_T dispmanx_update;
103 DISPMANX_ELEMENT_HANDLE_T dispmanx_element;
104- EGL_DISPMANX_WINDOW_T egl_dispmanx_window;
105 WindowProperties properties_;
106+ std::unique_ptr<Private> priv;
107 };
108
109 #endif /* GLMARK2_NATIVE_STATE_DISPMANX_H_ */
110diff --git a/wscript b/wscript
111index e09fa78..6c3869c 100644
112--- a/wscript
113+++ b/wscript
114@@ -205,7 +205,7 @@ def configure_linux(ctx):
115
116 ctx.check_cxx(lib = 'brcmGLESv2', uselib_store = 'glesv2', libpath='/opt/vc/lib')
117 ctx.check_cxx(lib = ['brcmEGL', 'brcmGLESv2'], uselib_store = 'egl', libpath='/opt/vc/lib')
118- ctx.check_cxx(lib = ['bcm_host', 'vcos', 'vchiq_arm'], uselib_store = 'dispmanx', libpath='/opt/vc/lib')
119+ ctx.check_cxx(lib = ['brcmEGL', 'brcmGLESv2', 'vchostif', 'bcm_host', 'vcos', 'vchiq_arm'], uselib_store = 'dispmanx', libpath='/opt/vc/lib')
120
121 # Check optional packages
122 opt_pkgs = [('x11', 'x11', None, list_contains(ctx.options.flavors, 'x11')),
123--
1242.28.0.497.g54e85e7af1
125