summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/gsp_gpu.cpp9
-rw-r--r--src/core/hw/gpu.cpp16
2 files changed, 22 insertions, 3 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index c11c5faba..c56475ae4 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -15,6 +15,7 @@
15#include "core/hw/lcd.h" 15#include "core/hw/lcd.h"
16 16
17#include "video_core/gpu_debugger.h" 17#include "video_core/gpu_debugger.h"
18#include "video_core/video_core.h"
18 19
19// Main graphics debugger object - TODO: Here is probably not the best place for this 20// Main graphics debugger object - TODO: Here is probably not the best place for this
20GraphicsDebugger g_debugger; 21GraphicsDebugger g_debugger;
@@ -264,6 +265,8 @@ static void FlushDataCache(Service::Interface* self) {
264 u32 size = cmd_buff[2]; 265 u32 size = cmd_buff[2];
265 u32 process = cmd_buff[4]; 266 u32 process = cmd_buff[4];
266 267
268 VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(address), size);
269
267 // TODO(purpasmart96): Verify return header on HW 270 // TODO(purpasmart96): Verify return header on HW
268 271
269 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 272 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -352,10 +355,16 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
352 355
353 // GX request DMA - typically used for copying memory from GSP heap to VRAM 356 // GX request DMA - typically used for copying memory from GSP heap to VRAM
354 case CommandId::REQUEST_DMA: 357 case CommandId::REQUEST_DMA:
358 VideoCore::g_renderer->hw_rasterizer->NotifyPreRead(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
359 command.dma_request.size);
360
355 memcpy(Memory::GetPointer(command.dma_request.dest_address), 361 memcpy(Memory::GetPointer(command.dma_request.dest_address),
356 Memory::GetPointer(command.dma_request.source_address), 362 Memory::GetPointer(command.dma_request.source_address),
357 command.dma_request.size); 363 command.dma_request.size);
358 SignalInterrupt(InterruptId::DMA); 364 SignalInterrupt(InterruptId::DMA);
365
366 VideoCore::g_renderer->hw_rasterizer->NotifyFlush(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
367 command.dma_request.size);
359 break; 368 break;
360 369
361 // ctrulib homebrew sends all relevant command list data with this command, 370 // 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 8ef1f70df..ddc5d647e 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) {
106 } else { 106 } else {
107 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1); 107 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1);
108 } 108 }
109
110 VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetStartAddress(), config.GetEndAddress() - config.GetStartAddress());
109 } 111 }
110 break; 112 break;
111 } 113 }
@@ -129,19 +131,25 @@ inline void Write(u32 addr, const T data) {
129 u32 output_width = config.output_width / horizontal_scale; 131 u32 output_width = config.output_width / horizontal_scale;
130 u32 output_height = config.output_height / vertical_scale; 132 u32 output_height = config.output_height / vertical_scale;
131 133
134 u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format);
135 u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format);
136
137 VideoCore::g_renderer->hw_rasterizer->NotifyPreRead(config.GetPhysicalInputAddress(), input_size);
138
132 if (config.raw_copy) { 139 if (config.raw_copy) {
133 // Raw copies do not perform color conversion nor tiled->linear / linear->tiled conversions 140 // Raw copies do not perform color conversion nor tiled->linear / linear->tiled conversions
134 // TODO(Subv): Verify if raw copies perform scaling 141 // TODO(Subv): Verify if raw copies perform scaling
135 memcpy(dst_pointer, src_pointer, config.output_width * config.output_height * 142 memcpy(dst_pointer, src_pointer, output_size);
136 GPU::Regs::BytesPerPixel(config.output_format));
137 143
138 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", 144 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",
139 config.output_height * output_width * GPU::Regs::BytesPerPixel(config.output_format), 145 output_size,
140 config.GetPhysicalInputAddress(), config.input_width.Value(), config.input_height.Value(), 146 config.GetPhysicalInputAddress(), config.input_width.Value(), config.input_height.Value(),
141 config.GetPhysicalOutputAddress(), config.output_width.Value(), config.output_height.Value(), 147 config.GetPhysicalOutputAddress(), config.output_width.Value(), config.output_height.Value(),
142 config.output_format.Value(), config.flags); 148 config.output_format.Value(), config.flags);
143 149
144 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF); 150 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
151
152 VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetPhysicalOutputAddress(), output_size);
145 break; 153 break;
146 } 154 }
147 155
@@ -247,6 +255,8 @@ inline void Write(u32 addr, const T data) {
247 config.output_format.Value(), config.flags); 255 config.output_format.Value(), config.flags);
248 256
249 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF); 257 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
258
259 VideoCore::g_renderer->hw_rasterizer->NotifyFlush(config.GetPhysicalOutputAddress(), output_size);
250 } 260 }
251 break; 261 break;
252 } 262 }