diff options
3 files changed, 168 insertions, 7 deletions
diff --git a/meta-oe/recipes-benchmark/glmark2/files/0001-fix-dispmanx-build.patch b/meta-oe/recipes-benchmark/glmark2/files/0001-fix-dispmanx-build.patch new file mode 100644 index 0000000000..e9b880c260 --- /dev/null +++ b/meta-oe/recipes-benchmark/glmark2/files/0001-fix-dispmanx-build.patch | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | From 56e4959f0bc3e442c813d78e8ab6b3bf64b4ac66 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: OpenEmbedded <oe.patch@oe> | ||
| 3 | Date: Wed, 2 Dec 2020 20:27:42 +0000 | ||
| 4 | Subject: [PATCH] fix dispmanx build | ||
| 5 | |||
| 6 | For when the user is building "--with-flavors dispmanx-glesv2", fixes a bunch | ||
| 7 | of "redeclared as different kind of symbol" problems. | ||
| 8 | |||
| 9 | This patch is almost entirely from: | ||
| 10 | https://github.com/glmark2/glmark2/commit/3b1a0f78d03ae126b78ee52a7c434809115e5993 | ||
| 11 | |||
| 12 | Which was created by: Alexandros Frantzis <alexandros.frantzis@collabora.com> | ||
| 13 | |||
| 14 | See: | ||
| 15 | https://github.com/glmark2/glmark2/issues/80 | ||
| 16 | |||
| 17 | My contribution is to tweak the wscript to link all the required libraries. | ||
| 18 | |||
| 19 | Upstream-status: submitted [https://github.com/glmark2/glmark2/pull/135] | ||
| 20 | Signed-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 | |||
| 27 | diff --git a/src/native-state-dispmanx.cpp b/src/native-state-dispmanx.cpp | ||
| 28 | index 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 | ||
| 80 | diff --git a/src/native-state-dispmanx.h b/src/native-state-dispmanx.h | ||
| 81 | index 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_ */ | ||
| 110 | diff --git a/wscript b/wscript | ||
| 111 | index 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 | -- | ||
| 124 | 2.28.0.497.g54e85e7af1 | ||
| 125 | |||
diff --git a/meta-oe/recipes-benchmark/glmark2/files/0002-run-dispmanx-fullscreen.patch b/meta-oe/recipes-benchmark/glmark2/files/0002-run-dispmanx-fullscreen.patch new file mode 100644 index 0000000000..27bd62edb9 --- /dev/null +++ b/meta-oe/recipes-benchmark/glmark2/files/0002-run-dispmanx-fullscreen.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 110ef8357ebaf24bc3995e631ec809a2f84c3b87 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Trevor Woerner <twoerner@gmail.com> | ||
| 3 | Date: Thu, 3 Dec 2020 07:16:58 -0500 | ||
| 4 | Subject: [PATCH] run dispmanx fullscreen | ||
| 5 | |||
| 6 | The dispmanx flavour can only run fullscreen, therefore set the size to | ||
| 7 | fullscreen when glmark2-es2-dispmanx is run. | ||
| 8 | |||
| 9 | Upstream-status: submitted [https://github.com/glmark2/glmark2/pull/135] | ||
| 10 | Signed-off-by: Trevor Woerner <twoerner@gmail.com> | ||
| 11 | --- | ||
| 12 | src/main.cpp | 5 +++++ | ||
| 13 | 1 file changed, 5 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/src/main.cpp b/src/main.cpp | ||
| 16 | index 677962e..273a217 100644 | ||
| 17 | --- a/src/main.cpp | ||
| 18 | +++ b/src/main.cpp | ||
| 19 | @@ -164,6 +164,11 @@ main(int argc, char *argv[]) | ||
| 20 | Options::size = std::pair<int,int>(800, 600); | ||
| 21 | } | ||
| 22 | |||
| 23 | +#if GLMARK2_USE_DISPMANX | ||
| 24 | + /* dispmanx can only run fullscreen */ | ||
| 25 | + Options::size = std::pair<int,int>(-1, -1); | ||
| 26 | +#endif | ||
| 27 | + | ||
| 28 | // Create the canvas | ||
| 29 | #if GLMARK2_USE_X11 | ||
| 30 | NativeStateX11 native_state; | ||
diff --git a/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb b/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb index 2092305726..46634634d2 100644 --- a/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb +++ b/meta-oe/recipes-benchmark/glmark2/glmark2_git.bb | |||
| @@ -13,20 +13,23 @@ DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland-n | |||
| 13 | 13 | ||
| 14 | PV = "2020.11+${SRCPV}" | 14 | PV = "2020.11+${SRCPV}" |
| 15 | 15 | ||
| 16 | COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '.*-linux*', 'null', d)}" | 16 | SRC_URI = " \ |
| 17 | 17 | git://github.com/glmark2/glmark2.git;protocol=https \ | |
| 18 | SRC_URI = "git://github.com/glmark2/glmark2.git;protocol=https" | 18 | file://0001-fix-dispmanx-build.patch \ |
| 19 | file://0002-run-dispmanx-fullscreen.patch \ | ||
| 20 | " | ||
| 19 | SRCREV = "784aca755a469b144acf3cae180b6e613b7b057a" | 21 | SRCREV = "784aca755a469b144acf3cae180b6e613b7b057a" |
| 20 | 22 | ||
| 21 | S = "${WORKDIR}/git" | 23 | S = "${WORKDIR}/git" |
| 22 | 24 | ||
| 23 | inherit waf pkgconfig features_check | 25 | inherit waf pkgconfig features_check |
| 24 | 26 | ||
| 25 | REQUIRED_DISTRO_FEATURES += "opengl" | 27 | ANY_OF_DISTRO_FEATURES = "opengl dispmanx" |
| 26 | 28 | ||
| 27 | PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11-gles2', '', d)} \ | 29 | PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11-gles2 drm-gles2', '', d)} \ |
| 28 | ${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'wayland-gles2', '', d)} \ | 30 | ${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'wayland-gles2 drm-gles2', '', d)} \ |
| 29 | drm-gles2" | 31 | ${@bb.utils.contains('DISTRO_FEATURES', 'dispmanx', 'dispmanx', '', d)} \ |
| 32 | " | ||
| 30 | 33 | ||
| 31 | PACKAGECONFIG[x11-gl] = ",,virtual/libgl virtual/libx11" | 34 | PACKAGECONFIG[x11-gl] = ",,virtual/libgl virtual/libx11" |
| 32 | PACKAGECONFIG[x11-gles2] = ",,virtual/libgles2 virtual/libx11" | 35 | PACKAGECONFIG[x11-gles2] = ",,virtual/libgles2 virtual/libx11" |
| @@ -34,6 +37,7 @@ PACKAGECONFIG[drm-gl] = ",,virtual/libgl libdrm virtual/libgbm" | |||
| 34 | PACKAGECONFIG[drm-gles2] = ",,virtual/libgles2 libdrm virtual/libgbm" | 37 | PACKAGECONFIG[drm-gles2] = ",,virtual/libgles2 libdrm virtual/libgbm" |
| 35 | PACKAGECONFIG[wayland-gl] = ",,virtual/libgl wayland" | 38 | PACKAGECONFIG[wayland-gl] = ",,virtual/libgl wayland" |
| 36 | PACKAGECONFIG[wayland-gles2] = ",,virtual/libgles2 wayland" | 39 | PACKAGECONFIG[wayland-gles2] = ",,virtual/libgles2 wayland" |
| 40 | PACKAGECONFIG[dispmanx] = ",,virtual/libgles2 virtual/libx11" | ||
| 37 | 41 | ||
| 38 | python __anonymous() { | 42 | python __anonymous() { |
| 39 | packageconfig = (d.getVar("PACKAGECONFIG") or "").split() | 43 | packageconfig = (d.getVar("PACKAGECONFIG") or "").split() |
| @@ -50,6 +54,8 @@ python __anonymous() { | |||
| 50 | flavors.append("drm-glesv2") | 54 | flavors.append("drm-glesv2") |
| 51 | if "drm-gl" in packageconfig: | 55 | if "drm-gl" in packageconfig: |
| 52 | flavors.append("drm-gl") | 56 | flavors.append("drm-gl") |
| 57 | if "dispmanx" in packageconfig: | ||
| 58 | flavors = ["dispmanx-glesv2"] | ||
| 53 | if flavors: | 59 | if flavors: |
| 54 | d.appendVar("EXTRA_OECONF", " --with-flavors=%s" % ",".join(flavors)) | 60 | d.appendVar("EXTRA_OECONF", " --with-flavors=%s" % ",".join(flavors)) |
| 55 | } | 61 | } |
