Skip to content

Calculate AnimationError and AnimationTime for generated frames#669

Open
markgalvan-intel wants to merge 1 commit into
mainfrom
cleanup-aefg
Open

Calculate AnimationError and AnimationTime for generated frames#669
markgalvan-intel wants to merge 1 commit into
mainfrom
cleanup-aefg

Conversation

@markgalvan-intel

Copy link
Copy Markdown
Collaborator

Calculate animation metrics per displayed frame by distributing the application simulation interval across every generated and application display step between two application frames. Buffer rows until both animation context and display timing are available, while preserving ingest order for generated and not-displayed frames. Start a new animation timeline when the simulation source changes, omit animation metrics when no valid interval exists, and retain lookahead buffering so displayed duration remains accurate.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the unified swap-chain metrics pipeline to compute AnimationError and AnimationTime per displayed frame (including generated frames) by buffering display-instance “rows” until both animation context (app-to-app interval resolution) and display-timing lookahead are available, while preserving ingest order and handling simulation-source transitions.

Changes:

  • Introduces a row-based processing pipeline (DisplayFrameQueue + AnimationErrorTracker) and routes console/middleware/API ingestion through UnifiedSwapChain::ProcessPresent().
  • Splits swap-chain state updates into V1/V2-specific paths and adds ReadyDisplayRow / AnimationDisplayContext to carry per-display-instance context.
  • Updates API2 CSV verification helpers to throw on metric mismatches and adds a unit test to ensure not-displayed rows preserve last-displayed state.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
PresentMon/OutputThread.cpp Switches console processing to new ProcessPresent() path for V2 and updates V1 handling/seed behavior.
PresentData/PresentMonTraceConsumer.cpp Adds helper to ignore/log duplicate Application FlipFrameType events.
IntelPresentMon/UnitTests/SwapChainTests.cpp Adds regression test to ensure not-displayed rows don’t clear last-displayed state.
IntelPresentMon/PresentMonMiddleware/FrameMetricsSource.cpp Routes middleware metrics through UnifiedSwapChain::ProcessPresent().
IntelPresentMon/PresentMonAPI2Tests/CsvHelper.h Adds *OrThrow helpers and simplifies per-column validation logic.
IntelPresentMon/CommonUtilities/mc/UnifiedSwapChain.h Replaces Enqueue() interface with ProcessPresent() and adds new row/apply plumbing.
IntelPresentMon/CommonUtilities/mc/UnifiedSwapChain.cpp Implements ProcessPresent(), EnqueueReadyDisplayRows(), and apply step; updates repeated-frame sanitization.
IntelPresentMon/CommonUtilities/mc/SwapChainState.h Splits swap-chain update APIs into V1/bootstrap-V2/row-based update methods.
IntelPresentMon/CommonUtilities/mc/SwapChainState.cpp Implements new swap-chain update paths and row-based state advancement rules.
IntelPresentMon/CommonUtilities/mc/MetricsTypes.h Adds AnimationDisplayContext and ReadyDisplayRow structures.
IntelPresentMon/CommonUtilities/mc/MetricsCalculatorInternal.h Changes animation metric calculation to consume AnimationDisplayContext.
IntelPresentMon/CommonUtilities/mc/MetricsCalculatorDisplay.cpp Removes legacy DisplayIndexing helper implementation.
IntelPresentMon/CommonUtilities/mc/MetricsCalculatorAnimation.cpp Moves animation computation out of calculator path; now consumes precomputed animation context.
IntelPresentMon/CommonUtilities/mc/MetricsCalculator.h Updates exported calculator APIs and adds ComputeMetricsForReadyDisplayRow().
IntelPresentMon/CommonUtilities/mc/MetricsCalculator.cpp Refactors V1 present-level computation and adds row-based compute/apply entry point.
IntelPresentMon/CommonUtilities/mc/DisplayFrameQueue.h New: buffering and publish policy for display-instance rows.
IntelPresentMon/CommonUtilities/mc/DisplayFrameQueue.cpp New: implements ingest/order/lookahead + release policy for rows.
IntelPresentMon/CommonUtilities/mc/AnimationErrorTracker.h New: interval-resolution and animation context distribution across display instances.
IntelPresentMon/CommonUtilities/mc/AnimationErrorTracker.cpp New: implements source resolution, sim-start resolution, interval distribution, and transitions.
IntelPresentMon/CommonUtilities/CommonUtilities.vcxproj.filters Adds new mc headers/sources to project filters.
IntelPresentMon/CommonUtilities/CommonUtilities.vcxproj Adds new mc headers/sources to the CommonUtilities build.
Comments suppressed due to low confidence (1)

IntelPresentMon/CommonUtilities/mc/SwapChainState.h:6

  • This header starts with a UTF-8 BOM character (visible before the leading //). That introduces non-ASCII content at the start of the file and is inconsistent with other files in this PR that removed the BOM. Also, SwapChainState.h uses std::optional but doesn't include directly, which makes the header rely on transitive includes.
// Copyright (C) 2025 Intel Corporation
// SPDX-License-Identifier: MIT
#pragma once

#include <cstdint>
#include "MetricsTypes.h"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 355 to 359
*outProcessInfo = processInfo;
auto chain = &processInfo->mSwapChain[presentEvent->SwapChainAddress];
*outChain = chain;
*outPresentTime = chain->mUnifiedSwapChain.GetLastPresentQpc();
return false;
@@ -0,0 +1,141 @@
// Copyright (C) 2025 Intel Corporation
@@ -0,0 +1,548 @@
// Copyright (C) 2025 Intel Corporation
@@ -0,0 +1,61 @@
// Copyright (C) 2025 Intel Corporation
@@ -0,0 +1,187 @@
// Copyright (C) 2025 Intel Corporation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.

Comment thread IntelPresentMon/CommonUtilities/mc/SwapChainState.h Outdated
Comment on lines +535 to +545
void ValidateMetricOrThrow(Header columnId, size_t line, double gold, double actual) {
if (!ValidateMetricValue(gold, actual)) {
throw CsvValidationException(columnId, line, gold, actual);
}
}

void ValidateFrameTypeOrThrow(Header columnId, size_t line, PM_FRAME_TYPE gold, PM_FRAME_TYPE test) {
if (!ValidateFrameType(gold, test)) {
throw CsvValidationException(columnId, line, gold, test);
}
}
Comment thread PresentData/PresentMonTraceConsumer.cpp Outdated
}
}

static inline bool TryApplyFlipFrameType(
Calculate animation metrics per displayed frame by distributing the application simulation interval across every generated and application display step between two application frames. Buffer rows until both animation context and display timing are available, while preserving ingest order for generated and not-displayed frames. Start a new animation timeline when the simulation source changes, omit animation metrics when no valid interval exists, and retain lookahead buffering so displayed duration remains accurate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants