History log of /frameworks/native/libs/gui/ConsumerBase.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8dc55396fc9bc425b5e2c82e76a38080f2a655ff 04-Nov-2014 Dan Stoza <stoza@google.com> Add a BufferItem parameter to onFrameAvailable

Passes the BufferItem for the queued buffer to the onFrameAvailable
callback so the consumer can track the BufferQueue's contents. Also
adds an onFrameReplaced callback, which is necessary if the consumer
wants to do anything more than simple queue length tracking.

Bug: 18111837
Change-Id: If9d07229c9b586c668e5f99074e9b63b0468feb0
55fc54970b674280376bbf037153ca1a5e53bc32 11-Jun-2014 Mark Salyzyn <salyzyn@google.com> am 72676e7d: am 0e1313cd: Merge "libgui: 64-bit compile issues"

* commit '72676e7d0db89d477495245aa15f1a128b5c35bc':
libgui: 64-bit compile issues
911004506dcb6ee68efdfd6636e0ffc72e6972b8 09-Jun-2014 Mark Salyzyn <salyzyn@google.com> libgui: 64-bit compile issues

Change-Id: I29961c1567b8431518a7d032ea43385e23b7bb37
febd4f4f462444bfcb3f0618d07ac77e3fc1f6ad 10-Apr-2014 Dan Stoza <stoza@google.com> BufferQueue: Increase max slots from 32 to 64

Increases NUM_BUFFER_SLOTS from 32 to 64 and changes the mask
returned by IGBC::getReleasedBuffers from 32 to 64 bits.

Bug: 13174352
Change-Id: Ie8ef0853916cfb91f83881c7241886bb1950f01a
399184a4cd728ea1421fb0bc1722274a29e38f4a 04-Mar-2014 Jesse Hall <jessehall@google.com> Add sideband streams to BufferQueue and related classes

Sideband streams are essentially a device-specific buffer queue that
bypasses the BufferQueue system. They can be used for situations with
hard real-time requirements like high-quality TV and video playback
with A/V sync. A handle to the stream is provided by the source HAL,
and attached to a BufferQueue. The sink HAL can read buffers via the
stream handle rather than acquiring individual buffers from the

Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
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
db89edc94bd2a78226b407f9f7261e202e7fa325 02-Aug-2013 Mathias Agopian <mathias@google.com> All consumers now take an IGraphicBufferConsumer instead of a BufferQueue

this means they only have access to the consumer end of
the interface. we had a lot of code that assumed consumers
where holding a BufferQueue (i.e.: both ends), so most of
this change is untangling in fix that

Bug: 9265647
Change-Id: Ic2e2596ee14c7535f51bf26d9a897a0fc036d22c
a4e19521ac4563f2ff6517bcfd63d9b8d33a6d0b 01-Aug-2013 Mathias Agopian <mathias@google.com> Binderize the consumer side of BufferQueue

While currently untested, this should allow to move the
BuffereQueue in the consumer process and have everything
work as usual.

Bug: 9265647

Change-Id: I9ca8f099f7c65b9a27b7e7a3643b46d1b58eacfc
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
1585c4d9fbbba3ba70ae625923b85cd02cb8a0fd 28-Jun-2013 Andy McFadden <fadden@android.com> Pay attention to buffer timestamps

When acquiring a buffer, SurfaceFlinger now computes the expected
presentation time and passes it to the BufferQueue acquireBuffer()
method. If it's not yet time to display the buffer, acquireBuffer()
returns PRESENT_LATER instead of a buffer.

The current implementation of the expected-present-time computation
uses approximations and guesswork.

Bug 7900302

Change-Id: If9345611c5983a11a811935aaf27d6388a5036f1
c5d7b7d323bba8772a9005f7d300ad983a04733a 03-May-2013 Lajos Molnar <lajos@google.com> BufferQueue: track buffer-queue by instance vs. by reference

Instead of representing the buffer-queue as a vector of buffer
indices, represent them as a vector of BufferItems (copies).
This allows modifying the buffer slots independent of the queued

As part of this change, BufferSlot properties that are only
been relevant in the buffer-queue have been removed.

Also, invalid scalingMode in queueBuffer now returns an error.

ConsumerBase has also changed to allow reuse of the same
buffer slots by different buffers.

Change-Id: If2a698fa142b67c69ad41b8eaca6e127eb3ef75b
Signed-off-by: Lajos Molnar <lajos@google.com>
Related-to-bug: 7093648
74d211ae26a0257c6075a823812e40b55aa1e653 22-Apr-2013 Mathias Agopian <mathias@google.com> clean-up/simplify all dump() APIs

remove the scratch buffer parameter and use
String8::appendFormat() instead.

Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
ad669b04f4633957eea55b8ad2d8253adcefe39b 06-Apr-2013 Jamie Gennis <jgennis@google.com> libgui: fix an EGLImage leak

This moves the call to ConsumerBase::abandon from the ConsumerBase dtor to
ConsumerBase::onLastStrongRef. The abandon call relies on virtual methods to
perform the clean-up, so calling it from the ConsumerBase dtor after the
derived classes dtors ran was skipping some of the clean-up. The
onLastStrongRef method should get called just before the most derived class's
dtor gets called.

Bug: 8349135
Change-Id: I836946826927cc1ed69c049049f525f92b17a269
ca08833d5ea99130797e10ad68a651b50e99da74 29-Mar-2013 Mathias Agopian <mathias@google.com> don't use compile-time configuration of libgui as much as possible

We now detect at runtime which sync features to use, which
allows us to remove a lot of the compile-time configuration
options. There is still one option though, to disable
KHR_fence_sync on some devices (which are more efficient
without it).

- added a backdoor to get the vendor's EGL strings

the new logic is:
- use always ANDROID_native_fence_sync if available
- fallback to KHR_fence_sync if available and not disabled
by the compile-time option
- use KHR_wait_sync if available and either of the above is

Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
1df8c345854155cbbcb9f80de9d12d66ea70ac08 20-Dec-2012 Jamie Gennis <jgennis@google.com> libgui: disallow NULL Fence pointers

This change eliminates the uses of a NULL sp<Fence> indicating that no waiting
is required. Instead we use a non-NULL but invalid Fence object for which the
wait methods will return immediately.

Bug: 7892871
Change-Id: I5360aebe3090422ef6920d56c99fc4eedc642e48
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

Bug 7736700

Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
a4367996681bae2612beebecb871961c5b361b2c 07-Dec-2012 Jamie Gennis <jgennis@google.com> am 50f8d285: am d4e70620: am 72c3f7d8: Revert "ConsumerBase: free buffers outside the lock"

* commit '50f8d2856b6644059b31684687842bf9c1f2e814':
Revert "ConsumerBase: free buffers outside the lock"
72c3f7d88160b7c279f90f0efe3c1cb12cd140ae 07-Dec-2012 Jamie Gennis <jgennis@google.com> Revert "ConsumerBase: free buffers outside the lock"

This reverts commit b21a4e3b5f7f07ed160ca6e1809313e2a8e2a6a4.
b5fe96b8130b5bacbc1762ba7f819a9f9b72bf59 07-Dec-2012 Jamie Gennis <jgennis@google.com> am 05989772: am 3ed2736c: am b21a4e3b: ConsumerBase: free buffers outside the lock

* commit '05989772d5b46cd5328e88d546f04deef39cc3c8':
ConsumerBase: free buffers outside the lock
b21a4e3b5f7f07ed160ca6e1809313e2a8e2a6a4 07-Dec-2012 Jamie Gennis <jgennis@google.com> ConsumerBase: free buffers outside the lock

This change makes ConsumerBase::onBuffersReleased hold a reference to all its
gralloc buffers until after the mutex is unlocked. This prevents slow
gralloc::free calls from causing lock contention with rendering threads.

Bug: 7675940
Change-Id: I0ec805d1b612afeeecfffec03f982371d27d93be
a4a3149a36bc69a06e4824aeae909ab910661070 29-Oct-2012 Igor Murashkin <iam@google.com> Change ConsumerBase's FrameAvailableListener to be a weak pointer

This prevents strong reference cycles when the listener implementation also
holds a strong pointer to the ConsumerBase

Bug: 7425644
Change-Id: I1514b13a32b18d421c902dddebec0765a989c55c
9504eb915c9628e130f45019bdefda0168089886 05-Oct-2012 Jesse Hall <jessehall@google.com> Fix race condition in ConsumerBase::addReleaseFence()

This needs the ConsumerBase mutex locked, but wasn't locking it. Two
of the four places that called it already held the lock so were fine.
Now addReleaseFence() takes the lock itself, and I added
addReleaseFenceLocked() for the two already-locked callers, since in
one of them dropping the lock would be inconvenient.

Bug: 7289269
Change-Id: I7a5628adb516f8eec782aa6c14128202f96d7b0a
7aff4a5de47bf32b0934f5744cd1df4ce666d2d2 24-Sep-2012 Jamie Gennis <jgennis@google.com> ConsumerBase: make fence names meaningful

Change-Id: I3580120cb63c027c327e80ec70e68650b75395de
b27254154642575dfb4bbfa79fbedde7d7ee23dd 06-Sep-2012 Jamie Gennis <jgennis@google.com> libgui: move fence handling into ConsumerBase

This change moves some common fence handling code into the base class for
BufferQueue consumer classes. It also makes the ConsumerBase class initialize
a buffer slot's fence with the acquire fence every time a buffer is acquired.

Change-Id: I0bd88bc269e919653b659bfb3ebfb04dd61692a0
9fea3421ffddf6480f57f55a25936a886043d909 08-Aug-2012 Jamie Gennis <jgennis@google.com> SurfaceTexture: inherit from ConsumerBase (try 2)

This change makes SurfaceTexture inherit from ConsumerBase. It removes all of
the functionality from SurfaceTexture that is now provided by the base class.
This includes fixes for two bugs that were found after checking this change in
the first time and then reverting it.

Change-Id: Ie2d9f4f27cfef26fdac341de3152e842b01a58d2
ce7a6c0fc9d75b80da030d1790321e84475f956a 20-Aug-2012 Jamie Gennis <jgennis@google.com> Revert "SurfaceTexture: inherit from ConsumerBase"

This reverts commit ed059a8d754770c3cf28b78dba30f7a6ba475dbe

Change-Id: I72542c2595771a40c2c88251e0d6eb54e305b99b
ed059a8d754770c3cf28b78dba30f7a6ba475dbe 08-Aug-2012 Jamie Gennis <jgennis@google.com> SurfaceTexture: inherit from ConsumerBase

This change makes SurfaceTexture inherit from ConsumerBase. It removes all of
the functionality from SurfaceTexture that is now provided by the base class.

Change-Id: I4a881df42810a14ee32d4ef7c8772a8f2510f4c7
1a4d883dcc1725892bfb5c28dec255a233186524 03-Aug-2012 Jamie Gennis <jgennis@google.com> surfaceflinger: refactor FrambufferSurface

This change refactors the FramebufferSurface class to inherit from the new
ConsumerBase class.

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2