Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Tais M. Hansen" <tais.hansen@osd.dk>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: [Alsa-user] Upgrade problems -addendum
Date: Thu, 23 Jan 2003 11:03:00 +0100	[thread overview]
Message-ID: <s5hfzrkyyi3.wl@alsa2.suse.de> (raw)
In-Reply-To: <200301230135.58325.tais.hansen@osd.dk>

[-- Attachment #1: Type: text/plain, Size: 1802 bytes --]

At Thu, 23 Jan 2003 01:35:53 +0100,
Tais M. Hansen <tais.hansen@osd.dk> wrote:
> 
> On Wednesday 22 January 2003 17:23, Takashi Iwai wrote:
> > could you test the following two patches?
> > with the first one, the driver will calculate the current pointer like
> > VIA686 does.  if this is ok, no messages will appear.
> 
> The first patch makes artsd freeze the computer for about 10-20 seconds and 
> then aborts with a "cpu overload" message. ogg123 sometimes plays noise when 
> starting while speeding through the ogg-file, sometimes it plays normally. 
> Only ogg123 generated output in syslog which I've attached in 
> alsa-ogg123-syslog-p1.txt.gz.
 
ok, that's not good...

> 
> > the second one is to force to increase the index.  you'll see debug
> > messages, anyway, if POINTER_DEBUG is defined.
> 
> First, removing first patch and applying the second patch. Ogg123 freezes when 
> started with no sound and a lot of errors. Ctrl-C is caught after about 10 
> secs. Syslog output is attached in alsa-ogg123-syslog-p2.txt.gz. Artsd starts 
> but keep looping a short random piece of noise. No sound can be played/heard 
> when played. Killing artsd produces the output attached in 
> alsa-artsd-syslog-p2.txt.gz.
 
hmm...

> Applying both patches. Ogg123 and artsd behaves like when only the first patch 
> was applied. I let ogg123 run a little longer and noticed that sometimes 
> about half a second noise where played. Syslog errors from using ogg123 this 
> time is attached in alsa-ogg123-syslog-p1+p2.txt.gz.
 
ah, applying both has no effect..

> Note: POINTER_DEBUG was defined and the initial patch you sent was applied 
> throughout the test.

ok, the attached is the third trial.
please appply it solely without the preivous patches.

hope this works better...


ciao,

Takashi

[-- Attachment #2: via-pointer-test3.dif --]
[-- Type: application/octet-stream, Size: 2138 bytes --]

Index: alsa-kernel/pci/via82xx.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/via82xx.c,v
retrieving revision 1.21
diff -u -r1.21 via82xx.c
--- alsa-kernel/pci/via82xx.c	22 Jan 2003 14:21:05 -0000	1.21
+++ alsa-kernel/pci/via82xx.c	23 Jan 2003 09:40:01 -0000
@@ -232,6 +232,7 @@
 	struct snd_via_sg_table *idx_table;
 	/* for recovery from the unexpected pointer */
 	unsigned int lastpos;
+	unsigned int lastidx;
 	unsigned int bufsize;
 	unsigned int bufsize2;
 };
@@ -485,6 +486,7 @@
 	outb(0x00, port + VIA_REG_OFFSET_TYPE); /* for via686 */
 	outl(0, port + VIA_REG_OFFSET_CURR_PTR);
 	viadev->lastpos = 0;
+	viadev->lastidx = 0;
 }
 
 
@@ -589,17 +591,26 @@
 #endif
 		/* count register returns full size when end of buffer is reached */
 		if (size != count) {
-			snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n");
-			res = viadev->lastpos;
+			/* assume the next index */
+			idx = viadev->lastidx + 1;
+			if (idx >= viadev->tbl_entries)
+				idx = 0;
+			size = viadev->idx_table[idx].size;
+			res = viadev->idx_table[idx].offset + size - count;
+			if (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) {
+				snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n");
+				return viadev->lastpos;
+			}
 		} else {
 			res = viadev->idx_table[idx].offset + size;
 			if (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) {
 				snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), using last valid pointer\n");
-				res = viadev->lastpos;
+				return viadev->lastpos;
 			}
 		}
 	}
 	viadev->lastpos = res; /* remember the last positiion */
+	viadev->lastidx = idx;
 	if (res >= viadev->bufsize)
 		res -= viadev->bufsize;
 	return res;
@@ -648,7 +659,7 @@
 		return 0;
 	spin_lock(&chip->reg_lock);
 	count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset);
-	idx = count >> 24;
+	idx = (count >> 24) & viadev->tbl_entries;
 	count &= 0xffffff;
 	res = calc_linear_pos(viadev, idx, count);
 	spin_unlock(&chip->reg_lock);

  reply	other threads:[~2003-01-23 10:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200301221234.33054.tais.hansen@osd.dk>
     [not found] ` <200301221543.52285.tais.hansen@osd.dk>
     [not found]   ` <s5hznpt1bn2.wl@alsa2.suse.de>
     [not found]     ` <200301221647.05780.tais.hansen@osd.dk>
2003-01-22 16:23       ` [Alsa-user] Upgrade problems -addendum Takashi Iwai
2003-01-23  0:35         ` Tais M. Hansen
2003-01-23 10:03           ` Takashi Iwai [this message]
2003-01-23 11:15             ` Tais M. Hansen
2003-01-23 11:46               ` Takashi Iwai
2003-01-23 12:36                 ` Tais M. Hansen
2003-01-23 15:08                   ` Takashi Iwai
2003-01-23 17:50                     ` Tais M. Hansen
2003-01-23 18:07                       ` Takashi Iwai
2003-01-23 18:43                         ` Tais M. Hansen
2003-01-24  9:12                           ` Takashi Iwai
2003-01-24 12:41                             ` Tais M. Hansen
2003-01-24 13:30                               ` Takashi Iwai
2003-01-24 14:12                                 ` Tais M. Hansen
2003-01-24 15:45                                   ` Takashi Iwai
2003-01-24 16:40                                     ` Tais M. Hansen
2003-01-24 17:08                                       ` Takashi Iwai
2003-01-24 21:24                                         ` Tais M. Hansen
2003-01-27 10:42                                           ` Takashi Iwai
2003-01-27 14:42                                             ` Tais M. Hansen
2003-01-27 15:15                                               ` Takashi Iwai
2003-01-27 17:01                                                 ` Tais M. Hansen
2003-01-27 17:27                                                   ` Takashi Iwai
2003-01-28  0:43                                                     ` VIA823x testing Tais M. Hansen
2003-01-28  9:31                                                       ` Takashi Iwai
2003-01-28 13:25                                                         ` Tais M. Hansen
2003-01-28 16:21                                                           ` Takashi Iwai
2003-01-28 23:19                                                             ` Tais M. Hansen
2003-01-24 16:42                                     ` Re: [Alsa-user] Upgrade problems -addendum Tais M. Hansen

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=s5hfzrkyyi3.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tais.hansen@osd.dk \
    /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