From 1dfa3928242ad486040b1c65768faa2c7fce4654 Mon Sep 17 00:00:00 2001
From: Tony Wasserka
Date: Sat, 17 May 2014 22:50:33 +0200
Subject: Rename LCD to GPU.
---
src/common/log.h | 2 +-
src/common/log_manager.cpp | 2 +-
src/core/CMakeLists.txt | 4 +-
src/core/core.vcxproj | 6 +-
src/core/core.vcxproj.filters | 6 +-
src/core/hle/service/gsp.cpp | 16 +-
src/core/hw/gpu.cpp | 194 +++++++++++++++++++++
src/core/hw/gpu.h | 111 ++++++++++++
src/core/hw/hw.cpp | 16 +-
src/core/hw/lcd.cpp | 194 ---------------------
src/core/hw/lcd.h | 111 ------------
src/core/hw/ndma.cpp | 4 +-
src/video_core/renderer_opengl/renderer_opengl.cpp | 6 +-
13 files changed, 336 insertions(+), 336 deletions(-)
create mode 100644 src/core/hw/gpu.cpp
create mode 100644 src/core/hw/gpu.h
delete mode 100644 src/core/hw/lcd.cpp
delete mode 100644 src/core/hw/lcd.h
(limited to 'src')
diff --git a/src/common/log.h b/src/common/log.h
index 8b39b03a1..d0da68aad 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -60,7 +60,7 @@ enum LOG_TYPE {
NDMA,
HLE,
RENDER,
- LCD,
+ GPU,
HW,
TIME,
NETPLAY,
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp
index 146472888..b4a761c75 100644
--- a/src/common/log_manager.cpp
+++ b/src/common/log_manager.cpp
@@ -65,7 +65,7 @@ LogManager::LogManager()
m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");
m_Log[LogTypes::RENDER] = new LogContainer("RENDER", "RENDER");
- m_Log[LogTypes::LCD] = new LogContainer("LCD", "LCD");
+ m_Log[LogTypes::GPU] = new LogContainer("GPU", "GPU");
m_Log[LogTypes::SVC] = new LogContainer("SVC", "Supervisor Call HLE");
m_Log[LogTypes::NDMA] = new LogContainer("NDMA", "NDMA");
m_Log[LogTypes::HLE] = new LogContainer("HLE", "High Level Emulation");
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4086b415b..1c1a2eeb3 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -42,8 +42,8 @@ set(SRCS core.cpp
hle/service/hid.cpp
hle/service/service.cpp
hle/service/srv.cpp
+ hw/gpu.cpp
hw/hw.cpp
- hw/lcd.cpp
hw/ndma.cpp)
set(HEADERS core.h
@@ -88,8 +88,8 @@ set(HEADERS core.h
hle/service/hid.h
hle/service/service.h
hle/service/srv.h
+ hw/gpu.h
hw/hw.h
- hw/lcd.h
hw/ndma.h)
add_library(core STATIC ${SRCS} ${HEADERS})
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index f271d336e..8a3ad83ea 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -177,8 +177,8 @@
+
-
@@ -226,8 +226,8 @@
+
-
@@ -239,4 +239,4 @@
-
\ No newline at end of file
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index b6c1d5b93..f7b342f98 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -102,7 +102,7 @@
hw
-
+
hw
@@ -244,7 +244,7 @@
hw
-
+
hw
@@ -299,4 +299,4 @@
-
\ No newline at end of file
+
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp
index a42759053..d51e6c66d 100644
--- a/src/core/hle/service/gsp.cpp
+++ b/src/core/hle/service/gsp.cpp
@@ -10,7 +10,7 @@
#include "core/hle/hle.h"
#include "core/hle/service/gsp.h"
-#include "core/hw/lcd.h"
+#include "core/hw/gpu.h"
#include "video_core/gpu_debugger.h"
@@ -69,8 +69,8 @@ enum {
/// 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];
@@ -85,13 +85,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;
@@ -123,9 +123,9 @@ void TriggerCmdReqQueue(Service::Interface* self) {
break;
case GXCommandId::SET_COMMAND_LIST_LAST:
- LCD::Write(LCD::CommandListAddress, cmd_buff[1] >> 3);
- LCD::Write(LCD::CommandListSize, cmd_buff[2] >> 3);
- LCD::Write(LCD::ProcessCommandList, 1); // TODO: Not sure if we are supposed to always write this
+ GPU::Write(GPU::CommandListAddress, cmd_buff[1] >> 3);
+ GPU::Write(GPU::CommandListSize, cmd_buff[2] >> 3);
+ GPU::Write(GPU::ProcessCommandList, 1); // TODO: Not sure if we are supposed to always write this
break;
case GXCommandId::SET_MEMORY_FILL:
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
new file mode 100644
index 000000000..632e1aaac
--- /dev/null
+++ b/src/core/hw/gpu.cpp
@@ -0,0 +1,194 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "common/common_types.h"
+#include "common/log.h"
+
+#include "core/core.h"
+#include "core/mem_map.h"
+#include "core/hle/kernel/thread.h"
+#include "core/hw/gpu.h"
+
+#include "video_core/video_core.h"
+
+
+namespace GPU {
+
+Registers g_regs;
+
+static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second
+
+u64 g_last_ticks = 0; ///< Last CPU ticks
+
+/**
+ * Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
+ * @param
+ */
+void SetFramebufferLocation(const FramebufferLocation mode) {
+ switch (mode) {
+ case FRAMEBUFFER_LOCATION_FCRAM:
+ g_regs.framebuffer_top_left_1 = PADDR_TOP_LEFT_FRAME1;
+ g_regs.framebuffer_top_left_2 = PADDR_TOP_LEFT_FRAME2;
+ g_regs.framebuffer_top_right_1 = PADDR_TOP_RIGHT_FRAME1;
+ g_regs.framebuffer_top_right_2 = PADDR_TOP_RIGHT_FRAME2;
+ g_regs.framebuffer_sub_left_1 = PADDR_SUB_FRAME1;
+ //g_regs.framebuffer_sub_left_2 = unknown;
+ g_regs.framebuffer_sub_right_1 = PADDR_SUB_FRAME2;
+ //g_regs.framebufferr_sub_right_2 = unknown;
+ break;
+
+ case FRAMEBUFFER_LOCATION_VRAM:
+ g_regs.framebuffer_top_left_1 = PADDR_VRAM_TOP_LEFT_FRAME1;
+ g_regs.framebuffer_top_left_2 = PADDR_VRAM_TOP_LEFT_FRAME2;
+ g_regs.framebuffer_top_right_1 = PADDR_VRAM_TOP_RIGHT_FRAME1;
+ g_regs.framebuffer_top_right_2 = PADDR_VRAM_TOP_RIGHT_FRAME2;
+ g_regs.framebuffer_sub_left_1 = PADDR_VRAM_SUB_FRAME1;
+ //g_regs.framebuffer_sub_left_2 = unknown;
+ g_regs.framebuffer_sub_right_1 = PADDR_VRAM_SUB_FRAME2;
+ //g_regs.framebufferr_sub_right_2 = unknown;
+ break;
+ }
+}
+
+/**
+ * Gets the location of the framebuffers
+ * @return Location of framebuffers as FramebufferLocation enum
+ */
+const FramebufferLocation GetFramebufferLocation() {
+ if ((g_regs.framebuffer_top_right_1 & ~Memory::VRAM_MASK) == Memory::VRAM_PADDR) {
+ return FRAMEBUFFER_LOCATION_VRAM;
+ } else if ((g_regs.framebuffer_top_right_1 & ~Memory::FCRAM_MASK) == Memory::FCRAM_PADDR) {
+ return FRAMEBUFFER_LOCATION_FCRAM;
+ } else {
+ ERROR_LOG(GPU, "unknown framebuffer location!");
+ }
+ return FRAMEBUFFER_LOCATION_UNKNOWN;
+}
+
+/**
+ * Gets a read-only pointer to a framebuffer in memory
+ * @param address Physical address of framebuffer
+ * @return Returns const pointer to raw framebuffer
+ */
+const u8* GetFramebufferPointer(const u32 address) {
+ switch (GetFramebufferLocation()) {
+ case FRAMEBUFFER_LOCATION_FCRAM:
+ return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_FCRAM(address));
+ case FRAMEBUFFER_LOCATION_VRAM:
+ return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_VRAM(address));
+ default:
+ ERROR_LOG(GPU, "unknown framebuffer location");
+ }
+ return NULL;
+}
+
+template
+inline void Read(T &var, const u32 addr) {
+ switch (addr) {
+ case REG_FRAMEBUFFER_TOP_LEFT_1:
+ var = g_regs.framebuffer_top_left_1;
+ break;
+
+ case REG_FRAMEBUFFER_TOP_LEFT_2:
+ var = g_regs.framebuffer_top_left_2;
+ break;
+
+ case REG_FRAMEBUFFER_TOP_RIGHT_1:
+ var = g_regs.framebuffer_top_right_1;
+ break;
+
+ case REG_FRAMEBUFFER_TOP_RIGHT_2:
+ var = g_regs.framebuffer_top_right_2;
+ break;
+
+ case REG_FRAMEBUFFER_SUB_LEFT_1:
+ var = g_regs.framebuffer_sub_left_1;
+ break;
+
+ case REG_FRAMEBUFFER_SUB_RIGHT_1:
+ var = g_regs.framebuffer_sub_right_1;
+ break;
+
+ case CommandListSize:
+ var = g_regs.command_list_size;
+ break;
+
+ case CommandListAddress:
+ var = g_regs.command_list_address;
+ break;
+
+ case ProcessCommandList:
+ var = g_regs.command_processing_enabled;
+ break;
+
+ default:
+ ERROR_LOG(GPU, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
+ break;
+ }
+}
+
+template
+inline void Write(u32 addr, const T data) {
+ switch (addr) {
+ case CommandListSize:
+ g_regs.command_list_size = data;
+ break;
+
+ case CommandListAddress:
+ g_regs.command_list_address = data;
+ break;
+
+ case 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:
+
+template void Read(u64 &var, const u32 addr);
+template void Read(u32 &var, const u32 addr);
+template void Read(u16 &var, const u32 addr);
+template void Read(u8 &var, const u32 addr);
+
+template void Write(u32 addr, const u64 data);
+template void Write(u32 addr, const u32 data);
+template void Write(u32 addr, const u16 data);
+template void Write(u32 addr, const u8 data);
+
+/// Update hardware
+void Update() {
+ u64 current_ticks = Core::g_app_core->GetTicks();
+
+ // Fake a vertical blank
+ if ((current_ticks - g_last_ticks) >= kFrameTicks) {
+ g_last_ticks = current_ticks;
+ VideoCore::g_renderer->SwapBuffers();
+ Kernel::WaitCurrentThread(WAITTYPE_VBLANK);
+ }
+}
+
+/// Initialize hardware
+void Init() {
+ g_last_ticks = Core::g_app_core->GetTicks();
+ SetFramebufferLocation(FRAMEBUFFER_LOCATION_FCRAM);
+ NOTICE_LOG(GPU, "initialized OK");
+}
+
+/// Shutdown hardware
+void Shutdown() {
+ NOTICE_LOG(GPU, "shutdown OK");
+}
+
+} // namespace
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
new file mode 100644
index 000000000..c81b1bb3f
--- /dev/null
+++ b/src/core/hw/gpu.h
@@ -0,0 +1,111 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+namespace GPU {
+
+struct Registers {
+ u32 framebuffer_top_left_1;
+ u32 framebuffer_top_left_2;
+ u32 framebuffer_top_right_1;
+ u32 framebuffer_top_right_2;
+ u32 framebuffer_sub_left_1;
+ 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;
+
+enum {
+ TOP_ASPECT_X = 0x5,
+ TOP_ASPECT_Y = 0x3,
+
+ TOP_HEIGHT = 240,
+ TOP_WIDTH = 400,
+ BOTTOM_WIDTH = 320,
+
+ // Physical addresses in FCRAM used by ARM9 applications - these are correct for real hardware
+ PADDR_FRAMEBUFFER_SEL = 0x20184E59,
+ PADDR_TOP_LEFT_FRAME1 = 0x20184E60,
+ PADDR_TOP_LEFT_FRAME2 = 0x201CB370,
+ PADDR_TOP_RIGHT_FRAME1 = 0x20282160,
+ PADDR_TOP_RIGHT_FRAME2 = 0x202C8670,
+ PADDR_SUB_FRAME1 = 0x202118E0,
+ PADDR_SUB_FRAME2 = 0x20249CF0,
+
+ // Physical addresses in VRAM - I'm not sure how these are actually allocated (so not real)
+ PADDR_VRAM_FRAMEBUFFER_SEL = 0x18184E59,
+ PADDR_VRAM_TOP_LEFT_FRAME1 = 0x18184E60,
+ PADDR_VRAM_TOP_LEFT_FRAME2 = 0x181CB370,
+ PADDR_VRAM_TOP_RIGHT_FRAME1 = 0x18282160,
+ PADDR_VRAM_TOP_RIGHT_FRAME2 = 0x182C8670,
+ PADDR_VRAM_SUB_FRAME1 = 0x182118E0,
+ 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
+
+ CommandListSize = 0x1EF018E0,
+ CommandListAddress = 0x1EF018E8,
+ ProcessCommandList = 0x1EF018F0,
+};
+
+/// Framebuffer location
+enum FramebufferLocation {
+ FRAMEBUFFER_LOCATION_UNKNOWN, ///< Framebuffer location is unknown
+ FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap
+ FRAMEBUFFER_LOCATION_VRAM, ///< Framebuffer is in VRAM
+};
+
+/**
+ * Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
+ * @param
+ */
+void SetFramebufferLocation(const FramebufferLocation mode);
+
+/**
+ * Gets a read-only pointer to a framebuffer in memory
+ * @param address Physical address of framebuffer
+ * @return Returns const pointer to raw framebuffer
+ */
+const u8* GetFramebufferPointer(const u32 address);
+
+/**
+ * Gets the location of the framebuffers
+ */
+const FramebufferLocation GetFramebufferLocation();
+
+template
+inline void Read(T &var, const u32 addr);
+
+template
+inline void Write(u32 addr, const T data);
+
+/// Update hardware
+void Update();
+
+/// Initialize hardware
+void Init();
+
+/// Shutdown hardware
+void Shutdown();
+
+
+} // namespace
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
@@ -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(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/lcd.cpp b/src/core/hw/lcd.cpp
deleted file mode 100644
index 61ee99c1f..000000000
--- a/src/core/hw/lcd.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#include "common/common_types.h"
-#include "common/log.h"
-
-#include "core/core.h"
-#include "core/mem_map.h"
-#include "core/hle/kernel/thread.h"
-#include "core/hw/lcd.h"
-
-#include "video_core/video_core.h"
-
-
-namespace LCD {
-
-Registers g_regs;
-
-static const u32 kFrameTicks = 268123480 / 60; ///< 268MHz / 60 frames per second
-
-u64 g_last_ticks = 0; ///< Last CPU ticks
-
-/**
- * Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
- * @param
- */
-void SetFramebufferLocation(const FramebufferLocation mode) {
- switch (mode) {
- case FRAMEBUFFER_LOCATION_FCRAM:
- g_regs.framebuffer_top_left_1 = PADDR_TOP_LEFT_FRAME1;
- g_regs.framebuffer_top_left_2 = PADDR_TOP_LEFT_FRAME2;
- g_regs.framebuffer_top_right_1 = PADDR_TOP_RIGHT_FRAME1;
- g_regs.framebuffer_top_right_2 = PADDR_TOP_RIGHT_FRAME2;
- g_regs.framebuffer_sub_left_1 = PADDR_SUB_FRAME1;
- //g_regs.framebuffer_sub_left_2 = unknown;
- g_regs.framebuffer_sub_right_1 = PADDR_SUB_FRAME2;
- //g_regs.framebufferr_sub_right_2 = unknown;
- break;
-
- case FRAMEBUFFER_LOCATION_VRAM:
- g_regs.framebuffer_top_left_1 = PADDR_VRAM_TOP_LEFT_FRAME1;
- g_regs.framebuffer_top_left_2 = PADDR_VRAM_TOP_LEFT_FRAME2;
- g_regs.framebuffer_top_right_1 = PADDR_VRAM_TOP_RIGHT_FRAME1;
- g_regs.framebuffer_top_right_2 = PADDR_VRAM_TOP_RIGHT_FRAME2;
- g_regs.framebuffer_sub_left_1 = PADDR_VRAM_SUB_FRAME1;
- //g_regs.framebuffer_sub_left_2 = unknown;
- g_regs.framebuffer_sub_right_1 = PADDR_VRAM_SUB_FRAME2;
- //g_regs.framebufferr_sub_right_2 = unknown;
- break;
- }
-}
-
-/**
- * Gets the location of the framebuffers
- * @return Location of framebuffers as FramebufferLocation enum
- */
-const FramebufferLocation GetFramebufferLocation() {
- if ((g_regs.framebuffer_top_right_1 & ~Memory::VRAM_MASK) == Memory::VRAM_PADDR) {
- return FRAMEBUFFER_LOCATION_VRAM;
- } 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!");
- }
- return FRAMEBUFFER_LOCATION_UNKNOWN;
-}
-
-/**
- * Gets a read-only pointer to a framebuffer in memory
- * @param address Physical address of framebuffer
- * @return Returns const pointer to raw framebuffer
- */
-const u8* GetFramebufferPointer(const u32 address) {
- switch (GetFramebufferLocation()) {
- case FRAMEBUFFER_LOCATION_FCRAM:
- return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_FCRAM(address));
- case FRAMEBUFFER_LOCATION_VRAM:
- return (const u8*)Memory::GetPointer(Memory::VirtualAddressFromPhysical_VRAM(address));
- default:
- ERROR_LOG(LCD, "unknown framebuffer location");
- }
- return NULL;
-}
-
-template
-inline void Read(T &var, const u32 addr) {
- switch (addr) {
- case REG_FRAMEBUFFER_TOP_LEFT_1:
- var = g_regs.framebuffer_top_left_1;
- break;
-
- case REG_FRAMEBUFFER_TOP_LEFT_2:
- var = g_regs.framebuffer_top_left_2;
- break;
-
- case REG_FRAMEBUFFER_TOP_RIGHT_1:
- var = g_regs.framebuffer_top_right_1;
- break;
-
- case REG_FRAMEBUFFER_TOP_RIGHT_2:
- var = g_regs.framebuffer_top_right_2;
- break;
-
- case REG_FRAMEBUFFER_SUB_LEFT_1:
- var = g_regs.framebuffer_sub_left_1;
- break;
-
- case REG_FRAMEBUFFER_SUB_RIGHT_1:
- var = g_regs.framebuffer_sub_right_1;
- break;
-
- case CommandListSize:
- var = g_regs.command_list_size;
- break;
-
- case CommandListAddress:
- var = g_regs.command_list_address;
- break;
-
- case ProcessCommandList:
- var = g_regs.command_processing_enabled;
- break;
-
- default:
- ERROR_LOG(LCD, "unknown Read%d @ 0x%08X", sizeof(var) * 8, addr);
- break;
- }
-}
-
-template
-inline void Write(u32 addr, const T data) {
- switch (addr) {
- case CommandListSize:
- g_regs.command_list_size = data;
- break;
-
- case CommandListAddress:
- g_regs.command_list_address = data;
- break;
-
- case 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(LCD, "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(LCD, "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:
-
-template void Read(u64 &var, const u32 addr);
-template void Read(u32 &var, const u32 addr);
-template void Read(u16 &var, const u32 addr);
-template void Read(u8 &var, const u32 addr);
-
-template void Write(u32 addr, const u64 data);
-template void Write(u32 addr, const u32 data);
-template void Write(u32 addr, const u16 data);
-template void Write(u32 addr, const u8 data);
-
-/// Update hardware
-void Update() {
- u64 current_ticks = Core::g_app_core->GetTicks();
-
- // Fake a vertical blank
- if ((current_ticks - g_last_ticks) >= kFrameTicks) {
- g_last_ticks = current_ticks;
- VideoCore::g_renderer->SwapBuffers();
- Kernel::WaitCurrentThread(WAITTYPE_VBLANK);
- }
-}
-
-/// Initialize hardware
-void Init() {
- g_last_ticks = Core::g_app_core->GetTicks();
- SetFramebufferLocation(FRAMEBUFFER_LOCATION_FCRAM);
- NOTICE_LOG(LCD, "initialized OK");
-}
-
-/// Shutdown hardware
-void Shutdown() {
- NOTICE_LOG(LCD, "shutdown OK");
-}
-
-} // namespace
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h
deleted file mode 100644
index 2ae852d7c..000000000
--- a/src/core/hw/lcd.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "common/common_types.h"
-
-namespace LCD {
-
-struct Registers {
- u32 framebuffer_top_left_1;
- u32 framebuffer_top_left_2;
- u32 framebuffer_top_right_1;
- u32 framebuffer_top_right_2;
- u32 framebuffer_sub_left_1;
- 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;
-
-enum {
- TOP_ASPECT_X = 0x5,
- TOP_ASPECT_Y = 0x3,
-
- TOP_HEIGHT = 240,
- TOP_WIDTH = 400,
- BOTTOM_WIDTH = 320,
-
- // Physical addresses in FCRAM used by ARM9 applications - these are correct for real hardware
- PADDR_FRAMEBUFFER_SEL = 0x20184E59,
- PADDR_TOP_LEFT_FRAME1 = 0x20184E60,
- PADDR_TOP_LEFT_FRAME2 = 0x201CB370,
- PADDR_TOP_RIGHT_FRAME1 = 0x20282160,
- PADDR_TOP_RIGHT_FRAME2 = 0x202C8670,
- PADDR_SUB_FRAME1 = 0x202118E0,
- PADDR_SUB_FRAME2 = 0x20249CF0,
-
- // Physical addresses in VRAM - I'm not sure how these are actually allocated (so not real)
- PADDR_VRAM_FRAMEBUFFER_SEL = 0x18184E59,
- PADDR_VRAM_TOP_LEFT_FRAME1 = 0x18184E60,
- PADDR_VRAM_TOP_LEFT_FRAME2 = 0x181CB370,
- PADDR_VRAM_TOP_RIGHT_FRAME1 = 0x18282160,
- PADDR_VRAM_TOP_RIGHT_FRAME2 = 0x182C8670,
- PADDR_VRAM_SUB_FRAME1 = 0x182118E0,
- 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
-
- CommandListSize = 0x1EF018E0,
- CommandListAddress = 0x1EF018E8,
- ProcessCommandList = 0x1EF018F0,
-};
-
-/// Framebuffer location
-enum FramebufferLocation {
- FRAMEBUFFER_LOCATION_UNKNOWN, ///< Framebuffer location is unknown
- FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap
- FRAMEBUFFER_LOCATION_VRAM, ///< Framebuffer is in VRAM
-};
-
-/**
- * Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM
- * @param
- */
-void SetFramebufferLocation(const FramebufferLocation mode);
-
-/**
- * Gets a read-only pointer to a framebuffer in memory
- * @param address Physical address of framebuffer
- * @return Returns const pointer to raw framebuffer
- */
-const u8* GetFramebufferPointer(const u32 address);
-
-/**
- * Gets the location of the framebuffers
- */
-const FramebufferLocation GetFramebufferLocation();
-
-template
-inline void Read(T &var, const u32 addr);
-
-template
-inline void Write(u32 addr, const T data);
-
-/// Update hardware
-void Update();
-
-/// Initialize hardware
-void Init();
-
-/// Shutdown hardware
-void Shutdown();
-
-
-} // namespace
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
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index bb5eb34aa..70af47c59 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "core/hw/lcd.h"
+#include "core/hw/gpu.h"
#include "video_core/video_core.h"
#include "video_core/renderer_opengl/renderer_opengl.h"
@@ -77,8 +77,8 @@ void RendererOpenGL::FlipFramebuffer(const u8* in, u8* out) {
*/
void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect& dst_rect) {
- FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_top_left_1), m_xfb_top_flipped);
- FlipFramebuffer(LCD::GetFramebufferPointer(LCD::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped);
+ FlipFramebuffer(GPU::GetFramebufferPointer(GPU::g_regs.framebuffer_top_left_1), m_xfb_top_flipped);
+ FlipFramebuffer(GPU::GetFramebufferPointer(GPU::g_regs.framebuffer_sub_left_1), m_xfb_bottom_flipped);
// Blit the top framebuffer
// ------------------------
--
cgit v1.2.3