diff options
| author | 2019-06-10 22:58:20 -0400 | |
|---|---|---|
| committer | 2019-07-05 15:49:23 -0400 | |
| commit | ea975896242fba4a92d68c8fb45751e60ed826cc (patch) | |
| tree | d5ba1357f40876d535c2148b62964f59765ace01 /src | |
| parent | nv_services: Deglobalize NvServices (diff) | |
| download | yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.gz yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.tar.xz yuzu-ea975896242fba4a92d68c8fb45751e60ed826cc.zip | |
nvflinger: Acquire buffers in the same order as they were queued.
Diffstat (limited to 'src')
| -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, | |||
| 75 | itr->crop_rect = crop_rect; | 75 | itr->crop_rect = crop_rect; |
| 76 | itr->swap_interval = swap_interval; | 76 | itr->swap_interval = swap_interval; |
| 77 | itr->multi_fence = multi_fence; | 77 | itr->multi_fence = multi_fence; |
| 78 | queue_sequence.push_back(slot); | ||
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() { | 81 | std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() { |
| 81 | auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) { | 82 | std::vector<Buffer>::iterator itr = queue.end(); |
| 82 | return buffer.status == Buffer::Status::Queued; | 83 | while (itr == queue.end() && !queue_sequence.empty()) { |
| 83 | }); | 84 | u32 slot = queue_sequence.front(); |
| 85 | itr = std::find_if(queue.begin(), queue.end(), [&slot](const Buffer& buffer) { | ||
| 86 | return buffer.status == Buffer::Status::Queued && buffer.slot == slot; | ||
| 87 | }); | ||
| 88 | queue_sequence.pop_front(); | ||
| 89 | } | ||
| 84 | if (itr == queue.end()) | 90 | if (itr == queue.end()) |
| 85 | return {}; | 91 | return {}; |
| 86 | itr->status = Buffer::Status::Acquired; | 92 | 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 @@ | |||
| 6 | 6 | ||
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include <list> | ||
| 9 | 10 | ||
| 10 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 11 | #include "common/math_util.h" | 12 | #include "common/math_util.h" |
| @@ -97,6 +98,7 @@ private: | |||
| 97 | u64 layer_id; | 98 | u64 layer_id; |
| 98 | 99 | ||
| 99 | std::vector<Buffer> queue; | 100 | std::vector<Buffer> queue; |
| 101 | std::list<u32> queue_sequence; | ||
| 100 | Kernel::EventPair buffer_wait_event; | 102 | Kernel::EventPair buffer_wait_event; |
| 101 | }; | 103 | }; |
| 102 | 104 | ||