summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/gsp_gpu.cpp44
-rw-r--r--src/core/hw/gpu.cpp9
-rw-r--r--src/core/hw/hw.cpp26
-rw-r--r--src/core/hw/hw.h26
4 files changed, 69 insertions, 36 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index c23cfa3c8..3b4a7b664 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -7,7 +7,9 @@
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"
12 14
13#include "video_core/gpu_debugger.h" 15#include "video_core/gpu_debugger.h"
@@ -85,7 +87,7 @@ static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) {
85 return; 87 return;
86 88
87 while (size_in_bytes > 0) { 89 while (size_in_bytes > 0) {
88 GPU::Write<u32>(base_address + 0x1EB00000, *data); 90 HW::Write<u32>(base_address + 0x1EB00000, *data);
89 91
90 size_in_bytes -= 4; 92 size_in_bytes -= 4;
91 ++data; 93 ++data;
@@ -131,12 +133,12 @@ static void WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, const u32*
131 const u32 reg_address = base_address + 0x1EB00000; 133 const u32 reg_address = base_address + 0x1EB00000;
132 134
133 u32 reg_value; 135 u32 reg_value;
134 GPU::Read<u32>(reg_value, reg_address); 136 HW::Read<u32>(reg_value, reg_address);
135 137
136 // Update the current value of the register only for set mask bits 138 // Update the current value of the register only for set mask bits
137 reg_value = (reg_value & ~*masks) | (*data | *masks); 139 reg_value = (reg_value & ~*masks) | (*data | *masks);
138 140
139 GPU::Write<u32>(reg_address, reg_value); 141 HW::Write<u32>(reg_address, reg_value);
140 142
141 size_in_bytes -= 4; 143 size_in_bytes -= 4;
142 ++data; 144 ++data;
@@ -188,7 +190,7 @@ static void ReadHWRegs(Service::Interface* self) {
188 u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); 190 u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]);
189 191
190 while (size > 0) { 192 while (size > 0) {
191 GPU::Read<u32>(*dst, reg_addr + 0x1EB00000); 193 HW::Read<u32>(*dst, reg_addr + 0x1EB00000);
192 194
193 size -= 4; 195 size -= 4;
194 ++dst; 196 ++dst;
@@ -427,6 +429,38 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
427 } 429 }
428} 430}
429 431
432/**
433 * GSP_GPU::SetLcdForceBlack service function
434 *
435 * Enable or disable REG_LCDCOLORFILL with the color black.
436 *
437 * Inputs:
438 * 1: Black color fill flag (0 = don't fill, !0 = fill)
439 * Outputs:
440 * 1: Result code
441 */
442void SetLcdForceBlack(Service::Interface* self) {
443 // TODO: currently has no effect, as LCD reg writes have nowhere to go.
444
445 u32* cmd_buff = Kernel::GetCommandBuffer();
446 bool enable_black = cmd_buff[1] != 0;
447 u32 data = 0;
448
449 if (enable_black) {
450 // Sets bit 24 to 1, enabling the fill
451 // Since data is already 0x00000000, there is no need to explicitly set
452 // bits 0-23 to zero (black), or bit 24 to 0 (fill disabled).
453 data |= (1 << 24);
454 }
455
456 u32 data_main = data;
457 u32 data_sub = data;
458 WriteHWRegs(0x202204, 4, &data_main); // Main LCD
459 WriteHWRegs(0x202A04, 4, &data_sub); // Sub LCD
460
461 cmd_buff[1] = RESULT_SUCCESS.raw;
462}
463
430/// This triggers handling of the GX command written to the command buffer in shared memory. 464/// This triggers handling of the GX command written to the command buffer in shared memory.
431static void TriggerCmdReqQueue(Service::Interface* self) { 465static void TriggerCmdReqQueue(Service::Interface* self) {
432 // Iterate through each thread's command queue... 466 // Iterate through each thread's command queue...
@@ -460,7 +494,7 @@ const Interface::FunctionInfo FunctionTable[] = {
460 {0x00080082, FlushDataCache, "FlushDataCache"}, 494 {0x00080082, FlushDataCache, "FlushDataCache"},
461 {0x00090082, nullptr, "InvalidateDataCache"}, 495 {0x00090082, nullptr, "InvalidateDataCache"},
462 {0x000A0044, nullptr, "RegisterInterruptEvents"}, 496 {0x000A0044, nullptr, "RegisterInterruptEvents"},
463 {0x000B0040, nullptr, "SetLcdForceBlack"}, 497 {0x000B0040, SetLcdForceBlack, "SetLcdForceBlack"},
464 {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"}, 498 {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"},
465 {0x000D0140, nullptr, "SetDisplayTransfer"}, 499 {0x000D0140, nullptr, "SetDisplayTransfer"},
466 {0x000E0180, nullptr, "SetTextureCopy"}, 500 {0x000E0180, nullptr, "SetTextureCopy"},
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 424ce2ca7..9942aab1f 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -15,12 +15,13 @@
15#include "core/hle/service/gsp_gpu.h" 15#include "core/hle/service/gsp_gpu.h"
16#include "core/hle/service/dsp_dsp.h" 16#include "core/hle/service/dsp_dsp.h"
17 17
18#include "core/hw/hw.h"
18#include "core/hw/gpu.h" 19#include "core/hw/gpu.h"
19 20
20#include "video_core/command_processor.h" 21#include "video_core/command_processor.h"
21#include "video_core/utils.h" 22#include "video_core/utils.h"
22#include "video_core/video_core.h" 23#include "video_core/video_core.h"
23#include <video_core/color.h> 24#include "video_core/color.h"
24 25
25namespace GPU { 26namespace GPU {
26 27
@@ -40,7 +41,7 @@ static bool last_skip_frame = false;
40 41
41template <typename T> 42template <typename T>
42inline void Read(T &var, const u32 raw_addr) { 43inline void Read(T &var, const u32 raw_addr) {
43 u32 addr = raw_addr - 0x1EF00000; 44 u32 addr = raw_addr - HW::VADDR_GPU;
44 u32 index = addr / 4; 45 u32 index = addr / 4;
45 46
46 // Reads other than u32 are untested, so I'd rather have them abort than silently fail 47 // Reads other than u32 are untested, so I'd rather have them abort than silently fail
@@ -54,7 +55,7 @@ inline void Read(T &var, const u32 raw_addr) {
54 55
55template <typename T> 56template <typename T>
56inline void Write(u32 addr, const T data) { 57inline void Write(u32 addr, const T data) {
57 addr -= 0x1EF00000; 58 addr -= HW::VADDR_GPU;
58 u32 index = addr / 4; 59 u32 index = addr / 4;
59 60
60 // Writes other than u32 are untested, so I'd rather have them abort than silently fail 61 // Writes other than u32 are untested, so I'd rather have them abort than silently fail
@@ -313,8 +314,6 @@ void Init() {
313 framebuffer_top.address_right2 = 0x182B9800; 314 framebuffer_top.address_right2 = 0x182B9800;
314 framebuffer_sub.address_left1 = 0x1848F000; 315 framebuffer_sub.address_left1 = 0x1848F000;
315 framebuffer_sub.address_left2 = 0x184C7800; 316 framebuffer_sub.address_left2 = 0x184C7800;
316 //framebuffer_sub.address_right1 = unknown;
317 //framebuffer_sub.address_right2 = unknown;
318 317
319 framebuffer_top.width = 240; 318 framebuffer_top.width = 240;
320 framebuffer_top.height = 400; 319 framebuffer_top.height = 400;
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp
index a63ba6eeb..bf4722cf7 100644
--- a/src/core/hw/hw.cpp
+++ b/src/core/hw/hw.cpp
@@ -9,32 +9,6 @@
9 9
10namespace HW { 10namespace HW {
11 11
12enum {
13 VADDR_HASH = 0x1EC01000,
14 VADDR_CSND = 0x1EC03000,
15 VADDR_DSP = 0x1EC40000,
16 VADDR_PDN = 0x1EC41000,
17 VADDR_CODEC = 0x1EC41000,
18 VADDR_SPI = 0x1EC42000,
19 VADDR_SPI_2 = 0x1EC43000, // Only used under TWL_FIRM?
20 VADDR_I2C = 0x1EC44000,
21 VADDR_CODEC_2 = 0x1EC45000,
22 VADDR_HID = 0x1EC46000,
23 VADDR_PAD = 0x1EC46000,
24 VADDR_PTM = 0x1EC46000,
25 VADDR_GPIO = 0x1EC47000,
26 VADDR_I2C_2 = 0x1EC48000,
27 VADDR_SPI_3 = 0x1EC60000,
28 VADDR_I2C_3 = 0x1EC61000,
29 VADDR_MIC = 0x1EC62000,
30 VADDR_PXI = 0x1EC63000, // 0xFFFD2000
31 //VADDR_NTRCARD
32 VADDR_CDMA = 0xFFFDA000, // CoreLink DMA-330? Info
33 VADDR_DSP_2 = 0x1ED03000,
34 VADDR_HASH_2 = 0x1EE01000,
35 VADDR_GPU = 0x1EF00000,
36};
37
38template <typename T> 12template <typename T>
39inline void Read(T &var, const u32 addr) { 13inline void Read(T &var, const u32 addr) {
40 switch (addr & 0xFFFFF000) { 14 switch (addr & 0xFFFFF000) {
diff --git a/src/core/hw/hw.h b/src/core/hw/hw.h
index 991c0a07d..6feeba08c 100644
--- a/src/core/hw/hw.h
+++ b/src/core/hw/hw.h
@@ -8,6 +8,32 @@
8 8
9namespace HW { 9namespace HW {
10 10
11enum {
12 VADDR_IO = 0x1EC00000,
13 VADDR_HASH = 0x1EC01000,
14 VADDR_CSND = 0x1EC03000,
15 VADDR_DSP = 0x1EC40000,
16 VADDR_PDN = 0x1EC41000,
17 VADDR_CODEC = 0x1EC41000,
18 VADDR_SPI = 0x1EC42000,
19 VADDR_SPI_2 = 0x1EC43000, // Only used under TWL_FIRM?
20 VADDR_I2C = 0x1EC44000,
21 VADDR_CODEC_2 = 0x1EC45000,
22 VADDR_HID = 0x1EC46000,
23 VADDR_GPIO = 0x1EC47000,
24 VADDR_I2C_2 = 0x1EC48000,
25 VADDR_SPI_3 = 0x1EC60000,
26 VADDR_I2C_3 = 0x1EC61000,
27 VADDR_MIC = 0x1EC62000,
28 VADDR_PXI = 0x1EC63000, // 0xFFFD2000
29 //VADDR_NTRCARD
30 VADDR_CDMA = 0xFFFDA000, // CoreLink DMA-330? Info
31 VADDR_LCD = 0x1ED02000,
32 VADDR_DSP_2 = 0x1ED03000,
33 VADDR_HASH_2 = 0x1EE01000,
34 VADDR_GPU = 0x1EF00000,
35};
36
11template <typename T> 37template <typename T>
12void Read(T &var, const u32 addr); 38void Read(T &var, const u32 addr);
13 39