blob: 6d4102751bab621a588365a2b00fbbbec114f758 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef STRATEGIES_LOW_LATENCY2_QUEUE_STRATEGY_HH_
#define STRATEGIES_LOW_LATENCY2_QUEUE_STRATEGY_HH_
#include "frame_span.hh"
#include "strategies/queue_strategy.hh"
#include <atomic>
#include <deque>
#include <memory>
#include <mutex>
#include <unordered_map>
namespace low_latency {
class QueueContext;
class LowLatency2QueueStrategy final : public QueueStrategy {
public:
static constexpr auto MAX_TRACKED_PRESENTS = 50;
// Mapping of present_id's to submissions. Grabbed later by the device
// strategy when we present and actually can associate them to some
// vkSwapchainKHR.
std::mutex mutex{};
std::unordered_map<std::uint64_t, std::unique_ptr<FrameSpan>> frame_spans{};
std::deque<std::uint64_t> stale_present_ids{};
std::atomic<bool> is_out_of_band{}; // atomic to avoid lock
public:
LowLatency2QueueStrategy(QueueContext& queue);
virtual ~LowLatency2QueueStrategy();
public:
virtual void
notify_submit(const VkSubmitInfo& submit,
std::shared_ptr<TimestampPool::Handle> handle) override;
virtual void
notify_submit(const VkSubmitInfo2& submit,
std::shared_ptr<TimestampPool::Handle> handle) override;
virtual void notify_present(const VkPresentInfoKHR& present) override;
public:
void notify_out_of_band();
};
} // namespace low_latency
#endif
|