diff options
Diffstat (limited to 'src/core/hle/service/gsp.cpp')
| -rw-r--r-- | src/core/hle/service/gsp.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index f793b592c..417c01b83 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp | |||
| @@ -105,6 +105,40 @@ void ReadHWRegs(Service::Interface* self) { | |||
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { | ||
| 109 | u32 base_address = 0x400000; | ||
| 110 | if (info.active_fb == 0) { | ||
| 111 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].address_left1), 4, &info.address_left); | ||
| 112 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].address_right1), 4, &info.address_right); | ||
| 113 | } else { | ||
| 114 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].address_left2), 4, &info.address_left); | ||
| 115 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].address_right2), 4, &info.address_right); | ||
| 116 | } | ||
| 117 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].stride), 4, &info.stride); | ||
| 118 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].color_format), 4, &info.format); | ||
| 119 | WriteHWRegs(base_address + 4 * GPU_REG_INDEX(framebuffer_config[screen_id].active_fb), 4, &info.shown_fb); | ||
| 120 | } | ||
| 121 | |||
| 122 | /** | ||
| 123 | * GSP_GPU::SetBufferSwap service function | ||
| 124 | * | ||
| 125 | * Updates GPU display framebuffer configuration using the specified parameters. | ||
| 126 | * | ||
| 127 | * Inputs: | ||
| 128 | * 1 : Screen ID (0 = top screen, 1 = bottom screen) | ||
| 129 | * 2-7 : FrameBufferInfo structure | ||
| 130 | * Outputs: | ||
| 131 | * 1: Result code | ||
| 132 | */ | ||
| 133 | void SetBufferSwap(Service::Interface* self) { | ||
| 134 | u32* cmd_buff = Service::GetCommandBuffer(); | ||
| 135 | u32 screen_id = cmd_buff[1]; | ||
| 136 | FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2]; | ||
| 137 | SetBufferSwap(screen_id, *fb_info); | ||
| 138 | |||
| 139 | cmd_buff[1] = 0; // No error | ||
| 140 | } | ||
| 141 | |||
| 108 | /** | 142 | /** |
| 109 | * GSP_GPU::RegisterInterruptRelayQueue service function | 143 | * GSP_GPU::RegisterInterruptRelayQueue service function |
| 110 | * Inputs: | 144 | * Inputs: |
| @@ -283,7 +317,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 283 | {0x00020084, nullptr, "WriteHWRegsWithMask"}, | 317 | {0x00020084, nullptr, "WriteHWRegsWithMask"}, |
| 284 | {0x00030082, nullptr, "WriteHWRegRepeat"}, | 318 | {0x00030082, nullptr, "WriteHWRegRepeat"}, |
| 285 | {0x00040080, ReadHWRegs, "ReadHWRegs"}, | 319 | {0x00040080, ReadHWRegs, "ReadHWRegs"}, |
| 286 | {0x00050200, nullptr, "SetBufferSwap"}, | 320 | {0x00050200, SetBufferSwap, "SetBufferSwap"}, |
| 287 | {0x00060082, nullptr, "SetCommandList"}, | 321 | {0x00060082, nullptr, "SetCommandList"}, |
| 288 | {0x000700C2, nullptr, "RequestDma"}, | 322 | {0x000700C2, nullptr, "RequestDma"}, |
| 289 | {0x00080082, nullptr, "FlushDataCache"}, | 323 | {0x00080082, nullptr, "FlushDataCache"}, |