mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-07-01 02:27:52 -05:00
SMMU: Initial adaptation to video_core.
This commit is contained in:
@ -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<const u8> read_buffer) {
|
||||
true, bytes_per_pixel, width, regs.dest.height, regs.dest.depth,
|
||||
regs.dest.BlockHeight(), regs.dest.BlockDepth());
|
||||
|
||||
Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite>
|
||||
Tegra::Memory::GpuGuestMemoryScoped<u8,
|
||||
Tegra::Memory::GuestMemoryFlags::SafeReadCachedWrite>
|
||||
tmp(memory_manager, address, dst_size, &tmp_buffer);
|
||||
|
||||
Tegra::Texture::SwizzleSubrect(tmp, read_buffer, bytes_per_pixel, width, regs.dest.height,
|
||||
|
@ -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<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
Tegra::Memory::GpuGuestMemory<u8, Tegra::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
memory_manager, src_operand.address, src_size, &read_buffer);
|
||||
Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::UnsafeReadCachedWrite>
|
||||
Tegra::Memory::GpuGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::UnsafeReadCachedWrite>
|
||||
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<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
Tegra::Memory::GpuGuestMemory<u8, Tegra::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
memory_manager, src_addr, src_size, &read_buffer);
|
||||
Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::UnsafeReadCachedWrite>
|
||||
Tegra::Memory::GpuGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::UnsafeReadCachedWrite>
|
||||
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<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
Tegra::Memory::GpuGuestMemory<u8, Tegra::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
|
||||
memory_manager, regs.offset_in, src_size, &read_buffer);
|
||||
Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite>
|
||||
Tegra::Memory::GpuGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::SafeReadCachedWrite>
|
||||
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,
|
||||
|
@ -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<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_buffer(
|
||||
Tegra::Memory::GpuGuestMemory<u8, Tegra::Memory::GuestMemoryFlags::SafeRead> 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<u8, Core::Memory::GuestMemoryFlags::SafeReadWrite>
|
||||
Tegra::Memory::GpuGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::SafeReadWrite>
|
||||
tmp_buffer2(memory_manager, dst.Address(), dst_size, &impl->tmp_buffer);
|
||||
|
||||
if (dst.linear == Fermi2D::MemoryLayout::BlockLinear) {
|
||||
|
Reference in New Issue
Block a user