From owner-freebsd-bugs Mon Feb 14 8:29:48 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by builder.freebsd.org (Postfix) with ESMTP id 0B67C3F8C for ; Mon, 14 Feb 2000 08:29:45 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA91558; Mon, 14 Feb 2000 08:30:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by builder.freebsd.org (Postfix) with ESMTP id 9ADA248A0 for ; Mon, 14 Feb 2000 08:20:40 -0800 (PST) Received: (from uucp@localhost) by sax.sax.de (8.9.3/8.9.3) with UUCP id RAA02724 for FreeBSD-gnats-submit@freebsd.org; Mon, 14 Feb 2000 17:20:47 +0100 (CET) Received: (from hohmuth@localhost) by olymp.sax.de (8.9.3/8.9.3) id RAA00803; Mon, 14 Feb 2000 17:16:15 +0100 (CET) (envelope-from hohmuth) Message-Id: <200002141616.RAA00803@olymp.sax.de> Date: Mon, 14 Feb 2000 17:16:15 +0100 (CET) From: Michael Hohmuth Reply-To: hohmuth@olymp.sax.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/16709: PATCH: make poll work for -STABLE's AudioPCI driver Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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