Skip to content

Commit e94b3e7

Browse files
author
msieben
committed
[wpebackend-rdk] : Add conditional VC4 quirks patch.
1 parent 90868ad commit e94b3e7

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
--- a/src/wpeframework/renderer-backend.cpp
2+
+++ b/src/wpeframework/renderer-backend.cpp
3+
@@ -34,6 +34,17 @@
4+
#include <string>
5+
#include <string.h>
6+
7+
+#ifdef __cplusplus
8+
+extern "C" {
9+
+#endif
10+
+#ifndef _GNU_SOURCE
11+
+#define _GNU_SOURCE
12+
+#endif
13+
+#include <dlfcn.h>
14+
+#ifdef __cplusplus
15+
+}
16+
+#endif
17+
+
18+
namespace WPEFramework {
19+
20+
struct EGLTarget : public IPC::Client::Handler {
21+
@@ -179,10 +190,100 @@
22+
// frame_will_render
23+
[](void* data)
24+
{
25+
+ constexpr char const * const _lib = "libcompositorclient.so";
26+
+
27+
+ {
28+
+ constexpr char const * const _func = "WillRenderEGLTargetFor";
29+
+
30+
+ void * _sym = dlsym (RTLD_NEXT, _func);
31+
+
32+
+ if (_sym != nullptr && data != nullptr) {
33+
+ Dl_info _info;
34+
+
35+
+ /* char * */dlerror ();
36+
+
37+
+ if (dladdr (_sym, &_info) == 0) {
38+
+ // Error
39+
+ fprintf (stderr, "Unable to verify %s exist in %s.\n", _func, _lib);
40+
+ }
41+
+ else {
42+
+ std::string _str (_info.dli_fname);
43+
+
44+
+ if (_str.rfind(_lib) != std::string::npos) {
45+
+ // Found in library _lib
46+
+
47+
+ reinterpret_cast < bool (*) (EGLNativeWindowType) > (_sym) ( static_cast < WPEFramework::EGLTarget* > (data) -> Native() );
48+
+ }
49+
+ else {
50+
+ // Different library
51+
+ fprintf (stderr, "%s not found in %s.\n", _func, _lib);
52+
+ }
53+
+ }
54+
+ }
55+
+ }
56+
+
57+
+ {
58+
+ constexpr char const * const _func = "SetEGLTarget";
59+
+
60+
+ void * _sym = dlsym (RTLD_NEXT, _func);
61+
+
62+
+ if (_sym != nullptr && data != nullptr) {
63+
+ Dl_info _info;
64+
+
65+
+ /* char * */dlerror ();
66+
+
67+
+ if (dladdr (_sym, &_info) == 0) {
68+
+ // Error
69+
+ fprintf (stderr, "Unable to verify %s exist in %s.\n", _func, _lib);
70+
+ }
71+
+ else {
72+
+ std::string _str (_info.dli_fname);
73+
+
74+
+ if (_str.rfind(_lib) != std::string::npos) {
75+
+ // Found in library _lib
76+
+
77+
+ reinterpret_cast < bool (*) () > (_sym) ();
78+
+ }
79+
+ else {
80+
+ // Different library
81+
+ fprintf (stderr, "%s not found in %s.\n", _func, _lib);
82+
+ }
83+
+ }
84+
+ }
85+
+ }
86+
},
87+
// frame_rendered
88+
[](void* data)
89+
{
90+
+ constexpr char const * const _lib = "libcompositorclient.so";
91+
+ constexpr char const * const _func = "RenderedEGLTarget";
92+
+
93+
+ void * _sym = dlsym (RTLD_NEXT, _func);
94+
+
95+
+ if (_sym != nullptr && data != nullptr) {
96+
+ Dl_info _info;
97+
+
98+
+ /* char * */dlerror ();
99+
+
100+
+ if (dladdr (_sym, &_info) == 0) {
101+
+ // Error
102+
+ fprintf (stderr, "Unable to verify %s exist in %s.\n", _func, _lib);
103+
+ }
104+
+ else {
105+
+ std::string _str (_info.dli_fname);
106+
+
107+
+ if (_str.rfind(_lib) != std::string::npos) {
108+
+ // Found in library _lib
109+
+
110+
+ reinterpret_cast < bool (*) () > (_sym) ();
111+
+ }
112+
+ else {
113+
+ // Different library
114+
+ fprintf (stderr, "%s not found in %s.\n", _func, _lib);
115+
+ }
116+
+ }
117+
+ }
118+
+
119+
WPEFramework::EGLTarget& target (*static_cast<WPEFramework::EGLTarget*>(data));
120+
121+
/* bool */ target.display.vSyncCallback ();

package/wpe/wpebackend-rdk/Config.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ config BR2_PACKAGE_WPEBACKEND_RDK
33
select BR2_PACKAGE_WAYLAND_EGL_BNXS if BR2_PACKAGE_HAS_NEXUS && BR2_PACKAGE_WESTEROS
44
help
55
RDK-specific implementations of the WPEBackend interfaces.
6+
7+
config BR2_PACKAGE_WPEBACKEND_RDK_VC4_QUIRKS
8+
bool "VC4 quirks"
9+
depends on BR2_PACKAGE_WPEBACKEND_RDK && BR2_PACKAGE_LIBDRM_VC4 && BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4
10+
default n
11+
12+
comment "WPEBackend VC4 quirks requires vc4, Gallium VC4 driver and wpebackend-rdk"
13+
depends on !BR2_PACKAGE_WPEBACKEND_RDK || !BR2_PACKAGE_LIBDRM_VC4 || !BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4

package/wpe/wpebackend-rdk/wpebackend-rdk.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ WPEBACKEND_RDK_FLAGS +=-DUSE_BACKEND_WESTEROS=ON -DUSE_HOLE_PUNCH_GSTREAMER=OFF
5353
else ifeq ($(BR2_PACKAGE_WPEFRAMEWORK_COMPOSITORCLIENT),y)
5454
WPEBACKEND_RDK_DEPENDENCIES += libegl wpeframework-plugins
5555
WPEBACKEND_RDK_FLAGS +=-DUSE_BACKEND_WPEFRAMEWORK=ON -DUSE_HOLE_PUNCH_GSTREAMER=OFF -DUSE_INPUT_LIBINPUT=OFF
56+
ifeq ($(BR2_PACKAGE_WPEBACKEND_RDK_VC4_QUIRKS)x,yx)
57+
WPEBACKEND_RDK_POST_PATCH_HOOKS += WPEBACKEND_RDK_VC4_QUIRKS_PATCHES
58+
endif
5659
else
5760
WPEBACKEND_RDK_DEPENDENCIES += libegl
5861
WPEBACKEND_RDK_FLAGS += -DUSE_BACKEND_BCM_RPI=ON
@@ -102,6 +105,13 @@ endif
102105

103106
endif
104107

108+
ifeq ($(BR2_PACKAGE_WPEBACKEND_RDK_VC4_QUIRKS)x,yx)
109+
WPEBACKEND_RDK_POST_PATCH_HOOKS += WPEBACKEND_RDK_VC4_QUIRKS_PATCHES
110+
define WPEBACKEND_RDK_VC4_QUIRKS_PATCHES
111+
patch -d $(@D)/ -p1 < package/wpe/wpebackend-rdk//0001-trigger-pre-post-hooks.patch.vc4
112+
endef
113+
endif
114+
105115
WPEBACKEND_RDK_CONF_OPTS = \
106116
$(WPEBACKEND_RDK_FLAGS)
107117

0 commit comments

Comments
 (0)