From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIiNW-0007z0-Mu for qemu-devel@nongnu.org; Tue, 25 Oct 2011 10:53:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIiNV-0003S9-MK for qemu-devel@nongnu.org; Tue, 25 Oct 2011 10:53:22 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:58152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIiNV-0003Rw-Hw for qemu-devel@nongnu.org; Tue, 25 Oct 2011 10:53:21 -0400 Received: by wyh15 with SMTP id 15so667218wyh.4 for ; Tue, 25 Oct 2011 07:53:20 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" Date: Tue, 25 Oct 2011 16:53:00 +0200 Message-Id: <1319554381-26230-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 1/2] hda: do not mix output and input streams, RHBZ #740493 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Windows 7 may use the same stream number for input and output. That will result in lot of garbage on playback. The hardcoded value of 4 needs to be in sync with GCAP streams description and IN/OUT registers. Signed-off-by: Marc-André Lureau --- hw/intel-hda.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 4272204..c6a3fec 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -389,14 +389,15 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output, { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, dev->qdev.parent_bus); IntelHDAState *d = container_of(bus, IntelHDAState, codecs); - IntelHDAStream *st = NULL; target_phys_addr_t addr; uint32_t s, copy, left; + IntelHDAStream *st; bool irq = false; - for (s = 0; s < ARRAY_SIZE(d->st); s++) { - if (stnr == ((d->st[s].ctl >> 20) & 0x0f)) { - st = d->st + s; + st = output ? d->st + 4 : d->st; + for (s = 0; s < 4; s++) { + if (stnr == ((st[s].ctl >> 20) & 0x0f)) { + st = st + s; break; } } -- 1.7.6.2