From 05dc633a8c35221ce8d6abe6ddf027f8b0bab6c2 Mon Sep 17 00:00:00 2001 From: tfarley Date: Mon, 18 May 2015 21:21:33 -0700 Subject: OpenGL renderer --- src/core/hle/service/gsp_gpu.cpp | 9 +++++++++ src/core/hw/gpu.cpp | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index c11c5fab..c56475ae 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -15,6 +15,7 @@ #include "core/hw/lcd.h" #include "video_core/gpu_debugger.h" +#include "video_core/video_core.h" // Main graphics debugger object - TODO: Here is probably not the best place for this GraphicsDebugger g_debugger; @@ -264,6 +265,8 @@ static void FlushDataCache(Service::Interface* self) { u32 size = cmd_buff[2]; u32 process = cmd_buff[4]; + VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(address), size); + // TODO(purpasmart96): Verify return header on HW cmd_buff[1] = RESULT_SUCCESS.raw; // No error @@ -352,10 +355,16 @@ static void ExecuteCommand(const Command& command, u32 thread_id) { // GX request DMA - typically used for copying memory from GSP heap to VRAM case CommandId::REQUEST_DMA: + VideoCore::g_renderer->hw_rasterizer->NotifyPreRead(Memory::VirtualToPhysicalAddress(command.dma_request.source_address), + command.dma_request.size); + memcpy(Memory::GetPointer(command.dma_request.dest_address), Memory::GetPointer(command.dma_request.source_address), command.dma_request.size); SignalInterrupt(InterruptId::DMA); + + VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address), + command.dma_request.size); break; // ctrulib homebrew sends all relevant command list data with this command, diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 8ef1f70d..ddc5d647 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -106,6 +106,8 @@ inline void Write(u32 addr, const T data) { } else { GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1); } + + VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetStartAddress(), config.GetEndAddress() - config.GetStartAddress()); } break; } @@ -129,19 +131,25 @@ inline void Write(u32 addr, const T data) { u32 output_width = config.output_width / horizontal_scale; u32 output_height = config.output_height / vertical_scale; + u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format); + u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format); + + VideoCore::g_renderer->hw_rasterizer->NotifyPreRead(config.GetPhysicalInputAddress(), input_size); + if (config.raw_copy) { // Raw copies do not perform color conversion nor tiled->linear / linear->tiled conversions // TODO(Subv): Verify if raw copies perform scaling - memcpy(dst_pointer, src_pointer, config.output_width * config.output_height * - GPU::Regs::BytesPerPixel(config.output_format)); + memcpy(dst_pointer, src_pointer, output_size); 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), + output_size, config.GetPhysicalInputAddress(), config.input_width.Value(), config.input_height.Value(), config.GetPhysicalOutputAddress(), config.output_width.Value(), config.output_height.Value(), config.output_format.Value(), config.flags); GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF); + + VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetPhysicalOutputAddress(), output_size); break; } @@ -247,6 +255,8 @@ inline void Write(u32 addr, const T data) { config.output_format.Value(), config.flags); GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF); + + VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetPhysicalOutputAddress(), output_size); } break; } -- cgit v1.2.3