apu/vp: Make number of voice workers configurable

This commit is contained in:
Matt Borgerson
2025-06-12 14:06:24 -07:00
parent 65140c98e4
commit 050826a31b
3 changed files with 9 additions and 2 deletions

View File

@ -214,6 +214,10 @@ display:
default: false
audio:
vp:
num_workers:
type: integer
default: 16
use_dsp: bool
hrtf:
type: bool

View File

@ -1761,6 +1761,8 @@ static void voice_work_init(MCPXAPUState *d)
{
VoiceWorkDispatch *vwd = &d->vp.voice_work_dispatch;
g_config.audio.vp.num_workers = MAX(1, MIN(g_config.audio.vp.num_workers, MAX_VOICE_WORKERS));
vwd->workers_should_exit = false;
vwd->workers_pending = 0;
vwd->queue_len = 0;

View File

@ -31,7 +31,8 @@
#include "svf.h"
#include "hrtf.h"
#define NUM_VOICE_WORKERS 4
#define NUM_VOICE_WORKERS g_config.audio.vp.num_workers
#define MAX_VOICE_WORKERS 16
typedef struct MCPXAPUState MCPXAPUState;
@ -65,7 +66,7 @@ typedef struct VoiceWorker {
typedef struct VoiceWorkDispatch {
QemuMutex lock;
VoiceWorker workers[NUM_VOICE_WORKERS];
VoiceWorker workers[MAX_VOICE_WORKERS];
bool workers_should_exit;
QemuCond work_pending;
uint64_t workers_pending;