The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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> |
| 25 | #include <utils/IInterface.h> |
| 26 | |
| 27 | #include <ui/PixelFormat.h> |
| 28 | #include <ui/ISurfaceFlingerClient.h> |
| 29 | |
| 30 | namespace android { |
| 31 | |
| 32 | // ---------------------------------------------------------------------------- |
| 33 | |
| 34 | class DisplayInfo; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | |
| 36 | class ISurfaceComposer : public IInterface |
| 37 | { |
| 38 | public: |
| 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 Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 83 | |
| 84 | // flags for setOrientation |
| 85 | enum { |
| 86 | eOrientationAnimationDisable = 0x00000001 |
| 87 | }; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | |
| 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 Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 107 | virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 108 | |
| 109 | /* signal that we're done booting. |
| 110 | * recquires ACCESS_SURFACE_FLINGER permission |
| 111 | */ |
| 112 | virtual void bootFinished() = 0; |
| 113 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 114 | /* 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 Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 120 | // ---------------------------------------------------------------------------- |
| 121 | |
| 122 | class BnSurfaceComposer : public BnInterface<ISurfaceComposer> |
| 123 | { |
| 124 | public: |
| 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 Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 136 | 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 Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 145 | // ---------------------------------------------------------------------------- |
| 146 | |
| 147 | }; // namespace android |
| 148 | |
| 149 | #endif // ANDROID_ISURFACE_COMPOSER_H |