]> git.proxmox.com Git - qemu.git/commitdiff
hda: do not mix output and input streams, RHBZ #740493
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Tue, 25 Oct 2011 14:53:00 +0000 (16:53 +0200)
committermalc <av1474@comtv.ru>
Tue, 25 Oct 2011 15:15:07 +0000 (19:15 +0400)
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 <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
hw/intel-hda.c

index 4272204e035afaba74dadef1f68c6f371db24d21..c6a3fecb57b7a85c80b088e067f2e0ffc0bb1749 100644 (file)
@@ -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;
         }
     }