Skip to content

Commit 5503600

Browse files
tiwaiperexg
authored andcommitted
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>
1 parent a2e3961 commit 5503600

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎sound/pci/via82xx.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ struct snd_via_sg_table {
313313
} ;
314314

315315
#define VIA_TABLE_SIZE 255
316+
#define VIA_MAX_BUFSIZE (1<<24)
316317

317318
struct viadev {
318319
unsigned int reg_offset;
@@ -456,9 +457,7 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
456457
}
457458
addr = snd_pcm_sgbuf_get_addr(substream, ofs);
458459
((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr);
459-
r = PAGE_SIZE - (ofs % PAGE_SIZE);
460-
if (rest < r)
461-
r = rest;
460+
r = snd_pcm_sgbuf_get_chunk_size(substream, ofs, rest);
462461
rest -= r;
463462
if (! rest) {
464463
if (i == periods - 1)
@@ -1147,9 +1146,9 @@ static struct snd_pcm_hardware snd_via82xx_hw =
11471146
.rate_max = 48000,
11481147
.channels_min = 1,
11491148
.channels_max = 2,
1150-
.buffer_bytes_max = 128 * 1024,
1149+
.buffer_bytes_max = VIA_MAX_BUFSIZE,
11511150
.period_bytes_min = 32,
1152-
.period_bytes_max = 128 * 1024,
1151+
.period_bytes_max = VIA_MAX_BUFSIZE / 2,
11531152
.periods_min = 2,
11541153
.periods_max = VIA_TABLE_SIZE / 2,
11551154
.fifo_size = 0,
@@ -1403,7 +1402,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip)
14031402

14041403
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
14051404
snd_dma_pci_data(chip->pci),
1406-
64*1024, 128*1024);
1405+
64*1024, VIA_MAX_BUFSIZE);
14071406

14081407
/* PCM #1: multi-channel playback and 2nd capture */
14091408
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)
14211420

14221421
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
14231422
snd_dma_pci_data(chip->pci),
1424-
64*1024, 128*1024);
1423+
64*1024, VIA_MAX_BUFSIZE);
14251424
return 0;
14261425
}
14271426

@@ -1455,7 +1454,7 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip)
14551454

14561455
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
14571456
snd_dma_pci_data(chip->pci),
1458-
64*1024, 128*1024);
1457+
64*1024, VIA_MAX_BUFSIZE);
14591458

14601459
/* SPDIF supported? */
14611460
if (! ac97_can_spdif(chip->ac97))
@@ -1474,7 +1473,7 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip)
14741473

14751474
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
14761475
snd_dma_pci_data(chip->pci),
1477-
64*1024, 128*1024)
1476+
64*1024, VIA_MAX_BUFSIZE);
14781477
return 0;
14791478
}
14801479

@@ -1504,7 +1503,7 @@ static int __devinit snd_via686_pcm_new(struct via82xx *chip)
15041503

15051504
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
15061505
snd_dma_pci_data(chip->pci),
1507-
64*1024, 128*1024);
1506+
64*1024, VIA_MAX_BUFSIZE);
15081507
return 0;
15091508
}
15101509

0 commit comments

Comments
 (0)