Skip to contentSkip to conversation

Audio 20180703 patches

GIT PULL Applied Gerd Hoffmann 2 participants 5 messages Jul 3, 2018 – Jul 4, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/audio-20180703-pull-request

for you to fetch changes up to 1a961e785f59eba1fa8e06d5b1ebc84927b4b3a3:

audio: add audio timer trace points (2018-07-03 11:46:47 +0200)

----------------------------------------------------------------
audio: hda fixes, timer tracing

----------------------------------------------------------------

Gerd Hoffmann (3):
audio/hda: adjust larger gaps faster
audio/hda: fix CID 1393631
audio: add audio timer trace points

 audio/audio.c        | 28 +++++++++++++++++++++++++---
 hw/audio/hda-codec.c |  5 ++++-
 audio/trace-events   |  5 +++++
 3 files changed, 34 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL 1/3] audio/hda: adjust larger gaps faster

Message-id: [email protected]

---
 hw/audio/hda-codec.c | 3 +++
 1 file changed, 3 insertions(+)
hw/audio/hda-codec.c +3 -0
index 31c66d4255..9f630fa37f 100644
@@ -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;
     }
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 2/3] audio/hda: fix CID 1393631

In reply to Gerd Hoffmann

Message-id: [email protected]

---
 hw/audio/hda-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/audio/hda-codec.c +1 -1
index 9f630fa37f..2b58c3505b 100644
@@ -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)
Signature · 1 line
2.9.3
#3 lore raw

[Qemu-devel] [PULL 3/3] audio: add audio timer trace points

In reply to Gerd Hoffmann

Track audio timer starts and stops. Also trace delayed audio timer calls.

Message-id: [email protected]

---
 audio/audio.c      | 28 +++++++++++++++++++++++++---
 audio/trace-events |  5 +++++
 2 files changed, 30 insertions(+), 3 deletions(-)
audio/audio.c +25 -3
index d6e91901aa..1ace47f510 100644
@@ -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);
-    }
-    else {
-        timer_del (s->ts);
+        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 {
+        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);
 }
audio/trace-events +5 -0
index d37639e611..c986469319 100644
@@ -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"
Signature · 1 line
2.9.3
#4 lore raw
In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/audio-20180703-pull-request

Quoted 8 lines

for you to fetch changes up to 1a961e785f59eba1fa8e06d5b1ebc84927b4b3a3:

audio: add audio timer trace points (2018-07-03 11:46:47 +0200)

----------------------------------------------------------------
audio: hda fixes, timer tracing

----------------------------------------------------------------

Applied, thanks.

-- PMM