[RFC] Remove PCM xfer_align parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch removes the PCM xfer_align parameter.
It's still present and won't break the kernel ABI.

Note that this patch won't be applied cleanly to HG, as it's generated
in the middle of my patch stack (to fix snd_pcm_lib_write1 blocking
bug).


Takashi

diff -r 3caa0db34608 Documentation/DocBook/writing-an-alsa-driver.tmpl
--- a/Documentation/DocBook/writing-an-alsa-driver.tmpl	Wed Dec 19 14:37:30 2007 +0100
+++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl	Wed Dec 19 14:53:10 2007 +0100
@@ -2185,7 +2185,6 @@ struct _snd_pcm_runtime {
 	struct timespec tstamp_mode;	/* mmap timestamp is updated */
   	unsigned int period_step;
 	unsigned int sleep_min;		/* min ticks to sleep */
-	snd_pcm_uframes_t xfer_align;	/* xfer size need to be a multiple */
 	snd_pcm_uframes_t start_threshold;
 	snd_pcm_uframes_t stop_threshold;
 	snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
diff -r 3caa0db34608 core/oss/pcm_oss.c
--- a/core/oss/pcm_oss.c	Wed Dec 19 14:37:30 2007 +0100
+++ b/core/oss/pcm_oss.c	Wed Dec 19 14:53:10 2007 +0100
@@ -988,7 +988,6 @@ static int snd_pcm_oss_change_params(str
 	sw_params->sleep_min = 0;
 	sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
 		1 : runtime->period_size;
-	sw_params->xfer_align = 1;
 	if (atomic_read(&substream->mmap_count) ||
 	    substream->oss.setup.nosilence) {
 		sw_params->silence_threshold = 0;
diff -r 3caa0db34608 core/pcm.c
--- a/core/pcm.c	Wed Dec 19 14:37:30 2007 +0100
+++ b/core/pcm.c	Wed Dec 19 14:53:10 2007 +0100
@@ -389,7 +389,6 @@ static void snd_pcm_substream_proc_sw_pa
 	snd_iprintf(buffer, "period_step: %u\n", runtime->period_step);
 	snd_iprintf(buffer, "sleep_min: %u\n", runtime->sleep_min);
 	snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min);
-	snd_iprintf(buffer, "xfer_align: %lu\n", runtime->xfer_align);
 	snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold);
 	snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold);
 	snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold);
diff -r 3caa0db34608 core/pcm_lib.c
--- a/core/pcm_lib.c	Wed Dec 19 14:37:30 2007 +0100
+++ b/core/pcm_lib.c	Wed Dec 19 14:53:10 2007 +0100
@@ -1598,8 +1598,6 @@ static snd_pcm_sframes_t snd_pcm_lib_wri
 
 	if (size == 0)
 		return 0;
-	if (size > runtime->xfer_align)
-		size -= size % runtime->xfer_align;
 
 	snd_pcm_stream_lock_irq(substream);
 	switch (runtime->status->state) {
@@ -1627,9 +1625,7 @@ static snd_pcm_sframes_t snd_pcm_lib_wri
 		avail = snd_pcm_playback_avail(runtime);
 		if (!avail ||
 		    (snd_pcm_running(substream) &&
-		     ((avail < runtime->control->avail_min && size > avail) ||
-		      (size >= runtime->xfer_align &&
-		       avail < runtime->xfer_align)))) {
+		     (avail < runtime->control->avail_min && size > avail))) {
 			wait_queue_t wait;
 			enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
 			long tout;
@@ -1701,8 +1697,6 @@ static snd_pcm_sframes_t snd_pcm_lib_wri
 				break;
 			}
 		}
-		if (avail > runtime->xfer_align)
-			avail -= avail % runtime->xfer_align;
 		frames = size > avail ? avail : size;
 		cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size;
 		if (frames > cont)
@@ -1870,8 +1864,6 @@ static snd_pcm_sframes_t snd_pcm_lib_rea
 
 	if (size == 0)
 		return 0;
-	if (size > runtime->xfer_align)
-		size -= size % runtime->xfer_align;
 
 	snd_pcm_stream_lock_irq(substream);
 	switch (runtime->status->state) {
@@ -1906,12 +1898,12 @@ static snd_pcm_sframes_t snd_pcm_lib_rea
 	      __draining:
 		avail = snd_pcm_capture_avail(runtime);
 		if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
-			if (avail < runtime->xfer_align) {
+			if (!avail) {
 				err = -EPIPE;
 				goto _end_unlock;
 			}
-		} else if ((avail < runtime->control->avail_min && size > avail) ||
-			   (size >= runtime->xfer_align && avail < runtime->xfer_align)) {
+		} else if (avail < runtime->control->avail_min &&
+			   size > avail) {
 			wait_queue_t wait;
 			enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
 			long tout;
@@ -1984,8 +1976,6 @@ static snd_pcm_sframes_t snd_pcm_lib_rea
 				break;
 			}
 		}
-		if (avail > runtime->xfer_align)
-			avail -= avail % runtime->xfer_align;
 		frames = size > avail ? avail : size;
 		cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size;
 		if (frames > cont)
diff -r 3caa0db34608 core/pcm_native.c
--- a/core/pcm_native.c	Wed Dec 19 14:37:30 2007 +0100
+++ b/core/pcm_native.c	Wed Dec 19 14:53:10 2007 +0100
@@ -432,7 +432,6 @@ static int snd_pcm_hw_params(struct snd_
 	runtime->period_step = 1;
 	runtime->sleep_min = 0;
 	runtime->control->avail_min = runtime->period_size;
-	runtime->xfer_align = runtime->period_size;
 	runtime->start_threshold = 1;
 	runtime->stop_threshold = runtime->buffer_size;
 	runtime->silence_threshold = 0;
@@ -529,9 +528,6 @@ static int snd_pcm_sw_params(struct snd_
 		return -EINVAL;
 	if (params->avail_min == 0)
 		return -EINVAL;
-	if (params->xfer_align == 0 ||
-	    params->xfer_align % runtime->min_align != 0)
-		return -EINVAL;
 	if (params->silence_size >= runtime->boundary) {
 		if (params->silence_threshold != 0)
 			return -EINVAL;
@@ -550,7 +546,6 @@ static int snd_pcm_sw_params(struct snd_
 	runtime->stop_threshold = params->stop_threshold;
 	runtime->silence_threshold = params->silence_threshold;
 	runtime->silence_size = params->silence_size;
-	runtime->xfer_align = params->xfer_align;
         params->boundary = runtime->boundary;
 	if (snd_pcm_running(substream)) {
 		if (runtime->sleep_min)
@@ -2282,8 +2277,6 @@ static snd_pcm_sframes_t snd_pcm_playbac
 	}
 	if (frames > (snd_pcm_uframes_t)hw_avail)
 		frames = hw_avail;
-	else
-		frames -= frames % runtime->xfer_align;
 	appl_ptr = runtime->control->appl_ptr - frames;
 	if (appl_ptr < 0)
 		appl_ptr += runtime->boundary;
@@ -2332,8 +2325,6 @@ static snd_pcm_sframes_t snd_pcm_capture
 	}
 	if (frames > (snd_pcm_uframes_t)hw_avail)
 		frames = hw_avail;
-	else
-		frames -= frames % runtime->xfer_align;
 	appl_ptr = runtime->control->appl_ptr - frames;
 	if (appl_ptr < 0)
 		appl_ptr += runtime->boundary;
@@ -2383,8 +2374,6 @@ static snd_pcm_sframes_t snd_pcm_playbac
 	}
 	if (frames > (snd_pcm_uframes_t)avail)
 		frames = avail;
-	else
-		frames -= frames % runtime->xfer_align;
 	appl_ptr = runtime->control->appl_ptr + frames;
 	if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary)
 		appl_ptr -= runtime->boundary;
@@ -2434,8 +2423,6 @@ static snd_pcm_sframes_t snd_pcm_capture
 	}
 	if (frames > (snd_pcm_uframes_t)avail)
 		frames = avail;
-	else
-		frames -= frames % runtime->xfer_align;
 	appl_ptr = runtime->control->appl_ptr + frames;
 	if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary)
 		appl_ptr -= runtime->boundary;
diff -r 3caa0db34608 include/pcm.h
--- a/include/pcm.h	Wed Dec 19 14:37:30 2007 +0100
+++ b/include/pcm.h	Wed Dec 19 14:53:10 2007 +0100
@@ -280,7 +280,6 @@ struct snd_pcm_runtime {
 	int tstamp_mode;		/* mmap timestamp is updated */
   	unsigned int period_step;
 	unsigned int sleep_min;		/* min ticks to sleep */
-	snd_pcm_uframes_t xfer_align;	/* xfer size need to be a multiple */
 	snd_pcm_uframes_t start_threshold;
 	snd_pcm_uframes_t stop_threshold;
 	snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux