From 7b2c4897f089ab6eee7bc2ce2873c2b11058e04e Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 2 Feb 2015 03:51:40 +0200 Subject: spu: fix some thread safety issues reverb and stuff --- plugins/dfsound/spu.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'plugins/dfsound/spu.c') diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 8681d35..193a5d0 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -818,12 +818,8 @@ static void do_channels(int ns_to) } if (spu.rvb->StartAddr) { - if (do_rvb) { - if (unlikely(spu.rvb->dirty)) - REVERBPrep(); - + if (do_rvb) REVERBDo(spu.SSumLR, RVB, ns_to, spu.rvb->CurrAddr); - } spu.rvb->CurrAddr += ns_to / 2; while (spu.rvb->CurrAddr >= 0x40000) @@ -970,11 +966,8 @@ static void queue_channel_work(int ns_to, unsigned int silentch) work->rvb_addr = 0; if (spu.rvb->StartAddr) { - if (spu_config.iUseReverb) { - if (unlikely(spu.rvb->dirty)) - REVERBPrep(); + if (spu_config.iUseReverb) work->rvb_addr = spu.rvb->CurrAddr; - } spu.rvb->CurrAddr += ns_to / 2; while (spu.rvb->CurrAddr >= 0x40000) @@ -989,9 +982,9 @@ static void do_channel_work(struct work_item *work) { unsigned int mask; unsigned int decode_dirty_ch = 0; + const SPUCHAN *s_chan; int *SB, sinc, spos, sbpos; int d, ch, ns_to; - SPUCHAN *s_chan; ns_to = work->ns_to; @@ -1057,6 +1050,9 @@ static void sync_worker_thread(int force) struct work_item *work; int done, used_space; + // rvb offsets will change, thread may be using them + force |= spu.rvb->dirty && spu.rvb->StartAddr; + done = thread_get_i_done() - worker->i_reaped; used_space = worker->i_ready - worker->i_reaped; //printf("done: %d use: %d dsp: %u/%u\n", done, used_space, @@ -1150,6 +1146,9 @@ void do_samples(unsigned int cycles_to, int do_direct) } } + if (unlikely(spu.rvb->dirty)) + REVERBPrep(); + if (do_direct || worker == NULL || !spu_config.iUseThread) { do_channels(ns_to); do_samples_finish(spu.SSumLR, ns_to, silentch, spu.decode_pos); -- cgit v1.2.3 From 0c1151feca09186ec61485436912a3e563c40b54 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 2 Feb 2015 04:13:30 +0200 Subject: spu: c64x: fix cache handling, enable l2 --- plugins/dfsound/spu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/dfsound/spu.c') diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 193a5d0..8e41d50 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -842,6 +842,7 @@ static struct spu_worker { unsigned int i_ready; unsigned int i_reaped; unsigned int last_boot_cnt; // dsp + unsigned int ram_dirty; }; // aligning for C64X_DSP unsigned int _pad0[128/4]; @@ -1055,6 +1056,7 @@ static void sync_worker_thread(int force) done = thread_get_i_done() - worker->i_reaped; used_space = worker->i_ready - worker->i_reaped; + //printf("done: %d use: %d dsp: %u/%u\n", done, used_space, // worker->boot_cnt, worker->i_done); -- cgit v1.2.3 From 1e0eac2348343c8a046f7a75d460f087556cf7f6 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 6 Feb 2015 01:26:44 +0200 Subject: libretro: always use fixed samples per frame --- plugins/dfsound/spu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/dfsound/spu.c') diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index 8e41d50..c6a1bf5 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -1253,7 +1253,7 @@ void schedule_next_irq(void) void CALLBACK SPUasync(unsigned int cycle, unsigned int flags) { - do_samples(cycle, 0); + do_samples(cycle, spu_config.iUseFixedUpdates); if (spu.spuCtrl & CTRL_IRQ) schedule_next_irq(); -- cgit v1.2.3