1*38e8c45fSAndroid Build Coastguard Worker /* 2*38e8c45fSAndroid Build Coastguard Worker * Copyright 2020 The Android Open Source Project 3*38e8c45fSAndroid Build Coastguard Worker * 4*38e8c45fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*38e8c45fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*38e8c45fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*38e8c45fSAndroid Build Coastguard Worker * 8*38e8c45fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*38e8c45fSAndroid Build Coastguard Worker * 10*38e8c45fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*38e8c45fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*38e8c45fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*38e8c45fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*38e8c45fSAndroid Build Coastguard Worker * limitations under the License. 15*38e8c45fSAndroid Build Coastguard Worker */ 16*38e8c45fSAndroid Build Coastguard Worker 17*38e8c45fSAndroid Build Coastguard Worker #pragma once 18*38e8c45fSAndroid Build Coastguard Worker 19*38e8c45fSAndroid Build Coastguard Worker namespace android { 20*38e8c45fSAndroid Build Coastguard Worker 21*38e8c45fSAndroid Build Coastguard Worker // Jank type tracked by SurfaceFlinger(SF) for Perfetto tracing and telemetry. 22*38e8c45fSAndroid Build Coastguard Worker enum JankType { 23*38e8c45fSAndroid Build Coastguard Worker // No Jank 24*38e8c45fSAndroid Build Coastguard Worker None = 0x0, 25*38e8c45fSAndroid Build Coastguard Worker // Jank that occurs in the layers below SurfaceFlinger 26*38e8c45fSAndroid Build Coastguard Worker DisplayHAL = 0x1, 27*38e8c45fSAndroid Build Coastguard Worker // SF took too long on the CPU; deadline missed during HWC 28*38e8c45fSAndroid Build Coastguard Worker SurfaceFlingerCpuDeadlineMissed = 0x2, 29*38e8c45fSAndroid Build Coastguard Worker // SF took too long on the GPU; deadline missed during GPU composition 30*38e8c45fSAndroid Build Coastguard Worker SurfaceFlingerGpuDeadlineMissed = 0x4, 31*38e8c45fSAndroid Build Coastguard Worker // Either App or GPU took too long on the frame 32*38e8c45fSAndroid Build Coastguard Worker AppDeadlineMissed = 0x8, 33*38e8c45fSAndroid Build Coastguard Worker // Vsync predictions have drifted beyond the threshold from the actual HWVsync 34*38e8c45fSAndroid Build Coastguard Worker PredictionError = 0x10, 35*38e8c45fSAndroid Build Coastguard Worker // Janks caused due to the time SF was scheduled to work on the frame 36*38e8c45fSAndroid Build Coastguard Worker // Example: SF woke up too early and latched a buffer resulting in an early present 37*38e8c45fSAndroid Build Coastguard Worker SurfaceFlingerScheduling = 0x20, 38*38e8c45fSAndroid Build Coastguard Worker // A buffer is said to be stuffed if it was expected to be presented on a vsync but was 39*38e8c45fSAndroid Build Coastguard Worker // presented later because the previous buffer was presented in its expected vsync. This 40*38e8c45fSAndroid Build Coastguard Worker // usually happens if there is an unexpectedly long frame causing the rest of the buffers 41*38e8c45fSAndroid Build Coastguard Worker // to enter a stuffed state. 42*38e8c45fSAndroid Build Coastguard Worker BufferStuffing = 0x40, 43*38e8c45fSAndroid Build Coastguard Worker // Jank due to unknown reasons. 44*38e8c45fSAndroid Build Coastguard Worker Unknown = 0x80, 45*38e8c45fSAndroid Build Coastguard Worker // SF is said to be stuffed if the previous frame ran longer than expected resulting in the case 46*38e8c45fSAndroid Build Coastguard Worker // where the previous frame was presented in the current frame's expected vsync. This pushes the 47*38e8c45fSAndroid Build Coastguard Worker // current frame to the next vsync. The behavior is similar to BufferStuffing. 48*38e8c45fSAndroid Build Coastguard Worker SurfaceFlingerStuffing = 0x100, 49*38e8c45fSAndroid Build Coastguard Worker // Frame was dropped, as a newer frame was ready and replaced this frame. 50*38e8c45fSAndroid Build Coastguard Worker Dropped = 0x200, 51*38e8c45fSAndroid Build Coastguard Worker }; 52*38e8c45fSAndroid Build Coastguard Worker 53*38e8c45fSAndroid Build Coastguard Worker // Jank severity type tracked by SurfaceFlinger(SF) for Perfetto tracing and telemetry. 54*38e8c45fSAndroid Build Coastguard Worker enum class JankSeverityType { 55*38e8c45fSAndroid Build Coastguard Worker // Unknown: not enough information to classify the severity of a jank 56*38e8c45fSAndroid Build Coastguard Worker Unknown = 0, 57*38e8c45fSAndroid Build Coastguard Worker // None: no jank 58*38e8c45fSAndroid Build Coastguard Worker None = 1, 59*38e8c45fSAndroid Build Coastguard Worker // Partial: jank caused by missing the deadline by less than the app's frame interval 60*38e8c45fSAndroid Build Coastguard Worker Partial = 2, 61*38e8c45fSAndroid Build Coastguard Worker // Full: jank caused by missing the deadline by more than the app's frame interval 62*38e8c45fSAndroid Build Coastguard Worker Full = 3, 63*38e8c45fSAndroid Build Coastguard Worker }; 64*38e8c45fSAndroid Build Coastguard Worker 65*38e8c45fSAndroid Build Coastguard Worker } // namespace android 66