mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 03:40:03 +00:00
nvflinger: Acquire buffers in the same order as they were queued.
This commit is contained in:
parent
24408cce9b
commit
ea97589624
@ -75,12 +75,18 @@ void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform,
|
|||||||
itr->crop_rect = crop_rect;
|
itr->crop_rect = crop_rect;
|
||||||
itr->swap_interval = swap_interval;
|
itr->swap_interval = swap_interval;
|
||||||
itr->multi_fence = multi_fence;
|
itr->multi_fence = multi_fence;
|
||||||
|
queue_sequence.push_back(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() {
|
std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() {
|
||||||
auto itr = std::find_if(queue.begin(), queue.end(), [](const Buffer& buffer) {
|
std::vector<Buffer>::iterator itr = queue.end();
|
||||||
return buffer.status == Buffer::Status::Queued;
|
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())
|
if (itr == queue.end())
|
||||||
return {};
|
return {};
|
||||||
itr->status = Buffer::Status::Acquired;
|
itr->status = Buffer::Status::Acquired;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
@ -97,6 +98,7 @@ private:
|
|||||||
u64 layer_id;
|
u64 layer_id;
|
||||||
|
|
||||||
std::vector<Buffer> queue;
|
std::vector<Buffer> queue;
|
||||||
|
std::list<u32> queue_sequence;
|
||||||
Kernel::EventPair buffer_wait_event;
|
Kernel::EventPair buffer_wait_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user