OSDN Git Service

ALSA: x86: Refactor PCM process engine
authorTakashi Iwai <tiwai@suse.de>
Thu, 2 Feb 2017 23:01:18 +0000 (00:01 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 6 Feb 2017 11:21:10 +0000 (12:21 +0100)
commite1b239f371c0c745542cb8108d085ec728e8a69c
tree5b79452798a340db7c2aabded15f4edf92465c80
parent1cf05ba2cafa079a943c2cbae51b2f2c2e247466
ALSA: x86: Refactor PCM process engine

This is again a big rewrite of the driver; now it touches the code to
process PCM stream transfers.

The most fundamental change is that the driver may support more than
four periods.  Instead of keeping the same index between both the ring
buffer (with the fixed four buffer descriptors) and the PCM buffer
periods, we keep difference indices for both (bd_head and pcm_head
fields).  In addition, when the periods are more than four, we need to
track both head and next indices.  That is, we now have three indices:
bd_head, pcm_head and pcm_filled.

Also, the driver works better for periods < 4, too: the remaining BDs
out of four are marked as invalid, so that the hardware skips those
BDs in its loop.

By this flexibility, we can use even ALSA-lib dmix plugin, which
requires 16 periods as default.

The buffer size could be up to 20bit, so the max buffer size was
increased accordingly.  However, the buffer pre-allocation is kept as
the old value (600kB) as default.  The reason is the limited number of
BDs: since it doesn't suffice for the useful SG page management that
can fit with the usual page allocator like some other drivers, we have
to still allocate continuous pages, hence we shouldn't take too big
memories there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/x86/intel_hdmi_audio.c
sound/x86/intel_hdmi_audio.h
sound/x86/intel_hdmi_lpe_audio.h