From 50f009b81218c5367031ce9c51089ecddc2e853a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Tue, 24 Feb 2026 00:11:22 +1100 Subject: Cleanup, better document some areas --- src/queue_context.hh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/queue_context.hh') diff --git a/src/queue_context.hh b/src/queue_context.hh index 2a3ea39..fbb04e8 100644 --- a/src/queue_context.hh +++ b/src/queue_context.hh @@ -16,6 +16,21 @@ namespace low_latency { class QueueContext final : public Context { + private: + // The amount of finished frame timing data we keep before eviction. + // For now, this value is also the number of data points used in the + // calculation of gpu timing information. + static constexpr auto MAX_TRACKED_TIMINGS = 50; + // The amount of queue submissions we allow tracked per queue before + // we give up tracking them. For a queue that is presented to, + // these submissions will be constantly moved to Frame structs so + // it's not an issue that we only track so many - unless it just + // happens that an application makes an unexpectedly large + // amount of vkQueueSubmit's per frame. For queues which don't + // present, this limit stops them from growing limitlessly in memory + // as we may not necessarily manually evict them yet. + static constexpr auto MAX_TRACKED_SUBMISSIONS = 50; + public: DeviceContext& device_context; @@ -27,8 +42,6 @@ class QueueContext final : public Context { std::unique_ptr timestamp_pool; public: - static constexpr auto MAX_TRACKED_TIMINGS = 50; - // Potentially in flight queue submissions that come from this queue. struct Submission { const std::unordered_set signals; @@ -36,7 +49,7 @@ class QueueContext final : public Context { const std::shared_ptr start_handle; const std::shared_ptr end_handle; - + const DeviceContext::Clock::time_point_t enqueued_time; }; using submission_ptr_t = std::shared_ptr; @@ -50,8 +63,8 @@ class QueueContext final : public Context { struct Frame { std::deque submissions; - // the point that control flow was returned from VkQueuePresentKHR back to the - // application. + // the point that control flow was returned from VkQueuePresentKHR back + // to the application. DeviceContext::Clock::time_point_t cpu_post_present_time; }; std::deque in_flight_frames; @@ -67,11 +80,11 @@ class QueueContext final : public Context { private: // Drains submissions and promotes them into a single frame object. void drain_submissions_to_frame(); - + // Drains in flight frames and promotes them into a Timing object if they // have completed. void drain_frames_to_timings(); - + // Antilag 1 equivalent where we sleep after present to reduce queueing. void sleep_in_present(); @@ -92,7 +105,7 @@ class QueueContext final : public Context { const DeviceContext::Clock::time_point_t& now); void notify_present(const VkPresentInfoKHR& info); - + public: bool should_inject_timestamps() const; }; -- cgit v1.2.3