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_LAYER_BASE_H |
| 18 | #define ANDROID_LAYER_BASE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 23 | #include <EGL/egl.h> |
| 24 | #include <EGL/eglext.h> |
Mathias Agopian | eda6540 | 2010-02-22 03:15:57 -0800 | [diff] [blame] | 25 | #include <GLES/gl.h> |
Mathias Agopian | 1fed11c | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 26 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 27 | #include <utils/RefBase.h> |
| 28 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | #include <ui/Region.h> |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | |
Mathias Agopian | 7e27f05 | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 31 | #include <surfaceflinger/ISurfaceComposerClient.h> |
Mathias Agopian | 9cce325 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 32 | #include <private/surfaceflinger/LayerState.h> |
| 33 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | #include <pixelflinger/pixelflinger.h> |
| 35 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 36 | #include <hardware/hwcomposer.h> |
| 37 | |
Mathias Agopian | 5ec99b5 | 2010-12-07 23:41:55 -0800 | [diff] [blame] | 38 | #include "DisplayHardware/DisplayHardware.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | #include "Transform.h" |
| 40 | |
| 41 | namespace android { |
| 42 | |
| 43 | // --------------------------------------------------------------------------- |
| 44 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | class Client; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 46 | class DisplayHardware; |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 47 | class GraphicBuffer; |
| 48 | class GraphicPlane; |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 49 | class LayerBaseClient; |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 50 | class SurfaceFlinger; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | |
| 52 | // --------------------------------------------------------------------------- |
| 53 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 54 | class LayerBase : public RefBase |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 55 | { |
Mathias Agopian | f6679fc | 2010-08-10 18:09:09 -0700 | [diff] [blame] | 56 | static int32_t sSequence; |
| 57 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | public: |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 59 | LayerBase(SurfaceFlinger* flinger, DisplayID display); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 61 | DisplayID dpy; |
| 62 | mutable bool contentDirty; |
| 63 | Region visibleRegionScreen; |
| 64 | Region transparentRegionScreen; |
| 65 | Region coveredRegionScreen; |
Mathias Agopian | f6679fc | 2010-08-10 18:09:09 -0700 | [diff] [blame] | 66 | int32_t sequence; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | |
| 68 | struct State { |
| 69 | uint32_t w; |
| 70 | uint32_t h; |
Mathias Agopian | 7e4a587 | 2009-09-29 22:39:22 -0700 | [diff] [blame] | 71 | uint32_t requested_w; |
| 72 | uint32_t requested_h; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | uint32_t z; |
| 74 | uint8_t alpha; |
| 75 | uint8_t flags; |
| 76 | uint8_t reserved[2]; |
| 77 | int32_t sequence; // changes when visible regions can change |
| 78 | uint32_t tint; |
| 79 | Transform transform; |
| 80 | Region transparentRegion; |
| 81 | }; |
| 82 | |
Mathias Agopian | d129659 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 83 | void setName(const String8& name); |
| 84 | String8 getName() const; |
| 85 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 86 | // modify current state |
Mathias Agopian | 41b6aab | 2011-08-30 18:51:54 -0700 | [diff] [blame] | 87 | bool setPosition(float x, float y); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | bool setLayer(uint32_t z); |
| 89 | bool setSize(uint32_t w, uint32_t h); |
| 90 | bool setAlpha(uint8_t alpha); |
| 91 | bool setMatrix(const layer_state_t::matrix22_t& matrix); |
| 92 | bool setTransparentRegionHint(const Region& opaque); |
| 93 | bool setFlags(uint8_t flags, uint8_t mask); |
| 94 | |
Mathias Agopian | ba6be54 | 2009-09-29 22:32:36 -0700 | [diff] [blame] | 95 | void commitTransaction(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 96 | bool requestTransaction(); |
| 97 | void forceVisibilityTransaction(); |
| 98 | |
| 99 | uint32_t getTransactionFlags(uint32_t flags); |
| 100 | uint32_t setTransactionFlags(uint32_t flags); |
| 101 | |
| 102 | Rect visibleBounds() const; |
| 103 | void drawRegion(const Region& reg) const; |
| 104 | |
| 105 | void invalidate(); |
Mathias Agopian | d129659 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 106 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 107 | virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; } |
| 108 | |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 109 | virtual const char* getTypeId() const { return "LayerBase"; } |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 110 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 111 | virtual void setGeometry(hwc_layer_t* hwcl); |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 112 | virtual void setPerFrameData(hwc_layer_t* hwcl); |
Mathias Agopian | f384cc3 | 2011-09-08 18:31:55 -0700 | [diff] [blame^] | 113 | void setOverlay(bool inOverlay); |
| 114 | bool isOverlay() const; |
| 115 | |
Mathias Agopian | a350ff9 | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 116 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 117 | /** |
| 118 | * draw - performs some global clipping optimizations |
| 119 | * and calls onDraw(). |
| 120 | * Typically this method is not overridden, instead implement onDraw() |
| 121 | * to perform the actual drawing. |
| 122 | */ |
| 123 | virtual void draw(const Region& clip) const; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 124 | virtual void drawForSreenShot(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * onDraw - draws the surface. |
| 128 | */ |
| 129 | virtual void onDraw(const Region& clip) const = 0; |
| 130 | |
| 131 | /** |
| 132 | * initStates - called just after construction |
| 133 | */ |
| 134 | virtual void initStates(uint32_t w, uint32_t h, uint32_t flags); |
| 135 | |
| 136 | /** |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | * doTransaction - process the transaction. This is a good place to figure |
| 138 | * out which attributes of the surface have changed. |
| 139 | */ |
| 140 | virtual uint32_t doTransaction(uint32_t transactionFlags); |
| 141 | |
| 142 | /** |
| 143 | * setVisibleRegion - called to set the new visible region. This gives |
| 144 | * a chance to update the new visible region or record the fact it changed. |
| 145 | */ |
| 146 | virtual void setVisibleRegion(const Region& visibleRegion); |
| 147 | |
| 148 | /** |
| 149 | * setCoveredRegion - called when the covered region changes. The covered |
Mathias Agopian | ab02873 | 2010-03-16 16:41:46 -0700 | [diff] [blame] | 150 | * region corresponds to any area of the surface that is covered |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 151 | * (transparently or not) by another surface. |
| 152 | */ |
| 153 | virtual void setCoveredRegion(const Region& coveredRegion); |
Mathias Agopian | ab02873 | 2010-03-16 16:41:46 -0700 | [diff] [blame] | 154 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | /** |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 156 | * validateVisibility - cache a bunch of things |
| 157 | */ |
| 158 | virtual void validateVisibility(const Transform& globalTransform); |
| 159 | |
| 160 | /** |
| 161 | * lockPageFlip - called each time the screen is redrawn and returns whether |
| 162 | * the visible regions need to be recomputed (this is a fairly heavy |
| 163 | * operation, so this should be set only if needed). Typically this is used |
| 164 | * to figure out if the content or size of a surface has changed. |
| 165 | */ |
| 166 | virtual void lockPageFlip(bool& recomputeVisibleRegions); |
| 167 | |
| 168 | /** |
| 169 | * unlockPageFlip - called each time the screen is redrawn. updates the |
| 170 | * final dirty region wrt the planeTransform. |
| 171 | * At this point, all visible regions, surface position and size, etc... are |
| 172 | * correct. |
| 173 | */ |
| 174 | virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion); |
| 175 | |
| 176 | /** |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 177 | * isOpaque - true if this surface is opaque |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 178 | */ |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 179 | virtual bool isOpaque() const { return true; } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 180 | |
| 181 | /** |
Mathias Agopian | 401c257 | 2009-09-23 19:16:27 -0700 | [diff] [blame] | 182 | * needsDithering - true if this surface needs dithering |
| 183 | */ |
| 184 | virtual bool needsDithering() const { return false; } |
| 185 | |
| 186 | /** |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 187 | * needsLinearFiltering - true if this surface's state requires filtering |
Mathias Agopian | a7f6692 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 188 | */ |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 189 | virtual bool needsFiltering() const { return mNeedsFiltering; } |
Mathias Agopian | a7f6692 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 190 | |
| 191 | /** |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | * isSecure - true if this surface is secure, that is if it prevents |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 193 | * screenshots or VNC servers. |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | */ |
| 195 | virtual bool isSecure() const { return false; } |
| 196 | |
Glenn Kasten | 16f0453 | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 197 | /** |
Jamie Gennis | 7a4d0df | 2011-03-09 17:05:02 -0800 | [diff] [blame] | 198 | * isProtected - true if the layer may contain protected content in the |
| 199 | * GRALLOC_USAGE_PROTECTED sense. |
Glenn Kasten | 16f0453 | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 200 | */ |
Jamie Gennis | 7a4d0df | 2011-03-09 17:05:02 -0800 | [diff] [blame] | 201 | virtual bool isProtected() const { return false; } |
Glenn Kasten | 16f0453 | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 202 | |
Mathias Agopian | 0b3ad46 | 2009-10-02 18:12:30 -0700 | [diff] [blame] | 203 | /** called with the state lock when the surface is removed from the |
| 204 | * current list */ |
| 205 | virtual void onRemoved() { }; |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 206 | |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 207 | /** always call base class first */ |
| 208 | virtual void dump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 48b888a | 2011-01-19 16:15:53 -0800 | [diff] [blame] | 209 | virtual void shortDump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 210 | |
| 211 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 212 | enum { // flags for doTransaction() |
| 213 | eVisibleRegion = 0x00000002, |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 214 | }; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 215 | |
| 216 | |
| 217 | inline const State& drawingState() const { return mDrawingState; } |
| 218 | inline const State& currentState() const { return mCurrentState; } |
| 219 | inline State& currentState() { return mCurrentState; } |
| 220 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | int32_t getOrientation() const { return mOrientation; } |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 222 | |
| 223 | protected: |
| 224 | const GraphicPlane& graphicPlane(int dpy) const; |
| 225 | GraphicPlane& graphicPlane(int dpy); |
| 226 | |
Mathias Agopian | 010fccb | 2010-05-26 22:26:12 -0700 | [diff] [blame] | 227 | void clearWithOpenGL(const Region& clip, GLclampf r, GLclampf g, |
| 228 | GLclampf b, GLclampf alpha) const; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 229 | void clearWithOpenGL(const Region& clip) const; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 230 | void drawWithOpenGL(const Region& clip) const; |
| 231 | |
| 232 | void setFiltering(bool filtering); |
| 233 | bool getFiltering() const; |
Mathias Agopian | b661d66 | 2010-08-19 17:01:19 -0700 | [diff] [blame] | 234 | |
Mathias Agopian | 9a11206 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 235 | sp<SurfaceFlinger> mFlinger; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 236 | uint32_t mFlags; |
| 237 | |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 238 | private: |
| 239 | // accessed only in the main thread |
| 240 | // Whether filtering is forced on or not |
| 241 | bool mFiltering; |
Mathias Agopian | b661d66 | 2010-08-19 17:01:19 -0700 | [diff] [blame] | 242 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 243 | // cached during validateVisibility() |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 244 | // Whether filtering is needed b/c of the drawingstate |
Mathias Agopian | a7f6692 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 245 | bool mNeedsFiltering; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 246 | |
Mathias Agopian | f384cc3 | 2011-09-08 18:31:55 -0700 | [diff] [blame^] | 247 | // this layer is currently handled by the hwc. this is |
| 248 | // updated at composition time, always frmo the composition |
| 249 | // thread. |
| 250 | bool mInOverlay; |
| 251 | |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 252 | protected: |
| 253 | // cached during validateVisibility() |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 254 | int32_t mOrientation; |
Mathias Agopian | d992db3 | 2011-08-18 18:31:00 -0700 | [diff] [blame] | 255 | Transform mTransform; |
Mathias Agopian | 78fd501 | 2010-04-20 14:51:04 -0700 | [diff] [blame] | 256 | GLfloat mVertices[4][2]; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 257 | Rect mTransformedBounds; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 258 | |
| 259 | // these are protected by an external lock |
| 260 | State mCurrentState; |
| 261 | State mDrawingState; |
| 262 | volatile int32_t mTransactionFlags; |
| 263 | |
| 264 | // don't change, don't need a lock |
| 265 | bool mPremultipliedAlpha; |
Mathias Agopian | d129659 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 266 | String8 mName; |
| 267 | mutable bool mDebug; |
| 268 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 269 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 270 | // atomic |
| 271 | volatile int32_t mInvalidate; |
| 272 | |
| 273 | |
Mathias Agopian | ca4d360 | 2011-05-19 15:38:14 -0700 | [diff] [blame] | 274 | public: |
| 275 | // called from class SurfaceFlinger |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 276 | virtual ~LayerBase(); |
| 277 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 278 | private: |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 279 | LayerBase(const LayerBase& rhs); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | |
| 283 | // --------------------------------------------------------------------------- |
| 284 | |
| 285 | class LayerBaseClient : public LayerBase |
| 286 | { |
| 287 | public: |
Mathias Agopian | 96f0819 | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 288 | LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, |
| 289 | const sp<Client>& client); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 290 | |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 291 | virtual ~LayerBaseClient(); |
| 292 | |
| 293 | sp<ISurface> getSurface(); |
Mathias Agopian | 0d15612 | 2011-01-25 20:17:45 -0800 | [diff] [blame] | 294 | wp<IBinder> getSurfaceBinder() const; |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 295 | virtual wp<IBinder> getSurfaceTextureBinder() const; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 296 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 297 | virtual sp<LayerBaseClient> getLayerBaseClient() const { |
| 298 | return const_cast<LayerBaseClient*>(this); } |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 299 | |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 300 | virtual const char* getTypeId() const { return "LayerBaseClient"; } |
Mathias Agopian | 285dbde | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 301 | |
Mathias Agopian | 96f0819 | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 302 | uint32_t getIdentity() const { return mIdentity; } |
| 303 | |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 304 | protected: |
| 305 | virtual void dump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 48b888a | 2011-01-19 16:15:53 -0800 | [diff] [blame] | 306 | virtual void shortDump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 307 | |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 308 | class LayerCleaner { |
| 309 | sp<SurfaceFlinger> mFlinger; |
| 310 | wp<LayerBaseClient> mLayer; |
| 311 | protected: |
| 312 | ~LayerCleaner(); |
| 313 | public: |
| 314 | LayerCleaner(const sp<SurfaceFlinger>& flinger, |
| 315 | const sp<LayerBaseClient>& layer); |
| 316 | }; |
| 317 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 318 | private: |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 319 | virtual sp<ISurface> createSurface(); |
| 320 | |
Mathias Agopian | 96f0819 | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 321 | mutable Mutex mLock; |
Mathias Agopian | a1f47b9 | 2011-02-15 19:01:06 -0800 | [diff] [blame] | 322 | mutable bool mHasSurface; |
Mathias Agopian | 0d15612 | 2011-01-25 20:17:45 -0800 | [diff] [blame] | 323 | wp<IBinder> mClientSurfaceBinder; |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 324 | const wp<Client> mClientRef; |
Mathias Agopian | 2e12324 | 2009-06-23 20:06:46 -0700 | [diff] [blame] | 325 | // only read |
Mathias Agopian | 96f0819 | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 326 | const uint32_t mIdentity; |
| 327 | static int32_t sIdentity; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 328 | }; |
| 329 | |
| 330 | // --------------------------------------------------------------------------- |
| 331 | |
| 332 | }; // namespace android |
| 333 | |
| 334 | #endif // ANDROID_LAYER_BASE_H |