0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-07-20 10:01:53 +00:00
Files
Lakka-LibreELEC/packages/linux/patches/raspberrypi-5.10.y/linux-020-eld-constraints-for-compressed-formats.patch
Tomáš Kelemen 198dd04be7 RPi-Composite: initial commit (#2037)
this brings images suited to work OOB for RPi3/4/5 with CRT TV sets. it
comes with preconfigured shaders, core options, readable font, ...
see https://www.lakka.tv/articles/2024/05/02/rpi-composite/

- add new RPiX-Composite devices under RPi project
- RPi3/4-Composite use own kernel config
- RPi5-Composite uses kernel config of RPi5
- remove linux.arm.conf broken symlinks from some devices
- move VULKAN enable to device options
- add splash screens for 480/576 height
- glibc: match kernel version for RPi3/4 (using 5.10.y with "fake" 240p
  patch)
- adjust DEVICE conditions to only match first 4 characters / first 4
  characters + wildcard (various places)
- add specific assets, configs, shaders in retroarch package
- retroarch: adjust default configuration
- linux: add 5.10.y kernel (used by RPi3/4-Composite, see above)
- linux: add patches for 5.10.y kernel
- mkimage: add additional information into cmdline.txt and
  retroarch-overrides.txt
- firstboot.sh: add output (logged in fs-resize.log)
- firstboot.sh: prepend processed overrides with hash
- firstboot.sh: copy core configurations to storage partition
- firstboot.sh: rework wifi autoconfig script
- retroarch: add full default config file and apply changes in the
  package file directly to the config for individual systems (solves
  some issues with core/game overrides when there is no value in the
  config and user creates overrides in first run of retroarch, then
  these overrides are also stored in default config)
2025-03-07 01:09:47 +01:00

92 lines
2.5 KiB
Diff

From a2769637a9b98c6809d4d25a3a20447a3ff7b23a Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Fri, 19 Mar 2021 12:14:17 +0100
Subject: [PATCH] ALSA: pcm: fix ELD constraints for some compressed audio
formats
The SADs of compressed formats like AC3 and DTS contain the channel
and sample rate info of the audio data inside the compressed stream,
but when building constraints we must use the rates and formats used
to pass through the stream. eg 2ch 48kHz for AC3.
Signed-off-by: Matthias Reichl <hias@horus.com>
---
sound/core/pcm_drm_eld.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/sound/core/pcm_drm_eld.c b/sound/core/pcm_drm_eld.c
index 4b5faae5d16e5..e7ec7a8b9d420 100644
--- a/sound/core/pcm_drm_eld.c
+++ b/sound/core/pcm_drm_eld.c
@@ -6,6 +6,7 @@
#include <drm/drm_edid.h>
#include <sound/pcm.h>
#include <sound/pcm_drm_eld.h>
+#include <linux/hdmi.h>
static const unsigned int eld_rates[] = {
32000,
@@ -17,9 +18,40 @@ static const unsigned int eld_rates[] = {
192000,
};
+static unsigned int sad_format(const u8 *sad)
+{
+ return (sad[0] & 0x78) >> 3;
+}
+
static unsigned int sad_max_channels(const u8 *sad)
{
- return 1 + (sad[0] & 7);
+ switch (sad_format(sad)) {
+ case HDMI_AUDIO_CODING_TYPE_AC3:
+ case HDMI_AUDIO_CODING_TYPE_DTS:
+ case HDMI_AUDIO_CODING_TYPE_EAC3:
+ return 2;
+ case HDMI_AUDIO_CODING_TYPE_DTS_HD:
+ case HDMI_AUDIO_CODING_TYPE_MLP:
+ return 8;
+ default:
+ return 1 + (sad[0] & 7);
+ }
+}
+
+static unsigned int sad_rate_mask(const u8 *sad)
+{
+ switch (sad_format(sad)) {
+ case HDMI_AUDIO_CODING_TYPE_AC3:
+ case HDMI_AUDIO_CODING_TYPE_DTS:
+ return 0x07; // 32-48kHz
+ case HDMI_AUDIO_CODING_TYPE_EAC3:
+ return 0x7f; // 32-192kHz
+ case HDMI_AUDIO_CODING_TYPE_DTS_HD:
+ case HDMI_AUDIO_CODING_TYPE_MLP:
+ return 0x60; // 176.4, 192kHz
+ default:
+ return sad[1] & 0x7f;
+ }
}
static int eld_limit_rates(struct snd_pcm_hw_params *params,
@@ -42,7 +74,7 @@ static int eld_limit_rates(struct snd_pcm_hw_params *params,
* requested number of channels.
*/
if (c->min <= max_channels)
- rate_mask |= sad[1];
+ rate_mask |= sad_rate_mask(sad);
}
}
@@ -70,7 +102,7 @@ static int eld_limit_channels(struct snd_pcm_hw_params *params,
rate_mask |= BIT(i);
for (i = drm_eld_sad_count(eld); i > 0; i--, sad += 3)
- if (rate_mask & sad[1])
+ if (rate_mask & sad_rate_mask(sad))
t.max = max(t.max, sad_max_channels(sad));
}
--
2.20.1