genodelabs / genode

Genode OS Framework
https://genode.org/
Other
1.08k stars 254 forks source link

run/avplay: Audio_out-session creation failed for both KERNEL=nova BOARD=pc and KERNEL=linux BOARD=linux #4995

Closed mewmew closed 11 months ago

mewmew commented 1 year ago

Edit: is this the expected behaviour? Perhaps there is no audio output mapped for the Qemu example nor the Linux host system when running run scenarios?


Having played around with SDL rendering (thanks @cnuke, @nfeske and @chelmuth for helping me get up to speed), I now wanted to take a spin at audio playback.

As a first step I wanted to get a minimal running example which plays a sound and then work backwards to try and understand all the components involved.

I tried running run/avplay with both KERNEL=linux BOARD=linux and KERNEL=nova BOARD=pc on staging (bad8d9d67e225411316251658fa3d04a34f55a99) and genode-world staging (genodelabs/genode-world@1a415947b5086d5ddfa525b75613b2e953aade3f) but ran into the same issue, namely:

[init -> avplay] Error: Audio_out-session creation failed (label="", ram_quota=535560, cap_quota=4, channel="front left")
[init -> avplay] Error: could not connect to 'Audio_out' service
detailed output for KERNEL=nova BOARD=pc ``` spawn qemu-system-x86_64 -display sdl -serial mon:stdio -m 800 -cdrom var/run/avplay.iso -machine q35 -cpu Nehalem-v2 -net nic,model=e1000,netdev=net0 -netdev user,id=net0 qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EDX.spec-ctrl [bit 26] Bender Version 0.9-beta7-51-g28ba2ad-dirty Patching BDA with I/O port 0x3f8. Bender: Hello World. hwp config: eeo=na irq=na hwp=na epp=na epb=na NOVA Microhypervisor v9-bad8d9d (x86_64): [gcc 12.3.0] [MBI2] [ 0] TSC:2932239 kHz BUS:1009718 kHz (measured) [ 0] CORE:00:00:0 6:1a:3:0 [1] Intel Core i7 9xx (Nehalem Core i7, IBRS update) Hypervisor NOVA (API v9) core image [0000000000100000,000000000334e000) binaries region [0000000000275000,000000000334e000) free for reuse detected physical memory: 0x0000000000000000 - size: 0x000000000009fc00 use physical memory: 0x0000000000000000 - size: 0x000000000009f000 detected physical memory: 0x0000000000100000 - size: 0x0000000031edf000 use physical memory: 0x0000000000100000 - size: 0x0000000031edf000 reserved memory: 0x2ed8f000 - size: 0x324f338 type=-2 reserved memory: 0x9fc00 - size: 0x400 type=2 reserved memory: 0xf0000 - size: 0x10000 type=2 reserved memory: 0x31fdf000 - size: 0x21000 type=2 reserved memory: 0xb0000000 - size: 0x10000000 type=2 reserved memory: 0xfed1c000 - size: 0x4000 type=2 reserved memory: 0xfffc0000 - size: 0x40000 type=2 reserved memory: 0xfd000000 - size: 0x3e8000 type=-5 reserved memory: 0x200000 - size: 0x4000 type=-1 reserved memory: 0x1000 - size: 0x1000 type=-1 reserved memory: 0x1000000 - size: 0x800000 type=-1 reserved memory: 0x1800000 - size: 0x1c00000 type=-1 reserved memory: 0x31fe22fc - size: 0x0 type=-3 Hypervisor reports 1x1 CPU Warning: CPU has no invariant TSC. mapping: affinity space -> kernel cpu id - package:core:thread remap (0x0) -> 0 - 0:0:0 boot cpu ROM modules: ROM: [000000002f240000,000000002f268bc8) acpi_drv ROM: [000000002f269000,000000002f8e2798) avcodec.lib.so ROM: [000000002ef05000,000000002ef08af8) avdevice.lib.so ROM: [000000002f934000,000000002f97bad8) avfilter.lib.so ROM: [000000002ef21000,000000002f0897f0) avformat.lib.so ROM: [000000002ef09000,000000002ef20b58) avplay ROM: [0000000031ed6000,0000000031eea4c0) avresample.lib.so ROM: [0000000031d54000,0000000031d7d118) avutil.lib.so ROM: [0000000031a0d000,0000000031a0da4a) config ROM: [0000000000030000,0000000000034000) core_log ROM: [000000002f8e3000,000000002f91ad10) decorator ROM: [0000000031a0c000,0000000031a0c366) decorator_init.config ROM: [0000000031f0b000,0000000031f0c7b1) drivers.config ROM: [000000003183e000,00000000318407df) en_us.chargen ROM: [0000000031a0e000,0000000031a47718) event_filter ROM: [0000000031df9000,0000000031df931a) event_filter.config ROM: [0000000031b22000,0000000031b22032) fb_drv.config ROM: [0000000031a48000,0000000031a4801d) focus ROM: [0000000031e64000,0000000031ed5750) init ROM: [0000000031805000,0000000031806cd0) init.xsd ROM: [0000000031807000,00000000318075f4) layouter.config ROM: [0000000031ba1000,0000000031c8db08) ld.lib.so ROM: [0000000031841000,0000000031a0b958) libc.lib.so ROM: [0000000031e1c000,0000000031e635a0) libm.lib.so ROM: [000000002f9ad000,00000000318042ef) mediafile ROM: [000000002f0b1000,000000002f11a0c8) nitpicker ROM: [000000002f11b000,000000002f23fbe8) pc_usb_host_drv ROM: [0000000031eeb000,0000000031f0a800) pci_decode ROM: [0000000031b23000,0000000031ba00a8) platform_drv ROM: [000000000002c000,000000000002f000) platform_info ROM: [000000002f97c000,000000002f9acac0) pointer ROM: [000000002f08a000,000000002f0b0ab8) ps2_drv ROM: [0000000031c8e000,0000000031cafb18) report_rom ROM: [0000000031dfa000,0000000031e1bc28) rom_filter ROM: [0000000031d80000,0000000031df7450) sdl.lib.so ROM: [0000000031df8000,0000000031df8542) special.chargen ROM: [0000000031808000,000000003183d9f0) swscale.lib.so ROM: [0000000031a49000,0000000031a64468) timer ROM: [0000000031a65000,0000000031b21b60) usb_hid_drv ROM: [0000000031f92000,0000000031fdd178) vesa_fb_drv ROM: [0000000031cb0000,0000000031d539c0) vfs.lib.so ROM: [0000000031f59000,0000000031f91ea8) window_layouter ROM: [0000000031f0d000,0000000031f58f60) wm ROM: [0000000031d7e000,0000000031d7f055) wm.config ROM: [000000002f91b000,000000002f933168) zlib.lib.so 36884K kernel memory Genode 23.08-34-gbad8d9d67e 712 MiB RAM and 63253 caps assigned to init [init -> avplay] avplay version 0.8, Copyright (c) 2003-2014 the Libav developers [init -> avplay] built on Sep 11 2023 21:45:51 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1) [init -> drivers -> usb_hid_drv] time-clocksource: dde_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns [init -> drivers -> usb_hid_drv] time-clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [init -> drivers -> usb_hid_drv] usbcore: registered new interface driver usbfs [init -> drivers -> usb_hid_drv] usbcore: registered new interface driver hub [init -> drivers -> usb_hid_drv] usbcore: registered new device driver usb [init -> drivers -> acpi_drv] Found MADT [init -> drivers -> acpi_drv] MADT IRQ 0 -> GSI 2 flags: 0 [init -> drivers -> acpi_drv] MADT IRQ 5 -> GSI 5 flags: 13 [init -> drivers -> acpi_drv] MADT IRQ 9 -> GSI 9 flags: 13 [init -> drivers -> acpi_drv] MADT IRQ 10 -> GSI 10 flags: 13 [init -> drivers -> acpi_drv] MADT IRQ 11 -> GSI 11 flags: 13 [init -> drivers -> acpi_drv] Found MCFG [init -> drivers -> acpi_drv] MCFG BASE 0xb0000000 seg 0x0 bus 0x0-0xff [init -> drivers -> acpi_drv] RSDT OEM 'BOCHS ', table id 'BXPC ', revision 1, creator 'BXPC' (1) [init -> avplay] Framebuffer has width=1024 height=768 [init -> drivers -> usb_hid_drv] time-clocksource: Switched to clocksource dde_counter [init -> drivers -> usb_hid_drv] usbcore: registered new interface driver usbhid [init -> drivers -> usb_hid_drv] usbhid-hid-core: USB HID core driver [init -> drivers -> usb_hid_drv] sched_clock: Marking stable (0, 520572000)->(688751000, -168179000) [init] Warning: avplay: no route to service "Audio_out" (label="avplay -> ") [init -> drivers -> usb_hid_drv] Warning: use compatibility mode: will claim all HID devices from USB report [init -> avplay] Error: Audio_out-session creation failed (label="", ram_quota=535560, cap_quota=4, channel="front left") [init -> avplay] Error: could not connect to 'Audio_out' service [init -> drivers -> acpi_drv] SMBIOS 3 table (entry point: 0x156d00 structures: 0xf6d20) [init -> drivers -> fb_drv] fb mapped to 0x6000 [init -> drivers -> ps2_drv] Warning: setting of mode indicators failed [init -> drivers -> ps2_drv] Using keyboard with scan code set 1 (xlate) [init -> drivers -> ps2_drv] detected ExPS/2 mouse - activating scroll-wheel and 5-button support [init -> avplay] SDL_OpenAudio: [init -> drivers -> fb_drv] Found: VESA BIOS version 3.0 [init -> drivers -> fb_drv] OEM: SeaBIOS VBE(C) 2011 [init -> avplay] Set video mode to: 640x400@32 [init -> drivers -> fb_drv] Found: physical frame buffer at 0xfd000000 size: 16777216 [init -> drivers -> fb_drv] fb mapped to 0x11000000 [init -> drivers -> fb_drv] using VESA mode 640x480@32 [init -> avplay] Seek to 62% ( 0:01:35) of total duration ( 0:02:35) ```
detailed output for KERNEL=linux BOARD=linux ``` Genode 23.08-34-gbad8d9d67e 17592186044415 MiB RAM and 18997 caps assigned to init [init -> avplay] avplay version 0.8, Copyright (c) 2003-2014 the Libav developers [init -> avplay] built on Sep 11 2023 21:45:51 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1) [init -> avplay] Framebuffer has width=1024 height=768 [init] Warning: avplay: no route to service "Audio_out" (label="avplay -> ") [init -> avplay] Error: Audio_out-session creation failed (label="", ram_quota=535560, cap_quota=4, channel="front left") [init -> avplay] Error: could not connect to 'Audio_out' service [init -> avplay] SDL_OpenAudio: [init -> avplay] Set video mode to: 640x400@32 ```

Steps to reproduce

git clone --branch staging https://github.com/genodelabs/genode.git
git clone  --branch staging https://github.com/genodelabs/genode-world.git genode/repos/world
cd genode
./tool/create_builddir x86_64
# edit build/x86_64/etc/build.conf to use required REPOSITORIES for run/avplay demo (gems + world + libports).
./tool/ports/prepare_port jitterentropy linux nova x86emu
./tool/ports/prepare_port libav libc sdl zlib
./tool/ports/prepare_port mesa
./tool/ports/prepare_port grub2
./tool/depot/create FORCE=1 REBUILD= UPDATE_VERSIONS=1 genodelabs/pkg/x86_64/drivers_interactive-pc genodelabs/pkg/x86_64/motif_wm genodelabs/bin/x86_64/base-nova genodelabs/bin/x86_64/init genodelabs/bin/x86_64/nitpicker CROSS_DEV_PREFIX=/usr/local/genode/tool/23.05/bin/genode-x86-
./tool/depot/create FORCE=1 REBUILD= UPDATE_VERSIONS=1 genodelabs/pkg/x86_64/drivers_interactive-linux genodelabs/bin/x86_64/base-linux CROSS_DEV_PREFIX=/usr/local/genode/tool/23.05/bin/genode-x86-

# for KERNEL=nova BOARD=pc
make -C build/x86_64 run/avplay KERNEL=nova BOARD=pc DEPOT=omit

# for KERNEL=linux BOARD=linux
make -C build/x86_64 run/avplay KERNEL=linux BOARD=linux DEPOT=omit

Cool demo

Exactly why there was an issue with the Audio-out session, I have no idea.

The graphics were way cool though!

genode_avplay

mewmew commented 1 year ago

On an (un)related note, building the run/avplay demo from scratch outlined all but one dependency required.

All of these commands were suggested automatically by the build system:

./tool/ports/prepare_port jitterentropy linux nova x86emu
./tool/ports/prepare_port libav libc sdl zlib
./tool/ports/prepare_port grub2
./tool/depot/create FORCE=1 REBUILD= UPDATE_VERSIONS=1 genodelabs/pkg/x86_64/drivers_interactive-pc genodelabs/pkg/x86_64/motif_wm genodelabs/bin/x86_64/base-nova genodelabs/bin/x86_64/init genodelabs/bin/x86_64/nitpicker CROSS_DEV_PREFIX=/usr/local/genode/tool/23.05/bin/genode-x86-
./tool/depot/create FORCE=1 REBUILD= UPDATE_VERSIONS=1 genodelabs/pkg/x86_64/drivers_interactive-linux genodelabs/bin/x86_64/base-linux CROSS_DEV_PREFIX=/usr/local/genode/tool/23.05/bin/genode-x86-

However, the mesa requirement was missing, which resulted in the following error when building the sdl library:

    COMPILE  events/SDL_events.o
In file included from /home/u/Desktop/genode_audio_play/genode/contrib/sdl-8543c5f3448ebea97afa84aee6691e38a78e756e/src/lib/sdl/src/events/../video/SDL_sysvideo.h:37,
                 from /home/u/Desktop/genode_audio_play/genode/contrib/sdl-8543c5f3448ebea97afa84aee6691e38a78e756e/src/lib/sdl/src/events/SDL_sysevents.h:24,
                 from /home/u/Desktop/genode_audio_play/genode/contrib/sdl-8543c5f3448ebea97afa84aee6691e38a78e756e/src/lib/sdl/src/events/SDL_events.c:28:
/home/u/Desktop/genode_audio_play/genode/contrib/sdl-8543c5f3448ebea97afa84aee6691e38a78e756e/include/SDL/SDL_opengl.h:44:10: fatal error: GL/gl.h: No such file or directory
   44 | #include <GL/gl.h>      /* Header File For The OpenGL Library */
      |          ^~~~~~~~~
compilation terminated.
make[3]: *** [/home/u/Desktop/genode_audio_play/genode/repos/base/mk/generic.mk:58: events/SDL_events.o] Error 1
make[2]: *** [var/libdeps:746: sdl.lib] Error 2
make[1]: *** [Makefile:336: gen_deps_and_build_targets] Error 2
make[1]: Leaving directory '/home/u/Desktop/genode_audio_play/genode/build/x86_64'
Error: Genode build failed
make: *** [Makefile:431: run/avplay] Error 252
make: Leaving directory '/home/u/Desktop/genode_audio_play/genode/build/x86_64'

In other words, mesa was required for sdl (specifically for the GL/gl.h header), but no suggestion was given to prepare the mesa port (i.e. ./tool/ports/prepare_port mesa).

These suggestion are very helpful, so I wanted to outline this missing dependency so that it can be included in the build system (if possible).

An example of the "suggestions" I'm talking about was given for grub2, as it is required to prepare to boot media for running the demo in Qemu.

Port not prepared or outdated:
  grub2

You can prepare respectively update it as follows:
  /home/u/Desktop/genode_audio_play/genode/tool/ports/prepare_port grub2
nfeske commented 1 year ago

Thanks @mewmew for reporting.

These suggestion are very helpful, so I wanted to outline this missing dependency so that it can be included in the build system (if possible).

Commit https://github.com/genodelabs/genode-world/commit/831c5497161f674083a48bbfce4dbe971ebd00af addresses this shortcoming.

The SDL audio backend accepts the missing audio-out connection, which is quite unusual for a Genode component. But the error messages appear nevertheless. The avplay.run script is not supposed to provide any audio though. To silence those messages, we could in principle wire up the component to the black_hole server.

Like the other run scripts based on gui_app.inc, avplay.run uses the bare-bones drivers_interactive pkgs for the most basic set of drivers needed for simple graphical scenarios. To enjoy audio, one is instead supposed to run the application directly on Sculpt. For avplay, there actually exists a pkg recipe at world/recipes/pkg/avplay.

Down the road, I think it would be best to support audio in Goa (using linux_audio_drv for testing on Linux), and successfully turn the gui_app.inc-based run scripts into Goa projects.

BTW, thank you for your note of appreciation about the little demo. It's this one: https://www.pouet.net/prod.php?which=16946 :-)