HWRasterizer: Texture forwarding

This commit is contained in:
tfarley 2016-04-16 18:57:57 -04:00
parent e46d086189
commit 22f3a7e94c
20 changed files with 1749 additions and 970 deletions

View file

@ -114,6 +114,7 @@ ResultVal<bool> File::SyncRequest() {
return read.Code();
}
cmd_buff[2] = static_cast<u32>(*read);
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length);
break;
}

View file

@ -4,6 +4,7 @@
#include "common/bit_field.h"
#include "common/microprofile.h"
#include "common/profiler.h"
#include "core/memory.h"
#include "core/hle/kernel/event.h"
@ -15,8 +16,6 @@
#include "video_core/gpu_debugger.h"
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/renderer_base.h"
#include "video_core/video_core.h"
#include "gsp_gpu.h"
@ -291,8 +290,6 @@ static void FlushDataCache(Service::Interface* self) {
u32 size = cmd_buff[2];
u32 process = cmd_buff[4];
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(address), size);
// TODO(purpasmart96): Verify return header on HW
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
@ -408,6 +405,8 @@ void SignalInterrupt(InterruptId interrupt_id) {
g_interrupt_event->Signal();
}
MICROPROFILE_DEFINE(GPU_GSP_DMA, "GPU", "GSP DMA", MP_RGB(100, 0, 255));
/// Executes the next GSP command
static void ExecuteCommand(const Command& command, u32 thread_id) {
// Utility function to convert register ID to address
@ -419,18 +418,21 @@ 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->Rasterizer()->FlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
command.dma_request.size);
{
MICROPROFILE_SCOPE(GPU_GSP_DMA);
// TODO: Consider attempting rasterizer-accelerated surface blit if that usage is ever possible/likely
Memory::RasterizerFlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
command.dma_request.size);
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_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->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
command.dma_request.size);
break;
}
// TODO: This will need some rework in the future. (why?)
case CommandId::SUBMIT_GPU_CMDLIST:
{
@ -517,13 +519,8 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
case CommandId::CACHE_FLUSH:
{
for (auto& region : command.cache_flush.regions) {
if (region.size == 0)
break;
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(
Memory::VirtualToPhysicalAddress(region.address), region.size);
}
// NOTE: Rasterizer flushing handled elsewhere in CPU read/write and other GPU handlers
// Use command.cache_flush.regions to implement this handler
break;
}

View file

@ -12,9 +12,6 @@
#include "core/hle/service/y2r_u.h"
#include "core/hw/y2r.h"
#include "video_core/renderer_base.h"
#include "video_core/video_core.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace Y2R_U
@ -262,13 +259,12 @@ static void SetAlpha(Service::Interface* self) {
static void StartConversion(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
HW::Y2R::PerformConversion(conversion);
// dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
u32 total_output_size = conversion.input_lines *
(conversion.dst.transfer_unit + conversion.dst.gap);
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(
Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
HW::Y2R::PerformConversion(conversion);
LOG_DEBUG(Service_Y2R, "called");
completion_event->Signal();