use super::*;
#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
pub struct VisualEquivalenceContract {
#[get(type(copy))]
pub(crate) fonts_identical: bool,
#[get(type(copy))]
pub(crate) layout_identical: bool,
#[get(type(copy))]
pub(crate) color_identical: bool,
#[get(type(copy))]
pub(crate) antialiasing_identical: bool,
#[get(type(copy))]
pub(crate) shadows_identical: bool,
#[get(type(copy))]
pub(crate) blur_identical: bool,
#[get(type(copy))]
pub(crate) visible_tiles_identical: bool,
#[get(type(copy))]
pub(crate) media_quality_identical: bool,
}
#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
pub struct CandidateCapabilities {
#[get(type(copy))]
pub(crate) candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) supported: bool,
#[get(type(copy))]
pub(crate) visual_contract: VisualEquivalenceContract,
#[get(type(copy))]
pub(crate) requires_ui_thread_warmup: bool,
#[get(type(copy))]
pub(crate) is_simulated_profile: bool,
#[get(type(copy))]
pub(crate) direct_gpu_verified_on_device: bool,
#[get(type(copy))]
pub(crate) graphics_backend: GraphicsBackend,
}
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct HostCapabilityProfile {
#[get(type(copy))]
pub(crate) platform: PlatformKind,
pub(crate) candidates: Vec<CandidateCapabilities>,
#[get(type(copy))]
pub(crate) single_channel_only: bool,
#[get(type(copy))]
pub(crate) baseline_contract: VisualEquivalenceContract,
}
#[derive(Clone, Data, Debug, Deserialize, Eq, Hash, New, PartialEq, Serialize)]
pub struct WinnerCacheKey {
pub(crate) device_id: String,
pub(crate) driver_version: String,
#[get(type(copy))]
pub(crate) display_mode_hz_millihz: u32,
pub(crate) build_id: String,
#[get(type(copy))]
pub(crate) scene_profile: SceneProfile,
}
#[derive(Clone, Copy, Data, Debug, Deserialize, New, PartialEq, Serialize)]
pub struct WinnerCacheEntry {
#[get(type(copy))]
pub(crate) winner: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) verified_at_ms: u64,
#[get(type(copy))]
pub(crate) p95_ms: f64,
#[get(type(copy))]
pub(crate) p99_ms: f64,
#[get(type(copy))]
pub(crate) missed_frame_rate: f64,
#[get(type(copy))]
pub(crate) input_to_present_ms: f64,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct WinnerCache {
pub(crate) entries: HashMap<WinnerCacheKey, WinnerCacheEntry>,
#[get(type(copy))]
pub(crate) max_entries: usize,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct TelemetrySample {
#[get(type(copy))]
pub(crate) frame_index: u64,
#[get(type(copy))]
pub(crate) timestamp_ns: u64,
#[get(type(copy))]
pub(crate) callback_interval_ms: f64,
#[get(type(copy))]
pub(crate) present_interval_ms: f64,
#[get(type(copy))]
pub(crate) present_timing_source: PresentTimingSource,
#[get(type(copy))]
pub(crate) present_outcome: SurfacePresentOutcome,
#[get(type(copy))]
pub(crate) missed_deadline: bool,
#[get(type(copy))]
pub(crate) input_to_present_ms: f64,
#[get(type(copy))]
pub(crate) input_latency_measured: bool,
#[get(type(copy))]
pub(crate) cpu_raster_ms: f64,
#[get(type(copy))]
pub(crate) cpu_raster_measured: bool,
#[get(type(copy))]
pub(crate) upload_bytes: u64,
#[get(type(copy))]
pub(crate) scene_profile: SceneProfile,
#[get(type(copy))]
pub(crate) display_mode_hz: f64,
#[get(type(copy))]
pub(crate) candidate: RenderBackendCandidate,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct BoundedTelemetryQueue {
pub(crate) slots: Vec<TelemetrySample>,
#[get(type(copy))]
pub(crate) head: usize,
#[get(type(copy))]
pub(crate) len: usize,
#[get(type(copy))]
pub(crate) capacity: usize,
#[get(type(copy))]
pub(crate) dropped_oldest_count: u64,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct AggregatedTelemetryWindow {
#[get(type(copy))]
pub(crate) sample_count: u64,
#[get(type(copy))]
pub(crate) presented_frames: u64,
#[get(type(copy))]
pub(crate) skipped_unchanged_frames: u64,
#[get(type(copy))]
pub(crate) failed_frames: u64,
#[get(type(copy))]
pub(crate) missed_deadline_frames: u64,
#[get(type(copy))]
pub(crate) present_p50_ms: f64,
#[get(type(copy))]
pub(crate) present_p95_ms: f64,
#[get(type(copy))]
pub(crate) present_p99_ms: f64,
#[get(type(copy))]
pub(crate) input_to_present_p95_ms: f64,
#[get(type(copy))]
pub(crate) has_input_latency: bool,
#[get(type(copy))]
pub(crate) has_compositor_timing: bool,
#[get(type(copy))]
pub(crate) scene_profile: SceneProfile,
#[get(type(copy))]
pub(crate) display_mode_hz: f64,
#[get(type(copy))]
pub(crate) candidate: RenderBackendCandidate,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct CandidateScore {
#[get(type(copy))]
pub(crate) candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) scene_profile: SceneProfile,
#[get(type(copy))]
pub(crate) display_mode_hz_millihz: u32,
#[get(type(copy))]
pub(crate) missed_frame_ratio: f64,
#[get(type(copy))]
pub(crate) p95_frame_ms: f64,
#[get(type(copy))]
pub(crate) p99_frame_ms: f64,
#[get(type(copy))]
pub(crate) input_to_present_ms: f64,
#[get(type(copy))]
pub(crate) hybrid_net_gain_ms: f64,
#[get(type(copy))]
pub(crate) sample_count: u64,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct RuntimeStateSnapshot {
#[get(type(copy))]
pub(crate) scroll_offset_x: f32,
#[get(type(copy))]
pub(crate) scroll_offset_y: f32,
#[get(type(copy))]
pub(crate) active_gesture_id: u64,
#[get(type(copy))]
pub(crate) focused_node_id: u64,
#[get(type(copy))]
pub(crate) page_state_revision: u64,
#[get(type(copy))]
pub(crate) animation_timeline_ns: u64,
#[get(type(copy))]
pub(crate) target_refresh_hz: f64,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct HandoffFrameDescriptor {
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) scale_factor: f32,
#[get(type(copy))]
pub(crate) scene_version: u64,
#[get(type(copy))]
pub(crate) frame_time_ms: f64,
#[get(type(copy))]
pub(crate) deadline_ms: f64,
#[get(type(copy))]
pub(crate) first_frame_ok: bool,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct HandoffBudgetConfig {
#[get(type(copy))]
pub(crate) warmup_steps_required: u32,
#[get(type(copy))]
pub(crate) per_frame_budget_ms: f64,
#[get(type(copy))]
pub(crate) max_warmup_timeout_ms: u64,
#[get(type(copy))]
pub(crate) post_commit_fence_frames: u32,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct HandoffCoordinator {
#[get(type(copy))]
pub(crate) stage: HandoffStage,
#[get(type(copy))]
pub(crate) old_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) target_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) target_width: u32,
#[get(type(copy))]
pub(crate) target_height: u32,
#[get(type(copy))]
pub(crate) target_scale_factor: f32,
#[get(type(copy))]
pub(crate) target_scene_version: u64,
#[get(type(copy))]
pub(crate) started_at_ms: u64,
#[get(type(copy))]
pub(crate) warmup_steps_completed: u32,
#[get(type(copy))]
pub(crate) budget_config: HandoffBudgetConfig,
#[get(type(copy))]
pub(crate) old_resources_retained: bool,
#[get(type(copy))]
pub(crate) commit_fence_id: u64,
#[get(type(copy))]
pub(crate) completed_fence_id: u64,
#[get(type(copy))]
pub(crate) post_handoff_present_confirmed: bool,
#[get(skip)]
pub(crate) last_abort_reason: Option<HandoffAbortReason>,
#[get(type(copy))]
pub(crate) seamless_success_count: u64,
#[get(type(copy))]
pub(crate) abort_count: u64,
#[get(type(copy))]
pub(crate) preserved_state: RuntimeStateSnapshot,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct AdaptiveRouterConfig {
#[get(type(copy))]
pub(crate) switch_mode: AdaptiveSwitchMode,
#[get(type(copy))]
pub(crate) sustained_miss_threshold: u32,
#[get(type(copy))]
pub(crate) input_latency_degrade_ratio: f64,
#[get(type(copy))]
pub(crate) consecutive_wins_required: u32,
#[get(type(copy))]
pub(crate) switch_cost_ms: f64,
#[get(type(copy))]
pub(crate) min_dwell_ms: u64,
#[get(type(copy))]
pub(crate) cooldown_ms: u64,
#[get(type(copy))]
pub(crate) probe_min_headroom_ratio: f64,
#[get(type(copy))]
pub(crate) telemetry_queue_capacity: usize,
}
#[derive(Clone, Copy, Data, Debug, Eq, Hash, PartialEq)]
pub struct AdaptiveDecision {
#[get(type(copy))]
pub(crate) kind: AdaptiveDecisionKind,
#[get(type(copy))]
pub(crate) active_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) recommended_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) applied: bool,
#[get(type(copy))]
pub(crate) reason: &'static str,
#[get(type(copy))]
pub(crate) preserve_last_valid_frame: bool,
#[get(skip)]
pub(crate) fault_tag: Option<FaultEventKind>,
}
#[derive(Clone, Copy, Data, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct AdaptiveRouterSnapshot {
#[get(type(copy))]
pub(crate) active_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) recommended_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) switch_mode: AdaptiveSwitchMode,
#[get(type(copy))]
pub(crate) handoff_stage: HandoffStage,
#[get(type(copy))]
pub(crate) seamless_handoff_successes: u64,
#[get(type(copy))]
pub(crate) handoff_aborts: u64,
#[get(type(copy))]
pub(crate) fault_failovers: u64,
#[get(type(copy))]
pub(crate) probe_runs: u64,
#[get(type(copy))]
pub(crate) probe_skips_no_headroom: u64,
#[get(type(copy))]
pub(crate) cache_hits: u64,
#[get(type(copy))]
pub(crate) recommendations_logged: u64,
#[get(type(copy))]
pub(crate) has_tagged_fault: bool,
#[get(type(copy))]
pub(crate) last_fault_kind: FaultEventKind,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct AdaptiveRenderRouter {
#[get(type(copy))]
pub(crate) config: AdaptiveRouterConfig,
pub(crate) host_profile: HostCapabilityProfile,
pub(crate) winner_cache: WinnerCache,
pub(crate) telemetry_queue: BoundedTelemetryQueue,
#[get(type(copy))]
pub(crate) handoff: HandoffCoordinator,
#[get(type(copy))]
pub(crate) active_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) recommended_candidate: RenderBackendCandidate,
#[get(type(copy))]
pub(crate) active_scene_profile: SceneProfile,
#[get(type(copy))]
pub(crate) display_mode_hz: f64,
pub(crate) device_id: String,
pub(crate) driver_version: String,
pub(crate) build_id: String,
#[get(type(copy))]
pub(crate) last_switch_ms: u64,
#[get(type(copy))]
pub(crate) has_switched_once: bool,
#[get(type(copy))]
pub(crate) cooldown_until_ms: u64,
#[get(type(copy))]
pub(crate) sustained_miss_streak: u32,
#[get(type(copy))]
pub(crate) input_latency_degraded: bool,
#[get(skip)]
pub(crate) streak_candidate: Option<RenderBackendCandidate>,
#[get(type(copy))]
pub(crate) streak_wins: u32,
#[get(type(copy))]
pub(crate) last_valid_frame_retained: bool,
#[get(type(copy))]
pub(crate) fault_failover_count: u64,
pub(crate) tagged_fault_events: Vec<(u64, FaultEventKind)>,
#[get(type(copy))]
pub(crate) probe_runs: u64,
#[get(type(copy))]
pub(crate) probe_skips_no_headroom: u64,
#[get(type(copy))]
pub(crate) cache_hits: u64,
#[get(type(copy))]
pub(crate) recommendations_logged: u64,
#[get(type(copy))]
pub(crate) last_decision_reason: &'static str,
}