All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mesa-gl: allow mesa (gbm) to compile without backend
@ 2022-12-28  4:05 Vincent Davis Jr
  2022-12-28  7:13 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Davis Jr @ 2022-12-28  4:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: Vincent Davis Jr

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 bypasses compilation issue by excluding gbm dri backend.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
 ...0001-undefined-reference-gbm-backend.patch | 51 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb  |  6 +++
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch

diff --git a/meta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch b/meta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch
new file mode 100644
index 0000000000..c9681e13a9
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch
@@ -0,0 +1,51 @@
+Fix gbm compile without dri 
+
+Upstream-Status: Inappropriate
+
+Only required if mesa-gl is the preferred provider
+of virtual/libgl, etc and the x11 DISTRO_FEATURE
+not included.
+
+Patch allows for gbm to be built with an
+empty backend. Thera are situation where mesa-gl
+is the preferred provider for virtual/libgbm,
+virtual/libgl, 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 
+
+Relevant previous mesa bug:
+* https://bugs.freedesktop.org/show_bug.cgi?id=78225
+
+Build libgbm without backend if its known that libgbm
+won't be utilized in OE system image.
+
+Signed-off-by: Vincent Davis Jr <vince@underview.tech>
+Index: mesa-22.2.3/src/gbm/main/backend.c
+===================================================================
+--- mesa-22.2.3.orig/src/gbm/main/backend.c
++++ mesa-22.2.3/src/gbm/main/backend.c
+@@ -42,7 +42,9 @@
+ #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+ #define VER_MIN(a, b) ((a) < (b) ? (a) : (b))
+ 
++#ifdef HAVE_DRI
+ extern const struct gbm_backend gbm_dri_backend;
++#endif
+ 
+ struct gbm_backend_desc {
+    const char *name;
+@@ -51,7 +53,9 @@ struct gbm_backend_desc {
+ };
+ 
+ static const struct gbm_backend_desc builtin_backends[] = {
++#ifdef HAVE_DRI
+    { "dri", &gbm_dri_backend },
++#endif
+ };
+ 
+ #define BACKEND_LIB_SUFFIX "_gbm"
diff --git a/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb b/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb
index f2bc8f6b5b..1571002317 100644
--- a/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb
@@ -6,6 +6,12 @@ PROVIDES = "virtual/libgl virtual/mesa"
 
 S = "${WORKDIR}/mesa-${PV}"
 
+SRC_URI:append = "\
+  ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'file://0001-undefined-reference-gbm-backend.patch', d)} \
+  "
+
+TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm"
+
 # At least one DRI rendering engine is required to build mesa.
 # When no X11 is available, use osmesa for the rendering engine.
 PACKAGECONFIG ??= "opengl ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa gallium', d)}"
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] mesa-gl: allow mesa (gbm) to compile without backend
  2022-12-28  4:05 [PATCH] mesa-gl: allow mesa (gbm) to compile without backend Vincent Davis Jr
@ 2022-12-28  7:13 ` Alexander Kanavin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kanavin @ 2022-12-28  7:13 UTC (permalink / raw)
  To: Vincent Davis Jr; +Cc: openembedded-core

On Wed, 28 Dec 2022 at 05:06, Vincent Davis Jr <vince@underview.tech> wrote:
> +Fix gbm compile without dri
> +
> +Upstream-Status: Inappropriate

This looks very much appropriate for upstream submission; please do so
and re-submit as backport.

Alex


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-28  7:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-28  4:05 [PATCH] mesa-gl: allow mesa (gbm) to compile without backend Vincent Davis Jr
2022-12-28  7:13 ` [OE-core] " Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.