Skip to content

Commit 6a27461

Browse files
committed
SEM-668: Enable building and packaging Vivante eglfs backend
Pull Vivante EGL/GLES into Qt sysroot and fail if eglfs_viv is missing
1 parent 50ab672 commit 6a27461

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+33081
-0
lines changed

build.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ build_sysroot()
5555

5656
multistrap -f "${TOOLS_DIR}/sysroot_multistrap.cfg" -d "${SYSROOT}"
5757

58+
# Inject Vivante proprietary headers and libraries when available so that
59+
# the Qt configure step can build the eglfs_viv backend.
60+
VIVANTE_DIR="${TOOLS_DIR}/vivante/${UM_ARCH}"
61+
if [ -d "${VIVANTE_DIR}" ]; then
62+
if [ -d "${VIVANTE_DIR}/lib" ]; then
63+
echo "Copying Vivante libraries into sysroot"
64+
mkdir -p "${SYSROOT}/usr/lib"
65+
cp -a "${VIVANTE_DIR}/lib/." "${SYSROOT}/usr/lib/"
66+
mkdir -p "${SYSROOT}/usr/lib/aarch64-linux-gnu"
67+
cp -a "${VIVANTE_DIR}/lib/." "${SYSROOT}/usr/lib/aarch64-linux-gnu/"
68+
fi
69+
if [ -d "${VIVANTE_DIR}/include" ]; then
70+
echo "Copying Vivante headers into sysroot"
71+
mkdir -p "${SYSROOT}/usr/include"
72+
cp -a "${VIVANTE_DIR}/include/." "${SYSROOT}/usr/include/"
73+
fi
74+
fi
75+
5876
# Fix up the symlinks in the sysroot, find all links that start with absolute paths
5977
# and replace them with relative paths inside the sysroot.
6078
cd "${SYSROOT}"
@@ -152,6 +170,22 @@ build()
152170
make "${MAKEFLAGS}"
153171
make "${MAKEFLAGS}" install
154172

173+
# Ensure Vivante runtime libraries are packaged with Qt so the target
174+
# filesystem gets the complete GPU stack.
175+
VIVANTE_DIR="${TOOLS_DIR}/vivante/${UM_ARCH}"
176+
if [ -d "${VIVANTE_DIR}/lib" ]; then
177+
echo "Copying Vivante libraries into Qt package"
178+
mkdir -p "${TARGET_DIR}/qt/lib"
179+
cp -a "${VIVANTE_DIR}/lib/." "${TARGET_DIR}/qt/lib/"
180+
fi
181+
182+
# Sanity check: the eglfs Vivante device integration must be present after build.
183+
EGLFS_VIV_PLUGIN="${TARGET_DIR}/qt/plugins/egldeviceintegrations/libqeglfs_viv.so"
184+
if [ ! -f "${EGLFS_VIV_PLUGIN}" ]; then
185+
echo "ERROR: libqeglfs_viv.so not found in build output" >&2
186+
exit 1
187+
fi
188+
155189
echo "Finished building."
156190
}
157191

tools/vivante/imx8/include/EGL/egl.h

Lines changed: 342 additions & 0 deletions
Large diffs are not rendered by default.

tools/vivante/imx8/include/EGL/eglext.h

Lines changed: 1456 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
#ifndef __eglplatform_h_
2+
#define __eglplatform_h_
3+
4+
/*
5+
** Copyright 2007-2020 The Khronos Group Inc.
6+
** SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
/* Platform-specific types and definitions for egl.h
10+
*
11+
* Adopters may modify khrplatform.h and this file to suit their platform.
12+
* You are encouraged to submit all modifications to the Khronos group so that
13+
* they can be included in future versions of this file. Please submit changes
14+
* by filing an issue or pull request on the public Khronos EGL Registry, at
15+
* https://www.github.com/KhronosGroup/EGL-Registry/
16+
*/
17+
18+
#include <KHR/khrplatform.h>
19+
20+
/* Macros used in EGL function prototype declarations.
21+
*
22+
* EGL functions should be prototyped as:
23+
*
24+
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
25+
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
26+
*
27+
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
28+
*/
29+
30+
#ifndef EGLAPI
31+
#define EGLAPI KHRONOS_APICALL
32+
#endif
33+
34+
#ifndef EGLAPIENTRY
35+
#define EGLAPIENTRY KHRONOS_APIENTRY
36+
#endif
37+
#define EGLAPIENTRYP EGLAPIENTRY*
38+
39+
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
40+
* are aliases of window-system-dependent types, such as X Display * or
41+
* Windows Device Context. They must be defined in platform-specific
42+
* code below. The EGL-prefixed versions of Native*Type are the same
43+
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
44+
*
45+
* Khronos STRONGLY RECOMMENDS that you use the default definitions
46+
* provided below, since these changes affect both binary and source
47+
* portability of applications using EGL running on different EGL
48+
* implementations.
49+
*/
50+
51+
#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) || (defined(EGL_API_FB) && !defined(EGL_API_WL) && !defined(WL_EGL_PLATFORM))
52+
53+
typedef void *EGLNativeDisplayType;
54+
typedef void *EGLNativePixmapType;
55+
typedef void *EGLNativeWindowType;
56+
57+
#elif defined(__QNXNTO__)
58+
59+
#include <screen/screen.h>
60+
typedef int EGLNativeDisplayType;
61+
typedef screen_window_t EGLNativeWindowType;
62+
typedef screen_pixmap_t EGLNativePixmapType;
63+
64+
#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
65+
#ifndef WIN32_LEAN_AND_MEAN
66+
/* #define WIN32_LEAN_AND_MEAN 1 */
67+
#endif
68+
#include <windows.h>
69+
70+
typedef HDC EGLNativeDisplayType;
71+
typedef HBITMAP EGLNativePixmapType;
72+
typedef HWND EGLNativeWindowType;
73+
74+
#elif defined(__EMSCRIPTEN__)
75+
76+
typedef int EGLNativeDisplayType;
77+
typedef int EGLNativePixmapType;
78+
typedef int EGLNativeWindowType;
79+
80+
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
81+
82+
typedef int EGLNativeDisplayType;
83+
typedef void *EGLNativePixmapType;
84+
typedef void *EGLNativeWindowType;
85+
86+
#elif defined(WL_EGL_PLATFORM) || defined(EGL_API_WL)
87+
88+
typedef struct wl_display *EGLNativeDisplayType;
89+
typedef struct wl_egl_pixmap *EGLNativePixmapType;
90+
typedef struct wl_egl_window *EGLNativeWindowType;
91+
92+
#elif defined(__GBM__) || defined(EGL_API_GBM)
93+
94+
typedef struct gbm_device *EGLNativeDisplayType;
95+
typedef struct gbm_bo *EGLNativePixmapType;
96+
typedef void *EGLNativeWindowType;
97+
98+
#elif defined(__ANDROID__) || defined(ANDROID)
99+
100+
#if ANDROID_SDK_VERSION >= 26
101+
# include <system/window.h>
102+
# else
103+
# include <android/native_window.h>
104+
# endif
105+
struct ANativeWindow;
106+
struct egl_native_pixmap_t;
107+
108+
typedef void* EGLNativeDisplayType;
109+
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
110+
typedef struct ANativeWindow* EGLNativeWindowType;
111+
112+
#elif defined(USE_OZONE)
113+
114+
typedef intptr_t EGLNativeDisplayType;
115+
typedef intptr_t EGLNativePixmapType;
116+
typedef intptr_t EGLNativeWindowType;
117+
118+
#elif defined(USE_X11) || defined(EGL_API_X)
119+
120+
/* X11 (tentative) */
121+
#include <X11/Xlib.h>
122+
#include <X11/Xutil.h>
123+
124+
typedef Display *EGLNativeDisplayType;
125+
typedef Pixmap EGLNativePixmapType;
126+
typedef Window EGLNativeWindowType;
127+
128+
#elif defined(__unix__)
129+
130+
typedef void *EGLNativeDisplayType;
131+
typedef khronos_uintptr_t EGLNativePixmapType;
132+
typedef khronos_uintptr_t EGLNativeWindowType;
133+
134+
#elif defined(__APPLE__)
135+
136+
typedef int EGLNativeDisplayType;
137+
typedef void *EGLNativePixmapType;
138+
typedef void *EGLNativeWindowType;
139+
140+
#elif defined(__HAIKU__)
141+
142+
#include <kernel/image.h>
143+
144+
typedef void *EGLNativeDisplayType;
145+
typedef khronos_uintptr_t EGLNativePixmapType;
146+
typedef khronos_uintptr_t EGLNativeWindowType;
147+
148+
#elif defined(__Fuchsia__)
149+
150+
typedef void *EGLNativeDisplayType;
151+
typedef khronos_uintptr_t EGLNativePixmapType;
152+
typedef khronos_uintptr_t EGLNativeWindowType;
153+
154+
#elif defined(__VXWORKS__)
155+
156+
typedef void * EGLNativeDisplayType;
157+
typedef void * EGLNativePixmapType;
158+
typedef void * EGLNativeWindowType;
159+
160+
#else
161+
#error "Platform not recognized"
162+
#endif
163+
164+
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
165+
typedef EGLNativeDisplayType NativeDisplayType;
166+
typedef EGLNativePixmapType NativePixmapType;
167+
typedef EGLNativeWindowType NativeWindowType;
168+
169+
170+
/* Define EGLint. This must be a signed integral type large enough to contain
171+
* all legal attribute names and values passed into and out of EGL, whether
172+
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
173+
* handle, or other. While in general a 32-bit integer will suffice, if
174+
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
175+
* integer type.
176+
*/
177+
typedef khronos_int32_t EGLint;
178+
179+
180+
/* C++ / C typecast macros for special EGL handle values */
181+
#if defined(__cplusplus)
182+
#define EGL_CAST(type, value) (static_cast<type>(value))
183+
#else
184+
#define EGL_CAST(type, value) ((type) (value))
185+
#endif
186+
187+
#include <EGL/eglvivante.h>
188+
189+
#endif /* __eglplatform_h */

0 commit comments

Comments
 (0)