History log of /frameworks/native/libs/gui/Surface.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
eb7980c224a54f860b7af5ecf30cbc633ae41289 28-Jun-2016 Pablo Ceballos <pceballos@google.com> BQ: Add and expose a unique id

Bug 29422927

Change-Id: I80eab94f073ebc378302f00fa86a740c3643657e
/frameworks/native/libs/gui/Surface.cpp
87709c91ffad0cbe92e6b45cc13a2902b3170a2d 03-Jun-2016 Mike Stroyan <stroyan@google.com> libgui: Check result in hook_dequeueBuffer_DEPRECATED

Surface::hook_dequeueBuffer_DEPRECATED calls c->dequeueBuffer without
checking the returned result value. It should check for failing
result and return on error without using the values that
c->dequeueBuffer did not set.

Bug: 28692406
Change-Id: I10f9a23ad1052c5149040124366e0eb91b616267
/frameworks/native/libs/gui/Surface.cpp
1a61da5e28fa16ad556a58193c8bbeb32a5f636d 28-Apr-2016 John Reck <jreck@google.com> Return the transform to apply in getLastQueuedBuffer

Bug: 28428955
Change-Id: Id48f7d3bf3f5deb074cf0a6a52a41caac875db41
/frameworks/native/libs/gui/Surface.cpp
50101d02a8eae555887282a5f761fdec57bdaf30 08-Apr-2016 Dan Stoza <stoza@google.com> libgui: Add getLastQueuedBuffer to BufferQueue

Adds the ability to get the last buffer queued to a BufferQueue plus
its acquire fence.

Bug: 27708453
Change-Id: Iee39475740b40c854a5f46178b2934fd930e61b8
/frameworks/native/libs/gui/Surface.cpp
9f31e299b3ec93b7bac969846105e7e926e3efcd 11-Apr-2016 Robert Carr <racarr@google.com> Add Surface::waitForNextFrame

We can use this for cases like SurfaceView
where one thread (e.g. the framework code)
wants to wait for an unknown client thread
to render a frame in to the surface before
we report it as shown to the window manager.

Bug: 22207948
Change-Id: I9d3344aa1c0ab0f0efd9df24e90ce0410d5f2e22
/frameworks/native/libs/gui/Surface.cpp
3559fbf93801e2c0d9d8fb246fb9b867a361b464 17-Mar-2016 Pablo Ceballos <pceballos@google.com> Rename single buffer mode to shared buffer mode

Change-Id: Id43d0737d9367981644e498942ebc0077d61038c
/frameworks/native/libs/gui/Surface.cpp
88612912ac8406f2be0eeff97892274f98509017 06-Jan-2016 Eino-Ville Talvala <etalvala@google.com> GUI: Move Surface.aidl here and implement for native

- Move android/view/Surface.aidl parcelable definition from frameworks/base
- Implement matching native behavior to android.view.Surface parceling,
to enable use of android.view.Surface in generated native AIDL interfaces

Bug: 25091611
Change-Id: I87ffbb9a19c27a99ce0749d0ca1f17aaa6b3fe74
/frameworks/native/libs/gui/Surface.cpp
aaf51e52cfa937a8938a4429a14432a8424c66d0 20-Feb-2016 Pablo Ceballos <pceballos@google.com> Merge "Add interface for controlling single buffer auto refresh" into nyc-dev
789a0c82cb370d6b82f401cc130af58c85802cbf 05-Feb-2016 Pablo Ceballos <pceballos@google.com> Fix Surface slot caching

- Now that it's possible to resize a BufferQueue while buffers are
dequeued/acquired, it's no longer correct for Surface to clear its
cache when the BufferQueue is resized since it must keep at least
the currently dequeued buffers.
- Add an onSlotsFreed callback to IProducerListener so that producers
that wish to be notified about buffers being freed can do so. Note
that this isn't currently used in Surface.
- Review and fixup all the places where the producer/consumer
listeners for freed buffers should be called.

Change-Id: I4ab0c92bc69b75a3c072ddf5d74d78f941dba4c8
/frameworks/native/libs/gui/Surface.cpp
ff95aabbcc6e8606acbd7933c90eeb9b8b382a21 14-Jan-2016 Pablo Ceballos <pceballos@google.com> Add interface for controlling single buffer auto refresh

- Adds a boolean to BufferQueue that controls whether or not auto
refresh is enabled in SurfaceFlinger when in single buffer mode.
- Adds plumbing up to ANativeWindow.
- When enabled, it will cache the shared buffer slot in Surface in
order to prevent the Binder transaction with SurfaceFlinger.

Bug 24940410

Change-Id: I83142afdc00e203f198a32288f071d926f8fda95
/frameworks/native/libs/gui/Surface.cpp
23b4abe024ea88c45e0b94c80e1fb537a573b143 08-Jan-2016 Pablo Ceballos <pceballos@google.com> BQ: Improved buffer/slot tracking

- Explicitly track active buffers and unused slots on top of the
already existing tracking for free slots and free buffers.

Change-Id: Ife2678678e96f0eb0b3fb21571058378134bd868
/frameworks/native/libs/gui/Surface.cpp
127fc63e8a15366b4395f1363e8e18eb058d1709 30-Jun-2015 Dan Stoza <stoza@google.com> libgui: Add dequeue/attach timeout

Adds the ability to specify the timeout when dequeueBuffer or
attachBuffer block due to the lack of a free buffer/slot. By default,
these will block indefinitely (which is signified by a timeout of -1).

When a timeout (other than -1) is specified, non-blocking mode is
disabled and the given timeout will be used instead.

Bug: 25196773
Change-Id: I17fdbeebccb7c8d878703d758ac1209608258e61
/frameworks/native/libs/gui/Surface.cpp
c2e7788721489c5a2ef681fd0bfa591d2ce41175 17-Dec-2015 Robert Carr <racarr@google.com> Expose setScalingMode from Surface.

While we are here fix a validation error causing
NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP to never be applied.
Furthermore, we remove GLConsumer logic causing the scaling mode to
be reinitialized when buffers change.

Bug: 26010823
Change-Id: I1bf1e4fdc2eded67ff401783cf24f920e4684326
/frameworks/native/libs/gui/Surface.cpp
ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584 08-Oct-2015 Pablo Ceballos <pceballos@google.com> BQ: Add support for single buffer mode

- Adds a single buffer mode to BufferQueue. In this mode designate the
first dequeued buffer as the shared buffer. All calls to dequeue()
and acquire() will then return the shared buffer, allowing the
producer and consumer to share it.
- Modify the buffer slot state tracking. Add a new SHARED state for
the shared buffer in single buffer mode. Also track how many times
a buffer has been dequeued/queued/acquired as it's possible for a
shared buffer to be both dequeued and acquired at the same time, or
dequeued/acquired multiple times. This tracking is needed to know
when to drop the buffer out of the SHARED state after single buffer
mode has been disabled.
- Add plumbing for enabling/disabling single buffer mode from Surface.

Bug 24940410

Change-Id: I3fc550c74bacb5523c049a227111356257386853
/frameworks/native/libs/gui/Surface.cpp
7dde599bf1a0dbef7390d91c2689d506371cdbd7 22-May-2015 Dan Stoza <stoza@google.com> Support SurfaceView synchronization.

Add API for fetching the next frame number to be produced by
a given buffer producer. Add an API to SurfaceComposer to
defer execution of the current transaction until a given frame number.
Together these may be used to synchronize app drawing and surface
control updates.

Change-Id: I8e0f4993332ac0199c768c88581a453fefbaff1d
/frameworks/native/libs/gui/Surface.cpp
567dbbb6dd42be5013fcde0dadb3316d85f2fa0d 27-Aug-2015 Pablo Ceballos <pceballos@google.com> BQ: get rid of async in producer interface

- Get rid of the async flag in dequeueBuffer, allocateBuffers,
waitForFreeSlotThenRelock, and QueueBufferInput.
- Instead use the persistent flags mDequeueBufferCannotBlock and
mAsyncMode to determine whether to use the async behavior.

Bug 13174928

Change-Id: Ie6f7b9e46ee3844ee77b102003c84dddf1bcafdd
/frameworks/native/libs/gui/Surface.cpp
d89c2bb6d265c653d3e1d2d94177c75636760abd 14-Sep-2015 Haixia Shi <hshi@google.com> libgui: Fix missing va_end in Surface::hook_perform()

BUG=23667255
TEST=libgui builds and volantis still works

Change-Id: I01de6ade6a47072c3a32c3eedc8568b1fd571363
/frameworks/native/libs/gui/Surface.cpp
e5b755a045f4203fdd989047441259893c6fbe2d 14-Aug-2015 Pablo Ceballos <pceballos@google.com> BQ: Get rid of setBufferCount

- Remove setBufferCount from BufferQueueProducer and
IGraphicsBufferQueueProducer.
- Get rid of the unit tests for it.
- In Surface, convert setBufferCount calls into calls to
setMaxDequeuedBufferCount.
- Change mOverrideMaxBufferCount to a boolean since it can now be
derived from mMaxAcquiredBufferCount, mMaxDequeuedBufferCount, and
mAsyncMode.

Bug 13174928

Change-Id: Ia0adc737fae9e13f186df832b8428a0829041bf9
/frameworks/native/libs/gui/Surface.cpp
fa455354557f6283ff3a7d76979e52fd251c155f 13-Aug-2015 Pablo Ceballos <pceballos@google.com> BQ: add setMaxDequeuedBufferCount

Adds the new setMaxDequeuedBufferCount() function to
BufferQueueProducer. This will eventually replace setBufferCount.

Also add setAsyncMode.

Bug 13174928

Change-Id: Iea1adcd5d74a75f67d8e9dde06d521695628ad5a
/frameworks/native/libs/gui/Surface.cpp
60d6922a011fe18c111b8d30fb6ef1f655b6b15e 07-Aug-2015 Pablo Ceballos <pceballos@google.com> libsgui: Change Rect default constructor

The current Rect default constructor initializes to all zeroes. Change
it to initialize to an invalid Rect.

Modify all of the existing invocations of the default constructor to
maintain the existing behavior.

Bug 18173359

Change-Id: Ibbad076f1550a94f56d7b1cf5350071f2022e09a
/frameworks/native/libs/gui/Surface.cpp
db4850c01ff02bf7f936aa427e1fa8af9abc8f22 26-Jun-2015 Dan Stoza <stoza@google.com> libgui: Fix handling of rotated surface damage

Incoming surface damage was not aware that the EGL implementation was
rotating buffers in response to SurfaceFlinger's transform hint. This
didn't affect all cases because the effect was to apply a 90 degree
rotation instead of a 270 degree rotation. For full-screen updates,
things more or less worked, but in other cases this caused corruption.

This fixes that by correctly undoing the effect of rotated buffers on
the incoming surface damage, and then passing that damage down
untouched to HWC.

Bug: 22068334
Change-Id: I226ecfc7a91fe2e16edd2aa6d9149f0d26b529d6
/frameworks/native/libs/gui/Surface.cpp
c6f30bdee1f634eb90d68cb76efe935b6535a1e8 08-Jun-2015 Dan Stoza <stoza@google.com> libgui/SurfaceFlinger: Add getConsumerName

Adds a getConsumerName method to IGraphicBufferProducer and Surface.
Currently, the name is cached inside of IGBP and is update on connect
and dequeueBuffer, which should be good enough for most uses.

Bug: 6667401
Change-Id: I22c7881d778e495cf8276de7bbcd769e52429915
/frameworks/native/libs/gui/Surface.cpp
a2ca9bf0a9789e9e5e37961ebfb356347f59309e 08-Jun-2015 Dan Stoza <stoza@google.com> Revert "libgui: Add getConsumerName"

This reverts commit 107fbe5599016b0e35145a1a00c4f238b63d61e4.

Change-Id: I0c2b0f7c81193b05eb3dd2f5a59f83598434b744
/frameworks/native/libs/gui/Surface.cpp
107fbe5599016b0e35145a1a00c4f238b63d61e4 06-Jun-2015 Dan Stoza <stoza@google.com> libgui: Add getConsumerName

Adds a getConsumerName method to IGraphicBufferProducer and Surface.
Currently, the name is cached inside of IGBP and is updated on connect
and dequeueBuffer, which should be good enough for most uses.

Bug: 6667401
Change-Id: Ife94bd89023fe7c00bad916932b9a19233fd2290
/frameworks/native/libs/gui/Surface.cpp
812ed0644f8f8f71ca403f4e5793f0dbc1fcf9b2 03-Jun-2015 Dan Stoza <stoza@google.com> libgui: Add generation numbers to BufferQueue

This change allows producers to set a generation number on a
BufferQueue. This number will be embedded in any new GraphicBuffers
created in that BufferQueue, and attempts to attach buffers which have
a different generation number will fail.

It also plumbs the setGenerationNumber method through Surface, with the
additional effect that any buffers attached to the Surface after
setting a new generation number will automatically be updated with the
new number (as opposed to failing, as would happen on through IGBP).

Bug: 20923096
Change-Id: I32bf726b035f99c3e5834beaf76afb9f01adcbc2
/frameworks/native/libs/gui/Surface.cpp
0e65e6c283c96d514c5ecefbb46a976939cfa64a 26-May-2015 Dan Stoza <stoza@google.com> libgui: Fix surface damage on rotated buffers

Flips the width and height when the buffer comes in with a 90 degree
rotation so that performing the Y-flip from GL works correctly.

Bug: 20761426
Change-Id: I41c9edc8549c6cbdb534277b996ff20c59034582
/frameworks/native/libs/gui/Surface.cpp
4d0cd3f5241df28d8259c5ee7df33649c5c10f2d 30-Apr-2015 Taiju Tsuiki <tzik@google.com> Close Fence FDs in error cases of Surface and GraphicBufferMapper

Surface::{cancel,queue}Buffer and GraphicBufferMapper::lockAsyncYCbCr take the
ownership of |fenceFd|s. Though they don't close it on error cases.

Change-Id: I49a7ce8837d5c510c4ac4ad4649f310d18610e80
(cherry picked from commit c7263fb43297744eb04b11025424c0c526d5584c)
/frameworks/native/libs/gui/Surface.cpp
d9c4971da2f2c4f980a748006bd40469c3332a13 27-Apr-2015 Dan Stoza <stoza@google.com> libgui: Change detachNextBuffer to return sp<GB>

Changes Surface::detachNextBuffer to return an sp<GraphicBuffer>
instead of an ANativeWindowBuffer* to ensure that reference counting
works correctly.

Bug: 20092217
Change-Id: I3979ea6121aaf14845f0554477b778770413581e
(cherry picked from commit 8b2daa3ca29492b181fb67840640d771c4a2b3ac)
/frameworks/native/libs/gui/Surface.cpp
c62acbd12711ee6cff1ef94c146316dfe5169045 22-Apr-2015 Dan Stoza <stoza@google.com> libgui: Fix CPU rendering on Surface

When the surface damage code went in, it incorrectly assumed that if
an application was doing CPU rendering, it would be using lock and
unlockAndPost instead of dequeue and queue, so it repurposed the dirty
region too aggressively. This change keeps it from clobbering the
dirty region if a CPU producer is attached.

Bug: 20431815
Change-Id: Id4dfd71378311ea822f0289f6de2d20a7bd84014
/frameworks/native/libs/gui/Surface.cpp
5065a55291b67f584d7b0be3fa3cfc4e29a3cd1c 18-Mar-2015 Dan Stoza <stoza@google.com> libgui: Pass surface damage through BufferQueue

This change adds support for passing surface damage all of the way
down from the EGL interface through the consumer side of the
BufferQueue. Depends on system/core change
Ie645e6a52b37b5c1b3be19481e8348570d1aa62c

Bug: 11239309
Change-Id: I4457ea826e9ade4ec187f973851d855b7b93a31b
/frameworks/native/libs/gui/Surface.cpp
231832eb27107fb561467f5f4a9be2c577c61ea8 11-Mar-2015 Dan Stoza <stoza@google.com> DO NOT MERGE libgui: Plumb attach/detach through Surface

Exposes the attachBuffer and detachNextBuffer calls from
IGraphicBufferProducer to the public Surface interface. Also moves
the version of connect that takes a producer callback from protected
to public.

Bug: 19628705
Change-Id: I9ebc3013c4d9c84c4e8ef150c00e03f8af80319e
(cherry picked from commit c14ecb9de243af8864610fd3c74342e3ca2cb4bc)
/frameworks/native/libs/gui/Surface.cpp
82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02 20-Feb-2015 Eino-Ville Talvala <etalvala@google.com> DO NOT MERGE Add dataSpace to buffer queues; remove old format enums.

- Wire up new dataSpace parameter through buffer queue stack
- Update tests to include the parameter
- Switch eglApi to using dataSpace to indicate sRGB gamma/linear
difference
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums
- Add default dataspace to buffer queue core
- Add query for default dataspace

Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df

Change-Id: I461952389c18051176c6b75e664f20ad369f5760
/frameworks/native/libs/gui/Surface.cpp
966b98bd86abc6473167bc98ddf8ddb1f8dd2ed5 03-Mar-2015 Dan Stoza <stoza@google.com> Surface: Permit an IProducerListener on connect

This change allows clients of Surface to provide an IProducerListener
callback object to Surface::connect, which will be passed down to the
underlying IGraphicBufferProducer.

Cherry pick of I5ea5229bf3a329bf02c6bd20e7247039c75d136b

Change-Id: I6f8f52c72654e4cee649721383819bafe378f964
/frameworks/native/libs/gui/Surface.cpp
3be1c6b60a188dc10025e2ce156c11fac050625d 18-Nov-2014 Dan Stoza <stoza@google.com> libgui: Enable -Weverything and -Werror

Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.

Cherry pick of I034abec27bf4020d84af60d7acc1939c59986dd6 plus a
couple of minor changes to CpuConsumer.cpp to make it work with a
prior change:
Uncomment CC_LOGV on line 46
Change C-style cast to static_cast on line 71

Change-Id: Iaec610477ea0122317b0578fb74caf2383d4cf08
/frameworks/native/libs/gui/Surface.cpp
b93bca5d0831068cd599f905ba43dc8334095d65 09-Dec-2014 Andreas Gampe <agampe@google.com> am a59d7a6a: Merge "GUI: Remove unused variables"

* commit 'a59d7a6a66a2b8dcb2d00dbd6371fa89ae45ab04':
GUI: Remove unused variables
7398a5af38a9eead2ac6c87da876ba834b450519 09-Dec-2014 Andreas Gampe <agampe@google.com> GUI: Remove unused variables

For build-system CFLAGS clean-up, remove unused variables.

Bug: 18632512
Change-Id: I79fdcf830683d7278f4bf114cfb76a26da1b88ff
/frameworks/native/libs/gui/Surface.cpp
dd883c0b08d2a60f89542b9b9f5fdabcb14885c7 18-Nov-2014 Dan Stoza <stoza@google.com> libgui: Enable -Weverything and -Werror

Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.

This is a squashed commit based on an initial change with a couple of
fixes to avoid breaking certain targets. The source commits are:
d723bd7669b4fc88dc282d8bf8ba5ecb2849d22f
00d504c06ea034befe143e6b8cb34d004670ed02
429ba89cd293633d2f882165066b422c96597df2

Change-Id: I034abec27bf4020d84af60d7acc1939c59986dd6
/frameworks/native/libs/gui/Surface.cpp
9f5a1b6abd5d77923bf5e0f1c5e2816fdee832c2 02-Oct-2014 Jesse Hall <jessehall@google.com> Surface: cancel the dequeued buffer when requestBuffer fails

Partial fix for bug: 17477219
Change-Id: Ibf5a9e26e02c4be8854925a77a70f5c9c7dcf6f2
/frameworks/native/libs/gui/Surface.cpp
7cb0d39016ff8061fe9fc2967870c145a6ffa2ac 30-Jul-2014 Rachad <rachad@google.com> Tunneled Video Playback support

Added native_window_set_sideband_stream() method to Surface.[h|cpp]
Added ConfigureVideoTunnelModeParams OMX configuration structure to
HardwareAPI.h

Bug: 16132368
Change-Id: I28fa1b9dbe858d93e353e0991098cad45c626bd9
/frameworks/native/libs/gui/Surface.cpp
1681d95989271f3a9ac0dbb93d10e4a29f2b4444 28-Jun-2014 Ruben Brunk <rubenbrunk@google.com> Add sticky transform to surfaceflinger.

Bug: 15116722

- Adds a sticky transform field that can be set from a
SurfaceFlinger client Surface. This transform is
added to any transform applied to the Surface.

Change-Id: Idaa4311dfd027b2d2b8ea5e2c6cba2da5779d753
/frameworks/native/libs/gui/Surface.cpp
29a3e90879fd96404c971e7187cd0e05927bbce0 20-Jun-2014 Dan Stoza <stoza@google.com> BufferQueue: Add allocateBuffers method

This adds an allocateBuffers method to BufferQueue, which instructs
it to allocate up to the maximum number of buffers allowed by the
current configuration. The goal is that this method can be called
ahead of render time, which will prevent dequeueBuffers from blocking
in allocation and inducing jank.

This interface is also plumbed up to the native Surface (and, in
another change, up to the Java Surface and ThreadedRenderer).

Bug: 11792166
Change-Id: I4aa96b4351ea1c95ed5db228ca3ef98303229c74
/frameworks/native/libs/gui/Surface.cpp
f974bffb36a97d21432a504a741330c4f4245746 12-May-2014 Greg Hackmann <ghackmann@google.com> am 38c9e132: am c1ffd351: am bd20e551: Merge "Use asynchronous lock/unlock API"

* commit '38c9e1327a5b24267c3dab5293bc9d7ada6e9fc9':
Use asynchronous lock/unlock API
8f3960179c56767e5077be8337792bd4e244b7d7 01-Apr-2014 Francis Hart <fhart@nvidia.com> Use asynchronous lock/unlock API

The gralloc API now provides a way for using lock/unlock with the Android
explicit synchronisation concept. This changes updates the GraphicBuffer class
to also expose this functionality, and updates the Surface class to make use of
in line with the dequeueBuffer/queueBuffer mechanism.

This new behaviour is dependent on GRALLOC_MODULE_API_VERSION_0_3. If the local
gralloc module does not support this then the existing synchronous lock/unlock
mechanism will be used.

Change-Id: I8c3fd9592e0c5400ac9be84450f55a77cc0bbdc5
/frameworks/native/libs/gui/Surface.cpp
2f3dca149a2bcae96f18e38f7ba99a95c3e1b08c 10-May-2014 Greg Hackmann <ghackmann@google.com> am 9493d492: am 9eb142e3: am a9d49f99: Merge "Revert "Use asynchronous lock/unlock API""

* commit '9493d4924a59f14b698389386337a9c07a7ea3c4':
Revert "Use asynchronous lock/unlock API"
02528cf6aaedbbfec55be57d33389e1c57d88245 09-May-2014 Greg Hackmann <ghackmann@google.com> am 4b46776f: am 8a6cd189: am f60564a1: Merge "Use asynchronous lock/unlock API"

* commit '4b46776ff88c5a365700b88e8b2b04e1b2c77e6e':
Use asynchronous lock/unlock API
53ec72523a4083b88eaa13e2e720976523a7ebf8 09-May-2014 Greg Hackmann <ghackmann@google.com> Revert "Use asynchronous lock/unlock API"

This reverts commit 378ef07760eda717367d9429428c42d54d54d9a7.

Change-Id: I1de5ab973b5383633e75924fe90ac3ca8216c36a
/frameworks/native/libs/gui/Surface.cpp
378ef07760eda717367d9429428c42d54d54d9a7 01-Apr-2014 Francis Hart <fhart@nvidia.com> Use asynchronous lock/unlock API

The gralloc API now provides a way for using lock/unlock with the Android
explicit synchronisation concept. This changes updates the GraphicBuffer class
to also expose this functionality, and updates the Surface class to make use of
in line with the dequeueBuffer/queueBuffer mechanism.

This new behaviour is dependent on GRALLOC_MODULE_API_VERSION_0_3. If the local
gralloc module does not support this then the existing synchronous lock/unlock
mechanism will be used.

Change-Id: I77daa1beb197b63b1c2f281b8414ac4ae4b5b03c
/frameworks/native/libs/gui/Surface.cpp
f0eaf25e9247edf4d124bedaeb863f7abdf35a3e 21-Mar-2014 Dan Stoza <stoza@google.com> BufferQueue: Add producer buffer-released callback

Add a callback to the producer side, onBufferReleased, which will be
called every time the consumer releases a buffer back to the
BufferQueue. This will enable a buffer stream splitter to work
autonomously without having to block on dequeueBuffer.

The binder object used for the callback replaces the generic IBinder
token that was passed into IGraphicBufferProducer::connect to detect
the death of the producer. If a producer does not wish to listen for
buffer release events, it can pass in an instance of the
DummyProducerListener class defined in IProducerListener.h, if it even
cares about death events (BufferQueue doesn't enforce the token being
non-NULL, though perhaps we should).

Change-Id: I23935760673524abeafea2b58dccc3583b368710
/frameworks/native/libs/gui/Surface.cpp
0ee14ca23dc2759e213172e38a840da0c36bd3ab 17-Mar-2014 Wonsik Kim <wonsik@google.com> Fill in sideband stream caveat

Change-Id: I20db8aea8f13acf31b42db08d90b338da8a5209c
/frameworks/native/libs/gui/Surface.cpp
0f1889efe77171696bfb3499832ed1732343d9fb 01-Mar-2014 Igor Murashkin <iam@google.com> gui: Surface::dequeueBuffer no locker holds mutex while blocking in binder

- This also fixes a hang in the camera service when trying to shut down
if the producer is infinitely blocked while trying to get a new buffer.

Bug: 13250382
Change-Id: I32ca82162bb8645b97dbe084e13e05ca05529a42
/frameworks/native/libs/gui/Surface.cpp
7d2d160cdc3cba9f4454f38433c94b68376cb843 13-Nov-2013 Igor Murashkin <iam@google.com> gui: Update header docs for IGraphicBufferConsumer/Producer/BufferQueue

Also fix compiler warnings for libgui

Change-Id: I0ee38d9ad5eaa82d55bf812d291da8c433581cef
/frameworks/native/libs/gui/Surface.cpp
365857df8b94c959dea984a63013f6e7730ef976 12-Sep-2013 Mathias Agopian <mathias@google.com> Make sure do disconnect from a BQ when its client dies.

Bug: 5679534

Change-Id: If447e8673df83fe0b1d6210641e0a48522501a53
/frameworks/native/libs/gui/Surface.cpp
7895e90e29d096be039202f2ff24fa8033b92477 21-Aug-2013 Eino-Ville Talvala <etalvala@google.com> Surface: Fix controlledByApp parameter

Bug: 10425641
Change-Id: I1a47e2ce4ecbdb8e67030a5d9ddf6604c5e2497d
/frameworks/native/libs/gui/Surface.cpp
3c25621ad7d13f64d3ab95a27fa970fbc9998f73 16-Aug-2013 Andy McFadden <fadden@android.com> Re-enable frame dropping for non-auto timestamps

This change adds an entire field to note whether the timestamp was
auto-generated by Surface or supplied by the application.

The value is used when deciding whether or not to drop frames based
on buffer presentation timestamps. If a desired presentation time
was set explicitly, BufferQueue will use that value to decide if a
frame should be dropped. If the timestamp was generated by Surface
at the time the buffer was queued, the timestamp is ignored.

Bug 10151804

Change-Id: Ibd571a7578351063b813cbdad2ddbeed70655ba5
/frameworks/native/libs/gui/Surface.cpp
d9ba9707b0ab5c53e34d8ce9a5e71c41b85bb8da 03-Aug-2013 Andy McFadden <fadden@android.com> Merge "Roll back recent change"
4b49e08385a96398aa2633e096fe916dc9f08768 03-Aug-2013 Andy McFadden <fadden@android.com> Roll back recent change

Disable dropping of frames based on timestamp. Resume auto-
generating timestamps in Surface.

Bug 10151804

Change-Id: I15de26158e1d7ef22a5b150e685a126dc48ae2b4
/frameworks/native/libs/gui/Surface.cpp
86cd09d388d8f6dd52ec1b3e19170966e99caacb 02-Aug-2013 Andy McFadden <fadden@android.com> Merge "Drop frames based on presentation timestamp"
14fab7dd794cd6bf29e6425340683c6221062b3c 01-Aug-2013 Andy McFadden <fadden@android.com> Drop frames based on presentation timestamp

If there are two or more buffers pending that are ready for
immediate presentation, drop all but the last one.

Any code that didn't explicitly specify timestamps for buffers
was using the default value (auto-generated "now"). As a result,
surfaceflinger would drop frames whenever more than one buffer
was queued. We now use zero as the auto-generated timestamp,
and we don't set the timestamp in eglBeginFrame().

Change-Id: I187f42d33de227cd3411ff0dcd3b9ce1961457eb
/frameworks/native/libs/gui/Surface.cpp
ba93b3f8e403636b614a4a379f9421bc70dca84f 02-Aug-2013 Mathias Agopian <mathias@google.com> log an error when dequeueBuffer gets a NULL Fence

Bug: 9858745
Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
/frameworks/native/libs/gui/Surface.cpp
7cdd786fa80cf03551291ae8feca7b77583be1c5 19-Jul-2013 Mathias Agopian <mathias@google.com> Make ANW.setSwapInterval(0) work again

we can now queue/dequeue a buffer in asynchrnous mode by using the
async parameter to these calls. async mode is only specified
with those calls (it is not modal anymore).

as a consequence it can only be specified when the buffer count
is not overidden, as error is returned otherwise.

Change-Id: Ic63f4f96f671cb9d65c4cecbcc192615e09a8b6b
/frameworks/native/libs/gui/Surface.cpp
595264f1af12e25dce57d7c5b1d52ed86ac0d0c9 17-Jul-2013 Mathias Agopian <mathias@google.com> BufferQueue improvements and APIs changes

this is the first step of a series of improvements to
BufferQueue. A few things happen in this change:

- setSynchronousMode() goes away as well as the SynchronousModeAllowed flag
- BufferQueue now defaults to (what used to be) synchronous mode
- a new "controlled by app" flag is passed when creating consumers and producers
those flags are used to put the BufferQueue in a mode where it
will never block if both flags are set. This is achieved by:
- returning an error from dequeueBuffer() if it would block
- making sure a buffer is always available by replacing
the previous buffer with the new one in queueBuffer()
(note: this is similar to what asynchrnous mode used to be)

Note: in this change EGL's swap-interval 0 is broken; this will be
fixed in another change.

Change-Id: I691f9507d6e2e158287e3039f2a79a4d4434211d
/frameworks/native/libs/gui/Surface.cpp
ea74d3b78d607cde17790a7bb83e6f68ffd34cfd 17-May-2013 Mathias Agopian <mathias@google.com> make the warning timout of Fence::waitForever() implicit and longer

- timeout is now 3 seconds instead of 1
- simplifies the API a bit
- allows us to change/tweak this timeout globaly

Bug: 8988871

Change-Id: I8d3c6ec43a372f602fb3f29856710339f86c0ec9
/frameworks/native/libs/gui/Surface.cpp
4c00cc11141da7d159eb2323b186ed344115c0f1 16-Mar-2013 Jesse Hall <jessehall@google.com> Fix argument types in IGraphicBufferProducer methods

Bug: 8384764
Change-Id: I7a3f1e1a0584a70af04f9eafef900505389d2202
/frameworks/native/libs/gui/Surface.cpp
35ffa6a868f1aa650c90956a4129bb70f780fc99 13-Mar-2013 Mathias Agopian <mathias@google.com> Surface can now be created only from an IGraphicBufferProducer

it can't write itself to a parcel, nor can it be created from a
parcel.

Change-Id: I69165d5c54d6024b3e546e80d8b57e3dedda7893
/frameworks/native/libs/gui/Surface.cpp
006a601f22b275bcabf608f630b321df027d56d1 03-Mar-2013 Jesse Hall <jessehall@google.com> Fix reading NULL Surfaces from Parcels

Writing a NULL Surface was being read as a non-NULL Surface with NULL
mGraphicBufferProducer. Before the SurfaceTextureClient -> Surface
refactoring, you'd get a NULL Surface, and some code relies on that.

Bug: 8291161
Change-Id: I477bfe8882693e53a5f604a3d2c9e3cfe24473b4
/frameworks/native/libs/gui/Surface.cpp
e3c697fb929c856b59fa56a8e05a2a7eba187c3d 15-Feb-2013 Mathias Agopian <mathias@google.com> Refactoring: Rename SurfaceTextureClient to Surface

Change-Id: Ibed34175ae273608393aaa5f0a7df207dc40d709
/frameworks/native/libs/gui/Surface.cpp
ac9fa427d4a86745e60a5f7fd8e3ea340c4db907 12-Feb-2013 Mathias Agopian <mathias@google.com> get rid of Surface identity and token

we use the IBinder instead.

Change-Id: I4aa0b58869ba43f19980013620051e5a261b062d
/frameworks/native/libs/gui/Surface.cpp
2adaf04fab35cf47c824d74d901b54094e01ccd3 18-Dec-2012 Andy McFadden <fadden@android.com> Rename ISurfaceTexture and SurfaceTexture

The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.

Bug 7736700

Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
/frameworks/native/libs/gui/Surface.cpp
380223bf1b340e7503177254a60d5982f95ab793 27-Aug-2012 Jeff Brown <jeffbrown@google.com> Remove unused "layer" argument from show().

Change-Id: I8944a9f4a27c330b11e5e837c69b88c8f84145ba
/frameworks/native/libs/gui/Surface.cpp
9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd 25-Aug-2012 Jeff Brown <jeffbrown@google.com> Banish DisplayID from the SurfaceFlinger API.

Use only display tokens in the API to refer to new displays.

Don't require the caller to specify the display when creating
a surface (since in general a surface could be shown on
any display).

This is intended to be a minimum change just to update the API.
Note that SurfaceFlinger still uses DisplayID in a few places
internally that might cause some features not to work properly
when there are multiple displays (LayerScreenshot, for example).

Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6
/frameworks/native/libs/gui/Surface.cpp
6501e9944df131b3b7e293007084735dfa217f24 17-Jul-2012 Jeff Brown <jeffbrown@google.com> Remove freeze(), unfreeze() and setFreezeTint().

This is all dead code.

Change-Id: I646673aac793a6ec45021c370a2450f0ea4fbcce
/frameworks/native/libs/gui/Surface.cpp
f15a83f5814219c167f87cb8aaea622fc8493499 11-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add a crop to the layer state

This change adds a crop rectangle specified in window coordinates to the layer
state. The all window pixels outside this crop rectangle are treated as though
they were fully transparent. This change also adds the plumbing necessary for
WindowManager to set that crop.

Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
/frameworks/native/libs/gui/Surface.cpp
b0e76f456afaada43ddb0968bb37145219f90cd3 23-Mar-2012 Mathias Agopian <mathias@google.com> remove dependency of EGL on ndk header

Change-Id: Ia6e489b5b4f028864bdf54923e81f604710dd8ad
/frameworks/native/libs/gui/Surface.cpp
90ac799241f077a7b7e6c1875fd933864c8dd2a7 26-Feb-2012 Mathias Agopian <mathias@google.com> fix libgui header location

Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
/frameworks/native/libs/gui/Surface.cpp
e6f43ddce78d6846af12550ff9193c5c6fe5844b 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/native/libs/gui/Surface.cpp
87a96ea9eae3f998381735ec65496e256f871c3c 24-Aug-2011 Mathias Agopian <mathias@google.com> Fix an issue where Surface::lock() would never update the output region

this bug was introduced recently. in some situations Surface::lock()
is not able to preserve the content of the back buffer and needs
to tell the caller to redraw everything.

Bug: 5186460
Change-Id: I14e03939ddfc1b7ad2a8b99ad79435314c60e78e
/frameworks/native/libs/gui/Surface.cpp
582270d69db94286a248bd829f1ae6f910d45124 18-Aug-2011 Jamie Gennis <jgennis@google.com> SurfaceTexture: fix queues-to-composer

This change fixes the NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER query of
Surface and SurfaceTextureClient. Surface now uses the inherited
SurfaceTextureClient implementation of this query. SurfaceTextureClient
now queries SurfaceFlinger to determine whether buffers that are queued
to its ISurfaceTexture will be sent to SurfaceFlinger (as opposed to
some other process).

Change-Id: Iff187e72f30d454229f07f896b438198978270a8
/frameworks/native/libs/gui/Surface.cpp
e5d6eb81e29e0fb914ce8fdaae17190b0dbae1a1 10-Aug-2011 Ted Bonkenburg <tedbo@google.com> Read leftover parcel data when a parceled Surface is found in the cache.

This fixes an issue where the Surface readFromParcel code was leaving
unread parcel data in the case where the Surface was re-used from the
sCachedSurfaces cache. On a cache miss the code is creating a new
Surface from the remainder of the parcel data. On a hit that data was
being left unread, so anything that parcels a Surface followed by
additional arguments may end up reading the wrong values.

Change-Id: I25365159d945c125bd1fcc9f17e39a4f00aece55
/frameworks/native/libs/gui/Surface.cpp
bd050ab2af1421d527d1a80ce59dd8d9940a838c 16-Jul-2011 Ted Bonkenburg <tedbo@google.com> Add support for creating a Surface from a a SurfaceTexture.

The Surface is already using SurfaceTexture internally and it is parcelable. This
is intended to replace and phase out ParcelSurfaceTexture in favor of creating a
new Surface.java object from an existing SurfaceTexture.

Change-Id: I8e2dd86614523da6abed6403e1d705a68fa19fdf
/frameworks/native/libs/gui/Surface.cpp
c10d9d90b2088a3304076e0dc4bf05cdbb5d45ab 21-Jul-2011 Mathias Agopian <mathias@google.com> clean-up. get rid ofunused code and members in Surface[Control].cpp

Change-Id: Ia7790ae28af2c2ac99eae01c2c5044ace4a490a4
/frameworks/native/libs/gui/Surface.cpp
8f9dbf9e13b927de2524116c30544f7dfbbbf56c 14-Jul-2011 Mathias Agopian <mathias@google.com> move lock/unlock implementaion outside of Surface into SurfaceTextureClient

This makes ANativeWindow_lock/ANativeWindow_unlockAndPost work
with ANativeWindows implemented by Surface and SurfaceTextureClient.

Also, Surface now inherits directly from SurfaceTextureClient.

Bug: 5003724
Change-Id: I9f285877c7bae9a262e9a7af91c2bae78804b2ef
/frameworks/native/libs/gui/Surface.cpp
1e7fa9e945d98eab76ff92f37c25040429a6c0a0 23-Jun-2011 tedbo <tedbo@google.com> Add method to create a ParcelSurfaceTexture from android.view.Surface.

Change-Id: I05e343ab7e327478f60322af9373574b70c148f5
/frameworks/native/libs/gui/Surface.cpp
a67932fe6864ac346e7f78b86df11cf6c5344137 20-Apr-2011 Mathias Agopian <mathias@google.com> unify SurfaceTexture and Surface

Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
/frameworks/native/libs/gui/Surface.cpp
697526bc9e44ce61c88614f98387ae8bbf0a187e 01-May-2011 Iliyan Malchev <malchev@google.com> frameworks/base: android_native_buffer_t -> ANativeWindowBuffer

Change-Id: Idc2eabaa805bb6d308ebb315872623f28d428417
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/native/libs/gui/Surface.cpp
41abd67302b52aefadc2b3dea42226f16bf6d9ba 15-Apr-2011 Iliyan Malchev <malchev@google.com> frameworks/base: make the ANativeWindow query() method const

query() does not modify the object's data, so it needs to be a const method

Change-Id: I67c40a3c865461e6f1cc2193fd2d74286ff6ac8f
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/native/libs/gui/Surface.cpp
47d8730a2463f38a695ab95b533b0d9728f266a3 06-Apr-2011 Mathias Agopian <mathias@google.com> remove more unused references to ISurface

Change-Id: I2201f1ca2bb8f203a081d94a0134f798778dfbef
/frameworks/native/libs/gui/Surface.cpp
d87f162026454f5a3e6437ed0c9ef51651a6b939 26-Mar-2011 Mathias Agopian <mathias@google.com> merge libsurfaceflinger_client into libgui

this is the first step in unifying surfacetexture and surface.
for this reason the header files were not moved, as most of them
will eventually go away.

NOTE: currently we keep libsurfaceflinger_client.so as an empty
library to workaround prebuilt binaries wrongly linking against
it.

Change-Id: I130f0de2428e8579033dc41394d093f4e1431a00
/frameworks/native/libs/gui/Surface.cpp