xref: /aosp_15_r20/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker  * Copyright 2013 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker  *
4*38e8c45fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker  *
8*38e8c45fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker  *
10*38e8c45fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker  * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker  */
16*38e8c45fSAndroid Build Coastguard Worker 
17*38e8c45fSAndroid Build Coastguard Worker #pragma once
18*38e8c45fSAndroid Build Coastguard Worker 
19*38e8c45fSAndroid Build Coastguard Worker #include <optional>
20*38e8c45fSAndroid Build Coastguard Worker #include <string>
21*38e8c45fSAndroid Build Coastguard Worker 
22*38e8c45fSAndroid Build Coastguard Worker #include <compositionengine/DisplaySurface.h>
23*38e8c45fSAndroid Build Coastguard Worker #include <gui/BufferQueue.h>
24*38e8c45fSAndroid Build Coastguard Worker #include <gui/ConsumerBase.h>
25*38e8c45fSAndroid Build Coastguard Worker #include <gui/IGraphicBufferProducer.h>
26*38e8c45fSAndroid Build Coastguard Worker #include <ui/DisplayId.h>
27*38e8c45fSAndroid Build Coastguard Worker 
28*38e8c45fSAndroid Build Coastguard Worker #include <ui/DisplayIdentification.h>
29*38e8c45fSAndroid Build Coastguard Worker 
30*38e8c45fSAndroid Build Coastguard Worker namespace android {
31*38e8c45fSAndroid Build Coastguard Worker 
32*38e8c45fSAndroid Build Coastguard Worker class HWComposer;
33*38e8c45fSAndroid Build Coastguard Worker class IProducerListener;
34*38e8c45fSAndroid Build Coastguard Worker 
35*38e8c45fSAndroid Build Coastguard Worker /* This DisplaySurface implementation supports virtual displays, where GPU
36*38e8c45fSAndroid Build Coastguard Worker  * and/or HWC compose into a buffer that is then passed to an arbitrary
37*38e8c45fSAndroid Build Coastguard Worker  * consumer (the sink) running in another process.
38*38e8c45fSAndroid Build Coastguard Worker  *
39*38e8c45fSAndroid Build Coastguard Worker  * The simplest case is when the virtual display will never use the h/w
40*38e8c45fSAndroid Build Coastguard Worker  * composer -- either the h/w composer doesn't support writing to buffers, or
41*38e8c45fSAndroid Build Coastguard Worker  * there are more virtual displays than it supports simultaneously. In this
42*38e8c45fSAndroid Build Coastguard Worker  * case, the GPU driver works directly with the output buffer queue, and
43*38e8c45fSAndroid Build Coastguard Worker  * calls to the VirtualDisplay from SurfaceFlinger and DisplayHardware do
44*38e8c45fSAndroid Build Coastguard Worker  * nothing.
45*38e8c45fSAndroid Build Coastguard Worker  *
46*38e8c45fSAndroid Build Coastguard Worker  * If h/w composer might be used, then each frame will fall into one of three
47*38e8c45fSAndroid Build Coastguard Worker  * configurations: GPU-only, HWC-only, and MIXED composition. In all of these,
48*38e8c45fSAndroid Build Coastguard Worker  * we must provide a FB target buffer and output buffer for the HWC set() call.
49*38e8c45fSAndroid Build Coastguard Worker  *
50*38e8c45fSAndroid Build Coastguard Worker  * In GPU-only composition, the GPU driver is given a buffer from the sink to
51*38e8c45fSAndroid Build Coastguard Worker  * render into. When the GPU driver queues the buffer to the
52*38e8c45fSAndroid Build Coastguard Worker  * VirtualDisplaySurface, the VirtualDisplaySurface holds onto it instead of
53*38e8c45fSAndroid Build Coastguard Worker  * immediately queueing it to the sink. The buffer is used as both the FB
54*38e8c45fSAndroid Build Coastguard Worker  * target and output buffer for HWC, though on these frames the HWC doesn't
55*38e8c45fSAndroid Build Coastguard Worker  * do any work for this display and doesn't write to the output buffer. After
56*38e8c45fSAndroid Build Coastguard Worker  * composition is complete, the buffer is queued to the sink.
57*38e8c45fSAndroid Build Coastguard Worker  *
58*38e8c45fSAndroid Build Coastguard Worker  * In HWC-only composition, the VirtualDisplaySurface dequeues a buffer from
59*38e8c45fSAndroid Build Coastguard Worker  * the sink and passes it to HWC as both the FB target buffer and output
60*38e8c45fSAndroid Build Coastguard Worker  * buffer. The HWC doesn't need to read from the FB target buffer, but does
61*38e8c45fSAndroid Build Coastguard Worker  * write to the output buffer. After composition is complete, the buffer is
62*38e8c45fSAndroid Build Coastguard Worker  * queued to the sink.
63*38e8c45fSAndroid Build Coastguard Worker  *
64*38e8c45fSAndroid Build Coastguard Worker  * On MIXED frames, things become more complicated, since some h/w composer
65*38e8c45fSAndroid Build Coastguard Worker  * implementations can't read from and write to the same buffer. This class has
66*38e8c45fSAndroid Build Coastguard Worker  * an internal BufferQueue that it uses as a scratch buffer pool. The GPU
67*38e8c45fSAndroid Build Coastguard Worker  * driver is given a scratch buffer to render into. When it finishes rendering,
68*38e8c45fSAndroid Build Coastguard Worker  * the buffer is queued and then immediately acquired by the
69*38e8c45fSAndroid Build Coastguard Worker  * VirtualDisplaySurface. The scratch buffer is then used as the FB target
70*38e8c45fSAndroid Build Coastguard Worker  * buffer for HWC, and a separate buffer is dequeued from the sink and used as
71*38e8c45fSAndroid Build Coastguard Worker  * the HWC output buffer. When HWC composition is complete, the scratch buffer
72*38e8c45fSAndroid Build Coastguard Worker  * is released and the output buffer is queued to the sink.
73*38e8c45fSAndroid Build Coastguard Worker  */
74*38e8c45fSAndroid Build Coastguard Worker class VirtualDisplaySurface : public compositionengine::DisplaySurface,
75*38e8c45fSAndroid Build Coastguard Worker                               public BnGraphicBufferProducer,
76*38e8c45fSAndroid Build Coastguard Worker                               private ConsumerBase {
77*38e8c45fSAndroid Build Coastguard Worker public:
78*38e8c45fSAndroid Build Coastguard Worker     VirtualDisplaySurface(HWComposer&, VirtualDisplayId, const sp<IGraphicBufferProducer>& sink,
79*38e8c45fSAndroid Build Coastguard Worker                           const sp<IGraphicBufferProducer>& bqProducer,
80*38e8c45fSAndroid Build Coastguard Worker                           const sp<IGraphicBufferConsumer>& bqConsumer, const std::string& name);
81*38e8c45fSAndroid Build Coastguard Worker 
82*38e8c45fSAndroid Build Coastguard Worker     //
83*38e8c45fSAndroid Build Coastguard Worker     // DisplaySurface interface
84*38e8c45fSAndroid Build Coastguard Worker     //
85*38e8c45fSAndroid Build Coastguard Worker     virtual status_t beginFrame(bool mustRecompose);
86*38e8c45fSAndroid Build Coastguard Worker     virtual status_t prepareFrame(CompositionType);
87*38e8c45fSAndroid Build Coastguard Worker     virtual status_t advanceFrame(float hdrSdrRatio);
88*38e8c45fSAndroid Build Coastguard Worker     virtual void onFrameCommitted();
89*38e8c45fSAndroid Build Coastguard Worker     virtual void dumpAsString(String8& result) const;
90*38e8c45fSAndroid Build Coastguard Worker     virtual void resizeBuffers(const ui::Size&) override;
91*38e8c45fSAndroid Build Coastguard Worker     virtual const sp<Fence>& getClientTargetAcquireFence() const override;
92*38e8c45fSAndroid Build Coastguard Worker     // Virtual display surface needs to prepare the frame based on composition type. Skip
93*38e8c45fSAndroid Build Coastguard Worker     // any client composition prediction.
supportsCompositionStrategyPrediction()94*38e8c45fSAndroid Build Coastguard Worker     virtual bool supportsCompositionStrategyPrediction() const override { return false; };
95*38e8c45fSAndroid Build Coastguard Worker 
96*38e8c45fSAndroid Build Coastguard Worker private:
97*38e8c45fSAndroid Build Coastguard Worker     enum Source : size_t {
98*38e8c45fSAndroid Build Coastguard Worker         SOURCE_SINK = 0,
99*38e8c45fSAndroid Build Coastguard Worker         SOURCE_SCRATCH = 1,
100*38e8c45fSAndroid Build Coastguard Worker 
101*38e8c45fSAndroid Build Coastguard Worker         ftl_first = SOURCE_SINK,
102*38e8c45fSAndroid Build Coastguard Worker         ftl_last = SOURCE_SCRATCH,
103*38e8c45fSAndroid Build Coastguard Worker     };
104*38e8c45fSAndroid Build Coastguard Worker 
105*38e8c45fSAndroid Build Coastguard Worker     virtual ~VirtualDisplaySurface();
106*38e8c45fSAndroid Build Coastguard Worker 
107*38e8c45fSAndroid Build Coastguard Worker     //
108*38e8c45fSAndroid Build Coastguard Worker     // IGraphicBufferProducer interface, used by the GPU driver.
109*38e8c45fSAndroid Build Coastguard Worker     //
110*38e8c45fSAndroid Build Coastguard Worker     virtual status_t requestBuffer(int pslot, sp<GraphicBuffer>* outBuf);
111*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setMaxDequeuedBufferCount(int maxDequeuedBuffers);
112*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setAsyncMode(bool async);
113*38e8c45fSAndroid Build Coastguard Worker     virtual status_t dequeueBuffer(int* pslot, sp<Fence>*, uint32_t w, uint32_t h, PixelFormat,
114*38e8c45fSAndroid Build Coastguard Worker                                    uint64_t usage, uint64_t* outBufferAge,
115*38e8c45fSAndroid Build Coastguard Worker                                    FrameEventHistoryDelta* outTimestamps);
116*38e8c45fSAndroid Build Coastguard Worker     virtual status_t detachBuffer(int slot);
117*38e8c45fSAndroid Build Coastguard Worker     virtual status_t detachNextBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence);
118*38e8c45fSAndroid Build Coastguard Worker     virtual status_t attachBuffer(int* slot, const sp<GraphicBuffer>&);
119*38e8c45fSAndroid Build Coastguard Worker     virtual status_t queueBuffer(int pslot, const QueueBufferInput&, QueueBufferOutput*);
120*38e8c45fSAndroid Build Coastguard Worker     virtual status_t cancelBuffer(int pslot, const sp<Fence>&);
121*38e8c45fSAndroid Build Coastguard Worker     virtual int query(int what, int* value);
122*38e8c45fSAndroid Build Coastguard Worker     virtual status_t connect(const sp<IProducerListener>&, int api, bool producerControlledByApp,
123*38e8c45fSAndroid Build Coastguard Worker                              QueueBufferOutput*);
124*38e8c45fSAndroid Build Coastguard Worker     virtual status_t disconnect(int api, DisconnectMode);
125*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setSidebandStream(const sp<NativeHandle>& stream);
126*38e8c45fSAndroid Build Coastguard Worker     virtual void allocateBuffers(uint32_t width, uint32_t height, PixelFormat, uint64_t usage);
127*38e8c45fSAndroid Build Coastguard Worker     virtual status_t allowAllocation(bool allow);
128*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setGenerationNumber(uint32_t);
129*38e8c45fSAndroid Build Coastguard Worker     virtual String8 getConsumerName() const override;
130*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setSharedBufferMode(bool sharedBufferMode) override;
131*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setAutoRefresh(bool autoRefresh) override;
132*38e8c45fSAndroid Build Coastguard Worker     virtual status_t setDequeueTimeout(nsecs_t timeout) override;
133*38e8c45fSAndroid Build Coastguard Worker     virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
134*38e8c45fSAndroid Build Coastguard Worker             sp<Fence>* outFence, float outTransformMatrix[16]) override;
135*38e8c45fSAndroid Build Coastguard Worker     virtual status_t getUniqueId(uint64_t* outId) const override;
136*38e8c45fSAndroid Build Coastguard Worker     virtual status_t getConsumerUsage(uint64_t* outUsage) const override;
137*38e8c45fSAndroid Build Coastguard Worker 
138*38e8c45fSAndroid Build Coastguard Worker     //
139*38e8c45fSAndroid Build Coastguard Worker     // Utility methods
140*38e8c45fSAndroid Build Coastguard Worker     //
141*38e8c45fSAndroid Build Coastguard Worker     static Source fbSourceForCompositionType(CompositionType);
142*38e8c45fSAndroid Build Coastguard Worker     static std::string toString(CompositionType);
143*38e8c45fSAndroid Build Coastguard Worker 
144*38e8c45fSAndroid Build Coastguard Worker     status_t dequeueBuffer(Source, PixelFormat, uint64_t usage, int* sslot, sp<Fence>*);
145*38e8c45fSAndroid Build Coastguard Worker     void updateQueueBufferOutput(QueueBufferOutput&&);
146*38e8c45fSAndroid Build Coastguard Worker     void resetPerFrameState();
147*38e8c45fSAndroid Build Coastguard Worker     status_t refreshOutputBuffer();
148*38e8c45fSAndroid Build Coastguard Worker 
149*38e8c45fSAndroid Build Coastguard Worker     // Both the sink and scratch buffer pools have their own set of slots
150*38e8c45fSAndroid Build Coastguard Worker     // ("source slots", or "sslot"). We have to merge these into the single
151*38e8c45fSAndroid Build Coastguard Worker     // set of slots used by the graphics producer ("producer slots" or "pslot") and
152*38e8c45fSAndroid Build Coastguard Worker     // internally in the VirtualDisplaySurface. To minimize the number of times
153*38e8c45fSAndroid Build Coastguard Worker     // a producer slot switches which source it comes from, we map source slot
154*38e8c45fSAndroid Build Coastguard Worker     // numbers to producer slot numbers differently for each source.
155*38e8c45fSAndroid Build Coastguard Worker     static int mapSource2ProducerSlot(Source, int sslot);
156*38e8c45fSAndroid Build Coastguard Worker     static int mapProducer2SourceSlot(Source, int pslot);
157*38e8c45fSAndroid Build Coastguard Worker 
158*38e8c45fSAndroid Build Coastguard Worker     //
159*38e8c45fSAndroid Build Coastguard Worker     // Immutable after construction
160*38e8c45fSAndroid Build Coastguard Worker     //
161*38e8c45fSAndroid Build Coastguard Worker     HWComposer& mHwc;
162*38e8c45fSAndroid Build Coastguard Worker     const VirtualDisplayId mDisplayId;
163*38e8c45fSAndroid Build Coastguard Worker     const std::string mDisplayName;
164*38e8c45fSAndroid Build Coastguard Worker     sp<IGraphicBufferProducer> mSource[2]; // indexed by SOURCE_*
165*38e8c45fSAndroid Build Coastguard Worker     uint32_t mDefaultOutputFormat;
166*38e8c45fSAndroid Build Coastguard Worker 
167*38e8c45fSAndroid Build Coastguard Worker     // Buffers that HWC has seen before, indexed by HWC slot number.
168*38e8c45fSAndroid Build Coastguard Worker     // NOTE: The BufferQueue slot number is the same as the HWC slot number.
169*38e8c45fSAndroid Build Coastguard Worker     uint64_t mHwcBufferIds[BufferQueue::NUM_BUFFER_SLOTS];
170*38e8c45fSAndroid Build Coastguard Worker 
171*38e8c45fSAndroid Build Coastguard Worker     //
172*38e8c45fSAndroid Build Coastguard Worker     // Inter-frame state
173*38e8c45fSAndroid Build Coastguard Worker     //
174*38e8c45fSAndroid Build Coastguard Worker 
175*38e8c45fSAndroid Build Coastguard Worker     // To avoid buffer reallocations, we track the buffer usage and format
176*38e8c45fSAndroid Build Coastguard Worker     // we used on the previous frame and use it again on the new frame. If
177*38e8c45fSAndroid Build Coastguard Worker     // the composition type changes or the GPU driver starts requesting
178*38e8c45fSAndroid Build Coastguard Worker     // different usage/format, we'll get a new buffer.
179*38e8c45fSAndroid Build Coastguard Worker     uint32_t mOutputFormat;
180*38e8c45fSAndroid Build Coastguard Worker     uint64_t mOutputUsage;
181*38e8c45fSAndroid Build Coastguard Worker 
182*38e8c45fSAndroid Build Coastguard Worker     // Since we present a single producer interface to the GPU driver, but
183*38e8c45fSAndroid Build Coastguard Worker     // are internally muxing between the sink and scratch producers, we have
184*38e8c45fSAndroid Build Coastguard Worker     // to keep track of which source last returned each producer slot from
185*38e8c45fSAndroid Build Coastguard Worker     // dequeueBuffer. Each bit in mProducerSlotSource corresponds to a producer
186*38e8c45fSAndroid Build Coastguard Worker     // slot. Both mProducerSlotSource and mProducerBuffers are indexed by a
187*38e8c45fSAndroid Build Coastguard Worker     // "producer slot"; see the mapSlot*() functions.
188*38e8c45fSAndroid Build Coastguard Worker     uint64_t mProducerSlotSource;
189*38e8c45fSAndroid Build Coastguard Worker     sp<GraphicBuffer> mProducerBuffers[BufferQueueDefs::NUM_BUFFER_SLOTS];
190*38e8c45fSAndroid Build Coastguard Worker 
191*38e8c45fSAndroid Build Coastguard Worker     // Need to propagate reallocation to VDS consumer.
192*38e8c45fSAndroid Build Coastguard Worker     // Each bit corresponds to a producer slot.
193*38e8c45fSAndroid Build Coastguard Worker     uint64_t mProducerSlotNeedReallocation;
194*38e8c45fSAndroid Build Coastguard Worker 
195*38e8c45fSAndroid Build Coastguard Worker     // The QueueBufferOutput with the latest info from the sink, and with the
196*38e8c45fSAndroid Build Coastguard Worker     // transform hint cleared. Since we defer queueBuffer from the GPU driver
197*38e8c45fSAndroid Build Coastguard Worker     // to the sink, we have to return the previous version.
198*38e8c45fSAndroid Build Coastguard Worker     // Moves instead of copies are performed to avoid duplicate
199*38e8c45fSAndroid Build Coastguard Worker     // FrameEventHistoryDeltas.
200*38e8c45fSAndroid Build Coastguard Worker     QueueBufferOutput mQueueBufferOutput;
201*38e8c45fSAndroid Build Coastguard Worker 
202*38e8c45fSAndroid Build Coastguard Worker     // Details of the current sink buffer. These become valid when a buffer is
203*38e8c45fSAndroid Build Coastguard Worker     // dequeued from the sink, and are used when queueing the buffer.
204*38e8c45fSAndroid Build Coastguard Worker     uint32_t mSinkBufferWidth, mSinkBufferHeight;
205*38e8c45fSAndroid Build Coastguard Worker 
206*38e8c45fSAndroid Build Coastguard Worker     //
207*38e8c45fSAndroid Build Coastguard Worker     // Intra-frame state
208*38e8c45fSAndroid Build Coastguard Worker     //
209*38e8c45fSAndroid Build Coastguard Worker 
210*38e8c45fSAndroid Build Coastguard Worker     // Composition type and graphics buffer source for the current frame.
211*38e8c45fSAndroid Build Coastguard Worker     // Valid after prepareFrame(), cleared in onFrameCommitted.
212*38e8c45fSAndroid Build Coastguard Worker     CompositionType mCompositionType = CompositionType::Unknown;
213*38e8c45fSAndroid Build Coastguard Worker 
214*38e8c45fSAndroid Build Coastguard Worker     // mFbFence is the fence HWC should wait for before reading the framebuffer
215*38e8c45fSAndroid Build Coastguard Worker     // target buffer.
216*38e8c45fSAndroid Build Coastguard Worker     sp<Fence> mFbFence;
217*38e8c45fSAndroid Build Coastguard Worker 
218*38e8c45fSAndroid Build Coastguard Worker     // mOutputFence is the fence HWC should wait for before writing to the
219*38e8c45fSAndroid Build Coastguard Worker     // output buffer.
220*38e8c45fSAndroid Build Coastguard Worker     sp<Fence> mOutputFence;
221*38e8c45fSAndroid Build Coastguard Worker 
222*38e8c45fSAndroid Build Coastguard Worker     // Producer slot numbers for the buffers to use for HWC framebuffer target
223*38e8c45fSAndroid Build Coastguard Worker     // and output.
224*38e8c45fSAndroid Build Coastguard Worker     int mFbProducerSlot;
225*38e8c45fSAndroid Build Coastguard Worker     int mOutputProducerSlot;
226*38e8c45fSAndroid Build Coastguard Worker 
227*38e8c45fSAndroid Build Coastguard Worker     // Debug only -- track the sequence of events in each frame so we can make
228*38e8c45fSAndroid Build Coastguard Worker     // sure they happen in the order we expect. This class implicitly models
229*38e8c45fSAndroid Build Coastguard Worker     // a state machine; this enum/variable makes it explicit.
230*38e8c45fSAndroid Build Coastguard Worker     //
231*38e8c45fSAndroid Build Coastguard Worker     // +-----------+-------------------+-------------+
232*38e8c45fSAndroid Build Coastguard Worker     // | State     | Event             || Next State |
233*38e8c45fSAndroid Build Coastguard Worker     // +-----------+-------------------+-------------+
234*38e8c45fSAndroid Build Coastguard Worker     // | Idle      | beginFrame        || Begun      |
235*38e8c45fSAndroid Build Coastguard Worker     // | Begun     | prepareFrame      || Prepared   |
236*38e8c45fSAndroid Build Coastguard Worker     // | Prepared  | dequeueBuffer [1] || Gpu        |
237*38e8c45fSAndroid Build Coastguard Worker     // | Prepared  | advanceFrame [2]  || Hwc        |
238*38e8c45fSAndroid Build Coastguard Worker     // | Gpu       | queueBuffer       || GpuDone    |
239*38e8c45fSAndroid Build Coastguard Worker     // | GpuDone   | advanceFrame      || Hwc        |
240*38e8c45fSAndroid Build Coastguard Worker     // | Hwc       | onFrameCommitted  || Idle       |
241*38e8c45fSAndroid Build Coastguard Worker     // +-----------+-------------------++------------+
242*38e8c45fSAndroid Build Coastguard Worker     // [1] CompositionType::Gpu and CompositionType::Mixed frames.
243*38e8c45fSAndroid Build Coastguard Worker     // [2] CompositionType::Hwc frames.
244*38e8c45fSAndroid Build Coastguard Worker     //
245*38e8c45fSAndroid Build Coastguard Worker     enum class DebugState {
246*38e8c45fSAndroid Build Coastguard Worker         // no buffer dequeued, don't know anything about the next frame
247*38e8c45fSAndroid Build Coastguard Worker         Idle,
248*38e8c45fSAndroid Build Coastguard Worker         // output buffer dequeued, framebuffer source not yet known
249*38e8c45fSAndroid Build Coastguard Worker         Begun,
250*38e8c45fSAndroid Build Coastguard Worker         // output buffer dequeued, framebuffer source known but not provided
251*38e8c45fSAndroid Build Coastguard Worker         // to GPU yet.
252*38e8c45fSAndroid Build Coastguard Worker         Prepared,
253*38e8c45fSAndroid Build Coastguard Worker         // GPU driver has a buffer dequeued
254*38e8c45fSAndroid Build Coastguard Worker         Gpu,
255*38e8c45fSAndroid Build Coastguard Worker         // GPU driver has queued the buffer, we haven't sent it to HWC yet
256*38e8c45fSAndroid Build Coastguard Worker         GpuDone,
257*38e8c45fSAndroid Build Coastguard Worker         // HWC has the buffer for this frame
258*38e8c45fSAndroid Build Coastguard Worker         Hwc,
259*38e8c45fSAndroid Build Coastguard Worker 
260*38e8c45fSAndroid Build Coastguard Worker         ftl_last = Hwc
261*38e8c45fSAndroid Build Coastguard Worker     };
262*38e8c45fSAndroid Build Coastguard Worker     DebugState mDebugState = DebugState::Idle;
263*38e8c45fSAndroid Build Coastguard Worker     CompositionType mDebugLastCompositionType = CompositionType::Unknown;
264*38e8c45fSAndroid Build Coastguard Worker 
265*38e8c45fSAndroid Build Coastguard Worker     bool mMustRecompose = false;
266*38e8c45fSAndroid Build Coastguard Worker 
267*38e8c45fSAndroid Build Coastguard Worker     bool mForceHwcCopy;
268*38e8c45fSAndroid Build Coastguard Worker };
269*38e8c45fSAndroid Build Coastguard Worker 
270*38e8c45fSAndroid Build Coastguard Worker } // namespace android
271