diff options
| author | Vincent Davis Jr <vince@underview.tech> | 2023-01-14 16:13:56 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-18 16:42:27 +0000 |
| commit | daf42dbe78795445892ed18c1a1d6fb233f37182 (patch) | |
| tree | 2d3129a1539d305ef5124301c39e1b85f8042f22 /meta | |
| parent | 2ac1235b9b6b14644c6bd6ff820264ed49d70170 (diff) | |
| download | poky-daf42dbe78795445892ed18c1a1d6fb233f37182.tar.gz | |
mesa: allow mesa (gbm) to compile without backend
Commit introduces a patch that allows for gbm to
be built with an empty backend. There are situation
where mesa-gl is the preferred provider for virtual/libgbm,
virtual/libgl, virtual/mesa, etc... But the x11 DISTRO_FEATURE
isn't included this leads to build errors such as
| /../../../ld: src/gbm/libgbm.so.1.0.0.p/main_backend.c.o: in function
`find_backend':
| backend.c:(.text.find_backend+0xa4): undefined reference to
`gbm_dri_backend'
| /../../../ld:
src/gbm/libgbm.so.1.0.0.p/main_backend.c.o:(.data.rel.ro.builtin_backends+0x4):
undefined reference to `gbm_dri_backend'
| collect2: error: ld returned 1 exit status
Add patch to bypass compilation issue by excluding gbm dri backend.
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20447
https://gitlab.freedesktop.org/mesa/mesa/-/commit/842ca284650f066e58706741a7d22d67b5088e60
Commit also includes the use of TARGET_CFLAGS variable in mesa-gl recipe
to fix bellow compilation bug.
/../recipe-sysroot/usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory
| 40 | #include <drm.h>
(From OE-Core rev: 00a662c5e28235fb64348aab4ce9aeb5e7f95d06)
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-graphics/mesa/files/0001-gbm-backend-fix-gbm-compile-without-dri.patch | 65 | ||||
| -rw-r--r-- | meta/recipes-graphics/mesa/mesa-gl_22.3.3.bb | 2 | ||||
| -rw-r--r-- | meta/recipes-graphics/mesa/mesa.inc | 1 |
3 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-gbm-backend-fix-gbm-compile-without-dri.patch b/meta/recipes-graphics/mesa/files/0001-gbm-backend-fix-gbm-compile-without-dri.patch new file mode 100644 index 0000000000..6541671b7a --- /dev/null +++ b/meta/recipes-graphics/mesa/files/0001-gbm-backend-fix-gbm-compile-without-dri.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | From 25946100e21cf2095bea334e8d7096798561d0b7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Davis Jr <vince@underview.tech> | ||
| 3 | Date: Wed, 28 Dec 2022 16:28:01 -0600 | ||
| 4 | Subject: [PATCH] gbm/backend: fix gbm compile without dri | ||
| 5 | |||
| 6 | Upstream-Status: Backport | ||
| 7 | |||
| 8 | https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20447 | ||
| 9 | https://gitlab.freedesktop.org/mesa/mesa/-/commit/842ca284650f066e58706741a7d22d67b5088e60 | ||
| 10 | |||
| 11 | At mesa version 22.2.3 patch wasn't introduced until after. | ||
| 12 | |||
| 13 | Commit introduces a fix that allows for gbm to be built with an empty | ||
| 14 | backend. There are situation especially in a Yocto/OE cross compilation | ||
| 15 | environment where you want to build with an empty backend. The particular | ||
| 16 | situation is as such: | ||
| 17 | |||
| 18 | The mesa-gl recipe is the preferred provider for virtual/libgbm, virtual/libgl, | ||
| 19 | virtual/mesa, etc... But the x11 DISTRO_FEATURE in't included this leads to build | ||
| 20 | errors such as: | ||
| 21 | |||
| 22 | | /../../../ld: src/gbm/libgbm.so.1.0.0.p/main_backend.c.o: in function `find_backend': | ||
| 23 | | backend.c:(.text.find_backend+0xa4): undefined reference to `gbm_dri_backend' | ||
| 24 | | /../../../ld: src/gbm/libgbm.so.1.0.0.p/main_backend.c.o:(.data.rel.ro.builtin_backends+0x4): | ||
| 25 | undefined reference to `gbm_dri_backend' | ||
| 26 | | collect2: error: ld returned 1 exit status | ||
| 27 | |||
| 28 | Issue should be replicable by setting -Ddri3=disabled and -Dgbm=enabled | ||
| 29 | |||
| 30 | Add fix to bypasses compilation issue by excluding gbm dri backend. If | ||
| 31 | HAVE_DRI || HAVE_DRIX not specified. | ||
| 32 | |||
| 33 | Acked-by: David Heidelberg <david.heidelberg@collabora.com> | ||
| 34 | Signed-off-by: Vincent Davis Jr <vince@underview.tech> | ||
| 35 | --- | ||
| 36 | src/gbm/main/backend.c | 4 ++++ | ||
| 37 | 1 file changed, 4 insertions(+) | ||
| 38 | |||
| 39 | diff --git a/src/gbm/main/backend.c b/src/gbm/main/backend.c | ||
| 40 | index 974d0a76a4e..feee0703495 100644 | ||
| 41 | --- a/src/gbm/main/backend.c | ||
| 42 | +++ b/src/gbm/main/backend.c | ||
| 43 | @@ -42,7 +42,9 @@ | ||
| 44 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) | ||
| 45 | #define VER_MIN(a, b) ((a) < (b) ? (a) : (b)) | ||
| 46 | |||
| 47 | +#if defined(HAVE_DRI) || defined(HAVE_DRI2) || defined(HAVE_DRI3) | ||
| 48 | extern const struct gbm_backend gbm_dri_backend; | ||
| 49 | +#endif | ||
| 50 | |||
| 51 | struct gbm_backend_desc { | ||
| 52 | const char *name; | ||
| 53 | @@ -51,7 +53,9 @@ struct gbm_backend_desc { | ||
| 54 | }; | ||
| 55 | |||
| 56 | static const struct gbm_backend_desc builtin_backends[] = { | ||
| 57 | +#if defined(HAVE_DRI) || defined(HAVE_DRI2) || defined(HAVE_DRI3) | ||
| 58 | { "dri", &gbm_dri_backend }, | ||
| 59 | +#endif | ||
| 60 | }; | ||
| 61 | |||
| 62 | #define BACKEND_LIB_SUFFIX "_gbm" | ||
| 63 | -- | ||
| 64 | 2.34.1 | ||
| 65 | |||
diff --git a/meta/recipes-graphics/mesa/mesa-gl_22.3.3.bb b/meta/recipes-graphics/mesa/mesa-gl_22.3.3.bb index c7c7aa7ac3..ca160f1bfc 100644 --- a/meta/recipes-graphics/mesa/mesa-gl_22.3.3.bb +++ b/meta/recipes-graphics/mesa/mesa-gl_22.3.3.bb | |||
| @@ -6,6 +6,8 @@ PROVIDES = "virtual/libgl virtual/mesa" | |||
| 6 | 6 | ||
| 7 | S = "${WORKDIR}/mesa-${PV}" | 7 | S = "${WORKDIR}/mesa-${PV}" |
| 8 | 8 | ||
| 9 | TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm" | ||
| 10 | |||
| 9 | # At least one DRI rendering engine is required to build mesa. | 11 | # At least one DRI rendering engine is required to build mesa. |
| 10 | # When no X11 is available, use osmesa for the rendering engine. | 12 | # When no X11 is available, use osmesa for the rendering engine. |
| 11 | PACKAGECONFIG ??= "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa', d)}" | 13 | PACKAGECONFIG ??= "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa', d)}" |
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 5fdb67ca2a..15b1a18eac 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc | |||
| @@ -18,6 +18,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ | |||
| 18 | file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ | 18 | file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ |
| 19 | file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ | 19 | file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ |
| 20 | file://0001-util-format-Check-for-NEON-before-using-it.patch \ | 20 | file://0001-util-format-Check-for-NEON-before-using-it.patch \ |
| 21 | file://0001-gbm-backend-fix-gbm-compile-without-dri.patch \ | ||
| 21 | ${NATIVE_PATCHES} \ | 22 | ${NATIVE_PATCHES} \ |
| 22 | " | 23 | " |
| 23 | NATIVE_PATCHES ?= "" | 24 | NATIVE_PATCHES ?= "" |
