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_H |
| 18 | #define ANDROID_LAYER_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 23 | #include <EGL/egl.h> |
| 24 | #include <EGL/eglext.h> |
| 25 | #include <GLES/gl.h> |
| 26 | #include <GLES/glext.h> |
| 27 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 28 | #include <utils/RefBase.h> |
| 29 | #include <utils/String8.h> |
| 30 | #include <utils/Timers.h> |
| 31 | |
| 32 | #include <ui/GraphicBuffer.h> |
| 33 | #include <ui/PixelFormat.h> |
| 34 | #include <ui/Region.h> |
| 35 | |
| 36 | #include <gui/ISurfaceComposerClient.h> |
| 37 | |
| 38 | #include <private/gui/LayerState.h> |
| 39 | |
Jamie Gennis | 82dbc74 | 2012-11-08 19:23:28 -0800 | [diff] [blame] | 40 | #include "FrameTracker.h" |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 41 | #include "Client.h" |
| 42 | #include "SurfaceFlinger.h" |
| 43 | #include "SurfaceFlingerConsumer.h" |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 44 | #include "SurfaceTextureLayer.h" |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | #include "Transform.h" |
| 46 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 47 | #include "DisplayHardware/HWComposer.h" |
| 48 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | namespace android { |
| 50 | |
| 51 | // --------------------------------------------------------------------------- |
| 52 | |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 53 | class Client; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 54 | class DisplayDevice; |
| 55 | class GraphicBuffer; |
| 56 | class SurfaceFlinger; |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 57 | class GLExtensions; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 58 | |
| 59 | // --------------------------------------------------------------------------- |
| 60 | |
Andy McFadden | 882e3a3 | 2013-01-08 16:06:15 -0800 | [diff] [blame] | 61 | /* |
Andy McFadden | 882e3a3 | 2013-01-08 16:06:15 -0800 | [diff] [blame] | 62 | * A new BufferQueue and a new SurfaceFlingerConsumer are created when the |
| 63 | * Layer is first referenced. |
| 64 | * |
| 65 | * This also implements onFrameAvailable(), which notifies SurfaceFlinger |
| 66 | * that new data has arrived. |
| 67 | */ |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 68 | class Layer : public SurfaceFlingerConsumer::FrameAvailableListener { |
| 69 | static int32_t sSequence; |
| 70 | |
Mathias Agopian | d606de6 | 2010-05-10 20:06:11 -0700 | [diff] [blame] | 71 | public: |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 72 | mutable bool contentDirty; |
| 73 | // regions below are in window-manager space |
| 74 | Region visibleRegion; |
| 75 | Region coveredRegion; |
| 76 | Region visibleNonTransparentRegion; |
| 77 | int32_t sequence; |
| 78 | |
| 79 | enum { // flags for doTransaction() |
| 80 | eDontUpdateGeometryState = 0x00000001, |
| 81 | eVisibleRegion = 0x00000002, |
| 82 | }; |
| 83 | |
| 84 | struct Geometry { |
| 85 | uint32_t w; |
| 86 | uint32_t h; |
| 87 | Rect crop; |
| 88 | inline bool operator ==(const Geometry& rhs) const { |
| 89 | return (w == rhs.w && h == rhs.h && crop == rhs.crop); |
| 90 | } |
| 91 | inline bool operator !=(const Geometry& rhs) const { |
| 92 | return !operator ==(rhs); |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | struct State { |
| 97 | Geometry active; |
| 98 | Geometry requested; |
| 99 | uint32_t z; |
| 100 | uint32_t layerStack; |
| 101 | uint8_t alpha; |
| 102 | uint8_t flags; |
| 103 | uint8_t reserved[2]; |
| 104 | int32_t sequence; // changes when visible regions can change |
| 105 | Transform transform; |
Mathias Agopian | 2ca7939 | 2013-04-02 18:30:32 -0700 | [diff] [blame^] | 106 | // the transparentRegion hint is a bit special, it's latched only |
| 107 | // when we receive a buffer -- this is because it's "content" |
| 108 | // dependent. |
| 109 | Region activeTransparentRegion; |
| 110 | Region requestedTransparentRegion; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | class LayerMesh { |
| 114 | friend class Layer; |
| 115 | GLfloat mVertices[4][2]; |
| 116 | size_t mNumVertices; |
| 117 | public: |
| 118 | LayerMesh() : |
| 119 | mNumVertices(4) { |
| 120 | } |
| 121 | GLfloat const* getVertices() const { |
| 122 | return &mVertices[0][0]; |
| 123 | } |
| 124 | size_t getVertexCount() const { |
| 125 | return mNumVertices; |
| 126 | } |
| 127 | }; |
| 128 | |
| 129 | // ----------------------------------------------------------------------- |
| 130 | |
Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 131 | Layer(SurfaceFlinger* flinger, const sp<Client>& client, |
| 132 | const String8& name, uint32_t w, uint32_t h, uint32_t flags); |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 133 | virtual ~Layer(); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 134 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 135 | // the this layer's size and format |
Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 136 | status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 138 | // modify current state |
| 139 | bool setPosition(float x, float y); |
| 140 | bool setLayer(uint32_t z); |
| 141 | bool setSize(uint32_t w, uint32_t h); |
| 142 | bool setAlpha(uint8_t alpha); |
| 143 | bool setMatrix(const layer_state_t::matrix22_t& matrix); |
| 144 | bool setTransparentRegionHint(const Region& transparent); |
| 145 | bool setFlags(uint8_t flags, uint8_t mask); |
| 146 | bool setCrop(const Rect& crop); |
| 147 | bool setLayerStack(uint32_t layerStack); |
| 148 | |
| 149 | void commitTransaction(); |
| 150 | |
| 151 | uint32_t getTransactionFlags(uint32_t flags); |
| 152 | uint32_t setTransactionFlags(uint32_t flags); |
| 153 | |
| 154 | void computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* mesh) const; |
| 155 | Rect computeBounds() const; |
| 156 | |
Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 157 | sp<IBinder> getHandle(); |
| 158 | sp<BufferQueue> getBufferQueue() const; |
| 159 | String8 getName() const; |
| 160 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 161 | // ----------------------------------------------------------------------- |
| 162 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 163 | virtual const char* getTypeId() const { return "Layer"; } |
| 164 | |
Mathias Agopian | 4297734 | 2012-08-05 00:40:46 -0700 | [diff] [blame] | 165 | virtual void setGeometry(const sp<const DisplayDevice>& hw, |
Mathias Agopian | 4fec873 | 2012-06-29 14:12:52 -0700 | [diff] [blame] | 166 | HWComposer::HWCLayerInterface& layer); |
Mathias Agopian | 4297734 | 2012-08-05 00:40:46 -0700 | [diff] [blame] | 167 | virtual void setPerFrameData(const sp<const DisplayDevice>& hw, |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 168 | HWComposer::HWCLayerInterface& layer); |
Mathias Agopian | 4297734 | 2012-08-05 00:40:46 -0700 | [diff] [blame] | 169 | virtual void setAcquireFence(const sp<const DisplayDevice>& hw, |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 170 | HWComposer::HWCLayerInterface& layer); |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 171 | |
| 172 | /* |
| 173 | * called after page-flip |
| 174 | */ |
Mathias Agopian | 4297734 | 2012-08-05 00:40:46 -0700 | [diff] [blame] | 175 | virtual void onLayerDisplayed(const sp<const DisplayDevice>& hw, |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 176 | HWComposer::HWCLayerInterface* layer); |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 177 | |
| 178 | /* |
| 179 | * called before composition. |
| 180 | * returns true if the layer has pending updates. |
| 181 | */ |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 182 | virtual bool onPreComposition(); |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 183 | |
| 184 | /* |
| 185 | * called after composition. |
| 186 | */ |
Mathias Agopian | d3ee231 | 2012-08-02 14:01:42 -0700 | [diff] [blame] | 187 | virtual void onPostComposition(); |
Mathias Agopian | 4fec873 | 2012-06-29 14:12:52 -0700 | [diff] [blame] | 188 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 189 | /* |
| 190 | * draw - performs some global clipping optimizations |
| 191 | * and calls onDraw(). |
| 192 | * Typically this method is not overridden, instead implement onDraw() |
| 193 | * to perform the actual drawing. |
| 194 | */ |
| 195 | virtual void draw(const sp<const DisplayDevice>& hw, const Region& clip) const; |
| 196 | virtual void draw(const sp<const DisplayDevice>& hw); |
| 197 | |
| 198 | /* |
| 199 | * onDraw - draws the surface. |
| 200 | */ |
Mathias Agopian | 4297734 | 2012-08-05 00:40:46 -0700 | [diff] [blame] | 201 | virtual void onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 202 | |
| 203 | /* |
| 204 | * needsLinearFiltering - true if this surface's state requires filtering |
| 205 | */ |
| 206 | virtual bool needsFiltering(const sp<const DisplayDevice>& hw) const; |
| 207 | |
| 208 | /* |
| 209 | * doTransaction - process the transaction. This is a good place to figure |
| 210 | * out which attributes of the surface have changed. |
| 211 | */ |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | virtual uint32_t doTransaction(uint32_t transactionFlags); |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 213 | |
| 214 | /* |
| 215 | * setVisibleRegion - called to set the new visible region. This gives |
| 216 | * a chance to update the new visible region or record the fact it changed. |
| 217 | */ |
| 218 | virtual void setVisibleRegion(const Region& visibleRegion); |
| 219 | |
| 220 | /* |
| 221 | * setCoveredRegion - called when the covered region changes. The covered |
| 222 | * region corresponds to any area of the surface that is covered |
| 223 | * (transparently or not) by another surface. |
| 224 | */ |
| 225 | virtual void setCoveredRegion(const Region& coveredRegion); |
| 226 | |
| 227 | /* |
| 228 | * setVisibleNonTransparentRegion - called when the visible and |
| 229 | * non-transparent region changes. |
| 230 | */ |
| 231 | virtual void setVisibleNonTransparentRegion(const Region& |
| 232 | visibleNonTransparentRegion); |
| 233 | |
| 234 | /* |
| 235 | * latchBuffer - called each time the screen is redrawn and returns whether |
| 236 | * the visible regions need to be recomputed (this is a fairly heavy |
| 237 | * operation, so this should be set only if needed). Typically this is used |
| 238 | * to figure out if the content or size of a surface has changed. |
| 239 | */ |
Mathias Agopian | 4fec873 | 2012-06-29 14:12:52 -0700 | [diff] [blame] | 240 | virtual Region latchBuffer(bool& recomputeVisibleRegions); |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 241 | |
| 242 | /* |
| 243 | * isOpaque - true if this surface is opaque |
| 244 | */ |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 245 | virtual bool isOpaque() const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 246 | |
| 247 | /* |
| 248 | * isSecure - true if this surface is secure, that is if it prevents |
| 249 | * screenshots or VNC servers. |
| 250 | */ |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 251 | virtual bool isSecure() const { return mSecure; } |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 252 | |
| 253 | /* |
| 254 | * isProtected - true if the layer may contain protected content in the |
| 255 | * GRALLOC_USAGE_PROTECTED sense. |
| 256 | */ |
Jamie Gennis | 7a4d0df | 2011-03-09 17:05:02 -0800 | [diff] [blame] | 257 | virtual bool isProtected() const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 258 | |
| 259 | /* |
| 260 | * isVisible - true if this layer is visible, false otherwise |
| 261 | */ |
Mathias Agopian | da27af9 | 2012-09-13 18:17:13 -0700 | [diff] [blame] | 262 | virtual bool isVisible() const; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 263 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 264 | /* |
| 265 | * isFixedSize - true if content has a fixed size |
| 266 | */ |
| 267 | virtual bool isFixedSize() const; |
Jamie Gennis | 582270d | 2011-08-17 18:19:00 -0700 | [diff] [blame] | 268 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 269 | /* |
| 270 | * called with the state lock when the surface is removed from the |
| 271 | * current list |
| 272 | */ |
| 273 | virtual void onRemoved(); |
| 274 | |
| 275 | |
Andy McFadden | bf974ab | 2012-12-04 16:51:15 -0800 | [diff] [blame] | 276 | // Updates the transform hint in our SurfaceFlingerConsumer to match |
Mathias Agopian | 8430095 | 2012-11-21 16:02:13 -0800 | [diff] [blame] | 277 | // the current orientation of the display device. |
| 278 | virtual void updateTransformHint(const sp<const DisplayDevice>& hw) const; |
Andy McFadden | 6905205 | 2012-09-14 16:10:11 -0700 | [diff] [blame] | 279 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 280 | /* |
| 281 | * returns the rectangle that crops the content of the layer and scales it |
| 282 | * to the layer's size. |
| 283 | */ |
Mathias Agopian | a8bca8d | 2013-02-27 22:03:19 -0800 | [diff] [blame] | 284 | virtual Rect getContentCrop() const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 285 | |
| 286 | /* |
| 287 | * returns the transform bits (90 rotation / h-flip / v-flip) of the |
| 288 | * layer's content |
| 289 | */ |
Mathias Agopian | a8bca8d | 2013-02-27 22:03:19 -0800 | [diff] [blame] | 290 | virtual uint32_t getContentTransform() const; |
| 291 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 292 | // ----------------------------------------------------------------------- |
| 293 | |
| 294 | void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const; |
| 295 | void setFiltering(bool filtering); |
| 296 | bool getFiltering() const; |
| 297 | |
| 298 | // only for debugging |
| 299 | inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; } |
| 300 | |
| 301 | inline const State& drawingState() const { return mDrawingState; } |
| 302 | inline const State& currentState() const { return mCurrentState; } |
| 303 | inline State& currentState() { return mCurrentState; } |
| 304 | |
| 305 | |
| 306 | /* always call base class first */ |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 307 | virtual void dump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 308 | virtual void shortDump(String8& result, char* scratch, size_t size) const; |
Mathias Agopian | 82d7ab6 | 2012-01-19 18:34:40 -0800 | [diff] [blame] | 309 | virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const; |
Mathias Agopian | 25e66fc | 2012-01-28 22:31:55 -0800 | [diff] [blame] | 310 | virtual void clearStats(); |
Mathias Agopian | 1b5e102 | 2010-04-20 17:55:49 -0700 | [diff] [blame] | 311 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 312 | protected: |
| 313 | // constant |
| 314 | sp<SurfaceFlinger> mFlinger; |
| 315 | |
| 316 | virtual void onFirstRef(); |
| 317 | |
| 318 | /* |
| 319 | * Trivial class, used to ensure that mFlinger->onLayerDestroyed(mLayer) |
| 320 | * is called. |
| 321 | */ |
| 322 | class LayerCleaner { |
| 323 | sp<SurfaceFlinger> mFlinger; |
| 324 | wp<Layer> mLayer; |
| 325 | protected: |
| 326 | ~LayerCleaner(); |
| 327 | public: |
| 328 | LayerCleaner(const sp<SurfaceFlinger>& flinger, const sp<Layer>& layer); |
| 329 | }; |
| 330 | |
Mathias Agopian | 2a9fc49 | 2013-03-01 13:42:57 -0800 | [diff] [blame] | 331 | |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 332 | private: |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 333 | // Interface implementation for SurfaceFlingerConsumer::FrameAvailableListener |
| 334 | virtual void onFrameAvailable(); |
| 335 | |
| 336 | |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 337 | uint32_t getEffectiveUsage(uint32_t usage) const; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 338 | Rect computeCrop(const sp<const DisplayDevice>& hw) const; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 339 | bool isCropped() const; |
| 340 | static bool getOpacityForFormat(uint32_t format); |
Mathias Agopian | 0aa758d | 2009-04-22 15:23:34 -0700 | [diff] [blame] | 341 | |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 342 | // drawing |
| 343 | void clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip, |
| 344 | GLclampf r, GLclampf g, GLclampf b, GLclampf alpha) const; |
| 345 | void drawWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip) const; |
| 346 | |
Igor Murashkin | a4a3149 | 2012-10-29 13:36:11 -0700 | [diff] [blame] | 347 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 348 | // ----------------------------------------------------------------------- |
| 349 | |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 350 | // constants |
Andy McFadden | bf974ab | 2012-12-04 16:51:15 -0800 | [diff] [blame] | 351 | sp<SurfaceFlingerConsumer> mSurfaceFlingerConsumer; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 352 | GLuint mTextureName; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 353 | bool mPremultipliedAlpha; |
| 354 | String8 mName; |
| 355 | mutable bool mDebug; |
| 356 | PixelFormat mFormat; |
| 357 | const GLExtensions& mGLExtensions; |
| 358 | bool mOpaqueLayer; |
| 359 | |
| 360 | // these are protected by an external lock |
| 361 | State mCurrentState; |
| 362 | State mDrawingState; |
| 363 | volatile int32_t mTransactionFlags; |
Mathias Agopian | d606de6 | 2010-05-10 20:06:11 -0700 | [diff] [blame] | 364 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 365 | // thread-safe |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 366 | volatile int32_t mQueuedFrames; |
Jamie Gennis | 4b0eba9 | 2013-02-05 13:30:24 -0800 | [diff] [blame] | 367 | FrameTracker mFrameTracker; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 368 | |
| 369 | // main thread |
| 370 | sp<GraphicBuffer> mActiveBuffer; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 371 | Rect mCurrentCrop; |
| 372 | uint32_t mCurrentTransform; |
Mathias Agopian | 933389f | 2011-07-18 16:15:08 -0700 | [diff] [blame] | 373 | uint32_t mCurrentScalingMode; |
Mathias Agopian | a67932f | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 374 | bool mCurrentOpacity; |
Mathias Agopian | 4d143ee | 2012-02-23 20:05:39 -0800 | [diff] [blame] | 375 | bool mRefreshPending; |
Jamie Gennis | e8696a4 | 2012-01-15 18:54:57 -0800 | [diff] [blame] | 376 | bool mFrameLatencyNeeded; |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 377 | // Whether filtering is forced on or not |
| 378 | bool mFiltering; |
| 379 | // Whether filtering is needed b/c of the drawingstate |
| 380 | bool mNeedsFiltering; |
Mathias Agopian | d606de6 | 2010-05-10 20:06:11 -0700 | [diff] [blame] | 381 | |
Mathias Agopian | b7e930d | 2010-06-01 15:12:58 -0700 | [diff] [blame] | 382 | // page-flip thread (currently main thread) |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 383 | bool mSecure; // no screenshots |
Glenn Kasten | 16f0453 | 2011-01-19 15:27:27 -0800 | [diff] [blame] | 384 | bool mProtectedByApp; // application requires protected path to external sink |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 385 | |
| 386 | // protected by mLock |
| 387 | mutable Mutex mLock; |
Mathias Agopian | 4d9b822 | 2013-03-12 17:11:48 -0700 | [diff] [blame] | 388 | // Set to true once we've returned this surface's handle |
Mathias Agopian | 13127d8 | 2013-03-05 17:47:11 -0800 | [diff] [blame] | 389 | mutable bool mHasSurface; |
| 390 | const wp<Client> mClientRef; |
The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 391 | }; |
| 392 | |
| 393 | // --------------------------------------------------------------------------- |
| 394 | |
| 395 | }; // namespace android |
| 396 | |
| 397 | #endif // ANDROID_LAYER_H |