diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 78cb761be..947958703 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -18,13 +18,11 @@ // Main graphics debugger object - TODO: Here is probably not the best place for this GraphicsDebugger g_debugger; -// Beginning address of HW regs -const static u32 REGS_BEGIN = 0x1EB00000; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace GSP_GPU +namespace Service { +namespace GSP { -namespace GSP_GPU { +// Beginning address of HW regs +const u32 REGS_BEGIN = 0x1EB00000; const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED( ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument, @@ -179,7 +177,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr * 2 : number of registers to write sequentially * 4 : pointer to source data array */ -static void WriteHWRegs(Service::Interface* self) { +static void WriteHWRegs(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 reg_addr = cmd_buff[1]; u32 size = cmd_buff[2]; @@ -199,7 +197,7 @@ static void WriteHWRegs(Service::Interface* self) { * 4 : pointer to source data array * 6 : pointer to mask array */ -static void WriteHWRegsWithMask(Service::Interface* self) { +static void WriteHWRegsWithMask(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 reg_addr = cmd_buff[1]; u32 size = cmd_buff[2]; @@ -211,7 +209,7 @@ static void WriteHWRegsWithMask(Service::Interface* self) { } /// Read a GSP GPU hardware register -static void ReadHWRegs(Service::Interface* self) { +static void ReadHWRegs(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 reg_addr = cmd_buff[1]; u32 size = cmd_buff[2]; @@ -298,7 +296,7 @@ ResultCode SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { * Outputs: * 1: Result code */ -static void SetBufferSwap(Service::Interface* self) { +static void SetBufferSwap(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 screen_id = cmd_buff[1]; FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2]; @@ -319,7 +317,7 @@ static void SetBufferSwap(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void FlushDataCache(Service::Interface* self) { +static void FlushDataCache(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 address = cmd_buff[1]; u32 size = cmd_buff[2]; @@ -340,7 +338,7 @@ static void FlushDataCache(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void SetAxiConfigQoSMode(Service::Interface* self) { +static void SetAxiConfigQoSMode(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 mode = cmd_buff[1]; @@ -359,7 +357,7 @@ static void SetAxiConfigQoSMode(Service::Interface* self) { * 2 : Thread index into GSP command buffer * 4 : Handle to GSP shared memory */ -static void RegisterInterruptRelayQueue(Service::Interface* self) { +static void RegisterInterruptRelayQueue(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 flags = cmd_buff[1]; @@ -391,7 +389,7 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) { * Outputs: * 1 : Result of function, 0 on success, otherwise error code */ -static void UnregisterInterruptRelayQueue(Service::Interface* self) { +static void UnregisterInterruptRelayQueue(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); g_thread_id = 0; @@ -592,7 +590,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { * Outputs: * 1: Result code */ -static void SetLcdForceBlack(Service::Interface* self) { +static void SetLcdForceBlack(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); bool enable_black = cmd_buff[1] != 0; @@ -609,7 +607,7 @@ static void SetLcdForceBlack(Service::Interface* self) { } /// This triggers handling of the GX command written to the command buffer in shared memory. -static void TriggerCmdReqQueue(Service::Interface* self) { +static void TriggerCmdReqQueue(Interface* self) { // Iterate through each thread's command queue... for (unsigned thread_id = 0; thread_id < 0x4; ++thread_id) { CommandBuffer* command_buffer = (CommandBuffer*)GetCommandBuffer(thread_id); @@ -638,6 +636,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) { * Inputs: * 0: Header 0x00180000 * Outputs: + * 0: Header Code[0x00180240] * 1: Result code * 2: Left framebuffer virtual address for the main screen * 3: Right framebuffer virtual address for the main screen @@ -648,7 +647,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) { * 8: Bottom screen framebuffer format * 9: Bottom screen framebuffer width */ -static void ImportDisplayCaptureInfo(Service::Interface* self) { +static void ImportDisplayCaptureInfo(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0, @@ -660,18 +659,19 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) { FrameBufferUpdate* top_screen = GetFrameBufferInfo(thread_id, 0); FrameBufferUpdate* bottom_screen = GetFrameBufferInfo(thread_id, 1); + cmd_buff[0] = IPC::MakeHeader(0x18, 0x9, 0); + cmd_buff[1] = RESULT_SUCCESS.raw; + // Top Screen cmd_buff[2] = top_screen->framebuffer_info[top_screen->index].address_left; cmd_buff[3] = top_screen->framebuffer_info[top_screen->index].address_right; cmd_buff[4] = top_screen->framebuffer_info[top_screen->index].format; cmd_buff[5] = top_screen->framebuffer_info[top_screen->index].stride; - + // Bottom Screen cmd_buff[6] = bottom_screen->framebuffer_info[bottom_screen->index].address_left; cmd_buff[7] = bottom_screen->framebuffer_info[bottom_screen->index].address_right; cmd_buff[8] = bottom_screen->framebuffer_info[bottom_screen->index].format; cmd_buff[9] = bottom_screen->framebuffer_info[bottom_screen->index].stride; - cmd_buff[1] = RESULT_SUCCESS.raw; - LOG_WARNING(Service_GSP, "called"); } @@ -680,7 +680,7 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) { * Outputs: * 1: Result code */ -static void AcquireRight(Service::Interface* self) { +static void AcquireRight(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); gpu_right_acquired = true; @@ -695,7 +695,7 @@ static void AcquireRight(Service::Interface* self) { * Outputs: * 1: Result code */ -static void ReleaseRight(Service::Interface* self) { +static void ReleaseRight(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); gpu_right_acquired = false; @@ -739,10 +739,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x001F0082, nullptr, "StoreDataCache"}, }; -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { +GSP_GPU::GSP_GPU() { Register(FunctionTable); g_interrupt_event = nullptr; @@ -757,10 +754,11 @@ Interface::Interface() { first_initialization = true; } -Interface::~Interface() { +GSP_GPU::~GSP_GPU() { g_interrupt_event = nullptr; g_shared_memory = nullptr; gpu_right_acquired = false; } -} // namespace +} // namespace GSP +} // namespace Service |