| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 1 | /* | 
|  | 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 Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 17 | #pragma once | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 18 |  | 
|  | 19 | #include <binder/IInterface.h> | 
| Dan Stoza | 2d191c3 | 2017-04-03 13:27:12 -0700 | [diff] [blame] | 20 | #include <binder/SafeInterface.h> | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 21 |  | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 22 | #include <utils/Errors.h> | 
|  | 23 |  | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 24 | #include <cstdint> | 
|  | 25 |  | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 26 | namespace android { | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 27 |  | 
| Dan Stoza | 27c8115 | 2017-03-31 16:30:42 -0700 | [diff] [blame] | 28 | namespace gui { | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 29 | class BitTube; | 
| Dan Stoza | 27c8115 | 2017-03-31 16:30:42 -0700 | [diff] [blame] | 30 | } // namespace gui | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 31 |  | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 32 | class IDisplayEventConnection : public IInterface { | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 33 | public: | 
| Colin Cross | 17576de | 2016-09-26 13:07:06 -0700 | [diff] [blame] | 34 | DECLARE_META_INTERFACE(DisplayEventConnection) | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 35 |  | 
| Mathias Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 36 | /* | 
| Dan Stoza | 6b698e4 | 2017-04-03 13:09:08 -0700 | [diff] [blame] | 37 | * 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 Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 40 | */ | 
| Dan Stoza | 6b698e4 | 2017-04-03 13:09:08 -0700 | [diff] [blame] | 41 | virtual status_t stealReceiveChannel(gui::BitTube* outChannel) = 0; | 
| Mathias Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 42 |  | 
|  | 43 | /* | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 44 | * 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 Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 47 | */ | 
| Dan Stoza | e1c599b | 2017-03-30 16:37:19 -0700 | [diff] [blame] | 48 | virtual status_t setVsyncRate(uint32_t count) = 0; | 
| Mathias Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 49 |  | 
|  | 50 | /* | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 51 | * requestNextVsync() schedules the next vsync event. It has no effect if the vsync rate is > 0. | 
| Mathias Agopian | 478ae5e | 2011-12-06 17:22:19 -0800 | [diff] [blame] | 52 | */ | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 53 | virtual void requestNextVsync() = 0; // Asynchronous | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 54 | }; | 
|  | 55 |  | 
| Dan Stoza | 2d191c3 | 2017-04-03 13:27:12 -0700 | [diff] [blame] | 56 | class BnDisplayEventConnection : public SafeBnInterface<IDisplayEventConnection> { | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 57 | public: | 
| Dan Stoza | 2d191c3 | 2017-04-03 13:27:12 -0700 | [diff] [blame] | 58 | BnDisplayEventConnection() | 
|  | 59 | : SafeBnInterface<IDisplayEventConnection>("BnDisplayEventConnection") {} | 
|  | 60 |  | 
|  | 61 | status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, | 
|  | 62 | uint32_t flags = 0) override; | 
| Mathias Agopian | d0566bc | 2011-11-17 17:49:17 -0800 | [diff] [blame] | 63 | }; | 
|  | 64 |  | 
| Dan Stoza | a5f61dd | 2017-03-30 16:09:13 -0700 | [diff] [blame] | 65 | } // namespace android |