aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-01-08 18:35:29 +0100
committerTakashi Iwai <tiwai@suse.de>2008-01-08 18:35:29 +0100
commitcf15e49d8460d9b56005d8c49faa064de3649cef (patch)
treed0e6ca53dd603eabf531fe17856c2e2a85a39d97
parente1e9e3ff8274b24857da083c19c47627e1a71c3e (diff)
Remove PCM xfer_align
The PCM xfer_align is a removed feature from the kernel. This patch cleans up the corresponding part in alsa-lib.
-rw-r--r--include/pcm.h4
-rw-r--r--src/pcm/pcm.c56
-rw-r--r--src/pcm/pcm_direct.c2
-rw-r--r--src/pcm/pcm_direct.h2
-rw-r--r--src/pcm/pcm_hw.c1
-rw-r--r--src/pcm/pcm_local.h3
-rw-r--r--src/pcm/pcm_mmap_emul.c2
-rw-r--r--src/pcm/pcm_params.c2
-rw-r--r--src/pcm/pcm_rate.c4
-rw-r--r--src/pcm/pcm_simple.c3
-rw-r--r--test/latency.c6
-rw-r--r--test/pcm.c6
12 files changed, 13 insertions, 78 deletions
diff --git a/include/pcm.h b/include/pcm.h
index f72b39cb..d2d8bf6e 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -713,8 +713,6 @@ int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val);
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
-int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
@@ -1103,6 +1101,8 @@ int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated));
snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));
/** \} */
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 2e36cc18..52714afa 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -872,10 +872,6 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
SNDMSG("params->avail_min is 0");
return -EINVAL;
}
- if (! params->xfer_align) {
- SNDMSG("params->xfer_align is 0");
- return -EINVAL;
- }
#if 0
/* disable the check below - it looks too restrictive
* (start_threshold is basically independent from avail_min)
@@ -886,11 +882,6 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
return -EINVAL;
}
#endif
- if (params->start_threshold <= pcm->buffer_size &&
- params->start_threshold > (pcm->buffer_size / params->xfer_align) * params->xfer_align) {
- SNDMSG("params->xfer_align problem for start_threshold");
- return -EINVAL;
- }
err = pcm->ops->sw_params(pcm->op_arg, params);
if (err < 0)
return err;
@@ -898,7 +889,6 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
pcm->period_step = params->period_step;
pcm->sleep_min = params->sleep_min;
pcm->avail_min = params->avail_min;
- pcm->xfer_align = params->xfer_align;
pcm->start_threshold = params->start_threshold;
pcm->stop_threshold = params->stop_threshold;
pcm->silence_threshold = params->silence_threshold;
@@ -1811,7 +1801,6 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
snd_output_printf(out, " period_step : %d\n", pcm->period_step);
snd_output_printf(out, " sleep_min : %d\n", pcm->sleep_min);
snd_output_printf(out, " avail_min : %ld\n", pcm->avail_min);
- snd_output_printf(out, " xfer_align : %ld\n", pcm->xfer_align);
snd_output_printf(out, " start_threshold : %ld\n", pcm->start_threshold);
snd_output_printf(out, " stop_threshold : %ld\n", pcm->stop_threshold);
snd_output_printf(out, " silence_threshold: %ld\n", pcm->silence_threshold);
@@ -5303,7 +5292,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
params->period_step = pcm->period_step;
params->sleep_min = pcm->sleep_min;
params->avail_min = pcm->avail_min;
- params->xfer_align = pcm->xfer_align;
+ params->xfer_align = 1;
params->start_threshold = pcm->start_threshold;
params->stop_threshold = pcm->stop_threshold;
params->silence_threshold = pcm->silence_threshold;
@@ -5326,7 +5315,6 @@ int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
snd_output_printf(out, "period_step: %u\n", params->period_step);
snd_output_printf(out, "sleep_min: %u\n", params->sleep_min);
snd_output_printf(out, "avail_min: %lu\n", params->avail_min);
- snd_output_printf(out, "xfer_align: %lu\n", params->xfer_align);
snd_output_printf(out, "silence_threshold: %lu\n", params->silence_threshold);
snd_output_printf(out, "silence_size: %lu\n", params->silence_size);
snd_output_printf(out, "boundary: %lu\n", params->boundary);
@@ -5607,45 +5595,37 @@ int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_u
/**
- * \brief Set xfer align inside a software configuration container
+ * \brief (DEPRECATED) Set xfer align inside a software configuration container
* \param pcm PCM handle
* \param params Software configuration container
* \param val Chunk size (frames are attempted to be transferred in chunks)
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t val ATTRIBUTE_UNUSED)
#else
int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
#endif
{
- assert(pcm && params);
- if (CHECK_SANITY(val % pcm->min_align)) {
- SNDMSG("xfer_align (%ld) is not aligned to min_align (%ld)", val, pcm->min_align);
- return -EINVAL;
- }
- params->xfer_align = val;
return 0;
}
/**
- * \brief Get xfer align from a software configuration container
+ * \brief (DEPRECATED) Get xfer align from a software configuration container
* \param params Software configuration container
* \param val returned chunk size (frames are attempted to be transferred in chunks)
* \return 0 otherwise a negative error code
*/
#ifndef DOXYGEN
-int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t *val)
#else
int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
#endif
{
- assert(params && val);
- *val = params->xfer_align;
+ *val = 1;
return 0;
}
-
/**
* \brief Set start threshold inside a software configuration container
* \param pcm PCM handle
@@ -6361,8 +6341,6 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
if (size == 0)
return 0;
- if (size > pcm->xfer_align)
- size -= size % pcm->xfer_align;
switch (state) {
case SND_PCM_STATE_PREPARED:
@@ -6397,9 +6375,8 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
err = avail;
goto _end;
}
- if (((snd_pcm_uframes_t)avail < pcm->avail_min && size > (snd_pcm_uframes_t)avail) ||
- (size >= pcm->xfer_align && (snd_pcm_uframes_t)avail < pcm->xfer_align)) {
-
+ if ((snd_pcm_uframes_t)avail < pcm->avail_min &&
+ size > (snd_pcm_uframes_t)avail) {
if (pcm->mode & SND_PCM_NONBLOCK) {
err = -EAGAIN;
goto _end;
@@ -6411,8 +6388,6 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
goto _again;
}
- if ((snd_pcm_uframes_t) avail > pcm->xfer_align)
- avail -= avail % pcm->xfer_align;
frames = size;
if (frames > (snd_pcm_uframes_t) avail)
frames = avail;
@@ -6440,8 +6415,6 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
if (size == 0)
return 0;
- if (size > pcm->xfer_align)
- size -= size % pcm->xfer_align;
switch (state) {
case SND_PCM_STATE_PREPARED:
@@ -6473,10 +6446,7 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
}
if ((state == SND_PCM_STATE_RUNNING &&
(snd_pcm_uframes_t)avail < pcm->avail_min &&
- size > (snd_pcm_uframes_t)avail) ||
- (size >= pcm->xfer_align &&
- (snd_pcm_uframes_t)avail < pcm->xfer_align)) {
-
+ size > (snd_pcm_uframes_t)avail)) {
if (pcm->mode & SND_PCM_NONBLOCK) {
err = -EAGAIN;
goto _end;
@@ -6487,8 +6457,6 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
break;
goto _again;
}
- if ((snd_pcm_uframes_t) avail > pcm->xfer_align)
- avail -= avail % pcm->xfer_align;
frames = size;
if (frames > (snd_pcm_uframes_t) avail)
frames = avail;
@@ -7245,12 +7213,6 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
SNDERR("Unable to set avail min for %s: %s", s, snd_strerror(err));
return err;
}
- /* align all transfers to 1 sample */
- err = snd_pcm_sw_params_set_xfer_align(pcm, swparams, 1);
- if (err < 0) {
- SNDERR("Unable to set transfer align for %s: %s", s, snd_strerror(err));
- return err;
- }
/* write the parameters to the playback device */
err = snd_pcm_sw_params(pcm, swparams);
if (err < 0) {
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
index 3f908e26..b80e31a0 100644
--- a/src/pcm/pcm_direct.c
+++ b/src/pcm/pcm_direct.c
@@ -826,7 +826,6 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(stop_threshold);
COPY_SLAVE(silence_threshold);
COPY_SLAVE(silence_size);
- COPY_SLAVE(xfer_align);
COPY_SLAVE(boundary);
COPY_SLAVE(info);
COPY_SLAVE(msbits);
@@ -1180,7 +1179,6 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(stop_threshold);
COPY_SLAVE(silence_threshold);
COPY_SLAVE(silence_size);
- COPY_SLAVE(xfer_align);
COPY_SLAVE(boundary);
COPY_SLAVE(info);
COPY_SLAVE(msbits);
diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h
index b51ca851..03ce53f3 100644
--- a/src/pcm/pcm_direct.h
+++ b/src/pcm/pcm_direct.h
@@ -94,7 +94,7 @@ typedef struct {
unsigned int stop_threshold;
unsigned int silence_threshold;
unsigned int silence_size;
- unsigned int xfer_align;
+ unsigned int xfer_align; /* not used */
unsigned long long boundary;
unsigned int info;
unsigned int msbits;
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 94eca84e..77a5c2ba 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -295,7 +295,6 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
params->period_step == pcm->period_step &&
params->sleep_min == pcm->sleep_min &&
- params->xfer_align == pcm->xfer_align &&
params->start_threshold == pcm->start_threshold &&
params->stop_threshold == pcm->stop_threshold &&
params->silence_threshold == pcm->silence_threshold &&
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
index b5877cd0..11a09407 100644
--- a/src/pcm/pcm_local.h
+++ b/src/pcm/pcm_local.h
@@ -196,7 +196,6 @@ struct _snd_pcm {
snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
noise is nearest than this */
snd_pcm_uframes_t silence_size; /* Silence filling size */
- snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
snd_pcm_uframes_t boundary; /* pointers wrap point */
unsigned int info; /* Info for returned setup */
unsigned int msbits; /* used most significant bits */
@@ -825,8 +824,6 @@ int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
int INTERNAL(snd_pcm_sw_params_get_sleep_min)(const snd_pcm_sw_params_t *params, unsigned int *val);
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
-int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
-int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
int INTERNAL(snd_pcm_sw_params_get_start_threshold)(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
diff --git a/src/pcm/pcm_mmap_emul.c b/src/pcm/pcm_mmap_emul.c
index c0181e79..d3fe05ef 100644
--- a/src/pcm/pcm_mmap_emul.c
+++ b/src/pcm/pcm_mmap_emul.c
@@ -260,7 +260,6 @@ sync_slave_write(snd_pcm_t *pcm)
size = map->appl_ptr - *slave->appl.ptr;
if (size < 0)
size += pcm->boundary;
- size -= size % pcm->xfer_align;
if (!size)
return 0;
offset = *slave->appl.ptr % pcm->buffer_size;
@@ -279,7 +278,6 @@ sync_slave_read(snd_pcm_t *pcm)
size = *slave->hw.ptr - map->hw_ptr;
if (size < 0)
size += pcm->boundary;
- size -= size % pcm->xfer_align;
if (!size)
return 0;
offset = map->hw_ptr % pcm->buffer_size;
diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c
index 63785010..89774033 100644
--- a/src/pcm/pcm_params.c
+++ b/src/pcm/pcm_params.c
@@ -2234,7 +2234,7 @@ static int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
params->period_step = 1;
params->sleep_min = 0;
params->avail_min = pcm->period_size;
- params->xfer_align = pcm->period_size;
+ params->xfer_align = 1;
params->start_threshold = 1;
params->stop_threshold = pcm->buffer_size;
params->silence_threshold = 0;
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index 26d26dbb..c5bded4d 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -387,15 +387,11 @@ static int snd_pcm_rate_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
recalc(pcm, &sparams->avail_min);
rate->orig_avail_min = sparams->avail_min;
- recalc(pcm, &sparams->xfer_align);
recalc(pcm, &sparams->start_threshold);
if (sparams->avail_min < 1) sparams->avail_min = 1;
- if (sparams->xfer_align < 1) sparams->xfer_align = 1;
if (sparams->start_threshold <= slave->buffer_size) {
if (sparams->start_threshold > (slave->buffer_size / sparams->avail_min) * sparams->avail_min)
sparams->start_threshold = (slave->buffer_size / sparams->avail_min) * sparams->avail_min;
- if (sparams->start_threshold > (slave->buffer_size / sparams->xfer_align) * sparams->xfer_align)
- sparams->start_threshold = (slave->buffer_size / sparams->xfer_align) * sparams->xfer_align;
}
if (sparams->stop_threshold >= params->boundary) {
sparams->stop_threshold = sparams->boundary;
diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c
index 5629d06f..975f6998 100644
--- a/src/pcm/pcm_simple.c
+++ b/src/pcm/pcm_simple.c
@@ -134,9 +134,6 @@ static int set_sw_params(snd_pcm_t *pcm,
}
if (err < 0)
return err;
- err = snd_pcm_sw_params_set_xfer_align(pcm, sw_params, 1);
- if (err < 0)
- return err;
err = snd_pcm_sw_params(pcm, sw_params);
if (err < 0)
return err;
diff --git a/test/latency.c b/test/latency.c
index e472b4fb..7132985f 100644
--- a/test/latency.c
+++ b/test/latency.c
@@ -185,12 +185,6 @@ int setparams_set(snd_pcm_t *handle,
printf("Unable to set avail min for %s: %s\n", id, snd_strerror(err));
return err;
}
- val = !block ? 4 : 1;
- err = snd_pcm_sw_params_set_xfer_align(handle, swparams, val);
- if (err < 0) {
- printf("Unable to set transfer align for %s: %s\n", id, snd_strerror(err));
- return err;
- }
err = snd_pcm_sw_params(handle, swparams);
if (err < 0) {
printf("Unable to set sw params for %s: %s\n", id, snd_strerror(err));
diff --git a/test/pcm.c b/test/pcm.c
index 17d0034f..fb38d499 100644
--- a/test/pcm.c
+++ b/test/pcm.c
@@ -177,12 +177,6 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams)
printf("Unable to set avail min for playback: %s\n", snd_strerror(err));
return err;
}
- /* align all transfers to 1 sample */
- err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
- if (err < 0) {
- printf("Unable to set transfer align for playback: %s\n", snd_strerror(err));
- return err;
- }
/* write the parameters to the playback device */
err = snd_pcm_sw_params(handle, swparams);
if (err < 0) {