History log of /frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
65bee228207da4064b09abc4c2b88cd7b797890b 26-Jun-2017 Dan Stoza <stoza@google.com> libgui: New mutex for ConsumerBase frame callbacks

Adds a new mutex to protect ConsumerBase's mFrameAvailableListener
separately from the main mMutex. This prevents deadlocks when trying
to perform callbacks in response to other calls that come through
ConsumerBase.

Bug: 62915791
Test: EncodeVirtualDisplayWithCompositionTest#
testRenderingMaxResolutionRemotely

Change-Id: I244dc2d83488e452d9690c0d7847c9ff15a95dbb
(cherry picked from commit 95971c8172495f7b6a0ede1a3508472b9a4e7b36)
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
0c9a1ed91f8e19887ac43eff5af16e59878c8226 07-Apr-2017 Dan Stoza <stoza@google.com> libgui: Normalize IGraphicBufferConsumer methods

This change modifies IGraphicBufferConsumer such that all synchronous
methods return a status_t and, as such, all outputs are returned by
output parameter rather than return value. It also eliminates the use
of a const char* parameter that SafeInterface can't handle.

Test: m -j + libgui_tests + manual testing
Change-Id: I9bb0e2892492d5e0a3f660bf228834b9ed014539
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
c45a7d9dfdefa07512c5acc07bcbee5362b34e3d 14-Mar-2017 Fabien Sanglard <sanglardf@google.com> [SF] Use presentTimeOffset from configStore

Change-Id: If9c872c565e68e8abe552ee11d2c7d48f44aec4b
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
cb765401a080a2c80eb562478263129a4f2483df 10-Mar-2017 Chia-I Wu <olv@google.com> Merge "surfaceflinger: simplify HWC buffer cache clean up"
aaff73f92a2fcadda8c765eb9b02f2849418a873 13-Feb-2017 Chia-I Wu <olv@google.com> surfaceflinger: simplify HWC buffer cache clean up

When a Layer is no longer connected, we destroy the associated HWC
layers on next call to SurfaceFlinger::rebuildLayerStacks or when
the Layer is destroyed. There is no need to listen to
onBuffersReleased. Besides, we need to perform the cleanup from the
main thread as we only talk to HWC process from the main thread.

While at it, move HWComposerBufferCache to its own files.

Bug: 35320590
Test: manual
Change-Id: Ifa32f24076b094c8fa9cda8572b03d5bfb8e0b93
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
0cc1938871edd6659d6783404a3523abc6b98d92 06-Mar-2017 Fabien Sanglard <sanglardf@google.com> [SurfaceFlinger] Use sf phase offset from CS

If present, use sf phase offset from the config Store.

Test: Manual
Change-Id: I2dd7ecf984b7484f6b447699680f54c7c8e221a0
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
3a156e11abc86f0fb7f3f503ca534140ea2a9a56 24-Feb-2017 Fabien Sanglard <sanglardf@google.com> Fix error code check in releaseBuffer

BufferQueueConsumer can occasionaly return STALE_BUFFER_SLOT which
does not indicate an error but that there is no more to be done.
SurfaceFlingerConsumer should report and error only with a status
code inferior to zero.

Test: AUPT
Change-Id: Ie0624358301e1e3b090adf35facd6eac79c214db
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
fb94f1db72bd769d4a63e2baf0b5a4ca5da7a86f 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Break a dependency of libui on libandroid"
a9347647eca3101c014be902b713772de3977d87 14-Feb-2017 Mathias Agopian <mathias@google.com> Break a dependency of libui on libandroid

This was only a header dependency, but it still
created a circular dependency, which will cause
problems in another CL.

We fix this by creating a libarect static library
containing only that header. both libui and
libandroid now depend on it and reexport the
header.

We also make sure rect.h ends-up in the right
place.

Test: built and booted device
Bug: 35164655

Change-Id: Iba25b8b801b26b26ec1401c00caf367a06f197ca
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
5ea5e5905170f32d5cf45ad35c552d64743892c3 02-Dec-2016 Brian Anderson <brianderson@google.com> Fix unexpected FrameEvents on BufferQueue reconnect

Helps reduce the number of ALOGE's being hit
when switching between apps.

* Notify Layer when the Producer disconnects.
* Avoid sending event deltas from a previous connection.
* Avoid releasing a frame more than once.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I64f314be72ddb154b584d726ac382cd468e345bf
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
06d63de03cb2a551ca99608f5aa0c4f3e200b0fc 04-Jan-2017 Chia-I Wu <olv@google.com> surfaceflinger: cache HWC client targets and buffers

Remember HWC client targets and buffers, and make sure we send each
unique slot/handle pair only once. This allows the composer to
clone/register/retain each buffer only once.

Test: builds and boots
Change-Id: Ib485189043a9c132031e82d4d7380ace3bf9453d
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
3890c3995c4a52439844faeb80b5503d42b977d8 25-Jul-2016 Brian Anderson <brianderson@google.com> Cache frame event history producer-side.

* Producer maintains a recent history of frames.
* Producer only does a binder call if requested
informatiVon doesn't exist in the cache.
* Consumer sends fences to the producer, which
can be queried for timestamps without a
binder call.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I8a64579407cc2935f5c659462cb227b07ba27e43
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
d6927fb1143398370c0885844bfb58923ef740b7 24-Jul-2016 Brian Anderson <brianderson@google.com> Track frame events incrementally and per layer.

* Replaces FenceTracker, which was owned by SurfaceFlinger,
with FrameEventHistory, which is owned by Layer.
* Updates FrameEventHistory as events occur.
* Changes SurfaceFlinger flag "--fences" to
"--frame-events".

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I868c2ef93964656d7e41848243433499e7f45fe7
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
3546a3f08ad84099db4006d651c656d58d2ed566 14-Jul-2016 Brian Anderson <brianderson@google.com> Fix FenceTracker releaseFence

This patch:
* Fixes the release fence when GPU compositing.
* Stores the final release fence in ConsumerBase just
before releasing the Buffer, which helps ensure
sync points aren't added unknowningly.
* Makes HWC2 release pending buffers as the first step
of postCompostion, rather than the last, which should
allow dequeue to unblock a little earlier and helps
make sure the previous buffer's release fence has
been finalized before FenceTracker::addFrame is
called.
* Fence tracker only sets the release fence once it
has been finalized so it does not report a release
fence for a buffer that is still latched.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I27d484bfd48f730bdcea2628f96795c6f4b4df7b
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
ee87482e6d9437f0a8690f32791120e8fd43d799 18-Oct-2016 Fabien Sanglard <sanglardf@google.com> Merge "Fix surfaceflinger file descriptor leak"
am: af2fbb0ccc

Change-Id: If21d062e144dd13064c0c3e8021523a8bf20b864
0a4b26ecb6a9f772502c770fbe4c9fc661578cb7 15-Oct-2016 Fabien Sanglard <sanglardf@google.com> Fix surfaceflinger file descriptor leak

If a producer queues a buffer after a screen resize, the buffer
will not be removed from the buffer queue, resulting in a leak of
file descriptor.

Test: Fix was tested by the bug reporter (ARM).
Bug: 32012717

Change-Id: I3b7b0745d5fbdee97fc8df2db399c1a2fcdeb375
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
367c5684f4d417e5176bec12d67f4e2e42738fe0 20-Jun-2016 Robert Carr <racarr@google.com> SurfaceControl: Add getTransformToDisplayInverse

For seamless rotation, the window manager needs
access to this flag, as it will apply the inverse
display transform itself to all other windows.

Bug: 28823590
Change-Id: Ifeee1078a9cb4cd01c8052570c137c6228b2f13d
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
ce796e78a57018f186b062199c75d94545318aca 05-Feb-2016 Pablo Ceballos <pceballos@google.com> Plumbing for getting FenceTracker timestamps

Change-Id: I1ebee9e42e28658bd3a2b161fdaabb7da756d8f3
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
40845df1285b387bcbf8f43ac72228eee2606d80 26-Jan-2016 Pablo Ceballos <pceballos@google.com> SF: Add FenceTracker

FenceTracker tracks all fences in SurfaceFlinger. These timestamps
could be used for debugging, profiling, or be exposed to the
application.

Change-Id: I4297a661c0a7530e744168ac7a2a66c4bca92fd5
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
9e56aa0fdb5f7121b9b975c6c16db103ea4d2fe9 02-Nov-2015 Dan Stoza <stoza@google.com> Switch SurfaceFlinger to HWC 2.0

Enables SurfaceFlinger to speak to version 2.0 of the Hardware Composer
HAL instead of version 1.x (also removing support for the framebuffer
HAL). By default, however, this functionality is disabled. In order to
enable it, USE_HWC2 must be set to true in Android.mk.

Change-Id: I4589e02ac2165236b10ff2f7cb772f87e0d3daab
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.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/services/surfaceflinger/SurfaceFlingerConsumer.cpp
063121849890da78b1ad7fb96c54c795de5d1fd6 08-Oct-2015 Pablo Ceballos <pceballos@google.com> SF: Force refresh when in single buffer mode

- Add a boolean to BufferItem to track whether single buffer mode is
enabled. When it is, force SurfaceFlinger to acquire a new buffer
and refresh on every vsync.

Bug 24940410

Change-Id: Iea67330c416b6fb14500865f98c67f1c12f23197
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
47650f4f66a49e1815ad08ca4fb12a661d133abc 05-Aug-2015 Pablo Ceballos <pceballos@google.com> native: Rename mBuf to mSlot

Remove the union in BufferItem.

Bug: 19769719
Change-Id: I4e496b5aafce0fc5206dc7551a741f9c262c2cd0
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
a4650a50a0b35e9e4342d6600b6eb24fd94bb8e5 12-May-2015 Dan Stoza <stoza@google.com> Fix PTS handling for buffer replacement

This changes the way that SurfaceFlinger's shadow buffer management
works such that instead of tracking the size of the shadow queue in the
BufferQueue, SF tracks the last frame number it has seen, and passes
that into the acquireBuffer call. BufferQueueConsumer then ensures that
it never returns a buffer newer than that frame number, even if that
means that it must return PRESENT_LATER for an otherwise valid buffer.

Change-Id: I3fcb45f683ed660c3f18a8b85ae1f8a962ba6f0e
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
ecc504043fddb7a75042ce402c67aedfac04d5e2 28-Apr-2015 Dan Stoza <stoza@google.com> SurfaceFlinger: Fix PTS on stale buffers

SurfaceFlinger's (Layer's) shadow copy of the BufferQueue queue was
getting out of sync for a few reasons. This change fixes these by
doing the following:

- Adds a check to re-synchronize the shadow copy every time we
successfully acquire a buffer by first dropping stale buffers before
removing the current buffer.
- Avoids trying to perform updates for buffers which have been rejected
(for incorrect dimensions) by SurfaceFlinger.
- Adds IGraphicBufferConsumer::setShadowQueueSize, which allows the
consumer to notify the BufferQueue that it is maintaining a shadow
copy of the queue and prevents it from dropping so many buffers
during acquireBuffer that it ends up returning a buffer for which the
consumer has not yet received an onFrameAvailable call.

Bug: 20096136
Change-Id: I78d0738428005fc19b3be85cc8f1db498043612f
(cherry picked from commit 2e36f2283f48ab764b496490c73a132acf21df3a)
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
ee44edd0acccbf5eaa918d75737c3b65ee04fff7 23-Mar-2015 Dan Stoza <stoza@google.com> SurfaceFlinger: Pass surface damage to HWC

Passes the surface damage from the incoming SurfaceFlingerConsumer
BufferQueue down to the hardware composer HAL interface, if the
HWC version number is 1.5 or greater.

Bug: 11239309
Change-Id: Ic4305210593874a8d6deba3319055b2b8c57e926
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
11611f9be590480d7ea27bf0153558573ddcded2 12-Mar-2015 Dan Stoza <stoza@google.com> DO NOT MERGE SurfaceFlinger: Stop using IGBC::BufferItem

Switches all uses of IGraphicBufferConsumer::BufferItem (and
BufferQueue::BufferItem) to the BufferItem in libgui. Depends on
frameworks/native I699ed0a6837076867ca756b28d1ffb2238f7a0d9.

Cherry pick of I187b3a7d05196b6289596afac8fb9a9d4aebff76

Change-Id: I5bc79fb96b6cba6021af64b20890967aa3b7fcbf
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
41d67d7ab4da1c393497a620a116a854b3c618e7 26-Apr-2014 Andy McFadden <fadden@android.com> Improve SurfaceFlinger PTS estimation

Get the next refresh time from DispSync instead of guessing based
on the current time.

Change-Id: I8dc72a3217bfd4e9b4c905034194d1a298cad69a
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
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
BufferQueue.

Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
c1c05de415854eb7a13a16b7e22a22de8515123a 18-Sep-2013 Mathias Agopian <mathias@google.com> fix camera API 2.0 orientation

we add a flag to ANativeWindow::setBufferTransform that means
"apply the inverse rotation of the display this buffer is displayed
onto to".

Bug: 10804238
Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
3f84483382be2d528918cc1a6fbc6a7d68e0b181 08-Aug-2013 Mathias Agopian <mathias@google.com> SurfaceFlinger now uses GLES 2.x when available

Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
ad678e18b66f495efa78dc3b9ab99b579945c9e2 24-Jul-2013 Mathias Agopian <mathias@google.com> single buffer mode for BufferQueue

Bug: 9891035
Change-Id: Id1ab5f911a6dc4c1d8235e65775b3d3635231ad4
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
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
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
98d3d6ec1250248574f2e8d72e5c934fecbcd734 27-Jun-2013 Lajos Molnar <lajos@google.com> SurfaceFlinger: fix releaseBuffer in updateTexImage

Allow releasing a buffer acquired in the past.

Change-Id: I3f27f1caec109c1a47286fc4d2235c6e1afe9022
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 9516405
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
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
buffers.

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
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
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
enabled

Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
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
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.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/services/surfaceflinger/SurfaceFlingerConsumer.cpp
97eba8904c2f221c42a9473407223a4c3a213f75 12-Dec-2012 Andy McFadden <fadden@android.com> Avoid unnecessary texture bind

In SurfaceFlingerConsumer, check to see if native fence sync is
enabled. If so, defer the texture binding step to Layer::onDraw.

Change-Id: I7d4034a31c0143207eea2509dfa13ef3820f9b8c
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp
bf974abe92f7495529916fe0f483f3b56e7c30e3 05-Dec-2012 Andy McFadden <fadden@android.com> Refactor SurfaceTexture a bit.

Rearranges updateTexImage() so that the SurfaceFlinger-specific
behavior is in a new SurfaceFlingerConsumer subclass.

SurfaceTexture behavior should not be altered. Instead of
acquire-bind-release we now do acquire-release-bind, but since
it's all done with the lock held there shouldn't be any
externally-visible change.

Change-Id: Ia566e4727945e2cfb9359fc6d2a8f8af64d7b7b7
/frameworks/native/services/surfaceflinger/SurfaceFlingerConsumer.cpp