[wdmaudiodev] Audio driver issues, "No speakers or headphones are plugged in."

  • From: Dylan Barrie <dylan.barrie@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 2 Nov 2023 16:18:37 -0700

Hello! First time posting on this list, and it's a pleasure to meet you
all. I was pointed here by the fantastic folks over at the OSR forums, who
mentioned what a great resource this list tends to be. I'm hoping I can
borrow some of your experience to get my audio driver behaving properly!

I've created a "toy" GPU <https://www.youtube.com/watch?v=JeUwAPe2pUE> that
has HDMI output hardware, and can support sending audio out over the HDMI
connection. I've created a PCIe card for the GPU and stood-up Windows
drivers for all of the graphics and rendering features, and the device is
viewed by the OS as a display-capable GPU. I'm now trying to get audio
working. Note that all of the audio hardware and internal (to the device)
configuration is already confirmed to work, I'm just trying to get that
integrated with the WDM audio infrastructure.

I'm basing my audio driver on Microsoft's sysvad sample driver, and am
running into some bizarre behavior that I haven't been able to find a
solution for. Since I am trying to support just the bare minimum necessary
to get what I need working, I've drastically stripped down the sample code
to be just a single render endpoint. Ideally the driver would support just
rendering raw PCM audio that is DMA'd to my device, and nothing more.

My driver declares both a WaveRT and a Topology filter, both of which I can
correctly instantiate inside of KS Studio and both of which validate
without issue. When my driver is installed, a new output device is also
created and I can select it in the Sound settings in the UI. However, its
volume is permanently fixed to zero and the taskbar sound icon shows an X.
Hovering over it reports "No speakers or headphones are plugged in."

My Topology filter's property handler handles the
KSPROPERTY_JACK_DESCRIPTION, KSPROPERTY_JACK_DESCRIPTION2, and
KSPROPERTY_JACK_SINK_INFO properties, and reports that the connection
status is connected. The topo filter contains two pins - an input pin that
is physically connected to the WaveRT instance, and an output pin that
represents the HDMI port. Only the output pin responds to the jack
properties.

My WaveRT filter also contains just two pins - a system render sink input
and an output bridge pin that connects to the topo filter. Internally, the
filter contains a Sum node, a Volume node, and a Mute node.

When the driver is first installed and when I attempt to change the volume,
I see it checking the WaveRT instance for supported formats, finding one,
creating a new instance of my WaveRTStream class, triggering a DMA buffer
allocation through AllocateBufferWithNotification, and then immediately
freeing that same buffer, closing the stream, and repeating the process. It
does this a dozen or so times before stopping and going idle. I never get
calls to change the stream's state or anything else that indicates it's
trying to do something that I'm not handling properly to cause this
behavior. I do see it also calling the topo property handler and reporting
back the jack status.

Does anyone have any idea what might be going on here? Is there any way for
me to have Windows report additional information about the behavior of the
audio systems that might help me track down what I'm doing wrong?

Thanks!

Other related posts: