diff mbox series

[3/6] mesa: enable a rich set of drivers for native builds

Message ID 20230316094102.2628727-3-alex@linutronix.de
State Accepted, archived
Commit 98d5c382e55910870d7e86dc83e3b7c742ea54cd
Headers show
Series [1/6] runqemu: direct mesa to use its own drivers, rather than ones provided by host distro | expand

Commit Message

Alexander Kanavin March 16, 2023, 9:40 a.m. UTC
Without this, the only available driver would be swrast
(without llvmpipe) which is far too slow to be practical,
and so qemu wouldn't be able to perform accelerated graphics.

The one major dependency pulled in by this change is llvm-native
which takes just under three minutes on my machine. If this is
undesitable, opengl can be removed from DISTRO_FEATURES_NATIVE.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/recipes-graphics/mesa/mesa.inc | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Ross Burton March 20, 2023, 5:10 p.m. UTC | #1
On 16 Mar 2023, at 09:40, Alexander Kanavin via lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org> wrote:
> 
> Without this, the only available driver would be swrast
> (without llvmpipe) which is far too slow to be practical,
> and so qemu wouldn't be able to perform accelerated graphics.
> 
> The one major dependency pulled in by this change is llvm-native
> which takes just under three minutes on my machine. If this is
> undesitable, opengl can be removed from DISTRO_FEATURES_NATIVE.

Grumble build time grumble.

Can we make this a packageconfig that is documented heavily in the local.conf sample?  My builder is headless so I disable the sdl backend in qemu-system-native already, and I’d be disabling this too as 99% of the time I just use runqemu nographic, but I don’t want to disable opengl entirely.

Ross
Alexander Kanavin March 20, 2023, 5:41 p.m. UTC | #2
On Mon, 20 Mar 2023 at 18:10, Ross Burton <Ross.Burton@arm.com> wrote:
> > The one major dependency pulled in by this change is llvm-native
> > which takes just under three minutes on my machine. If this is
> > undesitable, opengl can be removed from DISTRO_FEATURES_NATIVE.
>
> Grumble build time grumble.
>
> Can we make this a packageconfig that is documented heavily in the local.conf sample?  My builder is headless so I disable the sdl backend in qemu-system-native already, and I’d be disabling this too as 99% of the time I just use runqemu nographic, but I don’t want to disable opengl entirely.

You can disable native opengl on the native distro feature level, but
keep target opengl enabled, would that work? I'm not sure if there is
a use case for native mesa without the drivers.

Even on headless hosts you can use egl-headless, and then a vnc client
will show you the qemu display.

Alex
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 775aab9297..dd15046438 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -89,6 +89,8 @@  PACKAGECONFIG = " \
 	${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'video-codecs', '', d)} \
 "
 
+PACKAGECONFIG:append:class-native = "gallium-llvm r600"
+
 # "gbm" requires "opengl"
 PACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled"
 
@@ -102,8 +104,10 @@  PACKAGECONFIG[dri3] = "-Ddri3=enabled, -Ddri3=disabled, xorgproto libxshmfence"
 # Vulkan drivers need dri3 enabled
 # amd could be enabled as well but requires gallium-llvm with llvm >= 3.9
 VULKAN_DRIVERS = ""
-VULKAN_DRIVERS:append:x86:class-target = ",intel"
-VULKAN_DRIVERS:append:x86-64:class-target = ",intel"
+VULKAN_DRIVERS:append:x86 = ",intel"
+VULKAN_DRIVERS:append:x86-64 = ",intel"
+# i686 is a 32 bit override for mesa-native
+VULKAN_DRIVERS:append:i686 = ",intel"
 VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
 VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broadcom', '', d)}"
 PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')}, -Dvulkan-drivers='',glslang-native vulkan-loader vulkan-headers"
@@ -149,8 +153,10 @@  PACKAGECONFIG[zink] = ""
 GALLIUMDRIVERS = "swrast"
 # gallium swrast was found to crash Xorg on startup in x32 qemu
 GALLIUMDRIVERS:x86-x32 = ""
-GALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus"
-GALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus"
+GALLIUMDRIVERS:append:x86 = ",i915,iris,crocus"
+GALLIUMDRIVERS:append:x86-64 = ",i915,iris,crocus"
+# i686 is a 32 bit override for mesa-native
+GALLIUMDRIVERS:append:i686 = ",i915,iris,crocus"
 
 GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
 GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
@@ -162,8 +168,10 @@  GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'zink', ',zink', '
 # radeonsi requires LLVM
 GALLIUMDRIVERS_RADEONSI = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
 GALLIUMDRIVERS_LLVM = "r300,nouveau${GALLIUMDRIVERS_RADEONSI}"
-GALLIUMDRIVERS_LLVM:append:x86:class-target = ",svga"
-GALLIUMDRIVERS_LLVM:append:x86-64:class-target = ",svga"
+GALLIUMDRIVERS_LLVM:append:x86 = ",svga"
+GALLIUMDRIVERS_LLVM:append:x86-64 = ",svga"
+# i686 is a 32 bit override for mesa-native
+GALLIUMDRIVERS_LLVM:append:i686 = ",svga"
 
 PACKAGECONFIG[r600] = ""
 PACKAGECONFIG[virgl] = ""