diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-07-30 09:23:06 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-25 03:57:43 -0400 |
commit | 5503600a1c5c2c11e14ff428b5d07a1018927bd6 (patch) | |
tree | 80d8dcb53337abb5af9fc4ac3f5ca98b7063c0c0 /sound/pci/via82xx.c | |
parent | a2e3961d0a26870eb23b70edab6814c7f08ce2e0 (diff) |
ALSA: via82xx - check continuous pages in buffer setup
Check continuous pages in the buffer set up so that the number of
BDL is reduced. Also increased the max buffer size.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/via82xx.c')
-rw-r--r-- | sound/pci/via82xx.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 57e33d7df5fa..1aafe956ee2b 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -313,6 +313,7 @@ struct snd_via_sg_table { | |||
313 | } ; | 313 | } ; |
314 | 314 | ||
315 | #define VIA_TABLE_SIZE 255 | 315 | #define VIA_TABLE_SIZE 255 |
316 | #define VIA_MAX_BUFSIZE (1<<24) | ||
316 | 317 | ||
317 | struct viadev { | 318 | struct viadev { |
318 | unsigned int reg_offset; | 319 | unsigned int reg_offset; |
@@ -456,9 +457,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre | |||
456 | } | 457 | } |
457 | addr = snd_pcm_sgbuf_get_addr(substream, ofs); | 458 | addr = snd_pcm_sgbuf_get_addr(substream, ofs); |
458 | ((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr); | 459 | ((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr); |
459 | r = PAGE_SIZE - (ofs % PAGE_SIZE); | 460 | r = snd_pcm_sgbuf_get_chunk_size(substream, ofs, rest); |
460 | if (rest < r) | ||
461 | r = rest; | ||
462 | rest -= r; | 461 | rest -= r; |
463 | if (! rest) { | 462 | if (! rest) { |
464 | if (i == periods - 1) | 463 | if (i == periods - 1) |
@@ -1147,9 +1146,9 @@ static struct snd_pcm_hardware snd_via82xx_hw = | |||
1147 | .rate_max = 48000, | 1146 | .rate_max = 48000, |
1148 | .channels_min = 1, | 1147 | .channels_min = 1, |
1149 | .channels_max = 2, | 1148 | .channels_max = 2, |
1150 | .buffer_bytes_max = 128 * 1024, | 1149 | .buffer_bytes_max = VIA_MAX_BUFSIZE, |
1151 | .period_bytes_min = 32, | 1150 | .period_bytes_min = 32, |
1152 | .period_bytes_max = 128 * 1024, | 1151 | .period_bytes_max = VIA_MAX_BUFSIZE / 2, |
1153 | .periods_min = 2, | 1152 | .periods_min = 2, |
1154 | .periods_max = VIA_TABLE_SIZE / 2, | 1153 | .periods_max = VIA_TABLE_SIZE / 2, |
1155 | .fifo_size = 0, | 1154 | .fifo_size = 0, |
@@ -1403,7 +1402,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1403 | 1402 | ||
1404 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1403 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1405 | snd_dma_pci_data(chip->pci), | 1404 | snd_dma_pci_data(chip->pci), |
1406 | 64*1024, 128*1024); | 1405 | 64*1024, VIA_MAX_BUFSIZE); |
1407 | 1406 | ||
1408 | /* PCM #1: multi-channel playback and 2nd capture */ | 1407 | /* PCM #1: multi-channel playback and 2nd capture */ |
1409 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); | 1408 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); |
@@ -1421,7 +1420,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1421 | 1420 | ||
1422 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1421 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1423 | snd_dma_pci_data(chip->pci), | 1422 | snd_dma_pci_data(chip->pci), |
1424 | 64*1024, 128*1024); | 1423 | 64*1024, VIA_MAX_BUFSIZE); |
1425 | return 0; | 1424 | return 0; |
1426 | } | 1425 | } |
1427 | 1426 | ||
@@ -1455,7 +1454,7 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | |||
1455 | 1454 | ||
1456 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1455 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1457 | snd_dma_pci_data(chip->pci), | 1456 | snd_dma_pci_data(chip->pci), |
1458 | 64*1024, 128*1024); | 1457 | 64*1024, VIA_MAX_BUFSIZE); |
1459 | 1458 | ||
1460 | /* SPDIF supported? */ | 1459 | /* SPDIF supported? */ |
1461 | if (! ac97_can_spdif(chip->ac97)) | 1460 | if (! ac97_can_spdif(chip->ac97)) |
@@ -1474,7 +1473,7 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | |||
1474 | 1473 | ||
1475 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1474 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1476 | snd_dma_pci_data(chip->pci), | 1475 | snd_dma_pci_data(chip->pci), |
1477 | 64*1024, 128*1024) | 1476 | 64*1024, VIA_MAX_BUFSIZE); |
1478 | return 0; | 1477 | return 0; |
1479 | } | 1478 | } |
1480 | 1479 | ||
@@ -1504,7 +1503,7 @@ static int __devinit snd_via686_pcm_new(struct via82xx *chip) | |||
1504 | 1503 | ||
1505 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1504 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1506 | snd_dma_pci_data(chip->pci), | 1505 | snd_dma_pci_data(chip->pci), |
1507 | 64*1024, 128*1024); | 1506 | 64*1024, VIA_MAX_BUFSIZE); |
1508 | return 0; | 1507 | return 0; |
1509 | } | 1508 | } |
1510 | 1509 | ||