diff options
author | Liam <byteslice@airmail.cc> | 2024-02-03 23:14:43 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-03 23:14:43 +0100 |
commit | 5eb5c967502e9d59e946af2aaea051426761e7a0 (patch) | |
tree | 6a19b7314c10c29bedc16411dbd459438e93c34b /src | |
parent | Merge pull request #12901 from Kelebek1/timezone_firmware_fix (diff) | |
download | yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar.gz yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar.bz2 yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar.lz yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar.xz yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.tar.zst yuzu-5eb5c967502e9d59e946af2aaea051426761e7a0.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/service/nvnflinger/hardware_composer.cpp | 50 | ||||
-rw-r--r-- | src/core/hle/service/nvnflinger/hardware_composer.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.cpp | 3 |
3 files changed, 27 insertions, 28 deletions
diff --git a/src/core/hle/service/nvnflinger/hardware_composer.cpp b/src/core/hle/service/nvnflinger/hardware_composer.cpp index c720dd1f8..ba2b5c28c 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.cpp +++ b/src/core/hle/service/nvnflinger/hardware_composer.cpp @@ -7,7 +7,6 @@ #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" #include "core/hle/service/nvnflinger/buffer_item.h" #include "core/hle/service/nvnflinger/buffer_item_consumer.h" -#include "core/hle/service/nvnflinger/buffer_queue_producer.h" #include "core/hle/service/nvnflinger/hardware_composer.h" #include "core/hle/service/nvnflinger/hwc_layer.h" #include "core/hle/service/nvnflinger/ui/graphic_buffer.h" @@ -46,31 +45,9 @@ HardwareComposer::HardwareComposer() = default; HardwareComposer::~HardwareComposer() = default; u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, VI::Display& display, - Nvidia::Devices::nvdisp_disp0& nvdisp, u32 frame_advance) { + Nvidia::Devices::nvdisp_disp0& nvdisp) { boost::container::small_vector<HwcLayer, 2> composition_stack; - m_frame_number += frame_advance; - - // Release any necessary framebuffers. - for (auto& [layer_id, framebuffer] : m_framebuffers) { - if (framebuffer.release_frame_number > m_frame_number) { - // Not yet ready to release this framebuffer. - continue; - } - - if (!framebuffer.is_acquired) { - // Already released. - continue; - } - - if (auto* layer = display.FindLayer(layer_id); layer != nullptr) { - // TODO: support release fence - // This is needed to prevent screen tearing - layer->GetConsumer().ReleaseBuffer(framebuffer.item, android::Fence::NoFence()); - framebuffer.is_acquired = false; - } - } - // Set default speed limit to 100%. *out_speed_scale = 1.0f; @@ -142,7 +119,30 @@ u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, VI::Display& display, MicroProfileFlip(); // Advance by at least one frame. - return swap_interval.value_or(1); + const u32 frame_advance = swap_interval.value_or(1); + m_frame_number += frame_advance; + + // Release any necessary framebuffers. + for (auto& [layer_id, framebuffer] : m_framebuffers) { + if (framebuffer.release_frame_number > m_frame_number) { + // Not yet ready to release this framebuffer. + continue; + } + + if (!framebuffer.is_acquired) { + // Already released. + continue; + } + + if (auto* layer = display.FindLayer(layer_id); layer != nullptr) { + // TODO: support release fence + // This is needed to prevent screen tearing + layer->GetConsumer().ReleaseBuffer(framebuffer.item, android::Fence::NoFence()); + framebuffer.is_acquired = false; + } + } + + return frame_advance; } void HardwareComposer::RemoveLayerLocked(VI::Display& display, LayerId layer_id) { diff --git a/src/core/hle/service/nvnflinger/hardware_composer.h b/src/core/hle/service/nvnflinger/hardware_composer.h index ddab94ac9..28392c512 100644 --- a/src/core/hle/service/nvnflinger/hardware_composer.h +++ b/src/core/hle/service/nvnflinger/hardware_composer.h @@ -27,7 +27,7 @@ public: ~HardwareComposer(); u32 ComposeLocked(f32* out_speed_scale, VI::Display& display, - Nvidia::Devices::nvdisp_disp0& nvdisp, u32 frame_advance); + Nvidia::Devices::nvdisp_disp0& nvdisp); void RemoveLayerLocked(VI::Display& display, LayerId layer_id); private: diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index a4e848882..d8ba89d43 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp @@ -291,8 +291,7 @@ void Nvnflinger::Compose() { auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>(disp_fd); ASSERT(nvdisp); - swap_interval = display.GetComposer().ComposeLocked(&compose_speed_scale, display, *nvdisp, - swap_interval); + swap_interval = display.GetComposer().ComposeLocked(&compose_speed_scale, display, *nvdisp); } } |