blob: 07794489b9ec58d69dbb86e06b74eda04a61fc30 [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 /*
Dan Stoza6b698e42017-04-03 13:09:08 -070037 * stealReceiveChannel() returns a BitTube to receive events from. Only the receive file
38 * descriptor of outChannel will be initialized, and this effectively "steals" the receive
39 * channel from the remote end (such that the remote end can only use its send channel).
Mathias Agopian478ae5e2011-12-06 17:22:19 -080040 */
Dan Stoza6b698e42017-04-03 13:09:08 -070041 virtual status_t stealReceiveChannel(gui::BitTube* outChannel) = 0;
Mathias Agopian478ae5e2011-12-06 17:22:19 -080042
43 /*
Dan Stozaa5f61dd2017-03-30 16:09:13 -070044 * setVsyncRate() sets the vsync event delivery rate. A value of 1 returns every vsync event.
45 * A value of 2 returns every other event, etc. A value of 0 returns no event unless
46 * requestNextVsync() has been called.
Mathias Agopian478ae5e2011-12-06 17:22:19 -080047 */
Dan Stozae1c599b2017-03-30 16:37:19 -070048 virtual status_t setVsyncRate(uint32_t count) = 0;
Mathias Agopian478ae5e2011-12-06 17:22:19 -080049
50 /*
Dan Stozaa5f61dd2017-03-30 16:09:13 -070051 * requestNextVsync() schedules the next vsync event. It has no effect if the vsync rate is > 0.
Mathias Agopian478ae5e2011-12-06 17:22:19 -080052 */
Dan Stozaa5f61dd2017-03-30 16:09:13 -070053 virtual void requestNextVsync() = 0; // Asynchronous
Mathias Agopiand0566bc2011-11-17 17:49:17 -080054};
55
Dan Stozaa5f61dd2017-03-30 16:09:13 -070056class BnDisplayEventConnection : public BnInterface<IDisplayEventConnection> {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080057public:
Dan Stozaa5f61dd2017-03-30 16:09:13 -070058 virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
59 uint32_t flags = 0);
Mathias Agopiand0566bc2011-11-17 17:49:17 -080060};
61
Dan Stozaa5f61dd2017-03-30 16:09:13 -070062} // namespace android