All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy White <jwhite@codeweavers.com>
To: linux-kernel@vger.kernel.org
Subject: Apparent bug in sound/oss/via82cxxx_audio.c GETOPTR ioctl
Date: Tue, 01 Mar 2005 11:35:37 -0600	[thread overview]
Message-ID: <4224A7E9.2070204@codeweavers.com> (raw)

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

Hi,

In trying to fix Wine's dsound implementation which uses mmap and
DSP_SND_GETOPTR to write data out to the driver, I uncovered what
appears to be a bug in the via82cxx_audio.c driver.

Specifically, via_sg_offset appears to return the number of bytes
not yet consumed within the current block; we use it to adjust from blocks
to a precise block count.  However, it appears as though it returns 0
to indicate that no bytes have been consumed.

I was seeing results where I would get an OPTR return along the
lines of 0x1c00, 0x1e00, 0x2800, and then 0x2100.  Needless to say,
having info.ptr go backwards causes Wine's code to have a serious
hissy fit.

The attached patch fixes the problem for me, but I would appreciate
review by an expert on this.

Cheers,

Jeremy

[-- Attachment #2: via82cxxx_audio.diff --]
[-- Type: text/x-patch, Size: 414 bytes --]

--- via82cxxx_audio.c	2005-03-01 11:27:07.525265232 -0600
+++ via82cxxx_audio.c.orig	2005-03-01 11:27:24.700654176 -0600
@@ -2831,8 +2831,6 @@
 		unsigned long extra;
 		info.ptr = atomic_read (&chan->hw_ptr) * chan->frag_size;
 		extra = chan->frag_size - via_sg_offset(chan);
-                if (extra == chan->frag_size)
-                    extra = 0;
 		info.ptr += extra;
 		info.bytes += extra;
 	} else {

                 reply	other threads:[~2005-03-01 17:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4224A7E9.2070204@codeweavers.com \
    --to=jwhite@codeweavers.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.