audio_core/hle: Stub binary requests SaveState and LoadState. (#6684)

* audio_core/hle: Stub binary requests SaveState and LoadState.

* audio_core/hle: Fire DSP binary pipe interrupt on request completion instead of tick.
This commit is contained in:
Steveice10 2023-07-16 17:54:40 -07:00 committed by GitHub
parent 9cb14044ec
commit 700c00f021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 9 deletions

View file

@ -85,7 +85,11 @@ std::optional<BinaryMessage> AudioToolboxDecoder::Impl::ProcessRequest(
case DecoderCommand::EncodeDecode: { case DecoderCommand::EncodeDecode: {
return Decode(request); return Decode(request);
} }
case DecoderCommand::Unknown: { case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState: {
LOG_WARNING(Audio_DSP, "Got unimplemented binary request: {}",
static_cast<u16>(request.header.cmd));
BinaryMessage response = request; BinaryMessage response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;

View file

@ -42,7 +42,9 @@ std::optional<BinaryMessage> NullDecoder::ProcessRequest(const BinaryMessage& re
BinaryMessage response{}; BinaryMessage response{};
switch (request.header.cmd) { switch (request.header.cmd) {
case DecoderCommand::Init: case DecoderCommand::Init:
case DecoderCommand::Unknown: case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState:
response = request; response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;

View file

@ -14,9 +14,16 @@
namespace AudioCore::HLE { namespace AudioCore::HLE {
enum class DecoderCommand : u16 { enum class DecoderCommand : u16 {
/// Initializes the decoder.
Init = 0, Init = 0,
/// Decodes/encodes a data frame.
EncodeDecode = 1, EncodeDecode = 1,
Unknown = 2, // Probably UnInit /// Shuts down the decoder.
Shutdown = 2,
/// Loads the saved decoder state. Used for DSP wake.
LoadState = 3,
/// Saves the decoder state. Used for DSP sleep.
SaveState = 4,
}; };
enum class DecoderCodec : u16 { enum class DecoderCodec : u16 {

View file

@ -111,7 +111,11 @@ std::optional<BinaryMessage> FDKDecoder::Impl::ProcessRequest(const BinaryMessag
case DecoderCommand::EncodeDecode: { case DecoderCommand::EncodeDecode: {
return Decode(request); return Decode(request);
} }
case DecoderCommand::Unknown: { case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState: {
LOG_WARNING(Audio_DSP, "Got unimplemented binary request: {}",
static_cast<u16>(request.header.cmd));
BinaryMessage response = request; BinaryMessage response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;

View file

@ -80,7 +80,11 @@ std::optional<BinaryMessage> FFMPEGDecoder::Impl::ProcessRequest(const BinaryMes
case DecoderCommand::EncodeDecode: { case DecoderCommand::EncodeDecode: {
return Decode(request); return Decode(request);
} }
case DecoderCommand::Unknown: { case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState: {
LOG_WARNING(Audio_DSP, "Got unimplemented binary request: {}",
static_cast<u16>(request.header.cmd));
BinaryMessage response = request; BinaryMessage response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;

View file

@ -319,6 +319,10 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, std::span<const u8> buffer) {
pipe_data[static_cast<u32>(pipe_number)].resize(sizeof(value)); pipe_data[static_cast<u32>(pipe_number)].resize(sizeof(value));
std::memcpy(pipe_data[static_cast<u32>(pipe_number)].data(), &value, sizeof(value)); std::memcpy(pipe_data[static_cast<u32>(pipe_number)].data(), &value, sizeof(value));
} }
auto dsp = dsp_dsp.lock();
if (dsp) {
dsp->SignalInterrupt(InterruptType::Pipe, DspPipe::Binary);
}
break; break;
} }
default: default:
@ -461,8 +465,6 @@ void DspHle::Impl::AudioTickCallback(s64 cycles_late) {
// TODO(merry): Signal all the other interrupts as appropriate. // TODO(merry): Signal all the other interrupts as appropriate.
if (auto service = dsp_dsp.lock()) { if (auto service = dsp_dsp.lock()) {
service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio); service->SignalInterrupt(InterruptType::Pipe, DspPipe::Audio);
// HACK(merry): Added to prevent regressions. Will remove soon.
service->SignalInterrupt(InterruptType::Pipe, DspPipe::Binary);
} }
} }

View file

@ -110,7 +110,11 @@ std::optional<BinaryMessage> MediaNDKDecoder::Impl::ProcessRequest(const BinaryM
case DecoderCommand::EncodeDecode: { case DecoderCommand::EncodeDecode: {
return Decode(request); return Decode(request);
} }
case DecoderCommand::Unknown: { case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState: {
LOG_WARNING(Audio_DSP, "Got unimplemented binary request: {}",
static_cast<u16>(request.header.cmd));
BinaryMessage response = request; BinaryMessage response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;

View file

@ -115,7 +115,11 @@ std::optional<BinaryMessage> WMFDecoder::Impl::ProcessRequest(const BinaryMessag
case DecoderCommand::EncodeDecode: { case DecoderCommand::EncodeDecode: {
return Decode(request); return Decode(request);
} }
case DecoderCommand::Unknown: { case DecoderCommand::Shutdown:
case DecoderCommand::SaveState:
case DecoderCommand::LoadState: {
LOG_WARNING(Audio_DSP, "Got unimplemented binary request: {}",
static_cast<u16>(request.header.cmd));
BinaryMessage response = request; BinaryMessage response = request;
response.header.result = ResultStatus::Success; response.header.result = ResultStatus::Success;
return response; return response;