---
# System prepended metadata

title: Dropped Frame in CC
tags: [Chromium-Graphics]

---

# Dropped Frame in CC
[FrameInfo](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/frame_info.h;l=13;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) is a container of the information representing the compositor frame.  
It stores the data related to frame submission including whether the frame has been dropped or not. Let's start from taking a look at FrameInfo to follow how the frame is dropped.

## Frame State
[FrameFinalState](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/frame_info.h;l=18-41;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) state represents how the frame is handled. This is one of the properties in FrameInfo. 
Some frame cannot be presented and ends up being dropped. Some frame is partially updated and does not require whole redraw.

If the frame has `kDropped` state, it means the frame is dropped for some reasons.  
The number of dropped frames are accumulated to [`frames_missing_content`](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/frame_sequence_metrics.cc;l=593;drc=8e78783dc1f7007bad46d657c9f332614e240fd8). 

`kPresentedAll` is set the frame contains all the desired update for this vsync.  
`kPresentedPartialOldMain` and `kPresentedPartialNewMain` us fir frame containing updates from a compositor frame but only partially. This misses the update from the main-thread for the same vsync. `Old` represents a partial update frame without any new update, but `New` is with some new update.  These are not for main thread.  

The default value is `kNoUpdateDesired` which literarly implies that there is no update in this frame.

## kDropped
Now let's see how `kDropped` state is set.

From blink, [VideoFrameSubmitter](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/video_frame_submitter.cc;l=382;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) sets `kDropped` when the presentation fas failed.  
On non linux platforms, presentation_failure flag is set from [OnBeginFrame](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/video_frame_submitter.cc;l=340;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) if `feedback.flags` has `gfx::PresentationFeedback::kFailure`. Note that [PresentationFeedback::Flags](https://source.chromium.org/chromium/chromium/src/+/main:ui/gfx/presentation_feedback.h;l=20;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) is a enum that includes the feedback data such as bwhether the presentation was synchronized to vsync, or whether the clock is converted from hardware clock.

Another scenario that sets `kDropped` is when FrameTerminationStatus is [kDidNotPresentFrame, kReplacedByNewReporter](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporter.cc;l=1907;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) or [kDidNotProduceFrame](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporter.cc;l=1923-1925;drc=8e78783dc1f7007bad46d657c9f332614e240fd8).

[FrameTerminationStatus](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporter.h;l=70;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) is passed via [TermionateFrame](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporter.cc;l=744;drc=8e78783dc1f7007bad46d657c9f332614e240fd8).  
[CompositorFrameReportingContrtoller](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporting_controller.h;l=40;drc=4afc175becb855737f279f8abc1bd50f3fecc4f2) manages simultaneous compositor frame reporter with high latency. It also calls TerminateFrame when needed, such as from [DidPresentCompositorFrame](https://source.chromium.org/chromium/chromium/src/+/main:cc/metrics/compositor_frame_reporting_controller.cc;l=557;drc=8e78783dc1f7007bad46d657c9f332614e240fd8) to set either of DidNotPresentFrame or PresentedFrame depending on the results, and this is called from [cc::Scheduler::DidPresentCompositorFrame](https://source.chromium.org/chromium/chromium/src/+/main:cc/scheduler/scheduler.cc;l=239-240;drc=8e78783dc1f7007bad46d657c9f332614e240fd8).  
Now that we find cc::Scheduler, we can imagine that this is the same pass we though during DrawAndSwap.