From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Yanan Wang" <wangyanan55@huawei.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
qemu-rust@nongnu.org, "Zhao Liu" <zhao1.liu@intel.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Jason Wang" <jasowang@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-s390x@nongnu.org,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: [PATCH 09/10] hw/audio/hda-codec: Remove HDAAudioState::use_timer field
Date: Fri, 2 May 2025 01:01:27 +0200 [thread overview]
Message-ID: <20250501230129.2596-10-philmd@linaro.org> (raw)
In-Reply-To: <20250501230129.2596-1-philmd@linaro.org>
The HDAAudioState::use_timer boolean was only set in the
hw_compat_2_12[] array, via the 'use-timer=false' property.
We removed all machines using that array, lets remove that
property and all the code around it, like the compatibility
callbacks.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/audio/hda-codec.c | 91 +++++++-------------------------------------
1 file changed, 13 insertions(+), 78 deletions(-)
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 66edad280f2..92e1fe65827 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -187,7 +187,6 @@ struct HDAAudioState {
/* properties */
uint32_t debug;
bool mixer;
- bool use_timer;
};
static inline uint32_t hda_bytes_per_second(HDAAudioStream *st)
@@ -366,58 +365,6 @@ static void hda_audio_output_cb(void *opaque, int avail)
hda_timer_sync_adjust(st, (wpos - rpos) - (B_SIZE >> 1));
}
-static void hda_audio_compat_input_cb(void *opaque, int avail)
-{
- HDAAudioStream *st = opaque;
- int recv = 0;
- int len;
- bool rc;
-
- while (avail - recv >= sizeof(st->compat_buf)) {
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- len = AUD_read(st->voice.in, st->compat_buf + st->compat_bpos,
- sizeof(st->compat_buf) - st->compat_bpos);
- st->compat_bpos += len;
- recv += len;
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- break;
- }
- }
- rc = hda_codec_xfer(&st->state->hda, st->stream, false,
- st->compat_buf, sizeof(st->compat_buf));
- if (!rc) {
- break;
- }
- st->compat_bpos = 0;
- }
-}
-
-static void hda_audio_compat_output_cb(void *opaque, int avail)
-{
- HDAAudioStream *st = opaque;
- int sent = 0;
- int len;
- bool rc;
-
- while (avail - sent >= sizeof(st->compat_buf)) {
- if (st->compat_bpos == sizeof(st->compat_buf)) {
- rc = hda_codec_xfer(&st->state->hda, st->stream, true,
- st->compat_buf, sizeof(st->compat_buf));
- if (!rc) {
- break;
- }
- st->compat_bpos = 0;
- }
- len = AUD_write(st->voice.out, st->compat_buf + st->compat_bpos,
- sizeof(st->compat_buf) - st->compat_bpos);
- st->compat_bpos += len;
- sent += len;
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- break;
- }
- }
-}
-
static void hda_audio_set_running(HDAAudioStream *st, bool running)
{
if (st->node == NULL) {
@@ -428,16 +375,14 @@ static void hda_audio_set_running(HDAAudioStream *st, bool running)
}
st->running = running;
trace_hda_audio_running(st->node->name, st->stream, st->running);
- if (st->state->use_timer) {
- if (running) {
- int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- st->rpos = 0;
- st->wpos = 0;
- st->buft_start = now;
- timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
- } else {
- timer_del(st->buft);
- }
+ if (running) {
+ int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ st->rpos = 0;
+ st->wpos = 0;
+ st->buft_start = now;
+ timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
+ } else {
+ timer_del(st->buft);
}
if (st->output) {
AUD_set_active_out(st->voice.out, st->running);
@@ -474,7 +419,6 @@ static void hda_audio_set_amp(HDAAudioStream *st)
static void hda_audio_setup(HDAAudioStream *st)
{
- bool use_timer = st->state->use_timer;
audio_callback_fn cb;
if (st->node == NULL) {
@@ -485,21 +429,13 @@ static void hda_audio_setup(HDAAudioStream *st)
fmt2name[st->as.fmt], st->as.freq);
if (st->output) {
- if (use_timer) {
- cb = hda_audio_output_cb;
- timer_del(st->buft);
- } else {
- cb = hda_audio_compat_output_cb;
- }
+ cb = hda_audio_output_cb;
+ timer_del(st->buft);
st->voice.out = AUD_open_out(&st->state->card, st->voice.out,
st->node->name, st, cb, &st->as);
} else {
- if (use_timer) {
- cb = hda_audio_input_cb;
- timer_del(st->buft);
- } else {
- cb = hda_audio_compat_input_cb;
- }
+ cb = hda_audio_input_cb;
+ timer_del(st->buft);
st->voice.in = AUD_open_in(&st->state->card, st->voice.in,
st->node->name, st, cb, &st->as);
}
@@ -805,7 +741,7 @@ static void hda_audio_reset(DeviceState *dev)
static bool vmstate_hda_audio_stream_buf_needed(void *opaque)
{
HDAAudioStream *st = opaque;
- return st->state && st->state->use_timer;
+ return st->state;
}
static const VMStateDescription vmstate_hda_audio_stream_buf = {
@@ -861,7 +797,6 @@ static const Property hda_audio_properties[] = {
DEFINE_AUDIO_PROPERTIES(HDAAudioState, card),
DEFINE_PROP_UINT32("debug", HDAAudioState, debug, 0),
DEFINE_PROP_BOOL("mixer", HDAAudioState, mixer, true),
- DEFINE_PROP_BOOL("use-timer", HDAAudioState, use_timer, true),
};
static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
--
2.47.1
next prev parent reply other threads:[~2025-05-01 23:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-01 23:01 [PATCH 00/10] hw/core: Remove hw_compat[] array for 2.10, 2.11 and 2.12 machines Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 01/10] hw/s390x/s390-virtio-ccw: Remove the deprecated 2.10 and 2.11 machine types Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 02/10] hw/core/machine: Remove hw_compat_2_10[] array Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 03/10] hw/input/virtio-input: Remove VirtIOInputHID::wheel_axis field Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 04/10] hw/core/machine: Remove hw_compat_2_11[] array Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 05/10] hw/timer/hpet: Remove HPETState::hpet_offset_saved field Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 06/10] hw/net/e1000: Remove unused E1000_FLAG_TSO flag Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 07/10] hw/s390x/s390-virtio-ccw: Remove the deprecated 2.12 machine type Philippe Mathieu-Daudé
2025-05-01 23:01 ` [PATCH 08/10] hw/core/machine: Remove hw_compat_2_12[] array Philippe Mathieu-Daudé
2025-05-01 23:01 ` Philippe Mathieu-Daudé [this message]
2025-05-01 23:01 ` [PATCH 10/10] hw/display/vga-pci: Do not expose the 'global-vmstate' property Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250501230129.2596-10-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=eduardo@habkost.net \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).