1 /*
2  * Copyright (C) 2010 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_GUI_SURFACE_H
18 #define ANDROID_GUI_SURFACE_H
19 
20 #include <gui/BufferQueueDefs.h>
21 #include <gui/HdrMetadata.h>
22 #include <gui/IGraphicBufferProducer.h>
23 #include <gui/IProducerListener.h>
24 #include <system/window.h>
25 #include <ui/ANativeObjectBase.h>
26 #include <ui/GraphicTypes.h>
27 #include <ui/Region.h>
28 #include <utils/Condition.h>
29 #include <utils/Mutex.h>
30 #include <utils/RefBase.h>
31 
32 #include <shared_mutex>
33 
34 namespace android {
35 
36 class ISurfaceComposer;
37 
38 /* This is the same as ProducerListener except that onBuffersDiscarded is
39  * called with a vector of graphic buffers instead of buffer slots.
40  */
41 class SurfaceListener : public virtual RefBase
42 {
43 public:
44     SurfaceListener() = default;
45     virtual ~SurfaceListener() = default;
46 
47     virtual void onBufferReleased() = 0;
48     virtual bool needsReleaseNotify() = 0;
49 
50     virtual void onBuffersDiscarded(const std::vector<sp<GraphicBuffer>>& buffers) = 0;
51 };
52 
53 /*
54  * An implementation of ANativeWindow that feeds graphics buffers into a
55  * BufferQueue.
56  *
57  * This is typically used by programs that want to render frames through
58  * some means (maybe OpenGL, a software renderer, or a hardware decoder)
59  * and have the frames they create forwarded to SurfaceFlinger for
60  * compositing.  For example, a video decoder could render a frame and call
61  * eglSwapBuffers(), which invokes ANativeWindow callbacks defined by
62  * Surface.  Surface then forwards the buffers through Binder IPC
63  * to the BufferQueue's producer interface, providing the new frame to a
64  * consumer such as GLConsumer.
65  */
66 class Surface
67     : public ANativeObjectBase<ANativeWindow, Surface, RefBase>
68 {
69 public:
70 
71     /*
72      * creates a Surface from the given IGraphicBufferProducer (which concrete
73      * implementation is a BufferQueue).
74      *
75      * Surface is mainly state-less while it's disconnected, it can be
76      * viewed as a glorified IGraphicBufferProducer holder. It's therefore
77      * safe to create other Surfaces from the same IGraphicBufferProducer.
78      *
79      * However, once a Surface is connected, it'll prevent other Surfaces
80      * referring to the same IGraphicBufferProducer to become connected and
81      * therefore prevent them to be used as actual producers of buffers.
82      *
83      * the controlledByApp flag indicates that this Surface (producer) is
84      * controlled by the application. This flag is used at connect time.
85      */
86     explicit Surface(const sp<IGraphicBufferProducer>& bufferProducer,
87             bool controlledByApp = false);
88 
89     /* getIGraphicBufferProducer() returns the IGraphicBufferProducer this
90      * Surface was created with. Usually it's an error to use the
91      * IGraphicBufferProducer while the Surface is connected.
92      */
93     sp<IGraphicBufferProducer> getIGraphicBufferProducer() const;
94 
95     /* convenience function to check that the given surface is non NULL as
96      * well as its IGraphicBufferProducer */
isValid(const sp<Surface> & surface)97     static bool isValid(const sp<Surface>& surface) {
98         return surface != nullptr && surface->getIGraphicBufferProducer() != nullptr;
99     }
100 
101     /* Attaches a sideband buffer stream to the Surface's IGraphicBufferProducer.
102      *
103      * A sideband stream is a device-specific mechanism for passing buffers
104      * from the producer to the consumer without using dequeueBuffer/
105      * queueBuffer. If a sideband stream is present, the consumer can choose
106      * whether to acquire buffers from the sideband stream or from the queued
107      * buffers.
108      *
109      * Passing NULL or a different stream handle will detach the previous
110      * handle if any.
111      */
112     void setSidebandStream(const sp<NativeHandle>& stream);
113 
114     /* Allocates buffers based on the current dimensions/format.
115      *
116      * This function will allocate up to the maximum number of buffers
117      * permitted by the current BufferQueue configuration. It will use the
118      * default format and dimensions. This is most useful to avoid an allocation
119      * delay during dequeueBuffer. If there are already the maximum number of
120      * buffers allocated, this function has no effect.
121      */
122     void allocateBuffers();
123 
124     /* Sets the generation number on the IGraphicBufferProducer and updates the
125      * generation number on any buffers attached to the Surface after this call.
126      * See IGBP::setGenerationNumber for more information. */
127     status_t setGenerationNumber(uint32_t generationNumber);
128 
129     // See IGraphicBufferProducer::getConsumerName
130     String8 getConsumerName() const;
131 
132     // See IGraphicBufferProducer::getNextFrameNumber
133     uint64_t getNextFrameNumber() const;
134 
135     /* Set the scaling mode to be used with a Surface.
136      * See NATIVE_WINDOW_SET_SCALING_MODE and its parameters
137      * in <system/window.h>. */
138     int setScalingMode(int mode);
139 
140     // See IGraphicBufferProducer::setDequeueTimeout
141     status_t setDequeueTimeout(nsecs_t timeout);
142 
143     /*
144      * Wait for frame number to increase past lastFrame for at most
145      * timeoutNs. Useful for one thread to wait for another unknown
146      * thread to queue a buffer.
147      */
148     bool waitForNextFrame(uint64_t lastFrame, nsecs_t timeout);
149 
150     // See IGraphicBufferProducer::getLastQueuedBuffer
151     // See GLConsumer::getTransformMatrix for outTransformMatrix format
152     status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
153             sp<Fence>* outFence, float outTransformMatrix[16]);
154 
155     status_t getDisplayRefreshCycleDuration(nsecs_t* outRefreshDuration);
156 
157     /* Enables or disables frame timestamp tracking. It is disabled by default
158      * to avoid overhead during queue and dequeue for applications that don't
159      * need the feature. If disabled, calls to getFrameTimestamps will fail.
160      */
161     void enableFrameTimestamps(bool enable);
162 
163     status_t getCompositorTiming(
164             nsecs_t* compositeDeadline, nsecs_t* compositeInterval,
165             nsecs_t* compositeToPresentLatency);
166 
167     // See IGraphicBufferProducer::getFrameTimestamps
168     status_t getFrameTimestamps(uint64_t frameNumber,
169             nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
170             nsecs_t* outLatchTime, nsecs_t* outFirstRefreshStartTime,
171             nsecs_t* outLastRefreshStartTime, nsecs_t* outGlCompositionDoneTime,
172             nsecs_t* outDisplayPresentTime, nsecs_t* outDequeueReadyTime,
173             nsecs_t* outReleaseTime);
174 
175     status_t getWideColorSupport(bool* supported);
176     status_t getHdrSupport(bool* supported);
177 
178     status_t getUniqueId(uint64_t* outId) const;
179     status_t getConsumerUsage(uint64_t* outUsage) const;
180 
181     status_t setFrameRate(float frameRate, int8_t compatibility);
182 
183 protected:
184     virtual ~Surface();
185 
186     // Virtual for testing.
187     virtual sp<ISurfaceComposer> composerService() const;
188     virtual nsecs_t now() const;
189 
190 private:
191     // can't be copied
192     Surface& operator = (const Surface& rhs);
193     Surface(const Surface& rhs);
194 
195     // ANativeWindow hooks
196     static int hook_cancelBuffer(ANativeWindow* window,
197             ANativeWindowBuffer* buffer, int fenceFd);
198     static int hook_dequeueBuffer(ANativeWindow* window,
199             ANativeWindowBuffer** buffer, int* fenceFd);
200     static int hook_perform(ANativeWindow* window, int operation, ...);
201     static int hook_query(const ANativeWindow* window, int what, int* value);
202     static int hook_queueBuffer(ANativeWindow* window,
203             ANativeWindowBuffer* buffer, int fenceFd);
204     static int hook_setSwapInterval(ANativeWindow* window, int interval);
205 
206     static int cancelBufferInternal(ANativeWindow* window, ANativeWindowBuffer* buffer,
207                                     int fenceFd);
208     static int dequeueBufferInternal(ANativeWindow* window, ANativeWindowBuffer** buffer,
209                                      int* fenceFd);
210     static int performInternal(ANativeWindow* window, int operation, va_list args);
211     static int queueBufferInternal(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd);
212     static int queryInternal(const ANativeWindow* window, int what, int* value);
213 
214     static int hook_cancelBuffer_DEPRECATED(ANativeWindow* window,
215             ANativeWindowBuffer* buffer);
216     static int hook_dequeueBuffer_DEPRECATED(ANativeWindow* window,
217             ANativeWindowBuffer** buffer);
218     static int hook_lockBuffer_DEPRECATED(ANativeWindow* window,
219             ANativeWindowBuffer* buffer);
220     static int hook_queueBuffer_DEPRECATED(ANativeWindow* window,
221             ANativeWindowBuffer* buffer);
222 
223     int dispatchConnect(va_list args);
224     int dispatchDisconnect(va_list args);
225     int dispatchSetBufferCount(va_list args);
226     int dispatchSetBuffersGeometry(va_list args);
227     int dispatchSetBuffersDimensions(va_list args);
228     int dispatchSetBuffersUserDimensions(va_list args);
229     int dispatchSetBuffersFormat(va_list args);
230     int dispatchSetScalingMode(va_list args);
231     int dispatchSetBuffersTransform(va_list args);
232     int dispatchSetBuffersStickyTransform(va_list args);
233     int dispatchSetBuffersTimestamp(va_list args);
234     int dispatchSetCrop(va_list args);
235     int dispatchSetUsage(va_list args);
236     int dispatchSetUsage64(va_list args);
237     int dispatchLock(va_list args);
238     int dispatchUnlockAndPost(va_list args);
239     int dispatchSetSidebandStream(va_list args);
240     int dispatchSetBuffersDataSpace(va_list args);
241     int dispatchSetBuffersSmpte2086Metadata(va_list args);
242     int dispatchSetBuffersCta8613Metadata(va_list args);
243     int dispatchSetBuffersHdr10PlusMetadata(va_list args);
244     int dispatchSetSurfaceDamage(va_list args);
245     int dispatchSetSharedBufferMode(va_list args);
246     int dispatchSetAutoRefresh(va_list args);
247     int dispatchGetDisplayRefreshCycleDuration(va_list args);
248     int dispatchGetNextFrameId(va_list args);
249     int dispatchEnableFrameTimestamps(va_list args);
250     int dispatchGetCompositorTiming(va_list args);
251     int dispatchGetFrameTimestamps(va_list args);
252     int dispatchGetWideColorSupport(va_list args);
253     int dispatchGetHdrSupport(va_list args);
254     int dispatchGetConsumerUsage64(va_list args);
255     int dispatchSetAutoPrerotation(va_list args);
256     int dispatchGetLastDequeueStartTime(va_list args);
257     int dispatchSetDequeueTimeout(va_list args);
258     int dispatchGetLastDequeueDuration(va_list args);
259     int dispatchGetLastQueueDuration(va_list args);
260     int dispatchSetFrameRate(va_list args);
261     int dispatchAddCancelInterceptor(va_list args);
262     int dispatchAddDequeueInterceptor(va_list args);
263     int dispatchAddPerformInterceptor(va_list args);
264     int dispatchAddQueueInterceptor(va_list args);
265     int dispatchAddQueryInterceptor(va_list args);
266     int dispatchGetLastQueuedBuffer(va_list args);
267     bool transformToDisplayInverse();
268 
269 protected:
270     virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
271     virtual int cancelBuffer(ANativeWindowBuffer* buffer, int fenceFd);
272     virtual int queueBuffer(ANativeWindowBuffer* buffer, int fenceFd);
273     virtual int perform(int operation, va_list args);
274     virtual int setSwapInterval(int interval);
275 
276     virtual int lockBuffer_DEPRECATED(ANativeWindowBuffer* buffer);
277 
278     virtual int connect(int api);
279     virtual int setBufferCount(int bufferCount);
280     virtual int setBuffersUserDimensions(uint32_t width, uint32_t height);
281     virtual int setBuffersFormat(PixelFormat format);
282     virtual int setBuffersTransform(uint32_t transform);
283     virtual int setBuffersStickyTransform(uint32_t transform);
284     virtual int setBuffersTimestamp(int64_t timestamp);
285     virtual int setBuffersDataSpace(ui::Dataspace dataSpace);
286     virtual int setBuffersSmpte2086Metadata(const android_smpte2086_metadata* metadata);
287     virtual int setBuffersCta8613Metadata(const android_cta861_3_metadata* metadata);
288     virtual int setBuffersHdr10PlusMetadata(const size_t size, const uint8_t* metadata);
289     virtual int setCrop(Rect const* rect);
290     virtual int setUsage(uint64_t reqUsage);
291     virtual void setSurfaceDamage(android_native_rect_t* rects, size_t numRects);
292 
293 public:
294     virtual int disconnect(int api,
295             IGraphicBufferProducer::DisconnectMode mode =
296                     IGraphicBufferProducer::DisconnectMode::Api);
297 
298     virtual int setMaxDequeuedBufferCount(int maxDequeuedBuffers);
299     virtual int setAsyncMode(bool async);
300     virtual int setSharedBufferMode(bool sharedBufferMode);
301     virtual int setAutoRefresh(bool autoRefresh);
302     virtual int setAutoPrerotation(bool autoPrerotation);
303     virtual int setBuffersDimensions(uint32_t width, uint32_t height);
304     virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
305     virtual int unlockAndPost();
306     virtual int query(int what, int* value) const;
307 
308     virtual int connect(int api, const sp<IProducerListener>& listener);
309 
310     // When reportBufferRemoval is true, clients must call getAndFlushRemovedBuffers to fetch
311     // GraphicBuffers removed from this surface after a dequeueBuffer, detachNextBuffer or
312     // attachBuffer call. This allows clients with their own buffer caches to free up buffers no
313     // longer in use by this surface.
314     virtual int connect(
315             int api, const sp<IProducerListener>& listener,
316             bool reportBufferRemoval);
317     virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer,
318             sp<Fence>* outFence);
319     virtual int attachBuffer(ANativeWindowBuffer*);
320 
321     virtual int connect(
322             int api, bool reportBufferRemoval,
323             const sp<SurfaceListener>& sListener);
324 
325     // When client connects to Surface with reportBufferRemoval set to true, any buffers removed
326     // from this Surface will be collected and returned here. Once this method returns, these
327     // buffers will no longer be referenced by this Surface unless they are attached to this
328     // Surface later. The list of removed buffers will only be stored until the next dequeueBuffer,
329     // detachNextBuffer, or attachBuffer call.
330     status_t getAndFlushRemovedBuffers(std::vector<sp<GraphicBuffer>>* out);
331 
332     ui::Dataspace getBuffersDataSpace();
333 
334     static status_t attachAndQueueBufferWithDataspace(Surface* surface, sp<GraphicBuffer> buffer,
335                                                       ui::Dataspace dataspace);
336 
337 protected:
338     enum { NUM_BUFFER_SLOTS = BufferQueueDefs::NUM_BUFFER_SLOTS };
339     enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 };
340 
341     class ProducerListenerProxy : public BnProducerListener {
342     public:
ProducerListenerProxy(wp<Surface> parent,sp<SurfaceListener> listener)343         ProducerListenerProxy(wp<Surface> parent, sp<SurfaceListener> listener)
344                : mParent(parent), mSurfaceListener(listener) {}
~ProducerListenerProxy()345         virtual ~ProducerListenerProxy() {}
346 
onBufferReleased()347         virtual void onBufferReleased() {
348             mSurfaceListener->onBufferReleased();
349         }
350 
needsReleaseNotify()351         virtual bool needsReleaseNotify() {
352             return mSurfaceListener->needsReleaseNotify();
353         }
354 
355         virtual void onBuffersDiscarded(const std::vector<int32_t>& slots);
356     private:
357         wp<Surface> mParent;
358         sp<SurfaceListener> mSurfaceListener;
359     };
360 
361     void querySupportedTimestampsLocked() const;
362 
363     void freeAllBuffers();
364     int getSlotFromBufferLocked(android_native_buffer_t* buffer) const;
365 
366     struct BufferSlot {
367         sp<GraphicBuffer> buffer;
368         Region dirtyRegion;
369     };
370 
371     // mSurfaceTexture is the interface to the surface texture server. All
372     // operations on the surface texture client ultimately translate into
373     // interactions with the server using this interface.
374     // TODO: rename to mBufferProducer
375     sp<IGraphicBufferProducer> mGraphicBufferProducer;
376 
377     // mSlots stores the buffers that have been allocated for each buffer slot.
378     // It is initialized to null pointers, and gets filled in with the result of
379     // IGraphicBufferProducer::requestBuffer when the client dequeues a buffer from a
380     // slot that has not yet been used. The buffer allocated to a slot will also
381     // be replaced if the requested buffer usage or geometry differs from that
382     // of the buffer allocated to a slot.
383     BufferSlot mSlots[NUM_BUFFER_SLOTS];
384 
385     // mReqWidth is the buffer width that will be requested at the next dequeue
386     // operation. It is initialized to 1.
387     uint32_t mReqWidth;
388 
389     // mReqHeight is the buffer height that will be requested at the next
390     // dequeue operation. It is initialized to 1.
391     uint32_t mReqHeight;
392 
393     // mReqFormat is the buffer pixel format that will be requested at the next
394     // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888.
395     PixelFormat mReqFormat;
396 
397     // mReqUsage is the set of buffer usage flags that will be requested
398     // at the next deuque operation. It is initialized to 0.
399     uint64_t mReqUsage;
400 
401     // mTimestamp is the timestamp that will be used for the next buffer queue
402     // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
403     // a timestamp is auto-generated when queueBuffer is called.
404     int64_t mTimestamp;
405 
406     // mDataSpace is the buffer dataSpace that will be used for the next buffer
407     // queue operation. It defaults to Dataspace::UNKNOWN, which
408     // means that the buffer contains some type of color data.
409     ui::Dataspace mDataSpace;
410 
411     // mHdrMetadata is the HDR metadata that will be used for the next buffer
412     // queue operation.  There is no HDR metadata by default.
413     HdrMetadata mHdrMetadata;
414 
415     // mCrop is the crop rectangle that will be used for the next buffer
416     // that gets queued. It is set by calling setCrop.
417     Rect mCrop;
418 
419     // mScalingMode is the scaling mode that will be used for the next
420     // buffers that get queued. It is set by calling setScalingMode.
421     int mScalingMode;
422 
423     // mTransform is the transform identifier that will be used for the next
424     // buffer that gets queued. It is set by calling setTransform.
425     uint32_t mTransform;
426 
427     // mStickyTransform is a transform that is applied on top of mTransform
428     // in each buffer that is queued.  This is typically used to force the
429     // compositor to apply a transform, and will prevent the transform hint
430     // from being set by the compositor.
431     uint32_t mStickyTransform;
432 
433     // mDefaultWidth is default width of the buffers, regardless of the
434     // native_window_set_buffers_dimensions call.
435     uint32_t mDefaultWidth;
436 
437     // mDefaultHeight is default height of the buffers, regardless of the
438     // native_window_set_buffers_dimensions call.
439     uint32_t mDefaultHeight;
440 
441     // mUserWidth, if non-zero, is an application-specified override
442     // of mDefaultWidth.  This is lower priority than the width set by
443     // native_window_set_buffers_dimensions.
444     uint32_t mUserWidth;
445 
446     // mUserHeight, if non-zero, is an application-specified override
447     // of mDefaultHeight.  This is lower priority than the height set
448     // by native_window_set_buffers_dimensions.
449     uint32_t mUserHeight;
450 
451     // mTransformHint is the transform probably applied to buffers of this
452     // window. this is only a hint, actual transform may differ.
453     uint32_t mTransformHint;
454 
455     // mProducerControlledByApp whether this buffer producer is controlled
456     // by the application
457     bool mProducerControlledByApp;
458 
459     // mSwapIntervalZero set if we should drop buffers at queue() time to
460     // achieve an asynchronous swap interval
461     bool mSwapIntervalZero;
462 
463     // mConsumerRunningBehind whether the consumer is running more than
464     // one buffer behind the producer.
465     mutable bool mConsumerRunningBehind;
466 
467     // mMutex is the mutex used to prevent concurrent access to the member
468     // variables of Surface objects. It must be locked whenever the
469     // member variables are accessed.
470     mutable Mutex mMutex;
471 
472     // mInterceptorMutex is the mutex guarding interceptors.
473     mutable std::shared_mutex mInterceptorMutex;
474 
475     ANativeWindow_cancelBufferInterceptor mCancelInterceptor = nullptr;
476     void* mCancelInterceptorData = nullptr;
477     ANativeWindow_dequeueBufferInterceptor mDequeueInterceptor = nullptr;
478     void* mDequeueInterceptorData = nullptr;
479     ANativeWindow_performInterceptor mPerformInterceptor = nullptr;
480     void* mPerformInterceptorData = nullptr;
481     ANativeWindow_queueBufferInterceptor mQueueInterceptor = nullptr;
482     void* mQueueInterceptorData = nullptr;
483     ANativeWindow_queryInterceptor mQueryInterceptor = nullptr;
484     void* mQueryInterceptorData = nullptr;
485 
486     // must be used from the lock/unlock thread
487     sp<GraphicBuffer>           mLockedBuffer;
488     sp<GraphicBuffer>           mPostedBuffer;
489     bool                        mConnectedToCpu;
490 
491     // When a CPU producer is attached, this reflects the region that the
492     // producer wished to update as well as whether the Surface was able to copy
493     // the previous buffer back to allow a partial update.
494     //
495     // When a non-CPU producer is attached, this reflects the surface damage
496     // (the change since the previous frame) passed in by the producer.
497     Region mDirtyRegion;
498 
499     // mBufferAge tracks the age of the contents of the most recently dequeued
500     // buffer as the number of frames that have elapsed since it was last queued
501     uint64_t mBufferAge;
502 
503     // Stores the current generation number. See setGenerationNumber and
504     // IGraphicBufferProducer::setGenerationNumber for more information.
505     uint32_t mGenerationNumber;
506 
507     // Caches the values that have been passed to the producer.
508     bool mSharedBufferMode;
509     bool mAutoRefresh;
510     bool mAutoPrerotation;
511 
512     // If in shared buffer mode and auto refresh is enabled, store the shared
513     // buffer slot and return it for all calls to queue/dequeue without going
514     // over Binder.
515     int mSharedBufferSlot;
516 
517     // This is true if the shared buffer has already been queued/canceled. It's
518     // used to prevent a mismatch between the number of queue/dequeue calls.
519     bool mSharedBufferHasBeenQueued;
520 
521     // These are used to satisfy the NATIVE_WINDOW_LAST_*_DURATION queries
522     nsecs_t mLastDequeueDuration = 0;
523     nsecs_t mLastQueueDuration = 0;
524 
525     // Stores the time right before we call IGBP::dequeueBuffer
526     nsecs_t mLastDequeueStartTime = 0;
527 
528     Condition mQueueBufferCondition;
529 
530     uint64_t mNextFrameNumber = 1;
531     uint64_t mLastFrameNumber = 0;
532 
533     // Mutable because ANativeWindow::query needs this class const.
534     mutable bool mQueriedSupportedTimestamps;
535     mutable bool mFrameTimestampsSupportsPresent;
536 
537     // A cached copy of the FrameEventHistory maintained by the consumer.
538     bool mEnableFrameTimestamps = false;
539     std::unique_ptr<ProducerFrameEventHistory> mFrameEventHistory;
540 
541     bool mReportRemovedBuffers = false;
542     std::vector<sp<GraphicBuffer>> mRemovedBuffers;
543     int mMaxBufferCount;
544 
545     sp<IProducerListener> mListenerProxy;
546     status_t getAndFlushBuffersFromSlots(const std::vector<int32_t>& slots,
547             std::vector<sp<GraphicBuffer>>* outBuffers);
548 };
549 
550 } // namespace android
551 
552 #endif  // ANDROID_GUI_SURFACE_H
553