diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-06-11 04:58:20 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-07-05 21:49:23 +0200 |
commit | ea975896242fba4a92d68c8fb45751e60ed826cc (patch) | |
tree | d5ba1357f40876d535c2148b62964f59765ace01 /src/core/hle | |
parent | nv_services: Deglobalize NvServices (diff) | |
download | yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.gz yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.bz2 yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.lz yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.xz yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.zst yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index 75e47b8c7..d8aa3f1c0 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -75,12 +75,18 @@ void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform, itr->crop_rect = crop_rect; itr->swap_interval = swap_interval; itr->multi_fence = multi_fence; + queue_sequence.push_back(slot); } std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() { - auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) { - return buffer.status == Buffer::Status::Queued; - }); + std::vector<Buffer>::iterator itr = queue.end(); + while (itr == queue.end() && !queue_sequence.empty()) { + u32 slot = queue_sequence.front(); + itr = std::find_if(queue.begin(), queue.end(), [&slot](const Buffer& buffer) { + return buffer.status == Buffer::Status::Queued && buffer.slot == slot; + }); + queue_sequence.pop_front(); + } if (itr == queue.end()) return {}; itr->status = Buffer::Status::Acquired; diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index c163e565c..be993ee61 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h @@ -6,6 +6,7 @@ #include <optional> #include <vector> +#include <list> #include "common/common_funcs.h" #include "common/math_util.h" @@ -97,6 +98,7 @@ private: u64 layer_id; std::vector<Buffer> queue; + std::list<u32> queue_sequence; Kernel::EventPair buffer_wait_event; }; |