diff options
Diffstat (limited to 'src/core/hw')
-rw-r--r-- | src/core/hw/gpu.cpp | 24 | ||||
-rw-r--r-- | src/core/hw/gpu.h | 4 | ||||
-rw-r--r-- | src/core/hw/hw.cpp | 3 | ||||
-rw-r--r-- | src/core/hw/lcd.cpp | 4 | ||||
-rw-r--r-- | src/core/hw/lcd.h | 3 |
5 files changed, 25 insertions, 13 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index e6983a225..8ef1f70df 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -8,7 +8,7 @@ #include "core/settings.h" #include "core/core.h" -#include "core/mem_map.h" +#include "core/memory.h" #include "core/core_timing.h" #include "core/hle/hle.h" @@ -29,8 +29,7 @@ namespace GPU { Regs g_regs; /// True if the current frame was skipped -bool g_skip_frame = false; - +bool g_skip_frame; /// 268MHz / gpu_refresh_rate frames per second static u64 frame_ticks; /// Event id for CoreTiming @@ -38,7 +37,7 @@ static int vblank_event; /// Total number of frames drawn static u64 frame_count; /// True if the last frame was skipped -static bool last_skip_frame = false; +static bool last_skip_frame; template <typename T> inline void Read(T &var, const u32 raw_addr) { @@ -77,8 +76,8 @@ inline void Write(u32 addr, const T data) { auto& config = g_regs.memory_fill_config[is_second_filler]; if (config.address_start && config.trigger) { - u8* start = Memory::GetPointer(Memory::PhysicalToVirtualAddress(config.GetStartAddress())); - u8* end = Memory::GetPointer(Memory::PhysicalToVirtualAddress(config.GetEndAddress())); + u8* start = Memory::GetPhysicalPointer(config.GetStartAddress()); + u8* end = Memory::GetPhysicalPointer(config.GetEndAddress()); if (config.fill_24bit) { // fill with 24-bit values @@ -115,8 +114,8 @@ inline void Write(u32 addr, const T data) { { const auto& config = g_regs.display_transfer_config; if (config.trigger & 1) { - u8* src_pointer = Memory::GetPointer(Memory::PhysicalToVirtualAddress(config.GetPhysicalInputAddress())); - u8* dst_pointer = Memory::GetPointer(Memory::PhysicalToVirtualAddress(config.GetPhysicalOutputAddress())); + u8* src_pointer = Memory::GetPhysicalPointer(config.GetPhysicalInputAddress()); + u8* dst_pointer = Memory::GetPhysicalPointer(config.GetPhysicalOutputAddress()); if (config.scaling > config.ScaleXY) { LOG_CRITICAL(HW_GPU, "Unimplemented display transfer scaling mode %u", config.scaling.Value()); @@ -136,7 +135,7 @@ inline void Write(u32 addr, const T data) { memcpy(dst_pointer, src_pointer, config.output_width * config.output_height * GPU::Regs::BytesPerPixel(config.output_format)); - LOG_TRACE(HW_GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), flags 0x%08X, Raw copy", + LOG_TRACE(HW_GPU, "DisplayTriggerTransfer: 0x%08x bytes from 0x%08x(%ux%u)-> 0x%08x(%ux%u), output format: %x, flags 0x%08X, Raw copy", config.output_height * output_width * GPU::Regs::BytesPerPixel(config.output_format), config.GetPhysicalInputAddress(), config.input_width.Value(), config.input_height.Value(), config.GetPhysicalOutputAddress(), config.output_width.Value(), config.output_height.Value(), @@ -258,7 +257,7 @@ inline void Write(u32 addr, const T data) { const auto& config = g_regs.command_processor_config; if (config.trigger & 1) { - u32* buffer = (u32*)Memory::GetPointer(Memory::PhysicalToVirtualAddress(config.GetPhysicalAddress())); + u32* buffer = (u32*)Memory::GetPhysicalPointer(config.GetPhysicalAddress()); Pica::CommandProcessor::ProcessCommandList(buffer, config.size); } break; @@ -312,7 +311,7 @@ static void VBlankCallback(u64 userdata, int cycles_late) { DSP_DSP::SignalInterrupt(); // Check for user input updates - Service::HID::HIDUpdate(); + Service::HID::Update(); // Reschedule recurrent event CoreTiming::ScheduleEvent(frame_ticks - cycles_late, vblank_event); @@ -320,6 +319,8 @@ static void VBlankCallback(u64 userdata, int cycles_late) { /// Initialize hardware void Init() { + memset(&g_regs, 0, sizeof(g_regs)); + auto& framebuffer_top = g_regs.framebuffer_config[0]; auto& framebuffer_sub = g_regs.framebuffer_config[1]; @@ -349,6 +350,7 @@ void Init() { frame_ticks = 268123480 / Settings::values.gpu_refresh_rate; last_skip_frame = false; g_skip_frame = false; + frame_count = 0; vblank_event = CoreTiming::RegisterEvent("GPU::VBlankCallback", VBlankCallback); CoreTiming::ScheduleEvent(frame_ticks, vblank_event); diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index c8f884494..699bcd2a5 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -6,8 +6,10 @@ #include <cstddef> -#include "common/common_types.h" +#include "common/assert.h" #include "common/bit_field.h" +#include "common/common_funcs.h" +#include "common/common_types.h" namespace GPU { diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index bed50af50..f4906cc7e 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/common_types.h" +#include "common/logging/log.h" #include "core/hw/hw.h" #include "core/hw/gpu.h" @@ -63,6 +64,8 @@ void Init() { /// Shutdown hardware void Shutdown() { + GPU::Shutdown(); + LCD::Shutdown(); LOG_DEBUG(HW, "shutdown OK"); } diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp index 7986f3ddb..09134c95b 100644 --- a/src/core/hw/lcd.cpp +++ b/src/core/hw/lcd.cpp @@ -2,7 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <cstring> + #include "common/common_types.h" +#include "common/logging/log.h" #include "core/arm/arm_interface.h" #include "core/hle/hle.h" @@ -55,6 +58,7 @@ template void Write<u8>(u32 addr, const u8 data); /// Initialize hardware void Init() { + memset(&g_regs, 0, sizeof(g_regs)); LOG_DEBUG(HW_LCD, "initialized OK"); } diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h index 43893a625..fb14c3b21 100644 --- a/src/core/hw/lcd.h +++ b/src/core/hw/lcd.h @@ -6,8 +6,9 @@ #include <cstddef> -#include "common/common_types.h" #include "common/bit_field.h" +#include "common/common_funcs.h" +#include "common/common_types.h" #define LCD_REG_INDEX(field_name) (offsetof(LCD::Regs, field_name) / sizeof(u32)) |