From d07397931a167004ea191ef275d11b8a02aa4fb7 Mon Sep 17 00:00:00 2001
From: Fernando Sahmkow <fsahmkow27@gmail.com>
Date: Sun, 31 Dec 2023 21:00:01 +0100
Subject: [PATCH 1/2] MaxwellDMA: Don't flush the outputs of a dma copy.

---
 src/core/memory.h                      | 2 +-
 src/video_core/engines/maxwell_dma.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/core/memory.h b/src/core/memory.h
index c1879e78f9..7bf05e1774 100644
--- a/src/core/memory.h
+++ b/src/core/memory.h
@@ -683,7 +683,7 @@ public:
                 } else {
                     this->m_memory.WriteBlockUnsafe(this->m_addr, this->data(), this->size_bytes());
                 }
-            } else if constexpr (FLAGS & GuestMemoryFlags::Safe) {
+            } else if constexpr ((FLAGS & GuestMemoryFlags::Safe) || (FLAGS & GuestMemoryFlags::Cached)) {
                 this->m_memory.InvalidateRegion(this->m_addr, this->size_bytes());
             }
         }
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index 422d4d859a..56fbff3066 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -228,7 +228,7 @@ void MaxwellDMA::CopyBlockLinearToPitch() {
 
     Core::Memory::GpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
         memory_manager, src_operand.address, src_size, &read_buffer);
-    Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite>
+    Core::Memory::GpuGuestMemoryScoped<u8, Core::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,
@@ -292,7 +292,7 @@ void MaxwellDMA::CopyPitchToBlockLinear() {
     GPUVAddr dst_addr = regs.offset_out;
     Core::Memory::GpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead> tmp_read_buffer(
         memory_manager, src_addr, src_size, &read_buffer);
-    Core::Memory::GpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::SafeReadCachedWrite>
+    Core::Memory::GpuGuestMemoryScoped<u8, Core::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.

From 737e6e531c8eb155fcbd19ddd679336332bbc8c6 Mon Sep 17 00:00:00 2001
From: Fernando Sahmkow <fsahmkow27@gmail.com>
Date: Sun, 31 Dec 2023 21:00:23 +0100
Subject: [PATCH 2/2] Vulkan: Only recreate swapchain if the frame is bigger
 than the swap image.

---
 src/core/memory.h                                     | 3 ++-
 src/video_core/renderer_vulkan/vk_present_manager.cpp | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/core/memory.h b/src/core/memory.h
index 7bf05e1774..e325dd613c 100644
--- a/src/core/memory.h
+++ b/src/core/memory.h
@@ -683,7 +683,8 @@ public:
                 } else {
                     this->m_memory.WriteBlockUnsafe(this->m_addr, this->data(), this->size_bytes());
                 }
-            } else if constexpr ((FLAGS & GuestMemoryFlags::Safe) || (FLAGS & GuestMemoryFlags::Cached)) {
+            } else if constexpr ((FLAGS & GuestMemoryFlags::Safe) ||
+                                 (FLAGS & GuestMemoryFlags::Cached)) {
                 this->m_memory.InvalidateRegion(this->m_addr, this->size_bytes());
             }
         }
diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp
index 5e7518d968..792ed9615a 100644
--- a/src/video_core/renderer_vulkan/vk_present_manager.cpp
+++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp
@@ -329,7 +329,7 @@ void PresentManager::CopyToSwapchainImpl(Frame* frame) {
     // to account for that.
     const bool is_suboptimal = swapchain.NeedsRecreation();
     const bool size_changed =
-        swapchain.GetWidth() != frame->width || swapchain.GetHeight() != frame->height;
+        swapchain.GetWidth() < frame->width || swapchain.GetHeight() < frame->height;
     if (is_suboptimal || size_changed) {
         RecreateSwapchain(frame);
     }