summary refs log tree commit diff
path: root/include/sound
diff options
context:
space:
mode:
authorDavid Henningsson <coding@diwic.se>2021-05-15 09:15:33 +0200
committerTakashi Iwai <tiwai@suse.de>2021-05-17 16:02:44 +0200
commit08fdced60ca08e34e316a3ab945636fcdfcbc973 (patch)
tree2ebf36f380c9bafbb78b43bb32de7118c8f4d529 /include/sound
parentbac59054544ebdb89f05c5b9598ca9cb2dea72ce (diff)
downloadlinux-08fdced60ca08e34e316a3ab945636fcdfcbc973.tar.gz
ALSA: rawmidi: Add framing mode
This commit adds a new framing mode that frames all MIDI data into
32-byte frames with a timestamp.

The main benefit is that we can get accurate timestamps even if
userspace wakeup and processing is not immediate.

Testing on a Celeron N3150 with this mode has a max jitter of 2.8 ms,
compared to the in-kernel seq implementation which has a max jitter
of 5 ms during idle and much worse when running scheduler stress tests
in parallel.

Signed-off-by: David Henningsson <coding@diwic.se>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210515071533.55332-1-coding@diwic.se
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/rawmidi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 334842daa904..989e1517332d 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -81,6 +81,8 @@ struct snd_rawmidi_substream {
 	bool opened;			/* open flag */
 	bool append;			/* append flag (merge more streams) */
 	bool active_sensing;		/* send active sensing when close */
+	unsigned int framing;		/* whether to frame input data */
+	unsigned int clock_type;	/* clock source to use for input framing */
 	int use_count;			/* use counter (for output) */
 	size_t bytes;
 	struct snd_rawmidi *rmidi;