blob: 21b53fe7e4404f487dee0315d27ab3fd567990ac [file] [log] [blame]
Mathias Agopiand0566bc2011-11-17 17:49:17 -08001/*
2 * Copyright (C) 2011 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
Dan Stozaa5f61dd2017-03-30 16:09:13 -070017#pragma once
Mathias Agopiand0566bc2011-11-17 17:49:17 -080018
19#include <binder/IInterface.h>
20
Dan Stozaa5f61dd2017-03-30 16:09:13 -070021#include <utils/Errors.h>
22
23#include <sys/types.h>
24#include <cstdint>
25
Mathias Agopiand0566bc2011-11-17 17:49:17 -080026namespace android {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080027
Dan Stoza27c81152017-03-31 16:30:42 -070028namespace gui {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080029class BitTube;
Dan Stoza27c81152017-03-31 16:30:42 -070030} // namespace gui
Mathias Agopiand0566bc2011-11-17 17:49:17 -080031
Dan Stozaa5f61dd2017-03-30 16:09:13 -070032class IDisplayEventConnection : public IInterface {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080033public:
Colin Cross17576de2016-09-26 13:07:06 -070034 DECLARE_META_INTERFACE(DisplayEventConnection)
Mathias Agopiand0566bc2011-11-17 17:49:17 -080035
Mathias Agopian478ae5e2011-12-06 17:22:19 -080036 /*
37 * getDataChannel() returns a BitTube where to receive the events from
38 */
Dan Stoza27c81152017-03-31 16:30:42 -070039 virtual status_t getDataChannel(sp<gui::BitTube>* outChannel) const = 0;
Mathias Agopian478ae5e2011-12-06 17:22:19 -080040
41 /*
Dan Stozaa5f61dd2017-03-30 16:09:13 -070042 * setVsyncRate() sets the vsync event delivery rate. A value of 1 returns every vsync event.
43 * A value of 2 returns every other event, etc. A value of 0 returns no event unless
44 * requestNextVsync() has been called.
Mathias Agopian478ae5e2011-12-06 17:22:19 -080045 */
Dan Stozae1c599b2017-03-30 16:37:19 -070046 virtual status_t setVsyncRate(uint32_t count) = 0;
Mathias Agopian478ae5e2011-12-06 17:22:19 -080047
48 /*
Dan Stozaa5f61dd2017-03-30 16:09:13 -070049 * requestNextVsync() schedules the next vsync event. It has no effect if the vsync rate is > 0.
Mathias Agopian478ae5e2011-12-06 17:22:19 -080050 */
Dan Stozaa5f61dd2017-03-30 16:09:13 -070051 virtual void requestNextVsync() = 0; // Asynchronous
Mathias Agopiand0566bc2011-11-17 17:49:17 -080052};
53
Dan Stozaa5f61dd2017-03-30 16:09:13 -070054class BnDisplayEventConnection : public BnInterface<IDisplayEventConnection> {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080055public:
Dan Stozaa5f61dd2017-03-30 16:09:13 -070056 virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
57 uint32_t flags = 0);
Mathias Agopiand0566bc2011-11-17 17:49:17 -080058};
59
Dan Stozaa5f61dd2017-03-30 16:09:13 -070060} // namespace android