The Android Open Source Project | 9066cfe | 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 | 999543b | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 23 | #include <EGL/egl.h> |
| 24 | #include <EGL/eglext.h> |
Mathias Agopian | 8c20ca3 | 2010-02-22 03:15:57 -0800 | [diff] [blame] | 25 | #include <GLES/gl.h> |
Mathias Agopian | 999543b | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 26 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 27 | #include <utils/RefBase.h> |
| 28 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | #include <ui/Region.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | |
Mathias Agopian | 770492c | 2010-05-28 14:22:23 -0700 | [diff] [blame] | 31 | #include <surfaceflinger/ISurfaceComposerClient.h> |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 32 | #include <private/surfaceflinger/SharedBufferStack.h> |
| 33 | #include <private/surfaceflinger/LayerState.h> |
| 34 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | #include <pixelflinger/pixelflinger.h> |
| 36 | |
Mathias Agopian | e0d5f5b | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 37 | #include <hardware/hwcomposer.h> |
| 38 | |
Mathias Agopian | 0b38aa0 | 2010-12-07 23:41:55 -0800 | [diff] [blame] | 39 | #include "DisplayHardware/DisplayHardware.h" |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | #include "Transform.h" |
| 41 | |
| 42 | namespace android { |
| 43 | |
| 44 | // --------------------------------------------------------------------------- |
| 45 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | class DisplayHardware; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 | class Client; |
Mathias Agopian | 6950e42 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 48 | class GraphicBuffer; |
| 49 | class GraphicPlane; |
Mathias Agopian | 7623da4 | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 50 | class LayerBaseClient; |
Mathias Agopian | 6950e42 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 51 | class SurfaceFlinger; |
Mathias Agopian | 9f2c4fd | 2010-05-10 20:06:11 -0700 | [diff] [blame] | 52 | class Texture; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 53 | |
| 54 | // --------------------------------------------------------------------------- |
| 55 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 56 | class LayerBase : public RefBase |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 57 | { |
Mathias Agopian | 1efba9a | 2010-08-10 18:09:09 -0700 | [diff] [blame] | 58 | static int32_t sSequence; |
| 59 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | public: |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 61 | LayerBase(SurfaceFlinger* flinger, DisplayID display); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | DisplayID dpy; |
| 64 | mutable bool contentDirty; |
| 65 | Region visibleRegionScreen; |
| 66 | Region transparentRegionScreen; |
| 67 | Region coveredRegionScreen; |
Mathias Agopian | 1efba9a | 2010-08-10 18:09:09 -0700 | [diff] [blame] | 68 | int32_t sequence; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | |
| 70 | struct State { |
| 71 | uint32_t w; |
| 72 | uint32_t h; |
Mathias Agopian | e1b6f24 | 2009-09-29 22:39:22 -0700 | [diff] [blame] | 73 | uint32_t requested_w; |
| 74 | uint32_t requested_h; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 75 | uint32_t z; |
| 76 | uint8_t alpha; |
| 77 | uint8_t flags; |
| 78 | uint8_t reserved[2]; |
| 79 | int32_t sequence; // changes when visible regions can change |
| 80 | uint32_t tint; |
| 81 | Transform transform; |
| 82 | Region transparentRegion; |
| 83 | }; |
| 84 | |
Mathias Agopian | 015b597 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 85 | void setName(const String8& name); |
| 86 | String8 getName() const; |
| 87 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | // modify current state |
| 89 | bool setPosition(int32_t x, int32_t y); |
| 90 | bool setLayer(uint32_t z); |
| 91 | bool setSize(uint32_t w, uint32_t h); |
| 92 | bool setAlpha(uint8_t alpha); |
| 93 | bool setMatrix(const layer_state_t::matrix22_t& matrix); |
| 94 | bool setTransparentRegionHint(const Region& opaque); |
| 95 | bool setFlags(uint8_t flags, uint8_t mask); |
| 96 | |
Mathias Agopian | 8851617 | 2009-09-29 22:32:36 -0700 | [diff] [blame] | 97 | void commitTransaction(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | bool requestTransaction(); |
| 99 | void forceVisibilityTransaction(); |
| 100 | |
| 101 | uint32_t getTransactionFlags(uint32_t flags); |
| 102 | uint32_t setTransactionFlags(uint32_t flags); |
| 103 | |
| 104 | Rect visibleBounds() const; |
| 105 | void drawRegion(const Region& reg) const; |
| 106 | |
| 107 | void invalidate(); |
Mathias Agopian | 015b597 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 108 | |
Mathias Agopian | 7623da4 | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 109 | virtual sp<LayerBaseClient> getLayerBaseClient() const { return 0; } |
| 110 | |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 111 | virtual const char* getTypeId() const { return "LayerBase"; } |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 112 | |
Mathias Agopian | e0d5f5b | 2010-08-10 17:14:02 -0700 | [diff] [blame] | 113 | virtual void setGeometry(hwc_layer_t* hwcl); |
| 114 | |
| 115 | virtual void setPerFrameData(hwc_layer_t* hwcl); |
| 116 | |
The Android Open Source Project | 9066cfe | 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 | 38ed2e3 | 2010-09-29 13:02:36 -0700 | [diff] [blame] | 124 | virtual void drawForSreenShot() const; |
The Android Open Source Project | 9066cfe | 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 | 9066cfe | 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 | 9c041bb | 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 | 9066cfe | 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 | 9c041bb | 2010-03-16 16:41:46 -0700 | [diff] [blame] | 154 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 155 | /** |
The Android Open Source Project | 9066cfe | 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 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 177 | * needsBlending - true if this surface needs blending |
| 178 | */ |
| 179 | virtual bool needsBlending() const { return false; } |
| 180 | |
| 181 | /** |
Mathias Agopian | cc93476 | 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 | 9237703 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 187 | * needsLinearFiltering - true if this surface needs filtering |
| 188 | */ |
Mathias Agopian | 1989af2 | 2010-12-02 21:32:29 -0800 | [diff] [blame] | 189 | virtual bool needsFiltering() const { |
| 190 | return (!(mFlags & DisplayHardware::SLOW_CONFIG)) && mNeedsFiltering; |
| 191 | } |
Mathias Agopian | 9237703 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 192 | |
| 193 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | * isSecure - true if this surface is secure, that is if it prevents |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 195 | * screenshots or VNC servers. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 196 | */ |
| 197 | virtual bool isSecure() const { return false; } |
| 198 | |
Glenn Kasten | d6f5bde | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 199 | /** |
Jamie Gennis | f72606c | 2011-03-09 17:05:02 -0800 | [diff] [blame] | 200 | * isProtected - true if the layer may contain protected content in the |
| 201 | * GRALLOC_USAGE_PROTECTED sense. |
Glenn Kasten | d6f5bde | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 202 | */ |
Jamie Gennis | f72606c | 2011-03-09 17:05:02 -0800 | [diff] [blame] | 203 | virtual bool isProtected() const { return false; } |
Glenn Kasten | d6f5bde | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 204 | |
Mathias Agopian | 0c4cec7 | 2009-10-02 18:12:30 -0700 | [diff] [blame] | 205 | /** called with the state lock when the surface is removed from the |
| 206 | * current list */ |
| 207 | virtual void onRemoved() { }; |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 208 | |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 209 | /** always call base class first */ |
| 210 | virtual void dump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 06a61e2 | 2011-01-19 16:15:53 -0800 | [diff] [blame] | 211 | virtual void shortDump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 212 | |
| 213 | |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 214 | enum { // flags for doTransaction() |
| 215 | eVisibleRegion = 0x00000002, |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 216 | }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 217 | |
| 218 | |
| 219 | inline const State& drawingState() const { return mDrawingState; } |
| 220 | inline const State& currentState() const { return mCurrentState; } |
| 221 | inline State& currentState() { return mCurrentState; } |
| 222 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 223 | int32_t getOrientation() const { return mOrientation; } |
| 224 | int tx() const { return mLeft; } |
| 225 | int ty() const { return mTop; } |
| 226 | |
| 227 | protected: |
| 228 | const GraphicPlane& graphicPlane(int dpy) const; |
| 229 | GraphicPlane& graphicPlane(int dpy); |
| 230 | |
Mathias Agopian | 0d3c006 | 2010-05-26 22:26:12 -0700 | [diff] [blame] | 231 | void clearWithOpenGL(const Region& clip, GLclampf r, GLclampf g, |
| 232 | GLclampf b, GLclampf alpha) const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 233 | void clearWithOpenGL(const Region& clip) const; |
Mathias Agopian | 999543b | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 234 | void drawWithOpenGL(const Region& clip, const Texture& texture) const; |
Mathias Agopian | 999543b | 2009-06-23 18:08:22 -0700 | [diff] [blame] | 235 | |
Mathias Agopian | e96aa3e | 2010-08-19 17:01:19 -0700 | [diff] [blame] | 236 | // these must be called from the post/drawing thread |
| 237 | void setBufferCrop(const Rect& crop); |
| 238 | void setBufferTransform(uint32_t transform); |
| 239 | |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 240 | sp<SurfaceFlinger> mFlinger; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 241 | uint32_t mFlags; |
| 242 | |
Mathias Agopian | e96aa3e | 2010-08-19 17:01:19 -0700 | [diff] [blame] | 243 | // post/drawing thread |
| 244 | Rect mBufferCrop; |
| 245 | uint32_t mBufferTransform; |
| 246 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 247 | // cached during validateVisibility() |
Mathias Agopian | 9237703 | 2010-05-26 22:08:52 -0700 | [diff] [blame] | 248 | bool mNeedsFiltering; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 249 | int32_t mOrientation; |
Mathias Agopian | e5c0a7b | 2010-04-20 14:51:04 -0700 | [diff] [blame] | 250 | GLfloat mVertices[4][2]; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 251 | Rect mTransformedBounds; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 252 | int mLeft; |
| 253 | int mTop; |
| 254 | |
| 255 | // these are protected by an external lock |
| 256 | State mCurrentState; |
| 257 | State mDrawingState; |
| 258 | volatile int32_t mTransactionFlags; |
| 259 | |
| 260 | // don't change, don't need a lock |
| 261 | bool mPremultipliedAlpha; |
Mathias Agopian | 015b597 | 2010-03-09 19:17:47 -0800 | [diff] [blame] | 262 | String8 mName; |
| 263 | mutable bool mDebug; |
| 264 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 265 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | // atomic |
| 267 | volatile int32_t mInvalidate; |
| 268 | |
| 269 | |
Mathias Agopian | 6960811 | 2011-05-19 15:38:14 -0700 | [diff] [blame] | 270 | public: |
| 271 | // called from class SurfaceFlinger |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 272 | virtual ~LayerBase(); |
| 273 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 274 | private: |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 275 | LayerBase(const LayerBase& rhs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 276 | }; |
| 277 | |
| 278 | |
| 279 | // --------------------------------------------------------------------------- |
| 280 | |
| 281 | class LayerBaseClient : public LayerBase |
| 282 | { |
| 283 | public: |
| 284 | class Surface; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 285 | |
Mathias Agopian | 593c05c | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 286 | LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, |
| 287 | const sp<Client>& client); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | virtual ~LayerBaseClient(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 289 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 290 | sp<Surface> getSurface(); |
Mathias Agopian | d35c666 | 2011-01-25 20:17:45 -0800 | [diff] [blame] | 291 | wp<IBinder> getSurfaceBinder() const; |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 292 | virtual sp<Surface> createSurface() const; |
Mathias Agopian | 7623da4 | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 293 | virtual sp<LayerBaseClient> getLayerBaseClient() const { |
| 294 | return const_cast<LayerBaseClient*>(this); } |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 295 | virtual const char* getTypeId() const { return "LayerBaseClient"; } |
Mathias Agopian | 5d26c1e | 2010-03-01 16:09:43 -0800 | [diff] [blame] | 296 | |
Mathias Agopian | 593c05c | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 297 | uint32_t getIdentity() const { return mIdentity; } |
| 298 | |
| 299 | class Surface : public BnSurface { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 300 | public: |
Mathias Agopian | 18b6b49 | 2009-08-19 17:46:26 -0700 | [diff] [blame] | 301 | int32_t getIdentity() const { return mIdentity; } |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 302 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 303 | protected: |
Mathias Agopian | 593c05c | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 304 | Surface(const sp<SurfaceFlinger>& flinger, int identity, |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 305 | const sp<LayerBaseClient>& owner); |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 306 | virtual ~Surface(); |
| 307 | virtual status_t onTransact(uint32_t code, const Parcel& data, |
| 308 | Parcel* reply, uint32_t flags); |
| 309 | sp<LayerBaseClient> getOwner() const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 310 | |
| 311 | private: |
Mathias Agopian | 2be352a | 2010-05-21 17:24:35 -0700 | [diff] [blame] | 312 | virtual sp<GraphicBuffer> requestBuffer(int bufferIdx, |
| 313 | uint32_t w, uint32_t h, uint32_t format, uint32_t usage); |
Mathias Agopian | 59751db | 2010-05-07 15:58:44 -0700 | [diff] [blame] | 314 | virtual status_t setBufferCount(int bufferCount); |
| 315 | |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 316 | protected: |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 317 | friend class LayerBaseClient; |
Mathias Agopian | 6cf0db2 | 2009-04-17 19:36:26 -0700 | [diff] [blame] | 318 | sp<SurfaceFlinger> mFlinger; |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 319 | int32_t mIdentity; |
| 320 | wp<LayerBaseClient> mOwner; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 321 | }; |
| 322 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 323 | friend class Surface; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 324 | |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 325 | protected: |
| 326 | virtual void dump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 06a61e2 | 2011-01-19 16:15:53 -0800 | [diff] [blame] | 327 | virtual void shortDump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 9bce873 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 328 | |
Mathias Agopian | 1473f46 | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 329 | private: |
Mathias Agopian | 593c05c | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 330 | mutable Mutex mLock; |
Mathias Agopian | 1b0114f | 2011-02-15 19:01:06 -0800 | [diff] [blame] | 331 | mutable bool mHasSurface; |
Mathias Agopian | d35c666 | 2011-01-25 20:17:45 -0800 | [diff] [blame] | 332 | wp<IBinder> mClientSurfaceBinder; |
Mathias Agopian | 7623da4 | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 333 | const wp<Client> mClientRef; |
Mathias Agopian | c660395 | 2009-06-23 20:06:46 -0700 | [diff] [blame] | 334 | // only read |
Mathias Agopian | 593c05c | 2010-06-02 23:28:45 -0700 | [diff] [blame] | 335 | const uint32_t mIdentity; |
| 336 | static int32_t sIdentity; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | // --------------------------------------------------------------------------- |
| 340 | |
| 341 | }; // namespace android |
| 342 | |
| 343 | #endif // ANDROID_LAYER_BASE_H |