The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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_SURFACE_FLINGER_H |
| 18 | #define ANDROID_SURFACE_FLINGER_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/SortedVector.h> |
| 24 | #include <utils/KeyedVector.h> |
| 25 | #include <utils/threads.h> |
| 26 | #include <utils/Atomic.h> |
| 27 | #include <utils/Errors.h> |
| 28 | #include <utils/MemoryDealer.h> |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 29 | #include <utils/RefBase.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | |
| 31 | #include <ui/PixelFormat.h> |
| 32 | #include <ui/ISurfaceComposer.h> |
| 33 | #include <ui/ISurfaceFlingerClient.h> |
| 34 | |
| 35 | #include <private/ui/SharedState.h> |
| 36 | #include <private/ui/LayerState.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | |
| 38 | #include "Barrier.h" |
| 39 | #include "BootAnimation.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | #include "Layer.h" |
| 41 | #include "Tokenizer.h" |
| 42 | |
Mathias Agopian | f1d8e87 | 2009-04-20 19:39:12 -0700 | [diff] [blame] | 43 | #include "MessageQueue.h" |
| 44 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | struct copybit_device_t; |
| 46 | struct overlay_device_t; |
| 47 | |
| 48 | namespace android { |
| 49 | |
| 50 | // --------------------------------------------------------------------------- |
| 51 | |
| 52 | class Client; |
| 53 | class BClient; |
| 54 | class DisplayHardware; |
| 55 | class FreezeLock; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | class Layer; |
| 57 | class LayerBuffer; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | |
| 59 | typedef int32_t ClientID; |
| 60 | |
| 61 | #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) |
| 62 | #define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) |
| 63 | |
| 64 | // --------------------------------------------------------------------------- |
| 65 | |
| 66 | class Client |
| 67 | { |
| 68 | public: |
| 69 | Client(ClientID cid, const sp<SurfaceFlinger>& flinger); |
| 70 | ~Client(); |
| 71 | |
| 72 | int32_t generateId(int pid); |
| 73 | void free(int32_t id); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 74 | status_t bindLayer(const sp<LayerBaseClient>& layer, int32_t id); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | |
| 76 | inline bool isValid(int32_t i) const; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 77 | sp<LayerBaseClient> getLayerUser(int32_t i) const; |
| 78 | const Vector< wp<LayerBaseClient> >& getLayers() const { return mLayers; } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 79 | const sp<IMemory>& controlBlockMemory() const { return mCblkMemory; } |
| 80 | void dump(const char* what); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | |
| 82 | // pointer to this client's control block |
| 83 | per_client_cblk_t* ctrlblk; |
| 84 | ClientID cid; |
| 85 | |
| 86 | |
| 87 | private: |
| 88 | int getClientPid() const { return mPid; } |
| 89 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 90 | int mPid; |
| 91 | uint32_t mBitmap; |
| 92 | SortedVector<uint8_t> mInUse; |
| 93 | Vector< wp<LayerBaseClient> > mLayers; |
| 94 | sp<MemoryDealer> mCblkHeap; |
| 95 | sp<SurfaceFlinger> mFlinger; |
| 96 | sp<IMemory> mCblkMemory; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | // --------------------------------------------------------------------------- |
| 100 | |
| 101 | class GraphicPlane |
| 102 | { |
| 103 | public: |
| 104 | static status_t orientationToTransfrom(int orientation, int w, int h, |
| 105 | Transform* tr); |
| 106 | |
| 107 | GraphicPlane(); |
| 108 | ~GraphicPlane(); |
| 109 | |
| 110 | bool initialized() const; |
| 111 | |
| 112 | void setDisplayHardware(DisplayHardware *); |
| 113 | void setTransform(const Transform& tr); |
| 114 | status_t setOrientation(int orientation); |
Mathias Agopian | 0d1318b | 2009-03-27 17:58:20 -0700 | [diff] [blame] | 115 | int getOrientation() const { return mOrientation; } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 116 | |
| 117 | const DisplayHardware& displayHardware() const; |
| 118 | const Transform& transform() const; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 119 | EGLDisplay getEGLDisplay() const; |
| 120 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | private: |
| 122 | GraphicPlane(const GraphicPlane&); |
| 123 | GraphicPlane operator = (const GraphicPlane&); |
| 124 | |
| 125 | DisplayHardware* mHw; |
| 126 | Transform mTransform; |
| 127 | Transform mOrientationTransform; |
| 128 | Transform mGlobalTransform; |
Mathias Agopian | 0d1318b | 2009-03-27 17:58:20 -0700 | [diff] [blame] | 129 | int mOrientation; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | // --------------------------------------------------------------------------- |
| 133 | |
| 134 | enum { |
| 135 | eTransactionNeeded = 0x01, |
| 136 | eTraversalNeeded = 0x02 |
| 137 | }; |
| 138 | |
| 139 | class SurfaceFlinger : public BnSurfaceComposer, protected Thread |
| 140 | { |
| 141 | public: |
| 142 | static void instantiate(); |
| 143 | static void shutdown(); |
| 144 | |
| 145 | SurfaceFlinger(); |
| 146 | virtual ~SurfaceFlinger(); |
| 147 | void init(); |
| 148 | |
| 149 | virtual status_t onTransact( |
| 150 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); |
| 151 | |
| 152 | virtual status_t dump(int fd, const Vector<String16>& args); |
| 153 | |
| 154 | // ISurfaceComposer interface |
| 155 | virtual sp<ISurfaceFlingerClient> createConnection(); |
| 156 | virtual sp<IMemory> getCblk() const; |
| 157 | virtual void bootFinished(); |
| 158 | virtual void openGlobalTransaction(); |
| 159 | virtual void closeGlobalTransaction(); |
| 160 | virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags); |
| 161 | virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags); |
Mathias Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 162 | virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | virtual void signal() const; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | |
| 165 | void screenReleased(DisplayID dpy); |
| 166 | void screenAcquired(DisplayID dpy); |
| 167 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 168 | overlay_control_device_t* getOverlayEngine() const; |
| 169 | |
| 170 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 171 | status_t removeLayer(const sp<LayerBase>& layer); |
| 172 | status_t addLayer(const sp<LayerBase>& layer); |
| 173 | status_t invalidateLayerVisibility(const sp<LayerBase>& layer); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 174 | |
| 175 | private: |
| 176 | friend class BClient; |
| 177 | friend class LayerBase; |
| 178 | friend class LayerBuffer; |
| 179 | friend class LayerBaseClient; |
| 180 | friend class Layer; |
| 181 | friend class LayerBlur; |
| 182 | |
| 183 | sp<ISurface> createSurface(ClientID client, int pid, |
| 184 | ISurfaceFlingerClient::surface_data_t* params, |
| 185 | DisplayID display, uint32_t w, uint32_t h, PixelFormat format, |
| 186 | uint32_t flags); |
| 187 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 188 | sp<LayerBaseClient> createNormalSurfaceLocked( |
| 189 | Client* client, DisplayID display, |
| 190 | int32_t id, uint32_t w, uint32_t h, |
| 191 | PixelFormat format, uint32_t flags); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 193 | sp<LayerBaseClient> createBlurSurfaceLocked( |
| 194 | Client* client, DisplayID display, |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 195 | int32_t id, uint32_t w, uint32_t h, uint32_t flags); |
| 196 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 197 | sp<LayerBaseClient> createDimSurfaceLocked( |
| 198 | Client* client, DisplayID display, |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 199 | int32_t id, uint32_t w, uint32_t h, uint32_t flags); |
| 200 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 201 | sp<LayerBaseClient> createPushBuffersSurfaceLocked( |
| 202 | Client* client, DisplayID display, |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 203 | int32_t id, uint32_t w, uint32_t h, uint32_t flags); |
| 204 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 205 | status_t removeSurface(SurfaceID surface_id); |
| 206 | status_t destroySurface(const sp<LayerBaseClient>& layer); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 207 | status_t setClientState(ClientID cid, int32_t count, const layer_state_t* states); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | |
| 209 | |
| 210 | class LayerVector { |
| 211 | public: |
| 212 | inline LayerVector() { } |
| 213 | LayerVector(const LayerVector&); |
| 214 | inline size_t size() const { return layers.size(); } |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 215 | inline sp<LayerBase> const* array() const { return layers.array(); } |
| 216 | ssize_t add(const sp<LayerBase>&, Vector< sp<LayerBase> >::compar_t); |
| 217 | ssize_t remove(const sp<LayerBase>&); |
| 218 | ssize_t reorder(const sp<LayerBase>&, Vector< sp<LayerBase> >::compar_t); |
| 219 | ssize_t indexOf(const sp<LayerBase>& key, size_t guess=0) const; |
| 220 | inline sp<LayerBase> operator [] (size_t i) const { return layers[i]; } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | private: |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 222 | KeyedVector< sp<LayerBase> , size_t> lookup; |
| 223 | Vector< sp<LayerBase> > layers; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | struct State { |
| 227 | State() { |
| 228 | orientation = ISurfaceComposer::eOrientationDefault; |
| 229 | freezeDisplay = 0; |
| 230 | } |
| 231 | LayerVector layersSortedByZ; |
| 232 | uint8_t orientation; |
Mathias Agopian | c08731e | 2009-03-27 18:11:38 -0700 | [diff] [blame] | 233 | uint8_t orientationType; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 234 | uint8_t freezeDisplay; |
| 235 | }; |
| 236 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 237 | virtual bool threadLoop(); |
| 238 | virtual status_t readyToRun(); |
| 239 | virtual void onFirstRef(); |
| 240 | |
| 241 | const GraphicPlane& graphicPlane(int dpy) const; |
| 242 | GraphicPlane& graphicPlane(int dpy); |
| 243 | |
| 244 | void waitForEvent(); |
| 245 | void signalEvent(); |
| 246 | void signalDelayedEvent(nsecs_t delay); |
| 247 | |
| 248 | void handleConsoleEvents(); |
| 249 | void handleTransaction(uint32_t transactionFlags); |
| 250 | |
| 251 | void computeVisibleRegions( |
| 252 | LayerVector& currentLayers, |
| 253 | Region& dirtyRegion, |
| 254 | Region& wormholeRegion); |
| 255 | |
| 256 | void handlePageFlip(); |
| 257 | bool lockPageFlip(const LayerVector& currentLayers); |
| 258 | void unlockPageFlip(const LayerVector& currentLayers); |
| 259 | void handleRepaint(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 260 | void scheduleBroadcast(Client* client); |
| 261 | void executeScheduledBroadcasts(); |
| 262 | void postFramebuffer(); |
| 263 | void composeSurfaces(const Region& dirty); |
| 264 | void unlockClients(); |
| 265 | |
| 266 | |
| 267 | void destroyConnection(ClientID cid); |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 268 | sp<LayerBaseClient> getLayerUser_l(SurfaceID index) const; |
| 269 | status_t addLayer_l(const sp<LayerBase>& layer); |
| 270 | status_t removeLayer_l(const sp<LayerBase>& layer); |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 271 | status_t purgatorizeLayer_l(const sp<LayerBase>& layer); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 272 | void free_resources_l(); |
| 273 | |
| 274 | uint32_t getTransactionFlags(uint32_t flags); |
| 275 | uint32_t setTransactionFlags(uint32_t flags, nsecs_t delay = 0); |
| 276 | void commitTransaction(); |
| 277 | |
| 278 | |
| 279 | friend class FreezeLock; |
| 280 | sp<FreezeLock> getFreezeLock() const; |
| 281 | inline void incFreezeCount() { mFreezeCount++; } |
| 282 | inline void decFreezeCount() { if (mFreezeCount > 0) mFreezeCount--; } |
| 283 | inline bool hasFreezeRequest() const { return mFreezeDisplay; } |
| 284 | inline bool isFrozen() const { |
| 285 | return mFreezeDisplay || mFreezeCount>0; |
| 286 | } |
| 287 | |
| 288 | |
| 289 | void debugFlashRegions(); |
| 290 | void debugShowFPS() const; |
| 291 | void drawWormhole() const; |
| 292 | |
Mathias Agopian | f1d8e87 | 2009-04-20 19:39:12 -0700 | [diff] [blame] | 293 | |
| 294 | mutable MessageQueue mEventQueue; |
| 295 | |
| 296 | |
| 297 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 298 | // access must be protected by mStateLock |
| 299 | mutable Mutex mStateLock; |
| 300 | State mCurrentState; |
| 301 | State mDrawingState; |
| 302 | volatile int32_t mTransactionFlags; |
| 303 | volatile int32_t mTransactionCount; |
| 304 | Condition mTransactionCV; |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 305 | SortedVector< sp<LayerBase> > mLayerPurgatory; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 306 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 307 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | // protected by mStateLock (but we could use another lock) |
| 309 | Tokenizer mTokens; |
| 310 | DefaultKeyedVector<ClientID, Client*> mClientsMap; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 311 | DefaultKeyedVector<SurfaceID, sp<LayerBaseClient> > mLayerMap; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 312 | GraphicPlane mGraphicPlanes[1]; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 313 | bool mLayersRemoved; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 314 | Vector<Client*> mDisconnectedClients; |
| 315 | |
| 316 | // constant members (no synchronization needed for access) |
| 317 | sp<MemoryDealer> mServerHeap; |
| 318 | sp<IMemory> mServerCblkMemory; |
| 319 | surface_flinger_cblk_t* mServerCblk; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 320 | GLuint mWormholeTexName; |
| 321 | sp<BootAnimation> mBootAnimation; |
| 322 | nsecs_t mBootTime; |
| 323 | |
| 324 | // Can only accessed from the main thread, these members |
| 325 | // don't need synchronization |
| 326 | Region mDirtyRegion; |
| 327 | Region mInvalidRegion; |
| 328 | Region mWormholeRegion; |
| 329 | Client* mLastScheduledBroadcast; |
| 330 | SortedVector<Client*> mScheduledBroadcasts; |
| 331 | bool mVisibleRegionsDirty; |
| 332 | bool mDeferReleaseConsole; |
| 333 | bool mFreezeDisplay; |
| 334 | int32_t mFreezeCount; |
| 335 | nsecs_t mFreezeDisplayTime; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 336 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | // don't use a lock for these, we don't care |
| 338 | int mDebugRegion; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 339 | int mDebugBackground; |
| 340 | int mDebugNoBootAnimation; |
| 341 | |
| 342 | // these are thread safe |
| 343 | mutable Barrier mReadyToRunBarrier; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 344 | |
| 345 | // atomic variables |
| 346 | enum { |
| 347 | eConsoleReleased = 1, |
| 348 | eConsoleAcquired = 2 |
| 349 | }; |
| 350 | volatile int32_t mConsoleSignals; |
| 351 | |
| 352 | // only written in the main thread, only read in other threads |
| 353 | volatile int32_t mSecureFrameBuffer; |
| 354 | }; |
| 355 | |
| 356 | // --------------------------------------------------------------------------- |
| 357 | |
| 358 | class FreezeLock : public LightRefBase<FreezeLock> { |
| 359 | SurfaceFlinger* mFlinger; |
| 360 | public: |
| 361 | FreezeLock(SurfaceFlinger* flinger) |
| 362 | : mFlinger(flinger) { |
| 363 | mFlinger->incFreezeCount(); |
| 364 | } |
| 365 | ~FreezeLock() { |
| 366 | mFlinger->decFreezeCount(); |
| 367 | } |
| 368 | }; |
| 369 | |
| 370 | // --------------------------------------------------------------------------- |
| 371 | |
| 372 | class BClient : public BnSurfaceFlingerClient |
| 373 | { |
| 374 | public: |
| 375 | BClient(SurfaceFlinger *flinger, ClientID cid, |
| 376 | const sp<IMemory>& cblk); |
| 377 | ~BClient(); |
| 378 | |
| 379 | // ISurfaceFlingerClient interface |
| 380 | virtual void getControlBlocks(sp<IMemory>* ctrl) const; |
| 381 | |
| 382 | virtual sp<ISurface> createSurface( |
| 383 | surface_data_t* params, int pid, |
| 384 | DisplayID display, uint32_t w, uint32_t h,PixelFormat format, |
| 385 | uint32_t flags); |
| 386 | |
| 387 | virtual status_t destroySurface(SurfaceID surfaceId); |
| 388 | virtual status_t setState(int32_t count, const layer_state_t* states); |
| 389 | |
| 390 | private: |
| 391 | ClientID mId; |
| 392 | SurfaceFlinger* mFlinger; |
| 393 | sp<IMemory> mCblk; |
| 394 | }; |
| 395 | |
| 396 | // --------------------------------------------------------------------------- |
| 397 | }; // namespace android |
| 398 | |
| 399 | #endif // ANDROID_SURFACE_FLINGER_H |