/*
 * Copyright (C) 2023 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;

// Custom configuration for the "android.surfaceflinger.layers" data source.
message SurfaceFlingerLayersConfig {
  enum Mode {
    MODE_UNSPECIFIED = 0;

    // Trace layers snapshots. A snapshot is taken every time a layers change
    // occurs.
    MODE_ACTIVE = 1;

    // Generate layers snapshots from the transactions kept in the
    // SurfaceFlinger's internal ring buffer.
    // The layers snapshots generation occurs when this data source is flushed.
    MODE_GENERATED = 2;

    // Trace a single layers snapshot.
    MODE_DUMP = 3;

    // Default mode (applied by SurfaceFlinger if no mode is specified).
    // Same as MODE_GENERATED, but triggers the layers snapshots generation only
    // when a bugreport is taken.
    MODE_GENERATED_BUGREPORT_ONLY = 4;

    // Layer snapshots are generated by ProtoVM from layer patches
    MODE_PROTOVM = 5;
  }
  optional Mode mode = 1;

  enum TraceFlag {
    TRACE_FLAG_UNSPECIFIED = 0;
    TRACE_FLAG_INPUT = 0x02;
    TRACE_FLAG_COMPOSITION = 0x04;
    TRACE_FLAG_EXTRA = 0x08;
    TRACE_FLAG_HWC = 0x10;
    TRACE_FLAG_BUFFERS = 0x20;
    TRACE_FLAG_VIRTUAL_DISPLAYS = 0x40;

    // INPUT | COMPOSITION | EXTRA
    TRACE_FLAG_ALL = 0x0e;
  }
  repeated TraceFlag trace_flags = 2;
}
