Now I wanna pre-allocate contiguous block of memory for this DMA audio buffer, cause I think this random can be in slow buffer pushing. I think so, cause of it no underruns on ALSA level, I already debugged it.
Mark Nagaev
@Mark Nagaev
Best posts made by Mark Nagaev
Latest posts made by Mark Nagaev
-
RE: Problem with i2s driver and ALSA, underrun
-
RE: Problem with i2s driver and ALSA, underrun
Ok I add some fixes, now it works better, but not perfect on 192/24.
First, I increased period_bytes_max, it can be 65535 bytes cause it limmited only by dma transfer.
Second, buffer_bytes_max and prealloc_buffer_size, I increased them too, now it ~4MB.
Third, dma_data->maxburst = 4, cause it can be transferred 16 bytes, after threshold reached.Now it's randomly can be ~100 underruns while playing, but most od the time it's clear
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3262.796745] underrun 4
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3278.822202] underrun 69
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3291.029872] underrun 19
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3303.158453] underrun 3
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3316.406874] underrun 1
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3328.456432] underrun 1
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3341.206080] underrun 100
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3352.909575] underrun 1
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3365.469447] underrun 0
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo
[ 3388.133126] underrun 1 -
RE: Contiguous Memory Allocator in kernel
@Modest-Polykarpovich not my own, but I'm still trying to improve existin driver, here my post, I add some of my fixes, It works better with them, but not perfect with rates higher than 96kHz, I really wanna play bit-perfect 192/24 on i2s Omega2
-
RE: Contiguous Memory Allocator in kernel
@Modest-Polykarpovich 16 MB just for experiment, but I need about 4 MB of contiguous memory for my DMA audio buffer, of course it works in kernel-mode. If it's interesting for u, u can read this article
-
Contiguous Memory Allocator in kernel
Hi, I'm trying to pre-allocate contiguos block of memory.
In kernel_menuconfig I'm selecting cma enabled in Kernel type submenu, and in Device drivers->Generic driver option I'm selecting DMA Contiguous Memory Allocator, trying to apply 16 MB size zone with max page order 6 (I have 16 kB kernel page size). Building image and downloadin in Omega2p.
When it starts i have message in terminal:[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] cma: Failed to reserve 128 MiBand after :
[ 0.000000] Memory: 124736K/131072K available (4117K kernel code, 226K rwdata, 944K rodata, 208K init, 245K bss, 6336K reserved, 0K cma-reserved)
Idk why it trying reserve 128 MiB, I added in device-tree of Omega2p this block to reserve 64 MB of memory:
memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; }; reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; /* global autoconfigured region for contiguous allocations */ linux,cma { compatible = "shared-dma-pool"; reusable; reg = <0x4000000 0x4000000>; alignment = <0x2000>; linux,cma-default; }; };
It still failing to reserve, if turn on debug messages:
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] cma: dma_contiguous_reserve(limit 08000000)
[ 0.000000] cma: dma_contiguous_reserve: reserving 16 MiB for global area
[ 0.000000] cma: cma_declare_contiguous(size 0x01000000, base 0x00000000, limit 0x08000000 alignment 0x00000000)
[ 0.000000] cma: Failed to reserve 128 MiBAnyway, mb someone successed with contiguous allocation for DMA buffers?
-
RE: Network configuration
@Douglas-Kryder oh, u mean it's apsta mode? Yeah it's really poor speed, u can connect it by eth and use only ap mode it'll be 40-50mbps for each device. But in my situation, I don't wanna be connected to internet on omega, it must be endpoint with audio server.
-
RE: Network configuration
@Douglas-Kryder yeah, but I wanna use omega like an access point wifi, it's eazier to connect several phones to it and stream from each of them, u don't need to reconfigure wifi of omega. It's simply for usability
-
RE: Network configuration
@Lucas-Gozalvez yeah, the same, it's all in OS of smartphones, can't do anything with it, i think
-
RE: Network configuration
I wanna use shairport synch for streaming airplay music over wifi and cellular connection for all applications on my iphone for example
-
Network configuration
I need to connect my phone to a wifi omega2 that is not connected to the internet. Is there a way to connect to omega2 with Wifi, yet continue to the the cellular connection for internet data?
Mb any network configuration to say to phone stay connected by wifi but use 4g for internet?