diff options
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.h | 3 | ||||
| -rw-r--r-- | src/core/hw/gpu.cpp | 8 |
3 files changed, 28 insertions, 5 deletions
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 2cf4d118f..d4affdfbf 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -12,9 +12,23 @@ | |||
| 12 | 12 | ||
| 13 | namespace DSP_DSP { | 13 | namespace DSP_DSP { |
| 14 | 14 | ||
| 15 | static u32 read_pipe_count; | 15 | static u32 read_pipe_count = 0; |
| 16 | static Handle semaphore_event; | 16 | static Handle semaphore_event = 0; |
| 17 | static Handle interrupt_event; | 17 | static Handle interrupt_event = 0; |
| 18 | |||
| 19 | void SignalInterrupt() { | ||
| 20 | // TODO(bunnei): This is just a stub, it does not do anything other than signal to the emulated | ||
| 21 | // application that a DSP interrupt occurred, without specifying which one. Since we do not | ||
| 22 | // emulate the DSP yet (and how it works is largely unknown), this is a work around to get games | ||
| 23 | // that check the DSP interrupt signal event to run. We should figure out the different types of | ||
| 24 | // DSP interrupts, and trigger them at the appropriate times. | ||
| 25 | |||
| 26 | if (interrupt_event == 0) { | ||
| 27 | LOG_WARNING(Service_DSP, "cannot signal interrupt until DSP event has been created!"); | ||
| 28 | return; | ||
| 29 | } | ||
| 30 | Kernel::SignalEvent(interrupt_event); | ||
| 31 | } | ||
| 18 | 32 | ||
| 19 | /** | 33 | /** |
| 20 | * DSP_DSP::ConvertProcessAddressFromDspDram service function | 34 | * DSP_DSP::ConvertProcessAddressFromDspDram service function |
| @@ -102,7 +116,7 @@ void RegisterInterruptEvents(Service::Interface* self) { | |||
| 102 | void WriteReg0x10(Service::Interface* self) { | 116 | void WriteReg0x10(Service::Interface* self) { |
| 103 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 117 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 104 | 118 | ||
| 105 | Kernel::SignalEvent(interrupt_event); | 119 | SignalInterrupt(); |
| 106 | 120 | ||
| 107 | cmd_buff[1] = 0; // No error | 121 | cmd_buff[1] = 0; // No error |
| 108 | 122 | ||
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h index 0b8b64600..fa13bfb7c 100644 --- a/src/core/hle/service/dsp_dsp.h +++ b/src/core/hle/service/dsp_dsp.h | |||
| @@ -20,4 +20,7 @@ public: | |||
| 20 | } | 20 | } |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | /// Signals that a DSP interrupt has occurred to userland code | ||
| 24 | void SignalInterrupt(); | ||
| 25 | |||
| 23 | } // namespace | 26 | } // namespace |
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 0ff6c6cde..e346e0ad6 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include "core/hle/hle.h" | 11 | #include "core/hle/hle.h" |
| 12 | #include "core/hle/service/gsp_gpu.h" | 12 | #include "core/hle/service/gsp_gpu.h" |
| 13 | #include "core/hle/service/dsp_dsp.h" | ||
| 13 | 14 | ||
| 14 | #include "core/hw/gpu.h" | 15 | #include "core/hw/gpu.h" |
| 15 | 16 | ||
| @@ -214,13 +215,18 @@ void Update() { | |||
| 214 | // - If frameskip == 0 (disabled), always swap buffers | 215 | // - If frameskip == 0 (disabled), always swap buffers |
| 215 | // - If frameskip == 1, swap buffers every other frame (starting from the first frame) | 216 | // - If frameskip == 1, swap buffers every other frame (starting from the first frame) |
| 216 | // - If frameskip > 1, swap buffers every frameskip^n frames (starting from the second frame) | 217 | // - If frameskip > 1, swap buffers every frameskip^n frames (starting from the second frame) |
| 217 | |||
| 218 | if ((((Settings::values.frame_skip != 1) ^ last_skip_frame) && last_skip_frame != g_skip_frame) || | 218 | if ((((Settings::values.frame_skip != 1) ^ last_skip_frame) && last_skip_frame != g_skip_frame) || |
| 219 | Settings::values.frame_skip == 0) { | 219 | Settings::values.frame_skip == 0) { |
| 220 | VideoCore::g_renderer->SwapBuffers(); | 220 | VideoCore::g_renderer->SwapBuffers(); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | // Signal to GSP that GPU interrupt has occurred | ||
| 223 | GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); | 224 | GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); |
| 225 | |||
| 226 | // TODO(bunnei): Fake a DSP interrupt on each frame. This does not belong here, but | ||
| 227 | // until we can emulate DSP interrupts, this is probably the only reasonable place to do | ||
| 228 | // this. Certain games expect this to be periodically signaled. | ||
| 229 | DSP_DSP::SignalInterrupt(); | ||
| 224 | } | 230 | } |
| 225 | } | 231 | } |
| 226 | } | 232 | } |