*/
#include "qemu/osdep.h"
-#include "qemu/atomic.h"
#include "hw/hw.h"
#include "hw/pci/pci.h"
#include "intel-hda.h"
}
trace_hda_audio_adjust(st->node->name, target_pos);
- atomic_fetch_add(&st->buft_start, corr);
+ st->buft_start += corr;
}
static void hda_audio_input_timer(void *opaque)
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- int64_t buft_start = atomic_fetch_add(&st->buft_start, 0);
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t buft_start = st->buft_start;
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t wanted_rpos = hda_bytes_per_second(st) * (now - buft_start)
/ NANOSECONDS_PER_SECOND;
}
rpos += chunk;
to_transfer -= chunk;
- atomic_fetch_add(&st->rpos, chunk);
+ st->rpos += chunk;
}
out_timer:
{
HDAAudioStream *st = opaque;
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t to_transfer = audio_MIN(B_SIZE - (wpos - rpos), avail);
uint32_t read = AUD_read(st->voice.in, st->buf + start, chunk);
wpos += read;
to_transfer -= read;
- atomic_fetch_add(&st->wpos, read);
+ st->wpos += read;
if (chunk != read) {
break;
}
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- int64_t buft_start = atomic_fetch_add(&st->buft_start, 0);
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t buft_start = st->buft_start;
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t wanted_wpos = hda_bytes_per_second(st) * (now - buft_start)
/ NANOSECONDS_PER_SECOND;
}
wpos += chunk;
to_transfer -= chunk;
- atomic_fetch_add(&st->wpos, chunk);
+ st->wpos += chunk;
}
out_timer:
{
HDAAudioStream *st = opaque;
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t to_transfer = audio_MIN(wpos - rpos, avail);
uint32_t written = AUD_write(st->voice.out, st->buf + start, chunk);
rpos += written;
to_transfer -= written;
- atomic_fetch_add(&st->rpos, written);
+ st->rpos += written;
if (chunk != written) {
break;
}