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