1d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian/*
2d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Copyright (C) 2011 The Android Open Source Project
3d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
4d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * you may not use this file except in compliance with the License.
6d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * You may obtain a copy of the License at
7d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
8d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
10d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Unless required by applicable law or agreed to in writing, software
11d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * See the License for the specific language governing permissions and
14d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * limitations under the License.
15d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian */
16d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
17a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza#pragma once
18d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
19a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza#include <binder/IInterface.h>
202d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza#include <binder/SafeInterface.h>
21d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
22d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <utils/Errors.h>
23d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
24a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza#include <cstdint>
25d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
26d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopiannamespace android {
27d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
2827c8115510cebda13cbe24fd4caa946ea9c5003cDan Stozanamespace gui {
29d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianclass BitTube;
3027c8115510cebda13cbe24fd4caa946ea9c5003cDan Stoza} // namespace gui
31d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
32a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stozaclass IDisplayEventConnection : public IInterface {
33d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianpublic:
3417576de056a57753eb4af797545db88ef4f81ef0Colin Cross    DECLARE_META_INTERFACE(DisplayEventConnection)
35d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
36478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
376b698e4fe4ff50dcef818452283637f9870ae770Dan Stoza     * stealReceiveChannel() returns a BitTube to receive events from. Only the receive file
386b698e4fe4ff50dcef818452283637f9870ae770Dan Stoza     * descriptor of outChannel will be initialized, and this effectively "steals" the receive
396b698e4fe4ff50dcef818452283637f9870ae770Dan Stoza     * channel from the remote end (such that the remote end can only use its send channel).
40478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
416b698e4fe4ff50dcef818452283637f9870ae770Dan Stoza    virtual status_t stealReceiveChannel(gui::BitTube* outChannel) = 0;
42478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian
43478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
44a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza     * setVsyncRate() sets the vsync event delivery rate. A value of 1 returns every vsync event.
45a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza     * A value of 2 returns every other event, etc. A value of 0 returns no event unless
46a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza     * requestNextVsync() has been called.
47478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
48e1c599b52fcce94bd27ebbc4d74cd59c9e71b452Dan Stoza    virtual status_t setVsyncRate(uint32_t count) = 0;
49478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian
50478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
51a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza     * requestNextVsync() schedules the next vsync event. It has no effect if the vsync rate is > 0.
52478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
53a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza    virtual void requestNextVsync() = 0; // Asynchronous
54d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian};
55d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
562d191c302df1c7b2443d333a5a243c0043a37101Dan Stozaclass BnDisplayEventConnection : public SafeBnInterface<IDisplayEventConnection> {
57d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianpublic:
582d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza    BnDisplayEventConnection()
592d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza          : SafeBnInterface<IDisplayEventConnection>("BnDisplayEventConnection") {}
602d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza
612d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza    status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
622d191c302df1c7b2443d333a5a243c0043a37101Dan Stoza                        uint32_t flags = 0) override;
63d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian};
64d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
65a5f61dd70ac151c8adbde20d3bc4cd7d27808d21Dan Stoza} // namespace android
66