diff mbox

[1/2] hda: do not mix output and input streams, RHBZ #740493

Message ID 1319554381-26230-1-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Oct. 25, 2011, 2:53 p.m. UTC
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>
---
 hw/intel-hda.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Comments

malc Oct. 25, 2011, 3:17 p.m. UTC | #1
On Tue, 25 Oct 2011, Marc-Andr? Lureau wrote:

> 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>
> ---
>  hw/intel-hda.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)

Applied.

[..snip..]
diff mbox

Patch

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;
         }
     }