Merge pull request #3996 from NarcolepticK/dsp-remove-weakptr

service/dsp: Clean up global state
This commit is contained in:
Weiyi Wang 2018-08-02 11:14:59 +03:00 committed by GitHub
commit 14bc20fc8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 24 deletions

View file

@ -21,8 +21,6 @@ enum class DspPipe;
namespace Service {
namespace DSP {
static std::weak_ptr<DSP_DSP> dsp_dsp;
void DSP_DSP::RecvData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x01, 1, 0);
const u32 register_number = rp.Pop<u32>();
@ -313,6 +311,10 @@ void DSP_DSP::ForceHeadphoneOut(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_DSP, "(STUBBED) called, force={}", force);
}
// DSP Interrupts:
// The audio-pipe interrupt occurs every frame tick. Userland programs normally have a thread
// that's waiting for an interrupt event. Immediately after this interrupt event, userland
// normally updates the state in the next region and increments the relevant frame counter by two.
void DSP_DSP::SignalInterrupt(InterruptType type, DspPipe pipe) {
LOG_DEBUG(Service_DSP, "called, type={}, pipe={}", static_cast<u32>(type),
static_cast<u32>(pipe));
@ -398,20 +400,10 @@ DSP_DSP::~DSP_DSP() {
pipes = {};
}
// DSP Interrupts:
// The audio-pipe interrupt occurs every frame tick. Userland programs normally have a thread
// that's waiting for an interrupt event. Immediately after this interrupt event, userland
// normally updates the state in the next region and increments the relevant frame counter by two.
void SignalPipeInterrupt(DspPipe pipe) {
auto dsp = dsp_dsp.lock();
ASSERT(dsp != nullptr);
return dsp->SignalInterrupt(InterruptType::Pipe, pipe);
}
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto dsp = std::make_shared<DSP_DSP>();
dsp->InstallAsService(service_manager);
dsp_dsp = dsp;
Core::DSP().SetServiceToInterrupt(std::move(dsp));
}
} // namespace DSP

View file

@ -251,12 +251,6 @@ private:
std::array<Kernel::SharedPtr<Kernel::Event>, AudioCore::num_dsp_pipe> pipes = {{}};
};
/**
* Signal a specific DSP related interrupt of type == InterruptType::Pipe, pipe == pipe.
* @param pipe The DSP pipe for which to signal an interrupt for.
*/
void SignalPipeInterrupt(AudioCore::DspPipe pipe);
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace DSP