• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18package perfetto.protos;
19
20// A profiling event corresponding to a single camera frame. This message
21// collects important details and timestamps involved in producing a single
22// camera frame.
23// Next ID: 17
24message AndroidCameraFrameEvent {
25  // Identifier for the CameraCaptureSession this frame originates from. See:
26  // https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession
27  optional uint64 session_id = 1;
28  // Identifier for the camera sensor that is the source of this frame. This may
29  // be either a physical or logical camera (up to vendor interpretation).
30  optional uint32 camera_id = 2;
31  // The frame number identifying this frame on this camera.
32  optional int64 frame_number = 3;
33  // Identifier for the CaptureRequest. See:
34  // https://developer.android.com/reference/android/hardware/camera2/CaptureRequest
35  //
36  // If multiple cameras are streaming simultaneously, the request_id may be
37  // used to identify which frames were captured in service of the same request.
38  optional int64 request_id = 4;
39
40  // The CLOCK_BOOTTIME timestamp at which the camera framework request is
41  // received by the camera HAL pipeline. Note that this request may wait for
42  // some time before processing actually begins. See also
43  // request_processing_started_ns.
44  optional int64 request_received_ns = 5;
45  // The CLOCK_BOOTTIME timestamp at which the framework request is accepted for
46  // processing by the camera HAL pipeline. This is the time at which the
47  // pipeline actually begins to work on the request.
48  optional int64 request_processing_started_ns = 6;
49
50  // The CLOCK_BOOTTIME timestamp at which the sensor begins its exposure.
51  optional int64 start_of_exposure_ns = 7;
52  // The CLOCK_BOOTTIME timestamp corresponding to the sensor start of frame
53  // event.
54  optional int64 start_of_frame_ns = 8;
55  // The CLOCK_BOOTTIME timestamp at which the camera HAL has sent all responses
56  // for the frame.
57  optional int64 responses_all_sent_ns = 9;
58
59  // The error status, if any, reported to the camera framework. Any status
60  // other than STATUS_OK indicates a dropped frame.
61  // Next Enum: 6
62  enum CaptureResultStatus {
63    STATUS_UNSPECIFIED = 0;
64    STATUS_OK = 1;
65    // Early metadata was returned to the camera framework with an error.
66    STATUS_EARLY_METADATA_ERROR = 2;
67    // Final metadata was returned to the camera framework with an error.
68    STATUS_FINAL_METADATA_ERROR = 3;
69    // One or more buffers were returned to the camera framework with an error.
70    STATUS_BUFFER_ERROR = 4;
71    // The frame was dropped as a result of a flush operation.
72    STATUS_FLUSH_ERROR = 5;
73  }
74  optional CaptureResultStatus capture_result_status = 10;
75
76  // The number of sensor frames that were skipped between this frame and the
77  // previous frame. Under normal operation, this should be zero. Any number
78  // greater than zero indicates dropped sensor frames.
79  optional int32 skipped_sensor_frames = 11;
80
81  // The value of CONTROL_CAPTURE_INTENT. See:
82  // https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_CAPTURE_INTENT
83  optional int32 capture_intent = 12;
84  // The number of streams in the capture request.
85  optional int32 num_streams = 13;
86
87  // A profiling event corresponding to a single node processing within the camera
88  // pipeline. Intuitively this corresponds to a single stage of processing to
89  // produce a camera frame.
90  // Next ID: 6
91  message CameraNodeProcessingDetails {
92    optional int64 node_id = 1;
93    // The timestamp at which node processing begins to run.
94    optional int64 start_processing_ns = 2;
95    // The timestamp at which node processing finishes running.
96    optional int64 end_processing_ns = 3;
97    // The delay between inputs becoming ready and the node actually beginning to
98    // run.
99    optional int64 scheduling_latency_ns = 4;
100  }
101  repeated CameraNodeProcessingDetails node_processing_details = 14;
102
103  // These fields capture vendor-specific additions to this proto message. In
104  // practice `vendor_data` typically contains a serialized message of the
105  // vendor's design, and `vendor_data_version` is incremented each time there
106  // is a backwards incompatible change made to the message.
107  optional int32 vendor_data_version = 15;
108  optional bytes vendor_data = 16;
109}
110
111// A profiling event that may be emitted periodically (i.e., at a slower rate
112// than `AndroidCameraFrameEvent`s) to record fixed and aggregated camera
113// session-specific values.
114message AndroidCameraSessionStats {
115  // Identifier for the CameraCaptureSession this frame originates from. See:
116  // https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession
117  optional uint64 session_id = 1;
118
119  // Although vendor implementations may vary, camera pipeline processing is
120  // typically arranged into a directed graph-like structure. This message is
121  // used to record that graph.
122  message CameraGraph {
123    message CameraNode {
124      optional int64 node_id = 1;
125      // A list of inputs consumed by this node.
126      repeated int64 input_ids = 2;
127      // A list of outputs produced by this node.
128      repeated int64 output_ids = 3;
129
130      // These fields capture vendor-specific additions to this proto message. In
131      // practice `vendor_data` typically contains a serialized message of the
132      // vendor's design, and `vendor_data_version` is incremented each time there
133      // is a backwards incompatible change made to the message.
134      optional int32 vendor_data_version = 4;
135      optional bytes vendor_data = 5;
136    }
137    repeated CameraNode nodes = 1;
138
139    // An adjacency list describing connections between CameraNodes, mapping
140    // nodes and their outputs to other nodes that consume them as inputs.
141    message CameraEdge {
142      // The pair of IDs identifying the node and output connected by this edge.
143      optional int64 output_node_id = 1;
144      optional int64 output_id = 2;
145
146      // The pair of IDs identifying the node and input connected by this edge.
147      optional int64 input_node_id = 3;
148      optional int64 input_id = 4;
149
150      // These fields capture vendor-specific additions to this proto message. In
151      // practice `vendor_data` typically contains a serialized message of the
152      // vendor's design, and `vendor_data_version` is incremented each time there
153      // is a backwards incompatible change made to the message.
154      optional int32 vendor_data_version = 5;
155      optional bytes vendor_data = 6;
156    }
157    repeated CameraEdge edges = 2;
158  }
159  optional CameraGraph graph = 2;
160}
161