euv_core/render/adaptive/struct.rs
1use super::*;
2
3/// Visual quality invariants that every adaptive render candidate MUST satisfy to participate in switching.
4#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
5pub struct VisualEquivalenceContract {
6 /// Font shaping, metrics, and glyph rasterization match the baseline.
7 #[get(type(copy))]
8 pub(crate) fonts_identical: bool,
9 /// Layout geometry and subpixel snapping match the baseline.
10 #[get(type(copy))]
11 pub(crate) layout_identical: bool,
12 /// Color gamut, sRGB/linear blending, and premultiplied alpha match the baseline.
13 #[get(type(copy))]
14 pub(crate) color_identical: bool,
15 /// Analytical SDF / MSAA / SSAA anti-aliasing coverage matches the baseline.
16 #[get(type(copy))]
17 pub(crate) antialiasing_identical: bool,
18 /// Soft drop-shadow spread, offset, and blur match the baseline.
19 #[get(type(copy))]
20 pub(crate) shadows_identical: bool,
21 /// Backdrop-blur kernel and rounded clip mask match the baseline.
22 #[get(type(copy))]
23 pub(crate) blur_identical: bool,
24 /// Visible tile coverage and clipping bounds match the baseline.
25 #[get(type(copy))]
26 pub(crate) visible_tiles_identical: bool,
27 /// Decoded media, image, and sprite sampling quality matches the baseline.
28 #[get(type(copy))]
29 pub(crate) media_quality_identical: bool,
30}
31
32/// Capability and visual-equivalence declaration for one host rendering candidate.
33#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
34pub struct CandidateCapabilities {
35 /// Rendering path candidate represented by this capability record.
36 #[get(type(copy))]
37 pub(crate) candidate: RenderBackendCandidate,
38 /// True when the host actually supports this candidate channel.
39 #[get(type(copy))]
40 pub(crate) supported: bool,
41 /// Visual-equivalence invariants guaranteed by this candidate.
42 #[get(type(copy))]
43 pub(crate) visual_contract: VisualEquivalenceContract,
44 /// True when platform rules require warmup/resource creation steps on the UI/render thread.
45 #[get(type(copy))]
46 pub(crate) requires_ui_thread_warmup: bool,
47 /// True when this capability entry originates from a simulated/emulated profile rather than a real device.
48 #[get(type(copy))]
49 pub(crate) is_simulated_profile: bool,
50 /// True when direct GPU presentation has been verified on a real target device.
51 #[get(type(copy))]
52 pub(crate) direct_gpu_verified_on_device: bool,
53 /// Concrete low-level graphics backend bound to this candidate.
54 #[get(type(copy))]
55 pub(crate) graphics_backend: GraphicsBackend,
56}
57
58/// Complete capability and channel declaration for a target host platform.
59#[derive(Clone, Data, Debug, Eq, PartialEq)]
60pub struct HostCapabilityProfile {
61 /// Target execution platform kind.
62 #[get(type(copy))]
63 pub(crate) platform: PlatformKind,
64 /// Ordered host-declared rendering candidates.
65 pub(crate) candidates: Vec<CandidateCapabilities>,
66 /// True when the host exposes only one valid rendering channel and MUST NEVER probe others.
67 #[get(type(copy))]
68 pub(crate) single_channel_only: bool,
69 /// Baseline visual-equivalence contract required of every eligible candidate.
70 #[get(type(copy))]
71 pub(crate) baseline_contract: VisualEquivalenceContract,
72}
73
74/// Composite cache key scoping a verified startup winner to exact hardware, driver, display mode, build, and scene profile.
75#[derive(Clone, Data, Debug, Deserialize, Eq, Hash, New, PartialEq, Serialize)]
76pub struct WinnerCacheKey {
77 /// Device or GPU adapter identifier.
78 pub(crate) device_id: String,
79 /// Graphics driver version string.
80 pub(crate) driver_version: String,
81 /// Display refresh mode in millihertz (`144.0 Hz` = `144_000`) for exact hashing.
82 #[get(type(copy))]
83 pub(crate) display_mode_hz_millihz: u32,
84 /// Application/engine build identifier or commit SHA.
85 pub(crate) build_id: String,
86 /// Scene workload profile key.
87 #[get(type(copy))]
88 pub(crate) scene_profile: SceneProfile,
89}
90
91/// Cached verified performance winner persisted for fast startup reuse.
92#[derive(Clone, Copy, Data, Debug, Deserialize, New, PartialEq, Serialize)]
93pub struct WinnerCacheEntry {
94 /// Verified winning backend candidate.
95 #[get(type(copy))]
96 pub(crate) winner: RenderBackendCandidate,
97 /// Monotonic timestamp in milliseconds when this winner was verified.
98 #[get(type(copy))]
99 pub(crate) verified_at_ms: u64,
100 /// Observed p95 frame time in milliseconds at verification.
101 #[get(type(copy))]
102 pub(crate) p95_ms: f64,
103 /// Observed p99 frame time in milliseconds at verification.
104 #[get(type(copy))]
105 pub(crate) p99_ms: f64,
106 /// Observed missed-frame ratio in `[0.0, 1.0]` at verification.
107 #[get(type(copy))]
108 pub(crate) missed_frame_rate: f64,
109 /// Observed input-to-present latency in milliseconds at verification.
110 #[get(type(copy))]
111 pub(crate) input_to_present_ms: f64,
112}
113
114/// Bounded startup winner cache invalidating automatically when driver, display mode, or build changes.
115#[derive(Clone, Data, Debug, PartialEq)]
116pub struct WinnerCache {
117 /// Verified winner entries keyed by `(device_id, driver_version, display_mode_hz, build_id, scene_profile)`.
118 pub(crate) entries: HashMap<WinnerCacheKey, WinnerCacheEntry>,
119 /// Maximum number of retained entries before evicting the oldest record.
120 #[get(type(copy))]
121 pub(crate) max_entries: usize,
122}
123
124/// Fixed-size zero-allocation hot-path telemetry record pushed into `BoundedTelemetryQueue`.
125#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
126pub struct TelemetrySample {
127 /// Monotonic rendered frame index.
128 #[get(type(copy))]
129 pub(crate) frame_index: u64,
130 /// Reused existing monotonic callback or present timestamp in nanoseconds.
131 #[get(type(copy))]
132 pub(crate) timestamp_ns: u64,
133 /// Observed frame-callback interval in milliseconds.
134 #[get(type(copy))]
135 pub(crate) callback_interval_ms: f64,
136 /// Observed presentation interval in milliseconds (compositor or proxy).
137 #[get(type(copy))]
138 pub(crate) present_interval_ms: f64,
139 /// Provenance of `present_interval_ms`.
140 #[get(type(copy))]
141 pub(crate) present_timing_source: PresentTimingSource,
142 /// Outcome of this frame presentation attempt.
143 #[get(type(copy))]
144 pub(crate) present_outcome: SurfacePresentOutcome,
145 /// True when this presented frame missed the active display deadline.
146 #[get(type(copy))]
147 pub(crate) missed_deadline: bool,
148 /// End-to-end input-to-present latency in milliseconds (valid only when `input_latency_measured` is true).
149 #[get(type(copy))]
150 pub(crate) input_to_present_ms: f64,
151 /// True when `input_to_present_ms` carries a real observation.
152 #[get(type(copy))]
153 pub(crate) input_latency_measured: bool,
154 /// Observed CPU raster time in milliseconds (valid when `cpu_raster_measured` is true).
155 #[get(type(copy))]
156 pub(crate) cpu_raster_ms: f64,
157 /// True when `cpu_raster_ms` was directly measured.
158 #[get(type(copy))]
159 pub(crate) cpu_raster_measured: bool,
160 /// Bytes uploaded to GPU/surface on this frame.
161 #[get(type(copy))]
162 pub(crate) upload_bytes: u64,
163 /// Scene profile active during this frame.
164 #[get(type(copy))]
165 pub(crate) scene_profile: SceneProfile,
166 /// Active display mode refresh rate in Hertz.
167 #[get(type(copy))]
168 pub(crate) display_mode_hz: f64,
169 /// Rendering backend candidate that produced this sample.
170 #[get(type(copy))]
171 pub(crate) candidate: RenderBackendCandidate,
172}
173
174/// Fixed-capacity non-blocking drop-oldest telemetry ring queue with zero heap allocation on hot-path `push`.
175#[derive(Clone, Data, Debug, PartialEq)]
176pub struct BoundedTelemetryQueue {
177 /// Pre-allocated fixed-capacity sample ring storage.
178 pub(crate) slots: Vec<TelemetrySample>,
179 /// Index of the oldest unread sample.
180 #[get(type(copy))]
181 pub(crate) head: usize,
182 /// Number of valid unread samples currently stored.
183 #[get(type(copy))]
184 pub(crate) len: usize,
185 /// Fixed slot capacity of the ring buffer.
186 #[get(type(copy))]
187 pub(crate) capacity: usize,
188 /// Total oldest samples overwritten due to queue saturation.
189 #[get(type(copy))]
190 pub(crate) dropped_oldest_count: u64,
191}
192
193/// Low-frequency aggregated telemetry window derived from `BoundedTelemetryQueue`.
194#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
195pub struct AggregatedTelemetryWindow {
196 /// Total samples aggregated in this window.
197 #[get(type(copy))]
198 pub(crate) sample_count: u64,
199 /// Number of frames with `SurfacePresentOutcome::Submitted`.
200 #[get(type(copy))]
201 pub(crate) presented_frames: u64,
202 /// Number of frames with `SurfacePresentOutcome::SkippedUnchanged`.
203 #[get(type(copy))]
204 pub(crate) skipped_unchanged_frames: u64,
205 /// Number of frames with `SurfacePresentOutcome::Failed`.
206 #[get(type(copy))]
207 pub(crate) failed_frames: u64,
208 /// Number of submitted frames that missed the display deadline.
209 #[get(type(copy))]
210 pub(crate) missed_deadline_frames: u64,
211 /// 50th percentile present interval in milliseconds.
212 #[get(type(copy))]
213 pub(crate) present_p50_ms: f64,
214 /// 95th percentile present interval in milliseconds.
215 #[get(type(copy))]
216 pub(crate) present_p95_ms: f64,
217 /// 99th percentile present interval in milliseconds.
218 #[get(type(copy))]
219 pub(crate) present_p99_ms: f64,
220 /// 95th percentile input-to-present latency in milliseconds (valid only when `has_input_latency` is true).
221 #[get(type(copy))]
222 pub(crate) input_to_present_p95_ms: f64,
223 /// True when at least one real input-to-present latency sample was present.
224 #[get(type(copy))]
225 pub(crate) has_input_latency: bool,
226 /// True when presentation intervals came from `PresentTimingSource::CompositorMeasured`.
227 #[get(type(copy))]
228 pub(crate) has_compositor_timing: bool,
229 /// Scene profile of this window.
230 #[get(type(copy))]
231 pub(crate) scene_profile: SceneProfile,
232 /// Display mode refresh rate in Hertz for this window.
233 #[get(type(copy))]
234 pub(crate) display_mode_hz: f64,
235 /// Candidate backend represented by this window.
236 #[get(type(copy))]
237 pub(crate) candidate: RenderBackendCandidate,
238}
239
240/// Comparable real-presentation performance summary for one candidate under a specific `(scene_profile, display_mode_hz)`.
241#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
242pub struct CandidateScore {
243 /// Candidate backend being scored.
244 #[get(type(copy))]
245 pub(crate) candidate: RenderBackendCandidate,
246 /// Scene profile during measurement (must match opponent).
247 #[get(type(copy))]
248 pub(crate) scene_profile: SceneProfile,
249 /// Display refresh mode in millihertz during measurement (must match opponent).
250 #[get(type(copy))]
251 pub(crate) display_mode_hz_millihz: u32,
252 /// Fraction of real presented frames that missed the active deadline in `[0.0, 1.0]`.
253 #[get(type(copy))]
254 pub(crate) missed_frame_ratio: f64,
255 /// Tail p95 actual present interval in milliseconds.
256 #[get(type(copy))]
257 pub(crate) p95_frame_ms: f64,
258 /// Tail p99 actual present interval in milliseconds.
259 #[get(type(copy))]
260 pub(crate) p99_frame_ms: f64,
261 /// Input-to-present latency in milliseconds.
262 #[get(type(copy))]
263 pub(crate) input_to_present_ms: f64,
264 /// Net positive gain in milliseconds for `Hybrid` over both pure GPU and pure CPU (`<= 0.0` disqualifies `Hybrid`).
265 #[get(type(copy))]
266 pub(crate) hybrid_net_gain_ms: f64,
267 /// Number of real presented frames backing this score.
268 #[get(type(copy))]
269 pub(crate) sample_count: u64,
270}
271
272/// Interactive runtime state invariants that normal performance-driven backend switches MUST NEVER reset or downgrade.
273#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
274pub struct RuntimeStateSnapshot {
275 /// Active horizontal scroll offset in logical pixels.
276 #[get(type(copy))]
277 pub(crate) scroll_offset_x: f32,
278 /// Active vertical scroll offset in logical pixels.
279 #[get(type(copy))]
280 pub(crate) scroll_offset_y: f32,
281 /// Active gesture recognizer token (`0` when idle).
282 #[get(type(copy))]
283 pub(crate) active_gesture_id: u64,
284 /// Focused interactive node identifier (`0` when unfocused).
285 #[get(type(copy))]
286 pub(crate) focused_node_id: u64,
287 /// Monotonic page/route state revision counter.
288 #[get(type(copy))]
289 pub(crate) page_state_revision: u64,
290 /// Continuous animation timeline position in nanoseconds.
291 #[get(type(copy))]
292 pub(crate) animation_timeline_ns: u64,
293 /// Target presentation refresh rate in Hertz (normal perf switches MUST NOT lower this).
294 #[get(type(copy))]
295 pub(crate) target_refresh_hz: f64,
296}
297
298/// First-frame verification descriptor submitted by a warmed candidate at a frame boundary.
299#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
300pub struct HandoffFrameDescriptor {
301 /// Physical surface width produced by the candidate first frame.
302 #[get(type(copy))]
303 pub(crate) width: u32,
304 /// Physical surface height produced by the candidate first frame.
305 #[get(type(copy))]
306 pub(crate) height: u32,
307 /// Exact DPI scale factor used by the candidate first frame.
308 #[get(type(copy))]
309 pub(crate) scale_factor: f32,
310 /// Exact `scene_version` rendered into the candidate first frame.
311 #[get(type(copy))]
312 pub(crate) scene_version: u64,
313 /// Measured candidate first-frame render + submit duration in milliseconds.
314 #[get(type(copy))]
315 pub(crate) frame_time_ms: f64,
316 /// Active frame deadline in milliseconds that the first frame must satisfy.
317 #[get(type(copy))]
318 pub(crate) deadline_ms: f64,
319 /// True when the candidate first frame rendered without error.
320 #[get(type(copy))]
321 pub(crate) first_frame_ok: bool,
322}
323
324/// Budget slicing and deferred resource reclamation settings for `HandoffCoordinator`.
325#[derive(Clone, Copy, Data, Debug, PartialEq)]
326pub struct HandoffBudgetConfig {
327 /// Number of budget-sliced warmup steps required before candidate first-frame boundary check.
328 #[get(type(copy))]
329 pub(crate) warmup_steps_required: u32,
330 /// Maximum per-frame UI/render-thread warmup work slice in milliseconds.
331 #[get(type(copy))]
332 pub(crate) per_frame_budget_ms: f64,
333 /// Maximum elapsed warmup wall time in milliseconds before aborting.
334 #[get(type(copy))]
335 pub(crate) max_warmup_timeout_ms: u64,
336 /// Minimum post-handoff fence frames confirmed before releasing old backend resources.
337 #[get(type(copy))]
338 pub(crate) post_commit_fence_frames: u32,
339}
340
341/// Frame-boundary backend handoff state machine ensuring uninterrupted presentation, exact version matching, and deferred resource release.
342#[derive(Clone, Copy, Data, Debug, PartialEq)]
343pub struct HandoffCoordinator {
344 /// Active handoff lifecycle stage.
345 #[get(type(copy))]
346 pub(crate) stage: HandoffStage,
347 /// Previous backend continuing to present until frame-boundary takeover.
348 #[get(type(copy))]
349 pub(crate) old_candidate: RenderBackendCandidate,
350 /// Candidate backend warming up for takeover.
351 #[get(type(copy))]
352 pub(crate) target_candidate: RenderBackendCandidate,
353 /// Target physical width captured when handoff started.
354 #[get(type(copy))]
355 pub(crate) target_width: u32,
356 /// Target physical height captured when handoff started.
357 #[get(type(copy))]
358 pub(crate) target_height: u32,
359 /// Target DPI scale factor captured when handoff started.
360 #[get(type(copy))]
361 pub(crate) target_scale_factor: f32,
362 /// Target `scene_version` the candidate warms up on.
363 #[get(type(copy))]
364 pub(crate) target_scene_version: u64,
365 /// Monotonic timestamp in milliseconds when warmup began.
366 #[get(type(copy))]
367 pub(crate) started_at_ms: u64,
368 /// Number of per-frame budget-sliced warmup steps completed.
369 #[get(type(copy))]
370 pub(crate) warmup_steps_completed: u32,
371 /// Active warmup budget and deferred release configuration.
372 #[get(type(copy))]
373 pub(crate) budget_config: HandoffBudgetConfig,
374 /// True while old backend resources remain alive and MUST NOT be released yet.
375 #[get(type(copy))]
376 pub(crate) old_resources_retained: bool,
377 /// Sync fence identifier assigned at frame-boundary takeover.
378 #[get(type(copy))]
379 pub(crate) commit_fence_id: u64,
380 /// Latest completed sync fence identifier confirmed after handoff.
381 #[get(type(copy))]
382 pub(crate) completed_fence_id: u64,
383 /// True once at least one post-handoff present has been confirmed on the new backend.
384 #[get(type(copy))]
385 pub(crate) post_handoff_present_confirmed: bool,
386 /// Diagnostic abort reason from the most recent aborted handoff.
387 #[get(skip)]
388 pub(crate) last_abort_reason: Option<HandoffAbortReason>,
389 /// Cumulative verified seamless handoff commits (explicitly excluding fault failovers).
390 #[get(type(copy))]
391 pub(crate) seamless_success_count: u64,
392 /// Cumulative cleanly aborted handoffs where the old backend kept presenting.
393 #[get(type(copy))]
394 pub(crate) abort_count: u64,
395 /// Runtime state snapshot captured at handoff start to assert zero state/timeline reset.
396 #[get(type(copy))]
397 pub(crate) preserved_state: RuntimeStateSnapshot,
398}
399
400/// Policy thresholds and rollout controls for `AdaptiveRenderRouter`.
401#[derive(Clone, Copy, Data, Debug, PartialEq)]
402pub struct AdaptiveRouterConfig {
403 /// Rollout mode (`RecommendOnly` default shadow mode vs `AutoSwitch` live takeover).
404 #[get(type(copy))]
405 pub(crate) switch_mode: AdaptiveSwitchMode,
406 /// Consecutive missed-deadline frames required before considering a candidate probe.
407 #[get(type(copy))]
408 pub(crate) sustained_miss_threshold: u32,
409 /// Input-to-present latency ratio over target frame interval triggering a probe.
410 #[get(type(copy))]
411 pub(crate) input_latency_degrade_ratio: f64,
412 /// Consecutive candidate wins required before recommending or triggering a switch.
413 #[get(type(copy))]
414 pub(crate) consecutive_wins_required: u32,
415 /// Minimum net latency improvement in milliseconds required to overcome switch cost.
416 #[get(type(copy))]
417 pub(crate) switch_cost_ms: f64,
418 /// Minimum dwell time in milliseconds between performance-driven switches.
419 #[get(type(copy))]
420 pub(crate) min_dwell_ms: u64,
421 /// Cooldown duration in milliseconds after a switch or failover.
422 #[get(type(copy))]
423 pub(crate) cooldown_ms: u64,
424 /// Minimum explicit frame headroom fraction required to run a probe when not idle.
425 #[get(type(copy))]
426 pub(crate) probe_min_headroom_ratio: f64,
427 /// Fixed capacity of `BoundedTelemetryQueue`.
428 #[get(type(copy))]
429 pub(crate) telemetry_queue_capacity: usize,
430}
431
432/// Structured decision returned by `AdaptiveRenderRouter` stages.
433#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
434pub struct AdaptiveDecision {
435 /// Specific routing/handoff/fault action category.
436 #[get(type(copy))]
437 pub(crate) kind: AdaptiveDecisionKind,
438 /// Backend candidate currently presenting frames.
439 #[get(type(copy))]
440 pub(crate) active_candidate: RenderBackendCandidate,
441 /// Recommended optimal candidate (may differ from `active_candidate` in `RecommendOnly` mode).
442 #[get(type(copy))]
443 pub(crate) recommended_candidate: RenderBackendCandidate,
444 /// True when the router actively applied a backend change or started handoff.
445 #[get(type(copy))]
446 pub(crate) applied: bool,
447 /// Human-readable static rationale for observability and telemetry evidence.
448 #[get(type(copy))]
449 pub(crate) reason: &'static str,
450 /// True when the last valid frame MUST be retained (never submitting a blank frame).
451 #[get(type(copy))]
452 pub(crate) preserve_last_valid_frame: bool,
453 /// Explicit hardware/surface/driver/thermal fault tag when triggered by a fault.
454 #[get(skip)]
455 pub(crate) fault_tag: Option<FaultEventKind>,
456}
457
458/// Serializable compact telemetry snapshot of `AdaptiveRenderRouter` embedded in `AdaptiveFrameMetrics`.
459#[derive(Clone, Copy, Data, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
460pub struct AdaptiveRouterSnapshot {
461 /// Currently active rendering backend candidate.
462 #[get(type(copy))]
463 pub(crate) active_candidate: RenderBackendCandidate,
464 /// Most recently recommended rendering backend candidate.
465 #[get(type(copy))]
466 pub(crate) recommended_candidate: RenderBackendCandidate,
467 /// Active rollout switch mode (`recommend_only` or `auto_switch`).
468 #[get(type(copy))]
469 pub(crate) switch_mode: AdaptiveSwitchMode,
470 /// Current frame-boundary handoff lifecycle stage.
471 #[get(type(copy))]
472 pub(crate) handoff_stage: HandoffStage,
473 /// Cumulative verified seamless handoff commits (excluding fault failovers).
474 #[get(type(copy))]
475 pub(crate) seamless_handoff_successes: u64,
476 /// Cumulative cleanly aborted handoffs.
477 #[get(type(copy))]
478 pub(crate) handoff_aborts: u64,
479 /// Cumulative fault-driven failovers (explicitly tracked apart from seamless handoffs).
480 #[get(type(copy))]
481 pub(crate) fault_failovers: u64,
482 /// Total headroom-gated candidate probes authorized.
483 #[get(type(copy))]
484 pub(crate) probe_runs: u64,
485 /// Total candidate probes skipped due to lack of idle time or explicit headroom.
486 #[get(type(copy))]
487 pub(crate) probe_skips_no_headroom: u64,
488 /// Total startup cache hits reused from `WinnerCache`.
489 #[get(type(copy))]
490 pub(crate) cache_hits: u64,
491 /// Total shadow-mode recommendations recorded in `RecommendOnly` mode.
492 #[get(type(copy))]
493 pub(crate) recommendations_logged: u64,
494 /// True when a fault has been tagged during this session.
495 #[get(type(copy))]
496 pub(crate) has_tagged_fault: bool,
497 /// Most recent tagged fault classification (valid when `has_tagged_fault` is true).
498 #[get(type(copy))]
499 pub(crate) last_fault_kind: FaultEventKind,
500}
501
502/// Unified 5-stage cross-platform adaptive render router (Startup, Runtime, Selection, Handoff, Fault).
503#[derive(Clone, Data, Debug, PartialEq)]
504pub struct AdaptiveRenderRouter {
505 /// Tunable adaptive routing thresholds and rollout mode.
506 #[get(type(copy))]
507 pub(crate) config: AdaptiveRouterConfig,
508 /// Host capability profile and visual-equivalence baseline.
509 pub(crate) host_profile: HostCapabilityProfile,
510 /// Verified startup winner cache keyed by device, driver, display mode, build, and scene profile.
511 pub(crate) winner_cache: WinnerCache,
512 /// Fixed-capacity non-blocking drop-oldest hot-path telemetry queue.
513 pub(crate) telemetry_queue: BoundedTelemetryQueue,
514 /// Frame-boundary handoff coordinator managing warmup, commit, abort, and deferred release.
515 #[get(type(copy))]
516 pub(crate) handoff: HandoffCoordinator,
517 /// Active backend candidate currently presenting frames.
518 #[get(type(copy))]
519 pub(crate) active_candidate: RenderBackendCandidate,
520 /// Latest recommended backend candidate.
521 #[get(type(copy))]
522 pub(crate) recommended_candidate: RenderBackendCandidate,
523 /// Active workload scene profile.
524 #[get(type(copy))]
525 pub(crate) active_scene_profile: SceneProfile,
526 /// Active display mode refresh rate in Hertz.
527 #[get(type(copy))]
528 pub(crate) display_mode_hz: f64,
529 /// Active device/adapter identifier for `WinnerCacheKey`.
530 pub(crate) device_id: String,
531 /// Active graphics driver version for `WinnerCacheKey`.
532 pub(crate) driver_version: String,
533 /// Active application/engine build identifier for `WinnerCacheKey`.
534 pub(crate) build_id: String,
535 /// Monotonic timestamp in milliseconds of the last committed backend switch.
536 #[get(type(copy))]
537 pub(crate) last_switch_ms: u64,
538 /// True once at least one switch has occurred (gating `min_dwell_ms`).
539 #[get(type(copy))]
540 pub(crate) has_switched_once: bool,
541 /// Monotonic timestamp in milliseconds until which probing and re-switching are suppressed.
542 #[get(type(copy))]
543 pub(crate) cooldown_until_ms: u64,
544 /// Consecutive missed-deadline frame counter.
545 #[get(type(copy))]
546 pub(crate) sustained_miss_streak: u32,
547 /// True when input-to-present latency degradation was detected in the active window.
548 #[get(type(copy))]
549 pub(crate) input_latency_degraded: bool,
550 /// Candidate currently accumulating consecutive selection wins.
551 #[get(skip)]
552 pub(crate) streak_candidate: Option<RenderBackendCandidate>,
553 /// Number of consecutive wins accumulated by `streak_candidate`.
554 #[get(type(copy))]
555 pub(crate) streak_wins: u32,
556 /// True when the last valid frame is currently retained on screen across a fault or transition.
557 #[get(type(copy))]
558 pub(crate) last_valid_frame_retained: bool,
559 /// Cumulative count of fault-driven failovers (never counted as seamless handoff successes).
560 #[get(type(copy))]
561 pub(crate) fault_failover_count: u64,
562 /// Chronological log of explicitly tagged `(timestamp_ms, FaultEventKind)` events.
563 pub(crate) tagged_fault_events: Vec<(u64, FaultEventKind)>,
564 /// Total headroom-gated short probes authorized.
565 #[get(type(copy))]
566 pub(crate) probe_runs: u64,
567 /// Total candidate probes skipped due to lack of idle time or explicit frame headroom.
568 #[get(type(copy))]
569 pub(crate) probe_skips_no_headroom: u64,
570 /// Total startup winner cache hits.
571 #[get(type(copy))]
572 pub(crate) cache_hits: u64,
573 /// Total shadow-mode recommendations logged in `RecommendOnly` mode.
574 #[get(type(copy))]
575 pub(crate) recommendations_logged: u64,
576 /// Static reason string from the most recent router decision.
577 #[get(type(copy))]
578 pub(crate) last_decision_reason: &'static str,
579}