History log of /frameworks/native/services/surfaceflinger/Layer.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
07376a98a6c66c4e48bdebe82616f0ae47e5f805 06-Jun-2018 Chia-I Wu <olv@google.com> surfaceflinger: force client composition for Y410

When the pixel format is Y410 masquerading as RGBA_1010102, always
force client composition.

Bug: 80509363
Test: no effect on Pixel devices
Change-Id: I31996eeda1559b0557a5acb53d593fd4f395ccaf
Merged-In: I31996eeda1559b0557a5acb53d593fd4f395ccaf
/frameworks/native/services/surfaceflinger/Layer.h
dba3273a27fb90f19a73abe7142790ad21387484 28-May-2018 Jorim Jaggi <jjaggi@google.com> Push existing pending state when deferring transaction

Otherwise the information from another transaction that happened
before deferring the transaction could have been deferred as well.
To fix that, we push the currently pending state if the
transaction is deferred.

Furthermore, we need to modify the behavior how flags are applied.
Imagine the following sequence of events
- Surface is hidden flags=hidden
- t1 doesn't modify the flags (0/0) but sets some other properties.
flags=hidden mask=0. mCurrentState gets pushed onto mPendingState
before t2 sets (0/hidden) (flags/mask) flags=0 mask=hidden, to
show the surface. Furthemore, we defer this transaction.
mCurrentState gets pushed onto mPendingState.
- At this point, mCurrentState.flags = 0 (shown), but
mDrawingState.flags = hidden
- doTransaction happens. c (the state to promote to drawing state)
= mCurrentState => c.flags = 0 (shown)
Since t1 isn't deferred, the 0th element of mPendingState gets
popped and applied to c. Since mask=0, c.flags = 0 still.
- c gets promoted to mDrawingState and BOOM the
surface was shown even though the barrier of the transaction
showing hasn't opened yet.

Looking closer at the logic it makes sense to just apply the mask
when modifying the current state, and then just pushing it like
all other attributes.

Test: go/wm-smoke
Bug: 78611607
Change-Id: Ia100532189ef7f59f8939c59db9b6292b41e8e77
/frameworks/native/services/surfaceflinger/Layer.h
1b6bafca6e5c4a71bc97f14be30e64541633bda7 22-May-2018 Chia-I Wu <olv@google.com> surfaceflinger: layer dataspace is not a state

Like current crop or transform, layer dataspace is latched with the
buffer. It is not a layer state, and should take effect
immediately.

Bug: 80139629
Test: manual
Change-Id: I52342ca345f174e647550b45defa977484db95a1
Merged-In: I52342ca345f174e647550b45defa977484db95a1
/frameworks/native/services/surfaceflinger/Layer.h
e1043320e8634fb100b5bc2cca4c5ac1f3e9f483 17-May-2018 Chia-I Wu <olv@google.com> surfaceflinger: use layer drawing dataspace

Layer::getDataSpace returns the current (as opposed to drawing)
dataspace, which we almost never want and is racy. Remove the
helper and access the dataspace directly.

Bug: 79210409
Test: boots, Photos
Change-Id: Ifec7055cf0a1f2d84da7ad58e27be2c01082e6e9
/frameworks/native/services/surfaceflinger/Layer.h
1148147c4c06d9d5390c7b7c8b0ca5e0c245fc4a 04-May-2018 Chia-I Wu <olv@google.com> surfaceflinger: re-saturate all legacy dataspaces

We changed HIDL interface to re-saturate any legacy dataspace.
Update SurfaceFlinger to match the behavior.

Bug: 78303195
Test: videos are re-saturated as well in GPU fallback
Change-Id: Idfa74783061a62d79ca5d9f38e50f4095ce38322
/frameworks/native/services/surfaceflinger/Layer.h
0102ad2d522de255efabd50adf6c6a27811344f4 03-May-2018 Yiwei Zhang <zzyiwei@google.com> SurfaceFlinger TimeStats Metrics

Add timestats metrics for SurfaceFlinger. Keep track of global metrics
like total frames, missed frames, frames fellback to client
compositions, etc, as well as layer timing metrics like the delta
combination of postTime, desiredPresentTime, acqureTime, latchTime,
presentTime, etc. This metric is aimed at GMScore.

Test: dumpsys SurfaceFlinger --timestats [go/sf-timestats for more args]
Bug: b/70388650
Change-Id: I6e4545aef62f7893020533a4e7521541ea453ecd
Merged-In: I6e4545aef62f7893020533a4e7521541ea453ecd
/frameworks/native/services/surfaceflinger/Layer.h
4b129c2e3f581ad2d8d18c99dc7b0c5bff3bd348 10-Apr-2018 chaviw <chaviw@google.com> Respect relative layer value if in tree when screenshotting.

Relative layers need to be screenshotted so the dim layer can be
captured in the correct place. However, there are other relative layers
that are not in the tree that shouldn't be part of the screenshot. This
change allows relative layer value to be handled correctly as long as the
layer it's relative to is in the tree to capture. This ensures relative
layers in the tree are captured the correct order, but also ignores any
relative layers that are not in the tree.

Change-Id: If0e0ea1417f01ad1bfe518744ae2b9827009c4c6
Fixes: 77823704
Test: Open app with dialog and go to recents. Dim is screenshotted.
Test: Open app with IME and go to recents. IME is not screenshotted.
Test: Transaction_test#DontCaptureRelativeOutsideTree, CaptureRelativeInTree
/frameworks/native/services/surfaceflinger/Layer.h
dd9b2ae8500d85a6aba82de15e8b40d14a921ca6 02-Mar-2018 Peiyong Lin <lpy@google.com> [SurfaceFinger] Adds auto color mode support in SurfaceFlinger.

This patch adds auto color mode support in SurfaceFlinger. For Auto Awesome
Color milestone 1, we expect the hardware composer is capable of handling P3
layers, meaning if the hardware composer is given P3 layers, it will strech the
color from Display P3 to the pannel native color space. Hardware composer may
punt sRGB layers back to SurfaceFlinger, in this case, we fall back to
RenderEngine. We will set the destination data space to Display P3 when the
layers are mixed color spaces, and set the destination data space as SRGB if
they are all SRGB layers.

BUG: 73824924
BUG: 73825729
Test: Build
Change-Id: I577841b14de0cfe8c29f8aa30bee8621c5d72976
/frameworks/native/services/surfaceflinger/Layer.h
34beb7a0ff0494b0c5ad81104171f8a49e599163 28-Mar-2018 Peiyong Lin <lpy@google.com> [SurfaceFlinger] Replace android_dataspace with Dataspace.

This patch replaces all android_dataspace in SurfaceFlinger with Dataspace
V1.1. 3 commands in sequence are used to do the conversion:

find ./ -type f -exec sed -i -e 's/android_dataspace_t/Dataspace/g' {} \;
find ./ -type f -exec sed -i -e 's/android_dataspace/Dataspace/g' {} \;
find ./ -type f -exec sed -i -e 's/HAL_DATASPACE_/Dataspace::/g' {} \;

With some minor tweak because most of the APIs in frameworks/native are still
accepting android_dataspace/android_dataspace_t.

Next step is to convert the rest of android_dataspace usage to Dataspace in
frameworks/native as well as frameworks/base.

BUG: 77156734
Test: Build and flash
Change-Id: I2304c7014cb49a1c9f67c4563603fb55e8dbd679
/frameworks/native/services/surfaceflinger/Layer.h
068e31b929b40a1bc9be742c04cbdf5b04f3ce97 21-Feb-2018 Yiwei Zhang <zzyiwei@google.com> Implement Display Layer Stats

Try to collect data for analyzing how many display controller layers we
need and what we use them for. Also part of a bug fixing for potential
memory leak of existing layer tracing work of winscope.

Test: adb shell dumpsys SurfaceFlinger --enable-layer-stats
Test: adb shell dumpsys SurfaceFlinger --disable-layer-stats
Test: adb shell dumpsys SurfaceFlinger --clear-layer-stats
Test: adb shell dumpsys SurfaceFlinger --dump-layer-stats
Bug: b/73668062
Change-Id: Ie08aa85d34db2c2c767b8e27eb5aad6f7c3fb975
Merged-In: Ie08aa85d34db2c2c767b8e27eb5aad6f7c3fb975
/frameworks/native/services/surfaceflinger/Layer.h
2afd5172c3e6bd99a287d24a1dd5fe5c7b70754e 28-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes Icf7cf2fd,I325521b7,Ia80c865d,I73599f62,I8526e671, ... into pi-dev

* changes:
SF: Use display device factory in unit test
SF: Introduce mock::NativeWindowSurface
SF: Refactor display device creation
SF: Introduce mock::NativeWindow
SF: Introduce mock::DisplaySurface
SF: Introduce mock::EventControlThread
SF: Separate EventControlThread into interface and impl
SF: Define mock::SurfaceInterceptor
SF: Separate SurfaceInterceptor into interface and impl
SF: Define mock::MessageQueue
SF: Separate MessageQueue into interface and impl
SF: libsurfaceflinger_unittest should skip SF ctor
SF: Switch to internal display setup
0c2de3681db029180ed13b02f090bfa1636bae1c 27-Mar-2018 Rob Carr <racarr@google.com> Merge "SurfaceFlinger: Fix reparenting following ReparentForDrawing" into pi-dev
4d2348551e73b4990aedc83db17a336b533316e6 23-Jan-2018 Lloyd Pique <lpique@google.com> SF: Separate SurfaceInterceptor into interface and impl

SurfaceInterceptor is now an abstract interface.
impl::SurfaceInterceptor is the normal implementation.

This allows unit tests to replace it with a GMock.

Test: Builds
Bug: 74827900
Change-Id: I4d5bb2649b0c7a8ec1e6c0abf01ab53174d06a19
(cherry picked from commit 4dccc413ddf822ca6f1856fd2d8ab80185203eed)
/frameworks/native/services/surfaceflinger/Layer.h
ccd348460ca25890a8fb709e82e6f780e3ce878e 14-Mar-2018 rongliu <rongliu@google.com> Pass correct window type and app id to hw composer.

1. Set -1 as default value for window type and app id.
2. When send layer information to hal, layers inherit type and app id from parent node when
parent node has valid type/appId.
3. Add window type and app id to SurfaceFlinger dumpsys.

Bug: 74622357
Test: Manual test. Several things verified:
1. Android settings layer, status bar layer, nav bar layer have valid window type and appId
when start android settings.
2. Layers without buffer have window type -1 and app id -1.
3. When send layers to hal, Chrome SurfaceView layer inherit type and app id from
its parent (MainActivity layer).

Change-Id: I8d6ad274ca18b61d1bbf6b28f7def5160b55b1e7
Merged-In: I8d6ad274ca18b61d1bbf6b28f7def5160b55b1e7
/frameworks/native/services/surfaceflinger/Layer.h
15eae09ebb293135dedce203bcb542a2e6e8d43a 23-Mar-2018 Robert Carr <racarr@google.com> SurfaceFlinger: Fix reparenting following ReparentForDrawing

Counterintuitively, the new-parent doesn't have the children in
it's child list so even when cleaning up we need to call
reparentChildrenForDrawing on the old parent instead of the new parent.
Also clarify name to make this more obvious and add test.

Test: Transaction_test.cpp
Bug: 76099859
Change-Id: I935eec303dba320b5a2731606ec862311c5ca43e
/frameworks/native/services/surfaceflinger/Layer.h
578038fc49f83c4c8c4accdce49df404ecd6ad02 09-Mar-2018 Robert Carr <racarr@google.com> SurfaceFlinger: Add childLayersOnly variant of capture layers.

Currently captureLayers is being used to capture children of abstract
buffer-less layers, for example we capture the node representing
a Task. Because of animations, etc, the node may have been scaled
when we want to take the screenshot, so we solved this problem with
an inverse transform in LayerRenderArea. However we have parallel problems
for crop, visibility, etc...It seems what we really want from captureLayers
is the ability to capture all child layers while ignoring the parent imposed
state as if in a parallel hierarchy. I initially considered implementing a parallel
hierarchy with layer clones but it seemed much less risky for P to instead
reparent the existing hierarchy to a parallel abstract parent on the server side.

Bug: 72760590
Test: Existing tests pass. Quickstep works with new implementation. New transaction tests.
Change-Id: Ifd2b2f9ed45351d8ed0d7f09be1cd9806ec4abe8
/frameworks/native/services/surfaceflinger/Layer.h
cdf832043afeb74598d64f8689098ae75dad8731 07-Mar-2018 Robert Carr <racarr@google.com> SurfaceFlinger: Add "Abstract" Layer type.

Add an Abstract Layer type which exists only to be a parent. We
will use this to more cleanly represent the various hierarchy Layers
from the WM and for an upcoming screenshot rework.

Bug: 72760590
Test: Existing tests pass
Change-Id: Icd19ab0a467585660a95ae37b9c5dd4b8106da9d
/frameworks/native/services/surfaceflinger/Layer.h
105e64bea07920857a2458d68e61db24d6c0230f 07-Mar-2018 Robert Carr <racarr@google.com> SurfaceFlinger: Move trivial implementations to layer base class.

With the aim of making adding additional Layer subclasses less wordy.

Bug: 72760590
Test: Existing tests pass
Change-Id: I720a1a890ebb652758342d8f6750b4de14f2190b
/frameworks/native/services/surfaceflinger/Layer.h
144e116f45f196396f0d59d5fc09766ab618f885 21-Dec-2017 Lloyd Pique <lpique@google.com> SF: Separate RenderEngine into interface and impl

This allows the RenderEngine to be substituted by a GMock for tests.

RE::RenderEngine is now a pure virtual interface class.
RE::impl::RenderEngine is the normal/base implementation.

Similarly, RE::Image and RE::Surface are pure virtual interfaces.
RE::impl::Image and RE::impl::Surface are the normal implementations.

Test: Builds
Bug: None
Change-Id: Ib5e658df4bb4efc1a9c0ae95feaf0c1e052cdc94
/frameworks/native/services/surfaceflinger/Layer.h
e5f4f694f11ad1e8a9bb3b1b9579a175435c7c19 12-Jan-2018 Robert Carr <racarr@google.com> SurfaceFlinger: Optimize region calculation for invisible layers.

This CL causes the computeVisibleRegions codepath to escape earlier
for a given layer when it is found that it's visible region is empty.
All the juggling in the later part of the function can end up being
quite expensive even when it's no-op. It seems this is largely due
to allocation of storage space for temporary Region variables. In particular
I found that without this CL Walleye was uncapable of staying in 60fps mode
when there were 100 fully occluded layers and 1 visible layer. With this CL
we're able to stay in 60FPS. We are running in to this issue in some practical
cases where we can have a few dozen parent layers with no buffer adding a lot
of time to computeVisibleRegion. Since they have no mActiveBuffer they will
bail early from isVisible and benefit from this change.

Test: Manual. Existing tests pass.
Change-Id: I7dd39f8641649a3cc38b4ed017ffe9b6eefcf224
/frameworks/native/services/surfaceflinger/Layer.h
80d611613ef1a9c05a31cd3f47badfd4de9b1418 21-Dec-2017 Dan Stoza <stoza@google.com> SF: Switch computeBounds to return FloatRect

Switches Layer::computeBounds to return a FloatRect instead of a Rect.

During the computation of the bounds, we apply the layer transformation
to its nominal dimensions, clip it against its bounds (which are either
its parents bounds or the screen bounds), and apply the inverse of the
layer transformation.

Previously, the intermediate position (after transformation/clip, but
before inverse transformation) was stored as Rect, which is to say that
it was truncated to integer coordinates. After applying the inverse
transformation, this loss of precision can cause glitches where a layer
that should be clipped against, e.g., the side of the screen no longer
creates a watertight seal against that side.

In order to fix this, we now store the intermediate value as a FloatRect
and propagate float precision back through computeBounds. The callers of
computeBounds tend to then immediately apply the transform again, at
which point it is safe to round back to integer.

Bug: 64070729
Bug: 66431327
Bug: 69935057
Test: Modified android.view.cts.SurfaceViewSyncTest#
testSurfaceViewBigScale no longer produces bogus display frames
Change-Id: If5987ca4ad76657f9670a5f59258f896180352e2
/frameworks/native/services/surfaceflinger/Layer.h
73bededbdc82a5b6199f0860c8900e75c6f0e467 15-Nov-2017 David Sodman <dsodman@google.com> SF: Move glComp/DispTimeline to SFBE

Move glCompositionDoneTimeline and mDisplayTimeline to the
SurfaceFlingerBE object.

Test: Build/run manually
Change-Id: I77f2cc39ecf20d5b1c93b5396e37df5b1273d613
/frameworks/native/services/surfaceflinger/Layer.h
0cc69188196037c06127c0bc56c516069dbaa558 17-Nov-2017 David Sodman <dsodman@google.com> SF: Add CompositionInfo to LayerBE

Add CompositionInfo structure to LayerBE that tracks the actual
data that will be used by SurfaceFlinger to compose a frame

Test: Build and run manually
Change-Id: I2523de430bb14f9d8f149ba011b25a7a470eae2d
/frameworks/native/services/surfaceflinger/Layer.h
29abff83bb6e148961c2319add7bd72eb76af3d4 04-Dec-2017 Robert Carr <racarr@google.com> Optimize layer traversal

I found when investigating traces with reported jank from P there
was a large amount of time in handleMessageInvalidate but before
latchBuffer. The only culprit here could be layer traversal itself.
The current algorithm is quite costy requiring producing copies
of sp, allocating a new vector, etc (see makeTraversalList). This CL
optimizes the case where there are no relatives of the current layer.
I found that this does in fact eliminate the new time in
handleMessageInvalidate and also reduces onPreComposition.

Bug:69852584
Test: Manual, comparison of systrace, relative Z still works.
Change-Id: I2d942c1987087aae85decc0480d3622204ed665d
/frameworks/native/services/surfaceflinger/Layer.h
5b4cffc352f7f5d3711d4b7798a07434a998b2d7 23-Nov-2017 David Sodman <dsodman@google.com> SF: replicate mActiveBuffer in LayerBE as mBuffer

Replicate mAcitveBuffer in LayerBE as mBuffer

Test: build/run
Change-Id: Iaec4eeddbf4ca1798a47ecbb6c0b6c82ceb1d27c
/frameworks/native/services/surfaceflinger/Layer.h
1e24ccebeeb6798afce2730a120abcf9927960fa 10-Nov-2017 Chia-I Wu <olv@google.com> surfaceflinger: remove all direct use of EGL

SurfaceFlinger now uses EGL/GLES only indirectly through
RenderEngine and GLConsumer.

Test: SurfaceFlinger_test
Change-Id: I78418b00168b79594979212eb488f530e738498d
/frameworks/native/services/surfaceflinger/Layer.h
6f65f3e7caab86a76419e7c1d1c787634a0852d8 03-Nov-2017 David Sodman <dsodman@google.com> SF: mHwcLayers to LayerBE

Move mHwcLayers to LayerBE

Test: build
Change-Id: I16918223d02ae8017656fa1385ed58bbb21aa688
/frameworks/native/services/surfaceflinger/Layer.h
386c22e70d63ecc8bf6ae3e7c2f623f42fcd8718 10-Nov-2017 David Sodman <dsodman@google.com> SF: replicate mSidebandStream in LayerBE

Add a copy of mSidebandStream in LayerBE. This is
one of the few data items that is replicated in
both FE and BE.

Test: build
Change-Id: Ief98645a4fa178e2606c0c337b3f260a1766597a
/frameworks/native/services/surfaceflinger/Layer.h
9eeae69005ef9a774bde19195b9c06eba7e463c2 02-Nov-2017 David Sodman <dsodman@google.com> Surfaceflinger: Create LayerBE data class

Split Layer class into a backend and front-end version. This
change creates the backend struct and only puts a single data
item in that struct. Follow-on changes to move more things
to the backend will follow

Test: build

Change-Id: I01d217468ea6008eb46cc3a225d47e1e0b90865a
/frameworks/native/services/surfaceflinger/Layer.h
8d7cb208f52d5034d1b580e819488e7a0b012d27 20-Nov-2017 Rob Carr <racarr@google.com> Merge "Allow relative layering of children"
83806897c6366d841971a38f4a007bb83a7afb64 16-Nov-2017 Chia-I Wu <olv@google.com> surfaceflinger: fix fencing when layers become invisible

A layer always holds on to a buffer (after the first one is
acquired). When a new buffer comes in, and the layer is visible, it
will

- acquire the new buffer
- present the new buffer to HWC
- get the release fence from HWC
- associate the old buffer with the release fence and release it

But if the layer happens to be becoming invisible, it will go
through

- acquire the new buffer
- destroy the HWC layer and present
- release the old buffer without any fence

The problem here is that the old buffer is still on screen until the
present takes effect (e.g., on next HW vsync). Rendering artifacts
may be seen on screen.

This commit changes the acquire/release process for layer becoming
invisible to

- acquire the new buffer
- destroy the HWC layer and present
- get a fence from HWC
- associate the old buffer with the fence and release it

We do not require HWC getReleaseFences to return fences for
destroyed layers. We can only use the next best fence, the present
fence.

Bug: 68490054
Test: manual
Change-Id: I68bbf392a6681c6512fc0be68a7d17df122f7308
/frameworks/native/services/surfaceflinger/Layer.h
503c7046237f2797a5cf8584064223359d0e6d10 28-Sep-2017 Robert Carr <racarr@google.com> Allow relative layering of children

Initially we had hoped not to go down this route in order to produce the most
understandable model, but in the end it seems to be the most sane way to
satisfy some existing use cases from the WM. In particular we have the use
case of the IME. The IME may of course be larger than the application it is
targetting, in particular we see this in side by side split-screen portrait
and freeform. However, various UI features such as the text drag handles,
spell checking popups, etc, are controlled by the application process
and modelled as child windows of the application. This is a good fit for them
as they need to inherit most properties of the application window: Cropping,
Transform, Alpha. However they need to appear over the IME! As the IME can't
be a child of the application (it is bigger), we now see our use case for relative
layering. Perhaps the drag handles could be reimplemented as controlled by the IME
process but if nothing else as a legacy API we have exposed the idea of child windows
of the app going over the IME and are likely to need to continue to support it in some
mode.

Test: Transaction_test.cpp
Change-Id: If2d831bcbe88fc753b02c044a57882cca6ccffbb
/frameworks/native/services/surfaceflinger/Layer.h
c9232edd34618360d099272fb0537cae2f715860 15-Nov-2017 chaviw <chaviw@google.com> Added check for forceClientComposition for every layer.

Instead of having the Layers check for forceClientComposition, have
SurfaceFlinger check since it will be skipping hwc. This also ensures
that new Layer types also get the same check.

Fixes: 69254085
Test: Current tests pass. Rotation works correctly now.

Change-Id: I7a2a378d9690206008b1dab9ce521f959542903a
/frameworks/native/services/surfaceflinger/Layer.h
83ce7c162855742a2d9eeebc0cd70fe48d2cd125 20-Oct-2017 Chia-I Wu <olv@google.com> surfaceflinger: remove USE_HWC2

Remove USE_HWC2 and assume it to be true. Remove all !USE_HWC2
code.

This also fixes a compile error in tests/fakehwc, which never
defines USE_HWC2.

Test: boots taimen and hikey960
Change-Id: Ie6d2fcf884aa6fc715ab0ce19a1e0f7c8acf734c
/frameworks/native/services/surfaceflinger/Layer.h
a6a56b32c133466df61237ced4c416d0dd840f18 09-Nov-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't invoke transactions on layers that will be removed."
8b3871addb9bbd5776f4ed59e67af2baa9c583fd 02-Nov-2017 chaviw <chaviw@google.com> Don't invoke transactions on layers that will be removed.

A layer can be marked as removed, but still be present in memory.
This check ensures that transactions aren't invoked on layers that
will be removed on the next commitTransaction.

Normally, this would be harmless since the layer will get removed
as soon as a commitTransaction is called. However, for cases like
re-parenting, a removed child layer can be re-parented to a non-removed
layer, which prevents the child from getting removed.

Test: Added code that would destroy a layer before the re-parent was
called. Ensure that the re-parent was ignored. There doesn't
seem to be an easy way to write a test case right now.

Change-Id: I17614447fc4253bdbbb0c06469bb09117b55c1ab
/frameworks/native/services/surfaceflinger/Layer.h
eb085e0c579f310e2670204b14b742b68c70bc9e 06-Oct-2017 David Sodman <dsodman@google.com> Move mSurfaceFlingerConsumer into BufferLayer

One of the benefits of splitting the Layer class to
have the BufferLayer specific derived class is so
that the SurfaceFlingerConsumer can be completely
removed from the ColorLayer class (which has no
BufferQueue). This change implements that change.

Test: Transaction_test.cpp and manual test

Change-Id: Ia923c3e0ea366f58de61eca31b444b3332a23e51
/frameworks/native/services/surfaceflinger/Layer.h
41fdfc920e2a479add53a1936c3ae76cdbea41db 07-Nov-2017 David Sodman <dsodman@google.com> Run clang-format on Layer/SurfaceFlinger files

Run clang-format on changes introduced by the
Layer refactor

Test: Compile/Manual run
Change-Id: I3042cb265d2a00c694f0d6d29cce878dbb069f50
/frameworks/native/services/surfaceflinger/Layer.h
0c69cad13dda09f1df1dbf23810b1c5b7f28ba08 21-Aug-2017 David Sodman <dsodman@google.com> Refactor Layer/ColorLayer into siblings

New class hierarchy should look like:

Layer (abstract)
/ \
/ \
Buffer Color
Layer Layer

Note: LayerBuffer is what previously was referred to by class Layer

Test: Transaction_test.cpp/manual test

Change-Id: I372a27d533e08371da37be811e4372404f7787bd
/frameworks/native/services/surfaceflinger/Layer.h
a76b271f0e14325fa0ebb98e1cac0a15adfea1cb 20-Sep-2017 chaviw <chaviw@google.com> Add captureLayers function to capture a layer and its children.

The captureLayers function gets a root layer as its argument.
It will capture the content for that layer and its descendants. The
capture will set the root layer's transform back to (0, 0).

Test: Transaction_test ScreenCaptureTest
Change-Id: I84fb66a65cd91434cddc99506b1924cf9f950935
/frameworks/native/services/surfaceflinger/Layer.h
1d04428c3cff3503212ec3e76775ca5ba20abc18 27-Sep-2017 chaviw <chaviw@google.com> Added protobuf to gather layer info.

Use protobuf to gather information about the layers. This change also
uses protobuf for the layer dumpsys.

Test: Ran dumpsys for layers to confirm the data was correct.

Change-Id: Iec474e57a4fb9de1e548440d6a08685505947278
/frameworks/native/services/surfaceflinger/Layer.h
4cdc58f6840d15b4952149d2b345ec1f97d505bc 23-Aug-2017 Robert Carr <racarr@google.com> SurfaceFlinger Transactions as distinct objects.

Essentially a process global singleton for transactions is not so useful once
we make surface control public API as process isn't something an app developer
is really thinking about. It's also nice that we get to delete two of the plumbing layers.

Test: Boots
Change-Id: I8864bd7e2f5865e3c0a425cf82f9928211911774
/frameworks/native/services/surfaceflinger/Layer.h
13fdc49516d17f41e64e62e73c313b0928bf13cc 27-Jun-2017 chaviw <chaviw@google.com> Added native functionality to create a color layer.

Added a new layer that can draw a specified color and specified
alpha. This will replace creating a dim layer and allow any colors,
not just black, to be set for this layer.

Test: Added tests to Transaction_test.cpp to test with a color
and a color layer with alpha.

Change-Id: I00a38d1bbc01093026f088c3347454281bdc2b8c
/frameworks/native/services/surfaceflinger/Layer.h
f1961f713de2b3f54c8ce7653964b969e1a02bc8 19-Sep-2017 chaviw <chaviw@google.com> Re-parent invoked on child instead of on parent.

The function to re-parent an individual child is now invoked on
the child instead of the parent. This ensures the child ends up with
the last parent set if multiple reparent requests are made in the same
transaction.
This also allows adding a parent to a layer that didn't have one
previously.

Test: Transaction_test -> Reparent, ReparentToNoParent,
ReparentFromNoParent

Change-Id: Idab429eb2dca5a4ae1b020a5a7629d719dd4d995
/frameworks/native/services/surfaceflinger/Layer.h
0617894190ea0c3ee50889bee1d4df0f369b0761 27-Jul-2017 chaviw <chaviw@google.com> Add a re-parent function to re-parent a specific child.

This is similar to reparentChildren, but the reparentChild will
only re-parent a specific child to the new parent and not all
children.

Test: Added test in Transaction_test for reparentChild.

Change-Id: I4275e0d5f1d5601b489956753c78a56d1a5d4c1c
/frameworks/native/services/surfaceflinger/Layer.h
c8a1e48ea0a0eddacdbccc58a2b087e4d925cedd 16-Aug-2017 Chia-I Wu <olv@google.com> Merge "surfaceflinger: fix z-relative layer destruction" into oc-mr1-dev
am: 11e66edfad

Change-Id: I8210bbb66165da88aa3331a31f134f0088d9f01e
c665702cea06c5c42360b7f66fed1693127e6680 15-Aug-2017 Chia-I Wu <olv@google.com> surfaceflinger: fix z-relative layer destruction

Layer::commitTransaction is called before Layer::onRemoved. The
removal of a layer from another layer's zOrderRelatives is not
reflected in Layer::mDrawingState until Layer::commitTransaction is
called again. As a result, we may draw a removed layer, which is
not supposed to own any HWC or GL resource.

Add Layer::onRemovedFromCurrentState that is called when a layer is
removed from mCurrentState to mLayersPendingRemoval. Move
zOrderRelative* updates from onRemoved to the new
onRemovedFromCurrentState, and set eTraversalNeeded as needed.

Also fix Layer::~Layer to restore the old behavior and destroy all
stale HWC layers just in case.

Bug: 64572777
Test: manual and AUPT
Change-Id: I546c5b4b7ecac0937fead655733402fae664331c
/frameworks/native/services/surfaceflinger/Layer.h
b02664ddc146893e6bbe7939ee2b948d54e7166a 27-Jul-2017 Steven Thomas <steventhomas@google.com> Use a separate hwcomposer hidl instance for vr flinger

Improve robustness of vr flinger <--> surface flinger switching by
having vr flinger use a separate hardware composer hidl instance instead
of sharing the instance with surface flinger. Sharing the hardware
composer instance has proven to be error prone, with situations where
both the vr flinger thread and surface flinger main thread would write
to the composer at the same time, causing hard to diagnose
crashes (b/62925812).

Instead of sharing the hardware composer instance, when switching to vr
flinger we now delete the existing instance, create a new instance
directed to the vr hardware composer shim, and vr flinger creates its
own composer instance connected to the real hardware composer. By
creating a separate composer instance for vr flinger, crashes like the
ones found in b/62925812 are no longer impossible.

Most of the changes in this commit are related to enabling surface
flinger to delete HWComposer instances cleanly. In particular:

- Previously the hardware composer callbacks (which come in on a
hwbinder thread) would land in HWC2::Device and bubble up to the
SurfaceFlinger object. But with the new behavior the HWC2::Device
might be dead or in the process of being destroyed, so instead we have
SurfaceFlinger receive the composer callbacks directly, and forward
them to HWComposer and HWC2::Device. We include a composer id field in
the callbacks so surface flinger can ignore stale callbacks from dead
composer instances.

- Object ownership for HWC2::Display and HWC2::Layer was shared by
passing around shared_ptrs to these objects. This was problematic
because they referenced and used the HWC2::Device, which can now be
destroyed when switching to vr flinger. Simplify the ownership model
by having HWC2::Device own (via unique_ptr<>) instances of
HWC2::Display, which owns (again via unique_ptr<>) instances of
HWC2::Layer. In cases where we previously passed std::shared_ptr<> to
HWC2::Display or HWC2::Layer, instead pass non-owning HWC2::Display*
and HWC2::Layer* pointers. This ensures clean composer instance
teardown with no stale references to the deleted HWC2::Device.

- When the hardware composer instance is destroyed and the HWC2::Layers
are removed, notify the android::Layer via a callback, so it can
remove the HWC2::Layer from its internal table of hardware composer
layers. This removes the burden to explicitly clear out all hardware
composer layers when switching to vr flinger, which has been a source
of bugs.

- We were missing an mStateLock lock in
SurfaceFlinger::setVsyncEnabled(), which was necessary to ensure we
were setting vsync on the correct hardware composer instance. Once
that lock was added, surface flinger would sometimes deadlock when
transitioning to vr flinger, because the surface flinger main thread
would acquire mStateLock and then EventControlThread::mMutex, whereas
the event control thread would acquire the locks in the opposite
order. The changes in EventControlThread.cpp are to ensure it doesn't
hold a lock on EventControlThread::mMutex while calling
setVsyncEnabled(), to avoid the deadlock.

I found that without a composer callback registered in vr flinger the
vsync_event file wasn't getting vsync timestamps written, so vr flinger
would get stuck in an infinite loop trying to parse a vsync
timestamp. Since we need to have a callback anyway I changed the code in
hardware_composer.cpp to get the vsync timestamp from the callback, as
surface flinger does. I confirmed the timestamps are the same with
either method, and this lets us remove some extra code for extracting
the vsync timestamp that (probably) wasn't compatible with all devices
we want to run on anyway. I also added a timeout to the vysnc wait so
we'll see an error message in the log if we fail to wait for vsync,
instead of looping forever.

Bug: 62925812

Test: - Confirmed surface flinger <--> vr flinger switching is robust by
switching devices on and off hundreds of times and observing no
hardware composer related issues, surface flinger crashes, or
hardware composer service crashes.

- Confirmed 2d in vr works as before by going through the OOBE flow on a
standalone. This also exercises virtual display creation and usage
through surface flinger.

- Added logs to confirm perfect layer/display cleanup when destroying
hardware composer instances.

- Tested normal 2d phone usage to confirm basic layer create/destroy
functionality works as before.

- Monitored surface flinger file descriptor usage across dozens of
surface flinger <--> vr flinger transitions and observed no file
descriptor leaks.

- Confirmed the HWC1 code path still compiles.

- Ran the surface flinger tests and confirmed there are no new test
failures.

- Ran the hardware composer hidl in passthrough mode on a Marlin and
confirmed it works.

- Ran CTS tests for virtual displays and confirmed they all pass.

- Tested Android Auto and confirmed basic graphics functionality still
works.

Change-Id: Ibf1dbdf3ec15ca66467697d711f8109dc9e46a47
Merged-In: I17dc0e060bfb5cb447ffbaa573b279fc6d2d8bd1
/frameworks/native/services/surfaceflinger/Layer.h
d7f49c5e93a554c2f0e85e279a765f92fb1e66f1 27-Jul-2017 Steven Thomas <steventhomas@google.com> Use a separate hwcomposer hidl instance for vr flinger

Improve robustness of vr flinger <--> surface flinger switching by
having vr flinger use a separate hardware composer hidl instance instead
of sharing the instance with surface flinger. Sharing the hardware
composer instance has proven to be error prone, with situations where
both the vr flinger thread and surface flinger main thread would write
to the composer at the same time, causing hard to diagnose
crashes (b/62925812).

Instead of sharing the hardware composer instance, when switching to vr
flinger we now delete the existing instance, create a new instance
directed to the vr hardware composer shim, and vr flinger creates its
own composer instance connected to the real hardware composer. By
creating a separate composer instance for vr flinger, crashes like the
ones found in b/62925812 are no longer impossible.

Most of the changes in this commit are related to enabling surface
flinger to delete HWComposer instances cleanly. In particular:

- Previously the hardware composer callbacks (which come in on a
hwbinder thread) would land in HWC2::Device and bubble up to the
SurfaceFlinger object. But with the new behavior the HWC2::Device
might be dead or in the process of being destroyed, so instead we have
SurfaceFlinger receive the composer callbacks directly, and forward
them to HWComposer and HWC2::Device. We include a composer id field in
the callbacks so surface flinger can ignore stale callbacks from dead
composer instances.

- Object ownership for HWC2::Display and HWC2::Layer was shared by
passing around shared_ptrs to these objects. This was problematic
because they referenced and used the HWC2::Device, which can now be
destroyed when switching to vr flinger. Simplify the ownership model
by having HWC2::Device own (via unique_ptr<>) instances of
HWC2::Display, which owns (again via unique_ptr<>) instances of
HWC2::Layer. In cases where we previously passed std::shared_ptr<> to
HWC2::Display or HWC2::Layer, instead pass non-owning HWC2::Display*
and HWC2::Layer* pointers. This ensures clean composer instance
teardown with no stale references to the deleted HWC2::Device.

- When the hardware composer instance is destroyed and the HWC2::Layers
are removed, notify the android::Layer via a callback, so it can
remove the HWC2::Layer from its internal table of hardware composer
layers. This removes the burden to explicitly clear out all hardware
composer layers when switching to vr flinger, which has been a source
of bugs.

- We were missing an mStateLock lock in
SurfaceFlinger::setVsyncEnabled(), which was necessary to ensure we
were setting vsync on the correct hardware composer instance. Once
that lock was added, surface flinger would sometimes deadlock when
transitioning to vr flinger, because the surface flinger main thread
would acquire mStateLock and then EventControlThread::mMutex, whereas
the event control thread would acquire the locks in the opposite
order. The changes in EventControlThread.cpp are to ensure it doesn't
hold a lock on EventControlThread::mMutex while calling
setVsyncEnabled(), to avoid the deadlock.

I found that without a composer callback registered in vr flinger the
vsync_event file wasn't getting vsync timestamps written, so vr flinger
would get stuck in an infinite loop trying to parse a vsync
timestamp. Since we need to have a callback anyway I changed the code in
hardware_composer.cpp to get the vsync timestamp from the callback, as
surface flinger does. I confirmed the timestamps are the same with
either method, and this lets us remove some extra code for extracting
the vsync timestamp that (probably) wasn't compatible with all devices
we want to run on anyway. I also added a timeout to the vysnc wait so
we'll see an error message in the log if we fail to wait for vsync,
instead of looping forever.

Bug: 62925812

Test: - Confirmed surface flinger <--> vr flinger switching is robust by
switching devices on and off hundreds of times and observing no
hardware composer related issues, surface flinger crashes, or
hardware composer service crashes.

- Confirmed 2d in vr works as before by going through the OOBE flow on a
standalone. This also exercises virtual display creation and usage
through surface flinger.

- Added logs to confirm perfect layer/display cleanup when destroying
hardware composer instances.

- Tested normal 2d phone usage to confirm basic layer create/destroy
functionality works as before.

- Monitored surface flinger file descriptor usage across dozens of
surface flinger <--> vr flinger transitions and observed no file
descriptor leaks.

- Confirmed the HWC1 code path still compiles.

- Ran the surface flinger tests and confirmed there are no new test
failures.

- Ran the hardware composer hidl in passthrough mode on a Marlin and
confirmed it works.

- Ran CTS tests for virtual displays and confirmed they all pass.

- Tested Android Auto and confirmed basic graphics functionality still
works.

Change-Id: I17dc0e060bfb5cb447ffbaa573b279fc6d2d8bd1
Merged-In: I17dc0e060bfb5cb447ffbaa573b279fc6d2d8bd1
/frameworks/native/services/surfaceflinger/Layer.h
a099a24c93bfa599fc5c36a647e946c26f68514f 11-Jan-2017 Kalle Raita <kraita@google.com> Faked HWC for SurfaceFlinger testing

Infrastructure and initial port of transaction tests. Faking the HWC
allows exercising the real path through the SurfaceFlinger, not relying
on screen captures. Faked HWC also opens up the possibility of faking
interactions like display hotplugs.

The tests are verifying the composition rectangles instead of a set of
select pixels. GLES rendering differences won't affect the
results. Also, the test expectations become clearer.

The ported transaction tests ran roughly twice as fast when compared
with the original transaction test. This is mostly due to the thighter
control over the vsyncs.

Test: Running the test on Marlin
Change-Id: I1c876cda78db94c1965498af957e64fdd23459ce
/frameworks/native/services/surfaceflinger/Layer.h
ab0c319824632c463ea624cee6f0bc3c8cd8a779 01-Aug-2017 Chia-I Wu <olv@google.com> libsurfaceflinger: handle WINDOW_TYPE_DONT_SCREENSHOT

When a layer has type WINDOW_TYPE_DONT_SCREENSHOT, hide it from
everywhere but the primary display. This should be reverted when we
switch to use layer hierarchy properly.

Bug: 63311708
Test: screencap, screenrecord, android.view.cts.SurfaceViewSyncTest
Change-Id: I6a8d6b93399b0dc42832588f9a6c5e8879a8b754
/frameworks/native/services/surfaceflinger/Layer.h
a36bf92663256f1c8d2956902daf0f1045961953 30-Jun-2017 Chia-I Wu <olv@google.com> surfaceflinger: refresh after latching any buffer

We should not skip refresh when a latched buffer happens to have an
empty dirty region. Also, we should signal a layer update when we
skip refresh.

Bug: 62752640
Test: manual
Change-Id: Ia603e7eeb37491c6ece7ea08d5d1e3b7ba93e6fa
/frameworks/native/services/surfaceflinger/Layer.h
c35a5e29f3c4c05041ac0f4a0bcbfe669d3d67bc 17-Jun-2017 Chia-I Wu <olv@google.com> Merge changes from topic 'layer-wp-race' into oc-dev
am: a17b14eb92

Change-Id: I1af51f57255024d36e9cae5c221361f36cb28da4
e41dbe6ab1d412efd67fdc8344be8da8b19426d2 13-Jun-2017 Chia-I Wu <olv@google.com> surfaceflinger: distinguish mCurrentParent/mDrawingParent

Updates to wp<> is not atomic. We cannot use/update it at the same
time from the main thread and a binder thread. With this change,
binder threads use mCurrentParent with the external state lock held.
The main thread uses mDrawingParent.

This is also an alternative fix to bug 62099658 and allows us to
revert "SurfaceFlinger: Update parent pointer while performing
transaction."

Bug: 38505866
Bug: 62099658
Test: boots and no repro (but I can never repro)
Change-Id: Id286a437537daaeec5eee5de62b1d9df245ece53
/frameworks/native/services/surfaceflinger/Layer.h
e6b63e1ae12692327f7e46d5f10d6ade5a7bf192 30-May-2017 Chia-I Wu <olv@google.com> surfaceflinger: fix layer count

When a layer is removed, mLayerCount is always decremented by 1 even
though the layer has children. This commit fixes that by making
sure mLayerCount is properly decremented, and makes sure that a
parent layer must be a valid layer in mCurrentState.

Bug: 37121786
Test: manually open and close Camera app
Change-Id: I5a3e18be41646b167b4d361dfe08db4d06e1c2d0
(cherry picked from commit 98f1c108b016dda77c808f3d099e7a45bdd70768)
/frameworks/native/services/surfaceflinger/Layer.h
98f1c108b016dda77c808f3d099e7a45bdd70768 30-May-2017 Chia-I Wu <olv@google.com> surfaceflinger: fix layer count

When a layer is removed, mLayerCount is always decremented by 1 even
though the layer has children. This commit fixes that by making
sure mLayerCount is properly decremented, and makes sure that a
parent layer must be a valid layer in mCurrentState.

Bug: 37121786
Test: manually open and close Camera app
Change-Id: I5a3e18be41646b167b4d361dfe08db4d06e1c2d0
/frameworks/native/services/surfaceflinger/Layer.h
bce1deadafc06d5a7d5fa78ee26602f565260028 23-May-2017 Robert Carr <racarr@google.com> Merge "SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes." into oc-dev am: e2fad8108e
am: 1ae167bef4

Change-Id: Iba205e1c3fcb0768aa4b418b843c4efaaf1ecc4d
7bf247e2db180da661b18084d50e0b389686fc0c 18-May-2017 Robert Carr <racarr@google.com> SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes.

The same sort of thing we had with setPosition...not sure why I didn't
realize we would need the fixes here too! In particular we need to ensure
the following scenarios work:

1. Additional calls to set(Final)Crop while in the setGeometryAppliesWithResize
state are eventually applied.
2. Additional calls to set(Final)Crop while in the setGeometryAppliesWithResize
state are not immediately applied.
3. In LayerRejector.cpp we have to be sure we are not just latching a buffer
at the old size, which we still allow. This is the correct time to latch
the transparentRegion as it is content dependent, but doesn't represent
a size changing.

The difference between this and the original CL which was reverted has to do with
point 3. The original CL tried to solve point 3 by moving the latching logic from
the LayerRejecter in to Layer::doTransaction. However, in general doTransaction
will not be called in between Latching the buffer and drawing the frame, so this
introduced errors. The new test "FinalCropLatchingBufferOldSize" encapsulates this.

Bug: 37621737
Bug: 37531386
Test: Included in Transaction_test.cpp
Change-Id: I14bd09d01ac6b85895caa1b707d6fa7dac962074
/frameworks/native/services/surfaceflinger/Layer.h
acbff73e732bca3cc5b486d2e8aadb15f097cec5 16-May-2017 Rob Carr <racarr@google.com> Merge "Revert "SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes."" into oc-dev am: cbcefae07a
am: 92a3cc4761

Change-Id: I1e88987fdaacebec61a15f8234839e89f4b79799
a3ed032256c475ce13c52b0261da6a5e2ffa77be 16-May-2017 Rob Carr <racarr@google.com> Revert "SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes."

This reverts commit 1e079c2804edfae77925150280fe79418e58750b.

Bug: 38331032
Change-Id: Ib703b7b80a940550487a80d8ad62947e4becae93
/frameworks/native/services/surfaceflinger/Layer.h
4ed76e27b6a77aad95bf29a94670c8e62436d7a9 16-May-2017 Rob Carr <racarr@google.com> Merge "SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes." into oc-dev am: 83c9468c80
am: 0f755fda7f

Change-Id: I0996c441cbfd4ead4ae5d0aaa5e80c9a02788c20
1e079c2804edfae77925150280fe79418e58750b 09-May-2017 Robert Carr <racarr@google.com> SurfaceFlinger: setGeometryAppliesWithResize crop latching fixes.

The same sort of thing we had with setPosition...not sure why I didn't
realize we would need the fixes here too! In particular we need to ensure
the following scenarios work:

1. Additional calls to set(Final)Crop while in the setGeometryAppliesWithResize
state are eventually applied.
2. Additional calls to set(Final)Crop while in the setGeometryAppliesWithResize
state are not immediately applied.
3. When we latch the buffer completing the resize...current hasn't been swapped
to drawing...which means our location in LayerRejector.cpp was the wrong
place to update the crop. This raises questions about whether the
Transparent region latching works.

Bug: 37531386
Test: Included in Transaction_test.
Change-Id: I5140d44fd5e591a4afe5bddc201db45f7bcb5674
/frameworks/native/services/surfaceflinger/Layer.h
f7ba41abeb819e915997b4612a7af8c685d1fe3c 11-May-2017 Dan Stoza <stoza@google.com> SF: Add systrace lines for layer transactions

Adds new lines to systrace corresponding to when Layers have
transactions (including showing how many transactions are pending when
deferred transactions are used). The new lines are prefixed with "TX - "
to distinguish them from the usual queue occupancy lines.

Test: Manual inspection of systraces
Change-Id: Iebc165a187cf87b6bc1ed4de6595463f5ba9d4fe
/frameworks/native/services/surfaceflinger/Layer.h
532b26380fd6d32dc5d7605bd766a2c4f00d0a80 06-May-2017 Courtney Goeltzenleuchter <courtneygo@google.com> Fix emulator build

getDataSpace was inside HWC2 ifdef when it didn't need to be.
Breaking builds that were not HWC2.
Test: build android auto or emulator

Change-Id: Ief68f458a29ae985780af9defcfeccb9baf7a701
/frameworks/native/services/surfaceflinger/Layer.h
412903fce3a93f411c85c54375a1851bfb370400 27-Apr-2017 Dan Stoza <stoza@google.com> SurfaceFlinger: Select which layer state to visit

Modifies the traverseIn[Reverse]ZOrder methods to also take an enum
value specifying whether to traverse the current state or the drawing
state.

This has the effect of fixing a bug where we weren't performing
transactions on a child layer because its parent was only visiting its
drawing layers (rather than its current layers) and was thus skipping
the child, which had not yet been moved from current to drawing.

Bug: 36858924
Test: ChildLayerTest.Bug36858924 doesn't hang
Change-Id: I1959f40bc07e77864ba024511d429592a398a67a
/frameworks/native/services/surfaceflinger/Layer.h
db66e627ad8904491e384c64f82fc77a939b9705 11-Apr-2017 Robert Carr <racarr@google.com> SurfaceFlinger: Add parent-less relative layering.

This is a temporary functionality for the intermediate state where not
all child-surface like things in WM land are ported to use Child
Surfaces. In particular, we have ported SurfaceView to use child
surfaces and relative Z ordering. However the TV frameworks provide a
View framework component which overlays views over the SurfaceView but
below the main application window. Since we have not ported View
framework surfaces to use child layers, there is nothing the WM or
View Framework can do about this situation. Luckily the WM API's to
have requested this are @hide but we have the one media framework
component using it. In order to solve this issue we provide a method
to set Z ordering relative to another window without inheriting
its coordinate space as a child window would. This way the WM can
recognize these TYPE_APPLICATION_MEDIA_OVERLAY windows and Z-order
them at -1 with respect to the parents (and the SurfaceView can be at
-2).

Test: Included in transaction tests. Also manual test of bug repro steps with accomp frameworks/base CL
Bug: 36693738
Change-Id: I921852d3d34f67f79ec745b9703f9e679867e7a1
/frameworks/native/services/surfaceflinger/Layer.h
6452f12c95e855a96ab8f690f28914cd37de762b 21-Mar-2017 Robert Carr <racarr@google.com> SurfaceFlinger: Inherit Alpha for child surfaces.

Necessary for various animations to work correctly and
for the general goal of treating child surfaces like
pixels in the parent surface.

Test: Includes new test in SurfaceFlinger_test
Bug: None yet ;)
Change-Id: Ic8309518bd327bbba6ad2f79f265e24cf37898e7
/frameworks/native/services/surfaceflinger/Layer.h
8d5227b8416b099c884429312daf2d60496fa484 16-Mar-2017 Robert Carr <racarr@google.com> Include finalCrop in setGeometryAppliesWithResize.

A refresher on this archaic function. Normally window crop and
position apply immediately. This is so the window manager can always
crop surfaces (e.g. while docked resizing) even if the app is lagging
behind. In some cases though the apps position or cropping may depend
on whether the resize has occured or not. For example when an app
gains shadows, we need to move expand the Surface and move it by a
negative offset for the content to remain in the same place. This
movement needs to be synchronized with the buffer latching for the
expansion.

We implemented setGeometryAppliesWithResize to take care of this. At
the time it wasn't clear if it was needed for finalCrop so we let it
be. Now that we are exclusively using final crop in the pinned stack
however it is required. The same way we have an issue with position
and shadows, we have an issue with expanding the crop rect (we may
have actually been cropping out part of a larger surface that is now
supposed to be shadows).

Also includes a test suite for setGeometryAppliesWithResize behavior
which was previously untested.

Bug: 35396882
Test: SurfaceFlinger_test
Change-Id: Ie4d32162eb21154496bb231161692d18341a1e1e
/frameworks/native/services/surfaceflinger/Layer.h
d8ab4396a858a9c929a1bb3cadf7705fb8061574 21-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "egl: Remove retire event."
9551fd3acc2b0bbdfed02ed2bf97c5e560933abe 21-Oct-2016 Courtney Goeltzenleuchter <courtneygo@google.com> Add getDataSpace to layer class

Test: TBD
Change-Id: I1d583bc6dae4cfb1569f053b2480e94b6ca9cc6f
/frameworks/native/services/surfaceflinger/Layer.h
4e606e3901b500bdd0f3ea21b8cb63734087bf0a 16-Mar-2017 Brian Anderson <brianderson@google.com> egl: Remove retire event.

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

Change-Id: Ibf63d22e42ae52307662107eec50f80de0e703f5
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
4afbf41da18937466ed87da5ccdcb6cf13622709 08-Mar-2017 Fabien Sanglard <sanglardf@google.com> Delete typo in SurfaceFlinger documentation

Test: None (this is a comment)
Change-Id: I0876a40697fe5bb5245513520bc1f9a4bf1139f7
/frameworks/native/services/surfaceflinger/Layer.h
f0c53d6e864abc284b267e866817b3d006944a60 04-Mar-2017 Fabien Sanglard <sanglardf@google.com> [SurfaceFlinger] Document layerStack

Test: None, these are only comments.
Change-Id: Id5d45a5847d253bf92263091e5b322a1577fabe1
/frameworks/native/services/surfaceflinger/Layer.h
9524cb3b37a91b5741790c77ff24fd825b02bca7 13-Feb-2017 Robert Carr <racarr@google.com> Add detachChildren transaction.

Add SurfaceControl#detachChildren for use by the WindowManager.
This method is used in cases where the WM would previously preserve
windows the client tried to destroy. For example, when becoming invisible
(in the activity lifecycle sense, not in the SurfaceFlinger sense)
an app will destroy its child surfaces. Previously the WM would keep child
windows alive until the animation finishes to prevent glitches. The new
scheme for this is the WM will detach the children at this point,
at which point the parent layer becomes the owner of the children and the WM
can control the lifecycle as it wishes. I also included a test for reparentChildren
as I realized I had forgotten that.

Test: New test in Transaction_test.cpp
Change-Id: I79c22b2ccccceb9bdcc37b70c491bdf33dcf83d2
/frameworks/native/services/surfaceflinger/Layer.h
0d48072f6047140119ff194c1194ce402fca2c0b 11-Jan-2017 Robert Carr <racarr@google.com> Add deferTransaction variant taking GraphicBufferProducer.

For SurfaceView using child layers, the client framework
will not have access to the Handle* for the parent surface,
but still needs a way to defer transactions to it's frames.

Test: Tested with corresponding SurfaceView modifications and existing tests.
Change-Id: I6f01c360e85a95ff0ab08db406741221152e5d5c
/frameworks/native/services/surfaceflinger/Layer.h
fb94f1db72bd769d4a63e2baf0b5a4ca5da7a86f 17-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Break a dependency of libui on libandroid"
f810b29ebc8564f94ff7fb14f2d13a0f4d111703 17-Feb-2017 Brian C. Anderson <brianderson@google.com> Merge changes from topic 'GPU_replace_GL'

* changes:
Fix unexpected FrameEvents on BufferQueue reconnect
Add FrameEvents::isValidTimestamp
Change GL references to GPU for getFrameTimestamps.
Clean up FrameTimestamp log messages.
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/Layer.h
5a423eaa86f4c990afcef8c55e3949d0872068b4 16-Feb-2017 Dan Stoza <stoza@google.com> Move FloatRect from libgfx to libui

Moves FloatRect from libgfx (which is being disintegrated) to libui

Test: Builds and sailfish boots
Change-Id: I68c1b7d86a363066fe4d6f0c038ca9d92d7ab9c7
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
9f02435fd44c0651c85e9bd4dc7307bc6b1a85fa 15-Feb-2017 Brian C. Anderson <brianderson@google.com> Merge "EGL: Add eglGetCompositorTimingANDROID."
0a61b0c813f5991bf462e36a2314dda062727a10 07-Dec-2016 Brian Anderson <brianderson@google.com> EGL: Add eglGetCompositorTimingANDROID.

Exposes the composite deadline, composite interval, and
the composite to present latency.

A history of composite and present fences are stored.
When the present fence's timestamp becomes known,
the composite to present latency is updated with
sampling jitter removed.

The values are updated in the producer when timestamps
are enabled and on queue and dequeue.

The deadline is snapped to the next expected deadline
based on the current systemTime().

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

Change-Id: I406814258613b984b56488236632494f2f61ff2e
/frameworks/native/services/surfaceflinger/Layer.h
87670ffe26079eb50b62f698eb0f7bfa8ee51deb 01-Feb-2017 Hendrik Wagenaar <hendrikw@google.com> Allow surfaceflinger to run vrflinger

* Allows surface flinger to switch in and out of vr mode

Bug: None
Test: Manually ran various vr test programs.
Change-Id: I15fbba0eb67cbcffeef41be31429550448a1db9c
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
1db73f66624e7d151710483dd58e03eed672f064 21-Dec-2016 Robert Carr <racarr@google.com> SurfaceFlinger: Add support for non-privileged clients.

Allow clients without privilege to create child layers through scoped
connections. We enable this in preparation for allowing SurfaceView
to bypass the WindowManager. We include support for reparenting of
all of a layer's children for the WindowManager to use in cases where
one surface is replacing another (while keeping its children around).

Test: Tested with corresponding SurfaceView modifications.
Change-Id: I9920e6730d719113522a68788e63fb59f70d3406
/frameworks/native/services/surfaceflinger/Layer.h
2f5f8a51f5994cf14837030d4b3b252a9d1b950b 20-Dec-2016 Daniel Nicoara <dnicoara@google.com> VR: Add ability to pass layer info through SurfaceFlinger

Updates SurfaceFlinger to connect to the VR HWC service and pass
additional layer information.

For now VR mode is enabled at build time.

Bug: 33297385
Test: Ran on device and verified the IVrComposerClient::setLayerInfo()
call is done successfully.

Change-Id: I9dea2451a3a2aa1919395d3785ae00446ba51f26
/frameworks/native/services/surfaceflinger/Layer.h
1f0a16a5d7cd00ba7fda82e7d315afa1fd1303b9 25-Oct-2016 Robert Carr <racarr@google.com> SurfaceFlinger and libgui: Support for child layers.

Add support for parenting Layers in a tree. Layers
follow scene-graph style rules, that is to say:
1. A child is cropped to the final bounds of the parent.
2. A child inherits the parent's transform (including position)
3. A child's Z ordering is relative to the parent and bounded between
the parents siblings.
4. A childs lifetime is bounded by it's parents lifetime.

Test: New tests in Transaction_test plus manual testing with later branches.
Change-Id: I96f8ad863665b9a70b6f845561344c297b7e6eff
/frameworks/native/services/surfaceflinger/Layer.h
ae0608381b2b4699218febd6d45ad9d307544d55 28-Nov-2016 Robert Carr <racarr@google.com> SurfaceFlinger and libgui: Switch Z-order to signed type.

In preparation for SurfaceFlinger child layers. In that model
children's Z order will be relative to their parent. We need
negative Z values to represent children stacking below their
parent (e.g. SurfaceView). Java side already uses signed types
strangely enough.

Test: Basically a refactoring. SurfaceFlinger still works.
Change-Id: Ifcece69f6f9d917cbf5238a59f8e5de1e8ba6a25
/frameworks/native/services/surfaceflinger/Layer.h
146abf38c2442b77dc78a0565ad010376c9d1b69 24-Jan-2017 Courtney Goeltzenleuchter <courtneygo@google.com> Merge "Make dataspace accessible to surface flinger"
f6386862dffb0fb9cb39343d959104a32e5e95b7 01-Nov-2016 Brian Anderson <brianderson@google.com> Add a DequeueReady FrameEvent

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

Change-Id: I98ffd4123fc50b5f560e432f4078408c913c8edf
/frameworks/native/services/surfaceflinger/Layer.h
32872923ea72b7edc4fbf962fb4481f4a50d6633 09-Jan-2017 Fabien Sanglard <sanglardf@google.com> Merge "Document crop and finalCrop"
bb09b436fa119ad8b97f1bf5c04cc5aa10b5f1f0 30-Nov-2016 Courtney Goeltzenleuchter <courtneygo@google.com> Make dataspace accessible to surface flinger

http://b/29940137

Keep track of dataspace in GLConsumer and make it
available to surfaceflinger's Layer class.

Test: TBD
Change-Id: I099dc6d8424909c5fc31bfe2d05a656695c4251b
/frameworks/native/services/surfaceflinger/Layer.h
71bded513d37a6c1260b4a62c69ecc0d24be95f7 19-Oct-2016 Dan Stoza <stoza@google.com> Create libgfx, starting with FloatRect

Creates libgfx, the future home of everything currently in libui and
libgui, which will be rigorously checked with -Weverything (with a few
common-sense exceptions) and clang-tidy and formatted using the included
.clang-format file.

Starts by moving FloatRect out of services/surfaceflinger since it will
be used by other libgfx primitives later.

Test: m
Change-Id: I5045ac089020e6ee380e81e8735117c500264b37
/frameworks/native/services/surfaceflinger/Layer.h
9698c2f193666ab506a6edf113c5a77d0d0acb3b 15-Dec-2016 Brian C. Anderson <brianderson@google.com> Merge "Use FenceTime to share fence times and reduce open fds."
4ed383cec76494a529abbd167109759d9e40cdd9 13-Dec-2016 Fabien Sanglard <sanglardf@google.com> Document crop and finalCrop

The difference between crop and finalCrop is not documented anywhere.
"finalCrop" is not a very good name either and it would also be a
good thing to rename it to windowSpaceClip and propagate this to
framework API.

Change-Id: I7542cdb7e2430b873b30e63f06a8d39de3fa2b6d
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
873228ef930efe2f37ec15a5dc8ae15240cd81d1 13-Dec-2016 Fabien Sanglard <sanglardf@google.com> Merge "Delete unused clip parameter in drawWithOpenGL"
1748719ea1b69cc7ad111d8c6149d692b9f056f8 07-Dec-2016 Fabien Sanglard <sanglardf@google.com> Delete unused clip parameter in clearWithOpenGL

Change-Id: Idc31d6cfe0c804fd6c5528432e1179f920e231b3
/frameworks/native/services/surfaceflinger/Layer.h
8578980f7dd775d7044780de85ac3103989ba7d7 07-Dec-2016 Fabien Sanglard <sanglardf@google.com> Delete unused clip parameter in drawWithOpenGL

Change-Id: Ia4662ccf9b5544c1a8c5252b4c8485fddd09e713
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
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/Layer.h
dbd0ea80021cbc61c578385f534f41a33338085b 22-Jul-2016 Brian Anderson <brianderson@google.com> Rename posted to requestedPresent for getFrameTimestamps

Test: Just a rename.

Change-Id: I63aa5b1b84715de2bebffb25f92bd826323a9acb
/frameworks/native/services/surfaceflinger/Layer.h
cd6fd5463d2e9b87504e29a39ac5f2395010805b 13-Oct-2016 Fabien Sanglard <sanglardf@google.com> Refactor surfacefinger latchBuffer: Create method

Shortens latchBuffer method, extracting transaction
credential verification to dedicated function.

Test: On device
Change-Id: Ia7c2f977a85d1c1afd87425588c07eb756b00f15
/frameworks/native/services/surfaceflinger/Layer.h
9d96de49673cb6c916bfb797aad4f4e024ea73ca 11-Oct-2016 Fabien Sanglard <sanglardf@google.com> Revert "Delete HWC1"

This reverts commit 90f923493fa053655a203c34ea491086aeb07602.

Change-Id: If9da49e3bc85f8ff21ac1bd22a6bab97e9aa3103
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
071b0a64c6dad8eaa1449827e44faae57dba851b 12-Sep-2016 Chih-Hung Hsieh <chh@google.com> Merge "Fix google-explicit-constructor warnings in surfaceflinger." am: 5e703a6ad0 am: 101b4cc9d7 am: 32db2f3c9f
am: 9a9816ad3f

Change-Id: I5766b8b9adb236795cc7c8449d97b6c300512623
9a9816ad3f3e2ee0d52a21e742d9bbdc3ddf25ff 12-Sep-2016 Chih-Hung Hsieh <chh@google.com> Merge "Fix google-explicit-constructor warnings in surfaceflinger." am: 5e703a6ad0 am: 101b4cc9d7
am: 32db2f3c9f

Change-Id: Ie75a9e21c634691243d4f5c972f2f2879c48a76e
58a64714126bf3d34566d56cb535e2ae78d1c5ef 08-Sep-2016 Dan Stoza <stoza@google.com> SF/HWC2: Add a layer minidump am: e22aec741f am: a9f976b50f
am: 11e9bd2b48

Change-Id: I14a22fe1dde3e93107834516ad826ddadcd6781a
a9f976b50f03890e7b1cb6c182f7608360b2bdbc 08-Sep-2016 Dan Stoza <stoza@google.com> SF/HWC2: Add a layer minidump
am: e22aec741f

Change-Id: Ib97254ebbf2e914c965b529e7d1e59a01db48214
342b760763300593cd20b01dac8cef61e7b25b86 01-Sep-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings in surfaceflinger.

* Add explicit keyword to conversion constructors,
or use NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1

Change-Id: I94f511c3be31dc22022db6466ee9ed0c6be2bc8e
/frameworks/native/services/surfaceflinger/Layer.h
22851c3ba2cf5ccb0c3a0aa6c5b94ae123a5616a 09-Aug-2016 Dan Stoza <stoza@google.com> SF: Fix a couple of Layer ref count issues

This is an attempt at fixing two reference counting issues for Layers.

The first issue is that since we were holding an sp<IBinder> (really a
reference to a LayerCleaner) inside the layer state for deferred
transactions, there was a possibility that it could end up being the
last strong reference to the LayerCleaner such that when it was
destroyed while applying a non-deferred transaction, it would attempt
to grab the SurfaceFlinger main lock to destroy its Layer. Since this
occurred in the main SurfaceFlinger loop, which was already holding
the lock to process transactions, this would cause a deadlock.

To fix this, the sp<IBinder> inside the layer state was changed to a
wp<IBinder>, only being promoted when it actually needs to be accessed
(i.e., when the deferred transaction is created).

The second issue is that we were promoting and holding a strong
reference to a Layer before calling into SurfaceFlinger to destroy it
on the onLayerDestroyed path (triggered when a LayerCleaner is
destroyed). After returning from the attempt to grab the SurfaceFlinger
main lock, it was possible that this strong reference was the last one
keeping the Layer alive, and destroying it at this point could cause
the HWC2 version of the layer to be destroyed at effectively any point,
even between validate/present.

To fix this, the promotion of the weak Layer reference was moved inside
the critical section where the SurfaceFlinger main lock is held.

Bug: 30503916
Bug: 30281222
Change-Id: I1c6a271f9a7b5d6eea9a9db61d971f262d0cfe84
/frameworks/native/services/surfaceflinger/Layer.h
ae56a32be71278b77e82fe56bcfbdc9589f7e1dc 10-Aug-2016 Dan Stoza <stoza@google.com> Revert "SF: Fix a couple of Layer ref count issues"

This reverts commit 92cd24e5f648175944deef5899258981807a9ca4.

Change-Id: I551c292d8151d39bd34f2667eda384273f7cfd87
/frameworks/native/services/surfaceflinger/Layer.h
dd03e70fd620a7a305c1a271583e0da07d6c1ac4 10-Aug-2016 Dan Stoza <stoza@google.com> SF: Fix a couple of Layer ref count issues am: 92cd24e5f6 am: 56e16bb1ca
am: 263910d00a

Change-Id: I76564ea2195d2de9aaf00ebd4c50db1d36dafeff
92cd24e5f648175944deef5899258981807a9ca4 09-Aug-2016 Dan Stoza <stoza@google.com> SF: Fix a couple of Layer ref count issues

This is an attempt at fixing two reference counting issues for Layers.

The first issue is that since we were holding an sp<IBinder> (really a
reference to a LayerCleaner) inside the layer state for deferred
transactions, there was a possibility that it could end up being the
last strong reference to the LayerCleaner such that when it was
destroyed while applying a non-deferred transaction, it would attempt
to grab the SurfaceFlinger main lock to destroy its Layer. Since this
occurred in the main SurfaceFlinger loop, which was already holding
the lock to process transactions, this would cause a deadlock.

To fix this, the sp<IBinder> inside the layer state was changed to a
wp<IBinder>, only being promoted when it actually needs to be accessed
(i.e., when the deferred transaction is created).

The second issue is that we were promoting and holding a strong
reference to a Layer before calling into SurfaceFlinger to destroy it
on the onLayerDestroyed path (triggered when a LayerCleaner is
destroyed). After returning from the attempt to grab the SurfaceFlinger
main lock, it was possible that this strong reference was the last one
keeping the Layer alive, and destroying it at this point could cause
the HWC2 version of the layer to be destroyed at effectively any point,
even between validate/present.

To fix this, the promotion of the weak Layer reference was moved inside
the critical section where the SurfaceFlinger main lock is held.

Bug: 30503916
Bug: 30281222
Change-Id: I1c6a271f9a7b5d6eea9a9db61d971f262d0cfe84
/frameworks/native/services/surfaceflinger/Layer.h
e22aec741f1530cde86c38989bcc2f87626b93b0 01-Aug-2016 Dan Stoza <stoza@google.com> SF/HWC2: Add a layer minidump

Adds a brief dump of visible HWC layers to replace functionality that
was lost when moving from HWC1 to HWC2.

Bug: 30242002
Change-Id: I7331517c7d1eb515b33d5db85cdaf23d8b9ae9d9
/frameworks/native/services/surfaceflinger/Layer.h
468051e20be19130572231266db306396a56402b 14-Jun-2016 Irvel <irvel@google.com> Integrate SurfaceInterceptor into SurfaceFlinger

Change-Id: If18d967f2b69ed219f17a9afedb61884ad5f1dc8
/frameworks/native/services/surfaceflinger/Layer.h
c5da271eec001da9e11a2786f2618a45257439c3 21-Jul-2016 Dan Stoza <stoza@google.com> HWC2: Add properties to revert latching changes

Adds two properties:

debug.sf.latch_unsignaled - This causes SurfaceFlinger to latch
buffers even if their fences haven't signaled
debug.sf.disable_backpressure - This causes SurfaceFlinger to skip
propagating backpressure back to apps by not running when it
detects that a prior composition missed hardware vsync

Bug: 30216498
Change-Id: Idd70f472ec567a4bc03352f30f201f434cf5d660
/frameworks/native/services/surfaceflinger/Layer.h
1ce6581ac788eaad58fd3329c2154af7dd74aa3d 16-Jun-2016 Dan Stoza <stoza@google.com> SF: Only latch buffers after fence signals

Changes SurfaceFlinger to only latch a buffer after its corresponding
acquire fence has signaled. This will enable us to move
SurfaceFlinger closer to vsync since there is no risk of fence waits
blocking composition.

Bug: 29413700
Change-Id: I26f4fd600c1611b8d736ec654d1f0f02cf69ae5f
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
99e27f0bc236e38d88ff4f9912ede514a729b8eb 17-Jun-2016 Robert Carr <racarr@google.com> Change setPositionAppliesWithResize to apply to all geometry.

To support seamless rotation, change setPositionAppliesWithResize
to also include the crop. As the transformation matrix is already
frozen during resize, this enables the window manager to set the
total geometry state before and after resize in a race free fashion.

Bug: 28823590
Change-Id: I3f8f0e162b7ef4e9403c1220c7e4191b3ef30526
/frameworks/native/services/surfaceflinger/Layer.h
9e8143ec78a0bf3779f12000b67f21b8fba6e2a7 09-Jun-2016 Pablo Ceballos <pceballos@google.com> Merge "Plumbing for getting FenceTracker timestamps" into nyc-mr1-dev
ce796e78a57018f186b062199c75d94545318aca 05-Feb-2016 Pablo Ceballos <pceballos@google.com> Plumbing for getting FenceTracker timestamps

Change-Id: I1ebee9e42e28658bd3a2b161fdaabb7da756d8f3
/frameworks/native/services/surfaceflinger/Layer.h
3fee6ca1d93c1d4b822d2dcd36c61f9722dd88b9 07-Jun-2016 Robert Carr <racarr@google.com> Merge "SurfaceFlinger: Add mode to apply position with resize." into nyc-dev
am: c3da482bb8

* commit 'c3da482bb8081ee2c19b5965585267b8e21cfc7e':
SurfaceFlinger: Add mode to apply position with resize.

Change-Id: Icedb7a6e37da9338b1194edaa32a67257640969f
82364e3cea0bf88fa8147766433329b3dd5148b8 15-May-2016 Robert Carr <racarr@google.com> SurfaceFlinger: Add mode to apply position with resize.

For some cases, like scaled windows with shadows,
we need to be able to apply the position concurrent with
window resize. This is because the scaling of the shadows causes
the top left coordinate of the non shadow surface content
to change before and after the resize.

Bug: 28899837
Change-Id: I522eacfbbcd79707dc1e5ab71901a263b3004ba9
/frameworks/native/services/surfaceflinger/Layer.h
e77c7669bee30b7c0099172cf0c38cef92412040 13-May-2016 Dan Stoza <stoza@google.com> BufferQueue/SF: Add OccupancyTracker

Adds an OccupancyTracker to BufferQueue. This module keeps track of
how many buffers are in the queue over time, which, in combination
with various aggregation of these statistics, allows SurfaceFlinger
to report what fraction of the time a given layer was double- or
triple-buffered.

Change-Id: Ida6e967dc5483c00a633e9fe03998e420dd88502
/frameworks/native/services/surfaceflinger/Layer.h
c3574f7b0141c69fdca25ccafb80ff334462f9a3 24-Mar-2016 Robert Carr <racarr@google.com> Add setOverrideScalingMode to SurfaceControl

Provide an interface for the window manager to override
the client specified scaling mode. This makes it possible
for the window manager to force windows to be scaleable
for animations, etc, even when a resize is pending.

Bug: 27891386
Change-Id: Ic4aae9917bd6869ee0dbb425979b4e21c68342a3
/frameworks/native/services/surfaceflinger/Layer.h
05289c2b78d21308a95ea6ef8f1d8f24359147cd 15-Apr-2016 Pablo Ceballos <pceballos@google.com> SF: Don't pop pending state into mCurrentState

Let mCurrentState always represent the most up to date state, even if
there are transactions we don't want to commit yet. Past snapshots of
the state are kept in mPendingState. In doTransaction(), grab the
correct pending state from mPendingState, but save it to a local copy
that gets committed rather than overriding mCurrentState.

Bug 27205755

Change-Id: Ib0ea809da1954409787c52b8f41d7963a57a6a4c
/frameworks/native/services/surfaceflinger/Layer.h
b5d3d2657bad1f012377dfacd354d3100a65768a 25-Mar-2016 Robert Carr <racarr@google.com> Move crop outside of geometry state.

Prior to this CL, if Layer crop is changed while a
surface resize is pending, the crop will not be
applied until a buffer latches at the new size. This
CL makes the crop apply immediately. We can see this
is the desired behavior by looking at the two cases
where a resize is pending.

1. A resize is pending to make the surface smaller.
In this case we need to be able to immediately update the crop so that
we can shrink the visible region of the surface at an interactive rate
with input. The window manager currently uses big surfaces and scaling
modes to accomplish this.
2. A resize is pending to make the surface larger.
In this case it doesn't matter. If we expand the crop immediately to
the new surface size, then we have simply uncropped an area which is
by definition transparent pixels (as we haven't latched a buffer
at the new size yet).

This change has conceptual soundness as well. We can see that the
scaling mode will not affect properties that affect scaling (transform,
width/height) but not properties which do not (crop).

Bug: 27729195
Bug: 27687126
Change-Id: Ieafdc14aeecb23085793e3056a746d6f344781df
/frameworks/native/services/surfaceflinger/Layer.h
830f5004da53a83e23b4102ba9b72e4cb366cb34 25-Mar-2016 Pablo Ceballos <pceballos@google.com> Merge "SF: Add FenceTracker" into nyc-dev
acbe67888f0bd65d5400400f0115bae6bd6199dc 04-Mar-2016 Pablo Ceballos <pceballos@google.com> Add final crop implementation

Bug 26559810

Change-Id: Idaccd13cd625c92d18665ddecebdbb266ea365f3
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
3dcabfab7ef80df5884b269fec17350a26da6f51 02-Mar-2016 Robert Carr <racarr@google.com> Latch transform with geometry state.

WindowManager would like this feature for animating
windows between sizes. For example, if we are animating
from a smaller to larger window, we need to complete the resize
at the beginning of the animation to avoid up-scaling. However
to avoid artifacts we need the window to appear at its old size
following this resize, so we use the transform to scale down. However
as the transform is latched immediately, we result in a frame where
the window is too small, until the resize is complete. This is
a change in behavior but it's hard to understand how it could
cause errors. Previously if someone wished to set the transform
and resize a window in the same transaction, then the results
would be undefined (depending on the state of the window buffer),
and there would be no avenue for synchronization.

Bug: 26454664
Change-Id: I4e8475967e0a19aa5879af965a5716eb173f9700
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
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/Layer.h
cac353808ec1048333d7fd2f3d596fb4db567aa3 27-Jan-2016 Dan Stoza <stoza@google.com> SF: Modify transaction/buffer sync logic

Reorganizes the transaction/buffer synchronization logic to only
consider the head of the incoming BufferQueue instead of all buffers,
and fixes some potential race conditions.

Bug: 25951593
Change-Id: Ib2b08e7be571eb8bbd8c364fb85acf0e046b439c
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
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/Layer.h
231160866738f6ed2175701f300fed1a8e8e02b0 18-Jun-2015 Dan Stoza <stoza@google.com> libgui/SF: Propagate SECURE Layer flag changes

This allows changes to the SECURE flag to propagate down to
Layers in SurfaceFlinger so that WindowManager can change it on the fly
in response to device policy updates.

Bug: 20934462
Change-Id: I558f6d22c6273be373f1f480365e42536af18a33
/frameworks/native/services/surfaceflinger/Layer.h
65476f3332641066a99e22338bf5cf49ce4af642 14-May-2015 Dan Stoza <stoza@google.com> SurfaceFlinger: Handle EGL errors more cleanly

Adds some more safety checking for cases where we get an error while
trying to create the EGLImage. The checking puts the Layer into a
failed state after detecting an error, since the shadow queue may no
longer be synchronized.

Bug: 20957332
Change-Id: I68b4c40eab3e58731b875ed5752f2c7d17f14bcb
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
dc13c5b85b099050c73297a19f1ef89308f7620b 12-May-2015 Dan Stoza <stoza@google.com> libgui: Hook up onFrameReplaced

This completes the plumbing from ConsumerListener::onFrameReplaced into
SurfaceFlinger (and other consumers that may care).

Change-Id: I376e78ace95d6748e8662e6b4d47c0dfa697a300
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
686c5be4722dce02ae8e5580d6677f1eeea22464 18-Nov-2014 Dan Stoza <stoza@google.com> am 6b9454d1: SurfaceFlinger: Do less work when using PTS

* commit '6b9454d1fee0347711af1746642aa7820b1ea04d':
SurfaceFlinger: Do less work when using PTS
6b9454d1fee0347711af1746642aa7820b1ea04d 08-Nov-2014 Dan Stoza <stoza@google.com> SurfaceFlinger: Do less work when using PTS

Currently, SurfaceFlinger is very dumb about how it handles buffer
updates at less than 60fps. If there is a new frame pending, but its
timestamp says not to present it until later SurfaceFlinger will wake
up every vsync until it is time to present it. Even worse, if
SurfaceFlinger has woken up but nothing has changed, it still goes
through the entire composition process.

This change (mostly) fixes that inefficiency. SurfaceFlinger will
still wake up every refresh period while there is a new frame
pending, but if there is no work to do, it will almost immediately go
back to sleep.

Bug: 18111837
Change-Id: I7825bacd37f40bf26edcc6a5e0f051dce45291fb
/frameworks/native/services/surfaceflinger/Layer.h
4037c458a7594cb3cd81a14e7e974abc28180187 13-Nov-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 07dffa18 to lmp-mr1-dev-plus-aosp

Change-Id: I42d8bc291f4f48f3098754b076889159c4b20e41
89fd4f7fa6bd17ce5400979c3b9e5ba0bf7e919e 13-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/native: Wall Werror in surfaceflinger

Turn on -Wall -Werror in services/surfaceflinger. Fix warnings.

Change-Id: Ifef830300d9d4bc657d8f1257c02bfe8c2b4d9c5
/frameworks/native/services/surfaceflinger/Layer.h
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
/frameworks/native/services/surfaceflinger/Layer.h
6c925ede620f4080227bb1fe8a41e4b4502348f8 27-Sep-2014 Michael Lentine <mlentine@google.com> Fixed discrepancy between crop and frame transparencies.

Bug: 17662777
Change-Id: I0d65d9b912a37a60e4c1d2e2e198f7709460917c
/frameworks/native/services/surfaceflinger/Layer.h
0ea1cb91954ac1ad0973a6b9482dcb2fee2449f5 23-Sep-2014 chenhg <chenhg@marvell.com> surfaceflinger: Check sideband stream changed to trigger sideband Layer update.

BUG: 17382907
Change-Id: I65fd037bd25238ae68a3976468ae7fd7ce49c562
/frameworks/native/services/surfaceflinger/Layer.h
a02e9484be6894f8a4db7049d432f534a4e0a676 31-Jul-2014 Eric Penner <epenner@google.com> Merge "SurfaceFlinger: Prevent deadlock by updating an atomic layer set." into lmp-dev
51c59cd1e73be3787eb75bebd87fc41739c65adb 29-Jul-2014 Eric Penner <epenner@google.com> SurfaceFlinger: Prevent deadlock by updating an atomic layer set.

Bug: 12934849

Change-Id: I9dede7316f1e967de4140bd731ac810115ea302f
/frameworks/native/services/surfaceflinger/Layer.h
03414a1cfe6c1222fd7723949bd622f9cba145aa 01-Jul-2014 Riley Andrews <riandrews@google.com> Turn on support for async cursor update in surfaceflinger.

If available, surfaceflinger will use the hwc setCursorPositionAsync()
api to change the position of supported cursor layers outside of
the usual prepare/set loop.

Change-Id: Ib3fc5c0c390b3489ddbba202379840a1d2748917
/frameworks/native/services/surfaceflinger/Layer.h
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/services/surfaceflinger/Layer.h
4df87bd1f6f68126e5e9081fc1365ae500e375db 22-Apr-2014 Andy McFadden <fadden@android.com> Update HWC dump format

Shortens a few fields. Displays the format as a string.

Change-Id: Ib471f05603763e250bad165db610f8e173e8423a
/frameworks/native/services/surfaceflinger/Layer.h
d85084b2b65828442eafaff9b811e9b6c9ca9fad 20-Mar-2014 Svetoslav <svetoslavganov@google.com> Adding render stats APIs to UiAutomation (framework native).

bug:12927198

Change-Id: Ibb1c07f7d89e11281e5c1f27f412a29ac6f9c4ab
/frameworks/native/services/surfaceflinger/Layer.h
b9b088375d33a87b201cdbe18be71802e2607717 13-Mar-2014 Dan Stoza <stoza@google.com> Remove deprecated BufferQueue constructor

Bug: 13415624
Change-Id: I9fe15e45daa7351f1db34ee75bfee6f19cb347d3
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
c701401f8cec2e5309f8b57e2b97baced5093274 15-Feb-2014 Dan Stoza <stoza@google.com> Allow disabling layer rotation during screenshots

Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.

Bug: 11805195
Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
/frameworks/native/services/surfaceflinger/Layer.h
4125a4ffaf374ca9c0773f256998557d3325343e 30-Jan-2014 Andy McFadden <fadden@android.com> Allow "opaque" flag to be updated

Moves the "opaque layer" from Layer to Layer::State. This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
/frameworks/native/services/surfaceflinger/Layer.h
49457ac092071a8f964f7f69156093657ccdc3d0 15-Aug-2013 Mathias Agopian <mathias@google.com> Encapsulate textures into their own Texture class

the main reason for doing this is so that we can have
access to informations about a texture (like its dimension)
close to where we generate and use shaders in ES 2.0.
Previously, there wasn't any way to get to a texture's size
from a RenderEngine implementation.

Bug: 8679321

Change-Id: I388b338a70d07e3e8177dde248710ea1e4c82dff
/frameworks/native/services/surfaceflinger/Layer.h
5cdc8994a0ecd751a6350b16a1bef8b6b0d09b11 14-Aug-2013 Mathias Agopian <mathias@google.com> don't reallocate the mesh each time we use it

the Mesh object can be part of each Layer (at least currently).
also reworked the Mesh code a bit to make it easier to access
the vertex data.

Change-Id: I0490851ba898f0aa2e55b62958dcd8bdb535e98b
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
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/Layer.h
6547ff4327aa320fbc9635668d3fc66db7dd78f6 17-Jul-2013 Jamie Gennis <jgennis@google.com> surfaceflinger: add frame duration logging

Change-Id: Ib414a45e7e191f23a2726cbbbeb606e9ce68a3b5
/frameworks/native/services/surfaceflinger/Layer.h
6b44267a3beb457e220cad0666c039d3a765cdb2 10-Jul-2013 Mathias Agopian <mathias@google.com> fix SF buffer cropping

When a buffer had a crop (meaning its content is scaled to the window size)
and a window crop was defined, the resulting crop couldn't be expressed
properly because h/w composer's API was limited to integers, since
this is fixed in h/w composer 1.3, we take adventage of this to
make sure we get the correct crop.

this bug could result in the buffer being scaled by an incorrect ratio and
be slightly offset; moreover, it would produce different results from the
GL code path, which is always correct.

Change-Id: I8e20e00b6e26177d14f4ab4d2cd581e26c818892
/frameworks/native/services/surfaceflinger/Layer.h
875d8e1323536e16dcfc90c9674d7ad32116a69a 08-Jun-2013 Mathias Agopian <mathias@google.com> Refactor SF. Move all GL operations in their own class.

this is the first step to add support for GLES 2.x, this
change breaks the dependency of SF on GLES 1.x by moving
all operation into their own class.

Bug: 8679321

Change-Id: I0d2741eca2cefe67dfd9cf837cac10c4d126928b
/frameworks/native/services/surfaceflinger/Layer.h
1eae0ee49402c39f1b08cc8fec129023f86494b7 06-Jun-2013 Mathias Agopian <mathias@google.com> clean-up SurfaceFlinger a bit

- most methods on Layer didn't need to be virtual
- more consistency in naming drawing/current state

Change-Id: Ieb7b4951b40fc673b807994ed21ae4aea7281068
/frameworks/native/services/surfaceflinger/Layer.h
3e25fd8609b100a75721be82d1d499f0ae9083cb 22-Apr-2013 Mathias Agopian <mathias@google.com> Add a --color option to dumpsys SurfaceFlinger

colorize a bit the output of dumpsys SurfaceFlinger to
make it easier to read. Right now it will bold the
title of each section and use green for the name of
each layer.

Change-Id: I0d9f18d115401cb45109d244ef3a278481f68cc6
/frameworks/native/services/surfaceflinger/Layer.h
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
/frameworks/native/services/surfaceflinger/Layer.h
2ca79399b933935eb1b6c0ec1f746f8c4475369c 03-Apr-2013 Mathias Agopian <mathias@google.com> latch transparent region hint only when we get a new frame

since the transparent region hint really depends on the
content of the window containing the SurfaceView
(it's calculated by the view hierarchy based on
overlapping views), it makes sense to latch it only when
the content of the window (the app) changes.

This should help fixing drawing artifacts when changing the
layout of a window containing a SurfaceView.

Bug: 8511430
Change-Id: Ic3aa668495293cb4d82a2cd7dcf3b6a337287678
/frameworks/native/services/surfaceflinger/Layer.h
4d9b822e2c18142e55fe2611aa6cd7dc7d4a62c6 13-Mar-2013 Mathias Agopian <mathias@google.com> get rid of ISurface

ISurface was only used to get the IGraphicBufferProducer from
a Layer. It's now replaced by a BBinder subclass / IBinder and
is only used as a handle to the surface, to both refer to it
and manage its life-time.

Also cleaned-up a bit the ISurfaceComposer interface and
"create layer" code path.

Change-Id: I68d0e02d57b862cffb31d5168c3bc10cea0906eb
/frameworks/native/services/surfaceflinger/Layer.h
13127d8921356dff794250e04208c3ed60b3a3df 06-Mar-2013 Mathias Agopian <mathias@google.com> Get rid of LayerBase.

The functionality of LayerBase and Layer is folded
into Layer. There wasn't a need for this abstraction
anymore.

Change-Id: I66511c08cc3d89009ba4deabf47e26cd4cfeaefb
/frameworks/native/services/surfaceflinger/Layer.h
2f73af9212487c81d31d07227fa8a2f4abc77638 06-Mar-2013 Mathias Agopian <mathias@google.com> Make LayerDim a regular Layer instead of a LayerBase

this is in preparation to get rid of LayerBase entirely

Change-Id: Ia051949fc5205fd87371331145356ee11598a597
/frameworks/native/services/surfaceflinger/Layer.h
b79f61d41ef053bee1087ec612896c59f95f9686 06-Mar-2013 Mathias Agopian <mathias@google.com> fold LayerBaseClient into LayerBase

Change-Id: Ic745136522df59c42f0885fd969e75ea55d09f01
/frameworks/native/services/surfaceflinger/Layer.h
306f18c5fb15ac05db09ece7241af02b9713a23d 05-Mar-2013 Mathias Agopian <mathias@google.com> Merge "rework screenshot API and implementation" into jb-mr2-dev
2a9fc493dfdba67108e4335bb1fe931bc1e2a025 01-Mar-2013 Mathias Agopian <mathias@google.com> rework screenshot API and implementation

- SurfaceFlinger now supports to take a screenshot
directly into an IGraphicBufferProducer

- reimplement the IMemoryHeap screenshot on top
of the above

- reimplement LayerScreenshot such that its
BufferQueue is directly used as the destination
of the screenshot. LayerScreenshot is now a thin
wrapper around Layer

Bug: 6940974

Change-Id: I69a2096b44b91acbb99eba16f83a9c78d94e0d10
/frameworks/native/services/surfaceflinger/Layer.h
a8bca8d84b559e7dcca010f7d6514333004020c7 28-Feb-2013 Mathias Agopian <mathias@google.com> refactor the crop region for hwc is calculated/set

- the crop region is now always calculated and set
in LayerBase::setGeometry which uses new virtuals to
access the "content" crop and transform (which are
provided by the Layer subclass)

Change-Id: Ib7769bdec0917dd248f926600c14ddf9ea84897a
/frameworks/native/services/surfaceflinger/Layer.h
4b0eba949cc026ffb2c75313042d8a7bcb3fcf86 05-Feb-2013 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add win anim frame time tracking

This change makes the 'dumpsys SurfaceFlinger --latency' command with no extra
args dump the frame timestamp data for the most recent frames that
SurfaceFlinger generated that included window animation transaction changes.

Change-Id: I8bded1ea08a4cddefef0aa955401052bb9107c90
/frameworks/native/services/surfaceflinger/Layer.h
882e3a39ed770b335a203e233b57127fde1c839e 09-Jan-2013 Andy McFadden <fadden@android.com> Add some comments.

Also, minor tweak to SurfaceTextureLayer.

Change-Id: If616d5ee4e8226dd0e16c5dbb0e0f80db553110e
/frameworks/native/services/surfaceflinger/Layer.h
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/Layer.h
9913b9941ef90a98d826f3338c0a1ec3e4497b8c 28-Nov-2012 Mathias Agopian <mathias@google.com> am a7da0dda: am 98cbec81: am efd614b8: Merge "make transform hint multi-display aware" into jb-mr1.1-dev

* commit 'a7da0dda39cf1e807eea1304b48d4583e7329b72':
make transform hint multi-display aware
8430095879d2fa6878e68f8f12da4e704815ac09 22-Nov-2012 Mathias Agopian <mathias@google.com> make transform hint multi-display aware

if a layer is not mirrored, we now use its display
as the source for the transfrom hint calculation
instead of always using the default (main) display.

this change does two thing:
1) we make updateTransformHint take a DisplayDevice
as a parameter instead of hard-coding the
main display.

2) each time we do a transaction that could change
the hint, we go through all layers and
figure out which display should be used for their
transform hint.

Bug: 7599344
Change-Id: I9b04a95e6c372dd770bacf81d8ef6f8e31b87b83
/frameworks/native/services/surfaceflinger/Layer.h
82dbc7429f5f9f2b303b31dc5b9f2bfd1bbe6add 09-Nov-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: refactor frame time tracking

This change moves the frame time history tracking code out of Layer and into a
new class called FrameTracker. It also changes the tracking to use signal
timestamps from fences when available for more accurate results.

Change-Id: I323c5f075c58bf86ce363b52af885ad0f6365f2b
/frameworks/native/services/surfaceflinger/Layer.h
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
/frameworks/native/services/surfaceflinger/Layer.h
da27af9832a0170f1fc40ef3f21371c4d30d21b3 14-Sep-2012 Mathias Agopian <mathias@google.com> add support hwc 1.1

Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
/frameworks/native/services/surfaceflinger/Layer.h
6905205c8d130b6ea3a813c1b9283492ed183367 15-Sep-2012 Andy McFadden <fadden@android.com> Fix transform hints

The hints were being set a little too late, so the pre-rotation stuff
wasn't quite working.

Bug 7054997

Change-Id: Id8d5c626db7a76f768ba762a145b315878ee08e6
/frameworks/native/services/surfaceflinger/Layer.h
3ee454a7bef8bd3d1c9cdd9d17108eb80ebadf2a 28-Aug-2012 Mathias Agopian <mathias@google.com> Eradicate DisplayID.

DisplayDevices are now keyed of the wp<IBinder> the client uses.
DisplayID has now become DisplayType which is just used to identify
physical displays (as opposed to virtual displays such as wifi displays).

Change-Id: I0c5968f2c902dcd699a7e0afacf833ff070c12ea
/frameworks/native/services/surfaceflinger/Layer.h
4297734c1156fd8ede7e9c61b1e439f9e1c18cd9 05-Aug-2012 Mathias Agopian <mathias@google.com> turn DisplayDevice into a reference-counted object

it's safer this way because this object owns an
EGLSurface which cannot be easily reference-counted.

it also gives us the ability to sub-class it, which
we might want to do soon.

Change-Id: I07358bb052dc5a13b4f2196b2c2b6e6e94c4bb4f
/frameworks/native/services/surfaceflinger/Layer.h
d3ee231eddce0b69ec5e35188dbd0f4a2c3b9ac3 02-Aug-2012 Mathias Agopian <mathias@google.com> cleanups in preparation of bigger changes

- fix typo drawForSreenshot misspelled
- get rid of DisplayDeviceBase
- removed unused or unneeded code
- always pass a DisplayDevice to Layer methods that are called
on a per-display basis (to make it clear that this could be
called more than once per composition).

Change-Id: Id948b7e09fe5c06db0e42d40d6ed75dd095c7f44
/frameworks/native/services/surfaceflinger/Layer.h
0f2f5ff75b7b48ceb64270655ee6b62d09bf4d00 01-Aug-2012 Mathias Agopian <mathias@google.com> rename DisplayHardware to DisplayDevice

Change-Id: I3f7250cd914e0da4f9ec2c9403587bbe12f3cc62
/frameworks/native/services/surfaceflinger/Layer.h
4fec873a98f7b4380720cd1ad006f74c8cdc73da 29-Jun-2012 Mathias Agopian <mathias@google.com> one more step towards multiple display support

- remove dependency on cached state in validateVisibility
- get rid of mVertices and mTransformedBounds
- get rid of validateVisibility
- get rid of unlockPageFlip
- handleTransaction now returns a dirty region
- computevisibileregion now uses window-manager space
/frameworks/native/services/surfaceflinger/Layer.h
c5c5a14c06de249d8e0445fd24699e1d9aa04549 03-Jul-2012 Jesse Hall <jessehall@google.com> Only set acquire fences on overlay layers

Change-Id: I08e8173f83580de5a4e43a0ba5ea03e5ec6e8782
/frameworks/native/services/surfaceflinger/Layer.h
dc5b485f74edf2d2f31c62054eb6c180421a3ade 30-Jun-2012 Jesse Hall <jessehall@google.com> Pass fence to HWC on first use of buffer

Also do a CPU-wait on the fence before using it for GL composition.

Change-Id: I0f645a42a44803276cae11b904e5a26d65871562
/frameworks/native/services/surfaceflinger/Layer.h
1b03149f3533db04e72e088d3fdd09d0087ca594 21-Jun-2012 Mathias Agopian <mathias@google.com> get rid of GraphicPlane

its functionality is now folded into DisplayHardware
there will be more changes in that area.
/frameworks/native/services/surfaceflinger/Layer.h
ef19414bd8b77a26f5751f3845be79025a8263fe 14-Jun-2012 Jesse Hall <jessehall@google.com> Transfer HWC release fences to BufferQueue

After a HWC set, each SurfaceFlinger Layer retrieves the release fence
HWC returned and gives it to the layer's SurfaceTexture. The
SurfaceTexture accumulates the fences into a merged fence until the
next updateTexImage, then passes the merged fence to the BufferQueue
in releaseBuffer.

In a follow-on change, BufferQueue will return the fence along with
the buffer slot in dequeueBuffer. For now, dequeueBuffer waits for the
fence to signal before returning.

The releaseFence default value for BufferQueue::releaseBuffer() is
temporary to avoid transient build breaks with a multi-project
checkin. It'll disappear in the next change.

Change-Id: Iaa9a0d5775235585d9cbf453d3a64623d08013d9
/frameworks/native/services/surfaceflinger/Layer.h
3e8b853d67c737abdb363f9c978e7d83eac4d888 14-May-2012 Mathias Agopian <mathias@google.com> refactor HWComposer to break dependency with the HAL headers

HWComposer must abstract the HWC HAL entirely, so that the
HAL can continue to evolve (and break binary compatibility)
without breaking SurfaceFlinger. The HWC data structure had
leaked outside of HWComposer, this is now fixed.

We now have an abstract interface that provide all the
needed functionality, HWCompose provides concrete
implementations of it based on the the HWC version.

Change-Id: I40c4676dc986b682ede5520a1c60efe64037b0bb
/frameworks/native/services/surfaceflinger/Layer.h
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/services/surfaceflinger/Layer.h
cbb1a95819ec302ae15e4a1162a8b1349ae5c33e 09-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: tell SurfaceTex about filtering

This change makes SurfaceFlinger set the filtering-enable on each layer's
SurfaceTexture before querying the texture matrix to use for GLES composition.

Change-Id: I40c3defd73ebf96e3cabb3bfdb1fc97f2036753a
/frameworks/native/services/surfaceflinger/Layer.h
b267579ba8dfe3f47d2a481c5a3c2254e3d565a1 23-Feb-2012 Daniel Lam <dalam@google.com> SurfaceTexture: Fully refactored from BufferQueue

SurfaceTexture and BufferQueue are separate objects.

Change-Id: I230bc0ae6f78d0f9b2b5df902f40ab443ed5a055
/frameworks/native/services/surfaceflinger/Layer.h
90ac799241f077a7b7e6c1875fd933864c8dd2a7 26-Feb-2012 Mathias Agopian <mathias@google.com> fix libgui header location

Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
/frameworks/native/services/surfaceflinger/Layer.h
4d143eed994778d37eb09bb5d452c26f12bca6e1 24-Feb-2012 Mathias Agopian <mathias@google.com> fix an issue in SF where we could miss some updates

Change-Id: I7d350bc05d1596655baddff3deaebaba58c9bcc0
/frameworks/native/services/surfaceflinger/Layer.h
99ce5cdeb383216dee95af4d90e47406b0948ea1 01-Feb-2012 Mathias Agopian <mathias@google.com> separate transactions from updates

with this changes, SF transactions are handled as soon as possible
but do not trigger updates. the update is delayed until the next
vsync.

this allows us to work much better without requiring triple-buffering.

Change-Id: I1fa10794d0cf742129f0877698b7b1e1f2ec7401
/frameworks/native/services/surfaceflinger/Layer.h
25e66fc324bbc004fa8902b2d4699e41bb601104 29-Jan-2012 Mathias Agopian <mathias@google.com> added a few more commands to SF's dumpsys

--latency-clear [name]
clears the latency data for the specified layer or for
all layers if none is specified

--list
prints the list of all layers regardless of their visibility

Change-Id: I7c07ae020f838c173b98ee50f3fb3e93da78acbb
/frameworks/native/services/surfaceflinger/Layer.h
82d7ab6c7e0cf971e515134ccf072682dd1a2cdb 20-Jan-2012 Mathias Agopian <mathias@google.com> improve SurfaceFlinger dumpsys

It is now possible to say:

dumpsys SurfaceFlinger --latency

to print latency information about all windows

dumpsys SurfaceFlinger --latency window-name

to print the latency stats of the specified window

for instance: dumpsys SurfaceFlinger --latency SurfaceView

The data consists of one line containing global stats, followed by
128 lines of tab separated timestamps in nanosecond.

The first line currently contains the refresh period in nanosecond.
Each 128 following line contains 3 timestamps, of respectively
the app draw time, the vsync timestamp just prior the call to set and
the timestamp of the call to set.

Change-Id: Ib6b6da1d7e2e6ba49c282bdbc0b56a7dc203343a
/frameworks/native/services/surfaceflinger/Layer.h
e8696a40e09b24b634214684d18526187b316a2f 16-Jan-2012 Jamie Gennis <jgennis@google.com> hack up frame latency measurement

Change-Id: I6d9a466a23285304f0e229a5649815636ab5d6af
/frameworks/native/services/surfaceflinger/Layer.h
a402c4c9913cfbc6c3da21719c57a93a11f091f0 15-Oct-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: Remove display freezing code

This change removes the dead code from SurfaceFlinger that resulted from
disabling support for freezing the display.

Change-Id: I4e5ff00c94b4c7a79af2f65c9850c135210068ed
/frameworks/native/services/surfaceflinger/Layer.h
a249f2d11249ff37c48119020b797ad437ddef2c 17-Sep-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: set layer names on SurfaceTextures

This change sets the SurfaceTexture name string to match that of the
layer to which it belongs.

Change-Id: Ib302d79e916a36ab1e54cb9ff477c3b857bd957b
/frameworks/native/services/surfaceflinger/Layer.h
fb4d5d5726c172adbe62341d99a2148685a98379 21-Sep-2011 Mathias Agopian <mathias@google.com> improve hwc dumpsys

we now log the buffer's format

Change-Id: I9d3ad8018e884240a153de3baefb6331cb014d0f
/frameworks/native/services/surfaceflinger/Layer.h
a45836466c301d49d8df286b5317dfa99cb83b70 24-Aug-2011 Mathias Agopian <mathias@google.com> Add a debug option to turn the "transformation hint" off

transformation hint is disabled with:

adb shell service call SurfaceFlinger 1009 i32 1

Change-Id: I9aafe6f280f88ce41569ed69a06dc522b10e3a88
/frameworks/native/services/surfaceflinger/Layer.h
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/services/surfaceflinger/Layer.h
47d0812977b7acc4fed6a823203770a57f7a6b78 12-Aug-2011 Mathias Agopian <mathias@google.com> SurfaceFlinger doesn't rely on having a custom RefBase destructor

we just use a message to the main thread to
destroy our GLES state.
/frameworks/native/services/surfaceflinger/Layer.h
933389f75814bb62e8153528f9cff2cb329b77df 19-Jul-2011 Mathias Agopian <mathias@google.com> use SurfaceTexture new scaling mode in SF

SF now obeys SurfaceTexture's scaling mode instead
of inferring it from the buffer's size

Change-Id: I4d50e9851abedd7e64bfcfc8af9eefb9fb668529
/frameworks/native/services/surfaceflinger/Layer.h
ddc31c3e2bc6ffe66695c385d23e8ccc3c6dad06 13-Jun-2011 Mathias Agopian <mathias@google.com> fix RefBase so it retains binary-compatibility with gingerbread

Bug: 4595257
Change-Id: I0d5e10f497e3f39868bff58f6ded510c38b44b12
/frameworks/native/services/surfaceflinger/Layer.h
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/services/surfaceflinger/Layer.h
ca4d3602c07837d0b2ac6878685a8e327b5f30f0 20-May-2011 Mathias Agopian <mathias@google.com> Fix a race that could cause GL commands to be executed from the wrong thread.

Change-Id: Ia3d407f7bf2f5553f46cfdade70b7b0badb35beb
/frameworks/native/services/surfaceflinger/Layer.h
7a4d0dfd43558c299e6af6c4910ef76db9db3172 10-Mar-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: Respect the PROTECTED gralloc bit.

This change makes SurfaceFlinger treat layers for which the active
buffer has the GRALLOC_USAGE_PROTECTED bit set as if they have the
'secure' flag set.

Change-Id: Ic60b6513a63e4bb92ec6ce9fd12fd39b4ba5f674
Bug: 4081304
/frameworks/native/services/surfaceflinger/Layer.h
ab0225e3308c2cc6d399e967be16e766468437ac 23-Feb-2011 Eric Hassold <hassold@google.com> Merge "Correctly handle translucency of device-specific pixel formats"
a1f47b90ab53af978be45b8bda16c5d084ae66e6 16-Feb-2011 Mathias Agopian <mathias@google.com> fix a surface leak in SurfaceFlinger

SF kept a strong reference to ISurface until the
window manager removed the surface from the screen.
This fell appart when running standalone tests, that is
when the window manager wasn't involved.

When the window manager is around, it would clean-up surfaces
even when an application died.

with this change, SF is able to do its own cleanup without
relying on the window manager.

the change is very simple, we simply don't keep a reference
to ISurface and make sure no more than one of them can
be created.

Change-Id: I61f2d7473bf8d4aa651549a846c34cdbb0d0c85a
/frameworks/native/services/surfaceflinger/Layer.h
ac45e6bff1b41acd35c981291b37b23f8e083cee 10-Feb-2011 Eric Hassold <hassold@google.com> Correctly handle translucency of device-specific pixel formats

Check requested format for device-specific formats, and assume (as
documented in libhardware/include/hardware/hardware.h) this is opaque
layer so no blending is necessary.

Bug: 3215931
Change-Id: Ib4dff8060ac522d201ff1e74807ac340c17d3fa7
/frameworks/native/services/surfaceflinger/Layer.h
16f0453fee84c6aad59fe0d1c7d36f061d46cffc 20-Jan-2011 Glenn Kasten <gkasten@google.com> Protected surface API

To be used by DRM framework, implemented by display HAL

Change-Id: I054a07a94f4d5dbe792f3a597e2e49a100d90eb2
/frameworks/native/services/surfaceflinger/Layer.h
2bd1d95efecffad447afd682ffe605bbf8c79d62 20-Jan-2011 Mathias Agopian <mathias@google.com> clean-up unneeded code

now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.

Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
/frameworks/native/services/surfaceflinger/Layer.h
420a283c4dc2a669c93bd5c0a2180b14f3625501 15-Dec-2010 Mathias Agopian <mathias@google.com> Fix a problem where hwc and GL composition could show a different buffer

if a surface's buffers are reallocated, the current active buffer will
end-up pointing on one of these until a new buffer is retired.

we're now keeping a reference to the actual buffer until we retire a
new one.

Change-Id: Ib1703947e7a0340694d846e0962576318863b935
/frameworks/native/services/surfaceflinger/Layer.h
da9584dc295cc5e6d0b49a97c1e45159249d650b 14-Dec-2010 Mathias Agopian <mathias@google.com> fix [3223749] media server crashes when switching mode from video capture to still image capture

there was an issue were in some situation SF would call prepare() on hwc
with a NULL handle and never call prepare again.
in this situation, we onw set the SKIP flag to make sure that hwc
won't process this layer and as soon as we receive our first buffer we
trigger a recompute of the visible regions which will end-up calling
prepare() again.

Change-Id: I6b400b2df79712408b9315a9859290c7fcb1609e
/frameworks/native/services/surfaceflinger/Layer.h
a1aa18fc267a7d2db99b3cbc39907127bcdf6ac6 08-Dec-2010 Mathias Agopian <mathias@google.com> resolved conflicts for merge of a0f011ff to master

Change-Id: I4c17021fc269ce66c98cc345353600eda332f980
733189d408e13b54fd70971b265244367efd0f51 03-Dec-2010 Mathias Agopian <mathias@google.com> [3171580] Fix two typos related to fixed-size buffers

mFixedSize was never set, this bug was introduced during some "cleanup", in
practice this could cause some issues when a fixed-size buffer was used and
the window was resized.

Layer::drawForSreenShot() had a typo that had no effect.

mFixedSize was used to determine if filtering was needed, which was a bit too
conservative and created a dependency between filtering and "fixed size" states
which should exist.

Now we enable filtering based on the size of the buffer vs. the size of the layer.

Change-Id: I32044e91b0c944c1b137efdceb3f01dfaa78119d
/frameworks/native/services/surfaceflinger/Layer.h
54cc83e8a48c57307cdd40fe4b7e296020490095 02-Nov-2010 Jamie Gennis <jgennis@google.com> Implement reducing the buffer count of a Surface.

Change-Id: I7f979c60c06d654aa8265002836277434bc1a64f
Bug: 3095167
/frameworks/native/services/surfaceflinger/Layer.h
df85c455c34a920d22a8e3f7459a1cc615efcd27 29-Sep-2010 Mathias Agopian <mathias@google.com> refactored screenshot code

the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.

we also now have some client code to interface with the screenshot service.

it's now possible to request a screenshot at a lower resolution.

Change-Id: I33689bba98507ab928d0898b21596d0d2fe4b953
/frameworks/native/services/surfaceflinger/Layer.h
74c40c0a273dbfd7d10617c4cc1b0c066bfc812e 29-Sep-2010 Mathias Agopian <mathias@google.com> refactored screenshot code

the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.

we also now have some client code to interface with the screenshot service.

it's now possible to request a screenshot at a lower resolution.

Change-Id: I5a3b0e431421800e3aad601d9af8f94adffbc71f
/frameworks/native/services/surfaceflinger/Layer.h
000ca8fa9a1a92aa2f132ba41d11ece6d01cdadd 18-Aug-2010 Mathias Agopian <mathias@google.com> revert hwcomposer HAL changes. DO NOT MERGE.

This reverts commit:
94364b91a2894bf037b8beb027132fbb812e1434
f8e705dea48f77f1c2532fdbadd4997dd1851af0
b59beb5ca68d0228f60dda60d85e2d0226b33215
e0d5f5bcf5a8b26f4ad75f549cbf380b2c9faf20
/frameworks/native/services/surfaceflinger/Layer.h
a350ff98692b3a50cad5cc93f9f83221242ca86a 11-Aug-2010 Mathias Agopian <mathias@google.com> call into hwcomposer HAL when present

Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
/frameworks/native/services/surfaceflinger/Layer.h
81bac09fa6b01dd1495644d9c825c3666762fced 15-Jul-2010 Mathias Agopian <mathias@google.com> move native services under services/

moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8
/frameworks/native/services/surfaceflinger/Layer.h