Home | History | Annotate | Download | only in 1.0
      1 /*
      2  * Copyright (C) 2017 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 package android.hardware.graphics.bufferqueue@1.0;
     18 
     19 import android.hardware.media@1.0::Fence;
     20 import android.hardware.media@1.0::AnwBuffer;
     21 import android.hardware.media@1.0::Rect;
     22 import android.hardware.media@1.0::Region;
     23 
     24 import android.hardware.graphics.common@1.0::Dataspace;
     25 import android.hardware.graphics.common@1.0::PixelFormat;
     26 
     27 import IProducerListener;
     28 
     29 /**
     30  * Ref: frameworks/native/include/gui/IGraphicBufferProducer.h:
     31  *      IGraphicBufferProducer
     32  * This is a wrapper/wrapped HAL interface for the actual binder interface.
     33  */
     34 interface IGraphicBufferProducer {
     35 
     36     /**
     37      * Type for return values of functions in IGraphicBufferProducer.
     38      */
     39     typedef int32_t Status;
     40 
     41     /**
     42      * Ref: frameworks/native/include/ui/FenceTime.h: FenceTime::Snapshot
     43      *
     44      * An atomic snapshot of the FenceTime that is flattenable.
     45      */
     46     struct FenceTimeSnapshot {
     47         enum State : int32_t {
     48             EMPTY,
     49             FENCE,
     50             SIGNAL_TIME,
     51         };
     52         State state;
     53         Fence fence;
     54         int64_t signalTimeNs;
     55     };
     56 
     57     /**
     58      * Ref: frameworks/native/include/gui/FrameTimestamp.h: FrameEventsDelta
     59      *
     60      * A single frame update from the consumer to producer that can be sent
     61      * through a HIDL interface. Although this may be sent multiple times for
     62      * the same frame as new timestamps are set, Fences only need to be sent
     63      * once.
     64      */
     65     struct FrameEventsDelta {
     66         uint32_t index;
     67         uint64_t frameNumber;
     68         bool addPostCompositeCalled;
     69         bool addRetireCalled;
     70         bool addReleaseCalled;
     71         int64_t postedTimeNs;
     72         int64_t requestedPresentTimeNs;
     73         int64_t latchTimeNs;
     74         int64_t firstRefreshStartTimeNs;
     75         int64_t lastRefreshStartTimeNs;
     76         int64_t dequeueReadyTime;
     77         FenceTimeSnapshot gpuCompositionDoneFence;
     78         FenceTimeSnapshot displayPresentFence;
     79         FenceTimeSnapshot displayRetireFence;
     80         FenceTimeSnapshot releaseFence;
     81     };
     82 
     83     /**
     84      * Ref: frameworks/native/include/gui/FrameTimestamp.h: CompositorTiming
     85      *
     86      * The most recent compositor timing info sent from consumer to producer
     87      * through a HIDL interface.
     88      */
     89     struct CompositorTiming {
     90         int64_t deadlineNs;
     91         int64_t intervalNs;
     92         int64_t presentLatencyNs;
     93     };
     94 
     95     /**
     96      * Ref: frameworks/native/include/gui/FrameTimestamp.h: FrameEventHistoryDelta
     97      *
     98      * A collection of updates from consumer to producer that can be sent
     99      * through a HIDL interface.
    100      */
    101     struct FrameEventHistoryDelta {
    102         vec<FrameEventsDelta> deltas;
    103         CompositorTiming compositorTiming;
    104     };
    105 
    106     /**
    107      * Modes for disconnection.
    108      */
    109     enum DisconnectMode : int32_t {
    110         /** Disconnect only the specified API. */
    111         API,
    112         /** Disconnect any API originally connected from the process calling
    113          *  disconnect. */
    114         ALL_LOCAL
    115     };
    116 
    117     struct QueueBufferInput {
    118         /** A monotonically increasing value in nanoseconds. */
    119         int64_t timestamp;
    120         /** Whether the timestamp was synthesized at queue time. */
    121         int32_t isAutoTimestamp;
    122         /** Description of the contents, interpretation depends on format. */
    123         Dataspace dataSpace;
    124         /** A crop rectangle that's used as a hint to the consumer. */
    125         Rect crop;
    126         /** A set of flags from NATIVE_WINDOW_SCALING_* in <window.h>. */
    127         int32_t scalingMode;
    128         /** A set of flags from NATIVE_WINDOW_TRANSFORM_* in <window.h>. */
    129         uint32_t transform;
    130         /** The sticky transform set in Surface (only used by the LEGACY camera
    131          *  mode). */
    132         uint32_t stickyTransform;
    133         /** A fence that the consumer must wait on before reading the buffer;
    134          *  set this to Fence::NO_FENCE if the buffer is ready immediately. */
    135         Fence fence;
    136         Region surfaceDamage;
    137         /** Whether or not the latest frame timestamps should be retrieved from
    138          *  the consumer. */
    139         bool getFrameTimestamps;
    140     };
    141 
    142     struct QueueBufferOutput {
    143         uint32_t width;
    144         uint32_t height;
    145         uint32_t transformHint;
    146         uint32_t numPendingBuffers;
    147         uint64_t nextFrameNumber;
    148         bool bufferReplaced;
    149         FrameEventHistoryDelta frameTimestamps;
    150     };
    151 
    152     /**
    153      * requestBuffer requests a new buffer for the given index. The server (i.e.
    154      * the IProducerListener implementation) assigns the newly created
    155      * buffer to the given slot index, and the client is expected to mirror the
    156      * slot->buffer mapping so that it's not necessary to transfer an
    157      * AnwBuffer for every dequeue operation.
    158      *
    159      * The slot must be in the range of [0, NUM_BUFFER_SLOTS).
    160      *
    161      * Return of a value other than NO_ERROR means an error has occurred:
    162      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    163      *             connected.
    164      * * BAD_VALUE - one of the two conditions occurred:
    165      *              * slot was out of range (see above)
    166      *              * buffer specified by the slot is not dequeued
    167      */
    168     requestBuffer(
    169             int32_t slot
    170         ) generates (
    171             Status status,
    172             AnwBuffer buffer
    173         );
    174 
    175     /**
    176      * setMaxDequeuedBufferCount sets the maximum number of buffers that can be
    177      * dequeued by the producer at one time. If this method succeeds, any new
    178      * buffer slots will be both unallocated and owned by the BufferQueue object
    179      * (i.e. they are not owned by the producer or consumer). Calling this may
    180      * also cause some buffer slots to be emptied. If the caller is caching the
    181      * contents of the buffer slots, it should empty that cache after calling
    182      * this method.
    183      *
    184      * This function should not be called with a value of maxDequeuedBuffers
    185      * that is less than the number of currently dequeued buffer slots. Doing so
    186      * will result in a BAD_VALUE error.
    187      *
    188      * The buffer count should be at least 1 (inclusive), but at most
    189      * (NUM_BUFFER_SLOTS - the minimum undequeued buffer count) (exclusive). The
    190      * minimum undequeued buffer count can be obtained by calling
    191      * query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS).
    192      *
    193      * Return of a value other than NO_ERROR means an error has occurred:
    194      * * NO_INIT - the buffer queue has been abandoned.
    195      * * BAD_VALUE - one of the below conditions occurred:
    196      *     * bufferCount was out of range (see above).
    197      *     * client would have more than the requested number of dequeued
    198      *       buffers after this call.
    199      *     * this call would cause the maxBufferCount value to be exceeded.
    200      *     * failure to adjust the number of available slots.
    201      */
    202     setMaxDequeuedBufferCount(
    203             int32_t maxDequeuedBuffers
    204         ) generates (
    205             Status status
    206         );
    207 
    208     /**
    209      * Set the async flag if the producer intends to asynchronously queue
    210      * buffers without blocking. Typically this is used for triple-buffering
    211      * and/or when the swap interval is set to zero.
    212      *
    213      * Enabling async mode will internally allocate an additional buffer to
    214      * allow for the asynchronous behavior. If it is not enabled queue/dequeue
    215      * calls may block.
    216      *
    217      * Return of a value other than NO_ERROR means an error has occurred:
    218      * * NO_INIT - the buffer queue has been abandoned.
    219      * * BAD_VALUE - one of the following has occurred:
    220      *             * this call would cause the maxBufferCount value to be
    221      *               exceeded
    222      *             * failure to adjust the number of available slots.
    223      */
    224     setAsyncMode(
    225             bool async
    226         ) generates (
    227             Status status
    228         );
    229 
    230     /**
    231      * dequeueBuffer requests a new buffer slot for the client to use. Ownership
    232      * of the slot is transfered to the client, meaning that the server will not
    233      * use the contents of the buffer associated with that slot.
    234      *
    235      * The slot index returned may or may not contain a buffer (client-side).
    236      * If the slot is empty the client should call requestBuffer to assign a new
    237      * buffer to that slot.
    238      *
    239      * Once the client is done filling this buffer, it is expected to transfer
    240      * buffer ownership back to the server with either cancelBuffer on
    241      * the dequeued slot or to fill in the contents of its associated buffer
    242      * contents and call queueBuffer.
    243      *
    244      * If dequeueBuffer returns the BUFFER_NEEDS_REALLOCATION flag, the client is
    245      * expected to call requestBuffer immediately.
    246      *
    247      * If dequeueBuffer returns the RELEASE_ALL_BUFFERS flag, the client is
    248      * expected to release all of the mirrored slot->buffer mappings.
    249      *
    250      * The fence parameter will be updated to hold the fence associated with
    251      * the buffer. The contents of the buffer must not be overwritten until the
    252      * fence signals. If the fence is Fence::NO_FENCE, the buffer may be written
    253      * immediately.
    254      *
    255      * The width and height parameters must be no greater than the minimum of
    256      * GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv).
    257      * An error due to invalid dimensions might not be reported until
    258      * updateTexImage() is called.  If width and height are both zero, the
    259      * default values specified by setDefaultBufferSize() are used instead.
    260      *
    261      * If the format is 0, the default format will be used.
    262      *
    263      * The usage argument specifies gralloc buffer usage flags.  The values
    264      * are enumerated in <gralloc.h>, e.g. GRALLOC_USAGE_HW_RENDER.  These
    265      * will be merged with the usage flags specified by
    266      * IGraphicBufferConsumer::setConsumerUsageBits.
    267      *
    268      * This call will block until a buffer is available to be dequeued. If
    269      * both the producer and consumer are controlled by the app, then this call
    270      * can never block and will return WOULD_BLOCK if no buffer is available.
    271      *
    272      * A non-negative value with flags set (see above) will be returned upon
    273      * success as status.
    274      *
    275      * Return of a negative means an error has occurred:
    276      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    277      *             connected.
    278      * * BAD_VALUE - both in async mode and buffer count was less than the
    279      *               max numbers of buffers that can be allocated at once.
    280      * * INVALID_OPERATION - cannot attach the buffer because it would cause
    281      *                       too many buffers to be dequeued, either because
    282      *                       the producer already has a single buffer dequeued
    283      *                       and did not set a buffer count, or because a
    284      *                       buffer count was set and this call would cause
    285      *                       it to be exceeded.
    286      * * WOULD_BLOCK - no buffer is currently available, and blocking is disabled
    287      *                 since both the producer/consumer are controlled by app
    288      * * NO_MEMORY - out of memory, cannot allocate the graphics buffer.
    289      * * TIMED_OUT - the timeout set by setDequeueTimeout was exceeded while
    290      *               waiting for a buffer to become available.
    291      *
    292      * All other negative values are an unknown error returned downstream
    293      * from the graphics allocator (typically errno).
    294      */
    295     dequeueBuffer(
    296             uint32_t width,
    297             uint32_t height,
    298             PixelFormat format,
    299             uint32_t usage,
    300             bool getFrameTimestamps
    301         ) generates (
    302             Status status,
    303             int32_t slot,
    304             Fence fence,
    305             FrameEventHistoryDelta outTimestamps
    306         );
    307 
    308     /**
    309      * detachBuffer attempts to remove all ownership of the buffer in the given
    310      * slot from the buffer queue. If this call succeeds, the slot will be
    311      * freed, and there will be no way to obtain the buffer from this interface.
    312      * The freed slot will remain unallocated until either it is selected to
    313      * hold a freshly allocated buffer in dequeueBuffer or a buffer is attached
    314      * to the slot. The buffer must have already been dequeued, and the caller
    315      * must already possesses the sp<AnwBuffer> (i.e., must have called
    316      * requestBuffer).
    317      *
    318      * Return of a value other than NO_ERROR means an error has occurred:
    319      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    320      *             connected.
    321      * * BAD_VALUE - the given slot number is invalid, either because it is
    322      *               out of the range [0, NUM_BUFFER_SLOTS), or because the slot
    323      *               it refers to is not currently dequeued and requested.
    324      */
    325     detachBuffer(
    326             int32_t slot
    327         ) generates (
    328             Status status
    329         );
    330 
    331     /**
    332      * detachNextBuffer is equivalent to calling dequeueBuffer, requestBuffer,
    333      * and detachBuffer in sequence, except for two things:
    334      *
    335      * 1) It is unnecessary to know the dimensions, format, or usage of the
    336      *    next buffer.
    337      * 2) It will not block, since if it cannot find an appropriate buffer to
    338      *    return, it will return an error instead.
    339      *
    340      * Only slots that are free but still contain an AnwBuffer will be
    341      * considered, and the oldest of those will be returned. buffer is
    342      * equivalent to buffer from the requestBuffer call, and fence is
    343      * equivalent to fence from the dequeueBuffer call.
    344      *
    345      * Return of a value other than NO_ERROR means an error has occurred:
    346      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    347      *             connected.
    348      * * BAD_VALUE - either outBuffer or outFence were NULL.
    349      * * NO_MEMORY - no slots were found that were both free and contained a
    350      *               AnwBuffer.
    351      */
    352     detachNextBuffer(
    353         ) generates (
    354             Status status,
    355             AnwBuffer buffer,
    356             Fence fence
    357         );
    358 
    359     /**
    360      * attachBuffer attempts to transfer ownership of a buffer to the buffer
    361      * queue. If this call succeeds, it will be as if this buffer was dequeued
    362      * from the returned slot number. As such, this call will fail if attaching
    363      * this buffer would cause too many buffers to be simultaneously dequeued.
    364      *
    365      * If attachBuffer returns the RELEASE_ALL_BUFFERS flag, the caller is
    366      * expected to release all of the mirrored slot->buffer mappings.
    367      *
    368      * A non-negative value with flags set (see above) will be returned upon
    369      * success.
    370      *
    371      * Return of a negative value means an error has occurred:
    372      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    373      *             connected.
    374      * * BAD_VALUE - outSlot or buffer were NULL, invalid combination of
    375      *               async mode and buffer count override, or the generation
    376      *               number of the buffer did not match the buffer queue.
    377      * * INVALID_OPERATION - cannot attach the buffer because it would cause
    378      *                       too many buffers to be dequeued, either because
    379      *                       the producer already has a single buffer dequeued
    380      *                       and did not set a buffer count, or because a
    381      *                       buffer count was set and this call would cause
    382      *                       it to be exceeded.
    383      * * WOULD_BLOCK - no buffer slot is currently available, and blocking is
    384      *                 disabled since both the producer/consumer are
    385      *                 controlled by the app.
    386      * * TIMED_OUT - the timeout set by setDequeueTimeout was exceeded while
    387      *               waiting for a slot to become available.
    388      */
    389     attachBuffer(
    390             AnwBuffer buffer
    391         ) generates (
    392             Status status,
    393             int32_t slot
    394         );
    395 
    396     /**
    397      * queueBuffer indicates that the client has finished filling in the
    398      * contents of the buffer associated with slot and transfers ownership of
    399      * that slot back to the server.
    400      *
    401      * It is not valid to call queueBuffer on a slot that is not owned
    402      * by the client or one for which a buffer associated via requestBuffer
    403      * (an attempt to do so will fail with a return value of BAD_VALUE).
    404      *
    405      * In addition, the input must be described by the client (as documented
    406      * below). Any other properties (zero point, etc)
    407      * are client-dependent, and should be documented by the client.
    408      *
    409      * The slot must be in the range of [0, NUM_BUFFER_SLOTS).
    410      *
    411      * Upon success, the output will be filled with meaningful values
    412      * (refer to the documentation below).
    413      *
    414      * Return of a value other than NO_ERROR means an error has occurred:
    415      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    416      *             connected.
    417      * * BAD_VALUE - one of the below conditions occurred:
    418      *              * fence was NULL
    419      *              * scaling mode was unknown
    420      *              * both in async mode and buffer count was less than the
    421      *                max numbers of buffers that can be allocated at once
    422      *              * slot index was out of range (see above).
    423      *              * the slot was not in the dequeued state
    424      *              * the slot was enqueued without requesting a buffer
    425      *              * crop rect is out of bounds of the buffer dimensions
    426      */
    427     queueBuffer(
    428             int32_t slot,
    429             QueueBufferInput input
    430         ) generates (
    431             Status status,
    432             QueueBufferOutput output
    433         );
    434 
    435     /**
    436      * cancelBuffer indicates that the client does not wish to fill in the
    437      * buffer associated with slot and transfers ownership of the slot back to
    438      * the server.
    439      *
    440      * The buffer is not queued for use by the consumer.
    441      *
    442      * The slot must be in the range of [0, NUM_BUFFER_SLOTS).
    443      *
    444      * The buffer will not be overwritten until the fence signals.  The fence
    445      * will usually be the one obtained from dequeueBuffer.
    446      *
    447      * Return of a value other than NO_ERROR means an error has occurred:
    448      * * NO_INIT - the buffer queue has been abandoned or the producer is not
    449      *             connected.
    450      * * BAD_VALUE - one of the below conditions occurred:
    451      *              * fence was NULL
    452      *              * slot index was out of range (see above).
    453      *              * the slot was not in the dequeued state
    454      */
    455     cancelBuffer(
    456             int32_t slot,
    457             Fence fence
    458         ) generates (
    459             Status status
    460         );
    461 
    462     /**
    463      * query retrieves some information for this surface
    464      * 'what' tokens allowed are that of NATIVE_WINDOW_* in <window.h>
    465      *
    466      * Return of a value other than NO_ERROR means an error has occurred:
    467      * * NO_INIT - the buffer queue has been abandoned.
    468      * * BAD_VALUE - what was out of range
    469      */
    470     query(
    471             int32_t what
    472         ) generates (
    473             int32_t result,
    474             int32_t value
    475         );
    476 
    477     /**
    478      * connect attempts to connect a client API to the IGraphicBufferProducer.
    479      * This must be called before any other IGraphicBufferProducer methods are
    480      * called except for getAllocator. A consumer must be already connected.
    481      *
    482      * This method will fail if the connect was previously called on the
    483      * IGraphicBufferProducer and no corresponding disconnect call was made.
    484      *
    485      * The listener is an optional binder callback object that can be used if
    486      * the producer wants to be notified when the consumer releases a buffer
    487      * back to the BufferQueue. It is also used to detect the death of the
    488      * producer. If only the latter functionality is desired, there is a
    489      * DummyProducerListener class in IProducerListener.h that can be used.
    490      *
    491      * The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
    492      *
    493      * The producerControlledByApp should be set to true if the producer is hosted
    494      * by an untrusted process (typically app_process-forked processes). If both
    495      * the producer and the consumer are app-controlled then all buffer queues
    496      * will operate in async mode regardless of the async flag.
    497      *
    498      * Upon success, the output will be filled with meaningful data
    499      * (refer to QueueBufferOutput documentation above).
    500      *
    501      * Return of a value other than NO_ERROR means an error has occurred:
    502      * * NO_INIT - one of the following occurred:
    503      *             * the buffer queue was abandoned
    504      *             * no consumer has yet connected
    505      * * BAD_VALUE - one of the following has occurred:
    506      *             * the producer is already connected
    507      *             * api was out of range (see above).
    508      *             * output was NULL.
    509      *             * Failure to adjust the number of available slots. This can
    510      *               happen because of trying to allocate/deallocate the async
    511      *               buffer in response to the value of producerControlledByApp.
    512      * * DEAD_OBJECT - the token is hosted by an already-dead process
    513      *
    514      * Additional negative errors may be returned by the internals, they
    515      * should be treated as opaque fatal unrecoverable errors.
    516      */
    517     connect(
    518             IProducerListener listener,
    519             int32_t api,
    520             bool producerControlledByApp
    521         ) generates (
    522             Status status,
    523             QueueBufferOutput output
    524         );
    525 
    526     /**
    527      * disconnect attempts to disconnect a client API from the
    528      * IGraphicBufferProducer.  Calling this method will cause any subsequent
    529      * calls to other IGraphicBufferProducer methods to fail except for
    530      * getAllocator and connect.  Successfully calling connect after this will
    531      * allow the other methods to succeed again.
    532      *
    533      * The api should be one of the NATIVE_WINDOW_API_* values in <window.h>
    534      *
    535      * Alternatively if mode is AllLocal, then the API value is ignored, and any API
    536      * connected from the same PID calling disconnect will be disconnected.
    537      *
    538      * Disconnecting from an abandoned IGraphicBufferProducer is legal and
    539      * is considered a no-op.
    540      *
    541      * Return of a value other than NO_ERROR means an error has occurred:
    542      * * BAD_VALUE - one of the following has occurred:
    543      *             * the api specified does not match the one that was connected
    544      *             * api was out of range (see above).
    545      * * DEAD_OBJECT - the token is hosted by an already-dead process
    546      */
    547     disconnect(
    548             int32_t api,
    549             DisconnectMode mode /* = DisconnectMode::API */
    550         ) generates (
    551             Status status
    552         );
    553 
    554     /**
    555      * Attaches a sideband buffer stream to the IGraphicBufferProducer.
    556      *
    557      * A sideband stream is a device-specific mechanism for passing buffers
    558      * from the producer to the consumer without using dequeueBuffer/
    559      * queueBuffer. If a sideband stream is present, the consumer can choose
    560      * whether to acquire buffers from the sideband stream or from the queued
    561      * buffers.
    562      *
    563      * Passing NULL or a different stream handle will detach the previous
    564      * handle if any.
    565      */
    566     setSidebandStream(
    567             handle stream
    568         ) generates (
    569             Status status
    570         );
    571 
    572     /**
    573      * Allocates buffers based on the given dimensions/format.
    574      *
    575      * This function will allocate up to the maximum number of buffers
    576      * permitted by the current BufferQueue configuration. It will use the
    577      * given format, dimensions, and usage bits, which are interpreted in the
    578      * same way as for dequeueBuffer, and the async flag must be set the same
    579      * way as for dequeueBuffer to ensure that the correct number of buffers are
    580      * allocated. This is most useful to avoid an allocation delay during
    581      * dequeueBuffer. If there are already the maximum number of buffers
    582      * allocated, this function has no effect.
    583      */
    584     allocateBuffers(
    585             uint32_t width,
    586             uint32_t height,
    587             PixelFormat format,
    588             uint32_t usage
    589         );
    590 
    591     /**
    592      * Sets whether dequeueBuffer is allowed to allocate new buffers.
    593      *
    594      * Normally dequeueBuffer does not discriminate between free slots which
    595      * already have an allocated buffer and those which do not, and will
    596      * allocate a new buffer if the slot doesn't have a buffer or if the slot's
    597      * buffer doesn't match the requested size, format, or usage. This method
    598      * allows the producer to restrict the eligible slots to those which already
    599      * have an allocated buffer of the correct size, format, and usage. If no
    600      * eligible slot is available, dequeueBuffer will block or return an error
    601      * as usual.
    602      */
    603     allowAllocation(
    604             bool allow
    605         ) generates (
    606             Status status
    607         );
    608 
    609     /**
    610      * Sets the current generation number of the BufferQueue.
    611      *
    612      * This generation number will be inserted into any buffers allocated by the
    613      * BufferQueue, and any attempts to attach a buffer with a different
    614      * generation number will fail. Buffers already in the queue are not
    615      * affected and will retain their current generation number. The generation
    616      * number defaults to 0.
    617      */
    618     setGenerationNumber(
    619             uint32_t generationNumber
    620         ) generates (
    621             Status status
    622         );
    623 
    624     /**
    625      * Returns the name of the connected consumer.
    626      */
    627     getConsumerName(
    628         ) generates (
    629             string name
    630         );
    631 
    632     /**
    633      * Used to enable/disable shared buffer mode.
    634      *
    635      * When shared buffer mode is enabled the first buffer that is queued or
    636      * dequeued will be cached and returned to all subsequent calls to
    637      * dequeueBuffer and acquireBuffer. This allows the producer and consumer to
    638      * simultaneously access the same buffer.
    639      */
    640     setSharedBufferMode(
    641             bool sharedBufferMode
    642         ) generates (
    643             Status status
    644         );
    645 
    646     /**
    647      * Used to enable/disable auto-refresh.
    648      *
    649      * Auto refresh has no effect outside of shared buffer mode. In shared
    650      * buffer mode, when enabled, it indicates to the consumer that it should
    651      * attempt to acquire buffers even if it is not aware of any being
    652      * available.
    653      */
    654     setAutoRefresh(
    655             bool autoRefresh
    656         ) generates (
    657             Status status
    658         );
    659 
    660     /**
    661      * Sets how long dequeueBuffer will wait for a buffer to become available
    662      * before returning an error (TIMED_OUT).
    663      *
    664      * This timeout also affects the attachBuffer call, which will block if
    665      * there is not a free slot available into which the attached buffer can be
    666      * placed.
    667      *
    668      * By default, the BufferQueue will wait forever, which is indicated by a
    669      * timeout of -1. If set (to a value other than -1), this will disable
    670      * non-blocking mode and its corresponding spare buffer (which is used to
    671      * ensure a buffer is always available).
    672      *
    673      * Return of a value other than NO_ERROR means an error has occurred:
    674      * * BAD_VALUE - Failure to adjust the number of available slots. This can
    675      *               happen because of trying to allocate/deallocate the async
    676      *               buffer.
    677      */
    678     setDequeueTimeout(
    679             int64_t timeoutNs
    680         ) generates (
    681             Status status
    682         );
    683 
    684     /**
    685      * Returns the last queued buffer along with a fence which must signal
    686      * before the contents of the buffer are read. If there are no buffers in
    687      * the queue, buffer.nativeHandle and fence will be null handles.
    688      *
    689      * transformMatrix is meaningless if buffer.nativeHandle is null.
    690      */
    691     getLastQueuedBuffer(
    692         ) generates (
    693             Status status,
    694             AnwBuffer buffer,
    695             Fence fence,
    696             float[16] transformMatrix
    697         );
    698 
    699     /**
    700      * Gets the frame events that haven't already been retrieved.
    701      */
    702     getFrameTimestamps(
    703         ) generates (
    704             FrameEventHistoryDelta timeStamps
    705         );
    706 
    707     /**
    708      * Returns a unique id for this BufferQueue.
    709      */
    710     getUniqueId(
    711         ) generates (
    712             Status status,
    713             uint64_t outId
    714         );
    715 
    716 };
    717 
    718 
    719