Layer.h revision 5ea5e5905170f32d5cf45ad35c552d64743892c3
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 23#include <EGL/egl.h> 24#include <EGL/eglext.h> 25 26#include <utils/RefBase.h> 27#include <utils/String8.h> 28#include <utils/Timers.h> 29 30#include <gfx/FloatRect.h> 31 32#include <ui/FrameStats.h> 33#include <ui/GraphicBuffer.h> 34#include <ui/PixelFormat.h> 35#include <ui/Region.h> 36 37#include <gui/ISurfaceComposerClient.h> 38 39#include <private/gui/LayerState.h> 40 41#include <list> 42 43#include "FrameTracker.h" 44#include "Client.h" 45#include "LayerVector.h" 46#include "MonitoredProducer.h" 47#include "SurfaceFlinger.h" 48#include "SurfaceFlingerConsumer.h" 49#include "Transform.h" 50 51#include "DisplayHardware/HWComposer.h" 52#include "RenderEngine/Mesh.h" 53#include "RenderEngine/Texture.h" 54 55namespace android { 56 57// --------------------------------------------------------------------------- 58 59class Client; 60class Colorizer; 61class DisplayDevice; 62class GraphicBuffer; 63class SurfaceFlinger; 64 65// --------------------------------------------------------------------------- 66 67/* 68 * A new BufferQueue and a new SurfaceFlingerConsumer are created when the 69 * Layer is first referenced. 70 * 71 * This also implements onFrameAvailable(), which notifies SurfaceFlinger 72 * that new data has arrived. 73 */ 74class Layer : public SurfaceFlingerConsumer::ContentsChangedListener { 75 static int32_t sSequence; 76 77public: 78 mutable bool contentDirty; 79 // regions below are in window-manager space 80 Region visibleRegion; 81 Region coveredRegion; 82 Region visibleNonTransparentRegion; 83 Region surfaceDamageRegion; 84 85 // Layer serial number. This gives layers an explicit ordering, so we 86 // have a stable sort order when their layer stack and Z-order are 87 // the same. 88 int32_t sequence; 89 90 enum { // flags for doTransaction() 91 eDontUpdateGeometryState = 0x00000001, 92 eVisibleRegion = 0x00000002, 93 }; 94 95 struct Geometry { 96 uint32_t w; 97 uint32_t h; 98 Transform transform; 99 100 inline bool operator ==(const Geometry& rhs) const { 101 return (w == rhs.w && h == rhs.h) && 102 (transform.tx() == rhs.transform.tx()) && 103 (transform.ty() == rhs.transform.ty()); 104 } 105 inline bool operator !=(const Geometry& rhs) const { 106 return !operator ==(rhs); 107 } 108 }; 109 110 struct State { 111 Geometry active; 112 Geometry requested; 113 int32_t z; 114 uint32_t layerStack; 115#ifdef USE_HWC2 116 float alpha; 117#else 118 uint8_t alpha; 119#endif 120 uint8_t flags; 121 uint8_t mask; 122 uint8_t reserved[2]; 123 int32_t sequence; // changes when visible regions can change 124 bool modified; 125 126 // Crop is expressed in layer space coordinate. 127 Rect crop; 128 Rect requestedCrop; 129 130 // finalCrop is expressed in display space coordinate. 131 Rect finalCrop; 132 133 // If set, defers this state update until the Layer identified by handle 134 // receives a frame with the given frameNumber 135 wp<IBinder> handle; 136 uint64_t frameNumber; 137 138 // the transparentRegion hint is a bit special, it's latched only 139 // when we receive a buffer -- this is because it's "content" 140 // dependent. 141 Region activeTransparentRegion; 142 Region requestedTransparentRegion; 143 android_dataspace dataSpace; 144 145 uint32_t appId; 146 uint32_t type; 147 }; 148 149 // ----------------------------------------------------------------------- 150 151 Layer(SurfaceFlinger* flinger, const sp<Client>& client, 152 const String8& name, uint32_t w, uint32_t h, uint32_t flags); 153 154 virtual ~Layer(); 155 156 // the this layer's size and format 157 status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); 158 159 // modify current state 160 bool setPosition(float x, float y, bool immediate); 161 bool setLayer(int32_t z); 162 bool setSize(uint32_t w, uint32_t h); 163#ifdef USE_HWC2 164 bool setAlpha(float alpha); 165#else 166 bool setAlpha(uint8_t alpha); 167#endif 168 bool setMatrix(const layer_state_t::matrix22_t& matrix); 169 bool setTransparentRegionHint(const Region& transparent); 170 bool setFlags(uint8_t flags, uint8_t mask); 171 bool setCrop(const Rect& crop, bool immediate); 172 bool setFinalCrop(const Rect& crop); 173 bool setLayerStack(uint32_t layerStack); 174 bool setDataSpace(android_dataspace dataSpace); 175 uint32_t getLayerStack() const; 176 void deferTransactionUntil(const sp<IBinder>& handle, uint64_t frameNumber); 177 bool setOverrideScalingMode(int32_t overrideScalingMode); 178 void setInfo(uint32_t type, uint32_t appId); 179 bool reparentChildren(const sp<IBinder>& layer); 180 181 // If we have received a new buffer this frame, we will pass its surface 182 // damage down to hardware composer. Otherwise, we must send a region with 183 // one empty rect. 184 void useSurfaceDamage(); 185 void useEmptyDamage(); 186 187 uint32_t getTransactionFlags(uint32_t flags); 188 uint32_t setTransactionFlags(uint32_t flags); 189 190 void computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh, 191 bool useIdentityTransform) const; 192 Rect computeBounds(const Region& activeTransparentRegion) const; 193 Rect computeBounds() const; 194 195 int32_t getSequence() const { return sequence; } 196 197 // ----------------------------------------------------------------------- 198 // Virtuals 199 200 virtual const char* getTypeId() const { return "Layer"; } 201 202 /* 203 * isOpaque - true if this surface is opaque 204 * 205 * This takes into account the buffer format (i.e. whether or not the 206 * pixel format includes an alpha channel) and the "opaque" flag set 207 * on the layer. It does not examine the current plane alpha value. 208 */ 209 virtual bool isOpaque(const Layer::State& s) const; 210 211 /* 212 * isSecure - true if this surface is secure, that is if it prevents 213 * screenshots or VNC servers. 214 */ 215 virtual bool isSecure() const; 216 217 /* 218 * isProtected - true if the layer may contain protected content in the 219 * GRALLOC_USAGE_PROTECTED sense. 220 */ 221 virtual bool isProtected() const; 222 223 /* 224 * isVisible - true if this layer is visible, false otherwise 225 */ 226 virtual bool isVisible() const; 227 228 /* 229 * isHiddenByPolicy - true if this layer has been forced invisible. 230 * just because this is false, doesn't mean isVisible() is true. 231 * For example if this layer has no active buffer, it may not be hidden by 232 * policy, but it still can not be visible. 233 */ 234 virtual bool isHiddenByPolicy() const; 235 236 /* 237 * isFixedSize - true if content has a fixed size 238 */ 239 virtual bool isFixedSize() const; 240 241protected: 242 /* 243 * onDraw - draws the surface. 244 */ 245 virtual void onDraw(const sp<const DisplayDevice>& hw, const Region& clip, 246 bool useIdentityTransform) const; 247 248public: 249 // ----------------------------------------------------------------------- 250 251#ifdef USE_HWC2 252 void setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z); 253 void forceClientComposition(int32_t hwcId); 254 void setPerFrameData(const sp<const DisplayDevice>& displayDevice); 255 256 // callIntoHwc exists so we can update our local state and call 257 // acceptDisplayChanges without unnecessarily updating the device's state 258 void setCompositionType(int32_t hwcId, HWC2::Composition type, 259 bool callIntoHwc = true); 260 HWC2::Composition getCompositionType(int32_t hwcId) const; 261 262 void setClearClientTarget(int32_t hwcId, bool clear); 263 bool getClearClientTarget(int32_t hwcId) const; 264 265 void updateCursorPosition(const sp<const DisplayDevice>& hw); 266#else 267 void setGeometry(const sp<const DisplayDevice>& hw, 268 HWComposer::HWCLayerInterface& layer); 269 void setPerFrameData(const sp<const DisplayDevice>& hw, 270 HWComposer::HWCLayerInterface& layer); 271 void setAcquireFence(const sp<const DisplayDevice>& hw, 272 HWComposer::HWCLayerInterface& layer); 273 274 Rect getPosition(const sp<const DisplayDevice>& hw); 275#endif 276 277 /* 278 * called after page-flip 279 */ 280#ifdef USE_HWC2 281 void onLayerDisplayed(const sp<Fence>& releaseFence); 282#else 283 void onLayerDisplayed(const sp<const DisplayDevice>& hw, 284 HWComposer::HWCLayerInterface* layer); 285#endif 286 287 bool shouldPresentNow(const DispSync& dispSync) const; 288 289 /* 290 * called before composition. 291 * returns true if the layer has pending updates. 292 */ 293 bool onPreComposition(nsecs_t refreshStartTime); 294 295 /* 296 * called after composition. 297 * returns true if the layer latched a new buffer this frame. 298 */ 299 bool onPostComposition(const std::shared_ptr<FenceTime>& glDoneFence, 300 const std::shared_ptr<FenceTime>& presentFence, 301 const std::shared_ptr<FenceTime>& retireFence, 302 const CompositorTiming& compositorTiming); 303 304#ifdef USE_HWC2 305 // If a buffer was replaced this frame, release the former buffer 306 void releasePendingBuffer(nsecs_t dequeueReadyTime); 307#endif 308 309 /* 310 * draw - performs some global clipping optimizations 311 * and calls onDraw(). 312 */ 313 void draw(const sp<const DisplayDevice>& hw, const Region& clip) const; 314 void draw(const sp<const DisplayDevice>& hw, bool useIdentityTransform) const; 315 void draw(const sp<const DisplayDevice>& hw) const; 316 317 /* 318 * doTransaction - process the transaction. This is a good place to figure 319 * out which attributes of the surface have changed. 320 */ 321 uint32_t doTransaction(uint32_t transactionFlags); 322 323 /* 324 * setVisibleRegion - called to set the new visible region. This gives 325 * a chance to update the new visible region or record the fact it changed. 326 */ 327 void setVisibleRegion(const Region& visibleRegion); 328 329 /* 330 * setCoveredRegion - called when the covered region changes. The covered 331 * region corresponds to any area of the surface that is covered 332 * (transparently or not) by another surface. 333 */ 334 void setCoveredRegion(const Region& coveredRegion); 335 336 /* 337 * setVisibleNonTransparentRegion - called when the visible and 338 * non-transparent region changes. 339 */ 340 void setVisibleNonTransparentRegion(const Region& 341 visibleNonTransparentRegion); 342 343 /* 344 * latchBuffer - called each time the screen is redrawn and returns whether 345 * the visible regions need to be recomputed (this is a fairly heavy 346 * operation, so this should be set only if needed). Typically this is used 347 * to figure out if the content or size of a surface has changed. 348 */ 349 Region latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime); 350 351 bool isPotentialCursor() const { return mPotentialCursor;} 352 353 /* 354 * called with the state lock when the surface is removed from the 355 * current list 356 */ 357 void onRemoved(); 358 359 360 // Updates the transform hint in our SurfaceFlingerConsumer to match 361 // the current orientation of the display device. 362 void updateTransformHint(const sp<const DisplayDevice>& hw) const; 363 364 /* 365 * returns the rectangle that crops the content of the layer and scales it 366 * to the layer's size. 367 */ 368 Rect getContentCrop() const; 369 370 /* 371 * Returns if a frame is queued. 372 */ 373 bool hasQueuedFrame() const { return mQueuedFrames > 0 || 374 mSidebandStreamChanged || mAutoRefresh; } 375 376#ifdef USE_HWC2 377 // ----------------------------------------------------------------------- 378 379 void eraseHwcLayer(int32_t hwcId) { 380 mHwcLayers.erase(hwcId); 381 382 Mutex::Autolock lock(mHwcBufferCacheMutex); 383 mHwcBufferCaches.erase(hwcId); 384 } 385 386 bool hasHwcLayer(int32_t hwcId) { 387 if (mHwcLayers.count(hwcId) == 0) { 388 return false; 389 } 390 if (mHwcLayers[hwcId].layer->isAbandoned()) { 391 ALOGI("Erasing abandoned layer %s on %d", mName.string(), hwcId); 392 eraseHwcLayer(hwcId); 393 return false; 394 } 395 return true; 396 } 397 398 std::shared_ptr<HWC2::Layer> getHwcLayer(int32_t hwcId) { 399 if (mHwcLayers.count(hwcId) == 0) { 400 return nullptr; 401 } 402 return mHwcLayers[hwcId].layer; 403 } 404 405 void setHwcLayer(int32_t hwcId, std::shared_ptr<HWC2::Layer>&& layer) { 406 if (layer) { 407 mHwcLayers[hwcId].layer = layer; 408 409 Mutex::Autolock lock(mHwcBufferCacheMutex); 410 mHwcBufferCaches[hwcId] = HWComposerBufferCache(); 411 } else { 412 eraseHwcLayer(hwcId); 413 } 414 } 415 416 void clearHwcLayers() { 417 mHwcLayers.clear(); 418 } 419 420#endif 421 // ----------------------------------------------------------------------- 422 423 void clearWithOpenGL(const sp<const DisplayDevice>& hw) const; 424 void setFiltering(bool filtering); 425 bool getFiltering() const; 426 427 // only for debugging 428 inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; } 429 430 inline const State& getDrawingState() const { return mDrawingState; } 431 inline const State& getCurrentState() const { return mCurrentState; } 432 inline State& getCurrentState() { return mCurrentState; } 433 434 435 /* always call base class first */ 436 void dump(String8& result, Colorizer& colorizer) const; 437#ifdef USE_HWC2 438 static void miniDumpHeader(String8& result); 439 void miniDump(String8& result, int32_t hwcId) const; 440#endif 441 void dumpFrameStats(String8& result) const; 442 void dumpFrameEvents(String8& result); 443 void clearFrameStats(); 444 void logFrameStats(); 445 void getFrameStats(FrameStats* outStats) const; 446 447 std::vector<OccupancyTracker::Segment> getOccupancyHistory(bool forceFlush); 448 449 void onDisconnect(); 450 void addAndGetFrameTimestamps(const NewFrameEventsEntry* newEntry, 451 FrameEventHistoryDelta* outDelta); 452 453 bool getTransformToDisplayInverse() const; 454 455 Transform getTransform() const; 456 457 void traverseInReverseZOrder(const std::function<void(Layer*)>& exec); 458 void traverseInZOrder(const std::function<void(Layer*)>& exec); 459 460 void addChild(const sp<Layer>& layer); 461 // Returns index if removed, or negative value otherwise 462 // for symmetry with Vector::remove 463 ssize_t removeChild(const sp<Layer>& layer); 464 sp<Layer> getParent() const { return mParent.promote(); } 465 bool hasParent() const { return getParent() != nullptr; } 466 467 Rect computeScreenBounds(bool reduceTransparentRegion = true) const; 468 bool setChildLayer(const sp<Layer>& childLayer, int32_t z); 469 470 // Copy the current list of children to the drawing state. Called by 471 // SurfaceFlinger to complete a transaction. 472 void commitChildList(); 473 474 int32_t getZ() const; 475protected: 476 // constant 477 sp<SurfaceFlinger> mFlinger; 478 /* 479 * Trivial class, used to ensure that mFlinger->onLayerDestroyed(mLayer) 480 * is called. 481 */ 482 class LayerCleaner { 483 sp<SurfaceFlinger> mFlinger; 484 wp<Layer> mLayer; 485 protected: 486 ~LayerCleaner() { 487 // destroy client resources 488 mFlinger->onLayerDestroyed(mLayer); 489 } 490 public: 491 LayerCleaner(const sp<SurfaceFlinger>& flinger, 492 const sp<Layer>& layer) 493 : mFlinger(flinger), mLayer(layer) { 494 } 495 }; 496 497 498 virtual void onFirstRef(); 499 500 501 502private: 503 friend class SurfaceInterceptor; 504 // Interface implementation for SurfaceFlingerConsumer::ContentsChangedListener 505 virtual void onFrameAvailable(const BufferItem& item) override; 506 virtual void onFrameReplaced(const BufferItem& item) override; 507 virtual void onBuffersReleased() override; 508 virtual void onSidebandStreamChanged() override; 509 510 void commitTransaction(const State& stateToCommit); 511 512 // needsLinearFiltering - true if this surface's state requires filtering 513 bool needsFiltering(const sp<const DisplayDevice>& hw) const; 514 515 uint32_t getEffectiveUsage(uint32_t usage) const; 516 517 gfx::FloatRect computeCrop(const sp<const DisplayDevice>& hw) const; 518 // Compute the initial crop as specified by parent layers and the SurfaceControl 519 // for this layer. Does not include buffer crop from the IGraphicBufferProducer 520 // client, as that should not affect child clipping. Returns in screen space. 521 Rect computeInitialCrop(const sp<const DisplayDevice>& hw) const; 522 bool isCropped() const; 523 static bool getOpacityForFormat(uint32_t format); 524 525 // drawing 526 void clearWithOpenGL(const sp<const DisplayDevice>& hw, 527 float r, float g, float b, float alpha) const; 528 void drawWithOpenGL(const sp<const DisplayDevice>& hw, 529 bool useIdentityTransform) const; 530 531 // Temporary - Used only for LEGACY camera mode. 532 uint32_t getProducerStickyTransform() const; 533 534 // Loads the corresponding system property once per process 535 static bool latchUnsignaledBuffers(); 536 537 void setParent(const sp<Layer>& layer); 538 539 // ----------------------------------------------------------------------- 540 541 class SyncPoint 542 { 543 public: 544 explicit SyncPoint(uint64_t frameNumber) : mFrameNumber(frameNumber), 545 mFrameIsAvailable(false), mTransactionIsApplied(false) {} 546 547 uint64_t getFrameNumber() const { 548 return mFrameNumber; 549 } 550 551 bool frameIsAvailable() const { 552 return mFrameIsAvailable; 553 } 554 555 void setFrameAvailable() { 556 mFrameIsAvailable = true; 557 } 558 559 bool transactionIsApplied() const { 560 return mTransactionIsApplied; 561 } 562 563 void setTransactionApplied() { 564 mTransactionIsApplied = true; 565 } 566 567 private: 568 const uint64_t mFrameNumber; 569 std::atomic<bool> mFrameIsAvailable; 570 std::atomic<bool> mTransactionIsApplied; 571 }; 572 573 // SyncPoints which will be signaled when the correct frame is at the head 574 // of the queue and dropped after the frame has been latched. Protected by 575 // mLocalSyncPointMutex. 576 Mutex mLocalSyncPointMutex; 577 std::list<std::shared_ptr<SyncPoint>> mLocalSyncPoints; 578 579 // SyncPoints which will be signaled and then dropped when the transaction 580 // is applied 581 std::list<std::shared_ptr<SyncPoint>> mRemoteSyncPoints; 582 583 uint64_t getHeadFrameNumber() const; 584 bool headFenceHasSignaled() const; 585 586 // Returns false if the relevant frame has already been latched 587 bool addSyncPoint(const std::shared_ptr<SyncPoint>& point); 588 589 void pushPendingState(); 590 void popPendingState(State* stateToCommit); 591 bool applyPendingStates(State* stateToCommit); 592 593 void clearSyncPoints(); 594 595 // Returns mCurrentScaling mode (originating from the 596 // Client) or mOverrideScalingMode mode (originating from 597 // the Surface Controller) if set. 598 uint32_t getEffectiveScalingMode() const; 599public: 600 /* 601 * The layer handle is just a BBinder object passed to the client 602 * (remote process) -- we don't keep any reference on our side such that 603 * the dtor is called when the remote side let go of its reference. 604 * 605 * LayerCleaner ensures that mFlinger->onLayerDestroyed() is called for 606 * this layer when the handle is destroyed. 607 */ 608 class Handle : public BBinder, public LayerCleaner { 609 public: 610 Handle(const sp<SurfaceFlinger>& flinger, const sp<Layer>& layer) 611 : LayerCleaner(flinger, layer), owner(layer) {} 612 613 wp<Layer> owner; 614 }; 615 616 sp<IBinder> getHandle(); 617 sp<IGraphicBufferProducer> getProducer() const; 618 const String8& getName() const; 619 void notifyAvailableFrames(); 620private: 621 622 // ----------------------------------------------------------------------- 623 624 // Check all of the local sync points to ensure that all transactions 625 // which need to have been applied prior to the frame which is about to 626 // be latched have signaled 627 bool allTransactionsSignaled(); 628 629 // constants 630 sp<SurfaceFlingerConsumer> mSurfaceFlingerConsumer; 631 sp<IGraphicBufferProducer> mProducer; 632 uint32_t mTextureName; // from GLES 633 bool mPremultipliedAlpha; 634 String8 mName; 635 PixelFormat mFormat; 636 637 // these are protected by an external lock 638 State mCurrentState; 639 State mDrawingState; 640 volatile int32_t mTransactionFlags; 641 642 // Accessed from main thread and binder threads 643 Mutex mPendingStateMutex; 644 Vector<State> mPendingStates; 645 646 // thread-safe 647 volatile int32_t mQueuedFrames; 648 volatile int32_t mSidebandStreamChanged; // used like an atomic boolean 649 650 // Timestamp history for UIAutomation. Thread safe. 651 FrameTracker mFrameTracker; 652 653 // Timestamp history for the consumer to query. 654 // Accessed by both consumer and producer on main and binder threads. 655 Mutex mFrameEventHistoryMutex; 656 ConsumerFrameEventHistory mFrameEventHistory; 657 FenceTimeline mAcquireTimeline; 658 FenceTimeline mReleaseTimeline; 659 660 // main thread 661 int mActiveBufferSlot = BufferQueue::INVALID_BUFFER_SLOT; 662 sp<GraphicBuffer> mActiveBuffer; 663 sp<NativeHandle> mSidebandStream; 664 Rect mCurrentCrop; 665 uint32_t mCurrentTransform; 666 uint32_t mCurrentScalingMode; 667 // We encode unset as -1. 668 int32_t mOverrideScalingMode; 669 bool mCurrentOpacity; 670 bool mBufferLatched = false; // TODO: Use mActiveBuffer? 671 std::atomic<uint64_t> mCurrentFrameNumber; 672 uint64_t mPreviousFrameNumber; // Only accessed on the main thread. 673 bool mRefreshPending; 674 bool mFrameLatencyNeeded; 675 // Whether filtering is forced on or not 676 bool mFiltering; 677 // Whether filtering is needed b/c of the drawingstate 678 bool mNeedsFiltering; 679 // The mesh used to draw the layer in GLES composition mode 680 mutable Mesh mMesh; 681 // The texture used to draw the layer in GLES composition mode 682 mutable Texture mTexture; 683 684#ifdef USE_HWC2 685 // HWC items, accessed from the main thread 686 struct HWCInfo { 687 HWCInfo() 688 : layer(), 689 forceClientComposition(false), 690 compositionType(HWC2::Composition::Invalid), 691 clearClientTarget(false) {} 692 693 std::shared_ptr<HWC2::Layer> layer; 694 bool forceClientComposition; 695 HWC2::Composition compositionType; 696 bool clearClientTarget; 697 Rect displayFrame; 698 gfx::FloatRect sourceCrop; 699 }; 700 std::unordered_map<int32_t, HWCInfo> mHwcLayers; 701 702 // We need one HWComposerBufferCache for each HWC display. We cannot have 703 // HWComposerBufferCache in HWCInfo because HWCInfo can only be accessed 704 // from the main thread. 705 Mutex mHwcBufferCacheMutex; 706 std::unordered_map<int32_t, HWComposerBufferCache> mHwcBufferCaches; 707#else 708 bool mIsGlesComposition; 709#endif 710 711 // page-flip thread (currently main thread) 712 bool mProtectedByApp; // application requires protected path to external sink 713 714 // protected by mLock 715 mutable Mutex mLock; 716 // Set to true once we've returned this surface's handle 717 mutable bool mHasSurface; 718 const wp<Client> mClientRef; 719 720 // This layer can be a cursor on some displays. 721 bool mPotentialCursor; 722 723 // Local copy of the queued contents of the incoming BufferQueue 724 mutable Mutex mQueueItemLock; 725 Condition mQueueItemCondition; 726 Vector<BufferItem> mQueueItems; 727 std::atomic<uint64_t> mLastFrameNumberReceived; 728 bool mUpdateTexImageFailed; // This is only accessed on the main thread. 729 730 bool mAutoRefresh; 731 bool mFreezePositionUpdates; 732 733 // Child list about to be committed/used for editing. 734 LayerVector mCurrentChildren; 735 // Child list used for rendering. 736 LayerVector mDrawingChildren; 737 738 wp<Layer> mParent; 739}; 740 741// --------------------------------------------------------------------------- 742 743}; // namespace android 744 745#endif // ANDROID_LAYER_H 746