blob: 1788265b5840790380f8096ba2f7a8ea8f3e1941 [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,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080065 };
66
67 enum {
68 eLayerHidden = 0x01,
69 eLayerFrozen = 0x02,
70 eLayerDither = 0x04,
71 eLayerFilter = 0x08,
72 eLayerBlurFreeze = 0x10
73 };
74
75 enum {
76 eOrientationDefault = 0,
77 eOrientation90 = 1,
78 eOrientation180 = 2,
79 eOrientation270 = 3,
80 eOrientationSwapMask = 0x01
81 };
Mathias Agopianc08731e2009-03-27 18:11:38 -070082
83 // flags for setOrientation
84 enum {
85 eOrientationAnimationDisable = 0x00000001
86 };
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080087
88 /* create connection with surface flinger, requires
89 * ACCESS_SURFACE_FLINGER permission
90 */
91
92 virtual sp<ISurfaceFlingerClient> createConnection() = 0;
93
94 /* retrieve the control block */
Mathias Agopian7303c6b2009-07-02 18:11:53 -070095 virtual sp<IMemoryHeap> getCblk() const = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080096
97 /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
98 virtual void openGlobalTransaction() = 0;
99 virtual void closeGlobalTransaction() = 0;
100
101 /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
102 virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
103 virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
104
105 /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
Mathias Agopianc08731e2009-03-27 18:11:38 -0700106 virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800107
108 /* signal that we're done booting.
109 * recquires ACCESS_SURFACE_FLINGER permission
110 */
111 virtual void bootFinished() = 0;
112
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800113 /* Signal surfaceflinger that there might be some work to do
114 * This is an ASYNCHRONOUS call.
115 */
116 virtual void signal() const = 0;
117};
118
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800119// ----------------------------------------------------------------------------
120
121class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
122{
123public:
124 enum {
125 // Note: BOOT_FINISHED must remain this value, it is called from
126 // Java by ActivityManagerService.
127 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION,
128 CREATE_CONNECTION,
129 GET_CBLK,
130 OPEN_GLOBAL_TRANSACTION,
131 CLOSE_GLOBAL_TRANSACTION,
132 SET_ORIENTATION,
133 FREEZE_DISPLAY,
134 UNFREEZE_DISPLAY,
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800135 SIGNAL
136 };
137
138 virtual status_t onTransact( uint32_t code,
139 const Parcel& data,
140 Parcel* reply,
141 uint32_t flags = 0);
142};
143
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800144// ----------------------------------------------------------------------------
145
146}; // namespace android
147
148#endif // ANDROID_ISURFACE_COMPOSER_H