/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

package perfetto.protos;

message AndroidDisplayMetrics {
  // Stat that reports the number of duplicate frames submitted
  // to the display for rendering. That is frames that have the same
  // pixels values but where still submitted. It is tracked based on
  // comparing the MISR of the current frame vs previous frame.
  optional uint32 total_duplicate_frames = 1;

  // Stat reports whether there is any duplicate_frames tracked
  optional uint32 duplicate_frames_logged = 2;

  // Stat that reports the number of dpu underrrun occurs count.
  optional uint32 total_dpu_underrun_count = 3;


  message RefreshRateStat {
    // The refresh rate value (the number of frames per second)
    optional uint32 refresh_rate_fps = 1;

    // Calculate the number of refresh rate switches to this fps
    optional uint32 count = 2;

    // Calculate the total duration of refresh rate stays at this fps
    optional double total_dur_ms = 3;

    // Calculate the average duration of refresh rate stays at this fps
    optional double avg_dur_ms = 4;
  }

  // Calculate the total number of refresh rate changes
  optional uint32 refresh_rate_switches = 4;

  // The statistics for each refresh rate value
  repeated RefreshRateStat refresh_rate_stats = 5;

  // Stats to measure the runtime of updating the power state in
  // DisplayPowerController
  message UpdatePowerState {
    optional uint32 avg_runtime_ms = 1;
  }

  optional UpdatePowerState update_power_state = 6;
}
