From gd78059@sac.sfbay.sun.com Fri Dec 11 09:46:41 2009
Received: from sunmail6brm.central.sun.com (sunmail6brm.Central.Sun.COM [129.147.4.169])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id nBBHkfVc023467
	for <psarc-ext@sac.sfbay.sun.com>; Fri, 11 Dec 2009 09:46:41 -0800 (PST)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail6brm.central.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.4) with ESMTP id nBBHkf2k013933;
	Fri, 11 Dec 2009 11:46:41 -0600 (CST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KUI0050T1DTUV00@brm-avmta-1.central.sun.com>; Fri,
 11 Dec 2009 10:46:41 -0700 (MST)
Received: from dm-sfbay-02.sfbay.sun.com ([129.146.11.31])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KUI000AL1DSBD30@brm-avmta-1.central.sun.com>; Fri,
 11 Dec 2009 10:46:40 -0700 (MST)
Received: from sac.sfbay.sun.com (sac.SFBay.Sun.COM [129.146.226.132])
	by dm-sfbay-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.4)
 with ESMTP id nBBHke1s006329; Fri, 11 Dec 2009 09:46:40 -0800 (PST)
Received: from sac.sfbay.sun.com (localhost [127.0.0.1])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id nBBHkcuu023462; Fri,
 11 Dec 2009 09:46:38 -0800 (PST)
Received: (from gd78059@localhost)
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit) id nBBHkcXG023458; Fri,
 11 Dec 2009 09:46:38 -0800 (PST)
Date: Fri, 11 Dec 2009 09:46:38 -0800 (PST)
From: "Garrett D'Amore - sun microsystems" <gd78059@sac.sfbay.sun.com>
Subject: Decoupling audio device interrupts [PSARC/2009/674 FastTrack timeout
 12/18/2009]
To: PSARC-ext@sun.com
Cc: audio-oss-ext@sun.com
Message-id: <200912111746.nBBHkcXG023458@sac.sfbay.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Status: RO
Content-Length: 4707


Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI
This information is Copyright 2009 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 Decoupling audio device interrupts
    1.2. Name of Document Author/Supplier:
	 Author:  Garrett D'Amore
    1.3  Date of This Document:
	11 December, 2009
4. Technical Description

Abstract

We propose to move processing of the audio data (that performed by
audio_consume() and audio_produce()) from device interrupts to a regular
framework internal periodic function.  There are changes to the Boomer DDI
(PSARC 2008/318) as a result.


Detail

Historically, the audio framework (both the legacy SADA framework and Boomer)
have used device-driven interrupts to drive processing of audio data.  While
this has worked very well, it turns out that there can be challenges from
this as different devices have different interrupt needs, and driving the
mixing framework from a device interrupt makes the framework subject to the
interrupt requirements of the device.  Ultimately, this either prevents, or
makes much more difficult, some of the changes we would like to make for
virtualization, Sun Ray, and automatic hotplug in the future.

It turns out that the nature of audio data is that the streaming data
moves at a regular fixed rate.  So we are able to drive use a timer-driven
event instead of a device specific interrupt to perform our internal
audio processing. 

This also lets us decouple the rate at which the audio framework processes
audio data from from any configuration requirements of the device.  (There
are still some minor requirements... the device must be able to pre-buffer
at least enough audio data to cover one and a half periodic intervals, and
the device must be able to report its DMA position.  Additionally, if the
device needs deeper buffering, it must report that to the framework via
the audio_engine_playahead(9E) entry point in its audio_engine_ops vector.

It turns out that for most devices, we are simply able to remove all hardware
interrupt handling, eliminating about 20% of the code complexity for most
typical AC'97 drivers.

Initially, we are using a ddi_periodic (see ddi_periodic_add) to drive
the internal framework.  This limits us to a 10 msec granularity/latency.
In the future, we might investigate other options to use higher resolution
clocking and lower latencies.  (The use of ddi_periodic's is a framework
internal detail, and not necessarily intrinsic to this case.)


DDI Changes

The audio_engine_open() entry point in the audio_engine_ops vector is
changed to have the following signature:  

	int (*audio_engine_open)(void *state, int flags, uint_t *nframesp,
	    caddr_t *buf);

The nframesp argument is new, and is the total number of frames that buf
can hold.  (It replaces the former nfragsp and fragframesp members, which
used to report the individual fragment size and total number of fragments.
With this change, the audio framework has no need to know if the engine
fragments data into regular blocks, nor any of said details.  The framework
is totally decoupled from this particular set of device details with this
change.)

We also have removed the audio_engine_consume() and audio_engine_produce()
functions.  Device drivers no longer have any need to trigger this
functionality.

Finally, we have bumped the value AUDIO_ENGINE_VERSION to 2.  While the
changes to the DDI are only being made to Consolidation Private interfaces,
this prevents someone from trying to mix-and-match old devices with the
new framework.  (Generally they would not load anyway, due to a failure
to resolve the audio_engine_produce or audio_engine_consume symbols, but
this just makes it absolutely certain.)

As with the previous Boomer DDI, these interfaces remain Consolidation
Private.


Release Binding

We are seeking Patch binding for these changes, dependent upon Boomer (PSARC
2008/318).  While the Boomer case was integrated with Minor binding, and while
we are dependent on Boomer, there is some risk that an actual minor release
may be cut with Boomer before this change is integrated.   In such an
event, we believe it would be approriate for the changes described here
to be integrated in a patch to such a release.

Note that this case explicitly does _not_ seek to alter the original
commitment of Boomer, so it would not be appropriate to deliver this
as a patch to a release that did not already have Boomer integrated. 
(I.e. it would not be appropriate to backport this to Solaris 10.)

6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


From Sebastien.Roy@sun.com Wed Dec 16 07:49:53 2009
Received: from sunmail3mpk.sfbay.sun.com (sunmail3mpk.SFBay.Sun.COM [129.146.11.52])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id nBGFnrKT021282
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 16 Dec 2009 07:49:53 -0800 (PST)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail3mpk.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.4) with ESMTP id nBGFnpAa006813;
	Wed, 16 Dec 2009 07:49:52 -0800 (PST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KUR00H0B5B4QH00@brm-avmta-1.central.sun.com>; Wed,
 16 Dec 2009 08:49:52 -0700 (MST)
Received: from brmea-mail-4.sun.com ([192.18.98.36])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KUR00AVP5B3VX50@brm-avmta-1.central.sun.com>; Wed,
 16 Dec 2009 08:49:51 -0700 (MST)
Received: from fe-amer-10.sun.com ([192.18.109.80])
	by brmea-mail-4.sun.com (8.13.6+Sun/8.12.9) with ESMTP id nBGFnpf3003042; Wed,
 16 Dec 2009 15:49:51 +0000 (GMT)
Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KUR00C003FTOR00@mail-amer.sun.com>; Wed, 16 Dec 2009 08:49:51 -0700 (MST)
Received: from [129.148.174.103] ([unknown] [129.148.174.103])
 by mail-amer.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KUR000I95AXGQ40@mail-amer.sun.com>; Wed,
 16 Dec 2009 08:49:46 -0700 (MST)
Date: Wed, 16 Dec 2009 10:46:56 -0500
From: Sebastien Roy <Sebastien.Roy@sun.com>
Subject: Re: Decoupling audio device interrupts [PSARC/2009/674 FastTrack
 timeout 12/18/2009]
In-reply-to: <200912111746.nBBHkcXG023458@sac.sfbay.sun.com>
Sender: Sebastien.Roy@sun.com
To: "Garrett D'Amore - sun microsystems" <gd78059@sac.sfbay.sun.com>
Cc: PSARC-ext@sun.com, audio-oss-ext@sun.com
Message-id: <1260978416.17127.34.camel@strat>
Organization: Sun Microsystems
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200912111746.nBBHkcXG023458@sac.sfbay.sun.com>
Status: RO
Content-Length: 413

On Fri, 2009-12-11 at 09:46 -0800, Garrett D'Amore - sun microsystems
wrote:
> Abstract
> 
> We propose to move processing of the audio data (that performed by
> audio_consume() and audio_produce()) from device interrupts to a regular
> framework internal periodic function.  There are changes to the Boomer DDI
> (PSARC 2008/318) as a result.

I've reviewed this case and have no issues to bring up.  +1

-Seb



From gdamore@sun.com Wed Dec 16 10:15:13 2009
Received: from sunmail6brm.central.sun.com (sunmail6brm.Central.Sun.COM [129.147.4.169])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id nBGIFDu6026849
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 16 Dec 2009 10:15:13 -0800 (PST)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail6brm.central.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.4) with ESMTP id nBGIFAL4027920
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Wed, 16 Dec 2009 12:15:12 -0600 (CST)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KUR0064BC1CZN00@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 16 Dec 2009 10:15:12 -0800 (PST)
Received: from sca-es-mail-1.sun.com ([192.18.43.132])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KUR00MDYC1BPKC0@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Wed,
 16 Dec 2009 10:15:11 -0800 (PST)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id nBGIFBCw000934	for
 <PSARC-ext@sun.com>; Wed, 16 Dec 2009 10:15:11 -0800 (PST)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KUR00200AHPJF00@fe-sfbay-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 16 Dec 2009 10:15:11 -0800 (PST)
Received: from [192.168.251.11] ([unknown] [76.93.15.33])
 by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KUR00L9VC118B70@fe-sfbay-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 16 Dec 2009 10:15:02 -0800 (PST)
Date: Wed, 16 Dec 2009 10:15:01 -0800
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: PSARC 2009/674 Decoupling audio device interrupts
Sender: Garrett.Damore@sun.com
To: PSARC-ext <PSARC-ext@sun.com>
Message-id: <4B2923A5.7020501@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
User-Agent: Thunderbird 2.0.0.23 (X11/20091013)
Status: RO
Content-Length: 54

This case was approved at PSARC today.

    - Garrett

