Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] TestGlxinfo fixes
@ 2024-02-06 12:49 Romain Naour
  2024-02-06 12:49 ` [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3 Romain Naour
  2024-02-06 12:49 ` [Buildroot] [PATCH 2/2] support/testing: use core2duo cpu emulation for TestGlxinfo Romain Naour
  0 siblings, 2 replies; 4+ messages in thread
From: Romain Naour @ 2024-02-06 12:49 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

I initially started looking at TestGlxinfo some weeks ago fixing two issues
at that time but patches requires some improvement before submitting them
upstream. In the mean time a new runtime issue appear due to x86 optimization.

Romain Naour (2):
  package/mesa3d: fix drisw build without dri3
  support/testing: use core2duo cpu emulation for TestGlxinfo

 .../0006-drisw-fix-build-without-dri3.patch   | 58 +++++++++++++++++++
 ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ++++++++++++++
 support/testing/tests/package/test_glxinfo.py |  3 +-
 3 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 package/mesa3d/0006-drisw-fix-build-without-dri3.patch
 create mode 100644 package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch

--
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3
  2024-02-06 12:49 [Buildroot] [PATCH 0/2] TestGlxinfo fixes Romain Naour
@ 2024-02-06 12:49 ` Romain Naour
  2024-02-07 15:19   ` Thomas Petazzoni via buildroot
  2024-02-06 12:49 ` [Buildroot] [PATCH 2/2] support/testing: use core2duo cpu emulation for TestGlxinfo Romain Naour
  1 sibling, 1 reply; 4+ messages in thread
From: Romain Naour @ 2024-02-06 12:49 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

mesa3d 23.3 added dri3_priv.h header and dri3_check_multibuffer() function in
drisw (part of swrast gallium driver) that can be build without dri3.

  i686-buildroot-linux-gnu/bin/ld: src/glx/libglx.a.p/drisw_glx.c.o: in function `driswCreateScreenDriver':
  drisw_glx.c:(.text.driswCreateScreenDriver+0x3a0): undefined reference to `dri3_check_multibuffer'
  collect2: error: ld returned 1 exit status

Add HAVE_DRI3 guard around dri3_priv.h header and the zink code using
dri3_check_multibuffer().

While testing again the TestGlxinfo runtime test, a new unexpected error line
appeared in the glxinfo log:

  MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so

mesa3d try to load zink gallium driver even if it was not enabled at
build time, indeed there is no such option in Buildroot.

Apply patches sent upstream:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27478

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/6093854455

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 .../0006-drisw-fix-build-without-dri3.patch   | 58 +++++++++++++++++++
 ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 package/mesa3d/0006-drisw-fix-build-without-dri3.patch
 create mode 100644 package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch

diff --git a/package/mesa3d/0006-drisw-fix-build-without-dri3.patch b/package/mesa3d/0006-drisw-fix-build-without-dri3.patch
new file mode 100644
index 0000000000..ab27d384cf
--- /dev/null
+++ b/package/mesa3d/0006-drisw-fix-build-without-dri3.patch
@@ -0,0 +1,58 @@
+From 3ab46dcfda9edf5c9bc27c8f5031146d9d9d8ade Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@smile.fr>
+Date: Thu, 18 Jan 2024 22:50:16 +0100
+Subject: [PATCH] drisw: fix build without dri3
+
+commit 1887368df41 ("glx/sw: check for modifier support in the kopper path")
+added dri3_priv.h header and dri3_check_multibuffer() function in drisw that
+can be build without dri3.
+
+  i686-buildroot-linux-gnu/bin/ld: src/glx/libglx.a.p/drisw_glx.c.o: in function `driswCreateScreenDriver':
+  drisw_glx.c:(.text.driswCreateScreenDriver+0x3a0): undefined reference to `dri3_check_multibuffer'
+  collect2: error: ld returned 1 exit status
+
+Add HAVE_DRI3 guard around dri3_priv.h header and the zink code using
+dri3_check_multibuffer().
+
+Fixes: 1887368df41 ("glx/sw: check for modifier support in the kopper path")
+
+Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27478
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ src/glx/drisw_glx.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
+index 3d3f75259bc..4b19e2d7707 100644
+--- a/src/glx/drisw_glx.c
++++ b/src/glx/drisw_glx.c
+@@ -32,7 +32,9 @@
+ #include <dlfcn.h>
+ #include "dri_common.h"
+ #include "drisw_priv.h"
++#ifdef HAVE_DRI3
+ #include "dri3_priv.h"
++#endif
+ #include <X11/extensions/shmproto.h>
+ #include <assert.h>
+ #include <vulkan/vulkan_core.h>
+@@ -995,6 +997,7 @@ driswCreateScreenDriver(int screen, struct glx_display *priv,
+        goto handle_error;
+    }
+ 
++#ifdef HAVE_DRI3
+    if (pdpyp->zink) {
+       bool err;
+       psc->has_multibuffer = dri3_check_multibuffer(priv->dpy, &err);
+@@ -1005,6 +1008,7 @@ driswCreateScreenDriver(int screen, struct glx_display *priv,
+          goto handle_error;
+       }
+    }
++#endif
+ 
+    glx_config_destroy_list(psc->base.configs);
+    psc->base.configs = configs;
+-- 
+2.43.0
+
diff --git a/package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch b/package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
new file mode 100644
index 0000000000..f9e4d50fd7
--- /dev/null
+++ b/package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
@@ -0,0 +1,42 @@
+From 83b4ff6616708bd7ba5981d22cd5211ca6787d58 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@smile.fr>
+Date: Wed, 24 Jan 2024 14:28:32 +0100
+Subject: [PATCH] glxext: don't try zink if not enabled in mesa
+
+Commit 7d9ea77b459 ("glx: add automatic zink fallback loading between hw and sw drivers")
+added an automatic zink fallback even when the zink gallium is not
+enabled at build time.
+
+It leads to unexpected error log while loading drisw driver and
+zink is not installed on the rootfs:
+
+  MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so
+
+Fixes: 7d9ea77b459 ("glx: add automatic zink fallback loading between hw and sw drivers")
+
+Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27478
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ src/glx/glxext.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/glx/glxext.c b/src/glx/glxext.c
+index 39d5f08bdcf..e106eb40046 100644
+--- a/src/glx/glxext.c
++++ b/src/glx/glxext.c
+@@ -904,9 +904,11 @@ __glXInitialize(Display * dpy)
+ #endif /* HAVE_DRI3 */
+       if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
+          dpyPriv->dri2Display = dri2CreateDisplay(dpy);
++#if defined(HAVE_ZINK)
+       if (!dpyPriv->dri3Display && !dpyPriv->dri2Display)
+          try_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) &&
+                     !getenv("GALLIUM_DRIVER");
++#endif /* HAVE_ZINK */
+    }
+ #endif /* GLX_USE_DRM */
+    if (glx_direct)
+-- 
+2.43.0
+
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 2/2] support/testing: use core2duo cpu emulation for TestGlxinfo
  2024-02-06 12:49 [Buildroot] [PATCH 0/2] TestGlxinfo fixes Romain Naour
  2024-02-06 12:49 ` [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3 Romain Naour
@ 2024-02-06 12:49 ` Romain Naour
  1 sibling, 0 replies; 4+ messages in thread
From: Romain Naour @ 2024-02-06 12:49 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

TestGlxinfo fail with a new runtime error:

  # glxinfo -B -display :0
  name of display: :0
  traps: glxinfo[84] trap invalid opcode ip:b73c7027 sp:bf8433c0 error:0 in swrast_dri.so[b6e4c000+64f000]
  Illegal instruction

The x86-core2 Bootlin toolchains are built for a core2 CPU [0],
this means that the Bootlin toolchains may use core2-specific
instructions.

The TestGlxinfo test is setup for BR2_x86_core2, so our
executables will also contain core2 instructions.

However, the default Qemu x86 is not guaranteed to emulate all the
instructions specific to core2, causing runtime issues as reported
above.

A similar issue has been fixed by adding Nehalem cpu emulation on
the qemu command line. See 4f565b5222 ("support/testing: use Nehalem
cpu emulation for TestGrubX8664EFI").

Set core2duo cpu emulation for TestGlxinfo on the qemu command line.

[0] https://gitlab.com/buildroot.org/toolchains-builder/-/blob/kubu/toolchain-builder-2023.08/configs/arch/x86-core2.config?ref_type=heads

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 support/testing/tests/package/test_glxinfo.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/support/testing/tests/package/test_glxinfo.py b/support/testing/tests/package/test_glxinfo.py
index 6bedee5298..3ccbdca8d9 100644
--- a/support/testing/tests/package/test_glxinfo.py
+++ b/support/testing/tests/package/test_glxinfo.py
@@ -42,7 +42,8 @@ class TestGlxinfo(infra.basetest.BRTest):
         self.emulator.boot(arch="i386",
                            kernel=kern,
                            kernel_cmdline=["root=/dev/vda console=ttyS0"],
-                           options=["-M", "pc", "-m", "512", "-drive", "file={},if=virtio,format=raw".format(img)])
+                           options=["-M", "pc", "-cpu", "core2duo", "-m", "512",
+                                    "-drive", "file={},if=virtio,format=raw".format(img)])
         self.emulator.login()
 
     def test_run(self):
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3
  2024-02-06 12:49 ` [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3 Romain Naour
@ 2024-02-07 15:19   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-07 15:19 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Tue,  6 Feb 2024 13:49:46 +0100
Romain Naour <romain.naour@smile.fr> wrote:

> mesa3d 23.3 added dri3_priv.h header and dri3_check_multibuffer() function in
> drisw (part of swrast gallium driver) that can be build without dri3.
> 
>   i686-buildroot-linux-gnu/bin/ld: src/glx/libglx.a.p/drisw_glx.c.o: in function `driswCreateScreenDriver':
>   drisw_glx.c:(.text.driswCreateScreenDriver+0x3a0): undefined reference to `dri3_check_multibuffer'
>   collect2: error: ld returned 1 exit status
> 
> Add HAVE_DRI3 guard around dri3_priv.h header and the zink code using
> dri3_check_multibuffer().
> 
> While testing again the TestGlxinfo runtime test, a new unexpected error line
> appeared in the glxinfo log:
> 
>   MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so
> 
> mesa3d try to load zink gallium driver even if it was not enabled at
> build time, indeed there is no such option in Buildroot.
> 
> Apply patches sent upstream:
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27478
> 
> Fixes:
> https://gitlab.com/buildroot.org/buildroot/-/jobs/6093854455
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
>  .../0006-drisw-fix-build-without-dri3.patch   | 58 +++++++++++++++++++
>  ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ++++++++++++++
>  2 files changed, 100 insertions(+)
>  create mode 100644 package/mesa3d/0006-drisw-fix-build-without-dri3.patch
>  create mode 100644 package/mesa3d/0007-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch

Both applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-02-07 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 12:49 [Buildroot] [PATCH 0/2] TestGlxinfo fixes Romain Naour
2024-02-06 12:49 ` [Buildroot] [PATCH 1/2] package/mesa3d: fix drisw build without dri3 Romain Naour
2024-02-07 15:19   ` Thomas Petazzoni via buildroot
2024-02-06 12:49 ` [Buildroot] [PATCH 2/2] support/testing: use core2duo cpu emulation for TestGlxinfo Romain Naour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox