blob: ab6dd56e64e9dad16e02a32aa35a5828f94b385d [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,
43 eGPU = 0x00000008,
44 eHardware = 0x00000010,
45 eDestroyBackbuffer = 0x00000020,
46 eSecure = 0x00000080,
47 eNonPremultiplied = 0x00000100,
48 ePushBuffers = 0x00000200,
49
50 eFXSurfaceNormal = 0x00000000,
51 eFXSurfaceBlur = 0x00010000,
52 eFXSurfaceDim = 0x00020000,
53 eFXSurfaceMask = 0x000F0000,
54 };
55
56 enum {
57 ePositionChanged = 0x00000001,
58 eLayerChanged = 0x00000002,
59 eSizeChanged = 0x00000004,
60 eAlphaChanged = 0x00000008,
61 eMatrixChanged = 0x00000010,
62 eTransparentRegionChanged = 0x00000020,
63 eVisibilityChanged = 0x00000040,
64 eFreezeTintChanged = 0x00000080,
65 eDestroyed = 0x00000100
66 };
67
68 enum {
69 eLayerHidden = 0x01,
70 eLayerFrozen = 0x02,
71 eLayerDither = 0x04,
72 eLayerFilter = 0x08,
73 eLayerBlurFreeze = 0x10
74 };
75
76 enum {
77 eOrientationDefault = 0,
78 eOrientation90 = 1,
79 eOrientation180 = 2,
80 eOrientation270 = 3,
81 eOrientationSwapMask = 0x01
82 };
Mathias Agopianc08731e2009-03-27 18:11:38 -070083
84 // flags for setOrientation
85 enum {
86 eOrientationAnimationDisable = 0x00000001
87 };
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080088
89 /* create connection with surface flinger, requires
90 * ACCESS_SURFACE_FLINGER permission
91 */
92
93 virtual sp<ISurfaceFlingerClient> createConnection() = 0;
94
95 /* retrieve the control block */
96 virtual sp<IMemory> getCblk() const = 0;
97
98 /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
99 virtual void openGlobalTransaction() = 0;
100 virtual void closeGlobalTransaction() = 0;
101
102 /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
103 virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
104 virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
105
106 /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
Mathias Agopianc08731e2009-03-27 18:11:38 -0700107 virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800108
109 /* signal that we're done booting.
110 * recquires ACCESS_SURFACE_FLINGER permission
111 */
112 virtual void bootFinished() = 0;
113
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800114 /* Signal surfaceflinger that there might be some work to do
115 * This is an ASYNCHRONOUS call.
116 */
117 virtual void signal() const = 0;
118};
119
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800120// ----------------------------------------------------------------------------
121
122class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
123{
124public:
125 enum {
126 // Note: BOOT_FINISHED must remain this value, it is called from
127 // Java by ActivityManagerService.
128 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
129 CREATE_CONNECTION,
130 GET_CBLK,
131 OPEN_GLOBAL_TRANSACTION,
132 CLOSE_GLOBAL_TRANSACTION,
133 SET_ORIENTATION,
134 FREEZE_DISPLAY,
135 UNFREEZE_DISPLAY,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800136 SIGNAL
137 };
138
139 virtual status_t onTransact( uint32_t code,
140 const Parcel& data,
141 Parcel* reply,
142 uint32_t flags = 0);
143};
144
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800145// ----------------------------------------------------------------------------
146
147}; // namespace android
148
149#endif // ANDROID_ISURFACE_COMPOSER_H