Bug 263385 - Sound pops using Realtek ALC897 Intel Alder Lake.
Summary: Sound pops using Realtek ALC897 Intel Alder Lake.
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-multimedia (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2022-04-18 01:05 UTC by Amar Takhar
Modified: 2024-03-06 15:04 UTC (History)
6 users (show)

See Also:


Attachments
Output of /dev/sndstat (6.67 KB, text/plain)
2022-04-18 01:05 UTC, Amar Takhar
no flags Details
Verbose output from snd_hda (3.83 KB, text/plain)
2022-04-20 15:45 UTC, Amar Takhar
no flags Details
Verbose output from uaudio (2.99 KB, text/plain)
2022-04-20 15:45 UTC, Amar Takhar
no flags Details
sndstat for uaudio. (6.67 KB, text/plain)
2022-04-20 15:46 UTC, Amar Takhar
no flags Details
messages from kern.hz=2000 snd.verbose=4 using SPDIF optical output (8.70 KB, text/plain)
2022-04-26 05:10 UTC, Amar Takhar
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amar Takhar 2022-04-18 01:05:25 UTC
Created attachment 233292 [details]
Output of /dev/sndstat

I am having sound pops on an Asus PRIME Z690-P WIFI using a i9 12900KF CPU.  The sound hardware is an ALC897.  Video card is an NVIDIA 3060.

I get frequent audio pops that seems to somehow be related to the video card.  If I am playing a video through a web browser and scroll fast in another tab or window I get pops that coincide with my scrolling.  Also if I probe the video card say with 'vdpauinfo' it will do it as well.

There are no sounds when audio is not playing.  I'm exporting the audio via Optical (ch6) to an external amp.  This does happen with headphones directly connected to the back audio port (ch4) as well.

It's most noticeable playing through Firefox while being extremely faint/quick playing the same video downloaded with mpv.

With hw.snd.verbose set to 4 I get these messages on my console:

  kernel: pcm4: WARNING: PCMDIR_PLAY DMA completion too fast/slow ! hwptr=896, old=896 delta=0 amt=0 ready=2048 free=0
  kernel: pcm4: WARNING: PCMDIR_PLAY DMA completion too fast/slow ! hwptr=1152, old=1152 delta=0 amt=0 ready=2048 free=0
  kernel: pcm4: WARNING: PCMDIR_PLAY DMA completion too fast/slow ! hwptr=256, old=256 delta=0 amt=0 ready=2048 free=0

Attached is output from /dev/sndstat

Thank you.
Comment 1 Amar Takhar 2022-04-18 03:24:56 UTC
I just tried Chromium using the analog pcm device (ch4) directly not using pulseaudio the problem is the same just quieter.
Comment 2 Amar Takhar 2022-04-20 15:44:48 UTC
I tried a USB audio card and I still have the same problem though it's nowhere near as bad and it doesn't trigger the PCMDIR_PLAY warnings like using snd_hda does.  I attached a few more files.  The verbose output for both snd_hda and uaudio as well as the sndstat output from uaudio.

When using snd_hda the audio sounds blown out from too much gain on some videos this doesn't exist with the uaudio device that I can tell.  I did try messing with hw.snd.vpc_0db it doesn't change anything the popping is still there just quieter or louder.
Comment 3 Amar Takhar 2022-04-20 15:45:24 UTC
Created attachment 233357 [details]
Verbose output from snd_hda
Comment 4 Amar Takhar 2022-04-20 15:45:47 UTC
Created attachment 233358 [details]
Verbose output from uaudio
Comment 5 Amar Takhar 2022-04-20 15:46:10 UTC
Created attachment 233359 [details]
sndstat for uaudio.
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2022-04-20 16:18:36 UTC
Does the popping go away if you do:

sysctl machdep.idle=spin

--HPS
Comment 7 Amar Takhar 2022-04-20 16:37:20 UTC
(In reply to Hans Petter Selasky from comment #6)

I tested with both snd_hda and uaudio it doesn't appear to make any difference at all.  Thanks for the suggestion.  I'm starting to wonder if this is part of a deeper issue that forced me to disable the E cores in my CPU see #261169

I don't seem to be having any other issues though that I can tell.
Comment 8 rkoberman 2022-04-21 05:42:32 UTC
This just a "Me, too.", but maybe not quite the same.

I nave a Lenovo L-15 (Intel) with a CometLake processor (Comet Lake PCH-LP cAVS). It sounds much like you are hearing.

I would not call them "pops". They sound more like very brief (maybe a tenth of a second or less) that happen pretty regularly like there is a buffer underflow issue.

It reminds my of about 20 years ago with clocking issue. It was playing the audio faster than the proper bit rate. Unfortunately, I don't recall details. It is possible that it may have even been on my old Sun SPARCstation 1, though I think it was more likely on an Intel laptop.

In any case, it this is the same issue, it is not specific to the ALC897.

While I'm happy to try things and test, I am moving in less than  week, so may be rather slow in responding.
Comment 9 Amar Takhar 2022-04-26 05:09:23 UTC
I decided to give setting kern.hz=2000 a shot.  If I just watch a video it's fine the problem is actually gone.  As soon as I move a window in X it is far, far worse.  It breaks up in tune to moving my window and will actually drown the sound out if I move it fast enough.  This is using optical SPIDF out.  If I use my external USB audio the problem is the same but the issue is deadened I'm assuming this is just a difference in the drivers.

I've attached output from messages when I changed kern.hz=2000 for the SPIDF output.  Not sure if this is a symptom of the problem or from adjusting kern.hz.
Comment 10 Amar Takhar 2022-04-26 05:10:13 UTC
Created attachment 233491 [details]
messages from kern.hz=2000 snd.verbose=4 using SPDIF optical output
Comment 11 Lars Henrik Ørn 2022-10-13 19:56:11 UTC
HI

I have almost the same hardware ASUS PRIME Z690-P D4. I had also sound issues related to Firefox. Solution is to compile Firefox without pulseaudio support. And us alsa instead. I have seen others metioning problems with the recent change to pulseaudio in default firefox config.

Have a nice day
Comment 12 rkoberman 2022-10-15 02:55:09 UTC
(In reply to Lars Henrik Ørn from comment #11)
I have had the same problem with my Comet Lake system (10th gen.). It only effects Firefox. On my old Sandy Lake system, I fixed it by switching to OSS backend, but that did not work for the Comet Lake nr my current Alder Lake system. If I play the same title pulled downloaded by yt-dlp on a local media player (mpv), it plays correctly.

The issue is clearly tied to youtube.
Comment 13 Amar Takhar 2022-12-14 20:20:45 UTC
For anyone still having this issue all my audio problems and my e-core kpanics were fixed with this patch on both 13.1 and CURRENT:

  https://kib.kiev.ua/git/gitweb.cgi?p=deviant3.git;a=commit;h=5d72240a8777b26d5e0a7d2d26bb919d05f60002

Mine was not specific to Youtube or Firefox it happened in all forms of audio though web browsers were the worst.
Comment 14 Graham Perrin freebsd_committer freebsd_triage 2022-12-14 22:35:02 UTC
(In reply to comment #13)

Context: <https://lists.freebsd.org/archives/freebsd-current/2022-November/002850.html>
Comment 15 Amar Takhar 2022-12-19 18:44:55 UTC
The patch hasn't fixed the problem.  I've noticed on reboot audio will be fine for some hours until it gets progressively worse and just stays at a certain point.

All the log messages are still the same that I've already attached to this ticket.  Doesn't seem to be a motherboard issue as I tried another Alder Lake machine using a Gigabyte board that has the same problem.