blob: 25d954c3d3e52f02f6f64e3776657f36fb6f5ad7 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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#ifndef ANDROID_ISURFACE_COMPOSER_H
18#define ANDROID_ISURFACE_COMPOSER_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/RefBase.h>
24#include <utils/Errors.h>
Mathias Agopianc5b2c0b2009-05-19 19:08:10 -070025#include <binder/IInterface.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080026
27#include <ui/PixelFormat.h>
28#include <ui/ISurfaceFlingerClient.h>
29
30namespace android {
31
32// ----------------------------------------------------------------------------
33
34class DisplayInfo;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080035
36class ISurfaceComposer : public IInterface
37{
38public:
39 DECLARE_META_INTERFACE(SurfaceComposer);
40
41 enum { // (keep in sync with Surface.java)
42 eHidden = 0x00000004,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080043 eDestroyBackbuffer = 0x00000020,
44 eSecure = 0x00000080,
45 eNonPremultiplied = 0x00000100,
46 ePushBuffers = 0x00000200,
47
48 eFXSurfaceNormal = 0x00000000,
49 eFXSurfaceBlur = 0x00010000,
50 eFXSurfaceDim = 0x00020000,
51 eFXSurfaceMask = 0x000F0000,
52 };
53
54 enum {
55 ePositionChanged = 0x00000001,
56 eLayerChanged = 0x00000002,
57 eSizeChanged = 0x00000004,
58 eAlphaChanged = 0x00000008,
59 eMatrixChanged = 0x00000010,
60 eTransparentRegionChanged = 0x00000020,
61 eVisibilityChanged = 0x00000040,
62 eFreezeTintChanged = 0x00000080,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080063 };
64
65 enum {
66 eLayerHidden = 0x01,
67 eLayerFrozen = 0x02,
68 eLayerDither = 0x04,
69 eLayerFilter = 0x08,
70 eLayerBlurFreeze = 0x10
71 };
72
73 enum {
74 eOrientationDefault = 0,
75 eOrientation90 = 1,
76 eOrientation180 = 2,
77 eOrientation270 = 3,
78 eOrientationSwapMask = 0x01
79 };
Mathias Agopianc08731e2009-03-27 18:11:38 -070080
81 // flags for setOrientation
82 enum {
83 eOrientationAnimationDisable = 0x00000001
84 };
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080085
86 /* create connection with surface flinger, requires
87 * ACCESS_SURFACE_FLINGER permission
88 */
89
90 virtual sp<ISurfaceFlingerClient> createConnection() = 0;
91
92 /* retrieve the control block */
Mathias Agopian7303c6b2009-07-02 18:11:53 -070093 virtual sp<IMemoryHeap> getCblk() const = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080094
95 /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
96 virtual void openGlobalTransaction() = 0;
97 virtual void closeGlobalTransaction() = 0;
98
99 /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
100 virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
101 virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
102
103 /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
Mathias Agopianc08731e2009-03-27 18:11:38 -0700104 virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800105
106 /* signal that we're done booting.
107 * recquires ACCESS_SURFACE_FLINGER permission
108 */
109 virtual void bootFinished() = 0;
110
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800111 /* Signal surfaceflinger that there might be some work to do
112 * This is an ASYNCHRONOUS call.
113 */
114 virtual void signal() const = 0;
115};
116
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800117// ----------------------------------------------------------------------------
118
119class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
120{
121public:
122 enum {
123 // Note: BOOT_FINISHED must remain this value, it is called from
124 // Java by ActivityManagerService.
125 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
126 CREATE_CONNECTION,
127 GET_CBLK,
128 OPEN_GLOBAL_TRANSACTION,
129 CLOSE_GLOBAL_TRANSACTION,
130 SET_ORIENTATION,
131 FREEZE_DISPLAY,
132 UNFREEZE_DISPLAY,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800133 SIGNAL
134 };
135
136 virtual status_t onTransact( uint32_t code,
137 const Parcel& data,
138 Parcel* reply,
139 uint32_t flags = 0);
140};
141
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800142// ----------------------------------------------------------------------------
143
144}; // namespace android
145
146#endif // ANDROID_ISURFACE_COMPOSER_H