diff options
author | Mark Hatle <mark.hatle@xilinx.com> | 2021-12-15 13:52:16 -0800 |
---|---|---|
committer | Mark Hatle <mark.hatle@xilinx.com> | 2021-12-22 08:19:01 -0800 |
commit | 322e23dc213d51a12345ca705b3776f189dc413f (patch) | |
tree | e257ca97fa6d3eef83c845b67d711b2d8ecba5ba /meta-xilinx-core/recipes-graphics/libgles | |
parent | dd95dde009dc7968f6e6e4c0609e7b443c55c627 (diff) | |
download | meta-xilinx-322e23dc213d51a12345ca705b3776f189dc413f.tar.gz |
Initial restructure/split of meta-xilinx-bsp
Create a new meta-xilinx-core, move core functionality to the core, keeping
board specific files in the bsp layer.
zynqmp-generic changed from require <board> to include, so if meta-xilinx-bsp
is not available it will not fail.
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-xilinx-core/recipes-graphics/libgles')
6 files changed, 261 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc b/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc new file mode 100644 index 00000000..65c4c1f3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/egl.pc | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=/usr | ||
2 | exec_prefix=${prefix} | ||
3 | libdir=/usr/lib | ||
4 | includedir=/usr/include | ||
5 | |||
6 | Name: egl | ||
7 | Description: MALI EGL library | ||
8 | Requires.private: | ||
9 | Version: 17.3 | ||
10 | Libs: -L${libdir} -lEGL | ||
11 | Libs.private: -lm -lpthread -ldl | ||
12 | Cflags: -I${includedir} | ||
diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc b/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc new file mode 100644 index 00000000..c40b5f4f --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/gbm.pc | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=/usr | ||
2 | exec_prefix=${prefix} | ||
3 | libdir=/usr/lib | ||
4 | includedir=/usr/include | ||
5 | |||
6 | Name: gbm | ||
7 | Description: MALI gbm library | ||
8 | Requires.private: | ||
9 | Version: 17.3 | ||
10 | Libs: -L${libdir} -lgbm | ||
11 | Libs.private: -lm -lpthread -ldl | ||
12 | Cflags: -I${includedir} | ||
diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc new file mode 100644 index 00000000..39467f33 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1.pc | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=/usr | ||
2 | exec_prefix=${prefix} | ||
3 | libdir=/usr/lib | ||
4 | includedir=/usr/include | ||
5 | |||
6 | Name: glesv1 | ||
7 | Description: MALI OpenGL ES 1.1 library | ||
8 | Requires.private: | ||
9 | Version: 17.3 | ||
10 | Libs: -L${libdir} -lGLESv1_CM | ||
11 | Libs.private: -lm -lpthread -ldl | ||
12 | Cflags: -I${includedir} | ||
diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc new file mode 100644 index 00000000..1547b4c8 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv1_cm.pc | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=/usr | ||
2 | exec_prefix=${prefix} | ||
3 | libdir=/usr/lib | ||
4 | includedir=/usr/include | ||
5 | |||
6 | Name: gles_cm | ||
7 | Description: Mali OpenGL ES 1.1 CM library | ||
8 | Requires.private: | ||
9 | Version: 17.3 | ||
10 | Libs: -L${libdir} -lGLESv1_CM | ||
11 | Libs.private: -lm -lpthread -ldl | ||
12 | Cflags: -I${includedir} | ||
diff --git a/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc b/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc new file mode 100644 index 00000000..a0a84f23 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/files/glesv2.pc | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=/usr | ||
2 | exec_prefix=${prefix} | ||
3 | libdir=/usr/lib | ||
4 | includedir=/usr/include | ||
5 | |||
6 | Name: glesv2 | ||
7 | Description: MALI OpenGL ES 2.0 library | ||
8 | Requires.private: | ||
9 | Version: 17.3 | ||
10 | Libs: -L${libdir} -lGLESv2 | ||
11 | Libs.private: -lm -lpthread -ldl | ||
12 | Cflags: -I${includedir} | ||
diff --git a/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb b/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb new file mode 100644 index 00000000..79e0d90b --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/libgles/libmali-xlnx.bb | |||
@@ -0,0 +1,201 @@ | |||
1 | DESCRIPTION = "libGLES for ZynqMP with Mali 400" | ||
2 | |||
3 | LICENSE = "Proprietary" | ||
4 | LIC_FILES_CHKSUM = "file://EULA;md5=82e466d0ed92c5a15f568dbe6b31089c" | ||
5 | |||
6 | inherit features_check update-alternatives | ||
7 | |||
8 | ANY_OF_DISTRO_FEATURES = "x11 fbdev wayland" | ||
9 | |||
10 | PROVIDES += "virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm" | ||
11 | |||
12 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" | ||
13 | |||
14 | REPO ?= "git://github.com/Xilinx/mali-userspace-binaries.git;protocol=https" | ||
15 | BRANCH ?= "xlnx_rel_v2021.2" | ||
16 | SRCREV ?= "a1a22c9f03b20d8cb70b91727fe51c1db7f4b061" | ||
17 | BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}" | ||
18 | |||
19 | PV = "r9p0-01rel0" | ||
20 | SRC_URI = " \ | ||
21 | ${REPO};${BRANCHARG} \ | ||
22 | file://egl.pc \ | ||
23 | file://glesv1_cm.pc \ | ||
24 | file://glesv1.pc \ | ||
25 | file://glesv2.pc \ | ||
26 | file://gbm.pc \ | ||
27 | " | ||
28 | |||
29 | COMPATIBLE_MACHINE = "^$" | ||
30 | COMPATIBLE_MACHINE:zynqmp-eg = "zynqmp-eg" | ||
31 | COMPATIBLE_MACHINE:zynqmp-ev = "zynqmp-ev" | ||
32 | |||
33 | PACKAGE_ARCH = "${SOC_VARIANT_ARCH}" | ||
34 | |||
35 | |||
36 | S = "${WORKDIR}/git" | ||
37 | |||
38 | # If were switching at runtime, we would need all RDEPENDS needed for all backends available | ||
39 | X11RDEPENDS = "libxdamage libxext libx11 libdrm libxfixes" | ||
40 | X11DEPENDS = "libxdamage libxext virtual/libx11 libdrm libxfixes" | ||
41 | |||
42 | # Don't install runtime dependencies for other backends unless the DISTRO supports it | ||
43 | RDEPENDS:${PN} = " \ | ||
44 | kernel-module-mali \ | ||
45 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \ | ||
46 | " | ||
47 | |||
48 | # We dont build anything but we want to avoid QA warning build-deps | ||
49 | DEPENDS = "\ | ||
50 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \ | ||
51 | ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland libdrm', '', d)} \ | ||
52 | " | ||
53 | |||
54 | |||
55 | # x11 is default, set to "fbdev" , "wayland", or "headless" if required | ||
56 | MALI_BACKEND_DEFAULT ?= "x11" | ||
57 | |||
58 | USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}" | ||
59 | USE_FB = "${@bb.utils.contains("DISTRO_FEATURES", "fbdev", "yes", "no", d)}" | ||
60 | USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}" | ||
61 | |||
62 | MONOLITHIC_LIBMALI = "libMali.so.9.0" | ||
63 | |||
64 | do_install() { | ||
65 | #Identify the ARCH type | ||
66 | ${TARGET_PREFIX}gcc --version > ARCH_PLATFORM | ||
67 | if grep -q aarch64 "ARCH_PLATFORM"; then | ||
68 | ARCH_PLATFORM_DIR=aarch64-linux-gnu | ||
69 | else | ||
70 | ARCH_PLATFORM_DIR=arm-linux-gnueabihf | ||
71 | fi | ||
72 | |||
73 | # install headers | ||
74 | install -d -m 0655 ${D}${includedir}/EGL | ||
75 | install -m 0644 ${S}/${PV}/glesHeaders/EGL/*.h ${D}${includedir}/EGL/ | ||
76 | install -d -m 0655 ${D}${includedir}/GLES | ||
77 | install -m 0644 ${S}/${PV}/glesHeaders/GLES/*.h ${D}${includedir}/GLES/ | ||
78 | install -d -m 0655 ${D}${includedir}/GLES2 | ||
79 | install -m 0644 ${S}/${PV}/glesHeaders/GLES2/*.h ${D}${includedir}/GLES2/ | ||
80 | install -d -m 0655 ${D}${includedir}/KHR | ||
81 | install -m 0644 ${S}/${PV}/glesHeaders/KHR/*.h ${D}${includedir}/KHR/ | ||
82 | |||
83 | install -d ${D}${libdir}/pkgconfig | ||
84 | install -m 0644 ${WORKDIR}/egl.pc ${D}${libdir}/pkgconfig/egl.pc | ||
85 | install -m 0644 ${WORKDIR}/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc | ||
86 | install -m 0644 ${WORKDIR}/glesv1.pc ${D}${libdir}/pkgconfig/glesv1.pc | ||
87 | install -m 0644 ${WORKDIR}/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc | ||
88 | |||
89 | install -d ${D}${libdir} | ||
90 | install -d ${D}${includedir} | ||
91 | |||
92 | cp -a --no-preserve=ownership ${S}/${PV}/${ARCH_PLATFORM_DIR}/common/*.so* ${D}${libdir} | ||
93 | |||
94 | install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/headless/${MONOLITHIC_LIBMALI} | ||
95 | ln -snf headless/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} | ||
96 | |||
97 | if [ "${USE_FB}" = "yes" ]; then | ||
98 | install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/fbdev/${MONOLITHIC_LIBMALI} | ||
99 | if [ "${MALI_BACKEND_DEFAULT}" = "fbdev" ]; then | ||
100 | ln -snf fbdev/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} | ||
101 | fi | ||
102 | fi | ||
103 | if [ "${USE_X11}" = "yes" ]; then | ||
104 | install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/x11/${MONOLITHIC_LIBMALI} | ||
105 | if [ "${MALI_BACKEND_DEFAULT}" = "x11" ]; then | ||
106 | ln -snf x11/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} | ||
107 | fi | ||
108 | else | ||
109 | # We cant rely on the fact that all apps will use pkgconfig correctly | ||
110 | sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if (1)/' ${D}${includedir}/EGL/eglplatform.h | ||
111 | fi | ||
112 | if [ "${USE_WL}" = "yes" ]; then | ||
113 | install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/ | ||
114 | install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc | ||
115 | install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/wayland/${MONOLITHIC_LIBMALI} | ||
116 | if [ "${MALI_BACKEND_DEFAULT}" = "wayland" ]; then | ||
117 | ln -snf wayland/${MONOLITHIC_LIBMALI} ${D}${libdir}/${MONOLITHIC_LIBMALI} | ||
118 | fi | ||
119 | fi | ||
120 | } | ||
121 | |||
122 | |||
123 | # We need separate packages to provide multiple alternatives, at this point we install | ||
124 | # everything on the default one but that can be split if necessary | ||
125 | PACKAGES += "${PN}-x11 ${PN}-fbdev ${PN}-wayland ${PN}-headless" | ||
126 | |||
127 | # This is default/common for all alternatives | ||
128 | ALTERNATIVE_LINK_NAME[libmali-xlnx] = "${libdir}/${MONOLITHIC_LIBMALI}" | ||
129 | |||
130 | |||
131 | # Declare alternatives and corresponding library location | ||
132 | ALTERNATIVE:${PN}-x11 = "libmali-xlnx" | ||
133 | ALTERNATIVE_TARGET_libmali-xlnx-x11[libmali-xlnx] = "${libdir}/x11/${MONOLITHIC_LIBMALI}" | ||
134 | |||
135 | ALTERNATIVE:${PN}-fbdev = "libmali-xlnx" | ||
136 | ALTERNATIVE_TARGET_libmali-xlnx-fbdev[libmali-xlnx] = "${libdir}/fbdev/${MONOLITHIC_LIBMALI}" | ||
137 | |||
138 | ALTERNATIVE:${PN}-wayland = "libmali-xlnx" | ||
139 | ALTERNATIVE_TARGET_libmali-xlnx-wayland[libmali-xlnx] = "${libdir}/wayland/${MONOLITHIC_LIBMALI}" | ||
140 | |||
141 | ALTERNATIVE:${PN}-headless = "libmali-xlnx" | ||
142 | ALTERNATIVE_TARGET_libmali-xlnx-headless[libmali-xlnx] = "${libdir}/headless/${MONOLITHIC_LIBMALI}" | ||
143 | |||
144 | # Set priorities according to what we prveiously defined | ||
145 | ALTERNATIVE_PRIORITY_libmali-xlnx-x11[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "x11", "20", "10", d)}" | ||
146 | ALTERNATIVE_PRIORITY_libmali-xlnx-fbdev[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "fbdev", "20", "10", d)}" | ||
147 | ALTERNATIVE_PRIORITY_libmali-xlnx-wayland[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "wayland", "20", "10", d)}" | ||
148 | |||
149 | # If misconfigured, fallback to headless | ||
150 | ALTERNATIVE_PRIORITY_libmali-xlnx-headless[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "headless", "20", "15", d)}" | ||
151 | |||
152 | |||
153 | # Package gets renamed on the debian class, but we want to keep -xlnx | ||
154 | DEBIAN_NOAUTONAME:libmali-xlnx = "1" | ||
155 | |||
156 | # Update alternatives will actually have separate postinst scripts (one for each package) | ||
157 | # This wont work for us, so we create a common postinst script and we pass that as the general | ||
158 | # libmali-xlnx postinst script, but we defer execution to run on first boot (pkg_postinst_ontarget). | ||
159 | # This will avoid ldconfig removing the symbolic links when creating the root filesystem. | ||
160 | python populate_packages_updatealternatives:append () { | ||
161 | # We need to remove the 'fake' libmali-xlnx before creating any links | ||
162 | libdir = d.getVar('libdir') | ||
163 | common_postinst = "#!/bin/sh\nrm " + libdir + "/${MONOLITHIC_LIBMALI}\n" | ||
164 | for pkg in (d.getVar('PACKAGES') or "").split(): | ||
165 | # Not all packages provide an alternative (e.g. ${PN}-lic) | ||
166 | postinst = d.getVar('pkg_postinst:%s' % pkg) | ||
167 | if postinst: | ||
168 | old_postinst = postinst | ||
169 | new_postinst = postinst.replace('#!/bin/sh','') | ||
170 | common_postinst += new_postinst | ||
171 | d.setVar('pkg_postinst_ontarget:%s' % 'libmali-xlnx', common_postinst) | ||
172 | } | ||
173 | |||
174 | |||
175 | # Inhibit warnings about files being stripped | ||
176 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
177 | INHIBIT_PACKAGE_STRIP = "1" | ||
178 | INHIBIT_SYSROOT_STRIP = "1" | ||
179 | |||
180 | RREPLACES:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" | ||
181 | RPROVIDES:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" | ||
182 | RCONFLICTS:${PN} = "libegl libgles1 libglesv1-cm1 libgles2 libglesv2-2 libgbm" | ||
183 | |||
184 | # These libraries shouldn't get installed in world builds unless something | ||
185 | # explicitly depends upon them. | ||
186 | EXCLUDE_FROM_WORLD = "1" | ||
187 | FILES:${PN} += "${libdir}/*" | ||
188 | |||
189 | do_package:append() { | ||
190 | |||
191 | shlibswork_dir = d.getVar('SHLIBSWORKDIR') | ||
192 | pkg_filename = d.getVar('PN') + ".list" | ||
193 | shlibs_file = os.path.join(shlibswork_dir, pkg_filename) | ||
194 | lines = "" | ||
195 | with open(shlibs_file, "r") as f: | ||
196 | lines = f.readlines() | ||
197 | with open(shlibs_file, "w") as f: | ||
198 | for line in lines: | ||
199 | if d.getVar('MALI_BACKEND_DEFAULT') in line.strip("\n"): | ||
200 | f.write(line) | ||
201 | } | ||