1 /*
2  * Copyright 2021 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 
17 #pragma once
18 
19 #include <stdint.h>
20 
21 #include <binder/Parcel.h>
22 
23 namespace android {
24 
25 struct FrameTimelineInfo {
26     // Needs to be in sync with android.graphics.FrameInfo.INVALID_VSYNC_ID in java
27     static constexpr int64_t INVALID_VSYNC_ID = -1;
28 
29     // The vsync id that was used to start the transaction
30     int64_t vsyncId = INVALID_VSYNC_ID;
31 
32     // The id of the input event that caused this buffer
33     // Default is android::os::IInputConstants::INVALID_INPUT_EVENT_ID = 0
34     // We copy the value of the input event ID instead of including the header, because libgui
35     // header libraries containing FrameTimelineInfo must be available to vendors, but libinput is
36     // not directly vendor available.
37     int32_t inputEventId = 0;
38 
39     status_t write(Parcel& output) const;
40     status_t read(const Parcel& input);
41 
42     void merge(const FrameTimelineInfo& other);
43     void clear();
44 };
45 
46 } // namespace android
47