18ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis/*
28ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Copyright (C) 2010 The Android Open Source Project
38ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis *
48ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Licensed under the Apache License, Version 2.0 (the "License");
58ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * you may not use this file except in compliance with the License.
68ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * You may obtain a copy of the License at
78ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis *
88ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis *      http://www.apache.org/licenses/LICENSE-2.0
98ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis *
108ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * Unless required by applicable law or agreed to in writing, software
118ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * distributed under the License is distributed on an "AS IS" BASIS,
128ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * See the License for the specific language governing permissions and
148ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis * limitations under the License.
158ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis */
168ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
172adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden#ifndef ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
182adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden#define ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
198ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
208ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <stdint.h>
218ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <sys/types.h>
228ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
238ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <utils/Errors.h>
248ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <utils/RefBase.h>
258ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
268ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <binder/IInterface.h>
278ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
28f78575400977f644cf0b12beb2fa5fc278b6ed4cJesse Hall#include <ui/Fence.h>
298ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <ui/GraphicBuffer.h>
308ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis#include <ui/Rect.h>
315065a55291b67f584d7b0be3fa3cfc4e29a3cd1cDan Stoza#include <ui/Region.h>
328ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
338ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennisnamespace android {
348ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis// ----------------------------------------------------------------------------
358ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
36f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stozaclass IProducerListener;
37399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hallclass NativeHandle;
38e3c697fb929c856b59fa56a8e05a2a7eba187c3dMathias Agopianclass Surface;
39eafabcdc1639fb96062d9e3c39b0ae27b0238ae1Mathias Agopian
400273adbf0bc202eda2ca579ae0773464ea9c701fAndy McFadden/*
41466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * This class defines the Binder IPC interface for the producer side of
42466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * a queue of graphics buffers.  It's used to send graphics data from one
43466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * component to another.  For example, a class that decodes video for
44466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * playback might use this to provide frames.  This is typically done
45e3c697fb929c856b59fa56a8e05a2a7eba187c3dMathias Agopian * indirectly, through Surface.
460273adbf0bc202eda2ca579ae0773464ea9c701fAndy McFadden *
47466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * The underlying mechanism is a BufferQueue, which implements
48466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * BnGraphicBufferProducer.  In normal operation, the producer calls
49466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * dequeueBuffer() to get an empty buffer, fills it with data, then
50466a192d2088f9238d34597d1aa28da41367c1caAndy McFadden * calls queueBuffer() to make it available to the consumer.
510273adbf0bc202eda2ca579ae0773464ea9c701fAndy McFadden *
522adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden * This class was previously called ISurfaceTexture.
530273adbf0bc202eda2ca579ae0773464ea9c701fAndy McFadden */
542adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFaddenclass IGraphicBufferProducer : public IInterface
558ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis{
568ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennispublic:
572adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    DECLARE_META_INTERFACE(GraphicBufferProducer);
588ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
598072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian    enum {
607d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // A flag returned by dequeueBuffer when the client needs to call
617d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // requestBuffer immediately thereafter.
628072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian        BUFFER_NEEDS_REALLOCATION = 0x1,
637d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // A flag returned by dequeueBuffer when all mirrored slots should be
647d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // released by the client. This flag should always be processed first.
658072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian        RELEASE_ALL_BUFFERS       = 0x2,
668072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian    };
67a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian
688ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // requestBuffer requests a new buffer for the given index. The server (i.e.
692adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // the IGraphicBufferProducer implementation) assigns the newly created
702adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // buffer to the given slot index, and the client is expected to mirror the
718ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // slot->buffer mapping so that it's not necessary to transfer a
728ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // GraphicBuffer for every dequeue operation.
737d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
747d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The slot must be in the range of [0, NUM_BUFFER_SLOTS).
757d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
767d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a value other than NO_ERROR means an error has occurred:
77583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
78583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
797d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * BAD_VALUE - one of the two conditions occurred:
807d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * slot was out of range (see above)
817d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * buffer specified by the slot is not dequeued
827b305fffc39d0fe0926e7fd2d7f6a524fbce62b7Jamie Gennis    virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0;
838ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
84fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // setMaxDequeuedBufferCount sets the maximum number of buffers that can be
8572daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // dequeued by the producer at one time. If this method succeeds, any new
8672daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // buffer slots will be both unallocated and owned by the BufferQueue object
8772daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // (i.e. they are not owned by the producer or consumer). Calling this may
8872daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // also cause some buffer slots to be emptied. If the caller is caching the
89fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // contents of the buffer slots, it should empty that cache after calling
90fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // this method.
91fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    //
9272daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // This function should not be called with a value of maxDequeuedBuffers
9372daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // that is less than the number of currently dequeued buffer slots. Doing so
9472daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    // will result in a BAD_VALUE error.
95fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    //
96fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // The buffer count should be at least 1 (inclusive), but at most
97fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // (NUM_BUFFER_SLOTS - the minimum undequeued buffer count) (exclusive). The
98fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // minimum undequeued buffer count can be obtained by calling
99fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS).
100fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    //
101fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // Return of a value other than NO_ERROR means an error has occurred:
102fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned.
103fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // * BAD_VALUE - one of the below conditions occurred:
10472daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    //     * bufferCount was out of range (see above).
10572daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    //     * client would have more than the requested number of dequeued
10672daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    //       buffers after this call.
10772daab652e3481566c01ce45c6afdb9fcec6f140Pablo Ceballos    //     * this call would cause the maxBufferCount value to be exceeded.
10823b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //     * failure to adjust the number of available slots.
109fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    virtual status_t setMaxDequeuedBufferCount(int maxDequeuedBuffers) = 0;
110fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos
111fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // Set the async flag if the producer intends to asynchronously queue
112fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // buffers without blocking. Typically this is used for triple-buffering
113fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // and/or when the swap interval is set to zero.
114fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    //
115fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // Enabling async mode will internally allocate an additional buffer to
116fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // allow for the asynchronous behavior. If it is not enabled queue/dequeue
117fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // calls may block.
118fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    //
119fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // Return of a value other than NO_ERROR means an error has occurred:
120fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned.
12123b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    // * BAD_VALUE - one of the following has occurred:
12223b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //             * this call would cause the maxBufferCount value to be
123b687a2814ca9db576eb1ea33dea90ac35cd61bc1Pablo Ceballos    //               exceeded
12423b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //             * failure to adjust the number of available slots.
125fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos    virtual status_t setAsyncMode(bool async) = 0;
126fa455354557f6283ff3a7d76979e52fd251c155fPablo Ceballos
1278ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // dequeueBuffer requests a new buffer slot for the client to use. Ownership
1288ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // of the slot is transfered to the client, meaning that the server will not
1297d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // use the contents of the buffer associated with that slot.
1307d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1317d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The slot index returned may or may not contain a buffer (client-side).
1327d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // If the slot is empty the client should call requestBuffer to assign a new
1337d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // buffer to that slot.
1347d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1357d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Once the client is done filling this buffer, it is expected to transfer
1367d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // buffer ownership back to the server with either cancelBuffer on
1377d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // the dequeued slot or to fill in the contents of its associated buffer
1387d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // contents and call queueBuffer.
1397d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1407d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // If dequeueBuffer returns the BUFFER_NEEDS_REALLOCATION flag, the client is
141a5c75c01620179ce00812354778a29a80d76e71fMathias Agopian    // expected to call requestBuffer immediately.
142f78575400977f644cf0b12beb2fa5fc278b6ed4cJesse Hall    //
1437d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // If dequeueBuffer returns the RELEASE_ALL_BUFFERS flag, the client is
1447d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // expected to release all of the mirrored slot->buffer mappings.
1457d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
146f78575400977f644cf0b12beb2fa5fc278b6ed4cJesse Hall    // The fence parameter will be updated to hold the fence associated with
147f78575400977f644cf0b12beb2fa5fc278b6ed4cJesse Hall    // the buffer. The contents of the buffer must not be overwritten until the
1487d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // fence signals. If the fence is Fence::NO_FENCE, the buffer may be written
149f78575400977f644cf0b12beb2fa5fc278b6ed4cJesse Hall    // immediately.
1507cdd786fa80cf03551291ae8feca7b77583be1c5Mathias Agopian    //
1517d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The width and height parameters must be no greater than the minimum of
1527d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
1537d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // An error due to invalid dimensions might not be reported until
1547d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // updateTexImage() is called.  If width and height are both zero, the
1557d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // default values specified by setDefaultBufferSize() are used instead.
1567d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1573be1c6b60a188dc10025e2ce156c11fac050625dDan Stoza    // If the format is 0, the default format will be used.
1587d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1597d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The usage argument specifies gralloc buffer usage flags.  The values
1607d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // are enumerated in <gralloc.h>, e.g. GRALLOC_USAGE_HW_RENDER.  These
1617d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // will be merged with the usage flags specified by
1627d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // IGraphicBufferConsumer::setConsumerUsageBits.
1637d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1647d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // This call will block until a buffer is available to be dequeued. If
1657d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // both the producer and consumer are controlled by the app, then this call
1667d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // can never block and will return WOULD_BLOCK if no buffer is available.
1677d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1687d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // A non-negative value with flags set (see above) will be returned upon
1697d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // success.
1707d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1717d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a negative means an error has occurred:
172583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
173583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
1749f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // * BAD_VALUE - both in async mode and buffer count was less than the
1759f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //               max numbers of buffers that can be allocated at once.
1769f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // * INVALID_OPERATION - cannot attach the buffer because it would cause
1779f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       too many buffers to be dequeued, either because
1789f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       the producer already has a single buffer dequeued
1799f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       and did not set a buffer count, or because a
1809f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       buffer count was set and this call would cause
1819f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       it to be exceeded.
1827d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * WOULD_BLOCK - no buffer is currently available, and blocking is disabled
1837d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //                 since both the producer/consumer are controlled by app
1847d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * NO_MEMORY - out of memory, cannot allocate the graphics buffer.
185127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // * TIMED_OUT - the timeout set by setDequeueTimeout was exceeded while
186127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    //               waiting for a buffer to become available.
1877d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
1887d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // All other negative values are an unknown error returned downstream
1897d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // from the graphics allocator (typically errno).
190567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos    virtual status_t dequeueBuffer(int* slot, sp<Fence>* fence, uint32_t w,
191567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos            uint32_t h, PixelFormat format, uint32_t usage) = 0;
1928ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
1939f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // detachBuffer attempts to remove all ownership of the buffer in the given
1949f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // slot from the buffer queue. If this call succeeds, the slot will be
1959f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // freed, and there will be no way to obtain the buffer from this interface.
1969f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // The freed slot will remain unallocated until either it is selected to
1979f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // hold a freshly allocated buffer in dequeueBuffer or a buffer is attached
1989f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // to the slot. The buffer must have already been dequeued, and the caller
1999f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // must already possesses the sp<GraphicBuffer> (i.e., must have called
2009f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // requestBuffer).
2019f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //
2029f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // Return of a value other than NO_ERROR means an error has occurred:
203583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
204583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
2059f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // * BAD_VALUE - the given slot number is invalid, either because it is
2069f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //               out of the range [0, NUM_BUFFER_SLOTS), or because the slot
2079f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //               it refers to is not currently dequeued and requested.
2089f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    virtual status_t detachBuffer(int slot) = 0;
2099f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza
210d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // detachNextBuffer is equivalent to calling dequeueBuffer, requestBuffer,
211d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // and detachBuffer in sequence, except for two things:
212d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //
213d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // 1) It is unnecessary to know the dimensions, format, or usage of the
214d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //    next buffer.
215d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // 2) It will not block, since if it cannot find an appropriate buffer to
216d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //    return, it will return an error instead.
217d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //
218d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // Only slots that are free but still contain a GraphicBuffer will be
219d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // considered, and the oldest of those will be returned. outBuffer is
220d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // equivalent to outBuffer from the requestBuffer call, and outFence is
221d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // equivalent to fence from the dequeueBuffer call.
222d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //
223d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // Return of a value other than NO_ERROR means an error has occurred:
224583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
225583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
226d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // * BAD_VALUE - either outBuffer or outFence were NULL.
227d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    // * NO_MEMORY - no slots were found that were both free and contained a
228d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    //               GraphicBuffer.
229d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza    virtual status_t detachNextBuffer(sp<GraphicBuffer>* outBuffer,
230d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza            sp<Fence>* outFence) = 0;
231d9822a3843017444364899afc3c23fb5be6b9cb9Dan Stoza
2329f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // attachBuffer attempts to transfer ownership of a buffer to the buffer
2339f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // queue. If this call succeeds, it will be as if this buffer was dequeued
2349f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // from the returned slot number. As such, this call will fail if attaching
2359f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // this buffer would cause too many buffers to be simultaneously dequeued.
2369f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //
2379f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // If attachBuffer returns the RELEASE_ALL_BUFFERS flag, the caller is
2389f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // expected to release all of the mirrored slot->buffer mappings.
2399f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //
2409f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // A non-negative value with flags set (see above) will be returned upon
2419f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // success.
2429f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //
2439f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // Return of a negative value means an error has occurred:
244583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
245583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
246812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // * BAD_VALUE - outSlot or buffer were NULL, invalid combination of
247812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    //               async mode and buffer count override, or the generation
248812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    //               number of the buffer did not match the buffer queue.
2499f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // * INVALID_OPERATION - cannot attach the buffer because it would cause
2509f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       too many buffers to be dequeued, either because
2519f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       the producer already has a single buffer dequeued
2529f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       and did not set a buffer count, or because a
2539f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       buffer count was set and this call would cause
2549f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                       it to be exceeded.
2559f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    // * WOULD_BLOCK - no buffer slot is currently available, and blocking is
2569f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                 disabled since both the producer/consumer are
2579f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    //                 controlled by the app.
258127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // * TIMED_OUT - the timeout set by setDequeueTimeout was exceeded while
259127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    //               waiting for a slot to become available.
2609f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza    virtual status_t attachBuffer(int* outSlot,
2619f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza            const sp<GraphicBuffer>& buffer) = 0;
2629f3053de78630815d60cf48a2cf2348cc5867c45Dan Stoza
2638ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // queueBuffer indicates that the client has finished filling in the
2648ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // contents of the buffer associated with slot and transfers ownership of
2657d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // that slot back to the server.
2667d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
2677d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // It is not valid to call queueBuffer on a slot that is not owned
2687d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // by the client or one for which a buffer associated via requestBuffer
2697d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // (an attempt to do so will fail with a return value of BAD_VALUE).
2707d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
2717d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // In addition, the input must be described by the client (as documented
2727d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // below). Any other properties (zero point, etc)
2731d01a12e7150be569557b64da9b8663c62c13594Eino-Ville Talvala    // are client-dependent, and should be documented by the client.
27497c602c5af5f3ffd69009bf496d86347b71a2b4cMathias Agopian    //
2757d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The slot must be in the range of [0, NUM_BUFFER_SLOTS).
2767d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
2777d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Upon success, the output will be filled with meaningful values
2787d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // (refer to the documentation below).
2797cdd786fa80cf03551291ae8feca7b77583be1c5Mathias Agopian    //
2807d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a value other than NO_ERROR means an error has occurred:
281583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
282583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
2837d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * BAD_VALUE - one of the below conditions occurred:
2847d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * fence was NULL
2857d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * scaling mode was unknown
2867d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * both in async mode and buffer count was less than the
2877d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //                max numbers of buffers that can be allocated at once
2887d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * slot index was out of range (see above).
2897d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * the slot was not in the dequeued state
2907d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * the slot was enqueued without requesting a buffer
2917d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //              * crop rect is out of bounds of the buffer dimensions
292f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian
293e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian    struct QueueBufferInput : public Flattenable<QueueBufferInput> {
294e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        friend class Flattenable<QueueBufferInput>;
295c777b0b3b9b0ea5d8e378fccde6935765e28e329Jesse Hall        inline QueueBufferInput(const Parcel& parcel);
2967d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // timestamp - a monotonically increasing value in nanoseconds
2977d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // isAutoTimestamp - if the timestamp was synthesized at queue time
29882c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala        // dataSpace - description of the contents, interpretation depends on format
2997d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // crop - a crop rectangle that's used as a hint to the consumer
3007d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // scalingMode - a set of flags from NATIVE_WINDOW_SCALING_* in <window.h>
3017d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // transform - a set of flags from NATIVE_WINDOW_TRANSFORM_* in <window.h>
3027d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // fence - a fence that the consumer must wait on before reading the buffer,
3037d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        //         set this to Fence::NO_FENCE if the buffer is ready immediately
3041681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk        // sticky - the sticky transform set in Surface (only used by the LEGACY
3051681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk        //          camera mode).
3063c25621ad7d13f64d3ab95a27fa970fbc9998f73Andy McFadden        inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp,
30782c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala                android_dataspace dataSpace, const Rect& crop, int scalingMode,
308567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos                uint32_t transform, const sp<Fence>& fence, uint32_t sticky = 0)
30982c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala                : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp),
31082c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala                  dataSpace(dataSpace), crop(crop), scalingMode(scalingMode),
311567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos                  transform(transform), stickyTransform(sticky), fence(fence),
312567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos                  surfaceDamage() { }
3133c25621ad7d13f64d3ab95a27fa970fbc9998f73Andy McFadden        inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp,
31482c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala                android_dataspace* outDataSpace,
31582c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala                Rect* outCrop, int* outScalingMode,
316567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos                uint32_t* outTransform, sp<Fence>* outFence,
3171681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk                uint32_t* outStickyTransform = NULL) const {
318f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outTimestamp = timestamp;
3193c25621ad7d13f64d3ab95a27fa970fbc9998f73Andy McFadden            *outIsAutoTimestamp = bool(isAutoTimestamp);
32082c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala            *outDataSpace = dataSpace;
321f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outCrop = crop;
322f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outScalingMode = scalingMode;
323f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outTransform = transform;
324c777b0b3b9b0ea5d8e378fccde6935765e28e329Jesse Hall            *outFence = fence;
3251681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk            if (outStickyTransform != NULL) {
3261681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk                *outStickyTransform = stickyTransform;
3271681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk            }
328f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        }
329c777b0b3b9b0ea5d8e378fccde6935765e28e329Jesse Hall
330e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        // Flattenable protocol
331e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        size_t getFlattenedSize() const;
332e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        size_t getFdCount() const;
333e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const;
334e142428a9c8b9d2380032cd4d7b55ee440fe8770Mathias Agopian        status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count);
335c777b0b3b9b0ea5d8e378fccde6935765e28e329Jesse Hall
3365065a55291b67f584d7b0be3fa3cfc4e29a3cd1cDan Stoza        const Region& getSurfaceDamage() const { return surfaceDamage; }
3375065a55291b67f584d7b0be3fa3cfc4e29a3cd1cDan Stoza        void setSurfaceDamage(const Region& damage) { surfaceDamage = damage; }
3385065a55291b67f584d7b0be3fa3cfc4e29a3cd1cDan Stoza
339f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian    private:
340f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        int64_t timestamp;
3413c25621ad7d13f64d3ab95a27fa970fbc9998f73Andy McFadden        int isAutoTimestamp;
34282c6bcc9705eabcaf5b9e45bc81867b0e2d61a02Eino-Ville Talvala        android_dataspace dataSpace;
343f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        Rect crop;
344f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        int scalingMode;
345f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        uint32_t transform;
3461681d95989271f3a9ac0dbb93d10e4a29f2b4444Ruben Brunk        uint32_t stickyTransform;
347c777b0b3b9b0ea5d8e378fccde6935765e28e329Jesse Hall        sp<Fence> fence;
3485065a55291b67f584d7b0be3fa3cfc4e29a3cd1cDan Stoza        Region surfaceDamage;
349f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian    };
350f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian
351f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian    // QueueBufferOutput must be a POD structure
3527d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    struct __attribute__ ((__packed__)) QueueBufferOutput {
353f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        inline QueueBufferOutput() { }
3547d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // outWidth - filled with default width applied to the buffer
3557d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // outHeight - filled with default height applied to the buffer
3567d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // outTransformHint - filled with default transform applied to the buffer
3577d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        // outNumPendingBuffers - num buffers queued that haven't yet been acquired
3587d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin        //                        (counting the currently queued buffer)
359f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        inline void deflate(uint32_t* outWidth,
3602488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian                uint32_t* outHeight,
3612488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian                uint32_t* outTransformHint,
3622488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian                uint32_t* outNumPendingBuffers) const {
363f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outWidth = width;
364f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outHeight = height;
365f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            *outTransformHint = transformHint;
3662488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian            *outNumPendingBuffers = numPendingBuffers;
367f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        }
368f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        inline void inflate(uint32_t inWidth, uint32_t inHeight,
3692488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian                uint32_t inTransformHint, uint32_t inNumPendingBuffers) {
370f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            width = inWidth;
371f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            height = inHeight;
372f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian            transformHint = inTransformHint;
3732488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian            numPendingBuffers = inNumPendingBuffers;
374f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        }
375f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian    private:
376f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        uint32_t width;
377f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        uint32_t height;
378f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian        uint32_t transformHint;
3792488b20aec097accb20a853d9876bb0a5dc04636Mathias Agopian        uint32_t numPendingBuffers;
380f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian    };
381f0bc2f1d8d37977bd3aef3d3326a70e9e69d4246Mathias Agopian
382567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos    virtual status_t queueBuffer(int slot, const QueueBufferInput& input,
383567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos            QueueBufferOutput* output) = 0;
3848ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
3858ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // cancelBuffer indicates that the client does not wish to fill in the
3868ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // buffer associated with slot and transfers ownership of the slot back to
3878ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    // the server.
3887d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
3897d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The buffer is not queued for use by the consumer.
3907d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
391583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // The slot must be in the range of [0, NUM_BUFFER_SLOTS).
392583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //
3937d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The buffer will not be overwritten until the fence signals.  The fence
3947d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // will usually be the one obtained from dequeueBuffer.
395583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //
396583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // Return of a value other than NO_ERROR means an error has occurred:
397583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * NO_INIT - the buffer queue has been abandoned or the producer is not
398583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //             connected.
399583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    // * BAD_VALUE - one of the below conditions occurred:
400583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //              * fence was NULL
401583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //              * slot index was out of range (see above).
402583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    //              * the slot was not in the dequeued state
403583b1b32191992d6ada58b3c61c71932a71c0c4bPablo Ceballos    virtual status_t cancelBuffer(int slot, const sp<Fence>& fence) = 0;
4048ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
405eafabcdc1639fb96062d9e3c39b0ae27b0238ae1Mathias Agopian    // query retrieves some information for this surface
4067d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // 'what' tokens allowed are that of NATIVE_WINDOW_* in <window.h>
4077d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4087d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a value other than NO_ERROR means an error has occurred:
4097d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * NO_INIT - the buffer queue has been abandoned.
4107d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * BAD_VALUE - what was out of range
411eafabcdc1639fb96062d9e3c39b0ae27b0238ae1Mathias Agopian    virtual int query(int what, int* value) = 0;
4128072711307aa98ee5ee6f7369860ae38c3e19656Mathias Agopian
4132adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // connect attempts to connect a client API to the IGraphicBufferProducer.
4142adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // This must be called before any other IGraphicBufferProducer methods are
4157d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // called except for getAllocator. A consumer must be already connected.
416fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis    //
417fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis    // This method will fail if the connect was previously called on the
4182adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // IGraphicBufferProducer and no corresponding disconnect call was made.
4195bfc24515bb5c8ea7975f72d538df37753733a2fMathias Agopian    //
420f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    // The listener is an optional binder callback object that can be used if
421f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    // the producer wants to be notified when the consumer releases a buffer
422f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    // back to the BufferQueue. It is also used to detect the death of the
423f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    // producer. If only the latter functionality is desired, there is a
424f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    // DummyProducerListener class in IProducerListener.h that can be used.
4257d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4267d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
4277d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4287d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The producerControlledByApp should be set to true if the producer is hosted
4297d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // by an untrusted process (typically app_process-forked processes). If both
4307d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // the producer and the consumer are app-controlled then all buffer queues
4317d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // will operate in async mode regardless of the async flag.
4327d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4337d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Upon success, the output will be filled with meaningful data
4347d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // (refer to QueueBufferOutput documentation above).
4357d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4367d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a value other than NO_ERROR means an error has occurred:
4377d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * NO_INIT - one of the following occurred:
4387d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * the buffer queue was abandoned
4397d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * no consumer has yet connected
4407d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * BAD_VALUE - one of the following has occurred:
4417d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * the producer is already connected
4427d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * api was out of range (see above).
4437ea777f097784492f880623067becac1b276f884Igor Murashkin    //             * output was NULL.
44423b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //             * Failure to adjust the number of available slots. This can
44523b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //               happen because of trying to allocate/deallocate the async
44623b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //               buffer in response to the value of producerControlledByApp.
4477d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * DEAD_OBJECT - the token is hosted by an already-dead process
4487d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4497d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Additional negative errors may be returned by the internals, they
4507d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // should be treated as opaque fatal unrecoverable errors.
451f0eaf25e9247edf4d124bedaeb863f7abdf35a3eDan Stoza    virtual status_t connect(const sp<IProducerListener>& listener,
452365857df8b94c959dea984a63013f6e7730ef976Mathias Agopian            int api, bool producerControlledByApp, QueueBufferOutput* output) = 0;
453fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis
4542adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // disconnect attempts to disconnect a client API from the
4552adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // IGraphicBufferProducer.  Calling this method will cause any subsequent
4562adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // calls to other IGraphicBufferProducer methods to fail except for
4572adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // getAllocator and connect.  Successfully calling connect after this will
4582adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // allow the other methods to succeed again.
459fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis    //
4602adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden    // This method will fail if the the IGraphicBufferProducer is not currently
461fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis    // connected to the specified client API.
4627d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4637d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
4647d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4657d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Disconnecting from an abandoned IGraphicBufferProducer is legal and
4667d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // is considered a no-op.
4677d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //
4687d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // Return of a value other than NO_ERROR means an error has occurred:
4697d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * BAD_VALUE - one of the following has occurred:
4707d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * the api specified does not match the one that was connected
4717d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    //             * api was out of range (see above).
4727d2d160cdc3cba9f4454f38433c94b68376cb843Igor Murashkin    // * DEAD_OBJECT - the token is hosted by an already-dead process
473fe0a87b54654a1392650e7f1862df473287d8332Jamie Gennis    virtual status_t disconnect(int api) = 0;
474399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall
475399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // Attaches a sideband buffer stream to the IGraphicBufferProducer.
476399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    //
477399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // A sideband stream is a device-specific mechanism for passing buffers
478399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // from the producer to the consumer without using dequeueBuffer/
479399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // queueBuffer. If a sideband stream is present, the consumer can choose
480399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // whether to acquire buffers from the sideband stream or from the queued
481399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // buffers.
482399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    //
483399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // Passing NULL or a different stream handle will detach the previous
484399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    // handle if any.
485399184a4cd728ea1421fb0bc1722274a29e38f4aJesse Hall    virtual status_t setSidebandStream(const sp<NativeHandle>& stream) = 0;
48629a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza
48729a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // Allocates buffers based on the given dimensions/format.
48829a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    //
48929a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // This function will allocate up to the maximum number of buffers
49029a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // permitted by the current BufferQueue configuration. It will use the
49129a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // given format, dimensions, and usage bits, which are interpreted in the
49229a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // same way as for dequeueBuffer, and the async flag must be set the same
49329a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // way as for dequeueBuffer to ensure that the correct number of buffers are
49429a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // allocated. This is most useful to avoid an allocation delay during
49529a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // dequeueBuffer. If there are already the maximum number of buffers
49629a3e90879fd96404c971e7187cd0e05927bbce0Dan Stoza    // allocated, this function has no effect.
497567dbbb6dd42be5013fcde0dadb3316d85f2fa0dPablo Ceballos    virtual void allocateBuffers(uint32_t width, uint32_t height,
4983be1c6b60a188dc10025e2ce156c11fac050625dDan Stoza            PixelFormat format, uint32_t usage) = 0;
4999de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza
5009de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // Sets whether dequeueBuffer is allowed to allocate new buffers.
5019de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    //
5029de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // Normally dequeueBuffer does not discriminate between free slots which
5039de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // already have an allocated buffer and those which do not, and will
5049de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // allocate a new buffer if the slot doesn't have a buffer or if the slot's
5059de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // buffer doesn't match the requested size, format, or usage. This method
5069de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // allows the producer to restrict the eligible slots to those which already
5079de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // have an allocated buffer of the correct size, format, and usage. If no
5089de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // eligible slot is available, dequeueBuffer will block or return an error
5099de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    // as usual.
5109de7293b0a1b01ebe6fb1ab4a498f144adc8029fDan Stoza    virtual status_t allowAllocation(bool allow) = 0;
511812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza
512812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // Sets the current generation number of the BufferQueue.
513812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    //
514812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // This generation number will be inserted into any buffers allocated by the
515812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // BufferQueue, and any attempts to attach a buffer with a different
516812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // generation number will fail. Buffers already in the queue are not
517812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // affected and will retain their current generation number. The generation
518812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    // number defaults to 0.
519812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2Dan Stoza    virtual status_t setGenerationNumber(uint32_t generationNumber) = 0;
520c6f30bdee1f634eb90d68cb76efe935b6535a1e8Dan Stoza
521c6f30bdee1f634eb90d68cb76efe935b6535a1e8Dan Stoza    // Returns the name of the connected consumer.
522c6f30bdee1f634eb90d68cb76efe935b6535a1e8Dan Stoza    virtual String8 getConsumerName() const = 0;
5237dde599bf1a0dbef7390d91c2689d506371cdbd7Dan Stoza
5247dde599bf1a0dbef7390d91c2689d506371cdbd7Dan Stoza    // Returns the number of the next frame which will be dequeued.
5257dde599bf1a0dbef7390d91c2689d506371cdbd7Dan Stoza    virtual uint64_t getNextFrameNumber() const = 0;
526ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos
5273559fbf93801e2c0d9d8fb246fb9b867a361b464Pablo Ceballos    // Used to enable/disable shared buffer mode.
528ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584Pablo Ceballos    //
5293559fbf93801e2c0d9d8fb246fb9b867a361b464Pablo Ceballos    // When shared buffer mode is enabled the first buffer that is queued or
530295a9fc8aa87daa2cded5c1a279b8cd24e9a9a9fPablo Ceballos    // dequeued will be cached and returned to all subsequent calls to
531295a9fc8aa87daa2cded5c1a279b8cd24e9a9a9fPablo Ceballos    // dequeueBuffer and acquireBuffer. This allows the producer and consumer to
532295a9fc8aa87daa2cded5c1a279b8cd24e9a9a9fPablo Ceballos    // simultaneously access the same buffer.
5333559fbf93801e2c0d9d8fb246fb9b867a361b464Pablo Ceballos    virtual status_t setSharedBufferMode(bool sharedBufferMode) = 0;
534127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza
535ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    // Used to enable/disable auto-refresh.
536ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    //
5373559fbf93801e2c0d9d8fb246fb9b867a361b464Pablo Ceballos    // Auto refresh has no effect outside of shared buffer mode. In shared
538ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    // buffer mode, when enabled, it indicates to the consumer that it should
539ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    // attempt to acquire buffers even if it is not aware of any being
540ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    // available.
541ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos    virtual status_t setAutoRefresh(bool autoRefresh) = 0;
542ff95aabbcc6e8606acbd7933c90eeb9b8b382a21Pablo Ceballos
543127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // Sets how long dequeueBuffer will wait for a buffer to become available
544127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // before returning an error (TIMED_OUT).
545127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    //
546127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // This timeout also affects the attachBuffer call, which will block if
547127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // there is not a free slot available into which the attached buffer can be
548127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // placed.
549127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    //
550127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // By default, the BufferQueue will wait forever, which is indicated by a
551127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // timeout of -1. If set (to a value other than -1), this will disable
552127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // non-blocking mode and its corresponding spare buffer (which is used to
553127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    // ensure a buffer is always available).
55423b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //
55523b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    // Return of a value other than NO_ERROR means an error has occurred:
55623b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    // * BAD_VALUE - Failure to adjust the number of available slots. This can
55723b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //               happen because of trying to allocate/deallocate the async
55823b4abe024ea88c45e0b94c80e1fb537a573b143Pablo Ceballos    //               buffer.
559127fc63e8a15366b4395f1363e8e18eb058d1709Dan Stoza    virtual status_t setDequeueTimeout(nsecs_t timeout) = 0;
56050101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza
56150101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    // Returns the last queued buffer along with a fence which must signal
56250101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    // before the contents of the buffer are read. If there are no buffers in
56350101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    // the queue, outBuffer will be populated with nullptr and outFence will be
56450101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    // populated with Fence::NO_FENCE
56550101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    //
5661a61da5e28fa16ad556a58193c8bbeb32a5f636dJohn Reck    // outTransformMatrix is not modified if outBuffer is null.
5671a61da5e28fa16ad556a58193c8bbeb32a5f636dJohn Reck    //
56850101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    // Returns NO_ERROR or the status of the Binder transaction
56950101d02a8eae555887282a5f761fdec57bdaf30Dan Stoza    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
5701a61da5e28fa16ad556a58193c8bbeb32a5f636dJohn Reck            sp<Fence>* outFence, float outTransformMatrix[16]) = 0;
571eb7980c224a54f860b7af5ecf30cbc633ae41289Pablo Ceballos
572eb7980c224a54f860b7af5ecf30cbc633ae41289Pablo Ceballos    // Returns a unique id for this BufferQueue
573eb7980c224a54f860b7af5ecf30cbc633ae41289Pablo Ceballos    virtual status_t getUniqueId(uint64_t* outId) const = 0;
5748ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis};
5758ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
5768ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis// ----------------------------------------------------------------------------
5778ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
5782adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFaddenclass BnGraphicBufferProducer : public BnInterface<IGraphicBufferProducer>
5798ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis{
5808ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennispublic:
5818ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis    virtual status_t    onTransact( uint32_t code,
5828ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis                                    const Parcel& data,
5838ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis                                    Parcel* reply,
5848ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis                                    uint32_t flags = 0);
5858ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis};
5868ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
5878ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis// ----------------------------------------------------------------------------
5888ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis}; // namespace android
5898ba32fade11abb73f3fd47ea0953c9528eb5b91fJamie Gennis
5902adaf04fab35cf47c824d74d901b54094e01ccd3Andy McFadden#endif // ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
591