2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_SURFACE_FLINGER_H
18 #define ANDROID_SURFACE_FLINGER_H
22 #include <sys/types.h>
27 * NOTE: Make sure this file doesn't include anything from <gl/ > or <gl2/ >
30 #include <cutils/compiler.h>
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>
39 #include <ui/FenceTime.h>
40 #include <ui/PixelFormat.h>
41 #include <math/mat4.h>
43 #include <gui/FrameTimestamps.h>
44 #include <gui/ISurfaceComposer.h>
45 #include <gui/ISurfaceComposerClient.h>
46 #include <gui/OccupancyTracker.h>
48 #include <hardware/hwcomposer_defs.h>
50 #include <system/graphics.h>
52 #include <private/gui/LayerState.h>
55 #include "DisplayDevice.h"
57 #include "FrameTracker.h"
58 #include "LayerVector.h"
59 #include "MessageQueue.h"
60 #include "SurfaceInterceptor.h"
61 #include "StartBootAnimThread.h"
63 #include "DisplayHardware/HWComposer.h"
64 #include "Effects/Daltonizer.h"
74 // ---------------------------------------------------------------------------
77 class DisplayEventConnection;
83 class EventControlThread;
85 class InjectVSyncSource;
91 // ---------------------------------------------------------------------------
94 eTransactionNeeded = 0x01,
95 eTraversalNeeded = 0x02,
96 eDisplayTransactionNeeded = 0x04,
97 eTransactionMask = 0x07
100 class SurfaceFlinger : public BnSurfaceComposer,
101 private IBinder::DeathRecipient,
102 private HWComposer::EventHandler
106 // This is the phase offset in nanoseconds of the software vsync event
107 // relative to the vsync event reported by HWComposer. The software vsync
108 // event is when SurfaceFlinger and Choreographer-based applications run each
111 // This phase offset allows adjustment of the minimum latency from application
112 // wake-up time (by Choreographer) to the time at which the resulting window
113 // image is displayed. This value may be either positive (after the HW vsync)
114 // or negative (before the HW vsync). Setting it to 0 will result in a lower
115 // latency bound of two vsync periods because the app and SurfaceFlinger
116 // will run just after the HW vsync. Setting it to a positive number will
117 // result in the minimum latency being:
119 // (2 * VSYNC_PERIOD - (vsyncPhaseOffsetNs % VSYNC_PERIOD))
121 // Note that reducing this latency makes it more likely for the applications
122 // to not have their window content image ready in time. When this happens
123 // the latency will end up being an additional vsync period, and animations
124 // will hiccup. Therefore, this latency should be tuned somewhat
125 // conservatively (or at least with awareness of the trade-off being made).
126 static int64_t vsyncPhaseOffsetNs;
127 static int64_t sfVsyncPhaseOffsetNs;
129 // If fences from sync Framework are supported.
130 static bool hasSyncFramework;
132 // Instruct the Render Engine to use EGL_IMG_context_priority is available.
133 static bool useContextPriority;
135 // The offset in nanoseconds to use when DispSync timestamps present fence
137 static int64_t dispSyncPresentTimeOffset;
139 // Some hardware can do RGB->YUV conversion more efficiently in hardware
140 // controlled by HWC than in hardware controlled by the video encoder.
141 // This instruct VirtualDisplaySurface to use HWC for such conversion on
143 static bool useHwcForRgbToYuv;
145 // Maximum dimension supported by HWC for virtual display.
146 // Equal to min(max_height, max_width).
147 static uint64_t maxVirtualDisplaySize;
149 // Controls the number of buffers SurfaceFlinger will allocate for use in
150 // FramebufferSurface
151 static int64_t maxFrameBufferAcquiredBuffers;
153 // Indicate if platform supports color management on its
154 // wide-color display. This is typically found on devices
155 // with wide gamut (e.g. Display-P3) display.
156 // This also allows devices with wide-color displays that don't
157 // want to support color management to disable color management.
158 static bool hasWideColorDisplay;
160 static char const* getServiceName() ANDROID_API {
161 return "SurfaceFlinger";
164 SurfaceFlinger() ANDROID_API;
166 // must be called before clients can connect
167 void init() ANDROID_API;
169 // starts SurfaceFlinger main loop in the current thread
170 void run() ANDROID_API;
173 EVENT_VSYNC = HWC_EVENT_VSYNC
176 // post an asynchronous message to the main thread
177 status_t postMessageAsync(const sp<MessageBase>& msg, nsecs_t reltime = 0, uint32_t flags = 0);
179 // post a synchronous message to the main thread
180 status_t postMessageSync(const sp<MessageBase>& msg, nsecs_t reltime = 0, uint32_t flags = 0);
182 // force full composition on all displays
183 void repaintEverything();
185 // returns the default Display
186 sp<const DisplayDevice> getDefaultDisplayDevice() const {
187 Mutex::Autolock _l(mStateLock);
188 return getDefaultDisplayDeviceLocked();
191 // utility function to delete a texture on the main thread
192 void deleteTextureAsync(uint32_t texture);
194 // enable/disable h/w composer event
195 // TODO: this should be made accessible only to EventThread
197 void setVsyncEnabled(int disp, int enabled);
199 void eventControl(int disp, int event, int enabled);
202 // called on the main thread by MessageQueue when an internal message
204 // TODO: this should be made accessible only to MessageQueue
205 void onMessageReceived(int32_t what);
207 // for debugging only
208 // TODO: this should be made accessible only to HWComposer
209 const Vector< sp<Layer> >& getLayerSortedByZForHwcDisplay(int id);
211 RenderEngine& getRenderEngine() const {
212 return *mRenderEngine;
215 bool authenticateSurfaceTextureLocked(
216 const sp<IGraphicBufferProducer>& bufferProducer) const;
220 friend class DisplayEventConnection;
221 friend class EventThread;
223 friend class MonitoredProducer;
225 // This value is specified in number of frames. Log frame stats at most
227 enum { LOG_FRAME_STATS_PERIOD = 30*60*60 };
229 static const size_t MAX_LAYERS = 4096;
230 static constexpr const char* kTimestampProperty = "service.sf.present_timestamp";
232 // We're reference counted, never destroy SurfaceFlinger directly
233 virtual ~SurfaceFlinger();
235 /* ------------------------------------------------------------------------
236 * Internal data structures
241 explicit State(LayerVector::StateSet set) : stateSet(set) {}
242 State& operator=(const State& other) {
243 // We explicitly don't copy stateSet so that, e.g., mDrawingState
244 // always uses the Drawing StateSet.
245 layersSortedByZ = other.layersSortedByZ;
246 displays = other.displays;
250 const LayerVector::StateSet stateSet = LayerVector::StateSet::Invalid;
251 LayerVector layersSortedByZ;
252 DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> displays;
254 void traverseInZOrder(const LayerVector::Visitor& visitor) const;
255 void traverseInReverseZOrder(const LayerVector::Visitor& visitor) const;
258 /* ------------------------------------------------------------------------
261 virtual status_t onTransact(uint32_t code, const Parcel& data,
262 Parcel* reply, uint32_t flags);
263 virtual status_t dump(int fd, const Vector<String16>& args);
265 /* ------------------------------------------------------------------------
266 * ISurfaceComposer interface
268 virtual sp<ISurfaceComposerClient> createConnection();
269 virtual sp<ISurfaceComposerClient> createScopedConnection(const sp<IGraphicBufferProducer>& gbp);
270 virtual sp<IBinder> createDisplay(const String8& displayName, bool secure);
271 virtual void destroyDisplay(const sp<IBinder>& display);
272 virtual sp<IBinder> getBuiltInDisplay(int32_t id);
273 virtual void setTransactionState(const Vector<ComposerState>& state,
274 const Vector<DisplayState>& displays, uint32_t flags);
275 virtual void bootFinished();
276 virtual bool authenticateSurfaceTexture(
277 const sp<IGraphicBufferProducer>& bufferProducer) const;
278 virtual status_t getSupportedFrameTimestamps(
279 std::vector<FrameEvent>* outSupported) const;
280 virtual sp<IDisplayEventConnection> createDisplayEventConnection(
281 ISurfaceComposer::VsyncSource vsyncSource = eVsyncSourceApp);
282 virtual status_t captureScreen(const sp<IBinder>& display,
283 const sp<IGraphicBufferProducer>& producer,
284 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
285 int32_t minLayerZ, int32_t maxLayerZ,
286 bool useIdentityTransform, ISurfaceComposer::Rotation rotation);
287 virtual status_t getDisplayStats(const sp<IBinder>& display,
288 DisplayStatInfo* stats);
289 virtual status_t getDisplayConfigs(const sp<IBinder>& display,
290 Vector<DisplayInfo>* configs);
291 virtual int getActiveConfig(const sp<IBinder>& display);
292 virtual status_t getDisplayColorModes(const sp<IBinder>& display,
293 Vector<android_color_mode_t>* configs);
294 virtual android_color_mode_t getActiveColorMode(const sp<IBinder>& display);
295 virtual status_t setActiveColorMode(const sp<IBinder>& display, android_color_mode_t colorMode);
296 virtual void setPowerMode(const sp<IBinder>& display, int mode);
297 virtual status_t setActiveConfig(const sp<IBinder>& display, int id);
298 virtual status_t clearAnimationFrameStats();
299 virtual status_t getAnimationFrameStats(FrameStats* outStats) const;
300 virtual status_t getHdrCapabilities(const sp<IBinder>& display,
301 HdrCapabilities* outCapabilities) const;
302 virtual status_t enableVSyncInjections(bool enable);
303 virtual status_t injectVSync(nsecs_t when);
306 /* ------------------------------------------------------------------------
307 * DeathRecipient interface
309 virtual void binderDied(const wp<IBinder>& who);
311 /* ------------------------------------------------------------------------
314 virtual void onFirstRef();
316 /* ------------------------------------------------------------------------
317 * HWComposer::EventHandler interface
319 virtual void onVSyncReceived(HWComposer* composer, int type, nsecs_t timestamp);
320 virtual void onHotplugReceived(HWComposer* composer, int disp, bool connected);
321 virtual void onInvalidateReceived(HWComposer* composer);
323 /* ------------------------------------------------------------------------
327 void signalTransaction();
328 void signalLayerUpdate();
329 void signalRefresh();
331 // called on the main thread in response to initializeDisplays()
332 void onInitializeDisplays();
333 // called on the main thread in response to setActiveConfig()
334 void setActiveConfigInternal(const sp<DisplayDevice>& hw, int mode);
335 // called on the main thread in response to setPowerMode()
336 void setPowerModeInternal(const sp<DisplayDevice>& hw, int mode);
338 // Called on the main thread in response to setActiveColorMode()
339 void setActiveColorModeInternal(const sp<DisplayDevice>& hw, android_color_mode_t colorMode);
341 // Returns whether the transaction actually modified any state
342 bool handleMessageTransaction();
344 // Returns whether a new buffer has been latched (see handlePageFlip())
345 bool handleMessageInvalidate();
347 void handleMessageRefresh();
349 void handleTransaction(uint32_t transactionFlags);
350 void handleTransactionLocked(uint32_t transactionFlags);
352 void updateCursorAsync();
354 /* handlePageFlip - latch a new buffer if available and compute the dirty
355 * region. Returns whether a new buffer has been latched, i.e., whether it
356 * is necessary to perform a refresh during this vsync.
358 bool handlePageFlip();
360 /* ------------------------------------------------------------------------
363 uint32_t getTransactionFlags(uint32_t flags);
364 uint32_t peekTransactionFlags();
365 uint32_t setTransactionFlags(uint32_t flags);
366 void commitTransaction();
367 uint32_t setClientStateLocked(const sp<Client>& client, const layer_state_t& s);
368 uint32_t setDisplayStateLocked(const DisplayState& s);
370 /* ------------------------------------------------------------------------
373 status_t createLayer(const String8& name, const sp<Client>& client,
374 uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
375 uint32_t windowType, uint32_t ownerUid, sp<IBinder>* handle,
376 sp<IGraphicBufferProducer>* gbp, sp<Layer>* parent);
378 status_t createNormalLayer(const sp<Client>& client, const String8& name,
379 uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format,
380 sp<IBinder>* outHandle, sp<IGraphicBufferProducer>* outGbp,
381 sp<Layer>* outLayer);
383 status_t createDimLayer(const sp<Client>& client, const String8& name,
384 uint32_t w, uint32_t h, uint32_t flags, sp<IBinder>* outHandle,
385 sp<IGraphicBufferProducer>* outGbp, sp<Layer>* outLayer);
387 String8 getUniqueLayerName(const String8& name);
389 // called in response to the window-manager calling
390 // ISurfaceComposerClient::destroySurface()
391 status_t onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle);
393 // called when all clients have released all their references to
394 // this layer meaning it is entirely safe to destroy all
395 // resources associated to this layer.
396 status_t onLayerDestroyed(const wp<Layer>& layer);
398 // remove a layer from SurfaceFlinger immediately
399 status_t removeLayer(const sp<Layer>& layer, bool topLevelOnly = false);
401 // add a layer to SurfaceFlinger
402 status_t addClientLayer(const sp<Client>& client,
403 const sp<IBinder>& handle,
404 const sp<IGraphicBufferProducer>& gbc,
405 const sp<Layer>& lbc,
406 const sp<Layer>& parent);
408 /* ------------------------------------------------------------------------
409 * Boot animation, on/off animations and screen capture
412 void startBootAnim();
414 void renderScreenImplLocked(
415 const sp<const DisplayDevice>& hw,
416 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
417 int32_t minLayerZ, int32_t maxLayerZ,
418 bool yswap, bool useIdentityTransform, Transform::orientation_flags rotation);
420 status_t captureScreenImplLocked(
421 const sp<const DisplayDevice>& hw,
422 const sp<IGraphicBufferProducer>& producer,
423 Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
424 int32_t minLayerZ, int32_t maxLayerZ,
425 bool useIdentityTransform, Transform::orientation_flags rotation,
426 bool isLocalScreenshot);
428 sp<StartBootAnimThread> mStartBootAnimThread = nullptr;
430 /* ------------------------------------------------------------------------
433 size_t getMaxTextureSize() const;
434 size_t getMaxViewportDims() const;
436 /* ------------------------------------------------------------------------
437 * Display and layer stack management
439 // called when starting, or restarting after system_server death
440 void initializeDisplays();
442 // Create an IBinder for a builtin display and add it to current state
443 void createBuiltinDisplayLocked(DisplayDevice::DisplayType type);
446 sp<const DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) const {
447 Mutex::Autolock _l(mStateLock);
448 return getDisplayDeviceLocked(dpy);
451 sp<DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) {
452 Mutex::Autolock _l(mStateLock);
453 return getDisplayDeviceLocked(dpy);
456 // NOTE: can only be called from the main thread or with mStateLock held
457 sp<const DisplayDevice> getDisplayDeviceLocked(const wp<IBinder>& dpy) const {
458 return mDisplays.valueFor(dpy);
461 // NOTE: can only be called from the main thread or with mStateLock held
462 sp<DisplayDevice> getDisplayDeviceLocked(const wp<IBinder>& dpy) {
463 return mDisplays.valueFor(dpy);
466 sp<const DisplayDevice> getDefaultDisplayDeviceLocked() const {
467 return getDisplayDeviceLocked(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]);
470 void createDefaultDisplayDevice();
472 int32_t getDisplayType(const sp<IBinder>& display) {
473 if (!display.get()) return NAME_NOT_FOUND;
474 for (int i = 0; i < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES; ++i) {
475 if (display == mBuiltinDisplays[i]) {
479 return NAME_NOT_FOUND;
482 // mark a region of a layer stack dirty. this updates the dirty
483 // region of all screens presenting this layer stack.
484 void invalidateLayerStack(uint32_t layerStack, const Region& dirty);
487 int32_t allocateHwcDisplayId(DisplayDevice::DisplayType type);
490 /* ------------------------------------------------------------------------
494 HWComposer& getHwComposer() const { return *mHwc; }
496 /* ------------------------------------------------------------------------
499 void invalidateHwcGeometry();
500 void computeVisibleRegions(uint32_t layerStack,
501 Region& dirtyRegion, Region& opaqueRegion);
503 void preComposition(nsecs_t refreshStartTime);
504 void postComposition(nsecs_t refreshStartTime);
505 void updateCompositorTiming(
506 nsecs_t vsyncPhase, nsecs_t vsyncInterval, nsecs_t compositeTime,
507 std::shared_ptr<FenceTime>& presentFenceTime);
508 void setCompositorTimingSnapped(
509 nsecs_t vsyncPhase, nsecs_t vsyncInterval,
510 nsecs_t compositeToPresentLatency);
511 void rebuildLayerStacks();
513 // Given a dataSpace, returns the appropriate color_mode to use
514 // to display that dataSpace.
515 android_color_mode pickColorMode(android_dataspace dataSpace);
516 android_dataspace bestTargetDataSpace(android_dataspace a, android_dataspace b);
518 void setUpHWComposer();
519 void doComposition();
520 void doDebugFlashRegions();
521 void doDisplayComposition(const sp<const DisplayDevice>& displayDevice, const Region& dirtyRegion);
523 // compose surfaces for display hw. this fails if using GL and the surface
524 // has been destroyed and is no longer valid.
525 bool doComposeSurfaces(const sp<const DisplayDevice>& displayDevice, const Region& dirty);
527 void postFramebuffer();
528 void drawWormhole(const sp<const DisplayDevice>& displayDevice, const Region& region) const;
530 /* ------------------------------------------------------------------------
534 /* ------------------------------------------------------------------------
537 void enableHardwareVsync();
538 void resyncToHardwareVsync(bool makeAvailable);
539 void disableHardwareVsync(bool makeUnavailable);
542 void resyncWithRateLimit();
543 void getCompositorTiming(CompositorTiming* compositorTiming);
546 /* ------------------------------------------------------------------------
547 * Debugging & dumpsys
549 void listLayersLocked(const Vector<String16>& args, size_t& index, String8& result) const;
550 void dumpStatsLocked(const Vector<String16>& args, size_t& index, String8& result) const;
551 void clearStatsLocked(const Vector<String16>& args, size_t& index, String8& result);
552 void dumpAllLocked(const Vector<String16>& args, size_t& index, String8& result) const;
553 bool startDdmConnection();
554 void appendSfConfigString(String8& result) const;
555 void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr,
556 const sp<const DisplayDevice>& hw,
557 int32_t minLayerZ, int32_t maxLayerZ);
559 void logFrameStats();
561 void dumpStaticScreenStats(String8& result) const;
562 // Not const because each Layer needs to query Fences and cache timestamps.
563 void dumpFrameEventsLocked(String8& result);
565 void recordBufferingStats(const char* layerName,
566 std::vector<OccupancyTracker::Segment>&& history);
567 void dumpBufferingStats(String8& result) const;
568 void dumpWideColorInfo(String8& result) const;
570 bool isLayerTripleBufferingDisabled() const {
571 return this->mLayerTripleBufferingDisabled;
575 /* ------------------------------------------------------------------------
578 void clearHwcLayers(const LayerVector& layers);
579 void resetHwcLocked();
581 // Check to see if we should handoff to vr flinger.
582 void updateVrFlinger();
585 /* ------------------------------------------------------------------------
589 // access must be protected by mStateLock
590 mutable Mutex mStateLock;
591 State mCurrentState{LayerVector::StateSet::Current};
592 volatile int32_t mTransactionFlags;
593 Condition mTransactionCV;
594 bool mTransactionPending;
595 bool mAnimTransactionPending;
596 SortedVector< sp<Layer> > mLayersPendingRemoval;
597 SortedVector< wp<IBinder> > mGraphicBufferProducerList;
599 // protected by mStateLock (but we could use another lock)
603 // access must be protected by mInvalidateLock
604 volatile int32_t mRepaintEverything;
606 // current, real and vr hardware composers.
609 HWComposer* mRealHwc;
612 // constant members (no synchronization needed for access)
613 RenderEngine* mRenderEngine;
615 bool mGpuToCpuSupported;
616 sp<EventThread> mEventThread;
617 sp<EventThread> mSFEventThread;
618 sp<EventThread> mInjectorEventThread;
619 sp<InjectVSyncSource> mVSyncInjector;
620 sp<EventControlThread> mEventControlThread;
621 EGLContext mEGLContext;
622 EGLDisplay mEGLDisplay;
623 sp<IBinder> mBuiltinDisplays[DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES];
626 std::unique_ptr<dvr::VrFlinger> mVrFlinger;
629 // Can only accessed from the main thread, these members
630 // don't need synchronization
631 State mDrawingState{LayerVector::StateSet::Drawing};
632 bool mVisibleRegionsDirty;
634 bool mHwWorkListDirty;
636 bool mGeometryInvalid;
638 bool mAnimCompositionPending;
640 std::vector<sp<Layer>> mLayersWithQueuedFrames;
641 sp<Fence> mPreviousPresentFence = Fence::NO_FENCE;
642 bool mHadClientComposition = false;
644 FenceTimeline mGlCompositionDoneTimeline;
645 FenceTimeline mDisplayTimeline;
647 // this may only be written from the main thread with mStateLock held
648 // it may be read from other threads with mStateLock held
649 DefaultKeyedVector< wp<IBinder>, sp<DisplayDevice> > mDisplays;
651 // don't use a lock for these, we don't care
654 int mDebugDisableHWC;
655 int mDebugDisableTransformHint;
656 volatile nsecs_t mDebugInSwapBuffers;
657 nsecs_t mLastSwapBufferTime;
658 volatile nsecs_t mDebugInTransaction;
659 nsecs_t mLastTransactionTime;
661 bool mForceFullDamage;
663 bool mPropagateBackpressure = true;
665 SurfaceInterceptor mInterceptor;
666 bool mUseHwcVirtualDisplays = false;
668 // Restrict layers to use two buffers in their bufferqueues.
669 bool mLayerTripleBufferingDisabled = false;
671 // these are thread safe
672 mutable MessageQueue mEventQueue;
673 FrameTracker mAnimFrameTracker;
674 DispSync mPrimaryDispSync;
676 // protected by mDestroyedLayerLock;
677 mutable Mutex mDestroyedLayerLock;
678 Vector<Layer const *> mDestroyedLayers;
680 // protected by mHWVsyncLock
682 bool mPrimaryHWVsyncEnabled;
683 bool mHWVsyncAvailable;
685 // protected by mCompositorTimingLock;
686 mutable std::mutex mCompositorTimingLock;
687 CompositorTiming mCompositorTiming;
689 // Only accessed from the main thread.
690 struct CompositePresentTime {
691 nsecs_t composite { -1 };
692 std::shared_ptr<FenceTime> display { FenceTime::NO_FENCE };
694 std::queue<CompositePresentTime> mCompositePresentTimes;
696 /* ------------------------------------------------------------------------
697 * Feature prototyping
702 Daltonizer mDaltonizer;
707 mat4 mPreviousColorMatrix;
709 bool mHasColorMatrix;
711 // Static screen stats
713 static const size_t NUM_BUCKETS = 8; // < 1-7, 7+
714 nsecs_t mFrameBuckets[NUM_BUCKETS];
716 std::atomic<nsecs_t> mLastSwapTime;
720 // Double- vs. triple-buffering stats
721 struct BufferingStats {
726 doubleBufferedTime(0),
727 tripleBufferedTime(0) {}
732 // "Two buffer" means that a third buffer was never used, whereas
733 // "double-buffered" means that on average the segment only used two
734 // buffers (though it may have used a third for some part of the
736 nsecs_t twoBufferTime;
737 nsecs_t doubleBufferedTime;
738 nsecs_t tripleBufferedTime;
740 mutable Mutex mBufferingStatsMutex;
741 std::unordered_map<std::string, BufferingStats> mBufferingStats;
743 // Verify that transaction is being called by an approved process:
744 // either AID_GRAPHICS or AID_SYSTEM.
745 status_t CheckTransactCodeCredentials(uint32_t code);
748 std::atomic<bool> mVrFlingerRequestsDisplay;
749 static bool useVrFlinger;
752 }; // namespace android
754 #endif // ANDROID_SURFACE_FLINGER_H