Date: Mon, 14 Feb 2000 17:16:15 +0100 (CET) From: Michael Hohmuth <hohmuth@olymp.sax.de> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/16709: PATCH: make poll work for -STABLE's AudioPCI driver Message-ID: <200002141616.RAA00803@olymp.sax.de>
next in thread | raw e-mail | index | archive | help
>Number: 16709
>Category: kern
>Synopsis: PATCH: make poll work for -STABLE's AudioPCI driver
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Feb 14 08:30:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Michael Hohmuth
>Release: FreeBSD 3.4-STABLE i386
>Organization:
private FreeBSD site
>Environment:
FreeBSD 3.4-STABLE as of Feb 11, 2000
>Description:
The AudioPCI driver in /sys/pci/es1370.c did not implement the poll
interface. This resulted in sluggish GUI performance of some audio
tools like XMMS.
>How-To-Repeat:
xmms -p somefile.mp3
>Fix:
Here's a patch:
--- es1370.c.orig Mon Feb 14 16:20:42 2000
+++ es1370.c Mon Feb 14 16:57:38 2000
@@ -628,7 +628,69 @@
static int
es_select(dev_t i_dev, int rw, struct proc * p)
{
- return (ENOSYS);
+ int unit, c = 1;
+ snddev_info *d ;
+ u_long flags;
+
+/* dev = minor(i_dev); */
+/* d = get_snddev_info(dev, &unit); */
+ unit = UNIT(minor(i_dev));
+ d = &pcm_info[unit];
+
+ if (d == NULL ) /* should not happen! */
+ return (ENXIO) ;
+
+ {
+ /*
+ * if the user selected a block size, then we want to use the
+ * device as a block device, and select will return ready when
+ * we have a full block.
+ * In all other cases, select will return when 1 byte is ready.
+ */
+ int lim = 1;
+
+ int revents = 0 ;
+ if (rw & (POLLOUT | POLLWRNORM) ) {
+ if ( d->flags & SND_F_HAS_SIZE )
+ lim = d->play_blocksize ;
+ /* XXX fix the test here for half duplex devices */
+ if (1 /* write is compatible with current mode */) {
+ flags = spltty();
+ if (d->dbuf_out.dl) {
+ es_wr_dmaupdate(d);
+ }
+ c = d->dbuf_out.fl ;
+ if (c < lim) /* no space available */
+ selrecord(p, & (d->wsel));
+ else
+ revents |= rw & (POLLOUT | POLLWRNORM);
+ splx(flags);
+ }
+ }
+ if (rw & (POLLIN | POLLRDNORM)) {
+ if ( d->flags & SND_F_HAS_SIZE )
+ lim = d->rec_blocksize ;
+ /* XXX fix the test here */
+ if (1 /* read is compatible with current mode */) {
+ flags = spltty();
+ if ( d->dbuf_in.dl == 0 ) /* dma idle, restart it */
+ dma_rdintr(d);
+ else {
+ es_rd_dmaupdate(d);
+ }
+ c = d->dbuf_in.rl ;
+ if (c < lim) /* no data available */
+ selrecord(p, & (d->rsel));
+ else
+ revents |= rw & (POLLIN | POLLRDNORM);
+ splx(flags);
+ }
+ DEB(printf("sndselect on read: %d >= %d flags 0x%08x\n",
+ c, lim, d->flags));
+ return c < lim ? 0 : 1 ;
+ }
+ return revents;
+ }
}
@@ -746,6 +808,15 @@
if(es_debug > 0) printf("es_callback reason %d speed %d \t",reason ,d->play_speed);
switch(reason & SND_CB_REASON_MASK) {
+ case SND_CB_DMAUPDATE:
+ if (reason & SND_CB_WR)
+ es_wr_dmaupdate(d);
+ else if (reason & SND_CB_RD)
+ es_rd_dmaupdate(d);
+ else return -1;
+
+ break;
+
case SND_CB_INIT:
/* if(es_debug > 0) printf("case SND_CB_INIT\n"); */
if (d->type == ES1371_PCI_ID){
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002141616.RAA00803>
