diff options
| author | 2015-03-10 18:08:55 -0400 | |
|---|---|---|
| committer | 2015-03-10 18:08:55 -0400 | |
| commit | b56829df020a81248dd04688ff2b307f3444a09f (patch) | |
| tree | 24a438627339b2d506e659adfa0873cdf037852a /src/core/hle | |
| parent | Merge pull request #649 from lioncash/clean (diff) | |
| parent | Added LCD registers, and implementation for color filling in OGL code. (diff) | |
| download | yuzu-b56829df020a81248dd04688ff2b307f3444a09f.tar.gz yuzu-b56829df020a81248dd04688ff2b307f3444a09f.tar.xz yuzu-b56829df020a81248dd04688ff2b307f3444a09f.zip | |
Merge pull request #629 from archshift/lcdfb
Implement SetLcdForceBlack and add implementation for color filling in the GPU code
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index c23cfa3c8..cff585698 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -7,14 +7,20 @@ | |||
| 7 | #include "core/mem_map.h" | 7 | #include "core/mem_map.h" |
| 8 | #include "core/hle/kernel/event.h" | 8 | #include "core/hle/kernel/event.h" |
| 9 | #include "core/hle/kernel/shared_memory.h" | 9 | #include "core/hle/kernel/shared_memory.h" |
| 10 | #include "core/hle/result.h" | ||
| 10 | #include "gsp_gpu.h" | 11 | #include "gsp_gpu.h" |
| 12 | #include "core/hw/hw.h" | ||
| 11 | #include "core/hw/gpu.h" | 13 | #include "core/hw/gpu.h" |
| 14 | #include "core/hw/lcd.h" | ||
| 12 | 15 | ||
| 13 | #include "video_core/gpu_debugger.h" | 16 | #include "video_core/gpu_debugger.h" |
| 14 | 17 | ||
| 15 | // Main graphics debugger object - TODO: Here is probably not the best place for this | 18 | // Main graphics debugger object - TODO: Here is probably not the best place for this |
| 16 | GraphicsDebugger g_debugger; | 19 | GraphicsDebugger g_debugger; |
| 17 | 20 | ||
| 21 | // Beginning address of HW regs | ||
| 22 | const static u32 REGS_BEGIN = 0x1EB00000; | ||
| 23 | |||
| 18 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 24 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 19 | // Namespace GSP_GPU | 25 | // Namespace GSP_GPU |
| 20 | 26 | ||
| @@ -85,7 +91,7 @@ static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { | |||
| 85 | return; | 91 | return; |
| 86 | 92 | ||
| 87 | while (size_in_bytes > 0) { | 93 | while (size_in_bytes > 0) { |
| 88 | GPU::Write<u32>(base_address + 0x1EB00000, *data); | 94 | HW::Write<u32>(base_address + REGS_BEGIN, *data); |
| 89 | 95 | ||
| 90 | size_in_bytes -= 4; | 96 | size_in_bytes -= 4; |
| 91 | ++data; | 97 | ++data; |
| @@ -128,15 +134,15 @@ static void WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, const u32* | |||
| 128 | return; | 134 | return; |
| 129 | 135 | ||
| 130 | while (size_in_bytes > 0) { | 136 | while (size_in_bytes > 0) { |
| 131 | const u32 reg_address = base_address + 0x1EB00000; | 137 | const u32 reg_address = base_address + REGS_BEGIN; |
| 132 | 138 | ||
| 133 | u32 reg_value; | 139 | u32 reg_value; |
| 134 | GPU::Read<u32>(reg_value, reg_address); | 140 | HW::Read<u32>(reg_value, reg_address); |
| 135 | 141 | ||
| 136 | // Update the current value of the register only for set mask bits | 142 | // Update the current value of the register only for set mask bits |
| 137 | reg_value = (reg_value & ~*masks) | (*data | *masks); | 143 | reg_value = (reg_value & ~*masks) | (*data | *masks); |
| 138 | 144 | ||
| 139 | GPU::Write<u32>(reg_address, reg_value); | 145 | HW::Write<u32>(reg_address, reg_value); |
| 140 | 146 | ||
| 141 | size_in_bytes -= 4; | 147 | size_in_bytes -= 4; |
| 142 | ++data; | 148 | ++data; |
| @@ -188,7 +194,7 @@ static void ReadHWRegs(Service::Interface* self) { | |||
| 188 | u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); | 194 | u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); |
| 189 | 195 | ||
| 190 | while (size > 0) { | 196 | while (size > 0) { |
| 191 | GPU::Read<u32>(*dst, reg_addr + 0x1EB00000); | 197 | HW::Read<u32>(*dst, reg_addr + REGS_BEGIN); |
| 192 | 198 | ||
| 193 | size -= 4; | 199 | size -= 4; |
| 194 | ++dst; | 200 | ++dst; |
| @@ -427,6 +433,32 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { | |||
| 427 | } | 433 | } |
| 428 | } | 434 | } |
| 429 | 435 | ||
| 436 | /** | ||
| 437 | * GSP_GPU::SetLcdForceBlack service function | ||
| 438 | * | ||
| 439 | * Enable or disable REG_LCDCOLORFILL with the color black. | ||
| 440 | * | ||
| 441 | * Inputs: | ||
| 442 | * 1: Black color fill flag (0 = don't fill, !0 = fill) | ||
| 443 | * Outputs: | ||
| 444 | * 1: Result code | ||
| 445 | */ | ||
| 446 | static void SetLcdForceBlack(Service::Interface* self) { | ||
| 447 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 448 | |||
| 449 | bool enable_black = cmd_buff[1] != 0; | ||
| 450 | LCD::Regs::ColorFill data = {0}; | ||
| 451 | |||
| 452 | // Since data is already zeroed, there is no need to explicitly set | ||
| 453 | // the color to black (all zero). | ||
| 454 | data.is_enabled = enable_black; | ||
| 455 | |||
| 456 | LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_top), data.raw); // Top LCD | ||
| 457 | LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_bottom), data.raw); // Bottom LCD | ||
| 458 | |||
| 459 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 460 | } | ||
| 461 | |||
| 430 | /// This triggers handling of the GX command written to the command buffer in shared memory. | 462 | /// This triggers handling of the GX command written to the command buffer in shared memory. |
| 431 | static void TriggerCmdReqQueue(Service::Interface* self) { | 463 | static void TriggerCmdReqQueue(Service::Interface* self) { |
| 432 | // Iterate through each thread's command queue... | 464 | // Iterate through each thread's command queue... |
| @@ -460,7 +492,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 460 | {0x00080082, FlushDataCache, "FlushDataCache"}, | 492 | {0x00080082, FlushDataCache, "FlushDataCache"}, |
| 461 | {0x00090082, nullptr, "InvalidateDataCache"}, | 493 | {0x00090082, nullptr, "InvalidateDataCache"}, |
| 462 | {0x000A0044, nullptr, "RegisterInterruptEvents"}, | 494 | {0x000A0044, nullptr, "RegisterInterruptEvents"}, |
| 463 | {0x000B0040, nullptr, "SetLcdForceBlack"}, | 495 | {0x000B0040, SetLcdForceBlack, "SetLcdForceBlack"}, |
| 464 | {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"}, | 496 | {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"}, |
| 465 | {0x000D0140, nullptr, "SetDisplayTransfer"}, | 497 | {0x000D0140, nullptr, "SetDisplayTransfer"}, |
| 466 | {0x000E0180, nullptr, "SetTextureCopy"}, | 498 | {0x000E0180, nullptr, "SetTextureCopy"}, |