]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch
Linux 6.1.85
[thirdparty/kernel/stable-queue.git] / queue-6.6 / revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch
1 From d33487df070a4b09e933a892fbf9cb5c3e672f1f Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 1 Apr 2024 16:58:05 +0200
4 Subject: Revert "ALSA: emu10k1: fix synthesizer sample playback position and
5 caching"
6
7 From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
8
9 [ Upstream commit 03f56ed4ead162551ac596c9e3076ff01f1c5836 ]
10
11 As already anticipated in the original commit, playback was broken for
12 very short samples. I just didn't expect it to be an actual problem,
13 because we're talking about less than 1.5 milliseconds here. But clearly
14 such wavetable samples do actually exist.
15
16 The problem was that for such short samples we'd set the current
17 position beyond the end of the loop, so we'd run off the end of the
18 sample and play garbage.
19 This is a bigger (more audible) problem than the original one, which was
20 that we'd start playback with garbage (whatever was still in the cache),
21 which would be mostly masked by the note's attack phase.
22
23 So revert to the old behavior for now. We'll subsequently fix it
24 properly with a bigger patch series.
25 Note that this isn't a full revert - the dead code is not re-introduced,
26 because that would be silly.
27
28 Fixes: df335e9a8bcb ("ALSA: emu10k1: fix synthesizer sample playback position and caching")
29 Link: https://bugzilla.kernel.org/show_bug.cgi?id=218625
30 Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
31 Message-ID: <20240401145805.528794-1-oswald.buddenhagen@gmx.de>
32 Signed-off-by: Takashi Iwai <tiwai@suse.de>
33 Signed-off-by: Sasha Levin <sashal@kernel.org>
34 ---
35 sound/pci/emu10k1/emu10k1_callback.c | 7 ++-----
36 1 file changed, 2 insertions(+), 5 deletions(-)
37
38 diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c
39 index d36234b88fb42..941bfbf812ed3 100644
40 --- a/sound/pci/emu10k1/emu10k1_callback.c
41 +++ b/sound/pci/emu10k1/emu10k1_callback.c
42 @@ -255,7 +255,7 @@ lookup_voices(struct snd_emux *emu, struct snd_emu10k1 *hw,
43 /* check if sample is finished playing (non-looping only) */
44 if (bp != best + V_OFF && bp != best + V_FREE &&
45 (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) {
46 - val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch) - 64;
47 + val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch);
48 if (val >= vp->reg.loopstart)
49 bp = best + V_OFF;
50 }
51 @@ -362,7 +362,7 @@ start_voice(struct snd_emux_voice *vp)
52
53 map = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0);
54
55 - addr = vp->reg.start + 64;
56 + addr = vp->reg.start;
57 temp = vp->reg.parm.filterQ;
58 ccca = (temp << 28) | addr;
59 if (vp->apitch < 0xe400)
60 @@ -430,9 +430,6 @@ start_voice(struct snd_emux_voice *vp)
61 /* Q & current address (Q 4bit value, MSB) */
62 CCCA, ccca,
63
64 - /* cache */
65 - CCR, REG_VAL_PUT(CCR_CACHEINVALIDSIZE, 64),
66 -
67 /* reset volume */
68 VTFT, vtarget | vp->ftarget,
69 CVCF, vtarget | CVCF_CURRENTFILTER_MASK,
70 --
71 2.43.0
72