SurfaceFlinger.h revision 3a8f794471815e6419caefe254adf2bbb19a8a53
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_SURFACE_FLINGER_H 18#define ANDROID_SURFACE_FLINGER_H 19 20#include <memory> 21#include <stdint.h> 22#include <sys/types.h> 23 24#include <EGL/egl.h> 25 26/* 27 * NOTE: Make sure this file doesn't include anything from <gl/ > or <gl2/ > 28 */ 29 30#include <cutils/compiler.h> 31 32#include <utils/Atomic.h> 33#include <utils/Errors.h> 34#include <utils/KeyedVector.h> 35#include <utils/RefBase.h> 36#include <utils/SortedVector.h> 37#include <utils/threads.h> 38 39#include <ui/FenceTime.h> 40#include <ui/PixelFormat.h> 41#include <math/mat4.h> 42 43#include <gui/FrameTimestamps.h> 44#include <gui/ISurfaceComposer.h> 45#include <gui/ISurfaceComposerClient.h> 46#include <gui/OccupancyTracker.h> 47 48#include <hardware/hwcomposer_defs.h> 49 50#include <system/graphics.h> 51 52#include <private/gui/LayerState.h> 53 54#include "Barrier.h" 55#include "DisplayDevice.h" 56#include "DispSync.h" 57#include "FrameTracker.h" 58#include "LayerVector.h" 59#include "MessageQueue.h" 60#include "SurfaceInterceptor.h" 61#include "StartBootAnimThread.h" 62 63#include "DisplayHardware/HWComposer.h" 64#include "Effects/Daltonizer.h" 65 66#include <map> 67#include <mutex> 68#include <queue> 69#include <string> 70#include <utility> 71 72namespace android { 73 74// --------------------------------------------------------------------------- 75 76class Client; 77class DisplayEventConnection; 78class EventThread; 79class IGraphicBufferAlloc; 80class Layer; 81class LayerDim; 82class Surface; 83class RenderEngine; 84class EventControlThread; 85class VSyncSource; 86class InjectVSyncSource; 87class VrStateCallbacks; 88 89namespace dvr { 90class VrFlinger; 91} // namespace dvr 92 93// --------------------------------------------------------------------------- 94 95enum { 96 eTransactionNeeded = 0x01, 97 eTraversalNeeded = 0x02, 98 eDisplayTransactionNeeded = 0x04, 99 eTransactionMask = 0x07 100}; 101 102class SurfaceFlinger : public BnSurfaceComposer, 103 private IBinder::DeathRecipient, 104 private HWComposer::EventHandler 105{ 106public: 107 static char const* getServiceName() ANDROID_API { 108 return "SurfaceFlinger"; 109 } 110 111 SurfaceFlinger() ANDROID_API; 112 113 // must be called before clients can connect 114 void init() ANDROID_API; 115 116 // starts SurfaceFlinger main loop in the current thread 117 void run() ANDROID_API; 118 119 enum { 120 EVENT_VSYNC = HWC_EVENT_VSYNC 121 }; 122 123 // post an asynchronous message to the main thread 124 status_t postMessageAsync(const sp<MessageBase>& msg, nsecs_t reltime = 0, uint32_t flags = 0); 125 126 // post a synchronous message to the main thread 127 status_t postMessageSync(const sp<MessageBase>& msg, nsecs_t reltime = 0, uint32_t flags = 0); 128 129 // force full composition on all displays 130 void repaintEverything(); 131 132 // returns the default Display 133 sp<const DisplayDevice> getDefaultDisplayDevice() const { 134 return getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]); 135 } 136 137 // utility function to delete a texture on the main thread 138 void deleteTextureAsync(uint32_t texture); 139 140 // enable/disable h/w composer event 141 // TODO: this should be made accessible only to EventThread 142#ifdef USE_HWC2 143 void setVsyncEnabled(int disp, int enabled); 144#else 145 void eventControl(int disp, int event, int enabled); 146#endif 147 148 // called on the main thread by MessageQueue when an internal message 149 // is received 150 // TODO: this should be made accessible only to MessageQueue 151 void onMessageReceived(int32_t what); 152 153 // for debugging only 154 // TODO: this should be made accessible only to HWComposer 155 const Vector< sp<Layer> >& getLayerSortedByZForHwcDisplay(int id); 156 157 RenderEngine& getRenderEngine() const { 158 return *mRenderEngine; 159 } 160 161 bool authenticateSurfaceTextureLocked( 162 const sp<IGraphicBufferProducer>& bufferProducer) const; 163 164private: 165 friend class Client; 166 friend class DisplayEventConnection; 167 friend class EventThread; 168 friend class Layer; 169 friend class MonitoredProducer; 170 friend class VrStateCallbacks; 171 172 // This value is specified in number of frames. Log frame stats at most 173 // every half hour. 174 enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; 175 176 static const size_t MAX_LAYERS = 4096; 177 178 // We're reference counted, never destroy SurfaceFlinger directly 179 virtual ~SurfaceFlinger(); 180 181 /* ------------------------------------------------------------------------ 182 * Internal data structures 183 */ 184 185 class State { 186 public: 187 LayerVector layersSortedByZ; 188 DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> displays; 189 190 void traverseInZOrder(const std::function<void(Layer*)>& consume) const; 191 void traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const; 192 }; 193 194 /* ------------------------------------------------------------------------ 195 * IBinder interface 196 */ 197 virtual status_t onTransact(uint32_t code, const Parcel& data, 198 Parcel* reply, uint32_t flags); 199 virtual status_t dump(int fd, const Vector<String16>& args); 200 201 /* ------------------------------------------------------------------------ 202 * ISurfaceComposer interface 203 */ 204 virtual sp<ISurfaceComposerClient> createConnection(); 205 virtual sp<ISurfaceComposerClient> createScopedConnection(const sp<IGraphicBufferProducer>& gbp); 206 virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc(); 207 virtual sp<IBinder> createDisplay(const String8& displayName, bool secure); 208 virtual void destroyDisplay(const sp<IBinder>& display); 209 virtual sp<IBinder> getBuiltInDisplay(int32_t id); 210 virtual void setTransactionState(const Vector<ComposerState>& state, 211 const Vector<DisplayState>& displays, uint32_t flags); 212 virtual void bootFinished(); 213 virtual bool authenticateSurfaceTexture( 214 const sp<IGraphicBufferProducer>& bufferProducer) const; 215 virtual status_t getSupportedFrameTimestamps( 216 std::vector<FrameEvent>* outSupported) const; 217 virtual sp<IDisplayEventConnection> createDisplayEventConnection(); 218 virtual status_t captureScreen(const sp<IBinder>& display, 219 const sp<IGraphicBufferProducer>& producer, 220 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, 221 int32_t minLayerZ, int32_t maxLayerZ, 222 bool useIdentityTransform, ISurfaceComposer::Rotation rotation); 223 virtual status_t getDisplayStats(const sp<IBinder>& display, 224 DisplayStatInfo* stats); 225 virtual status_t getDisplayConfigs(const sp<IBinder>& display, 226 Vector<DisplayInfo>* configs); 227 virtual int getActiveConfig(const sp<IBinder>& display); 228 virtual status_t getDisplayColorModes(const sp<IBinder>& display, 229 Vector<android_color_mode_t>* configs); 230 virtual android_color_mode_t getActiveColorMode(const sp<IBinder>& display); 231 virtual status_t setActiveColorMode(const sp<IBinder>& display, android_color_mode_t colorMode); 232 virtual void setPowerMode(const sp<IBinder>& display, int mode); 233 virtual status_t setActiveConfig(const sp<IBinder>& display, int id); 234 virtual status_t clearAnimationFrameStats(); 235 virtual status_t getAnimationFrameStats(FrameStats* outStats) const; 236 virtual status_t getHdrCapabilities(const sp<IBinder>& display, 237 HdrCapabilities* outCapabilities) const; 238 virtual status_t enableVSyncInjections(bool enable); 239 virtual status_t injectVSync(nsecs_t when); 240 241 242 /* ------------------------------------------------------------------------ 243 * DeathRecipient interface 244 */ 245 virtual void binderDied(const wp<IBinder>& who); 246 247 /* ------------------------------------------------------------------------ 248 * RefBase interface 249 */ 250 virtual void onFirstRef(); 251 252 /* ------------------------------------------------------------------------ 253 * HWComposer::EventHandler interface 254 */ 255 virtual void onVSyncReceived(HWComposer* composer, int type, nsecs_t timestamp); 256 virtual void onHotplugReceived(int disp, bool connected); 257 virtual void onInvalidateReceived(HWComposer* composer); 258 259 /* ------------------------------------------------------------------------ 260 * Message handling 261 */ 262 void waitForEvent(); 263 void signalTransaction(); 264 void signalLayerUpdate(); 265 void signalRefresh(); 266 267 // called on the main thread in response to initializeDisplays() 268 void onInitializeDisplays(); 269 // called on the main thread in response to setActiveConfig() 270 void setActiveConfigInternal(const sp<DisplayDevice>& hw, int mode); 271 // called on the main thread in response to setPowerMode() 272 void setPowerModeInternal(const sp<DisplayDevice>& hw, int mode); 273 274 // Called on the main thread in response to setActiveColorMode() 275 void setActiveColorModeInternal(const sp<DisplayDevice>& hw, android_color_mode_t colorMode); 276 277 // Returns whether the transaction actually modified any state 278 bool handleMessageTransaction(); 279 280 // Returns whether a new buffer has been latched (see handlePageFlip()) 281 bool handleMessageInvalidate(); 282 283 void handleMessageRefresh(); 284 285 void handleTransaction(uint32_t transactionFlags); 286 void handleTransactionLocked(uint32_t transactionFlags); 287 288 void updateCursorAsync(); 289 290 /* handlePageFlip - latch a new buffer if available and compute the dirty 291 * region. Returns whether a new buffer has been latched, i.e., whether it 292 * is necessary to perform a refresh during this vsync. 293 */ 294 bool handlePageFlip(); 295 296 /* ------------------------------------------------------------------------ 297 * Transactions 298 */ 299 uint32_t getTransactionFlags(uint32_t flags); 300 uint32_t peekTransactionFlags(); 301 uint32_t setTransactionFlags(uint32_t flags); 302 void commitTransaction(); 303 uint32_t setClientStateLocked(const sp<Client>& client, const layer_state_t& s); 304 uint32_t setDisplayStateLocked(const DisplayState& s); 305 306 /* ------------------------------------------------------------------------ 307 * Layer management 308 */ 309 status_t createLayer(const String8& name, const sp<Client>& client, 310 uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, 311 uint32_t windowType, uint32_t ownerUid, sp<IBinder>* handle, 312 sp<IGraphicBufferProducer>* gbp, sp<Layer>* parent); 313 314 status_t createNormalLayer(const sp<Client>& client, const String8& name, 315 uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, 316 sp<IBinder>* outHandle, sp<IGraphicBufferProducer>* outGbp, 317 sp<Layer>* outLayer); 318 319 status_t createDimLayer(const sp<Client>& client, const String8& name, 320 uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle, 321 sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer); 322 323 // called in response to the window-manager calling 324 // ISurfaceComposerClient::destroySurface() 325 status_t onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle); 326 327 // called when all clients have released all their references to 328 // this layer meaning it is entirely safe to destroy all 329 // resources associated to this layer. 330 status_t onLayerDestroyed(const wp<Layer>& layer); 331 332 // remove a layer from SurfaceFlinger immediately 333 status_t removeLayer(const sp<Layer>& layer); 334 335 // add a layer to SurfaceFlinger 336 status_t addClientLayer(const sp<Client>& client, 337 const sp<IBinder>& handle, 338 const sp<IGraphicBufferProducer>& gbc, 339 const sp<Layer>& lbc, 340 const sp<Layer>& parent); 341 342 /* ------------------------------------------------------------------------ 343 * Boot animation, on/off animations and screen capture 344 */ 345 346 void startBootAnim(); 347 348 void renderScreenImplLocked( 349 const sp<const DisplayDevice>& hw, 350 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, 351 int32_t minLayerZ, int32_t maxLayerZ, 352 bool yswap, bool useIdentityTransform, Transform::orientation_flags rotation); 353 354 status_t captureScreenImplLocked( 355 const sp<const DisplayDevice>& hw, 356 const sp<IGraphicBufferProducer>& producer, 357 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, 358 int32_t minLayerZ, int32_t maxLayerZ, 359 bool useIdentityTransform, Transform::orientation_flags rotation, 360 bool isLocalScreenshot); 361 362 sp<StartBootAnimThread> mStartBootAnimThread = nullptr; 363 364 /* ------------------------------------------------------------------------ 365 * EGL 366 */ 367 size_t getMaxTextureSize() const; 368 size_t getMaxViewportDims() const; 369 370 /* ------------------------------------------------------------------------ 371 * Display and layer stack management 372 */ 373 // called when starting, or restarting after system_server death 374 void initializeDisplays(); 375 376 // Create an IBinder for a builtin display and add it to current state 377 void createBuiltinDisplayLocked(DisplayDevice::DisplayType type); 378 379 // NOTE: can only be called from the main thread or with mStateLock held 380 sp<const DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) const { 381 return mDisplays.valueFor(dpy); 382 } 383 384 // NOTE: can only be called from the main thread or with mStateLock held 385 sp<DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) { 386 return mDisplays.valueFor(dpy); 387 } 388 389 int32_t getDisplayType(const sp<IBinder>& display) { 390 if (!display.get()) return NAME_NOT_FOUND; 391 for (int i = 0; i < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES; ++i) { 392 if (display == mBuiltinDisplays[i]) { 393 return i; 394 } 395 } 396 return NAME_NOT_FOUND; 397 } 398 399 // mark a region of a layer stack dirty. this updates the dirty 400 // region of all screens presenting this layer stack. 401 void invalidateLayerStack(uint32_t layerStack, const Region& dirty); 402 403#ifndef USE_HWC2 404 int32_t allocateHwcDisplayId(DisplayDevice::DisplayType type); 405#endif 406 407 /* ------------------------------------------------------------------------ 408 * H/W composer 409 */ 410 411 HWComposer& getHwComposer() const { return *mHwc; } 412 413 /* ------------------------------------------------------------------------ 414 * Compositing 415 */ 416 void invalidateHwcGeometry(); 417 void computeVisibleRegions(uint32_t layerStack, 418 Region& dirtyRegion, Region& opaqueRegion); 419 420 void preComposition(nsecs_t refreshStartTime); 421 void postComposition(nsecs_t refreshStartTime); 422 void updateCompositorTiming( 423 nsecs_t vsyncPhase, nsecs_t vsyncInterval, nsecs_t compositeTime, 424 std::shared_ptr<FenceTime>& presentFenceTime); 425 void rebuildLayerStacks(); 426 void setUpHWComposer(); 427 void doComposition(); 428 void doDebugFlashRegions(); 429 void doDisplayComposition(const sp<const DisplayDevice>& displayDevice, const Region& dirtyRegion); 430 431 // compose surfaces for display hw. this fails if using GL and the surface 432 // has been destroyed and is no longer valid. 433 bool doComposeSurfaces(const sp<const DisplayDevice>& displayDevice, const Region& dirty); 434 435 void postFramebuffer(); 436 void drawWormhole(const sp<const DisplayDevice>& displayDevice, const Region& region) const; 437 438 /* ------------------------------------------------------------------------ 439 * Display management 440 */ 441 442 /* ------------------------------------------------------------------------ 443 * VSync 444 */ 445 void enableHardwareVsync(); 446 void resyncToHardwareVsync(bool makeAvailable); 447 void disableHardwareVsync(bool makeUnavailable); 448 449public: 450 void resyncWithRateLimit(); 451 void getCompositorTiming(CompositorTiming* compositorTiming); 452private: 453 454 /* ------------------------------------------------------------------------ 455 * Debugging & dumpsys 456 */ 457 void listLayersLocked(const Vector<String16>& args, size_t& index, String8& result) const; 458 void dumpStatsLocked(const Vector<String16>& args, size_t& index, String8& result) const; 459 void clearStatsLocked(const Vector<String16>& args, size_t& index, String8& result); 460 void dumpAllLocked(const Vector<String16>& args, size_t& index, String8& result) const; 461 bool startDdmConnection(); 462 void appendSfConfigString(String8& result) const; 463 void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr, 464 const sp<const DisplayDevice>& hw, 465 int32_t minLayerZ, int32_t maxLayerZ); 466 467 void logFrameStats(); 468 469 void dumpStaticScreenStats(String8& result) const; 470 // Not const because each Layer needs to query Fences and cache timestamps. 471 void dumpFrameEventsLocked(String8& result); 472 473 void recordBufferingStats(const char* layerName, 474 std::vector<OccupancyTracker::Segment>&& history); 475 void dumpBufferingStats(String8& result) const; 476 477 bool isLayerTripleBufferingDisabled() const { 478 return this->mLayerTripleBufferingDisabled; 479 } 480 481#ifdef USE_HWC2 482 /* ------------------------------------------------------------------------ 483 * VrFlinger 484 */ 485 void clearHwcLayers(const LayerVector& layers); 486 void resetHwc(); 487 488 // Check to see if we should change to or from vr mode, and if so, perform 489 // the handoff. 490 void updateVrMode(); 491#endif 492 493 /* ------------------------------------------------------------------------ 494 * Attributes 495 */ 496 497 // access must be protected by mStateLock 498 mutable Mutex mStateLock; 499 State mCurrentState; 500 volatile int32_t mTransactionFlags; 501 Condition mTransactionCV; 502 bool mTransactionPending; 503 bool mAnimTransactionPending; 504 SortedVector< sp<Layer> > mLayersPendingRemoval; 505 SortedVector< wp<IBinder> > mGraphicBufferProducerList; 506 507 // protected by mStateLock (but we could use another lock) 508 bool mLayersRemoved; 509 bool mLayersAdded; 510 511 // access must be protected by mInvalidateLock 512 volatile int32_t mRepaintEverything; 513 514 // current, real and vr hardware composers. 515 HWComposer* mHwc; 516#ifdef USE_HWC2 517 HWComposer* mRealHwc; 518 HWComposer* mVrHwc; 519#endif 520 // constant members (no synchronization needed for access) 521 RenderEngine* mRenderEngine; 522 nsecs_t mBootTime; 523 bool mGpuToCpuSupported; 524 sp<EventThread> mEventThread; 525 sp<EventThread> mSFEventThread; 526 sp<EventThread> mInjectorEventThread; 527 sp<InjectVSyncSource> mVSyncInjector; 528 sp<EventControlThread> mEventControlThread; 529 EGLContext mEGLContext; 530 EGLDisplay mEGLDisplay; 531 sp<IBinder> mBuiltinDisplays[DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES]; 532 533#ifdef USE_HWC2 534 std::unique_ptr<dvr::VrFlinger> mVrFlinger; 535#endif 536 537 // Can only accessed from the main thread, these members 538 // don't need synchronization 539 State mDrawingState; 540 bool mVisibleRegionsDirty; 541#ifndef USE_HWC2 542 bool mHwWorkListDirty; 543#else 544 bool mGeometryInvalid; 545#endif 546 bool mAnimCompositionPending; 547#ifdef USE_HWC2 548 std::vector<sp<Layer>> mLayersWithQueuedFrames; 549 sp<Fence> mPreviousPresentFence = Fence::NO_FENCE; 550 bool mHadClientComposition = false; 551#endif 552 FenceTimeline mGlCompositionDoneTimeline; 553 FenceTimeline mDisplayTimeline; 554 555 // this may only be written from the main thread with mStateLock held 556 // it may be read from other threads with mStateLock held 557 DefaultKeyedVector< wp<IBinder>, sp<DisplayDevice> > mDisplays; 558 559 // don't use a lock for these, we don't care 560 int mVrModeSupported; 561 int mDebugRegion; 562 int mDebugDDMS; 563 int mDebugDisableHWC; 564 int mDebugDisableTransformHint; 565 volatile nsecs_t mDebugInSwapBuffers; 566 nsecs_t mLastSwapBufferTime; 567 volatile nsecs_t mDebugInTransaction; 568 nsecs_t mLastTransactionTime; 569 bool mBootFinished; 570 bool mForceFullDamage; 571#ifdef USE_HWC2 572 bool mPropagateBackpressure = true; 573#endif 574 SurfaceInterceptor mInterceptor; 575 bool mUseHwcVirtualDisplays = false; 576 577 // Restrict layers to use two buffers in their bufferqueues. 578 bool mLayerTripleBufferingDisabled = false; 579 580 // these are thread safe 581 mutable MessageQueue mEventQueue; 582 FrameTracker mAnimFrameTracker; 583 DispSync mPrimaryDispSync; 584 585 // protected by mDestroyedLayerLock; 586 mutable Mutex mDestroyedLayerLock; 587 Vector<Layer const *> mDestroyedLayers; 588 589 // protected by mHWVsyncLock 590 Mutex mHWVsyncLock; 591 bool mPrimaryHWVsyncEnabled; 592 bool mHWVsyncAvailable; 593 594 // protected by mCompositorTimingLock; 595 mutable std::mutex mCompositeTimingLock; 596 CompositorTiming mCompositorTiming; 597 598 // Only accessed from the main thread. 599 struct CompositePresentTime { 600 nsecs_t composite { -1 }; 601 std::shared_ptr<FenceTime> display { FenceTime::NO_FENCE }; 602 }; 603 std::queue<CompositePresentTime> mCompositePresentTimes; 604 605 /* ------------------------------------------------------------------------ 606 * Feature prototyping 607 */ 608 609 bool mInjectVSyncs; 610 611 Daltonizer mDaltonizer; 612#ifndef USE_HWC2 613 bool mDaltonize; 614#endif 615 616 mat4 mPreviousColorMatrix; 617 mat4 mColorMatrix; 618 bool mHasColorMatrix; 619 620 // Static screen stats 621 bool mHasPoweredOff; 622 static const size_t NUM_BUCKETS = 8; // < 1-7, 7+ 623 nsecs_t mFrameBuckets[NUM_BUCKETS]; 624 nsecs_t mTotalTime; 625 std::atomic<nsecs_t> mLastSwapTime; 626 627 size_t mNumLayers; 628 629 // Double- vs. triple-buffering stats 630 struct BufferingStats { 631 BufferingStats() 632 : numSegments(0), 633 totalTime(0), 634 twoBufferTime(0), 635 doubleBufferedTime(0), 636 tripleBufferedTime(0) {} 637 638 size_t numSegments; 639 nsecs_t totalTime; 640 641 // "Two buffer" means that a third buffer was never used, whereas 642 // "double-buffered" means that on average the segment only used two 643 // buffers (though it may have used a third for some part of the 644 // segment) 645 nsecs_t twoBufferTime; 646 nsecs_t doubleBufferedTime; 647 nsecs_t tripleBufferedTime; 648 }; 649 mutable Mutex mBufferingStatsMutex; 650 std::unordered_map<std::string, BufferingStats> mBufferingStats; 651 652 // Verify that transaction is being called by an approved process: 653 // either AID_GRAPHICS or AID_SYSTEM. 654 status_t CheckTransactCodeCredentials(uint32_t code); 655 656#ifdef USE_HWC2 657 sp<VrStateCallbacks> mVrStateCallbacks; 658 659 std::atomic<bool> mEnterVrMode; 660#endif 661 }; 662 663}; // namespace android 664 665#endif // ANDROID_SURFACE_FLINGER_H 666