All of 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: Re: [Alsa-user] Upgrade problems -addendum
Date: Thu, 23 Jan 2003 12:46:22 +0100	[thread overview]
Message-ID: <s5hadhsytpt.wl@alsa2.suse.de> (raw)
In-Reply-To: <200301231215.29675.tais.hansen@osd.dk>

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

At Thu, 23 Jan 2003 12:15:26 +0100,
Tais M. Hansen <tais.hansen@osd.dk> wrote:
> 
> On Thursday 23 January 2003 11:03, Takashi Iwai wrote:
> > ok, the attached is the third trial.
> > please appply it solely without the preivous patches.
> 
> I'm assuming the very first via8233a-fix.dif is still supposed to be applied. 
> (won't work without it anyway)
 
yes.  the patch had been already applied to cvs.

> > hope this works better...
> 
> Well... Ogg123 freezes the same way as with test1. Artsd no longer fails with 
> "cpu overload", but it's constantly busy and can't play sound. There's 
> nothing to see in syslog but there's suddenly a bunch of output in the debug 
> log.
> 
> This is ogg123:
> 
> Jan 23 12:05:25 proficio kernel: ALSA ../alsa-kernel/core/pcm_lib.c:123: 
> Unexpected hw_pointer value (stream = 0, delta: -1024, max jitter = 4096): 
> wrong interrupt acknowledge?
> Jan 23 12:05:35 proficio last message repeated 429 times
> Jan 23 12:05:35 proficio kernel: ALSA ../alsa-kernel/core/pcm_lib.c:2117: 
> playback write error (DMA or IRQ trouble?)
> 
> And this is artsd:
> 
> Jan 23 12:06:31 proficio kernel: ALSA ../alsa-kernel/core/pcm_lib.c:123: 
> Unexpected hw_pointer value (stream = 0, delta: -1024, max jitter = 8192): 
> wrong interrupt acknowledge?
> Jan 23 12:06:41 proficio last message repeated 206 times
 
hmm, it'd better to start from the beginning.

please try the attached patch (solely).
this will generate bunch of debug messages at each interrupt but won't
improve any behavior.
so, it would be enough to run only once or twice if you got bad
playback.
from the obtained log, we'll be able to know whether the interrupt is
properly generated, or at which condition, the read of register value
fails.


ciao,

Takashi

[-- Attachment #2: via-pointer-debug.dif --]
[-- Type: application/octet-stream, Size: 3497 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 11:41:45 -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;
 }
 
 
@@ -512,10 +514,13 @@
 	/* check status for each stream */
 	for (i = 0; i < chip->num_devs; i++) {
 		viadev_t *viadev = &chip->devs[i];
-		if (inb(chip->port + viadev->reg_offset) & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG)) {
-			outb(VIA_REG_STAT_FLAG | VIA_REG_STAT_EOL, VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset);
+		unsigned long port = chip->port + viadev->reg_offset;
+		unsigned char status = inb(port) & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG);
+		if (status) {
+			outb(status, port); /* ack */
 			if (viadev->substream && viadev->running) {
 				spin_unlock(&chip->reg_lock);
+				printk("via: period_elapsed [%d]\n", i);
 				snd_pcm_period_elapsed(viadev->substream);
 				spin_lock(&chip->reg_lock);
 			}
@@ -582,24 +587,25 @@
 	size = viadev->idx_table[idx].size;
 	res = viadev->idx_table[idx].offset + size - count;
 
-	/* check the validity of the calculated position */
-	if (size < count || (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2))) {
 #ifdef POINTER_DEBUG
-		printk("fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count);
+	printk("via: idx = %i/%i, lastpos = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count);
 #endif
+	/* check the validity of the calculated position */
+	if (size < count || (res < viadev->lastpos && (res >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2))) {
 		/* 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;
+			printk("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;
+				printk("invalid via82xx_cur_ptr (2), using last valid pointer\n");
+				return viadev->lastpos;
 			}
 		}
 	}
 	viadev->lastpos = res; /* remember the last positiion */
+	viadev->lastidx = idx;
 	if (res >= viadev->bufsize)
 		res -= viadev->bufsize;
 	return res;
@@ -648,7 +654,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 11:46 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
2003-01-23 11:15             ` Tais M. Hansen
2003-01-23 11:46               ` Takashi Iwai [this message]
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=s5hadhsytpt.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.