From 651e58f443ebde66b6edb3fad760f40388c0db18 Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi Date: Mon, 1 Aug 2022 23:03:10 +0300 Subject: [PATCH] rsx: Trivial optimization --- rpcs3/Emu/RSX/rsx_methods.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 7d2c2de506..88a582b2b8 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -43,6 +43,12 @@ namespace rsx // First, queue the GPU work. If it flushes the queue for us, the following routines will be faster. const bool handled = rsx->get_backend_config().supports_host_gpu_labels && rsx->release_GCM_label(address, data); + if (vm::_ref(address).val == data) + { + // It's a no-op to write the same value (although there is a delay in real-hw so it's more accurate to allow GPU label in this case) + return; + } + if constexpr (FlushDMA) { // If the backend handled the request, this call will basically be a NOP @@ -77,10 +83,14 @@ namespace rsx { void set_reference(thread* rsx, u32 /*reg*/, u32 arg) { - rsx->sync(); - // Write ref+get (get will be written again with the same value at command end) auto& dma = vm::_ref(rsx->dma_address); + + if (arg != dma.ref) + { + rsx->sync(); + } + dma.get.release(rsx->fifo_ctrl->get_pos()); dma.ref.store(arg); }