mesa-gl: allow mesa (gbm) to compile without backend
PATCH v2 1/1 mesa-gl: 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 bypasses compilation issue by excluding gbm dri backend.
--- ...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
meta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch new file +51 -0
@@ -0,0 +1,51 @@ +Fix gbm compile without dri + +Upstream-Status: Backport + +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 <[email protected]> +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"
meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb +6 -0
@@ -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)}"
Signature · 1 line
2.38.1
This is not a backport. The upstream code does not have the change that the patch introduces:
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/main/backend.c
Please do a proper upstream submission, and do not tell untruths in your submissions here. You do not want your future contributions to be viewed with suspicion.
Alex
Quoted 111 lines · 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 x11DISTRO_FEATUREisn'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 statusAdd patch bypasses compilation issue by excluding gbm dri backend.
Signed-off-by Vincent Davis Jr <[email protected]>--- ...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.patchmeta/recipes-graphics/mesa/files/0001-undefined-reference-gbm-backend.patch new file +51
-0@@ -0,0 +1,51 @@ +Fix gbm compile without dri + +Upstream-Status: Backport + +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 <[email protected]> +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"meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb +6
-1@@ -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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#175086): https://lists.openembedded.org/g/openembedded-core/message/175086
Mute This Topic: https://lists.openembedded.org/mt/95926733/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-