audio: hda fixes, timer tracing
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJbO2ebAAoJEEy22O7T6HE4PasP/2ZpHYzFudwqA5EOeJWOdm94 SzWesi2C2HDpocoov/i1UiKuNZvl4/oAQuZRgB8ynKBSkNLkAIZ6tV+SAMEaf0tZ CdUIre/26e+K/RwwZDCZNR6z99G+wSKDr0OuNKSbVfB8yCqPsDXPE95N1FU7Fm2Z yxi6brPHESXN5hNeX3TppP93jjGjplog6t7P6sDFg8iX4kmugDvm4ylP7fp2/vNO BU3CpyhGdSLENa+AGHIxOyopCW7QtMI7JMH6W2/6Lgc8MKB+jJSuFKO3rTYF5V8Q CiCZYgnK11D+bzRxH+I3TWaMjy0JZDyePl0v+1PWOkmkCU0PvNapYbKUbtNu+jn8 t+sG8cbCBEk9+0Fg0EvtqpmexMiIGrhLeEMrmNXtimBi6tMvNaLnEnthfJYpczX6 EZbDlX+jgGzGPhjBpDEfDnEf9SzsCl150rhZOVDn79dlYMAvo5Yk1iNvZclSSPxc psgkGQfSSl6nxV4g1rx2h2ciC1x4LN51pammJWMt1giRNGXD9tOfvspKw9n3a+K2 8U8b16jiNWSz0qv7F5cggHonU8g4nRDIM2+chuQDs7nugp80JdHQ14B7HbF5/SdG uQM3ZrwoMDQBlRxxlb7f0oz7AD902h44JfGake6W7Tvs9vYQHkOI7xZ/VnGpi35s eDMewdjPY37Igl4NPkkc =2iYJ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/audio-20180703-pull-request' into staging audio: hda fixes, timer tracing # gpg: Signature made Tue 03 Jul 2018 13:10:03 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20180703-pull-request: audio: add audio timer trace points audio/hda: fix CID 1393631 audio/hda: adjust larger gaps faster Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
6d8ad1614e
|
@ -29,6 +29,7 @@
|
|||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "sysemu/replay.h"
|
||||
#include "trace.h"
|
||||
|
||||
#define AUDIO_CAP "audio"
|
||||
#include "audio_int.h"
|
||||
|
@ -1129,6 +1130,10 @@ static void audio_pcm_print_info (const char *cap, struct audio_pcm_info *info)
|
|||
/*
|
||||
* Timer
|
||||
*/
|
||||
|
||||
static bool audio_timer_running;
|
||||
static uint64_t audio_timer_last;
|
||||
|
||||
static int audio_is_timer_needed (void)
|
||||
{
|
||||
HWVoiceIn *hwi = NULL;
|
||||
|
@ -1148,14 +1153,31 @@ static void audio_reset_timer (AudioState *s)
|
|||
if (audio_is_timer_needed ()) {
|
||||
timer_mod_anticipate_ns(s->ts,
|
||||
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + conf.period.ticks);
|
||||
if (!audio_timer_running) {
|
||||
audio_timer_running = true;
|
||||
audio_timer_last = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
trace_audio_timer_start(conf.period.ticks / SCALE_MS);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
timer_del(s->ts);
|
||||
if (audio_timer_running) {
|
||||
audio_timer_running = false;
|
||||
trace_audio_timer_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void audio_timer (void *opaque)
|
||||
{
|
||||
int64_t now, diff;
|
||||
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
diff = now - audio_timer_last;
|
||||
if (diff > conf.period.ticks * 3 / 2) {
|
||||
trace_audio_timer_delayed(diff / SCALE_MS);
|
||||
}
|
||||
audio_timer_last = now;
|
||||
|
||||
audio_run ("timer");
|
||||
audio_reset_timer (opaque);
|
||||
}
|
||||
|
|
|
@ -15,3 +15,8 @@ alsa_no_frames(int state) "No frames available and ALSA state is %d"
|
|||
# audio/ossaudio.c
|
||||
oss_version(int version) "OSS version = 0x%x"
|
||||
oss_invalid_available_size(int size, int bufsize) "Invalid available size, size=%d bufsize=%d"
|
||||
|
||||
# audio/audio.c
|
||||
audio_timer_start(int interval) "interval %d ms"
|
||||
audio_timer_stop(void) ""
|
||||
audio_timer_delayed(int interval) "interval %d ms"
|
||||
|
|
|
@ -189,7 +189,7 @@ struct HDAAudioState {
|
|||
|
||||
static inline int64_t hda_bytes_per_second(HDAAudioStream *st)
|
||||
{
|
||||
return 2 * st->as.nchannels * st->as.freq;
|
||||
return 2LL * st->as.nchannels * st->as.freq;
|
||||
}
|
||||
|
||||
static inline void hda_timer_sync_adjust(HDAAudioStream *st, int64_t target_pos)
|
||||
|
@ -203,6 +203,9 @@ static inline void hda_timer_sync_adjust(HDAAudioStream *st, int64_t target_pos)
|
|||
if (target_pos < -limit) {
|
||||
corr = -HDA_TIMER_TICKS;
|
||||
}
|
||||
if (target_pos < -(2 * limit)) {
|
||||
corr = -(4 * HDA_TIMER_TICKS);
|
||||
}
|
||||
if (corr == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue