Message ID | 20221228202649.91106-1-vince@underview.tech |
---|---|
State | New |
Headers | show |
Series | [v2] mesa-gl: allow mesa (gbm) to compile without backend | expand |
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 On Wed, 28 Dec 2022 at 21:27, Vincent Davis Jr <vince@underview.tech> wrote: > > 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..66ab52fdaa > --- /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: 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 <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 > > > -=-=-=-=-=-=-=-=-=-=-=- > 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: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
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..66ab52fdaa --- /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: 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 <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)}"
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