Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171212420
D59444.id185920.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D59444.id185920.diff
View Options
diff --git a/sys/dev/sound/pci/emu10kx-pcm.c b/sys/dev/sound/pci/emu10kx-pcm.c
--- a/sys/dev/sound/pci/emu10kx-pcm.c
+++ b/sys/dev/sound/pci/emu10kx-pcm.c
@@ -768,13 +768,30 @@
{
struct emu_pcm_pchinfo *ch = c_devinfo;
struct emu_pcm_info *sc = ch->pcm;
+ uint32_t blkcnt;
+
+ /*
+ * The channel always plays the whole EMU_PLAY_BUFSZ buffer, so the
+ * blocks have to cover it exactly, or the part they do not cover is
+ * "played" without ever being written to.
+ *
+ * sndbuf_resize() needs at least two blocks, so a block can be at most
+ * half the buffer's size. The block count has to be a power of two as
+ * well, because only then does the division come out exact.
+ */
+ if (blocksize == 0 || blocksize > EMU_PLAY_BUFSZ / 2)
+ blocksize = EMU_PLAY_BUFSZ / 2;
+ blkcnt = 1 << (fls(EMU_PLAY_BUFSZ / blocksize) - 1);
+ blocksize = EMU_PLAY_BUFSZ / blkcnt;
+
+ if (sndbuf_resize(ch->buffer, blkcnt, blocksize) != 0)
+ return (ch->blksz);
- if (blocksize > ch->pcm->bufsz)
- blocksize = ch->pcm->bufsz;
mtx_lock(&sc->lock);
ch->blksz = blocksize;
emu_timer_set(sc->card, ch->timer, ch->blksz / ch->buffer->align);
mtx_unlock(&sc->lock);
+
return (ch->blksz);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 10, 1:51 PM (17 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38416192
Default Alt Text
D59444.id185920.diff (1 KB)
Attached To
Mode
D59444: snd_emu10kx: Make sure the block count and size cover the whole buffer
Attached
Detach File
Event Timeline
Log In to Comment