From 0a2536a0df1f4aea406f2132d3edda0430acc9d1 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 25 Dec 2023 07:32:16 +0100 Subject: SMMU: Initial adaptation to video_core. --- src/video_core/engines/engine_upload.cpp | 5 +++-- src/video_core/engines/maxwell_dma.cpp | 25 +++++++++++++------------ src/video_core/engines/sw_blitter/blitter.cpp | 5 +++-- 3 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src/video_core/engines') diff --git a/src/video_core/engines/engine_upload.cpp b/src/video_core/engines/engine_upload.cpp index bc64d4486..e5cc04ec4 100644 --- a/src/video_core/engines/engine_upload.cpp +++ b/src/video_core/engines/engine_upload.cpp @@ -5,8 +5,8 @@ #include "common/algorithm.h" #include "common/assert.h" -#include "core/memory.h" #include "video_core/engines/engine_upload.h" +#include "video_core/guest_memory.h" #include "video_core/memory_manager.h" #include "video_core/rasterizer_interface.h" #include "video_core/textures/decoders.h" @@ -68,7 +68,8 @@ void State::ProcessData(std::span read_buffer) { true, bytes_per_pixel, width, regs.dest.height, regs.dest.depth, regs.dest.BlockHeight(), regs.dest.BlockDepth()); - Core::Memory::GpuGuestMemoryScoped + Tegra::Memory::GpuGuestMemoryScoped tmp(memory_manager, address, dst_size, &tmp_buffer); Tegra::Texture::SwizzleSubrect(tmp, read_buffer, bytes_per_pixel, width, regs.dest.height, diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 56fbff306..4bf461fb0 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -11,6 +11,7 @@ #include "core/memory.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_dma.h" +#include "video_core/guest_memory.h" #include "video_core/memory_manager.h" #include "video_core/renderer_base.h" #include "video_core/textures/decoders.h" @@ -133,8 +134,8 @@ void MaxwellDMA::Launch() { UNIMPLEMENTED_IF(regs.offset_out % 16 != 0); read_buffer.resize_destructive(16); for (u32 offset = 0; offset < regs.line_length_in; offset += 16) { - Core::Memory::GpuGuestMemoryScoped< - u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite> + Tegra::Memory::GpuGuestMemoryScoped< + u8, Tegra::Memory::GuestMemoryFlags::SafeReadCachedWrite> tmp_write_buffer(memory_manager, convert_linear_2_blocklinear_addr(regs.offset_in + offset), 16, &read_buffer); @@ -146,16 +147,16 @@ void MaxwellDMA::Launch() { UNIMPLEMENTED_IF(regs.offset_out % 16 != 0); read_buffer.resize_destructive(16); for (u32 offset = 0; offset < regs.line_length_in; offset += 16) { - Core::Memory::GpuGuestMemoryScoped< - u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite> + Tegra::Memory::GpuGuestMemoryScoped< + u8, Tegra::Memory::GuestMemoryFlags::SafeReadCachedWrite> tmp_write_buffer(memory_manager, regs.offset_in + offset, 16, &read_buffer); tmp_write_buffer.SetAddressAndSize( convert_linear_2_blocklinear_addr(regs.offset_out + offset), 16); } } else { if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) { - Core::Memory::GpuGuestMemoryScoped< - u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite> + Tegra::Memory::GpuGuestMemoryScoped< + u8, Tegra::Memory::GuestMemoryFlags::SafeReadCachedWrite> tmp_write_buffer(memory_manager, regs.offset_in, regs.line_length_in, &read_buffer); tmp_write_buffer.SetAddressAndSize(regs.offset_out, regs.line_length_in); @@ -226,9 +227,9 @@ void MaxwellDMA::CopyBlockLinearToPitch() { const size_t dst_size = dst_operand.pitch * regs.line_count; - Core::Memory::GpuGuestMemory tmp_read_buffer( + Tegra::Memory::GpuGuestMemory tmp_read_buffer( memory_manager, src_operand.address, src_size, &read_buffer); - Core::Memory::GpuGuestMemoryScoped + Tegra::Memory::GpuGuestMemoryScoped tmp_write_buffer(memory_manager, dst_operand.address, dst_size, &write_buffer); UnswizzleSubrect(tmp_write_buffer, tmp_read_buffer, bytes_per_pixel, width, height, depth, @@ -290,9 +291,9 @@ void MaxwellDMA::CopyPitchToBlockLinear() { GPUVAddr src_addr = regs.offset_in; GPUVAddr dst_addr = regs.offset_out; - Core::Memory::GpuGuestMemory tmp_read_buffer( + Tegra::Memory::GpuGuestMemory tmp_read_buffer( memory_manager, src_addr, src_size, &read_buffer); - Core::Memory::GpuGuestMemoryScoped + Tegra::Memory::GpuGuestMemoryScoped tmp_write_buffer(memory_manager, dst_addr, dst_size, &write_buffer); // If the input is linear and the output is tiled, swizzle the input and copy it over. @@ -344,9 +345,9 @@ void MaxwellDMA::CopyBlockLinearToBlockLinear() { intermediate_buffer.resize_destructive(mid_buffer_size); - Core::Memory::GpuGuestMemory tmp_read_buffer( + Tegra::Memory::GpuGuestMemory tmp_read_buffer( memory_manager, regs.offset_in, src_size, &read_buffer); - Core::Memory::GpuGuestMemoryScoped + Tegra::Memory::GpuGuestMemoryScoped tmp_write_buffer(memory_manager, regs.offset_out, dst_size, &write_buffer); UnswizzleSubrect(intermediate_buffer, tmp_read_buffer, bytes_per_pixel, src_width, src.height, diff --git a/src/video_core/engines/sw_blitter/blitter.cpp b/src/video_core/engines/sw_blitter/blitter.cpp index 67ce9134b..b67589daf 100644 --- a/src/video_core/engines/sw_blitter/blitter.cpp +++ b/src/video_core/engines/sw_blitter/blitter.cpp @@ -11,6 +11,7 @@ #include "video_core/memory_manager.h" #include "video_core/surface.h" #include "video_core/textures/decoders.h" +#include "video_core/guest_memory.h" namespace Tegra { class MemoryManager; @@ -160,7 +161,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, const auto dst_bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(dst.format)); const size_t src_size = get_surface_size(src, src_bytes_per_pixel); - Core::Memory::GpuGuestMemory tmp_buffer( + Tegra::Memory::GpuGuestMemory tmp_buffer( memory_manager, src.Address(), src_size, &impl->tmp_buffer); const size_t src_copy_size = src_extent_x * src_extent_y * src_bytes_per_pixel; @@ -220,7 +221,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst, } const size_t dst_size = get_surface_size(dst, dst_bytes_per_pixel); - Core::Memory::GpuGuestMemoryScoped + Tegra::Memory::GpuGuestMemoryScoped tmp_buffer2(memory_manager, dst.Address(), dst_size, &impl->tmp_buffer); if (dst.linear == Fermi2D::MemoryLayout::BlockLinear) { -- cgit v1.2.3