mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hw/audio/cs4231a: skip automatic zero-init of large arrays
The 'cs_write_audio' method has a pair of byte arrays, one 4k in size and one 8k, which are used in converting audio samples. Skip the automatic zero-init of these arrays to eliminate the performance overhead in the I/O hot path. The 'tmpbuf' array will be fully initialized when reading a block of data from the guest. The 'linbuf' array will be fully initialized when converting the audio samples. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20250610123709.835102-9-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
2553d2d26a
commit
ca2cc0385d
1 changed files with 2 additions and 2 deletions
|
@ -528,7 +528,7 @@ static int cs_write_audio (CSState *s, int nchan, int dma_pos,
|
||||||
int dma_len, int len)
|
int dma_len, int len)
|
||||||
{
|
{
|
||||||
int temp, net;
|
int temp, net;
|
||||||
uint8_t tmpbuf[4096];
|
QEMU_UNINITIALIZED uint8_t tmpbuf[4096];
|
||||||
IsaDmaClass *k = ISADMA_GET_CLASS(s->isa_dma);
|
IsaDmaClass *k = ISADMA_GET_CLASS(s->isa_dma);
|
||||||
|
|
||||||
temp = len;
|
temp = len;
|
||||||
|
@ -547,7 +547,7 @@ static int cs_write_audio (CSState *s, int nchan, int dma_pos,
|
||||||
copied = k->read_memory(s->isa_dma, nchan, tmpbuf, dma_pos, to_copy);
|
copied = k->read_memory(s->isa_dma, nchan, tmpbuf, dma_pos, to_copy);
|
||||||
if (s->tab) {
|
if (s->tab) {
|
||||||
int i;
|
int i;
|
||||||
int16_t linbuf[4096];
|
QEMU_UNINITIALIZED int16_t linbuf[4096];
|
||||||
|
|
||||||
for (i = 0; i < copied; ++i)
|
for (i = 0; i < copied; ++i)
|
||||||
linbuf[i] = s->tab[tmpbuf[i]];
|
linbuf[i] = s->tab[tmpbuf[i]];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue