summaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
authorGravatar bunnei2016-04-22 08:15:51 -0400
committerGravatar bunnei2016-04-22 08:15:51 -0400
commitbab30bcd6e6ea43cde9f75136e711a59f094b058 (patch)
treee5a16dc5b13ecfb831bf1986636d232f83ee4723 /src/core/hle
parentMerge pull request #1655 from JayFoxRox/hw-dot3 (diff)
parentHWRasterizer: Texture forwarding (diff)
downloadyuzu-bab30bcd6e6ea43cde9f75136e711a59f094b058.tar.gz
yuzu-bab30bcd6e6ea43cde9f75136e711a59f094b058.tar.xz
yuzu-bab30bcd6e6ea43cde9f75136e711a59f094b058.zip
Merge pull request #1436 from tfarley/hw-tex-forwarding
Hardware Renderer Texture Forwarding
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/fs/archive.cpp1
-rw-r--r--src/core/hle/service/gsp_gpu.cpp31
-rw-r--r--src/core/hle/service/y2r_u.cpp10
3 files changed, 18 insertions, 24 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index e9588cb72..cc51ede0c 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -114,6 +114,7 @@ ResultVal<bool> File::SyncRequest() {
114 return read.Code(); 114 return read.Code();
115 } 115 }
116 cmd_buff[2] = static_cast<u32>(*read); 116 cmd_buff[2] = static_cast<u32>(*read);
117 Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length);
117 break; 118 break;
118 } 119 }
119 120
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 0c655395e..211fcf599 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/bit_field.h" 5#include "common/bit_field.h"
6#include "common/microprofile.h" 6#include "common/microprofile.h"
7#include "common/profiler.h"
7 8
8#include "core/memory.h" 9#include "core/memory.h"
9#include "core/hle/kernel/event.h" 10#include "core/hle/kernel/event.h"
@@ -15,8 +16,6 @@
15 16
16#include "video_core/gpu_debugger.h" 17#include "video_core/gpu_debugger.h"
17#include "video_core/debug_utils/debug_utils.h" 18#include "video_core/debug_utils/debug_utils.h"
18#include "video_core/renderer_base.h"
19#include "video_core/video_core.h"
20 19
21#include "gsp_gpu.h" 20#include "gsp_gpu.h"
22 21
@@ -291,8 +290,6 @@ static void FlushDataCache(Service::Interface* self) {
291 u32 size = cmd_buff[2]; 290 u32 size = cmd_buff[2];
292 u32 process = cmd_buff[4]; 291 u32 process = cmd_buff[4];
293 292
294 VideoCore::g_renderer->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(address), size);
295
296 // TODO(purpasmart96): Verify return header on HW 293 // TODO(purpasmart96): Verify return header on HW
297 294
298 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 295 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@@ -408,6 +405,8 @@ void SignalInterrupt(InterruptId interrupt_id) {
408 g_interrupt_event->Signal(); 405 g_interrupt_event->Signal();
409} 406}
410 407
408MICROPROFILE_DEFINE(GPU_GSP_DMA, "GPU", "GSP DMA", MP_RGB(100, 0, 255));
409
411/// Executes the next GSP command 410/// Executes the next GSP command
412static void ExecuteCommand(const Command& command, u32 thread_id) { 411static void ExecuteCommand(const Command& command, u32 thread_id) {
413 // Utility function to convert register ID to address 412 // Utility function to convert register ID to address
@@ -419,18 +418,21 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
419 418
420 // GX request DMA - typically used for copying memory from GSP heap to VRAM 419 // GX request DMA - typically used for copying memory from GSP heap to VRAM
421 case CommandId::REQUEST_DMA: 420 case CommandId::REQUEST_DMA:
422 VideoCore::g_renderer->Rasterizer()->FlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address), 421 {
423 command.dma_request.size); 422 MICROPROFILE_SCOPE(GPU_GSP_DMA);
423
424 // TODO: Consider attempting rasterizer-accelerated surface blit if that usage is ever possible/likely
425 Memory::RasterizerFlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
426 command.dma_request.size);
427 Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
428 command.dma_request.size);
424 429
425 memcpy(Memory::GetPointer(command.dma_request.dest_address), 430 memcpy(Memory::GetPointer(command.dma_request.dest_address),
426 Memory::GetPointer(command.dma_request.source_address), 431 Memory::GetPointer(command.dma_request.source_address),
427 command.dma_request.size); 432 command.dma_request.size);
428 SignalInterrupt(InterruptId::DMA); 433 SignalInterrupt(InterruptId::DMA);
429
430 VideoCore::g_renderer->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
431 command.dma_request.size);
432 break; 434 break;
433 435 }
434 // TODO: This will need some rework in the future. (why?) 436 // TODO: This will need some rework in the future. (why?)
435 case CommandId::SUBMIT_GPU_CMDLIST: 437 case CommandId::SUBMIT_GPU_CMDLIST:
436 { 438 {
@@ -517,13 +519,8 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
517 519
518 case CommandId::CACHE_FLUSH: 520 case CommandId::CACHE_FLUSH:
519 { 521 {
520 for (auto& region : command.cache_flush.regions) { 522 // NOTE: Rasterizer flushing handled elsewhere in CPU read/write and other GPU handlers
521 if (region.size == 0) 523 // Use command.cache_flush.regions to implement this handler
522 break;
523
524 VideoCore::g_renderer->Rasterizer()->InvalidateRegion(
525 Memory::VirtualToPhysicalAddress(region.address), region.size);
526 }
527 break; 524 break;
528 } 525 }
529 526
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index 22f373adf..1672ad775 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -12,9 +12,6 @@
12#include "core/hle/service/y2r_u.h" 12#include "core/hle/service/y2r_u.h"
13#include "core/hw/y2r.h" 13#include "core/hw/y2r.h"
14 14
15#include "video_core/renderer_base.h"
16#include "video_core/video_core.h"
17
18//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
19// Namespace Y2R_U 16// Namespace Y2R_U
20 17
@@ -262,13 +259,12 @@ static void SetAlpha(Service::Interface* self) {
262static void StartConversion(Service::Interface* self) { 259static void StartConversion(Service::Interface* self) {
263 u32* cmd_buff = Kernel::GetCommandBuffer(); 260 u32* cmd_buff = Kernel::GetCommandBuffer();
264 261
265 HW::Y2R::PerformConversion(conversion);
266
267 // dst_image_size would seem to be perfect for this, but it doesn't include the gap :( 262 // dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
268 u32 total_output_size = conversion.input_lines * 263 u32 total_output_size = conversion.input_lines *
269 (conversion.dst.transfer_unit + conversion.dst.gap); 264 (conversion.dst.transfer_unit + conversion.dst.gap);
270 VideoCore::g_renderer->Rasterizer()->InvalidateRegion( 265 Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
271 Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size); 266
267 HW::Y2R::PerformConversion(conversion);
272 268
273 LOG_DEBUG(Service_Y2R, "called"); 269 LOG_DEBUG(Service_Y2R, "called");
274 completion_event->Signal(); 270 completion_event->Signal();