History log of /frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a34ed639c3057b99da0fb703beb12827e30aa508 14-Mar-2017 Fabien Sanglard <sanglardf@google.com> Use forceHwcCopyForVirtualDisplay in configStore

Test: Manual
Change-Id: Ie6f816cf8f48b1cca41d51f40e9f0ae49aef2908
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
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/DisplayHardware/VirtualDisplaySurface.cpp
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/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.cpp
3d4039d7a291cd9b6f2dd4b46fcdb576f2db3356 24-Sep-2016 Brian Anderson <brianderson@google.com> Use FenceTime to share fence times and reduce open fds.

FenceTimes are created and shared for each Fence that
FrameTimestampHistory and FrameTracker care about.

On the consumer side, the FenceTimes are also added to
shared timelines that are owned by SurfaceFlinger or
unshared timelines owned by Layer. The timelines are
checked at the end of every frame to minimize the number
of file descriptors open.

On the producer side, the FenceTimes are added to
the ConsumerFrameEventHistory instead, since the timelines
that would be tracked by SurfaceFlinger are not shared
with anyone else in the consumer's process. The timelines
are checked just after a frame is queued to minimize
the number of file descriptors open.

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

Change-Id: Ifd4301affe1b24705b2bee7608c5a2c09dfb4041
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
11d0fc38ad8d2e5bb5bc0a282336cabe28dbf9d6 02-Dec-2016 Fabien Sanglard <sanglardf@google.com> Rename "retire" to "present" for consistency

The HWC2 model has no concept of retire fence beyond HWC2to1Adapter
All references to "retire" fence should be called "present"

Change-Id: I26540aad9e65f138a4df60a34eaee030f1c17567
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
7c3ba8aa288755fad78ddbabcee0ad5a0610ac1c 25-Jul-2016 Brian Anderson <brianderson@google.com> Update producer's cache of frame events in de/queue

* Cache is only updated during queue and dequeue if
the getFrameTimestamps is enabled.
* The consumer avoids sending a copy of the acquire
fence back to the producer since the producer
already has a copy.

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

Change-Id: I6a8b965ae79441a40893b5df937f9ed004fe7359
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
baaad32cd582bcc09db89135715717234ea398ea 23-Jul-2016 Brian Anderson <brianderson@google.com> BQ: Make QueueBufferOutput implement Flattenable

It will need to support file descriptors soon.

Also:
* Make it's members public and clean up
inflate/deflate usage.
* Send Fence::NO_FENCE over Binder from dequeue
to indicate lack of fence.

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

Change-Id: Ia9e4600424a89ce026ba27e8aaed27a6bab860a4
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
9d96de49673cb6c916bfb797aad4f4e024ea73ca 11-Oct-2016 Fabien Sanglard <sanglardf@google.com> Revert "Delete HWC1"

This reverts commit 90f923493fa053655a203c34ea491086aeb07602.

Change-Id: If9da49e3bc85f8ff21ac1bd22a6bab97e9aa3103
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
90f923493fa053655a203c34ea491086aeb07602 03-Oct-2016 Fabien Sanglard <sanglardf@google.com> Delete HWC1

After 10 years of good service, HWC1 is not needed anymore since HWC2
is now mandatory.

Change-Id: I5768b50c89854688ba31032f01ea231699393e5b
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
97b9c86338e2d364d47ea7522c2d81a8014f0e07 08-Sep-2016 Robert Carr <racarr@google.com> Surface: Add force disconnection method.

Add a new method forceScopedDisconnect to Surface. This will
be used by the framework to force disconnection at times where
the underlying GraphicBufferProducer may be about to be reused.
This is scoped by PID to avoid conflicting with remote producers.

Bug: 30236166
Change-Id: I857216483c0b550f240b3baea41977cbc58a67ed
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
bc8c1928e1dbdaf6a2820f6e426c96ed61284043 01-Jul-2016 Pablo Ceballos <pceballos@google.com> BQ: Remove getNextFrameNumber Binder call

- Return the value in queueBuffer instead and cache it in Surface

Change-Id: I10ab112afb03cf0231b047d4a4569cd641827043
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
8e3e92b906db431c4fa822f21242977d4ee99942 28-Jun-2016 Pablo Ceballos <pceballos@google.com> BQ: Add and expose a unique id

Bug 29422927

Change-Id: I80eab94f073ebc378302f00fa86a740c3643657e
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
1a61da5e28fa16ad556a58193c8bbeb32a5f636d 28-Apr-2016 John Reck <jreck@google.com> Return the transform to apply in getLastQueuedBuffer

Bug: 28428955
Change-Id: Id48f7d3bf3f5deb074cf0a6a52a41caac875db41
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
59d12e90ae09171fc8b50fd8fd02e3247c04840c 28-Mar-2016 Pablo Ceballos <pceballos@google.com> Merge "Rename single buffer mode to shared buffer mode" into nyc-dev
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/DisplayHardware/VirtualDisplaySurface.cpp
3559fbf93801e2c0d9d8fb246fb9b867a361b464 17-Mar-2016 Pablo Ceballos <pceballos@google.com> Rename single buffer mode to shared buffer mode

Change-Id: Id43d0737d9367981644e498942ebc0077d61038c
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
b0c8d787040974128dc7c7c2e484da66a2437815 29-Oct-2015 Rob Carr <racarr@google.com> Merge "Support SurfaceView synchronization."
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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
f133d003aaac80a0932a2d8f9efd8493e56f7814 23-Oct-2015 Pablo Ceballos <pceballos@google.com> SF: Connect the VDS scratch surface producer

- VirtualDisplaySurface has a BufferQueue for producing scratch
buffers when doing mixed composition for a virtual display.
- Connect/disconnect the producer end of this BufferQueue in the
VirtualDisplaySurface constructor/destructor to avoid using it in a
disconnected state.

Bug 24733179

Change-Id: I87dab9ff4f46d422b7796670b0b4d17b7fd09165
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
583b1b32191992d6ada58b3c61c71932a71c0c4b 04-Sep-2015 Pablo Ceballos <pceballos@google.com> BQ: Prevent operations on disconnected BQs

- Update unit tests to match

Bug 23763412

Change-Id: I77e59bf6b57b328433c3835450455f80a8fa454b
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
ff12cba77b5b88f3978070bb970d7721225271ee 16-Sep-2015 Pablo Ceballos <pceballos@google.com> Merge "BQ: Modify consumer buffer count interfaces"
4aa427b964f22e3cf10381f8fc27e7042c322b9c 14-Sep-2015 Pablo Ceballos <pceballos@google.com> Merge "native: Rename mBuf to mSlot"
19e3e06e3c65a7c001a6fe0971744ba5ff536515 20-Aug-2015 Pablo Ceballos <pceballos@google.com> BQ: Modify consumer buffer count interfaces

- Rename setDefaultMaxBufferCount() to setMaxBufferCount(). Modify it
to be hard maximum on the number of buffers that can't be overwritten
by the producer.
- Enforce the maximum buffer count in setMaxAcquiredBufferCount(),
setMaxDequeuedBufferCount(), and setAsyncMode().
- Remove mOverrideMaxBufferCount as it's no longer needed since
overriding is no longer possible.
- Expose setMaxAcquiredBufferCount() in GLConsumer.
- Remove disableAsyncBuffer(), it was only being used for single buffer
mode. Single buffer mode is now achievable with setMaxBufferCount().

Bug 13174928

Change-Id: Ia33799f42751272a711fbd8559f7602ce9f18e4f
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
9de7293b0a1b01ebe6fb1ab4a498f144adc8029f 17-Apr-2015 Dan Stoza <stoza@google.com> libgui: Allow an IGBProducer to disable allocation

Adds a new method IGBP::allowAllocation, which controls whether
dequeueBuffer is permitted to allocate a new buffer. If allocation is
disallowed, dequeueBuffer will block or return an error as it
normally would (as controlled by *ControlledByApp).

If there are free buffers, but they are not of the correct dimensions,
format, or usage, they may be freed if a more suitable buffer is not
found first.

Bug: 19801715
Change-Id: I0d604958b78b2fd775c2547690301423f9a52165
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
01049c8321aab30cd431e2febeddd79242ae5a4f 11-Nov-2014 Dan Stoza <stoza@google.com> Enable clang for libui/libgui/surfaceflinger

Enables clang and C++11 for libui/libgui/surfaceflinger, and
eliminates all compile-time warnings.

Change-Id: Ie237fdb5ae44f2bfcddaa884f9c65ec3f08ae50f
(cherry picked from commit f10c46ef855b6410b20ebd8b1351d4d78d8eca8e)
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
fd9d183cd8c859ab8480dea572430398438ba8b5 31-Jul-2014 Michael Lentine <mlentine@google.com> Build fix to use the correct source.

Change-Id: If36710be600dd0e15c31682e0343f281baa55627
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
47e45405d1533aa73307014f7bf371e118695cf3 19-Jul-2014 Michael Lentine <mlentine@google.com> Allow for resizing of Virtual Displays.

Modify SurfaceFlinger to use VirtualDisplaySurface in all cases when a virtual
display is used. Add functionality in VirtualDisplaySurface to resize the
buffers aquired in the QueueBufferOutput. Add transaction support in
SurfaceFlinger for resize. Add the modification of the size in DisplayDevice.

Change-Id: Iae7e3556dc06fd18d470adbbd76f7255f6e6dd6b
Tested: None
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
24cd98eef88ac93f80c327f8d74f0a1ae0aceee4 13-Jul-2014 Jesse Hall <jessehall@google.com> Compile libsurfaceflinger with Clang and -std=c++11 [DO NOT MERGE]

This is necessary to use C11/C++11 stdlib atomics, which the next
change will do. This change also fixes a couple bits of syntax that
both GCC and Clang refuse to compile in -std=c++11 mode.

Change-Id: Ia14d9d6b537a3bb106c23e19a277e48be180754c
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
0b63cd105cae094c21aafaa2bac8322427e75827 30-Apr-2014 Jesse Hall <jessehall@google.com> Handle failed requestBuffer after successful dequeueBuffer

If the virtual display consumer disconnects after the
VirtualDisplaySurface dequeues a buffer but before it requests it, the
request will fail. Previously the error was ignored, and the caller
would get a success result but a NULL buffer. Now the dequeued buffer
is cancelled and the error propagated to the caller.

Bug: 14140551
Change-Id: I91547885c2cf6063dc7a8f02d97f2df282cdde2c
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
fb39827ebce4637dcba03770f6644cf67e932e06 21-Apr-2014 Dan Stoza <stoza@google.com> Merge "BufferQueue: Increase max slots from 32 to 64"
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
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
d9822a3843017444364899afc3c23fb5be6b9cb9 28-Mar-2014 Dan Stoza <stoza@google.com> BufferQueueProducer: add detachNextBuffer

Adds a new method, IGBP::detachNextBuffer, that effectively does
dequeue + request + detach in a single call, but does not need to
know anything about the dequeued buffer, and will not block on
dequeue. This is mostly for the upcoming StreamSplitter to use in
its onBufferReleased callback.

Change-Id: Ie88a69de109003acebaa486a5b44c8a455726550
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
b9b088375d33a87b201cdbe18be71802e2607717 13-Mar-2014 Dan Stoza <stoza@google.com> Remove deprecated BufferQueue constructor

Bug: 13415624
Change-Id: I9fe15e45daa7351f1db34ee75bfee6f19cb347d3
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
73ed82f809a40560fd3a6d53d18e5c846362d764 13-Mar-2014 Jesse Hall <jessehall@google.com> Merge "Add sideband streams to BufferQueue and related classes"
88a459a9b37f3b4eb3c9a044ad7af30616ad66c9 12-Mar-2014 Dan Stoza <stoza@google.com> VirtualDisplaySurface: no attach/detach support

Change-Id: I630dd6e352940318c33a4e072d2f33a6ec58c556
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/DisplayHardware/VirtualDisplaySurface.cpp
9f3053de78630815d60cf48a2cf2348cc5867c45 07-Mar-2014 Dan Stoza <stoza@google.com> BufferQueue: Allow detaching/reattaching buffers

Adds detachBuffer and attachBuffer calls to both the producer and
consumer sides of BufferQueue. Buffers may be detached while dequeued
by the producer or acquired by the consumer, and when attached, enter
the dequeued and acquired states, respectively.

Bug: 13173343
Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
7143316af216fa92c31a60d4407b707637382da1 05-Feb-2014 Dan Stoza <stoza@google.com> Fix virtual display nesting

This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.

Bug: 12101046
Change-Id: I600365c0fd5d3ad93e04295d26cf9de177ffc79b
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
fdfde88d0bcd0b293c9deb37f49254bdd97e4dac 23-Jan-2014 mayank parshar <mayankp@broadcom.com> SurfaceFlinger: mFbProducerSlot initailization

b/12487813

SurfaceFlinger crash is observed during simulation of
Secondary display

Note: change 14e8b01a761180250671f3d6494532d8bd04fa8e
removed the initialization leading to the crash when
simulating secondary display. Restore the initialization
to solve the problem.

Change-Id: Iae5845fb82735e01de5cc0dc582d13c27e3c614f
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
b988f85fc44efd24f11f2e5ab8fb9b653916f666 10-Jan-2014 mayank parshar <mayankp@broadcom.com> SurfaceFlinger: mFbFence initialization

MobC00383030
b/12487813

SurfaceFlinger crash is observed while connecting
to Wi-Fi display.

Note: change 14e8b01a761180250671f3d6494532d8bd04fa8e
removed the initialization leading to the crash when
running through the HWC composition path. Restore the
initialization to solve the problem.

Change-Id: I581defc7135ac512080c0da06a62b1dae7d218c4
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
14e8b01a761180250671f3d6494532d8bd04fa8e 07-Nov-2013 Jesse Hall <jessehall@google.com> Don't change the framebuffer target until we render a new one

Continuing to send the last-rendered framebuffer to HWC on subsequent
frames allows the HWC to read partially-composed regions that haven't
changed, instead of re-composing from scratch.

Bug: 11573910
Change-Id: I8829877d2a06001f1e1b3f168cbba71c7b217b2d
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
497ba0e08503806571b52ebe27cc7eee4c0e71a7 05-Nov-2013 Jesse Hall <jessehall@google.com> Don't use implementation-defined format with CPU consumers

If the virtual display surface is being consumed by the CPU, it can't
be allowed with HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED since there is
no way for the CPU consumer to find out what format gralloc chose. So
for CPU-consumer surfaces, just use the BufferQueue's default format,
which can be set by the consumer.

A better but more invasive change would be to let the consumer require
a certain format (or set of formats?), and disallow the producer from
requesting a different format.

Bug: 11479817
Change-Id: I5b20ee6ac1146550e8799b806e14661d279670c0
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
c354effe97be26638618e3bc0da81a3f8b384b20 25-Oct-2013 Jesse Hall <jessehall@google.com> Fix handling of undefined TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS

related to b/8316155 - Implement HWComposer 1.3 w/ virtual display support
Change-Id: I2dc8d65a74174aa833cc491264f97f1f2df49307
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
6a968462f9ce4d93d81fcc13672073e3e6eb2e0f 04-Oct-2013 Naseer Ahmed <naseer@codeaurora.org> Add a boardconfig to force HWC composition of virtual displays

When this boardconfig is defined, even when all virtual display
composition is done by GLES, the HWC will be forced to copy from the
GLES framebuffer to the output buffer. On some hardware this allows
HWC to do format conversions that would otherwise have to be done by
the consumer, with worse power and/or performance.

Bug: 8316155
Change-Id: If980ecc589f138cef063eafa757f7f748196713e
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
1e27ba234c5bfd4f6535ee221a6c20407a50f868 27-Sep-2013 Jesse Hall <jessehall@google.com> Use implementation-defined format when HWC writes to output buffer

When GLES isn't writing to the output buffer directly, request an
implementation-defined format with minimal usage flags, leaving the
format choice up to gralloc. On some hardware this allows HWC to do
format conversions during composition that would otherwise need to be
done (with worse power and/or performance) by the consumer.

Bug: 8316155
Change-Id: Iee6ee8404282036f9fd1833067cfe11dbadbf0bf
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
b716e57048e945d5bceda33c2434c65d06464dba 02-Oct-2013 Jesse Hall <jessehall@google.com> Set the outbuf acquire fence after we actually have it.

In GLES-only mode, we don't have the outbuf acquire fence until after
GLES composition is done for the frame. We were setting the fence in
HWC's state immediately after dequeueing the buffer from the consumer,
before GLES had started. This fence got passed through HWC and on to
the consumer, so the consumer was reading the buffer before GLES was
done writing to it.

Now we update HWC's state just before set(), when we know we have the
right fence.

Bug: 11000763
Change-Id: Iea9db4c69634c352dc2d600f0bdb6bef2a432636
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
6da15f46f5f8b38e31384d641f8d3db2c3c6ea30 26-Sep-2013 Mathias Agopian <mathias@google.com> fix crashers with wifi/virtual displays

Bug: 10647742
Change-Id: I4b8ed9da52ef95af3a3b3a04b98514a3776a674d
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
8db92553e9e6263cd41eaf1a1ebc9e3f88f92b5f 30-Aug-2013 Jesse Hall <jessehall@google.com> Force async behavior for the virtual display output BufferQueue

Bug: 10551087
Change-Id: I40bbb2b87d64420939a0ea309254f281437dab56
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
028dc8f2d72bc7cd4fbe7808781443125a742f78 21-Aug-2013 Jesse Hall <jessehall@google.com> Provide HWC prepare with a valid output buffer

We weren't dequeing and setting the output buffer until just before
set(). This didn't allow HWC to make decisions in prepare() based on
the output buffer format, dimensions, etc.

Now we dequeue the output buffer at the beginning of the composition
loop and provide it to HWC in prepare. In GLES-only rendering, we may
have to cancel the buffer and acquire a new one if GLES requests a
buffer with properties different than the one we already dequeued.

Bug: 10365313
Change-Id: I96b4b0a851920e4334ef05080d58097d46467ab8
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
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
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.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/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
bce7611e8e4514026bf12f96baaf9168f6d5894e 16-Jul-2013 Jesse Hall <jessehall@google.com> Fix build -- update for function signature change

Change-Id: I9c2448d5853c69ec7e962847fdaba9a99906cc42
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
38efe86d9459cf5c96a24a34cc5cbf31fdba7e19 07-Apr-2013 Jesse Hall <jessehall@google.com> Rewrite VirtualDisplaySurface

The previous implementation assumed that the HWC could read and write
the same buffer on frames that involved both GLES and HWC composition.
It turns out some hardware can't do this. The new implementation
maintains a scratch buffer pool to use on these mixed frames, but on
GLES-only or HWC-only frames still does composition directly into the
output buffer.

Bug: 8384764
Change-Id: I7a3addb34fad9bfcbdabbb8b635083e10223df69
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
e737c11cd83a449d9a544c5c6d4e0dfd42250a56 07-May-2013 Jesse Hall <jessehall@google.com> Remove experimental HWC virtual display support

Bug: 8384764
Change-Id: I97b52ed83ad85466bd91cb9291308994048568a1
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
2ba647e9f5249d9ed97739d29d879064e31ba34a 04-Apr-2013 Jesse Hall <jessehall@google.com> Actually set the virtual display output buffer.

Bug: 8316155
Change-Id: Ida1ac47e5a932fdaad3ec862e121cfe55d255699
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
ffe1f19ca9707f84cb9fdb06209bf36cd8c2ef0a 22-Mar-2013 Jesse Hall <jessehall@google.com> Fix virtual displays for HWC<=1.1

If we're using a HWC that doesn't support virtual displays, or we have
more virtual displays than HWC supports concurrently, the
VirtualDisplaySurface should simply be a passthrough from source
(GLES) to sink.

This change also tries to distinguish between display types and HWC
display IDs a little better, though there's more to do here. Probably
needs a higher-level rethink; it's too error-prone now.

Bug: 8446838
Change-Id: I708d2cf262ec30177042304f174ca5b8da701df1
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
851cfe834295224cd64bdd499872b95b19c4de8c 20-Mar-2013 Jesse Hall <jessehall@google.com> Isolate knowledge that fb target == output buffer

HWComposer didn't allow the virtual display output buffer to be set
directly, instead it always used the framebuffer target buffer.
DisplayDevice was only providing the framebuffer release fence to
DisplaySurfaces after a commit.

This change fixes both of these, so both HWComposer and DisplayDevice
should continue to work if VirtualDisplaySurface changes to use
separate framebuffer and output buffers. It's also more correct since
VirtualDisplaySurface uses the correct release fence when queueing the
buffer to the sink.

Bug: 8384764
Change-Id: I95c71e8d4f67705e23f122259ec8dd5dbce70dcf
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
13f01cbdbd34779a234bc674df79e23672fd5c0b 20-Mar-2013 Jesse Hall <jessehall@google.com> Pass sp<Fence>s around instead of file descriptors

Change-Id: Iac70584a2207940730e8f803a543e4e9a4000c47
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
7414965606f82ac2bcace5d3e2c8a4810517bf1e 20-Mar-2013 Jesse Hall <jessehall@google.com> Release virtual display buffer immediately after HWC set

Previously we only queued a virtual display buffer to the sink when
the next frame was about to be displayed. This may delay the "last"
frame of an animation indefinitely. Now we queue the buffer as soon as
HWC set() returns and gives us the release fence.

Bug: 8384764
Change-Id: I3844a188e0f6ef6ff28f3e11477cfa063a924b1a
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
80e0a397a4712666661ecc629a64ec26e7f6aac3 15-Mar-2013 Jesse Hall <jessehall@google.com> Add BufferQueueInterposer and use it for virtual displays

BufferQueueInterposer allows a client to tap into a
IGraphicBufferProducer-based buffer queue, and modify buffers as they
pass from producer to consumer. VirtualDisplaySurface uses this to
layer HWC composition on top of GLES composition before passing the
buffer to the virtual display consumer.

Bug: 8384764
Change-Id: I61ae54f3d90de6a35f4f02bb5e64e7cc88e1cb83
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
99c7dbb24994df2f3e175f7b25dd2c9dd92a72f0 14-Mar-2013 Jesse Hall <jessehall@google.com> Add DisplaySurface abstraction

DisplayDevice now has a DisplaySurface instead of using
FramebufferSurface directly. FramebufferSurface implements
DisplaySurface, and so does the new VirtualDisplaySurface class.
DisplayDevice now always has a surface, not just for virtual displays.

In this change VirtualDisplaySurface is just a stub; buffers still go
directly from GLES to the final consumer.

Bug: 8384764
Change-Id: I57cb668edbc6c37bfebda90b9222d435bf589f37
/frameworks/native/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp