diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/CMakeLists.txt | 50 | ||||
-rw-r--r-- | src/core/arm/arm_interface.h | 2 | ||||
-rw-r--r-- | src/core/arm/interpreter/mmu/maverick.cpp | 4 | ||||
-rw-r--r-- | src/core/arm/interpreter/vfp/vfp_helper.h | 4 | ||||
-rw-r--r-- | src/core/arm/interpreter/vfp/vfpdouble.cpp | 8 | ||||
-rw-r--r-- | src/core/arm/interpreter/vfp/vfpsingle.cpp | 4 | ||||
-rw-r--r-- | src/core/core.cpp | 6 | ||||
-rw-r--r-- | src/core/core.vcxproj | 6 | ||||
-rw-r--r-- | src/core/core.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/core/hle/service/gsp.cpp | 70 | ||||
-rw-r--r-- | src/core/hle/service/gsp.h | 17 | ||||
-rw-r--r-- | src/core/hle/service/service.h | 2 | ||||
-rw-r--r-- | src/core/hw/gpu.cpp (renamed from src/core/hw/lcd.cpp) | 71 | ||||
-rw-r--r-- | src/core/hw/gpu.h (renamed from src/core/hw/lcd.h) | 36 | ||||
-rw-r--r-- | src/core/hw/hw.cpp | 16 | ||||
-rw-r--r-- | src/core/hw/ndma.cpp | 4 |
16 files changed, 224 insertions, 82 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7236033c4..7116b88e9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -44,8 +44,54 @@ set(SRCS core.cpp hle/service/ndm.cpp hle/service/service.cpp hle/service/srv.cpp + hw/gpu.cpp hw/hw.cpp - hw/lcd.cpp hw/ndma.cpp) -add_library(core STATIC ${SRCS}) +set(HEADERS core.h + core_timing.h + loader.h + mem_map.h + system.h + arm/disassembler/arm_disasm.h + arm/disassembler/load_symbol_map.h + arm/interpreter/arm_interpreter.h + arm/interpreter/arm_regformat.h + arm/interpreter/armcpu.h + arm/interpreter/armdefs.h + arm/interpreter/armemu.h + arm/interpreter/armmmu.h + arm/interpreter/armos.h + arm/interpreter/skyeye_defs.h + arm/interpreter/mmu/arm1176jzf_s_mmu.h + arm/interpreter/mmu/cache.h + arm/interpreter/mmu/rb.h + arm/interpreter/mmu/sa_mmu.h + arm/interpreter/mmu/tlb.h + arm/interpreter/mmu/wb.h + arm/interpreter/vfp/asm_vfp.h + arm/interpreter/vfp/vfp.h + arm/interpreter/vfp/vfp_helper.h + elf/elf_reader.h + elf/elf_types.h + file_sys/directory_file_system.h + file_sys/file_sys.h + file_sys/meta_file_system.h + hle/config_mem.h + hle/coprocessor.h + hle/hle.h + hle/svc.h + hle/kernel/kernel.h + hle/kernel/mutex.h + hle/kernel/thread.h + hle/function_wrappers.h + hle/service/apt.h + hle/service/gsp.h + hle/service/hid.h + hle/service/service.h + hle/service/srv.h + hw/gpu.h + hw/hw.h + hw/ndma.h) + +add_library(core STATIC ${SRCS} ${HEADERS}) diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 316b50fbb..be677ae20 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -25,7 +25,7 @@ public: */ void Run(int num_instructions) { ExecuteInstructions(num_instructions); - num_instructions += num_instructions; + this->num_instructions += num_instructions; } /// Step CPU by one instruction diff --git a/src/core/arm/interpreter/mmu/maverick.cpp b/src/core/arm/interpreter/mmu/maverick.cpp index 0e98ef22b..adcc2efb5 100644 --- a/src/core/arm/interpreter/mmu/maverick.cpp +++ b/src/core/arm/interpreter/mmu/maverick.cpp @@ -86,12 +86,12 @@ static union } reg_conv; static void -printf_nothing (void *foo, ...) +printf_nothing (const char *foo, ...) { } static void -cirrus_not_implemented (char *insn) +cirrus_not_implemented (const char *insn) { fprintf (stderr, "Cirrus instruction '%s' not implemented.\n", insn); fprintf (stderr, "aborting!\n"); diff --git a/src/core/arm/interpreter/vfp/vfp_helper.h b/src/core/arm/interpreter/vfp/vfp_helper.h index 80f9a93f4..b222e79f1 100644 --- a/src/core/arm/interpreter/vfp/vfp_helper.h +++ b/src/core/arm/interpreter/vfp/vfp_helper.h @@ -50,7 +50,7 @@ #define pr_info //printf #define pr_debug //printf -static u32 fls(int x); +static u32 vfp_fls(int x); #define do_div(n, base) {n/=base;} /* From vfpinstr.h */ @@ -508,7 +508,7 @@ struct op { u32 flags; }; -static inline u32 fls(int x) +static u32 vfp_fls(int x) { int r = 32; diff --git a/src/core/arm/interpreter/vfp/vfpdouble.cpp b/src/core/arm/interpreter/vfp/vfpdouble.cpp index cd5b5afa4..7f975cbeb 100644 --- a/src/core/arm/interpreter/vfp/vfpdouble.cpp +++ b/src/core/arm/interpreter/vfp/vfpdouble.cpp @@ -69,9 +69,9 @@ static void vfp_double_dump(const char *str, struct vfp_double *d) static void vfp_double_normalise_denormal(struct vfp_double *vd) { - int bits = 31 - fls(vd->significand >> 32); + int bits = 31 - vfp_fls(vd->significand >> 32); if (bits == 31) - bits = 63 - fls(vd->significand); + bits = 63 - vfp_fls(vd->significand); vfp_double_dump("normalise_denormal: in", vd); @@ -108,9 +108,9 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, exponent = vd->exponent; significand = vd->significand; - shift = 32 - fls(significand >> 32); + shift = 32 - vfp_fls(significand >> 32); if (shift == 32) - shift = 64 - fls(significand); + shift = 64 - vfp_fls(significand); if (shift) { exponent -= shift; significand <<= shift; diff --git a/src/core/arm/interpreter/vfp/vfpsingle.cpp b/src/core/arm/interpreter/vfp/vfpsingle.cpp index 05279f5ce..602713cff 100644 --- a/src/core/arm/interpreter/vfp/vfpsingle.cpp +++ b/src/core/arm/interpreter/vfp/vfpsingle.cpp @@ -69,7 +69,7 @@ static void vfp_single_dump(const char *str, struct vfp_single *s) static void vfp_single_normalise_denormal(struct vfp_single *vs) { - int bits = 31 - fls(vs->significand); + int bits = 31 - vfp_fls(vs->significand); vfp_single_dump("normalise_denormal: in", vs); @@ -111,7 +111,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, * bit 31, so we have VFP_SINGLE_LOW_BITS + 1 below the least * significant bit. */ - shift = 32 - fls(significand); + shift = 32 - vfp_fls(significand); if (shift < 32 && shift) { exponent -= shift; significand <<= shift; diff --git a/src/core/core.cpp b/src/core/core.cpp index d366498a5..7dc0809d0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -9,7 +9,7 @@ #include "core/core.h" #include "core/mem_map.h" #include "core/hw/hw.h" -#include "core/hw/lcd.h" +#include "core/hw/gpu.h" #include "core/arm/disassembler/arm_disasm.h" #include "core/arm/interpreter/arm_interpreter.h" @@ -26,7 +26,7 @@ ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core /// Run the core CPU loop void RunLoop() { for (;;){ - g_app_core->Run(LCD::kFrameTicks); + g_app_core->Run(GPU::kFrameTicks); HW::Update(); Kernel::Reschedule(); } @@ -38,7 +38,7 @@ void SingleStep() { // Update and reschedule after approx. 1 frame u64 current_ticks = Core::g_app_core->GetTicks(); - if ((current_ticks - g_last_ticks) >= LCD::kFrameTicks || HLE::g_reschedule) { + if ((current_ticks - g_last_ticks) >= GPU::kFrameTicks || HLE::g_reschedule) { g_last_ticks = current_ticks; HW::Update(); Kernel::Reschedule(); diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index 6fec75d79..8eb189a8b 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -179,8 +179,8 @@ <ClCompile Include="hle\service\service.cpp" /> <ClCompile Include="hle\service\srv.cpp" /> <ClCompile Include="hle\svc.cpp" /> + <ClCompile Include="hw\gpu.cpp" /> <ClCompile Include="hw\hw.cpp" /> - <ClCompile Include="hw\lcd.cpp" /> <ClCompile Include="hw\ndma.cpp" /> <ClCompile Include="loader.cpp" /> <ClCompile Include="mem_map.cpp" /> @@ -230,8 +230,8 @@ <ClInclude Include="hle\service\service.h" /> <ClInclude Include="hle\service\srv.h" /> <ClInclude Include="hle\svc.h" /> + <ClInclude Include="hw\gpu.h" /> <ClInclude Include="hw\hw.h" /> - <ClInclude Include="hw\lcd.h" /> <ClInclude Include="hw\ndma.h" /> <ClInclude Include="loader.h" /> <ClInclude Include="mem_map.h" /> @@ -243,4 +243,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index 8e5966d73..da781f816 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -102,7 +102,7 @@ <ClCompile Include="hw\ndma.cpp"> <Filter>hw</Filter> </ClCompile> - <ClCompile Include="hw\lcd.cpp"> + <ClCompile Include="hw\gpu.cpp"> <Filter>hw</Filter> </ClCompile> <ClCompile Include="arm\disassembler\load_symbol_map.cpp"> @@ -250,7 +250,7 @@ <ClInclude Include="hw\ndma.h"> <Filter>hw</Filter> </ClInclude> - <ClInclude Include="hw\lcd.h"> + <ClInclude Include="hw\gpu.h"> <Filter>hw</Filter> </ClInclude> <ClInclude Include="arm\disassembler\load_symbol_map.h"> @@ -311,4 +311,4 @@ <ItemGroup> <Text Include="CMakeLists.txt" /> </ItemGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index f31e7d86d..f75ba75c2 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -11,25 +11,29 @@ #include "core/hle/kernel/event.h" #include "core/hle/service/gsp.h" -#include "core/hw/lcd.h" +#include "core/hw/gpu.h" + +#include "video_core/gpu_debugger.h" //////////////////////////////////////////////////////////////////////////////////////////////////// +// Main graphics debugger object - TODO: Here is probably not the best place for this +GraphicsDebugger g_debugger; + /// GSP shared memory GX command buffer header union GX_CmdBufferHeader { u32 hex; - // Current command index. This index is updated by GSP module after loading the command data, - // right before the command is processed. When this index is updated by GSP module, the total + // Current command index. This index is updated by GSP module after loading the command data, + // right before the command is processed. When this index is updated by GSP module, the total // commands field is decreased by one as well. BitField<0,8,u32> index; - + // Total commands to process, must not be value 0 when GSP module handles commands. This must be - // <=15 when writing a command to shared memory. This is incremented by the application when - // writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only + // <=15 when writing a command to shared memory. This is incremented by the application when + // writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only // used if this field is value 1. BitField<8,8,u32> number_commands; - }; /// Gets the address of the start (header) of a command buffer in GSP shared memory @@ -45,7 +49,11 @@ static inline u8* GX_GetCmdBufferPointer(u32 thread_id, u32 offset=0) { /// Finishes execution of a GSP command void GX_FinishCommand(u32 thread_id) { GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(thread_id); + + g_debugger.GXCommandProcessed(GX_GetCmdBufferPointer(thread_id, 0x20 + (header->index * 0x20))); + header->number_commands = header->number_commands - 1; + // TODO: Increment header->index? } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -57,24 +65,20 @@ Handle g_event_handle = 0; u32 g_thread_id = 0; enum { - CMD_GX_REQUEST_DMA = 0x00000000, -}; - -enum { REG_FRAMEBUFFER_1 = 0x00400468, REG_FRAMEBUFFER_2 = 0x00400494, }; /// Read a GSP GPU hardware register void ReadHWRegs(Service::Interface* self) { - static const u32 framebuffer_1[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME1, LCD::PADDR_VRAM_TOP_RIGHT_FRAME1}; - static const u32 framebuffer_2[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME2, LCD::PADDR_VRAM_TOP_RIGHT_FRAME2}; + static const u32 framebuffer_1[] = {GPU::PADDR_VRAM_TOP_LEFT_FRAME1, GPU::PADDR_VRAM_TOP_RIGHT_FRAME1}; + static const u32 framebuffer_2[] = {GPU::PADDR_VRAM_TOP_LEFT_FRAME2, GPU::PADDR_VRAM_TOP_RIGHT_FRAME2}; u32* cmd_buff = Service::GetCommandBuffer(); u32 reg_addr = cmd_buff[1]; u32 size = cmd_buff[2]; u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); - + switch (reg_addr) { // NOTE: Calling SetFramebufferLocation here is a hack... Not sure the correct way yet to set @@ -83,13 +87,13 @@ void ReadHWRegs(Service::Interface* self) { // Top framebuffer 1 addresses case REG_FRAMEBUFFER_1: - LCD::SetFramebufferLocation(LCD::FRAMEBUFFER_LOCATION_VRAM); + GPU::SetFramebufferLocation(GPU::FRAMEBUFFER_LOCATION_VRAM); memcpy(dst, framebuffer_1, size); break; // Top framebuffer 2 addresses case REG_FRAMEBUFFER_2: - LCD::SetFramebufferLocation(LCD::FRAMEBUFFER_LOCATION_VRAM); + GPU::SetFramebufferLocation(GPU::FRAMEBUFFER_LOCATION_VRAM); memcpy(dst, framebuffer_2, size); break; @@ -119,22 +123,50 @@ void RegisterInterruptRelayQueue(Service::Interface* self) { cmd_buff[2] = g_thread_id; // ThreadID } + /// This triggers handling of the GX command written to the command buffer in shared memory. void TriggerCmdReqQueue(Service::Interface* self) { GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(g_thread_id); u32* cmd_buff = (u32*)GX_GetCmdBufferPointer(g_thread_id, 0x20 + (header->index * 0x20)); - switch (cmd_buff[0]) { + switch (static_cast<GXCommandId>(cmd_buff[0])) { // GX request DMA - typically used for copying memory from GSP heap to VRAM - case CMD_GX_REQUEST_DMA: + case GXCommandId::REQUEST_DMA: memcpy(Memory::GetPointer(cmd_buff[2]), Memory::GetPointer(cmd_buff[1]), cmd_buff[3]); break; + case GXCommandId::SET_COMMAND_LIST_LAST: + GPU::Write<u32>(GPU::Registers::CommandListAddress, cmd_buff[1] >> 3); + GPU::Write<u32>(GPU::Registers::CommandListSize, cmd_buff[2] >> 3); + GPU::Write<u32>(GPU::Registers::ProcessCommandList, 1); // TODO: Not sure if we are supposed to always write this + + // TODO: Move this to GPU + // TODO: Not sure what units the size is measured in + g_debugger.CommandListCalled(cmd_buff[1], (u32*)Memory::GetPointer(cmd_buff[1]), cmd_buff[2]); + break; + + case GXCommandId::SET_MEMORY_FILL: + break; + + case GXCommandId::SET_DISPLAY_TRANSFER: + break; + + case GXCommandId::SET_TEXTURE_COPY: + break; + + case GXCommandId::SET_COMMAND_LIST_FIRST: + { + //u32* buf0_data = (u32*)Memory::GetPointer(cmd_buff[1]); + //u32* buf1_data = (u32*)Memory::GetPointer(cmd_buff[3]); + //u32* buf2_data = (u32*)Memory::GetPointer(cmd_buff[5]); + break; + } + default: ERROR_LOG(GSP, "unknown command 0x%08X", cmd_buff[0]); } - + GX_FinishCommand(g_thread_id); } diff --git a/src/core/hle/service/gsp.h b/src/core/hle/service/gsp.h index eb5786cd1..214de140f 100644 --- a/src/core/hle/service/gsp.h +++ b/src/core/hle/service/gsp.h @@ -11,6 +11,23 @@ namespace GSP_GPU { +enum class GXCommandId : u32 { + REQUEST_DMA = 0x00000000, + SET_COMMAND_LIST_LAST = 0x00000001, + SET_MEMORY_FILL = 0x00000002, // TODO: Confirm? (lictru uses 0x01000102) + SET_DISPLAY_TRANSFER = 0x00000003, + SET_TEXTURE_COPY = 0x00000004, + SET_COMMAND_LIST_FIRST = 0x00000005, +}; + +union GXCommand { + struct { + GXCommandId id; + }; + + u32 data[0x20]; +}; + /// Interface to "srv:" service class Interface : public Service::Interface { public: diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 166d13038..dcd525727 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -71,7 +71,7 @@ public: /// Frees a handle from the service template <class T> void DeleteHandle(const Handle handle) { - g_object_pool.Destroy<T>(handle); + Kernel::g_object_pool.Destroy<T>(handle); m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); } diff --git a/src/core/hw/lcd.cpp b/src/core/hw/gpu.cpp index 6cbce14ed..f0ca4eada 100644 --- a/src/core/hw/lcd.cpp +++ b/src/core/hw/gpu.cpp @@ -7,13 +7,13 @@ #include "core/core.h" #include "core/mem_map.h" -#include "core/hw/lcd.h" +#include "core/hle/kernel/thread.h" +#include "core/hw/gpu.h" #include "video_core/video_core.h" -#include "core/hle/kernel/thread.h" -namespace LCD { +namespace GPU { Registers g_regs; @@ -59,7 +59,7 @@ const FramebufferLocation GetFramebufferLocation() { } else if ((g_regs.framebuffer_top_right_1 & ~Memory::FCRAM_MASK) == Memory::FCRAM_PADDR) { return FRAMEBUFFER_LOCATION_FCRAM; } else { - ERROR_LOG(LCD, "unknown framebuffer location!"); + ERROR_LOG(GPU, "unknown framebuffer location!"); } return FRAMEBUFFER_LOCATION_UNKNOWN; } @@ -76,7 +76,7 @@ const u8* GetFramebufferPointer(const u32 address) { case FRAMEBUFFER_LOCATION_VRAM: return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_VRAM(address)); default: - ERROR_LOG(LCD, "unknown framebuffer location"); + ERROR_LOG(GPU, "unknown framebuffer location"); } return NULL; } @@ -84,34 +84,73 @@ const u8* GetFramebufferPointer(const u32 address) { template <typename T> inline void Read(T &var, const u32 addr) { switch (addr) { - case REG_FRAMEBUFFER_TOP_LEFT_1: + case Registers::FramebufferTopLeft1: var = g_regs.framebuffer_top_left_1; break; - case REG_FRAMEBUFFER_TOP_LEFT_2: + + case Registers::FramebufferTopLeft2: var = g_regs.framebuffer_top_left_2; break; - case REG_FRAMEBUFFER_TOP_RIGHT_1: + + case Registers::FramebufferTopRight1: var = g_regs.framebuffer_top_right_1; break; - case REG_FRAMEBUFFER_TOP_RIGHT_2: + + case Registers::FramebufferTopRight2: var = g_regs.framebuffer_top_right_2; break; - case REG_FRAMEBUFFER_SUB_LEFT_1: + + case Registers::FramebufferSubLeft1: var = g_regs.framebuffer_sub_left_1; break; - case REG_FRAMEBUFFER_SUB_RIGHT_1: + + case Registers::FramebufferSubRight1: var = g_regs.framebuffer_sub_right_1; break; + + case Registers::CommandListSize: + var = g_regs.command_list_size; + break; + + case Registers::CommandListAddress: + var = g_regs.command_list_address; + break; + + case Registers::ProcessCommandList: + var = g_regs.command_processing_enabled; + break; + default: - ERROR_LOG(LCD, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); + ERROR_LOG(GPU, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr); break; } - } template <typename T> inline void Write(u32 addr, const T data) { - ERROR_LOG(LCD, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); + switch (static_cast<Registers::Id>(addr)) { + case Registers::CommandListSize: + g_regs.command_list_size = data; + break; + + case Registers::CommandListAddress: + g_regs.command_list_address = data; + break; + + case Registers::ProcessCommandList: + g_regs.command_processing_enabled = data; + if (g_regs.command_processing_enabled & 1) + { + // u32* buffer = (u32*)Memory::GetPointer(g_regs.command_list_address << 3); + ERROR_LOG(GPU, "Beginning %x bytes of commands from address %x", g_regs.command_list_size, g_regs.command_list_address << 3); + // TODO: Process command list! + } + break; + + default: + ERROR_LOG(GPU, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr); + break; + } } // Explicitly instantiate template functions because we aren't defining this in the header: @@ -142,12 +181,12 @@ void Update() { void Init() { g_last_ticks = Core::g_app_core->GetTicks(); SetFramebufferLocation(FRAMEBUFFER_LOCATION_FCRAM); - NOTICE_LOG(LCD, "initialized OK"); + NOTICE_LOG(GPU, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(LCD, "shutdown OK"); + NOTICE_LOG(GPU, "shutdown OK"); } } // namespace diff --git a/src/core/hw/lcd.h b/src/core/hw/gpu.h index 7484f8f66..3314ba989 100644 --- a/src/core/hw/lcd.h +++ b/src/core/hw/gpu.h @@ -6,12 +6,27 @@ #include "common/common_types.h" -namespace LCD { +namespace GPU { static const u32 kFrameCycles = 268123480 / 60; ///< 268MHz / 60 frames per second static const u32 kFrameTicks = kFrameCycles / 3; ///< Approximate number of instructions/frame struct Registers { + enum Id : u32 { + FramebufferTopLeft1 = 0x1EF00468, // Main LCD, first framebuffer for 3D left + FramebufferTopLeft2 = 0x1EF0046C, // Main LCD, second framebuffer for 3D left + FramebufferTopRight1 = 0x1EF00494, // Main LCD, first framebuffer for 3D right + FramebufferTopRight2 = 0x1EF00498, // Main LCD, second framebuffer for 3D right + FramebufferSubLeft1 = 0x1EF00568, // Sub LCD, first framebuffer + FramebufferSubLeft2 = 0x1EF0056C, // Sub LCD, second framebuffer + FramebufferSubRight1 = 0x1EF00594, // Sub LCD, unused first framebuffer + FramebufferSubRight2 = 0x1EF00598, // Sub LCD, unused second framebuffer + + CommandListSize = 0x1EF018E0, + CommandListAddress = 0x1EF018E8, + ProcessCommandList = 0x1EF018F0, + }; + u32 framebuffer_top_left_1; u32 framebuffer_top_left_2; u32 framebuffer_top_right_1; @@ -20,6 +35,10 @@ struct Registers { u32 framebuffer_sub_left_2; u32 framebuffer_sub_right_1; u32 framebuffer_sub_right_2; + + u32 command_list_size; + u32 command_list_address; + u32 command_processing_enabled; }; extern Registers g_regs; @@ -27,7 +46,7 @@ extern Registers g_regs; enum { TOP_ASPECT_X = 0x5, TOP_ASPECT_Y = 0x3, - + TOP_HEIGHT = 240, TOP_WIDTH = 400, BOTTOM_WIDTH = 320, @@ -51,21 +70,10 @@ enum { PADDR_VRAM_SUB_FRAME2 = 0x18249CF0, }; -enum { - REG_FRAMEBUFFER_TOP_LEFT_1 = 0x1EF00468, // Main LCD, first framebuffer for 3D left - REG_FRAMEBUFFER_TOP_LEFT_2 = 0x1EF0046C, // Main LCD, second framebuffer for 3D left - REG_FRAMEBUFFER_TOP_RIGHT_1 = 0x1EF00494, // Main LCD, first framebuffer for 3D right - REG_FRAMEBUFFER_TOP_RIGHT_2 = 0x1EF00498, // Main LCD, second framebuffer for 3D right - REG_FRAMEBUFFER_SUB_LEFT_1 = 0x1EF00568, // Sub LCD, first framebuffer - REG_FRAMEBUFFER_SUB_LEFT_2 = 0x1EF0056C, // Sub LCD, second framebuffer - REG_FRAMEBUFFER_SUB_RIGHT_1 = 0x1EF00594, // Sub LCD, unused first framebuffer - REG_FRAMEBUFFER_SUB_RIGHT_2 = 0x1EF00598, // Sub LCD, unused second framebuffer -}; - /// Framebuffer location enum FramebufferLocation { FRAMEBUFFER_LOCATION_UNKNOWN, ///< Framebuffer location is unknown - FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap + FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap FRAMEBUFFER_LOCATION_VRAM, ///< Framebuffer is in VRAM }; diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 85669ae7f..ed70486e6 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -6,7 +6,7 @@ #include "common/log.h" #include "core/hw/hw.h" -#include "core/hw/lcd.h" +#include "core/hw/gpu.h" #include "core/hw/ndma.h" namespace HW { @@ -34,7 +34,7 @@ enum { VADDR_CDMA = 0xFFFDA000, // CoreLink DMA-330? Info VADDR_DSP_2 = 0x1ED03000, VADDR_HASH_2 = 0x1EE01000, - VADDR_LCD = 0x1EF00000, + VADDR_GPU = 0x1EF00000, }; template <typename T> @@ -46,8 +46,8 @@ inline void Read(T &var, const u32 addr) { // NDMA::Read(var, addr); // break; - case VADDR_LCD: - LCD::Read(var, addr); + case VADDR_GPU: + GPU::Read(var, addr); break; default: @@ -64,8 +64,8 @@ inline void Write(u32 addr, const T data) { // NDMA::Write(addr, data); // break; - case VADDR_LCD: - LCD::Write(addr, data); + case VADDR_GPU: + GPU::Write(addr, data); break; default: @@ -87,13 +87,13 @@ template void Write<u8>(u32 addr, const u8 data); /// Update hardware void Update() { - LCD::Update(); + GPU::Update(); NDMA::Update(); } /// Initialize hardware void Init() { - LCD::Init(); + GPU::Init(); NDMA::Init(); NOTICE_LOG(HW, "initialized OK"); } diff --git a/src/core/hw/ndma.cpp b/src/core/hw/ndma.cpp index 52e459ebd..f6aa72d16 100644 --- a/src/core/hw/ndma.cpp +++ b/src/core/hw/ndma.cpp @@ -37,12 +37,12 @@ void Update() { /// Initialize hardware void Init() { - NOTICE_LOG(LCD, "initialized OK"); + NOTICE_LOG(GPU, "initialized OK"); } /// Shutdown hardware void Shutdown() { - NOTICE_LOG(LCD, "shutdown OK"); + NOTICE_LOG(GPU, "shutdown OK"); } } // namespace |