History log of /frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/SurfaceFlinger.cpp
02b95105754b1859a97e234b79f41489a4677c20 06-Nov-2012 Mathias Agopian <mathias@google.com> fix transitions from hwc to GLES composition

If we switched from HWC to GLES but the dirty region was empty
(could happen if the dirty region is outside of the screen for instance), we
need to force a full screen composition.

In this change we ignore the dirty region for the purpose of
rejecting the whole update and we rely on the fact that it will later
be expanded to the whole screen. This was the least risky fix.

Bug: 7467760, 7452931
Change-Id: I2132f2f963b00a3ce7150adadb107b0367b3862e
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f45c510009edab4a3e93f8d66b2e30aa26759fed 25-Oct-2012 Mathias Agopian <mathias@google.com> partially implement external display clipping

we perform external display clipping only on the GL
side (ie: not done on the h/w composer side, which is
harder and would be too risky). in practice this means
that WFD will be clipped properly, while HDMI *may* or
may not depending on how hwc is used.

Bug: 7149437
Change-Id: I92d4d04220db72b6ffb134c7fa7a93af569723a5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
d17e3b5f6cf71eb52bc81f37719254ce08244b34 22-Oct-2012 Mathias Agopian <mathias@google.com> prevent a client from crashing surfaceflinger

a misbehaving or malicious client could cause SF to crash
by providing a "fake" IInterface. we now check the
IInterface we get is our own and local.

Bug: 7278879
Change-Id: Ia19d05902d4b2385c5a16416148378d4998833fd
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
dd3cb84cfbe8068790c6233b5829fae9c4a0ee93 20-Oct-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add support for secure displays

This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set. All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.

Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7c41bf7092b75dba6029cd3bbc842d3a2661b0aa 17-Oct-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: change the animation timeout

This change changes the animation transaction timeout from 500us to 5s.

Bug: 7362633
Change-Id: I9bed8e74f726dae2daa398afc29babcea00d5b04
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
db9b41fd157279d1b988a854e0d7c5b43c2fac38 16-Oct-2012 Mathias Agopian <mathias@google.com> fix a corruption in blank/unblank

we were holding a reference (ie: pointer) to a sp<DisplayDevice>
while processing the message. Meanwhile the object itself could
go away and we would end up accessing a dead object.

the root cause of the problem is that we are accessing mDisplays[]
in a few places outside of the main thread.

Bug: 7352770
Change-Id: I89e35dd85fb30e9a6383eca9a0bbc7028363876c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
2d5e230292c27d59f4c096bc742a0a19abf811c1 16-Oct-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add animation transactions

This change adds a transaction flag for WindowManager to indicate that a
transaction is being used to animate windows around the screen. SurfaceFlinger
will not allow more than one of these transactions to be outstanding at a time
to prevent the animation "frames" from being dropped.

Bug: 7353840
Change-Id: I6488a6e0e1ed13d27356d2203c9dc766dc6b1759
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9e9689c11148521d2c16a121a0b87b062be0714c 11-Oct-2012 Andy McFadden <fadden@android.com> Fix HDMI unblank behavior

Two issues:

(1) We were announcing the hotplug event before we were ready to
handle blank/unblank events, so we were losing the initial unblank
that power manager sends us when HDMI is first plugged in. This
left the display blank until you toggled the device power off/on.

(2) We were retaining fbTargetHandle for HDMI after the display was
disconnected. The value didn't get updated when HDMI was reconnected
because the display was blank, so we didn't go through that code
path. So, when HDMI was re-connected, we passed stale data into
the HWC.

Bug 7323938

Change-Id: I2335d24fd7b0f00bb23fc63aa7bcf44cb8857c73
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3292cae8c37fc8d7cd8bf77fafaa55e6fc7a8cc5 09-Oct-2012 Mathias Agopian <mathias@google.com> don't automatically unblank external displays

this should be handled by the display-manager. we were doing
that in SF because until recently we didn't have enough support
in the HAL. however, this is now causing other problems when
plugging hdmi while the screen is off for instance.

Bug: 7150885
Change-Id: I739b209056a765d38d05295cf202f67ee0f506ae
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cb55857bbde34a06c19dde3db5064d1717a0173e 05-Oct-2012 Mathias Agopian <mathias@google.com> fix dumpsys Layer name when using multiple displays

Bug: 7288401
Change-Id: I14beeef58fac5270cef3b611e18c163060efe6c3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9a14392256354538f1f43a5e80fe46c2c2b965cb 05-Oct-2012 Jesse Hall <jessehall@google.com> Ignore display state changes for disconnected displays

When a display is disconnected, removing it from SurfaceFlinger's
display list is non-atomic with removing it from the Display Manager
and any in-flight transactions. So SurfaceFlinger might get a display
state change transaction for a display it has already forgotten about.
Just ignore these.

Bug: 7288082
Change-Id: Ic27e55377f3db40fb34e3b1cd67e43297df117a2
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
81cd5d3b94d21253a0be925f4ae58cc7f4afeef7 04-Oct-2012 Mathias Agopian <mathias@google.com> make sure we don't call into the HWC HAL when not needed

when enabling/disabling vsync we now make sure to
not call into the HAL if the state wouldn't change.

Bug: 7274951

Change-Id: Ie24a6d68888a51b577acf9c2a973d85437cbacaf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
27ec5739bc05330e08b02f25b62a8f597bad897a 03-Oct-2012 Andy McFadden <fadden@android.com> Fix crashes after HDMI disconnect

The display was being removed from SurfaceFlinger's list before we
had a chance to reset HWComposer's layer list, so we were passing
stale data into the hardware composer (which has its own per-display
data). This resulted in "invalid gralloc handle" complaints.
We now clear the layer list immediately after removing the display.

The display was being removed while its EGLSurface was still
"current", resulting in "cancelBuffer: BufferQueue has been
abandoned" complaints. We now call makeCurrent on the primary
display before removing the external display.

Bug 7274254

Change-Id: Ia59e3a61d7ec46488b96bf93ec5e4ed3488b70e4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
135e5899f70a67e62baaf6dbec7ba2ce611ca16a 01-Oct-2012 Mathias Agopian <mathias@google.com> save/restore viewport properly when taking screenshot

Bug: 7241739
Change-Id: Iba8b9ffc75ab47fbc56169e65da26d96850a9297
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
bae92d0d605e99a14731add4f11b72413b2835e5 28-Sep-2012 Mathias Agopian <mathias@google.com> reset GL viewport and project when caputring the screen

Bug: 7241739
Change-Id: I3bb5214b070384de9be2026647865c6c236a4331
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c01a79d77b829e7de86ef137694e8ad708470ca1 28-Sep-2012 Andy McFadden <fadden@android.com> Pass display arg to blank/unblank

This allows us to blank and unblank displays other than the built-in
display (e.g. HDMI).

Bug: 7240511
Change-Id: I89ea13f9e497be74c3e1231d0c62fb558e93e0f8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a4310c8be2dc3406a668ee99020d52187173232f 26-Sep-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: don't always set HWC_GEOM_CHGD

This change fixes a bug in SurfaceFlinger that caused the HWC_GEOMETRY_CHANGED
flag to be set every flip.

Change-Id: I4f395a2883bcbb53b23b3d14941aff108739c9f0
Bug: 7234237
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a8026d21f3f2f09e3416cbd33c277fbd15d8cf4e 25-Sep-2012 Jesse Hall <jessehall@google.com> Stop using transparent region for computing visible regions

The transparent region hint is computed only from view layout
locations, ignoring post-layout translation. If a SurfaceView is layed
out with no other views above it, but a view is moved above it
post-layout, that view's layout bounds would be subtracted from the
window's transparent region instead of its drawing bounds. Prior to
this change, the view would not be visible (except where its layout
bounds and drawing bounds overlap).

With this change, composition uses visible regions computed without
regard to the transparent regions. However, if all of a layer's
visible region is transparent, it will be removed from the list of
layers to composite. This doesn't fix the root problem of incorrect
transparent regions, and doesn't prevent bad composition in all cases.
But it does avoid it for some existing apps, whiel still allowing the
transparent region hint to save power in the important
fullscreen-video-in-a-SurfaceView case.

Bug: 7179570
Change-Id: I47cf939e12129b167afa344b8b036e8827103ac8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
722b98f9dfe8f04de8734630198b99a6cd024118 26-Sep-2012 Mathias Agopian <mathias@google.com> add support for EGL_FRAMEBUFFER_TARGET_ANDROID

we now try first with EGL_FRAMEBUFFER_TARGET_ANDROID, and
pick the first config we find. Otherwise, we revert to
the old algorithm.

Bug: 7232584

Change-Id: I8d5c5a4ce48420832c2e2828718a8f53325effb0
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7b1905113712281c777b230648d3fbb69ae4f42c 26-Sep-2012 Mathias Agopian <mathias@google.com> fix a crasher when running out of memory

MemoryHeapBase::getBase() returns MAP_FAILED in case or
OOM, not null which is what SF was checking against.

This addresses one of the issues of bug 7230543.

Bug: 7230543
Change-Id: I763a88f64a2f9ff75eb139cfbaf9a1a9746c5577
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
bb53b0e4b97634bc31808965f81b3ab4193d0e84 25-Sep-2012 Mathias Agopian <mathias@google.com> When "show visible regions" is enabled we were missing a call to HWC

Bug: 7204034
Change-Id: I64dd78362fa75149513a7d9ff92dde175e9b4958
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4803b74e2a12a508f7bbfde6f6a962fe3299c61c 25-Sep-2012 Andy McFadden <fadden@android.com> Show build config in dumpsys SurfaceFlinger

This adds a line to the "dumpsys SurfaceFlinger" output that shows
build-time configuration values.

Example:
Build configuration: [sf HAS_CONTEXT_PRIORITY] [libui] \
[libgui USE_FENCE_SYNC]

Bug 7206633

Change-Id: Ibe1856b459d34a4be6ee83a4ebfd2807e6cc68a0
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
2a23184e4109060ec772763e80dae2132cf9d2eb 25-Sep-2012 Mathias Agopian <mathias@google.com> don't call eglMakeCurrent() before calling HWC commit() on HWC 1.1

this call is not needed and misleading on HWC 1.1; it can also have
a negative performance impact when multiple displays are used.

Bug: 7124069
Change-Id: I47cd25c9d6e69abcc9333b9ecd5044e8fb1919ec
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9e2463e71796964cfaa06bf09a880875ac3537bc 22-Sep-2012 Mathias Agopian <mathias@google.com> add/remove displays properly on hotplug events

Bug: 7191563
Change-Id: I8f0fbf3b29658c9479443141798e6f288a1f2d52
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4c0751a1f6e4ee941791012b31f9dbc65601e1d6 21-Sep-2012 Mathias Agopian <mathias@google.com> return an error, as expected, when querying a disconnected display

Change-Id: I405a3a7bb42b9bbd2ec7bfe09e60e1b7acf7389d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f5a33928349bebc8eebc9f466618997e98c24e68 20-Sep-2012 Mathias Agopian <mathias@google.com> we now correctly set-up connected screens during boot

Change-Id: Ie8b1a3b97ad1821cc970e43abe96c8cec7135b66
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
148994e5f33ce240ff24ceb5bc0500b7f2001959 20-Sep-2012 Mathias Agopian <mathias@google.com> We now report hotplug events to the framework

Change-Id: I2d6b7787d39e5929485a551e4982498c5053c211
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1604f777d11c40daae8ec91d8ea75625996bfbac 19-Sep-2012 Mathias Agopian <mathias@google.com> one more step toward HDMI support

getDisplayInfo() now returns proper information for
HWC managed displays.

hotplug is sitll not supported; so this is not fully correct
as the information returned will be bogus if the HDMI screen
is not plugged in.

Bug: 7191563
Change-Id: If55d8e829fae0443571548155007f486cdf9bc9f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f33e4b6f13bc3ee2d2a4e1abd1ada171c70d3492 21-Sep-2012 Mathias Agopian <mathias@google.com> GraphicBufferAlloc class was declared twice

this was confusing because the one in FramebufferSurface
wasn't in fact being used

Change-Id: Ied45aec20d804cfbe52440f9b2f2852a85c757cf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f21cffa7d707dad10b2974c58c91482f7ca689ac 20-Sep-2012 Jesse Hall <jessehall@google.com> Allow 16-bit color EGLConfigs

The emulator without GPU acceleration only supports 16-bit
framebuffers.

Bug: 7185810
Change-Id: I883180367bf5b291d5e70427ab586d2e17868a96
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1d12d8a8e61163b35cf42c51c558a67138014e82 18-Sep-2012 Mathias Agopian <mathias@google.com> improve logging of external displays

Change-Id: I041aebb7fc655aeca98bbf698d15e05d7c12cac9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8dfa92fef9759a881e96ee58d59875d35023aab9 18-Sep-2012 Andy McFadden <fadden@android.com> Plumb display name into SurfaceFlinger

The Surface createDisplay() call takes a display name for debugging.
This change carries it through SurfaceFlinger and displays it in
the "dumpsys SurfaceFlinger" output.

Bug 7058158

Change-Id: I79f3474a8656ff1beb7b478e0dbf2c5de666118a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
da27af9832a0170f1fc40ef3f21371c4d30d21b3 14-Sep-2012 Mathias Agopian <mathias@google.com> add support hwc 1.1

Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cde87a3b9d3f8dc15232d927b56ee9e5e520f58d 13-Sep-2012 Mathias Agopian <mathias@google.com> refactor things a bit

- decouple GL and main display initialization
- ensure that each "supported" display has its own FramebufferSurface
- onScreenAcquired/Released now takes a display

Change-Id: If34a05f3dea40f6c79db77f4dde283a2580daac4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
6e220a6ce6971555b883f4852c6e5d4c7a617815 14-Sep-2012 Jeff Brown <jeffbrown@google.com> Fix display projections when translated.

There are two different translations to apply in the logical
orientation, one before scaling and one after.
So translate, scale, translate then rotate.

Bug: 7139798
Change-Id: I0726991cadb62988390e77503dbbaed54f07bfe3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ce3a0a541c3dde1330551bd7a048cd9d92335c00 13-Sep-2012 Mathias Agopian <mathias@google.com> don't call hwc with non-empty layer lists for blanked displays

we now make sure to take the blanked state of a display into
account when we build its list of visible layers, this ensures
that we won't call prepare/set with a non-empty list when the
display is blanked.

Possibly fixes 7075380, 7103553, 7130187, 7016215

Bug: 7075380
Change-Id: I9fdd2e73d1b7621eaeca3d4ac2ae60d9fb1b3631
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
43601a2dc320a271ff8c3765ff61414a07221635 12-Sep-2012 Andy McFadden <fadden@android.com> Reduce failure uncertainty

This adds a trivial workaround for a one-shot boot time crash, plus
an explicit check and abort for a failure condition that currently
presents as a less obvious failure.

Bug: 7145521, 7147557
Change-Id: I548f6a9caa9f0bd5710aaecea0e1c6c7c8f2f281
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b0d1dd36f104c0b581674adc7f830cbf44b7db06 10-Sep-2012 Andy McFadden <fadden@android.com> Reshuffle FramebufferSurface

FramebufferSurface no longer speaks directly to the FB HAL. Now
everything goes through HWComposer (which may or may not be
connected to a hardware composer).

Added display index arg to some query methods.

Change-Id: Id3e157d2d4e3555d33afbb703e518b6e92e2d6d5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4c05dd175ee3bd5119eecf368742b6510a8cfa6c 09-Sep-2012 Jeff Brown <jeffbrown@google.com> Ensure that viewport and frame are initialized.

onInitializeDisplays() was posting a transaction with changes
to the display projection. Unfortunately, it only set the
display orientation field and left viewport and frame
uninitialized.

The uninitialized values flowed downstream and found themselves
baked into a bogus DisplayDevice mGlobalTransform. That transform
was then applied to some Rects which were turned into Regions
that were them combined with other Regions.

Under certain situations, the uninitialized data might have
a largish value, resulting in the creation of Regions with
components in excess of the Region max-value limit of 0x7ffffff
(note that this is not INT_MAX). Later when performing a
binary operation using the Region, the Spanner would loop
indefinitely trying to figure out how to stuff a humongous
region inside of a max-value region. Not content to try
just once, the Spanner would continue trying again and
again, pegging the CPU and hanging surface flinger during boot.

Insanity soon followed.

Bug: 7130713
Change-Id: I0016f0c9662185be833474c212a1dd408096ae23
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4fb3999cea652617be5125f8a42c257467bf3c77 07-Sep-2012 Jeff Brown <jeffbrown@google.com> Fix display projection.

Change-Id: I0f253dc3759b99e05ff8344b0f513d8c289702e7
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1501d54d63c55dc4e8f4c6eeaeac35aca6660ffc 05-Sep-2012 Mathias Agopian <mathias@google.com> minor cleanup

Change-Id: Ied80e14878e92a506930f7a5a55adde8f260ec70
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
00e8c7a88a5b9c4104a71013a713acd3e4d3b77b 05-Sep-2012 Mathias Agopian <mathias@google.com> display projection API now has a single function instead of 3

Change-Id: I9bf46d372b77d547486d4bbe6f1953ec8c65e98f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
da8d0a5c0cf9d41915d3b106cad4aaec3e767c11 05-Sep-2012 Mathias Agopian <mathias@google.com> implement display viewport and frame

note: viewport clipping is not implemented yet

Change-Id: I7fde7c4de075d409d95c48bb20ba8ee017f6f00a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
63f165fd6b86d04be94d4023e845e98560504a96 31-Aug-2012 Keun young Park <keunyoung@google.com> add libsurfaceflinger_ddmconnection for PDK build

- the library is dlopened from libsurfaceflinger
- the library built only when libnativehelper exists

Bug: 7089510
Change-Id: Ib3ea1029d7e8f6e055f4b759d0bf68f5123fa8a1
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9ca48916bc9408d0f3f8ac95469ced0a6a342aca 30-Aug-2012 Jesse Hall <jessehall@google.com> If there is no hwc, call eglSwapBuffers for the main display

Bug: 7068568
Change-Id: I6a0309613fe3619d065b9047af6c3fb32b510d97
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
93997a8a75942b4d06cf50925de5bede489cc134 30-Aug-2012 Mathias Agopian <mathias@google.com> fix a crasher when setting a display to a null surface

Bug: 7076303
Change-Id: I843dd4ee4a603b8ad51bc1ad14e429db15050bec
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
85d751cba5d4386c739dbf9dd8f7bbf8c493ade9 30-Aug-2012 Mathias Agopian <mathias@google.com> we were sometimes not setting fences properly

this would happen when the composition was handled
entirely in h/w composer, in this case, we would
not set the fences for any involved layers.

Bug: 7049373
Change-Id: I1439dc156ce23c24041cdfbbebfe8ff4fdf790f8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7e7ed7f77a3963a3542bde529d2797a239e2798b 28-Aug-2012 Mathias Agopian <mathias@google.com> the layer list per display could contain non-visible layers

this happened because we didn't check that the visible
region was within the bounds of the display.

Bug: 7064121
Change-Id: I2e81850a3dc3d1474253520ad7f9e559c26d5a96
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
55801e41e6d7306d75d8134dd69d7d8cbbfbc63c 28-Aug-2012 Mathias Agopian <mathias@google.com> we were not always clearing the screen properly

Change-Id: I269dd866e965aebd9b3c4667095818202982f4a3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd 25-Aug-2012 Jeff Brown <jeffbrown@google.com> Banish DisplayID from the SurfaceFlinger API.

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

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

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

Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
13a082e160c2d1d8006b93a555a57035213d568b 24-Aug-2012 Andy McFadden <fadden@android.com> Added display initialization method

The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

Change-Id: I0fa52e9e719c6e997c5725a7baf15d9718461b78
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0bceb84773882b796d9dacbaf96167cb15928d78 24-Aug-2012 Jamie Gennis <jgennis@google.com> surfaceflinger: fix display id selection

This change fixes display ID selection so that it never chooses negative
numbers as display IDs.

Change-Id: I5af1acc7b1270b371595e096b18e2a6ad250c7ba
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9b6a395e65ff88ab79fe92d6f112c434441ca606 24-Aug-2012 Andy McFadden <fadden@android.com> Revert "Added display initialization method"

Something doesn't seem right (again).

This reverts commit 53ade0853ca003c9e917b5e7d34e1b1338d7b87d.

Change-Id: Id5786997ca9dd2a447363e8ac95213ea37468504
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
53ade0853ca003c9e917b5e7d34e1b1338d7b87d 24-Aug-2012 Andy McFadden <fadden@android.com> Added display initialization method

The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

(This reverts an earlier revert.)
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
e60b0687c8d49871d0c8786cabe6851f7a7783b5 22-Aug-2012 Mathias Agopian <mathias@google.com> HWComposer now has its own concept of display IDs

HWComposer can now create IDs representing a display
it can deal with. IDs MAIN and HDMI are reserved.
SurfaceFlinger associate HWComposer IDs with a
DisplayDevice and uses that when it talks to HWComposer.

A DisplayDevice doesn't have to have a HWComposer ID,
in that case it just can't use h/w composer composition.

Change-Id: Iec3d7ac92e0c22bf975052ae2847402f58bade71
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f1bf89dd88f3926faaec77b9322b2a580691960d 22-Aug-2012 Ramanan Rajeswaran <ramanan@google.com> Revert "Added display initialization method"

This reverts commit 3f3956236aac97b6aa25fa89f0983d5e9d065fdb

Change-Id: Ia2a15d9a5db88add6019edf9d955cef1f73d432d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3f3956236aac97b6aa25fa89f0983d5e9d065fdb 21-Aug-2012 Andy McFadden <fadden@android.com> Added display initialization method

The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

Change-Id: Idaa0d0b98ebb331a17d1b16774c6b05bfa1e8728
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cd60f99aba9e750700a967db30b74a29145739cf 17-Aug-2012 Mathias Agopian <mathias@google.com> refactor compositing code to avoid multiple eglMakeCurrent() calls

when multiple displays are connected, we ended-up having to
call eglMakeCurrent() twice per display due to a limitation
in EGL. this fixes that.

Change-Id: I11e4584df50f8c24bbecee74e37b28b3ee031d2f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
5f20e2d4462da3471f59152b32cd8640fa4a21da 11-Aug-2012 Mathias Agopian <mathias@google.com> reimplement wifi display hack with new external display SF framework

fix a few bugs with external displays

- HWComposer doesn't really handle multiple displays yet
so there is a lot of ugliness there

- We also need to make sure that external displays are not
blanked by default

- due to some EGL limitations surfaces being swapped need
to be current

Change-Id: I82bff05b43bcebd8da863c7c76b4edbc3bc223a9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
818b46058aa3006e1d3c178abd36d4f10823f5d9 17-Aug-2012 Mathias Agopian <mathias@google.com> display states can't share the dirty flags

Change-Id: Ifade9f2f1a0df9a36aede77a6cf5eee4be534f98
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
111b2d89221722d38f5b5b3ba65904ec22421839 17-Aug-2012 Mathias Agopian <mathias@google.com> binder interfaces can't be compared directly

we always need to compare their binder

Change-Id: I70d554ebc5009fe81e87923235f91451f32e1a30
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
13233e067b8f71adc3a0ade5f442265e1f27084b 16-Aug-2012 Mathias Agopian <mathias@google.com> oopsie, missed a spot when fixing b/6970310

Change-Id: Ia320fddc7cc4b0666a4fee678af710ecf5f83ff5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3559b07a885bcdff51a6dffb8e3a5ac5adf3a220 15-Aug-2012 Mathias Agopian <mathias@google.com> we were mistakenly optimizing out SF's main transactions in some cases

due to a typo, SF's main transaction was conditional to having a
display transaction.

more correct fix for 6970310

Bug: 6970310
Change-Id: Iafd8c4e02afa5db829cc1c65950cfcc74754c6af
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
01eb979243a57bd33f8389aeeade8024dd0258c0 15-Aug-2012 Jeff Brown <jeffbrown@google.com> Fix layer removal transaction.

Layers were not properly being removed because we were
setting the wrong transaction type flag at the time of
removal.

When layers are removed, we must use eDisplayTransactionNeeded,
not eTransactionNeeded, to ensure that the mLayersRemoved
flag is checked and the appropriate cleanup occurs.

Bug: 6970310
Change-Id: Id4b2897a34d4ac00aa0f92349c0ec6db95c1aaf7
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ea599dfff03b45903dae3288274c31cb24fd483f 13-Aug-2012 Jesse Hall <jessehall@google.com> Don't crash when recovering from WM death

Bug: 6956162
Change-Id: I27244b960c77187b4c4cd7297989c4c872e94a3a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
20128300e0cb7f459a60cfbcddb48190ce6545ed 14-Aug-2012 Mathias Agopian <mathias@google.com> make sure to repaint the screen when unblank()ing

Change-Id: I38e3a8e6bb31ef3d2f1fcaec7490cb92a4427db2
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8b736f138cfd9b239a2c7073347a13c489534ae1 14-Aug-2012 Mathias Agopian <mathias@google.com> xdpi / ydpi were reported as 0

Bug: 6975723
Change-Id: Ia7fa37ec11e2308804f5034959a37e508d292d31
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
e57f292595bec48f65c8088b00ff6beea01217e9 10-Aug-2012 Mathias Agopian <mathias@google.com> make multi-display more real

- displays are represented by a binder on the client side
- c++ clients can now create and modify displays

Change-Id: I203ea5b4beae0819d742ec5171c27568f4e8354b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ef7b9c7eac036cc1230c64821039d18f8cbd2c1c 11-Aug-2012 Mathias Agopian <mathias@google.com> screenshots could stop working after camera was used

once a secure window is put on screen the display
would retain its "secure" flag forever, preventing
screenshots from being taken.

Bug: 6933967
Change-Id: I5be8355145ca7d580d84552311642f8fa912fe6a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3165cc21cfea781988407b19bd83292b19f05f55 09-Aug-2012 Mathias Agopian <mathias@google.com> libgui includes refactoring

Change-Id: I1d24ec17f5003ec2abab5f7472daaff4cc4cc2d3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1e26087493ac0e7d7dc6dea8ad85cfef08b3271f 09-Aug-2012 Mathias Agopian <mathias@google.com> Add a display parameter to HWComposer where needed

- also replace C casts with C++ casts
- only the interface is changed, HWComposer still doesn't
fully handle multiple displays

Change-Id: I48eb89bff2edb76bf1d4d41f46802b9b2a7166a8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
28947d7fbf9f486539322e8e12dd057568e180c2 09-Aug-2012 Mathias Agopian <mathias@google.com> now able to set the layer stack on a DisplayDevice

Change-Id: Ia9691cf221b9444c243eb468d9e276a30e600b6b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1a4d883dcc1725892bfb5c28dec255a233186524 03-Aug-2012 Jamie Gennis <jgennis@google.com> surfaceflinger: refactor FrambufferSurface

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

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
888c822c4cb6976aab9256c58bae9e17e3e55c5c 05-Aug-2012 Mathias Agopian <mathias@google.com> remove a dependency of DisplayDevice on the refresh rate

this remove a dependency (not all) on FramebufferSurface

Change-Id: Ie07ce70760cdcedfb41b5b41bea8da45637bf474
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c1d359d42b753fcc2426d66a0f782f7c300893bc 05-Aug-2012 Mathias Agopian <mathias@google.com> break SF dependencies on libdvm and libandroid_runtime

these libraries are only needed for debugging and are now
linked at runtime if needed.

Change-Id: I03f138523c6de166a1e2700d4454d4a854aee145
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
92efd84f37ce5a8aae74dc9086f825a67b6894e9 03-Aug-2012 Mathias Agopian <mathias@google.com> screen-off animation won't be handled by SF anymore

Change-Id: Idc41386804ae7d7eb981c36e1bc55c270870c8d0
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
92a979a92c34b7de609ce2b1662c73bb8a2728b9 03-Aug-2012 Mathias Agopian <mathias@google.com> We now have a real list of displays.

displays can be dynamically added or removed, and the
list is part of the SF's transaction.

Change-Id: I4186ea39f1317c0e7c044f869004017738968fab
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
fcb239d3dac8bc80f28177f1951611c1d43286ff 03-Aug-2012 Mathias Agopian <mathias@google.com> don't filter when capturing a screenshot unless needed

bug: 6919952
Change-Id: Ia6fbe9bc7e533a64cfdd6ef7f0cd6b9f11feb947
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
0f2f5ff75b7b48ceb64270655ee6b62d09bf4d00 01-Aug-2012 Mathias Agopian <mathias@google.com> rename DisplayHardware to DisplayDevice

Change-Id: I3f7250cd914e0da4f9ec2c9403587bbe12f3cc62
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
be246f86bd6378a5110e81e9d9068ab03c3b077e 01-Aug-2012 Mathias Agopian <mathias@google.com> Layers are now sorted by layer-stack first, then by z-order

Change-Id: I7a82929df5ba87b9d88cc5be87e1a233bc4628e9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
52bbb1ae239c8a4d05543a23fa8c08467d09c3b2 01-Aug-2012 Mathias Agopian <mathias@google.com> getting closer to final main composition loop

Change-Id: Icd63782366ffd11d9ea00c925ae5783ed7440cdb
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
87baae104a3e4c2059990b01c393476065c558b0 31-Jul-2012 Mathias Agopian <mathias@google.com> get rid of global regions that should be tracked per display

Change-Id: I3b871860cc29f1b2fdcc22b0c577a6eae65d9296
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
34a09ba1efd706323a15633da5044b352988eb5f 30-Jul-2012 Jesse Hall <jessehall@google.com> Move eglSwapBuffers out of HWComposer

Commit 8630320 moved the eglSwapBuffers fallback (for devices with no
HWC implementation) from DisplayHardware to HWComposer. But HWComposer
only knows about the framebuffer EGL display and surface handles if
there is a HWC, so it was always passing bogus handles.

This change moves the eglSwapBuffers fallback up to SurfaceFlinger,
which has access to the framebuffer EGL handles.

Bug: 6886613
Change-Id: Iad3f5ff7c90ee48d7053999e6a4548d6794b6ebd
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c666cae2d5995097ec49a87e375e2afdd92802b7 26-Jul-2012 Mathias Agopian <mathias@google.com> get rid of the shared-memory control block

Change-Id: If814060aca1d2ff2619d4adcd57296983d207f7f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
028508cad5ef63ef9fbd42c14e76658e4fd9ebf2 26-Jul-2012 Mathias Agopian <mathias@google.com> hopefully fixe a race condition in sf initialization

if we received a vsync event during SF init, we could crash
as not all objects were ready to go.

Change-Id: Ie11b46e3eb1b37a709dd8757843d444f93dd0189
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8630320433bd15aca239522e54e711ef6372ab07 25-Jul-2012 Mathias Agopian <mathias@google.com> split HWComposer out of DisplayHardware

we will only ever have a single instance of HWComposer, so
it's now an attribute of SurfaceFlinger, instead of being part
of DisplayHardware.

DisplayHardware now just represents a "display" (it should be renamed).

Change-Id: Iec191e57686868e1df6daa8b880a286c9fefde56
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
98a121aa916eb7acbf11df0e3e31a6fede6fc9dd 25-Jul-2012 Mathias Agopian <mathias@google.com> get rid of ro.sf.hwrotation, it's not used anymore

Change-Id: I2ee469ac89ecd65d7187be5cab08b5cc18f67cbe
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8785578391eacd4192333d7b0ce3afedd7d163e6 25-Jul-2012 Mathias Agopian <mathias@google.com> add a layerStack attribute to Layers.

this attribute can be set through a regular transaction using
SurfaceComposerClient (just like any other attribute, eg: position or size)

Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8b33f032327f8de0dcc0e6d0d43ed80f834b51f6 25-Jul-2012 Mathias Agopian <mathias@google.com> update SF binder protocol to support setting display attributes

no change of functionality -- the old behavior is implemented
on top of this new protocol.
this new protocol will allow, eventually, to pass informations
about displays and layer stacks.

Change-Id: Ic6c2295e61ec8ecbc8ce01ab7664e35d928202fc
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
921e6ac4b7610a178285898d191eb0e3afe906c0 24-Jul-2012 Mathias Agopian <mathias@google.com> SurfaceFlinger cleanup

mostly refactored SurfaceFlinger.h, but also removed dead code.
cleaned-up a few includes as well.

Change-Id: Ib15f4ffe567912b61ee98aa076c6a283b72811b5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
6ee93c0d36dff1339eb2428be2d65441398e6e5f 23-Jul-2012 Jesse Hall <jessehall@google.com> Increment iterator on early-out too

Bug: 6860046
Change-Id: I82f9e4062cb58d5479c9d8dc5f2f0770a1dcc605
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a6b32db164e7834e211261046f3229bf50bc0098 20-Jul-2012 Jesse Hall <jessehall@google.com> Handle empty HWC layer list when composing

Bug: 6777877
Change-Id: I71e9b948d04dda33d45cfa986d9c7e28328cf749
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a49126087b4494f4ef50873f3a3f6727265f6621 12-Jul-2012 Mathias Agopian <mathias@google.com> factor EGL/GL and surface creation out of DisplayHardware

Change-Id: Icd85a6a4caad06f056578008af3e21666fa8b1f4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3b1d2b6b2bbfb5df46b1059ec52360974e6f1428 11-Jul-2012 Mathias Agopian <mathias@google.com> mVisibleLayersSortedByZ is now maintained per display

Change-Id: Idcdb77eba1a3f99b3e4b2150128a82acaffcd2a8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
c5c5a14c06de249d8e0445fd24699e1d9aa04549 03-Jul-2012 Jesse Hall <jessehall@google.com> Only set acquire fences on overlay layers

Change-Id: I08e8173f83580de5a4e43a0ba5ea03e5ec6e8782
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
3094df359d1e6e2ae8ca4e935cc093f563804c96 19-Jun-2012 Mathias Agopian <mathias@google.com> First prototype atttempting to support an external display

both API and implementation will change, this is just a prototype
intended to show feasability.

SurfaceFlinger is passed an ISurfaceTexture through a new
callback, it is in turn used to create an EGLSurface which
surfaceflinger will draw into in addition to the main screen.

Change-Id: Id0bbb0b854bb7bae44d57246a90b65d4567f9a21
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
aa049f0d19684cf92f2f6510133a33138845dcd3 20-Jun-2012 Mathias Agopian <mathias@google.com> am 8aaf3e47: am a67e418e: Exit boot animation cleanly.

* commit '8aaf3e47a51aa0beebecc8c536504d310d07cda9':
Exit boot animation cleanly.
a67e418e1fda219f6cc0a7e420bcf5cc4f9fe710 20-Jun-2012 Mathias Agopian <mathias@google.com> Exit boot animation cleanly.

The desc.txt file can now mark parts as 'must finish cleanly' by using
'c' as the part line prefix rather than 'p'. If so indicated, if the
bootanimation is asked to quit it will do so only after waiting to
finish that part.

I considered either making init.c service killing smarter or promoting
bootanim to be a bindable service with a requestExit method. However,
these changes are probably too big/risky given our ship date. So
I used a property as a mailbox between SurfaceFlinger and bootanim.

Bug: 6679877
Change-Id: Id7dca22caa50b450fff25ca94f7242d971034f41
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
5df996211d4e263feb862121cfafa7f9c8eeda68 19-Jun-2012 Mathias Agopian <mathias@google.com> fix typo in makefile LOCAL_CFLAGS was spelled LOCAL_CLFAGS

Change-Id: I58b96d28f608ce16fcad5ed0efb887e582779e03
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
db403e8ff0d7727015e1a5009bab20eb7ec205bc 19-Jun-2012 Mathias Agopian <mathias@google.com> split-up Client.h out of SurfaceFlinger.h

Change-Id: I1993bf23e417163749d886283563a93d50b361b4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
8e533069e5721e55cb9768e140e16546c3a4a8b6 07-Jun-2012 Colin Cross <ccross@android.com> surfaceflinger: replace early suspend with binder call from PowerManager

SurfaceFlinger will no longer directly synchronize with early suspend.
Instead, PowerManagerService will synchronize with SurfaceFlinger to
ensure that a black frame has been drawn on the display, and then
trigger all early suspend handlers.

Change-Id: I07acdd628440d23fdb69db94319ec5d65d3f4919
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a4c5b19dd711abecf87ff1e04e530edec58a0d8c 05-Jun-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: remove all GLES scissor calls.

Bug: 6576505
Change-Id: I494b7627f2e271a234706bf49a9490f8ac56c77a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ed9807bd7dbd4863841e251138392c54755eb394 18-May-2012 Mathias Agopian <mathias@google.com> we need to wait for vsync when doing the screen-off animation

Bug: 6511421
Change-Id: I7a85a55e66a3a8d9937df575e98a5efec01a634f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f15a83f5814219c167f87cb8aaea622fc8493499 11-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add a crop to the layer state

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

Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
56a2bbe70876c1ac4e18b3740722c01d69bca2fd 19-Apr-2012 Mathias Agopian <mathias@google.com> SF needs to render even if we don't have a h/w composer

Bug: 6350574, 6361055
Change-Id: Iab92cc31bab4771fca63619c8e3105c759535f72
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b9494d5c9d44e4a59b6d510fea1665de434f3c6b 18-Apr-2012 Mathias Agopian <mathias@google.com> make sure to clear the framebuffer when using overlays

Bug: 6354761, 6353719
Change-Id: I0739de3fee7c54c14b294ffd768b70ee1f541d9e
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f74e8e0602100e048c13ea262f0c19c3b8738b6f 16-Apr-2012 Mathias Agopian <mathias@google.com> don't attempt to clip layers anymore using glScissor

this seems to hurt performance on some GPU. this change
might negatively affect performance on other GPUs though, but
probably in less time-sensitive cases. If this becomes a
problem it might become necessary to pre-clip the geometry
(so that we don't have to use glScissor).

This improves the rotation animation quite a bit.

Change-Id: I5dbe1286f7ad858ef2c1e1ad9a07ee3f26c0b1f3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a2f4e56fec0fb36c4a370eb23d6e9dc57f250b59 16-Apr-2012 Mathias Agopian <mathias@google.com> get rid off preserve backbuffer optimization in SF

this optimization didn't improve performance and in fact
seemed to hurt more than anything else. it also made
things a lot more complex as it introduced edges cases
when switching to/from h/w composer.

Change-Id: Iaafc235e175f5740cd98bff914d706e02ab88bb8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8acce2046ac7086c3dcfb1fc7c9c39f31de48694 14-Apr-2012 Mathias Agopian <mathias@google.com> make sure to repaint the screen when screen turns on

Bug: 6336168
Change-Id: Ic6f11b6bf6c3d849f5cb6ac95961d10d7f88e4ec
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
69a655caef30663403802281210363f643ceb946 12-Apr-2012 Mathias Agopian <mathias@google.com> Revert "handle surfaces posts independently from composition"

This reverts commit 562f4b2c1e555b853997113bb54b21303d642bc6.

Change-Id: I96efe11c2f0494ed2d57fc580e49c598d913830e
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
562f4b2c1e555b853997113bb54b21303d642bc6 25-Mar-2012 Mathias Agopian <mathias@google.com> handle surfaces posts independently from composition

surfaceflinger will now handle each surface post
as soon as possible and handle the composition
itself at VSYNC time as usual.

Change-Id: I6b1ae33fd56062d86e5419ebab8def0ca5803fbf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
22ffb117b0c2a906bd04aef9738a52223cdd1dce 11-Apr-2012 Mathias Agopian <mathias@google.com> make sure to disable VSYNC while screen is off

Change-Id: If1894c43b0a39a2851e1280a35ae77bccd6d9abd
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b60314a12f3336b27d73920805ab07cbc498d857 11-Apr-2012 Mathias Agopian <mathias@google.com> rework screen on/off code

Change-Id: I13f71e850592a588bbd4805b1830c503bd4decb4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cb9732a951d20cacb7ebe2dab132b5738226b1b6 04-Apr-2012 Mathias Agopian <mathias@google.com> refactor / simplify EventThread

Change-Id: I3981c6fba93b7b985174b2a7045e24db2c0b4428
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4b2ba53423ac2dc795a5a0bf72f6d787d9dc8950 29-Mar-2012 Mathias Agopian <mathias@google.com> better workaround for bug: 6020860

this prevents the GPU from running when composition
is fully handled by overlays. this should improve
animations a bit.

Change-Id: If4ae584b7a3976e6bdd36e318686ac3940b6b075
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3854ed549012f2abf8fea7b0e6db30b104ea5547 23-Mar-2012 Colin Cross <ccross@android.com> surfaceflinger: disable ddms debugging on pdk builds

DDMS debugging depends on non-pdk apis, disable it when a pdk
build is selected.

Change-Id: I6376b5c4cf49f2c51f35f8d567f7c6d18daf893f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b5dd9c0fee3b3d6d35035dfb992951ebea3e0e4e 22-Mar-2012 Mathias Agopian <mathias@google.com> rewrite density calculation code so it's understandable

Change-Id: I1016cd5fd75355abe4ab879d04f4849bd2dd4122
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
fddc28d87136b55f0d9613e5f8ecd64a6aca018d 12-Mar-2012 Mathias Agopian <mathias@google.com> add ATRACE logs for screenshots

Change-Id: Ie8146c4d7608159e9d28b7338f9109b8fcdf955f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
35aadd6be249da4bd4851692e6aff757c91b32a7 09-Mar-2012 Mathias Agopian <mathias@google.com> fix surfaceflinger's dumpsys

Change-Id: I7b95c3e04f145003f9c0eef321a21f3f36dfe835
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
841cde55549cea7a344a1705b18d57a0c6c8ec45 02-Mar-2012 Mathias Agopian <mathias@google.com> add more ATRACE

Change-Id: I6cc5759fb0a05427680488fd12ae797e77644f3d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1c8e95cf86f2182986385bc1ee85f13f425f3a3a 24-Feb-2012 Jamie Gennis <jgennis@google.com> Add tracing to various graphics components.

This change adds ATRACE call tracing to BufferQueue,
SurfaceTextureClient, SurfaceTexture, SurfaceFlinger, Layer, and EGL.

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

Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ff615cc7a1cceedd705b0623b058c54669b29596 24-Feb-2012 Mathias Agopian <mathias@google.com> deprecate L_8, LA_88 and RGB_332 in sdk

re-add support for pixelformats L_8, LA_88 and RGB_332 in libui
for backward compatibility.

This may or may not fix 6058926

Bug: 6049685
Change-Id: Ic1b8b4cc994522f7fe664da64c0ef76b98bc6d53
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
fbc7922ec87298601ba6a3be1bd9f83ffaf9a233 24-Feb-2012 Mathias Agopian <mathias@google.com> workaround for an issue where the screen would flicker sometimes

bug: 6020860
Change-Id: I97807db66b66c5f4dcbed0df79d5d257cfc7c0bd
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
751d0bb9b2f73f7e7ca3fbb0ed7ede7fd63b813a 21-Feb-2012 Mathias Agopian <mathias@google.com> Merge "SurfaceFlinger: set wrap mode on screenshot texture"
1676828d115301ee1d0d4ffa68f832cecc0bbff1 07-Feb-2012 Dianne Hackborn <hackbod@google.com> Merge "Return information about whether overlays are disabled."
12839bee29bdcc65731b4d42029cc59e2320c5c4 07-Feb-2012 Dianne Hackborn <hackbod@google.com> Return information about whether overlays are disabled.

Change-Id: I85ae42e9f28461f5142cc6b3c8e25ff3f195805a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f6de1c04ffc2c7a739578b7612944fddb7011ab7 05-Feb-2012 Mathias Agopian <mathias@google.com> fix a crasher when starting SF with the screen off

SF could end-up in an infinite crash-loop during startup if it
was stopped while the screen was off. This happened because
the thread that manages screen blanking was started before
other important pieces of SF were initialized.

Change-Id: I0dded11dbf2395fdd57b673859a7aa0fa9eb32b6
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
303d538bb012e82c6b9a98c4930a03455000f761 05-Feb-2012 Mathias Agopian <mathias@google.com> ui freeze workaround: reenable triple buffering mode

we're seeing UI freezes when window updates and
composition are separated. for now we workaround this
by always doing a composition after window updates on
vsync. triple buffering is reenabled for performance.

Change-Id: I693d705000b7452489bb0b4918fbeadb9879315c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c95dbdc236acf002b5f8aed8c8a9e43047fc75b5 05-Feb-2012 Mathias Agopian <mathias@google.com> improve SF dumpsys
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b048cef231075a5e41d224b73fe11fec62f335b1 05-Feb-2012 Mathias Agopian <mathias@google.com> fix UI freezes

In some situations SF would mark a window as "has a pending update"
but would never process that update because the window is not
visible (fully transparent, hidden by another window, etc...), this
window would then be "stuck" until some other window updated.

Change-Id: Ifa18a9aef3a53f2593b473556702688ae62d9503
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c9ca7011501cb8730ce4e6e527cb402adb7a0178 04-Feb-2012 Mathias Agopian <mathias@google.com> attempt to fix an ANR in various apps

recent changes in SF introduced a hang where some windows would
stop being refreshed.
This is an attemp to fix that.

Change-Id: I6aa32ac0d6f1c0a6aea8f6195825dc4f4e6f93f9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
8aedd4737d6ce8548d2fd5def65b1e1737283821 25-Jan-2012 Mathias Agopian <mathias@google.com> SF now synchronizes to VSYNC

Change-Id: Ic5e4f2ea9927ce133eef9499c03161325e9d02c5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ad8d13c8858b33e3efef42086875c0b0836d2296 30-Jan-2012 Mathias Agopian <mathias@google.com> remove unneeded code

Change-Id: I07e2fca7274d2e12bf5b4aee0050794bdb97a8b3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
e8696a40e09b24b634214684d18526187b316a2f 16-Jan-2012 Jamie Gennis <jgennis@google.com> hack up frame latency measurement

Change-Id: I6d9a466a23285304f0e229a5649815636ab5d6af
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1db13d79518f600d65a4fc006fe42900b890966e 19-Dec-2011 Glenn Kasten <gkasten@google.com> Get AID_GRAPHICS from right place

Change-Id: I97b1754dc7260fec083275c71a8f71ebfb2cefa8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b1d1c6d4c2eb942e18a59a8cdf1c7c4f0f03ef1b 13-Jan-2012 Michael I. Gold <gold@nvidia.com> SurfaceFlinger: set wrap mode on screenshot texture

Some implementations of NPOT, particular those derived from core
GLES2, require the wrap mode to be CLAMP_TO_EDGE. Set the required
wrap mode for the screenshot texture so it passes the completeness
check.

Change-Id: I735016123e4acaf54b40d1435bd70281cef88a31
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
55ef343331f5efbfe3e01bc9993d94faea236048 07-Jan-2012 Mathias Agopian <mathias@google.com> remove dead/usnused code

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

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

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
32397c1cd3327905173b36baa6fd1c579bc328ff 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c267bab3d1c7980a03541283e88c0b6df378b826 05-Jan-2012 Steve Block <steveblock@google.com> Merge "Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE"
2adea706d445e837053403a00286a21c00e22649 05-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros"
99ed22412db547c59d3da08114d9d5a586442b30 15-Dec-2011 Glenn Kasten <gkasten@google.com> Use the standard CC_LIKELY and CC_UNLIKELY macros

Several source files privately defined macros LIKELY and UNLIKELY in terms
of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and
CC_UNLIKELY which are intended for this purpose. So rename the private
uses to use the standard names.

In addition, AudioFlinger was relying on the macro expanding to extra ( ).

Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a19954ab377b46dbcb9cbe8a6ab6d458f2e32bca 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9d4536835248525f32f1504a3d28d5bbfa0a2910 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
478ae5eb5a0047e1b2988c896cff6363b455ee50 07-Dec-2011 Mathias Agopian <mathias@google.com> Improve the VSYNC api a bit.

- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.

- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.

Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
43bfe7f047668a5b74fefb8cfecbf070f637201b 03-Dec-2011 Jesse Hall <jessehall@google.com> am a91e54fe: am f57c1388: Merge "SurfaceFlinger: fix layer removal race condition" into ics-mr1

* commit 'a91e54fed6a0690d59c97bab9b081b2614880563':
SurfaceFlinger: fix layer removal race condition
2f4b68d21c1a58cbcb1e6929fb241e425a8f7b5d 02-Dec-2011 Jesse Hall <jessehall@google.com> SurfaceFlinger: fix layer removal race condition

Layer::lockPageFlip() and layer::onRemove() could be called on
different threads and race such that lockPageFlip() successfully
called mSurfaceTexture->updateTexImage() but then gets NULL back from
mSurfaceTexture->getCurrentBuffer(), leading to a crash.

This change moves Layer::onRemove() calls to
SurfaceFlinger::commitTransaction() so they happen after the Layer is
done being drawn from and only happen on the main surfaceflinger
thread.

Change-Id: I4b550caadff4cc1878d7c3bca6129193fb0c713e
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
79544364aa3c088fa7fbfadfc169086653389555 30-Nov-2011 Mathias Agopian <mathias@google.com> am e2970700: am e8ba2aba: Merge "add a way to access the version string of the h/w implementation of EGL" into ics-mr1

* commit 'e2970700e921da4226061988a6e8953b1fbfb5a9':
add a way to access the version string of the h/w implementation of EGL
bc2d79ed7ada6243f3690f94ab512c0ddcdbed12 30-Nov-2011 Mathias Agopian <mathias@google.com> add a way to access the version string of the h/w implementation of EGL

we use a hidden egl extension. the version string is printed
in SF's dumpsys log.

Change-Id: I123eb4bde6de462bb2404c67b74d6d6219a48d6a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
d0566bc26fcf6ca396118701fa11900b627f2c09 18-Nov-2011 Mathias Agopian <mathias@google.com> Add support for sending VSYNC events to the framework

use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: Ia720f64d1b950328b47b22c6a86042e481d35f09
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
439cf8576d3b846c0aa0944d84372259bf075d51 29-Nov-2011 Mathias Agopian <mathias@google.com> Fix build.

Revert "Add support for sending VSYNC events to the framework"

This reverts commit f3918c5bd4bc9f02f74da42995564150ca2dd382.

Change-Id: I998e3e1aa3fa310829ae973b64fe11b01f6f468f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
461afeb9fde149f9455acbadf1257d08d33e8eb3 18-Nov-2011 Mathias Agopian <mathias@google.com> Add support for sending VSYNC events to the framework

use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: If4126023fc9c067e56087ec7d16a8fd542ce1794
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f61c57fe2e955e1c195bb0ca2dd7bcdaa922d5a9 24-Nov-2011 Mathias Agopian <mathias@google.com> rewrite SF's message loop on top of Looper

Change-Id: Ib56139f87a5c0b124e34da5c8151207219b2577b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
386aa98c4ffb9b805303e683f0a7b925b44d04db 08-Nov-2011 Mathias Agopian <mathias@google.com> Fix an issue where we could wait for a non-existing transaction

This fixes the issue:
"Call not sent" dialog takes too long to dismiss after hitting OK"

Note: the system would recover after a 5 second timeout.

Bug: 5534520
Change-Id: Ifa37e594b50581f498479a5858672441b3d7dd87
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4a9ac37fe26644bb5253d15eec08be2edb896642 01-Nov-2011 Mathias Agopian <mathias@google.com> Fix rotation displays frame N-1 briefly while rotating

The ScreenShot layer is now created hidden. The screenshot itself
is aquired during the transaction when the layer is made visible.
This guarantees the screenshot and the layer happen atomically
with respect to screen updates.

Bug: 5534521
Change-Id: Ida23e1f13d5716ec83b78a15712e0646d6cf8729
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
62f7114719d2009dca7dd120f0fe29a24bd77a40 27-Oct-2011 Mathias Agopian <mathias@google.com> fix Corrupted graphics while playing You Tube on orientation change

Bug: 5432124
Change-Id: If948b9797b1ec6fff80ca5ea94508abcaced9f31
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
51726c381e23d148867c760d06306dfa940b4d15 22-Oct-2011 Mathias Agopian <mathias@google.com> am aa938c8d: Merge "mDirtyRegion is single threaded, but could be accessed from a hwc thread" into ics-mr0

* commit 'aa938c8d9c0e71c9b556657cb33794210ce6ebf8':
mDirtyRegion is single threaded, but could be accessed from a hwc thread
0dfb7b73a468698622d6c0423f0d5471a6f5d375 22-Oct-2011 Mathias Agopian <mathias@google.com> mDirtyRegion is single threaded, but could be accessed from a hwc thread

We now have mInvalidateRegion which holds the region to invalidate, it
can be set from any thread as long as mInvalidateLock is held. We use
fine-grained locking here because mInvalidateRegion can be set from anywhere,
in particular frmo HWC callbacks.

Bug: 5466774
Change-Id: Iafca20aa3f5b25a87755e65bde7b769aa8f997bc
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7ec662c07aea2a76394cd69f19be0f9a7d87b701 21-Oct-2011 Mathias Agopian <mathias@google.com> am 16bece04: Merge "added dpi and refresh rate info in SF\'s dumpsys" into ics-mr0

* commit '16bece04bdbac9af5228436f70267ec5763315de':
added dpi and refresh rate info in SF's dumpsys
d5e4ef9e439317e2525a51106dbc509d3982de24 21-Oct-2011 Mathias Agopian <mathias@google.com> added dpi and refresh rate info in SF's dumpsys

Change-Id: I2327248eb1993689367e3daeaccba74c172dfceb
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
818fb243572f8e1f408ba9fc35ef61bbedbd9ce1 19-Oct-2011 Dave Burke <daveburke@google.com> am 70ac412b: Merge "Add a LayerScreenshot" into ics-mr0

* commit '70ac412b2fe7be2507189a9fdfb30c43b36d56ac':
Add a LayerScreenshot
675370ab9aadd148ba2cc15b3078c915811355a1 19-Oct-2011 Mathias Agopian <mathias@google.com> am f7613743: Merge "Don\'t call hwc set() if there is nothing new to do" into ics-mr0

* commit 'f7613743f29f38cbbaf4ae09996c380845a17daf':
Don't call hwc set() if there is nothing new to do
5ba8f366bd81348ac8b0e3a09fa122f3098b4363 19-Oct-2011 Mathias Agopian <mathias@google.com> am 23bf2505: Merge "Make sure set GL state properly" into ics-mr0

* commit '23bf250522b7dff9acd14c5900b66b1df9c76745':
Make sure set GL state properly
118d0245ee0a3b107055782aa8b555404b6f0280 14-Oct-2011 Mathias Agopian <mathias@google.com> Add a LayerScreenshot

A LayerScreenshot is a special type of layer that contains a screenshot of
the screen acquired when its created. It works just like LayerDim.

Make sure to call compositionComplete() after rendering into a FBO.

Bug: 5446982, 5467587, 5466259
Change-Id: I5d8a1b4c327f9973d950cd4f4c0bca7f62825cd4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
3a3cad30c40c8eb87671262a9fe7f0e214b6a934 19-Oct-2011 Mathias Agopian <mathias@google.com> Don't call hwc set() if there is nothing new to do

there was situations where SF's main loop would run (as if there was
an invalidate), but the dirty region was empty (so no new buffers
were retired). In this case we return early and don't swap, which
would cause drawing artifacts.

Bug: 5476838
Change-Id: Id3b7bf4b7aabec7919c50d9278eb2165973a4c3d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c492e67810814bf86301abffe1d31598b775cf45 18-Oct-2011 Mathias Agopian <mathias@google.com> Make sure set GL state properly

when taking a screenshot, in particular, we could end up
with stale GL state when drawing LayerDim which resulted
in incortect rendering.

Bug: 5467587
Change-Id: Id9fbed2843481d31063620f3662b364c7e3ac781
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cdec8f01aae14ed59fbc57cb2ce97a6602f4b9a1 17-Oct-2011 Mathias Agopian <mathias@google.com> am 840b8a67: Revert "Add a LayerScreenshot"

* commit '840b8a678537519c27ddf2f818494eaa20a135d4':
Revert "Add a LayerScreenshot"
5bacca6238adba927f9e9b27087e134e9a3c2561 17-Oct-2011 Mathias Agopian <mathias@google.com> am 4fb6416e: Merge "we need to guarantee that h/w comp set() is called when a buffer has been retired" into ics-mr0

* commit '4fb6416e3a21031a88921a784ae62b13d8a1a39f':
we need to guarantee that h/w comp set() is called when a buffer has been retired
090cb44b945bfe2711344a5331814bd6412ab437 17-Oct-2011 Elliott Hughes <enh@google.com> Merge branch 'master' of ssh://android-git:29418/platform/frameworks/base
e9800c83114988b6f8cc25bb9d508ebb322f9903 17-Oct-2011 Mathias Agopian <mathias@google.com> Revert "Add a LayerScreenshot"

This reverts commit d6809f40cf61203573ec5dbc437f695cd132cc18.
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a44b04163957d6086362f6f365443c4c93379031 17-Oct-2011 Mathias Agopian <mathias@google.com> we need to guarantee that h/w comp set() is called when a buffer has been retired

removed a test that could violate this guarantee. note that we
have no proof tha this ever happened, but consequences could be
hard lock-ups.

the code here was intended to track the region to update for displays
that can do partial update. the logic discarded the update entirely
if that region was empty. instead we just redraw the whole thing
(note that we should never be there with an empty region and retired
buffers though).

Bug: 5466259

Change-Id: I91ccab3b1a599e729e438eb833939e2236da6854
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
28378392fd5aa3e0a392c9eb64634055678c3987 13-Oct-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: make sync transactions explicit

This change enables a layer or orientation update transaction sent to
SurfaceFlinger to explicitly request a synchronous transaction.

Change-Id: I97cbba610c13679849f66114b216fa6dbf12f2a9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f171ab6da9cf9793093e50947aacdab8f2b0c9b2 14-Oct-2011 Mathias Agopian <mathias@google.com> Add a LayerScreenshot

A LayerScreenshot is a special type of layer that contains a screenshot of
the screen acquired when its created. It works just like LayerDim.

Bug: 5446982
Change-Id: I7814aff2380e7e146937f2b641907be2a30c76cc
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b8d69a55f1c187a35ac41e69de63251f5501b6f4 11-Oct-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: update orientation via transactions

This change merges the ISurfaceComposer::setOrientation functionality
into ISurfaceComposer::setTransactionState. It enables the window
manager to atomically update both the display orientation and the
position and size of the windows in a single transaction with
SurfaceFlinger.

Bug: 5439574
Change-Id: I18a8ccc564d7d760ef8afb2d015ccdb7a7963900
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f7cdd053fe1fee093f6b0973ad5723765f98a48d 11-Oct-2011 Mathias Agopian <mathias@google.com> fix an issue where the screen could stay off

this would happen when toggling on/off/on very fast, the screen
could stay black (while the panel is on).

Bug: 5429724
Change-Id: Ic8aa6aff066e6267923c0d47ef65e314e7bb6d41
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a9040d0eefa34a78ca68b6e7901e1703e74aeb7c 11-Oct-2011 Mathias Agopian <mathias@google.com> Fix screen off animation when in landscape

Change-Id: I4bc5b12d7a64a4bf8b9a851594be4d60b790d1ed
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9575f60722f7a4f54384fe0be6938a8de48dc23a 07-Oct-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: screenshots w/ protected buffers

This change modifies SurfaceFlinger's screenshot behavior when a layer
with a protected buffer is visible. The previous behavior was to simply
fail the screenshot. The new behavior is to render the screenshot using
a placeholder texture where the protected buffer would have been.

Change-Id: I5e50cb2f3b31b2ea81cfe291c9b4a42e9ee71874
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
059fd18396605592ec538b9e5574a80a8987d10d 23-Sep-2011 Mathias Agopian <mathias@google.com> Merge "don't clear the framebuffer when the framebuffer is not used"
cd20eb09c4752531c1ab1a0084474ef530a5d44f 23-Sep-2011 Mathias Agopian <mathias@google.com> don't clear the framebuffer when the framebuffer is not used

when areas of the FB are undefined (transparent windows on top of
nothing), we clear those areas before composition.
however, it makes no sense to do this when the FB is not in use
(case where hwc handles all layers)

Bug: 5360529
Change-Id: If51bb669307e8419bbe1f3a89d1c88e0ec1f216c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
21230c6410bdab13cd2bd274da54b1e4061b6035 21-Sep-2011 Jeff Brown <jeffbrown@google.com> Handle orientation changes more systematically.
Bug: 4981385

Simplify the orientation changing code path in the
WindowManager. Instead of the policy calling setRotation()
when the sensor determined orientation changes, it calls
updateRotation(), which figures everything out. For the most
part, the rotation actually passed to setRotation() was
more or less ignored and just added confusion, particularly
when handling deferred orientation changes.

Ensure that 180 degree rotations are disallowed even when
the application specifies SCREEN_ORIENTATION_SENSOR_*.
These rotations are only enabled when docked upside-down for
some reason or when the application specifies
SCREEN_ORIENTATION_FULL_SENSOR.

Ensure that special modes like HDMI connected, lid switch,
dock and rotation lock all cause the sensor to be ignored
even when the application asks for sensor-based orientation
changes. The sensor is not relevant in these modes because
some external factor (or the user) is determining the
preferred rotation.

Currently, applications can still override the preferred
rotation even when there are special modes in play that
might say otherwise. We could tweak this so that some
special modes trump application choices completely
(resulting in a letter-boxed application, perhaps).
I tested this sort of tweak (not included in the patch)
and it seems to work fine, including transitions between
applications with varying orientation.

Delete dead code related to animFlags.

Handle pausing/resuming orientation changes more precisely.
Ensure that a deferred orientation change is performed when
a drag completes, even if endDragLw() is not called because the
drag was aborted before the drop happened. We pause
the orientation change in register() and resume in unregister()
because those methods appear to always be called as needed.

Change-Id: If0a31de3d057251e581fdee64819f2b19e676e9a
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9c6e297271ec9af9d974242d89cfa08cb6ceaa0a 21-Sep-2011 Mathias Agopian <mathias@google.com> fix transition from full overlays to fb

we need to clear the whole framebuffer in that situation because
we can't trust the content of the FB when partial (fb preserving)
updates are used.

Bug: 5318492

Change-Id: I3f0e01b0fb665a34e44d88ad9f0f54a5d990060b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0656a68380d01de4136933901b2c322cf9ab0d7e 21-Sep-2011 Mathias Agopian <mathias@google.com> rename mInvalidRegion to mSwapRegion

Change-Id: I946cbc782c0c84645843ea44c3d8b04a0a2fe658
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
f9abeb956fb95682d77005ea0dc506a805f52a04 09-Sep-2011 Mathias Agopian <mathias@google.com> Fix another problem with refreshing the screen when switching to/from overlay

the previous fix was incorrect. See comment in setupHardwareComposer for
full explanations.

Change-Id: Ib24a9af000b8f95cf7319f9272d34997064ceb6d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
22da60c3e64cd57535cbba063c07127814a2b52f 09-Sep-2011 Mathias Agopian <mathias@google.com> Improve SF dumpsys output wrt HWC

Change-Id: Ibdb7930fa3b521bfd3f44750ed98cfd75f9a01fe
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f384cc3008a25ad1b00403aca0cc001547f029c6 09-Sep-2011 Mathias Agopian <mathias@google.com> Fix an issue is SF that caused drawing artifacts when hwc changed mode

we were not redrawing and/or clearing the FB properly when
hwc moved a layer from/to FB to/from OVERLAY.

In these cases we needed to expand the dirty region to include
the layer that changed mode.

Also split composeSurfaces() which was becoming quite large.

Change-Id: Id6fa1acfc4ff694037fddf7efd037a4405732073
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7ee4cd5556cef1878e1d4729f1b389f186311027 02-Sep-2011 Mathias Agopian <mathias@google.com> fix a bug that caused the off animation to not show sometimes

this happened when the overlays were in use, since the animation
is rendered in the FB and the FB is not used.

we now have a way to turn hwc off temporarily.

Change-Id: I3385f0c25bb9cc91948e7b26e7cd31ed18c36ace
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f914e7ffad20c0a39d86376c703cd98c086e774a 02-Sep-2011 Mathias Agopian <mathias@google.com> Fix various flickering / artifacts

these were due to the "preserve backbuffer" optimization
interfering with hw composer. basically the screen needed
to be redrawn in the areas that move from GL to
overlay.

Bug: 5245513
Change-Id: I9bf75c4fe905f3ef62005e52108b94edae692304
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
b0610335d745718f5ee54f15ef1a492921d759f4 25-Aug-2011 Mathias Agopian <mathias@google.com> Fix screenshots

Change-Id: If904634e64b154bbe336d5789dd1209b8ae871fb
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0abe83a680d1f410c28b755eb4b3d6bee30c39dd 25-Aug-2011 Mathias Agopian <mathias@google.com> Fix Recent thumbnails aren't taken when leaving an activity via notification

When taking screenshots we need to use the full drawing state list
instead of the visible list.

Bug: 5186823
Change-Id: I214ee0203aaf8e2c038e44581f7f1ae36edf08c5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
53331da007b56e0cb4201728de99c8c29bcfaa9a 23-Aug-2011 Mathias Agopian <mathias@google.com> fix "show screen update" debug option.

Change-Id: I7d8b24124768b5f7d59d3bb0b019e9baaa0dfc4f
NOTE: from now on, this also disable the h/w composer
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
582270d69db94286a248bd829f1ae6f910d45124 18-Aug-2011 Jamie Gennis <jgennis@google.com> SurfaceTexture: fix queues-to-composer

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

Change-Id: Iff187e72f30d454229f07f896b438198978270a8
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8afb7e39a83a3e31170612d562eb08508e328388 16-Aug-2011 Mathias Agopian <mathias@google.com> as a debug option SrufaceFlinger can now connect to DDMS

this is disabled by default. To enable:
setprop debug.sf.ddms 1

this debug option requires to restart SurfaceFlinger

Change-Id: Ic2f8050b29911b55bcd21721648b6978700c277d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
c10d9d90b2088a3304076e0dc4bf05cdbb5d45ab 21-Jul-2011 Mathias Agopian <mathias@google.com> clean-up. get rid ofunused code and members in Surface[Control].cpp

Change-Id: Ia7790ae28af2c2ac99eae01c2c5044ace4a490a4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ad70186f80355e55ddad2a66b5fd174a1c019c2d 15-Jul-2011 Mathias Agopian <mathias@google.com> dump GLES strings in SF dumpsys log

Change-Id: I438d511159b2bd915c84954f30574340017d4f47
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ffcf4657718831edecb6ff2ed1b45ac8bf8b9a58 08-Jul-2011 Mathias Agopian <mathias@google.com> fix screen on/off animation (again)

- surfaceflinger now uses the GL-convention of
placing the origin in the left-bottom corner

- map texture coordinates of the screen capture
properly

- add the ability to control the animation
speed through a debug property

Bug: 4989276

Change-Id: Ifb3297bb578078b47146fff666c01f85417e0d6f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
7e918860f9d496bf0c4b7e1649216c9209c57850 06-Jul-2011 Mathias Agopian <mathias@google.com> Merge "don't kill surfaceflinger when system process dies"
1f339ff3875afad128a8e16ee6395c5fad295826 02-Jul-2011 Mathias Agopian <mathias@google.com> don't kill surfaceflinger when system process dies

Change-Id: I2d3ed87b590f9ccea3fa4af41d92911de070b315
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
d9e8c64c3dce1612eb948a5c16ba4ff62202b423 01-Jul-2011 Mathias Agopian <mathias@google.com> return an error code with gralloc buffer allocation failures

Change-Id: I471e5d37ea7a42fc8a0f93446ee3b4229da37807
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
2dbf9fffb2c99bc7f9dadf226772fd8cafc7826f 01-Jul-2011 Mathias Agopian <mathias@google.com> fix screen on/off animation, which was flipped

Bug: 4673549
Change-Id: Ia9766754687b89c1ee24b2dbe918c11290ebe038
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
698c0873cf2e07bdc7fd1e72169aee2a19fa40d7 29-Jun-2011 Mathias Agopian <mathias@google.com> SF transactions are now O(1) wrt IPC instead of O(N).

Change-Id: I57669852cbf6aabae244ea86940a08a5a27ffc43
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
99b49840d309727678b77403d6cc9f920111623f 28-Jun-2011 Mathias Agopian <mathias@google.com> PermissionCache caches permission checks

This is intended to absorb the cost of the IPC
to the permission controller.
Cached permission checks cost about 3us, while
full blown ones are two orders of magnitude slower.

CAVEAT: PermissionCache can only handle system
permissions safely for now, because the cache is
not purged upon global permission changes.

Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a67932fe6864ac346e7f78b86df11cf6c5344137 20-Apr-2011 Mathias Agopian <mathias@google.com> unify SurfaceTexture and Surface

Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
dea20b1f343012d58ca9eb381684b26a168dc127 04-May-2011 Mathias Agopian <mathias@google.com> Fix a race in SurfaceFlinger that could cause layers to be leaked forever.

The transaction flags were atomically read-and-cleared to determine if
a transaction was needed, in the later case, mStateLock was taken to
keep the current state still during the transaction. This left a small
window open, where a layer could be removed after the transaction flags
were checked but before the transaction was started holding the lock.
In that situation eTraversalNeeded would be set but only seen during the
next transaction cycle; however, because we're handling this transaction
(because of another flag) it will be commited, "loosing" the information
about the layer being removed -- so when the next transaction cycle due
to eTraversalNeeded starts, it won't notice that layers have been removed
and won't populated the ditchedLayers array.

Change-Id: Iedea9e25fee8dd98a0c5bd5ad41a20fcadf75b47
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4f113740180b6512b43723c4728f262882dc9b45 04-May-2011 Mathias Agopian <mathias@google.com> Fix a race-condtion in SurfaceFlinger that could lead to a crash.

Client::mLayers could be accessed from different threads.
On one side from Client::attachLayer() which is currently
called from a binder thread; on the other side from
Client::detachLayer() which is always called from the main
thread.

This could lead to a corruption of Client::mLayers.

We fix this issue by adding an internal lock to Client.

Change-Id: Ib1317d7750ed5030e6f577efe34b69fc10198bd3
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0ef4e15a6c12778daf464a4953d7e15e651f49ac 20-Apr-2011 Mathias Agopian <mathias@google.com> Get rid of the "pid" parameter from createSurface

Change-Id: I28635e3f803e6abe965d79998e305f54a202465d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4cb18881b55b82a24873ccd8e298bc2d5a9c17e5 09-Apr-2011 Mathias Agopian <mathias@google.com> Fix a GraphicBuffer leak in SurfaceTexture

This leak was intentional, it was there to deal with the fact that
some gralloc implementations don't track buffer handles with
file-descriptors so buffers needed to stay alive until there were
registered, which is not guaranteed by binder transactions.

In this new implementation, we use a small BBinder holding a
reference to the buffer, which with tuck into the parcel. This forces
the reference to stay alive until the parcel is destroyed, which
is guaranteed (by construction) to happen after the buffer is
registered.

this allows the public facing API to not expose the previous hack.

Change-Id: I1dd6cd83679a2b7457ad628169e2851acc027143
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1bbafb96101de04c43adb5e3ca2494070d20a46a 12-Mar-2011 Mathias Agopian <mathias@google.com> Fix some const-ness and comments

mDrawingState doesn't need to be accessed by the
mStateLock, because by definition it's only accessed
from the main thread.

Similarily, the list of layers in the drawing state
cannot change (ie: is const).

Change-Id: I2e5da7f4d8caee7af7802b432cd45cc81c7c08b0
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
134f0422866e8985188ed10dfbdcb8e6c34b87f7 08-Mar-2011 Jamie Gennis <jgennis@google.com> ANativeWindow: add queues-to-window-composer check.

This change adds a new 'method' to the ANativeWindow interface to check
whether buffers queued to the window will be sent directly to the system
window compositor.

Change-Id: I4d4b199e328c110b68b250029aea650f03c8724d
Bug: 3495535
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1c71a47a6db679a3212f0c99e14f330d6da500fa 03-Mar-2011 Mathias Agopian <mathias@google.com> remove some logs

Change-Id: Ia476184048ee419e19330a56dc8e6553189f6a24
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
d1ad86f66b070eaf81f8bee41a2528d5da9363f1 28-Feb-2011 Jamie Gennis <jgennis@google.com> am e630e5f4: am 919853ce: Merge "Prevent SurfaceFlinger from using layer token 31." into gingerbread

* commit 'e630e5f49ba15005172dceeda7299569b2d2351f':
Prevent SurfaceFlinger from using layer token 31.
8a08392833a2db80aef20fba8a43f0829a096e13 11-Feb-2011 Jamie Gennis <jgennis@google.com> Prevent SurfaceFlinger from using layer token 31.

Bug: 2964479
Change-Id: I81e948924bff35b8b300d409f2c09f3779bcdeec
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
bce26daaaf4ea245ccb09d75a378d294e518d945 03-Feb-2011 Mathias Agopian <mathias@google.com> [3418265] apply layer transformations to the DimLayer.

with this change DimLayers will behave just like any other layer,
in particular they'll respect the layer transformations.

Change-Id: Icb4a1275e8bca9e3deb5f57c9f9219aaa69f9877
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0d1561275e80073807ac04728951782d943f8882 26-Jan-2011 Mathias Agopian <mathias@google.com> fix [3385504] Surface flinger hang when adding dim surface

Change-Id: I8e0cda414bcad5854d2ca5dde8370bfd8b2e5ea4
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
d1a99ec6b2f23db5662e6d2ccf7b40d96869eccb 19-Jan-2011 Mathias Agopian <mathias@google.com> fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)

Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.

The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.

This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.

Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.

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.
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
53a67e1663564efd691461659634f9e908407112 15-Jan-2011 Mathias Agopian <mathias@google.com> partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)

We used to guarantee that a layer in SurfaceFlinger would never be
destroyed before all references (to its ISurface) on the client
side would be released. At some point, this guarantee got
relaxed to allow to free gralloc resources sooner. This last
change was incorrect, because:
- in implementations with reference-counting the gralloc resources
wouldn't be released anyways, until all the mapping were gone
- in implementations without ref counting, the client side
would most likely crash or do something bad
- it also caused the SharedBufferStack slot to be reallocated
to another surface, which could be problematic if the client
continued to use the surface after the window manager destroyed it.

So, we essentially reinstate the guarantee that layers won't be
destroyed until after all references to their ISurface are
released.

NOTE: This doesn't entirely fix 3306150 because there is another
problem there where the Browser continues to use a surface after it
has been destroyed.

also improve SurfaceFlinger 'dumpsys' log

list the purgatory, which shows windows that have been closed,
but for which the client still has references.
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
cfb676f1aeb8648699bf23e987c3a752275519ca 17-Dec-2010 Mathias Agopian <mathias@google.com> fix a small bug that caused screenshot to show garbage in some cases (DO NOT MERGE)

we were not clearing the screen entirely, which caused garbage when
the screen wasn't entirely covered by windows.

Change-Id: Ia7aa13c36a8a314e0e8427d419b16b9aa2165ddf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
5dc7e7da9273a5b40a85f8f6177793a23669cf98 15-Dec-2010 Mathias Agopian <mathias@google.com> workaround [3201922] display not on: log full of gralloc errors (DO NOT MERGE)

we make sure to call compositionComplete after everytime we do
composition with the GPU (even for the screenshot case), which is
where the buffer locks are released.

Change-Id: I450430d1e4d1ee9ce1023970642378c42cdcfa4c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0c2648ab644b22100c1e80801d05278f9ac729e9 25-Jan-2011 Mathias Agopian <mathias@google.com> tone down the log spew regarding taking screenshots.

Change-Id: I673806bda23eba6aab25f7505b7e0170afc9920b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a9f54a77cd4057b0fddb0c6886357152548bf891 20-Jan-2011 Mathias Agopian <mathias@google.com> Merge "fix [3369743] SurfaceFlinger reads hardware composer hints before calling hwc.prepare()" into honeycomb
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/SurfaceFlinger.cpp
48b888aab9fdcfba250722dffbdffe61f11c64f3 20-Jan-2011 Mathias Agopian <mathias@google.com> improve SurfaceFlinger 'dumpsys' log

list the purgatory, which shows windows that have been closed,
but for which the client still has references.

Change-Id: I5168bb88cb328d5d77d71d0871deb9190f493126
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f20a32415d055336bc6016fa2de36d126db32746 20-Jan-2011 Mathias Agopian <mathias@google.com> fix [3369743] SurfaceFlinger reads hardware composer hints before calling hwc.prepare()

Change-Id: If3277c7b9d4cb8ef20d1706155fac7b87e64fb20
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c1d1b0d9b74d8f55346d0b84f369e48ecf2e0d33 16-Jan-2011 Mathias Agopian <mathias@google.com> Add logs when taking a screenshot to help tracking issue 3361121

Change-Id: I61d1e072ebe7061ee1d7255f6121b684e2923d1b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0d3dcc4aab864e4e4086b070c08949d369239f22 15-Jan-2011 Mathias Agopian <mathias@google.com> Merge "partially fix [3306150] HTML5 video with H/W acceleration blackout" into honeycomb
76cd4ddc6ad664257739b3d3713fd9ebdc9a4ad9 15-Jan-2011 Mathias Agopian <mathias@google.com> partially fix [3306150] HTML5 video with H/W acceleration blackout

We used to guarantee that a layer in SurfaceFlinger would never be
destroyed before all references (to its ISurface) on the client
side would be released. At some point, this guarantee got
relaxed to allow to free gralloc resources sooner. This last
change was incorrect, because:
- in implementations with reference-counting the gralloc resources
wouldn't be released anyways, until all the mapping were gone
- in implementations without ref counting, the client side
would most likely crash or do something bad
- it also caused the SharedBufferStack slot to be reallocated
to another surface, which could be problematic if the client
continued to use the surface after the window manager destroyed it.

So, we essentially reinstate the guarantee that layers won't be
destroyed until after all references to their ISurface are
released.

NOTE: This doesn't entirely fix 3306150 because there is another
problem there where the Browser continues to use a surface after it
has been destroyed.

Change-Id: I305c830dd722b30a6d53cbf3a9c714fd3cf7eb06
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a49576f06b73893fd957d974382390a47b44589e 14-Jan-2011 Mathias Agopian <mathias@google.com> Merge "fix [3312683] Camera mirroring problem after switching from back to front camera" into honeycomb
ad456f9878ff7c176499e7b992f9ff1cb3e9cdee 14-Jan-2011 Mathias Agopian <mathias@google.com> fix [3312683] Camera mirroring problem after switching from back to front camera

the crop as well as buffer orientation can change at every frame, when that happens
we need to reset the hwc HAL (ie: set the GEOMETRY_CHANGED flag).
currently we achieve this by taking the same code path than an actual geometry change
which is a bit more heavy than necessary.

Change-Id: I751f9ed1eeec0c27db7df2e77d5d17c6bcc17a24
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
9a78c90cd46b2a3bd637b056873149d3b94384b4 13-Jan-2011 Jamie Gennis <jgennis@google.com> Fix remote GraphicBuffer allocation in SurfaceFlinger.

This change fixes a horrible hack that I did to allow application
processes to create GraphicBuffer objects by making a binder call to
SurfaceFlinger. This change introduces a new binder interface
specifically for doing this, and does it in such a way that
SurfaceFlinger will maintain a reference to the buffers until the app is
done with them.

Change-Id: Icb240397c6c206d7f69124c1497a829f051cb49b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
495633406580685dfaa41979bbae47fc5f77fefe 20-Dec-2010 Jamie Gennis <jgennis@google.com> Add the ISurfaceComposer::createGraphicBuffer IPC.

This change adds a new binder method to the ISurfaceComposer interface.
This IPC is intended to allow SurfaceFlinger clients to allocate gralloc
buffers using SurfaceFlinger as a proxy to gralloc.

Change-Id: Ide9fc283aec5da6268ba62cfed0c3319a50b640d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f653b897a449e10d6cbfb6e0812f7b0bb02d6482 17-Dec-2010 Mathias Agopian <mathias@google.com> fix a small bug that caused screenshot to show garbage in some cases

we were not clearing the screen entirely, which caused garbage when
the screen wasn't entirely covered by windows.

Change-Id: Ie9ab9b94eabfa6cafddf45bb14bc733bdc8d35c0
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
e6f0984361f634ff36bc0ad1c2d45f4554619ac8 15-Dec-2010 Mathias Agopian <mathias@google.com> workaround [3201922] display not on: log full of gralloc errors

while we're waiting for the real fix in the gralloc/gpu driver,
this workaround should resolve the issue.

we make sure to call compositionComplete after everytime we do
composition with the GPU (even for the screenshot case), which is
where the buffer locks are released.

Change-Id: I3cb5ad67d48c81a23100172bab77e86a70e29152
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
ebeb7095961e09f5cff0c7cf2c04fa4770b2e033 15-Dec-2010 Mathias Agopian <mathias@google.com> fix debug.sf.showbackground

Change-Id: Ie4eeca006ad6d8030900d8cb0029e4d1c22474fb
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
bf2c6a6c8f1df40ac94e28b948754bb9739daaca 11-Dec-2010 Mathias Agopian <mathias@google.com> [3258939] Need snapshot to limit which layers are included

Change-Id: Id7351a0e3f53dde99b291cffba553d89fd4d7ca9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1293a8eb567fd63c072a6970fa9dcf37d076059f 09-Dec-2010 Mathias Agopian <mathias@google.com> More clean-up. Get rid off the "blur" effect in SurfaceFlinger

For multiple reason, this effect is not maintainable and was never
used due to its abysmal performance. it'll be resurected when it can be
implemented efficiently.

Change-Id: Id4222c9b86c629275cdec18873ef07be8723b6d2
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a5529c8778c2f407f482fc12165aeb76c0f505c2 08-Dec-2010 Mathias Agopian <mathias@google.com> remove support for PUSH_BUFFER surfaces and overlays

the same functionality is now supported through
the h/w composer HAL, and YUV support in the GPU.

Change-Id: I8146605449954b8e8fd7f78810b7d873c2d8f5bf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
1d21a9cafc534c34a2f28c985c4c7aa176d0e67b 02-Dec-2010 Erik Gilling <konkers@android.com> surfaceflinger: add support for gralloc dump hooks

Change-Id: Ib6f539ed0132b70d040d653c03d52cc04249ac3c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
e24cc7a38dce071267156a9345e9ec3f27890daf 08-Dec-2010 Mathias Agopian <mathias@google.com> [317580] fix issue where the screen wouldn't be rotated properly in bypass mode

In some situations, the screen transformation would not be
applied while in bypass mode.

Change-Id: I3d6dd52e4c12b11aae97b54bf8e2322536eee37f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
22c67843bebd2083053af5992befe7ebd50303a5 02-Nov-2010 Mathias Agopian <mathias@google.com> [3171580] SurfaceFlinger Bypass mode. (DO NOT MERGE)

This is a poor's man precursor to the h/w composer HAL.
Basically we detect when a window is full screen and in
that case we bypass surfaceflinger's composition step, which
yields to much improved performance.

Change-Id: Ie03796ae81a1c951949b771c9323044b980cb347
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
37b126a3b274e1930fbbddcdf3ec708d13d01801 10-Nov-2010 Jamie Gennis <jgennis@google.com> Remove a problematic empty update optimization.

This change removes an optimization from SurfaceFlinger that skipped
composition when it got window updates that had an empty dirty region.
This optimization caused problems because it would skip the hwcomposer
set call, which could leave the window's previous frame buffer bound to
an overlay plane. When the application subsequently dequeued and tried
to lock its next buffer (which would be the buffer currently bound to
the overlay), the lock call would block until the next hwcomposer set
call (which may never happen).

Change-Id: I563b626a1d52c1f30eb82489eae0ceb4edc79936
Bug: 3138752
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
0a96e3c31f137fd4e271c1fb2aef9aa0b6e79ce0 16-Oct-2010 Mathias Agopian <mathias@google.com> am 9f6d18ca: am 04358138: Merge "[3095807] screen takes a long time to turn on" into gingerbread

Merge commit '9f6d18cadf9ac50062063f5f5ff5de7f6895696a'

* commit '9f6d18cadf9ac50062063f5f5ff5de7f6895696a':
[3095807] screen takes a long time to turn on
fb3051b15e15b0f57196e0f2bc6ba8570f7ffe5e 16-Oct-2010 Mathias Agopian <mathias@google.com> am 7e9a54d4: am d4e03f37: addresses parts of 3096779 and 3097475

Merge commit '7e9a54d460030a871a4f05e61e943c6a694e9ef8'

* commit '7e9a54d460030a871a4f05e61e943c6a694e9ef8':
addresses parts of 3096779 and 3097475
1cc53746aa8f548349385af7134af1135cfd1d5e 16-Oct-2010 Mathias Agopian <mathias@google.com> am a8faf91f: am 6d71f6a0: Merge "fix [3095607] Gingerbread screen turn-on animation does not show the last frame" into gingerbread

Merge commit 'a8faf91fa558be1235d508e776eb24be4429585c'

* commit 'a8faf91fa558be1235d508e776eb24be4429585c':
fix [3095607] Gingerbread screen turn-on animation does not show the last frame
c9ce8cbe3bc1cd75598ab67081fe8b96199bfd31 15-Oct-2010 Mathias Agopian <mathias@google.com> am 3d4a9774: am b0e020ab: Merge "may fix 3097381 and 3097482. don\'t abort on/off if the animation fails" into gingerbread

Merge commit '3d4a9774ced0c704da455c5bd9989127e90ba133'

* commit '3d4a9774ced0c704da455c5bd9989127e90ba133':
may fix 3097381 and 3097482. don't abort on/off if the animation fails
e33a35f02576b482a5ac4891a78f6e72fb4c0dea 15-Oct-2010 Mathias Agopian <mathias@google.com> am 5bfa3a34: am 011b5bcc: Merge "implement part of [3094280] New animation for screen on and screen off add support for screen on animation" into gingerbread

Merge commit '5bfa3a34eaef759c3ec4def76f646eb1c0bf997f'

* commit '5bfa3a34eaef759c3ec4def76f646eb1c0bf997f':
implement part of [3094280] New animation for screen on and screen off
a6546e5af4ce0cff01cd13605fc3eb16325feac3 14-Oct-2010 Mathias Agopian <mathias@google.com> [3095807] screen takes a long time to turn on

turn on animation is now ~200 ms (12 frames).

Change-Id: I49ca9e8d0afa566349d360b3b6c88f0d55aa6e75
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
abd671a08a41519a7ab3d438a500efe0ef0bfc1d 14-Oct-2010 Mathias Agopian <mathias@google.com> addresses parts of 3096779 and 3097475

3097475: Animation setting should control the screen on animation
3096779: CRT power-on animation can briefly show the top app instead of lockscreen

There is now a parameter that controls wether the ON and/or OFF animation are
performed. we also always clear the screen to black on power off, to make
sure it won't briefly appear on power on.
HOWEVER, 3096779 is not 100% fixed in the case where we're doing the animation
because there is a race, where SF doesn't wait (b/c it doesn't know) for the
framework to have redrawn the lockscreen.

Change-Id: Ie0f02c9225fcdf24b1e8907e268eb7da2c5b0a03
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a7f0373533e590fdca1400f90e6657ebb2dd5f17 14-Oct-2010 Mathias Agopian <mathias@google.com> fix [3095607] Gingerbread screen turn-on animation does not show the last frame

always redraw the screen entirely after the power-on animation, because:
- the animation may not run (ie: on the emu)
- the animation may not contain the video planes
- the interpolation may not be perfect and not land exactly on the last frame

Change-Id: I9ba40f537b1e94464f8a3ed6f81e7c2f552df51d
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
015fb3fb41ffe04475ab2b604cc30cc1c031815a 14-Oct-2010 Mathias Agopian <mathias@google.com> may fix 3097381 and 3097482. don't abort on/off if the animation fails

now that sf handles more of the screen on/off state, we don't want to abort
because/if the animation fails for some reason (which will be the case on the
emulator).

Change-Id: I239e0a39cf8aff3074647e82db92de4a0bf0e494
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
503d2d4a08370209dc83330bd00997ba9512f46f 14-Oct-2010 Joe Onorato <joeo@google.com> am 9a12a3c8: am ba799098: Merge changes I76513387,I335fb671 into gingerbread

Merge commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96'

* commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96':
Remove dead code, and make the animation a setting.
turn off the electron beam
9daa5c9b9dd286cbbf5d43f7e45a5e9e4048e855 13-Oct-2010 Mathias Agopian <mathias@google.com> implement part of [3094280] New animation for screen on and screen off
add support for screen on animation

Change-Id: If50cf52ae04b95b42da7d74cf7fa96d5cb54d238
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
59119e658a12279e8fff508f8773843de2d90917 11-Oct-2010 Mathias Agopian <mathias@google.com> turn off the electron beam

Change-Id: I335fb6719f1d5a3f1c6f37a046fd1c2c4ed2bbc6
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
a3aefeb1c31618dcc897da22d2d2f741104e3fe3 25-Sep-2010 Mathias Agopian <mathias@google.com> am 495ad4f2: am beabe75a: Merge changes I1f7c4535,I741c68a2 into gingerbread

Merge commit '495ad4f22096aa172d025c16c25497e7dad8f2bd'

* commit '495ad4f22096aa172d025c16c25497e7dad8f2bd':
simple test app for screen capture API
add support for [1974164] Be able to take a screen shot on the device
1b0b30d04304392748a8a4ab5a69e52a19f51b3a 24-Sep-2010 Mathias Agopian <mathias@google.com> add support for [1974164] Be able to take a screen shot on the device

screenshots are taken using ISurfaceComposer::captureScreen() which returns
the size of the screenshot and an IMemoryHeap containing the data.
screenshots have limitations:
- they will always fail if a secure window is up on screen
- require GL_OES_framebuffer_object extension
- in some situation, video planes won't been captured

Change-Id: I741c68a2d2984fb139039301c3349e6780e2cd58
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8372785879d329f592f6883620b5a32d80d74691 24-Sep-2010 Mathias Agopian <mathias@google.com> dump HWC state in dumpsys

Change-Id: Ifbb38ca1ac9685776250e01c8d02021b35af72cf
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
73d3ba9e50be1014aa21ec4bbdc874be394accb4 23-Sep-2010 Mathias Agopian <mathias@google.com> add a way to toggle the h/w composer at runtime

to DISABLE the h/w composer:
adb shell service call SurfaceFlinger 1008 i32 1

to ENABLE the h/w composer:
adb shell service call SurfaceFlinger 1008 i32 0

the state is dumped in "dumpsys SurfaceFlinger"

Change-Id: I23e2242d42c6e3fd5261a83332dd900b189e38ce
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
fe0a0af7bdab1e61fdb00f4705ccff5b46c19d8e 17-Sep-2010 Mathias Agopian <mathias@google.com> am 793b2293: am 1bcb8b1a: Merge "surfaceflinger / GL extensions cleanup" into gingerbread

Merge commit '793b2293797ea930078640c4827d3cbdf449c227'

* commit '793b2293797ea930078640c4827d3cbdf449c227':
surfaceflinger / GL extensions cleanup
7f198b6bff54af3c8e8ac32b83ffc6488e773ac1 16-Sep-2010 Michael I. Gold <gold@nvidia.com> surfaceflinger / GL extensions cleanup

Add correct enumerants for OES_EGL_image_external to glext.h.
SurfaceFlinger now checks for the correct extension name.

Change-Id: I2ba2728a01fa2260bd086d2df4316c68f694a9b1
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
c479e18db0216f7096fefe85ffa71ab00329aef3 15-Sep-2010 Mathias Agopian <mathias@google.com> resolved conflicts for merge of 48a86240 to master

Change-Id: I2305fef9f4dd46183337217d822df3c675b6b6e5
35b48d10bc9e064201d3d54d2d476314684a7a05 14-Sep-2010 Mathias Agopian <mathias@google.com> Add logging of various important graphics events

There are 16 events logged in the event log:
SF_APP_DEQUEUE_BEFORE
SF_APP_DEQUEUE_AFTER
SF_APP_LOCK_BEFORE
SF_APP_LOCK_AFTER
SF_APP_QUEUE

SF_REPAINT
SF_COMPOSITION_COMPLETE
SF_UNLOCK_CLIENTS
SF_SWAP_BUFFERS
SF_REPAINT_DONE

SF_FB_POST_BEFORE
SF_FB_POST_AFTER
SF_FB_DEQUEUE_BEFORE
SF_FB_DEQUEUE_AFTER
SF_FB_LOCK_BEFORE
SF_FB_LOCK_AFTER

all events log the buffer conserned and a timestamp in microseconds.

by default the logging is not enabled, to turn it on:
adb shell service call SurfaceFlinger 1006 i31 1
adb shell setprop debug.graphic_log 1

The effect is immediate in SurfaceFlinger, but applications need to be
restarted.

Change-Id: Ifc2e31f7aed072d9a7dede20ff2ce59231edbec1
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
586a0deb76012c4347298c11df460631853b67f8 09-Sep-2010 Antti Hatala <ahatala@nvidia.com> surfaceflinger: composite HWC_SKIP_LAYER layers

Change-Id: I363ede63287ae903d66d0d419343f4ecd81bcc00
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8392b504bdf63ac7820c79c7217a89f2b2411bd0 08-Sep-2010 Antti Hatala <ahatala@nvidia.com> surfaceflinger: unlock clients only after flip

Change-Id: I039291a36f05bbaa02b29325d4012114abd784b9
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
89c2dd2cc27ead77da131fe27810c99a11a92ad7 11-Aug-2010 Jamie Gennis <jgennis@google.com> Change the framework to use the new camera preview path.

This change makes the camera HAL interface take an ANativeWindow interface from
which all the camera preview buffers will be allocated. The framework code
running in application processes now passes a Surface object rather than an
ISurface to the camera server via Binder when setting the preview surface. The
camera server then forwards that Surface object (which implements the
ANativeWindow interface) to the camera HAL, which uses it to communicate with
SurfaceFlinger to allocate the camera preview buffers.

Change-Id: Ie438f721559cd7de5e4f848a26d96360dda07b5f
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
8b42e8a5d87dcdc8ea31368ab88de49b72ab5432 16-Aug-2010 Andreas Huber <andih@google.com> Squashed commit of the following:

commit 35cc68814a9537c31fde146e171e7b0bbdfe211e
Author: Andreas Huber <andih@google.com>
Date: Mon Aug 16 08:48:42 2010 -0700

Only enable support for yuv to yuv conversion on passion, where it's available, use the slower yuv->rgb565 path everywhere else.

commit d8ac5a8814103e60d11d2acf61997fc31a1dc58d
Author: Andreas Huber <andih@google.com>
Date: Fri Aug 13 13:56:44 2010 -0700

The software renderer takes over all rendering, converting from yuv to yuv if possible and rgb565 otherwise.

commit 684972074b74318bdcb826ed9b5b0864d2d2e273
Author: Andreas Huber <andih@google.com>
Date: Fri Aug 13 09:34:35 2010 -0700

A first shot at supporting the new rendering APIs.

Change-Id: Iea9b32856da46950501f1a700f616b5feac710fd
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp
ae957658688ce174a8d58434b4567d022c22a6cf 13-Aug-2010 Erik Gilling <konkers@android.com> surfaceflinger: don't check HWComposer numLayers unless one exists

Change-Id: I4b83f7bf7ba1318c70054117f14e759fe0ad105c
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
24925bfba22ac24de8dedc8f2c1cad5be7ade14f 13-Aug-2010 Erik Gilling <konkers@android.com> surfaceflinger: don't check HWComposer numLayers unless one exists

Change-Id: I6524f46910b761cff3ef696edf5a65a424879faa
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
45721773e1a68e96da4b6cc04cef276bae7ca3e9 13-Aug-2010 Mathias Agopian <mathias@google.com> Fix a couple issues with the new hwcomposer HAL

- we now clear the framebuffer upon request from the HAL
- the HAL list size could get out of sync with reality
- there was also an issue where sometime we could run past the list

Change-Id: Ic3a34314aed24181f2d8cc787096af83c046ef27
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a350ff98692b3a50cad5cc93f9f83221242ca86a 11-Aug-2010 Mathias Agopian <mathias@google.com> call into hwcomposer HAL when present

Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
f6679fc6f70939643901f29a9a69e40c603e6e5f 11-Aug-2010 Mathias Agopian <mathias@google.com> get rid of our LayerVector implementation

we now use SortedVector<> with a special compare implementation.

Change-Id: I910459cf3b3c8993b55ad0786a8c348369262de5
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
4da751999358fffa4cefc4c8046dab72045925f6 11-Aug-2010 Mathias Agopian <mathias@google.com> keep a list of visible sorted surfaces

Change-Id: Ib815eeff894f8a3b1e79fbbf8186d5d91bb60285
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
a1e6bc864fb821c1b470b7aad9b75c441f54eeb4 15-Jul-2010 Mathias Agopian <mathias@google.com> added BinderService<> template to help creating native binder services

Change-Id: Id980899d2647b56479f8a27c89eaa949f9209dfe
/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
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/SurfaceFlinger.cpp