alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: linux@audioscience.com
To: patch@alsa-project.org
Cc: tiwai@suse.de,
	Eliot Blennerhassett <eblennerhassett@audioscience.com>,
	alsa-devel@alsa-project.org
Subject: [PATCH 6/7] Keep HPI buffer pointers in sync with ALSA after prewrite.
Date: Tue, 23 Mar 2010 21:14:26 +1300	[thread overview]
Message-ID: <1269332067-25959-7-git-send-email-linux@audioscience.com> (raw)
In-Reply-To: <1269332067-25959-1-git-send-email-linux@audioscience.com>

From: Eliot Blennerhassett <eblennerhassett@audioscience.com>

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
---
 pci/asihpi/hpi6205.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/pci/asihpi/hpi6205.c b/pci/asihpi/hpi6205.c
index a8a84b3..6db1c58 100644
--- a/pci/asihpi/hpi6205.c
+++ b/pci/asihpi/hpi6205.c
@@ -1051,26 +1051,18 @@ static void OutStreamWrite(
 	struct bus_master_interface *interface = phw->pInterfaceBuffer;
 	struct hpi_hostbuffer_status *status;
 	long dwSpaceAvailable;
+
 	if (!phw->OutStreamHostBufferSize[phm->wObjIndex]) {
-		/* there  is no BBM buffer */
+		/* there  is no BBM buffer, write via message */
 		HW_Message(pao, phm, phr);
 		return;
 	}
-	HPI_InitResponse(phr, phm->wObject, phm->wFunction, 0);
 
+	HPI_InitResponse(phr, phm->wObject, phm->wFunction, 0);
 	status = &interface->aOutStreamHostBufferStatus[phm->wObjIndex];
 
-/* Set this to 1 to force this OutStremWrite() call to write data to the */
-/* adapter's buffers for the first write following stream reset. */
-#define OLD_STYLE_PREWRITE (1)
-
-	/* check whether we need to send the format to the DSP */
 	if (phw->flagOStreamJustReset[phm->wObjIndex]) {
-#if OLD_STYLE_PREWRITE
-		int nPartialWrite = 0;
-		unsigned int nOriginalSize = 0;
-#endif
-
+		/* Format can only change after reset. Must tell DSP. */
 		u16 wFunction = phm->wFunction;
 		phw->flagOStreamJustReset[phm->wObjIndex] = 0;
 		phm->wFunction = HPI_OSTREAM_SET_FORMAT;
@@ -1078,11 +1070,18 @@ static void OutStreamWrite(
 		phm->wFunction = wFunction;
 		if (phr->wError)
 			return;
+	}
+#if 1
+	if (phw->flagOStreamJustReset[phm->wObjIndex]) {
+		/* First OutStremWrite() call following reset will write data to the
+		   adapter's buffers, reducing delay before stream can start
+		 */
+		int nPartialWrite = 0;
+		unsigned int nOriginalSize = 0;
 
-#if OLD_STYLE_PREWRITE
 		/* Send the first buffer to the DSP the old way. */
 		/* Limit size of first transfer - */
-		/* hopefully this will not not be triggered. */
+		/* expect that this will not usually be triggered. */
 		if (phm->u.d.u.Data.dwDataSize > HPI6205_SIZEOF_DATA) {
 			nPartialWrite = 1;
 			nOriginalSize = phm->u.d.u.Data.dwDataSize;
@@ -1096,6 +1095,8 @@ static void OutStreamWrite(
 		 * buffer update task reads data from the host BBM buffer)
 		 */
 		status->dwAuxiliaryDataAvailable = phm->u.d.u.Data.dwDataSize;
+		status->dwHostIndex += phm->u.d.u.Data.dwDataSize;
+		status->dwDSPIndex += phm->u.d.u.Data.dwDataSize;
 
 		/* if we did a full write, we can return from here. */
 		if (!nPartialWrite)
@@ -1106,8 +1107,8 @@ static void OutStreamWrite(
 		phm->u.d.u.Data.dwDataSize =
 			nOriginalSize - HPI6205_SIZEOF_DATA;
 		phm->u.d.u.Data.pbData += HPI6205_SIZEOF_DATA;
-#endif
 	}
+#endif
 
 	dwSpaceAvailable = OutStreamGetSpaceAvailable(status);
 	if (dwSpaceAvailable < (long)phm->u.d.u.Data.dwDataSize) {
-- 
1.7.0.rc0.8.ge3f67d

  parent reply	other threads:[~2010-03-23  8:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23  8:14 [PATCH 0/7] snd-asihpi playback improvement + others linux
2010-03-23  8:14 ` [PATCH 1/7] Remove obsolete comment Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> linux
2010-03-23 14:07   ` Takashi Iwai
2010-03-23  8:14 ` [PATCH 2/7] - const correct pointer parameters. - add a new stream state wait and function linux
2010-03-23  8:14 ` [PATCH 3/7] Reinit response size for every msg/response transaction. Minor fix const ptr linux
2010-03-23  8:14 ` [PATCH 4/7] Bump lib version due to added and removed APIs linux
2010-03-23  8:14 ` [PATCH 5/7] Use adapter properties for stream buffer constraints. Default to less logging, remove VPRINTK3 Log buffer info in decimal linux
2010-03-23  8:14 ` linux [this message]
2010-03-23  8:14 ` [PATCH 7/7] Support mic control caching. Move an enum out of public api linux
2010-03-23 14:07 ` [PATCH 0/7] snd-asihpi playback improvement + others Takashi Iwai
2010-03-24 11:06   ` Takashi Iwai
2010-03-24 20:05     ` Eliot Blennerhassett

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=1269332067-25959-7-git-send-email-linux@audioscience.com \
    --to=linux@audioscience.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=eblennerhassett@audioscience.com \
    --cc=patch@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).