Use IPC:MakeHeader instead of hardcoded raw values for IPC command tables. (#6453)

* Use IPC:MakeHeader instead of hardcoded values for IPC command tables.

* Use u32 instead of unsigned int in MakeHeader function

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>

* Fix clang format

---------

Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>
This commit is contained in:
PabloMK7 2023-04-28 07:31:03 +02:00 committed by GitHub
parent 9bd8c9290b
commit 63bc0b59bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 1983 additions and 1896 deletions

View file

@ -820,37 +820,39 @@ SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) {
GSP_GPU::GSP_GPU(Core::System& system) : ServiceFramework("gsp::Gpu", 2), system(system) {
static const FunctionInfo functions[] = {
{0x00010082, &GSP_GPU::WriteHWRegs, "WriteHWRegs"},
{0x00020084, &GSP_GPU::WriteHWRegsWithMask, "WriteHWRegsWithMask"},
{0x00030082, nullptr, "WriteHWRegRepeat"},
{0x00040080, &GSP_GPU::ReadHWRegs, "ReadHWRegs"},
{0x00050200, &GSP_GPU::SetBufferSwap, "SetBufferSwap"},
{0x00060082, nullptr, "SetCommandList"},
{0x000700C2, nullptr, "RequestDma"},
{0x00080082, &GSP_GPU::FlushDataCache, "FlushDataCache"},
{0x00090082, &GSP_GPU::InvalidateDataCache, "InvalidateDataCache"},
{0x000A0044, nullptr, "RegisterInterruptEvents"},
{0x000B0040, &GSP_GPU::SetLcdForceBlack, "SetLcdForceBlack"},
{0x000C0000, &GSP_GPU::TriggerCmdReqQueue, "TriggerCmdReqQueue"},
{0x000D0140, nullptr, "SetDisplayTransfer"},
{0x000E0180, nullptr, "SetTextureCopy"},
{0x000F0200, nullptr, "SetMemoryFill"},
{0x00100040, &GSP_GPU::SetAxiConfigQoSMode, "SetAxiConfigQoSMode"},
{0x00110040, nullptr, "SetPerfLogMode"},
{0x00120000, nullptr, "GetPerfLog"},
{0x00130042, &GSP_GPU::RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
{0x00140000, &GSP_GPU::UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"},
{0x00150002, nullptr, "TryAcquireRight"},
{0x00160042, &GSP_GPU::AcquireRight, "AcquireRight"},
{0x00170000, &GSP_GPU::ReleaseRight, "ReleaseRight"},
{0x00180000, &GSP_GPU::ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"},
{0x00190000, &GSP_GPU::SaveVramSysArea, "SaveVramSysArea"},
{0x001A0000, &GSP_GPU::RestoreVramSysArea, "RestoreVramSysArea"},
{0x001B0000, nullptr, "ResetGpuCore"},
{0x001C0040, &GSP_GPU::SetLedForceOff, "SetLedForceOff"},
{0x001D0040, nullptr, "SetTestCommand"},
{0x001E0080, nullptr, "SetInternalPriorities"},
{0x001F0082, &GSP_GPU::StoreDataCache, "StoreDataCache"},
// clang-format off
{IPC::MakeHeader(0x0001, 2, 2), &GSP_GPU::WriteHWRegs, "WriteHWRegs"},
{IPC::MakeHeader(0x0002, 2, 4), &GSP_GPU::WriteHWRegsWithMask, "WriteHWRegsWithMask"},
{IPC::MakeHeader(0x0003, 2, 2), nullptr, "WriteHWRegRepeat"},
{IPC::MakeHeader(0x0004, 2, 0), &GSP_GPU::ReadHWRegs, "ReadHWRegs"},
{IPC::MakeHeader(0x0005, 8, 0), &GSP_GPU::SetBufferSwap, "SetBufferSwap"},
{IPC::MakeHeader(0x0006, 2, 2), nullptr, "SetCommandList"},
{IPC::MakeHeader(0x0007, 3, 2), nullptr, "RequestDma"},
{IPC::MakeHeader(0x0008, 2, 2), &GSP_GPU::FlushDataCache, "FlushDataCache"},
{IPC::MakeHeader(0x0009, 2, 2), &GSP_GPU::InvalidateDataCache, "InvalidateDataCache"},
{IPC::MakeHeader(0x000A, 1, 4), nullptr, "RegisterInterruptEvents"},
{IPC::MakeHeader(0x000B, 1, 0), &GSP_GPU::SetLcdForceBlack, "SetLcdForceBlack"},
{IPC::MakeHeader(0x000C, 0, 0), &GSP_GPU::TriggerCmdReqQueue, "TriggerCmdReqQueue"},
{IPC::MakeHeader(0x000D, 5, 0), nullptr, "SetDisplayTransfer"},
{IPC::MakeHeader(0x000E, 6, 0), nullptr, "SetTextureCopy"},
{IPC::MakeHeader(0x000F, 8, 0), nullptr, "SetMemoryFill"},
{IPC::MakeHeader(0x0010, 1, 0), &GSP_GPU::SetAxiConfigQoSMode, "SetAxiConfigQoSMode"},
{IPC::MakeHeader(0x0011, 1, 0), nullptr, "SetPerfLogMode"},
{IPC::MakeHeader(0x0012, 0, 0), nullptr, "GetPerfLog"},
{IPC::MakeHeader(0x0013, 1, 2), &GSP_GPU::RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
{IPC::MakeHeader(0x0014, 0, 0), &GSP_GPU::UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"},
{IPC::MakeHeader(0x0015, 0, 2), nullptr, "TryAcquireRight"},
{IPC::MakeHeader(0x0016, 1, 2), &GSP_GPU::AcquireRight, "AcquireRight"},
{IPC::MakeHeader(0x0017, 0, 0), &GSP_GPU::ReleaseRight, "ReleaseRight"},
{IPC::MakeHeader(0x0018, 0, 0), &GSP_GPU::ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"},
{IPC::MakeHeader(0x0019, 0, 0), &GSP_GPU::SaveVramSysArea, "SaveVramSysArea"},
{IPC::MakeHeader(0x001A, 0, 0), &GSP_GPU::RestoreVramSysArea, "RestoreVramSysArea"},
{IPC::MakeHeader(0x001B, 0, 0), nullptr, "ResetGpuCore"},
{IPC::MakeHeader(0x001C, 1, 0), &GSP_GPU::SetLedForceOff, "SetLedForceOff"},
{IPC::MakeHeader(0x001D, 1, 0), nullptr, "SetTestCommand"},
{IPC::MakeHeader(0x001E, 2, 0), nullptr, "SetInternalPriorities"},
{IPC::MakeHeader(0x001F, 2, 2), &GSP_GPU::StoreDataCache, "StoreDataCache"},
// clang-format on
};
RegisterHandlers(functions);

View file

@ -12,15 +12,17 @@ namespace Service::GSP {
GSP_LCD::GSP_LCD() : ServiceFramework("gsp::Lcd") {
static const FunctionInfo functions[] = {
{0x000A0080, nullptr, "SetBrightnessRaw"},
{0x000B0080, nullptr, "SetBrightness"},
{0x000F0000, nullptr, "PowerOnAllBacklights"},
{0x00100000, nullptr, "PowerOffAllBacklights"},
{0x00110040, nullptr, "PowerOnBacklight"},
{0x00120040, nullptr, "PowerOffBacklight"},
{0x00130040, nullptr, "SetLedForceOff"},
{0x00140000, nullptr, "GetVendor"},
{0x00150040, nullptr, "GetBrightness"},
// clang-format off
{IPC::MakeHeader(0x000A, 2, 0), nullptr, "SetBrightnessRaw"},
{IPC::MakeHeader(0x000B, 2, 0), nullptr, "SetBrightness"},
{IPC::MakeHeader(0x000F, 0, 0), nullptr, "PowerOnAllBacklights"},
{IPC::MakeHeader(0x0010, 0, 0), nullptr, "PowerOffAllBacklights"},
{IPC::MakeHeader(0x0011, 1, 0), nullptr, "PowerOnBacklight"},
{IPC::MakeHeader(0x0012, 1, 0), nullptr, "PowerOffBacklight"},
{IPC::MakeHeader(0x0013, 1, 0), nullptr, "SetLedForceOff"},
{IPC::MakeHeader(0x0014, 0, 0), nullptr, "GetVendor"},
{IPC::MakeHeader(0x0015, 1, 0), nullptr, "GetBrightness"},
// clang-format on
};
RegisterHandlers(functions);
};