History log of /frameworks/native/services/surfaceflinger/Layer.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c1c05de415854eb7a13a16b7e22a22de8515123a 18-Sep-2013 Mathias Agopian <mathias@google.com> fix camera API 2.0 orientation

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

Bug: 10804238
Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2
/frameworks/native/services/surfaceflinger/Layer.cpp
ff2ed70fa30f04b90dd1a2c06ec2319e157152d7 02-Sep-2013 Mathias Agopian <mathias@google.com> color blindness enhancement

This is an attempt at improving the experience of
users with color vision impairement.

At this time this feature can only be enabled for
debugging:

adb shell service call SurfaceFlinger 1014 i32 PARAM

with PARAM:
0 : disabled
1 : protanomaly/protanopia simulation
2 : deuteranomaly/deuteranopia simulation
3 : tritanopia/tritanomaly simulation
11, 12, 13: same as above w/ attempted correction/enhancement

The enhancement algorithm tries to spread the "error"
such that tones that would otherwise appear similar can be
distinguished.

Bug: 9465644

Change-Id: I860f7eed0cb81f54ef9cf24ad78155b6395ade48
/frameworks/native/services/surfaceflinger/Layer.cpp
19733a32799f792125913e746e8644d16f8dc223 29-Aug-2013 Mathias Agopian <mathias@google.com> minor clean-up of the GLESRenderer

Change-Id: I978dea25b7687fbbbb283f09c24e115d9bad49a2
/frameworks/native/services/surfaceflinger/Layer.cpp
4ceff3d5efd27c164788bb2b3f0fd17c691a0204 22-Aug-2013 Mathias Agopian <mathias@google.com> screenshot layers wouldn't work in some cases

specifically when the display size and the screenshot window
size didn't match, the buffer would be rejected.
We simply fix this by setting the scalling mode to
"SCALE_TO_WINDOW".

Bug: 9992306
Change-Id: Ib821767899af330bb70d3cbbfa7d41b02794a075
/frameworks/native/services/surfaceflinger/Layer.cpp
0e8f1443b87f9009159cef6394de48894f98f826 21-Aug-2013 Mathias Agopian <mathias@google.com> Fix a bug where non-cropped layer could be scaled incorrectly

If a layer is not cropped but its bounds are outside of the
viewport (i.e.: clipped), the crop rectangle passed to
hw composer would be invalid because it started invalid
in the first place (to indicate "no crop").

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

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

Bug: 8679321

Change-Id: I388b338a70d07e3e8177dde248710ea1e4c82dff
/frameworks/native/services/surfaceflinger/Layer.cpp
e048a4374c4e355c361f5eec0482ac85df0c73fe 16-Aug-2013 Jesse Hall <jessehall@google.com> Merge "Add support for EGL_KHR_gl_colorspace" into klp-dev
5cdc8994a0ecd751a6350b16a1bef8b6b0d09b11 14-Aug-2013 Mathias Agopian <mathias@google.com> don't reallocate the mesh each time we use it

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

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

Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
/frameworks/native/services/surfaceflinger/Layer.cpp
c2e41222bf02a6579763974f82d65875cfa43481 08-Aug-2013 Jesse Hall <jessehall@google.com> Add support for EGL_KHR_gl_colorspace

Change-Id: I684d0b8556cd6c84ee4b4d67e1bb95c3b96fccfb
/frameworks/native/services/surfaceflinger/Layer.cpp
db89edc94bd2a78226b407f9f7261e202e7fa325 02-Aug-2013 Mathias Agopian <mathias@google.com> All consumers now take an IGraphicBufferConsumer instead of a BufferQueue

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

Bug: 9265647
Change-Id: Ic2e2596ee14c7535f51bf26d9a897a0fc036d22c
/frameworks/native/services/surfaceflinger/Layer.cpp
c2414bb0989763641ca57cf72c11ef6d86565a23 26-Jul-2013 Mathias Agopian <mathias@google.com> get rid of HAL pixelformats 5551 and 4444

Change-Id: I39409103144c1ba09078c4ddc323a58987fb09ea
/frameworks/native/services/surfaceflinger/Layer.cpp
dd533712f8dd21c0dadfd5ce8a0ad85aa3e96ada 27-Jul-2013 Mathias Agopian <mathias@google.com> make transparent pixels transparents again

apparently boolean logic in hard...

Change-Id: Ie70401fe12e0fa00b0b8c7cc475c1438cdbbf531
/frameworks/native/services/surfaceflinger/Layer.cpp
5773d3f5b2694c647e010246dff99acc70131289 26-Jul-2013 Mathias Agopian <mathias@google.com> get rid of PixelFormatInfo and simplify things

Change-Id: I025a362cc12d5b9b794fac14be500e25aab65396
/frameworks/native/services/surfaceflinger/Layer.cpp
6547ff4327aa320fbc9635668d3fc66db7dd78f6 17-Jul-2013 Jamie Gennis <jgennis@google.com> surfaceflinger: add frame duration logging

Change-Id: Ib414a45e7e191f23a2726cbbbeb606e9ce68a3b5
/frameworks/native/services/surfaceflinger/Layer.cpp
595264f1af12e25dce57d7c5b1d52ed86ac0d0c9 17-Jul-2013 Mathias Agopian <mathias@google.com> BufferQueue improvements and APIs changes

this is the first step of a series of improvements to
BufferQueue. A few things happen in this change:

- setSynchronousMode() goes away as well as the SynchronousModeAllowed flag
- BufferQueue now defaults to (what used to be) synchronous mode
- a new "controlled by app" flag is passed when creating consumers and producers
those flags are used to put the BufferQueue in a mode where it
will never block if both flags are set. This is achieved by:
- returning an error from dequeueBuffer() if it would block
- making sure a buffer is always available by replacing
the previous buffer with the new one in queueBuffer()
(note: this is similar to what asynchrnous mode used to be)

Note: in this change EGL's swap-interval 0 is broken; this will be
fixed in another change.

Change-Id: I691f9507d6e2e158287e3039f2a79a4d4434211d
/frameworks/native/services/surfaceflinger/Layer.cpp
8f938a53385a3c6d1c6aa24b3f38437bb2cc47ae 13-Jul-2013 Mathias Agopian <mathias@google.com> always pass the BufferQueue explicitely to consumers

Change-Id: I883b0a7b19d8e722f9ab714ba6f49e658b02ca86
/frameworks/native/services/surfaceflinger/Layer.cpp
c33f9a76b5dff1a9b4e4d0c76459c0d5b36a0d74 11-Jul-2013 Andy McFadden <fadden@android.com> Merge "Pay attention to buffer timestamps"
1585c4d9fbbba3ba70ae625923b85cd02cb8a0fd 28-Jun-2013 Andy McFadden <fadden@android.com> Pay attention to buffer timestamps

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

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

Bug 7900302

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

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

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

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

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

Bug: 8679321

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

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

Change-Id: Ieb7b4951b40fc673b807994ed21ae4aea7281068
/frameworks/native/services/surfaceflinger/Layer.cpp
29c3f352797d9d2ddf055d8f888e7694ef8b3947 22-May-2013 Jesse Hall <jessehall@google.com> Prevent opaque windows from making framebuffer translucent

To keep the code readable now that we have four different texenv
configurations, this change separates the decisions about what
configuration to use from the GL calls to set up the configuration.

Bug: 8963244
Change-Id: Ia07a306a7809ba8f93493d0160ccbd509e948581
/frameworks/native/services/surfaceflinger/Layer.cpp
f3e85d432749ca77ad707bec523b67d741d43e6e 11-May-2013 Mathias Agopian <mathias@google.com> take the "transparent region" into account for blending

until now it was only used to discard a layer entirely.
we're now reducing the size of the layer if it is still
visible, if possible.

this works for instance when a surfaceView is used and
only the menu bar is displayed over it.

Change-Id: I3f5527c5cd1e69ecc968272c8948f1513ada8c55
/frameworks/native/services/surfaceflinger/Layer.cpp
6c7f25afb75ac155bad0b3bc17c0089d0337d060 10-May-2013 Mathias Agopian <mathias@google.com> reformat Rect.{cpp|h}

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

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

Change-Id: I0d9f18d115401cb45109d244ef3a278481f68cc6
/frameworks/native/services/surfaceflinger/Layer.cpp
74d211ae26a0257c6075a823812e40b55aa1e653 22-Apr-2013 Mathias Agopian <mathias@google.com> clean-up/simplify all dump() APIs

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

Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
/frameworks/native/services/surfaceflinger/Layer.cpp
6c67f0fe457f758fc875e1178d8fd5258fd8f6df 13-Apr-2013 Mathias Agopian <mathias@google.com> make sure to update the "current state" when we "fake" the transaction

this mimics the code we used for the size. basically we need to
also update the "current state" because it gets copied to the
"drawing state" when a transaction occurs, and it would
"undo" our change.

Bug: 8511430
Bug: 8581533
Change-Id: I08c02abbf21b7f168f7124cd14ee717d7d3d502c
/frameworks/native/services/surfaceflinger/Layer.cpp
2ca79399b933935eb1b6c0ec1f746f8c4475369c 03-Apr-2013 Mathias Agopian <mathias@google.com> latch transparent region hint only when we get a new frame

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

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

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

Change-Id: Iac70584a2207940730e8f803a543e4e9a4000c47
/frameworks/native/services/surfaceflinger/Layer.cpp
6710604286401d4205c27235a252dd0e5008cc08 15-Mar-2013 Mathias Agopian <mathias@google.com> get rid of purgatory and fix QueuesToWindowComposer query

the purgatory list wasn't needed anymore; in fact it had no effect as
buffer life-time management is now handled by the BufferQueue.

For QueuesToWindowComposer we keep a list of wp<> on the IBinder
for IGraphicBufferProducers we hand over to clients so we can
easily check if an IGraphicBufferProducer is ours. We clean-up the
list when our IGraphicBufferProducer are destroyed.

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

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

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

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

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

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

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

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

Change-Id: Ib7769bdec0917dd248f926600c14ddf9ea84897a
/frameworks/native/services/surfaceflinger/Layer.cpp
789a6c3f1dfe22a1ffea7f39b2098d7842cd1f30 25-Feb-2013 Jamie Gennis <jgennis@google.com> SurfaceFlinger: fix a couple NULL fence checks

This change replaces checks for a NULL fence pointer with calls to
Fence::isValid. There should no longer be NULL fences.

Change-Id: If17c9c132fcb1801531bf7588f8ba53476c57dad
/frameworks/native/services/surfaceflinger/Layer.cpp
1df8c345854155cbbcb9f80de9d12d66ea70ac08 20-Dec-2012 Jamie Gennis <jgennis@google.com> libgui: disallow NULL Fence pointers

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

Bug: 7892871
Change-Id: I5360aebe3090422ef6920d56c99fc4eedc642e48
/frameworks/native/services/surfaceflinger/Layer.cpp
351c2941736039c495dd7ac849ec64fbf7f3ff05 11-Feb-2013 Jamie Gennis <jgennis@google.com> Merge changes I8bded1ea,I7478293e

* changes:
SurfaceFlinger: add win anim frame time tracking
SurfaceFlinger: remove a driver bug workaround
4b0eba949cc026ffb2c75313042d8a7bcb3fcf86 05-Feb-2013 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add win anim frame time tracking

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

Change-Id: I8bded1ea08a4cddefef0aa955401052bb9107c90
/frameworks/native/services/surfaceflinger/Layer.cpp
9f8386e1118c10dd4927f62637ec7162569bdbdc 30-Jan-2013 Mathias Agopian <mathias@google.com> Add support for plane-alpha in HWC

Change-Id: I218e7dd5f23de535aabce61e993002ab6cb46cdd
/frameworks/native/services/surfaceflinger/Layer.cpp
33c544c4d3af8bae518474df6a9da9b7c349b91a 04-Feb-2013 Jamie Gennis <jgennis@google.com> SurfaceFlinger: remove a driver bug workaround

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

Also, minor tweak to SurfaceTextureLayer.

Change-Id: If616d5ee4e8226dd0e16c5dbb0e0f80db553110e
/frameworks/native/services/surfaceflinger/Layer.cpp
2adaf04fab35cf47c824d74d901b54094e01ccd3 18-Dec-2012 Andy McFadden <fadden@android.com> Rename ISurfaceTexture and SurfaceTexture

The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.

Bug 7736700

Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
/frameworks/native/services/surfaceflinger/Layer.cpp
97eba8904c2f221c42a9473407223a4c3a213f75 12-Dec-2012 Andy McFadden <fadden@android.com> Avoid unnecessary texture bind

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

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

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

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

Change-Id: Ia566e4727945e2cfb9359fc6d2a8f8af64d7b7b7
/frameworks/native/services/surfaceflinger/Layer.cpp
46b6bce198c81ce9a4e0583e876d080ad48db003 08-Dec-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: work around a driver bug

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

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

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

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

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

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

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

Change-Id: I323c5f075c58bf86ce363b52af885ad0f6365f2b
/frameworks/native/services/surfaceflinger/Layer.cpp
a4a3149a36bc69a06e4824aeae909ab910661070 29-Oct-2012 Igor Murashkin <iam@google.com> Change ConsumerBase's FrameAvailableListener to be a weak pointer

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

Bug: 7425644
Change-Id: I1514b13a32b18d421c902dddebec0765a989c55c
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
ab10c5804c250e7f392c8262f687766edec2e9f4 27-Sep-2012 Andy McFadden <fadden@android.com> Recompute visible regions more vigorously

Some of the code in latchBuffer was calling invalidateHwcGeometry,
but that didn't cause the SurfaceFlinger visible region code to
re-evaluate the layer's visibility. Set the recomputeVisibleRegions
"out" parameter instead.

Bug 7235797

Change-Id: If6ba33fbd1a594cd64cc5253aebf752d6ceda1c9
/frameworks/native/services/surfaceflinger/Layer.cpp
eba8c688f633f3f3f1b75c2bc64faf799dd2b5f2 20-Sep-2012 Mathias Agopian <mathias@google.com> calculate wether we filter on a per-display basis

Change-Id: I79d80b432b20b3d02428da19add464ac1e2b9378
/frameworks/native/services/surfaceflinger/Layer.cpp
3941cb240d438bfdebe24920bb2ada86456a0bf9 18-Sep-2012 Jamie Gennis <jgennis@google.com> SurfaceTexture: default to doing GL sync

This change makes updateTexImage default to performing the necessary
synchronization and adds an argument for SurfaceFlinger to disable that
synchronization so that it can be performed lazily.

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

Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
/frameworks/native/services/surfaceflinger/Layer.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/Layer.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/Layer.cpp
61e04b92bdeafc6fca89052d14dab1bd0c384a71 10-Sep-2012 Jamie Gennis <jgennis@google.com> SurfaceTexture: use eglWaitSync

This change adds a compile-option to use eglWaitSyncANDROID to ensure that
texturing operations that access the current buffer of a SurfaceTexture do not
occur until the buffer is completely written. It also moves this
synchronization into a new SurfaceTexture method called doGLFenceWait and
changes SurfaceFlinger's Layer class to use that method rather than performing
its own wait on the fence.

Change-Id: I70afa88086ca7ff49a80e3cd03d423767db7cb88
/frameworks/native/services/surfaceflinger/Layer.cpp
71e83e1202dc87afde9c0c31f31c129f3f99263f 05-Sep-2012 Mathias Agopian <mathias@google.com> the visibleRegion was never set in hwcomposer

Bug: 7089478
Change-Id: I13b031b23ce908d33f431a04e1cf87831b551260
/frameworks/native/services/surfaceflinger/Layer.cpp
c39736088398a9b4367b30fc307ed7de96ac342e 01-Sep-2012 Mathias Agopian <mathias@google.com> the visible region sent to HWC was garbage

we used to have a visibleRegion object per layer, but now
it's per screen; so at somepoint the code got changed to
calculate the per-screen visible region on the stack and that's
what got passed to HWC.

we're now setting the visibleRegionScreen at each frame and
freeing at after the HWC set() call. We use the underlaying
SharedBuffer so that in most cases we don't have to allocate,
free or copy memory around.

Bug: 7089478
Change-Id: I24fa556c76613a225d9fe7a6c6b727bb476144d8
/frameworks/native/services/surfaceflinger/Layer.cpp
31a353da225af5329735451c761b430d82dfda1b 25-Aug-2012 Jamie Gennis <jgennis@google.com> BufferQueue: clean up buffer counting

This change is a clean up of some of the handling of the maximum number of
buffers that are allowed at once. It mostly renames a few member variables and
methods, but it includes a couple small refactorings.

Change-Id: I9959310f563d09583548d4291e1050a7bbc7d87d
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
3165cc21cfea781988407b19bd83292b19f05f55 09-Aug-2012 Mathias Agopian <mathias@google.com> libgui includes refactoring

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

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

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

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

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

Change-Id: I0f645a42a44803276cae11b904e5a26d65871562
/frameworks/native/services/surfaceflinger/Layer.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/Layer.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/Layer.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/Layer.cpp
0cd545f14261d829513e0d6e8fa5e4e4f3372b3d 07-Jun-2012 Mathias Agopian <mathias@google.com> sometimes we would incorrectly scale the content of a surface

this would happen when a resize was pending (ie: we have received
and processed a resize transaction but have not received a buffer
with the right size) and a new transaction came in that didn't
involve a resize, for instance a translate-only transaction.

in this case, we would incorrectly update the drawing state
with the pending size, eventhough we still don't have a buffer
for it.

the solution is quite simple, we never allow the size to propagate
from current to drawing state during the regular transaction processing
(unless we are in fixed-size mode -- meaning we don't need to have
a matching size buffer), this propagation happens later once we
receive the buffer.

Bug: 6624163
Change-Id: I11a97e4b88a7f3a0571ddcfe99c86cb04ce01a4d
/frameworks/native/services/surfaceflinger/Layer.cpp
4824d40a35333182c2eb3593511b9bcbecd0a943 05-Jun-2012 Mathias Agopian <mathias@google.com> sometimes SF would not process a surface resize

this would happen when a window started with size A, was
resized to B and immediately resized to A. In this situation
the erquested and active size would be the same, and SF
would think a transaction wasn't needed.

we fix this by always comparing the requested sizes.

Also, make sure to set mRefreshPending once we're sure
we have succesfully called updateTexImage().

Bug: 6580962
Change-Id: I2c48b4df7f05fd35c9e1d2dd82095b0f3d5a0b6a
/frameworks/native/services/surfaceflinger/Layer.cpp
e31564d8eb0ab67e167a888eccce20f5b4e4ef45 30-May-2012 Mathias Agopian <mathias@google.com> Fix a crasher is surfaceflinger.

this bug introduced recently would happen when the very first
buffer of a surface was rejected for not having the right size

Bug: 6577035
Change-Id: I9fabf20006019f2a6c308be7c7f5c05bdcfd5014
/frameworks/native/services/surfaceflinger/Layer.cpp
2c8207e9627fe6c7a90e31fae8d71ae49df56845 24-May-2012 Mathias Agopian <mathias@google.com> add the ability to reject buffers in SurfaceTexture::updateTexImage

SurfaceFlinger is using this new feature to reject buffers that
don't have the right size.

Bug: 6498869
Change-Id: I8a7250a47db6c082a357b703feb3b9d0fc8d3443
/frameworks/native/services/surfaceflinger/Layer.cpp
702634a4dad85cfc292618ac91eda6c00f42b7c5 24-May-2012 Mathias Agopian <mathias@google.com> refactoring in preparation for bug:6498869 fix

here we just shuffle a bit the code inside lockPageFlip(),
we move the code that handles the buffer size closer to the call
to updateTexImage(). no functionality change.

Change-Id: Ie3193cd86cd32cf3c89532449fd747d145ca0ab6
/frameworks/native/services/surfaceflinger/Layer.cpp
05cec9d1275fd939c2d1aec235dca2bdb8edef63 23-May-2012 Mathias Agopian <mathias@google.com> improve resize transactions

use a flag instead of pre-committing the "requested" state
to prevent propagation or "requested" to "active", which makes
things a lot clearer when reading the code.

also avoid going through the "resized" code-path when requested
size is equal to "active" size.

Bug: 6498869
Change-Id: I24f893ba0ec5ca06aac5b8da9818989ae7ce4005
/frameworks/native/services/surfaceflinger/Layer.cpp
419e196e639c8adb875da2765abcef95017b6d4a 23-May-2012 Mathias Agopian <mathias@google.com> Improve debug logs and minor clean-up

Bug: 6498869
Change-Id: I14d1b4d6960b87b5a7c4d7e20b92538edd9331ff
/frameworks/native/services/surfaceflinger/Layer.cpp
b30c415539813b96a831b75d07f3d12aef1aeab7 17-May-2012 Mathias Agopian <mathias@google.com> Fix "Battery/Status/Clock status bar area flickers when dragging down"

The crop is now handled like a resize, it's latched only when we
receive a new buffer in the case we have a resize in the same
transaction.

Bug: 6498869
Change-Id: I9f3cbbe08fb19443899461ec441c714748a4fd1a
/frameworks/native/services/surfaceflinger/Layer.cpp
93ffb86b909005bbee4993fc9053f017466311c7 17-May-2012 Mathias Agopian <mathias@google.com> minor refactoring in praparation of crop fix

Bug: 6498869
Change-Id: I12a6f9a9fdfd2ea1db3fbe5fc8cb443aeaedb328
/frameworks/native/services/surfaceflinger/Layer.cpp
cbad735d8cc4ff360341bf12d8c388edcbc78ce3 15-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: recompute visible regions less

This change removes some visible region recomputation that was needed to handle
the SCALING_MODE_FREEZE cropping. We've changed things to use a window crop
from the WindowManager instead, so this is no longer needed.

Bug: 6299171
Change-Id: I32fbc2b689c985837126d8ba3d9a91e79613ffbf
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
51dcd581b1fb1bcea7cac9b969123abda13e34ab 10-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: recompute visible regions more

This change makes a change in the crop, scaling mode, transform, or buffer
dimensions trigger a recomputation of the visible regions of a window. With
the new cropping behavior for SCALING_MODE_FREEZE all of these can now affect
the visible region.

Bug: 6470541
Change-Id: I1904e47efbd708e28bf189f637d24dbef65cd41e
/frameworks/native/services/surfaceflinger/Layer.cpp
161534a3c5ee77bc91e7a73ffb6274f35324f8b5 07-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: SCALING_MODE_FREEZE cropping support

This change adss support for applying a buffer crop to layers with the
SCALING_MODE_FREEZE scaling mode. These layers do not scale the image, but
rather treat all pixels outside the crop rectangle as fully transparent.

Change-Id: I762518e56a37aef7747f9b581df2f2589b232c49
Bug: 6299171
/frameworks/native/services/surfaceflinger/Layer.cpp
cbb1a95819ec302ae15e4a1162a8b1349ae5c33e 09-May-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: tell SurfaceTex about filtering

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

Change-Id: I40c3defd73ebf96e3cabb3bfdb1fc97f2036753a
/frameworks/native/services/surfaceflinger/Layer.cpp
a0db308c3d62301ae41b2e2bcf295c4ee4c7b08e 23-Apr-2012 Mathias Agopian <mathias@google.com> remove SurfaceTexture::connect()

use BufferQueue::connect() instead

Change-Id: I04aab7cf11304bf962cde38470747f3b19ddba42
/frameworks/native/services/surfaceflinger/Layer.cpp
7f42a9c47c5a7f40cf02032d286d6bd62f28e650 24-Apr-2012 Mathias Agopian <mathias@google.com> triple buffering is now controled by BoardConfig and enabled by default

use TARGET_DISABLE_TRIPLE_BUFFERING := true to disable
triple buffering.

Change-Id: I9875d6ddefd23c1af9e51e7ee7dec1bacd1e6799
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
ed61a47c5b23e277d20a49fceb16d6ba5896b7d2 28-Feb-2012 Mathias Agopian <mathias@google.com> Merge "a window could get stuck to gpu composition"
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/Layer.cpp
ec923ee0d0e6f95bd56275214c252cb57bb8cfd4 28-Feb-2012 Mathias Agopian <mathias@google.com> a window could get stuck to gpu composition

this could happen after an orientation change. basically
we need to triger a geometry-changed when the very first buffer
is received

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

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

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

Change-Id: I6d9a466a23285304f0e229a5649815636ab5d6af
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
4c4163b53e262ff9cc10c819321d4ae03c2d7d46 22-Oct-2011 Xavier Ducrohet <xav@android.com> Fix software GL renderer.

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

* commit '70ac412b2fe7be2507189a9fdfb30c43b36d56ac':
Add a LayerScreenshot
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/Layer.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/Layer.cpp
cdec8f01aae14ed59fbc57cb2ce97a6602f4b9a1 17-Oct-2011 Mathias Agopian <mathias@google.com> am 840b8a67: Revert "Add a LayerScreenshot"

* commit '840b8a678537519c27ddf2f818494eaa20a135d4':
Revert "Add a LayerScreenshot"
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/Layer.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/Layer.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/Layer.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/Layer.cpp
ed984d9406b5a4062db93319e6f94d5f9fd19648 27-Sep-2011 Jamie Gennis <jgennis@google.com> Merge changes Ib302d79e,Ib4ee085f

* changes:
SurfaceFlinger: set layer names on SurfaceTextures
SurfaceTexture: add name support
1b5f4e61ff481387215d98c3266871bfd465bce5 27-Sep-2011 Jamie Gennis <jgennis@google.com> Merge "SurfaceFlinger: fix setting default buffer size" into ics-factoryrom
2a0d5b608447a880beff5149805425f02691442b 27-Sep-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: fix setting default buffer size

This change makes SurfaceFlinger update a SurfaceTextureLayer's default
buffer size in response to a window resize even if the Layer is in fixed
size mode.

Change-Id: I3871c8f19a045d03904d1284390cad7659be71ff
Bug: 5366426
/frameworks/native/services/surfaceflinger/Layer.cpp
36d2c1f02c58d8b5d2706960f370c9d74aafd740 27-Sep-2011 Jamie Gennis <jgennis@google.com> Merge "(DO NOT MERGE) SurfaceFlinger: fix isOpaque check in lockPageFlip" into ics-factoryrom
8d91b425078083d0e4967dcd8d669d9f7196123a 24-Sep-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: fix the transform hint

This change fixes the transform hint to use only the global display
transform rather than incorporating the transient layer-specific
transform used during animations.

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

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

Change-Id: Ib302d79e916a36ab1e54cb9ff477c3b857bd957b
/frameworks/native/services/surfaceflinger/Layer.cpp
351a513b12622781de9580b3c96fd0a8578b563b 15-Sep-2011 Jamie Gennis <jgennis@google.com> (DO NOT MERGE) SurfaceFlinger: fix isOpaque check in lockPageFlip

This change fixes an issue where Layer::isOpaque was being called in
lockPageFlip to get the opaqueness for the new buffer before
mActiveBuffer was updated.

Bug: 5321313
Change-Id: Ibb5d7d3f4e9a2b1448e117a484a0d9f9ca5fc9de
/frameworks/native/services/surfaceflinger/Layer.cpp
945d291699e439c6cbc6192164e0fa53d9a03c3a 15-Sep-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: fix isOpaque check in lockPageFlip

This change fixes an issue where Layer::isOpaque was being called in
lockPageFlip to get the opaqueness for the new buffer before
mActiveBuffer was updated.

Bug: 5321313
Change-Id: Ibb5d7d3f4e9a2b1448e117a484a0d9f9ca5fc9de
/frameworks/native/services/surfaceflinger/Layer.cpp
c7f3381c3b2945e441747130eae88214435d0819 31-Aug-2011 Mathias Agopian <mathias@google.com> fix display artifacts in preview screen in timelapse video mode

We were not updating the h/w composer state when the buffer size
changed.

We also didn't update the h/w composer state when the transformation
matrix changed (which is related to the above issue, since it would
probably change when the buffer size changes).

Also moved updating the crop to setGeometry(), since we decided
that the "crop" change requires the GEOMETRY_CHANGED flag (ie:
not need to do this every frame)

Bug: 5238473

Change-Id: Ia7b47e145b48581b568d89d9aa2c14ff778be862
/frameworks/native/services/surfaceflinger/Layer.cpp
85b6f7afeab61b75e4326639a9f4cb61523ea997 25-Aug-2011 Jamie Gennis <jgennis@google.com> Merge "SurfaceFlinger: use the HWC gralloc usage bit"
45d845190d26ae27de45390460f50a6a8639e2e5 24-Aug-2011 Mathias Agopian <mathias@google.com> Merge changes I14e03939,I9aafe6f2

* changes:
Fix an issue where Surface::lock() would never update the output region
Add a debug option to turn the "transformation hint" off
a45836466c301d49d8df286b5317dfa99cb83b70 24-Aug-2011 Mathias Agopian <mathias@google.com> Add a debug option to turn the "transformation hint" off

transformation hint is disabled with:

adb shell service call SurfaceFlinger 1009 i32 1

Change-Id: I9aafe6f280f88ce41569ed69a06dc522b10e3a88
/frameworks/native/services/surfaceflinger/Layer.cpp
f7ae69d4bd292110da976c8ae766a8ef083d731f 23-Aug-2011 Mathias Agopian <mathias@google.com> Minor cleanup

Change-Id: Ic042043c54631b5a5c74d20136addb2c08515ea9
/frameworks/native/services/surfaceflinger/Layer.cpp
3599bf2c0727bc33e8136f5163eee6f398545e05 10-Aug-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: use the HWC gralloc usage bit

This change makes SurfaceFlinger always use the
GRALLOC_USAGE_HW_COMPOSER usage bit when allocating buffers that may be
passed to the HWComposer.

Change-Id: I70362a8ede2b359fb2046853f85149d597465817
/frameworks/native/services/surfaceflinger/Layer.cpp
d992db3827016388e8069f5793b031153d423501 19-Aug-2011 Mathias Agopian <mathias@google.com> give the proper orientation to the h/w composer HAL

we were using the "orientation" value instead of the
real transform, which may contain arbitrary rotations for
instance, and in some case ended up with a final "orientation"
that looked valid, but wasn't.

this fixes a problem on devices with a h/w composer hal where
the rotation animation looked weird.

Change-Id: I4be8a2a1bde49c33456fcf5c8d87ab515c216763
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
c5953904ad6b6db1f48cf6d208ecf940f6a656d4 13-Aug-2011 Mathias Agopian <mathias@google.com> fix an orientation change drawing artifact.

a wrong orientation would be briefly shown when
rotation the screen. this happened when the window manager
set a custom transformation and the h/w composer was used.

the custom transformation was applied twice in that case.

Bug: 5037522
Change-Id: Ic1f87b63cd843f4475e4265d1624463825d775c4
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
ad795baecccf239621cbffa0249c8e855296cae6 09-Aug-2011 Mathias Agopian <mathias@google.com> improve dumpsys SurfaceFlinger output

we now output the handle and size of all buffers of each layer.

Change-Id: I8d011ee4ae9199f4198bd07bed770ec3bcf02986
/frameworks/native/services/surfaceflinger/Layer.cpp
e8067a7d996105d9e03d75e6593e28b795fa9336 03-Aug-2011 Mathias Agopian <mathias@google.com> fix a crasher in surfaceflinger

this would happen if being told to draw before a buffer
was available.

Change-Id: I46d121c73e883078cdbf952063e38b0076f79038
/frameworks/native/services/surfaceflinger/Layer.cpp
a537c0f42e8077baafcbc65844adf1ec8397c040 03-Aug-2011 Mathias Agopian <mathias@google.com> update HWC data structures even when a layer is marked for SKIP

Change-Id: I16bcf44cd617814a14a795429bde2f39f411077d
/frameworks/native/services/surfaceflinger/Layer.cpp
dbe6486ca151d0eb1950be0aae347f0eb8ed3442 30-Jul-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: abandon Layer SurfaceTextures

This change makes the Layer::onRemoved method call
SurfaceTextures::abandon on the layer's SurfaceTexture. This will cause
all client-initiated operations on the SurfaceTexture to fail. In
particular, this will result in an error on the client side, rather than
a deadlock when removing a layer that used a SurfaceTexture in
synchronous mode.

Change-Id: I14014d00369f29560a21b606831edee432bb8867
Bug: 5020874
/frameworks/native/services/surfaceflinger/Layer.cpp
db5230f4441fa8f120f15bdd6fcfc6e75d9c27d0 28-Jul-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: fix a layer occlusion bug

This change fixes a bug where the window visibility would be computed
before any buffers were available, causing the window to be treated as
non-opaque. When the first buffer arrived, if both mCurrentOpacity and
the opacity determined by the buffer's format were 'opaque', a
recomputation of the opacity would not be done, and the window would
continue to be treated as non-opaque. SurfaceFlinger could then
unnecessarily draw fully occluded layers.

Change-Id: I2b95da2f4b50e68d50fc5afd8b772e26e62f58d6
Bug: 5057122
/frameworks/native/services/surfaceflinger/Layer.cpp
3fbce7c56082e4e0d23f1c1c89983d3841853ed7 26-Jul-2011 Mathias Agopian <mathias@google.com> remove dead code and member variables.

also fix some comments and improve debugging logs.

Change-Id: I83e55309f306332b59e1ec46104c4a7fffbf3c97
/frameworks/native/services/surfaceflinger/Layer.cpp
97c602c5af5f3ffd69009bf496d86347b71a2b4c 20-Jul-2011 Mathias Agopian <mathias@google.com> implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation"

Bug: 4487161
Change-Id: I883f34efe542c2a566d04966f873374f40c50092
/frameworks/native/services/surfaceflinger/Layer.cpp
933389f75814bb62e8153528f9cff2cb329b77df 19-Jul-2011 Mathias Agopian <mathias@google.com> use SurfaceTexture new scaling mode in SF

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

Change-Id: I4d50e9851abedd7e64bfcfc8af9eefb9fb668529
/frameworks/native/services/surfaceflinger/Layer.cpp
29a367bb7c14c916e991a6a0028727bd06c1e16e 12-Jul-2011 Mathias Agopian <mathias@google.com> take the state transform into account with h/w composer hal

if the state transform didn't preserve rectangles, we
would still try to use h/w composer hal using the bounds
of the transformed rect, which isn't correct.

now we correctly fall back to composition.

Change-Id: Iff78f4339ece415d4987e95a5717b04934d370ab
/frameworks/native/services/surfaceflinger/Layer.cpp
3d8063b02e06020c8062addcc9ec49048d3bdb9a 27-Jun-2011 Jamie Gennis <jgennis@google.com> SurfaceTexture: change onFrameAvailable behavior

This change alters the conditions under which the onFrameAvailable
callback gets called by the C++ SurfaceTexture class. The new behavior
is to call the callback whenever a frame gets queued that will be
visible to the buffer consumer. This means that buffers queued in
synchronous mode always trigger the callback, as those buffers will
remain pending until they are consumed. Buffers queued in asynchronous
mode will only trigger the callback if there was not previously an
unconsumed buffer pending.

The new behavior means that a consumer should perform a draw operation
exactly once for every onFrameAvailable call that it recieves. This
change also modifies SurfaceFlinger and the SurfaceTexture JNI to
support of the new behavior.

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

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

Change-Id: Ia3d407f7bf2f5553f46cfdade70b7b0badb35beb
/frameworks/native/services/surfaceflinger/Layer.cpp
3629d7ff29495aad453b08a86e9ede7e42afa786 17-May-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: unfreeze windows for fixed size buffers.

This change makes SurfaceFlinger unfreeze a window if it ever gets a
buffer that is fixed-size. Normally the window would not be frozen if
its in fixed-size mode, but if the window was frozen before entering
fixed-size mode then it should be unfrozen.

Change-Id: I6bc822d4b02ae51fa8914c1f60f5d24b2002b38d
/frameworks/native/services/surfaceflinger/Layer.cpp
345c6114dad73fad026fa0925cca133236091dc2 27-Apr-2011 Conley Owens <cco3@android.com> am ba5aebd1: am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"

* commit 'ba5aebd106c61567ad6be905efd18902025735aa':
Add lock before calling initEglImage
ddc25bb92eb10ee40559424a75cac5e440b75575 27-Apr-2011 Conley Owens <cco3@android.com> am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"

* commit 'ac505b86b45462d9883f9c36fad0ef85e0885ee4':
Add lock before calling initEglImage
0d11baf88920660cf0e30b25b7268a9459e8ffa5 15-Apr-2011 Kobi Cohen Arazi <kobic@codeaurora.org> Add lock before calling initEglImage

Without that lock, there is a chance of race condition
where while composing a specific index, requestBuf with
the same index can be executed and touch the
same data that is being used in initEglImage.
(e.g. dirty flag in texture)
/frameworks/native/services/surfaceflinger/Layer.cpp
3eb70b4a51979399aed9b0017a23151701d1ad0e 19-Mar-2011 Jamie Gennis <jgennis@google.com> am bd340c7b: am b368f4d8: am 38caff23: Merge "SurfaceFlinger: Fix a typo." into honeycomb-mr1

* commit 'bd340c7b492fcf7d0a6cccab8825e710c83fe76d':
SurfaceFlinger: Fix a typo.
5fd799dab602850b384d124c61096636f0988a93 19-Mar-2011 Jamie Gennis <jgennis@google.com> SurfaceFlinger: Fix a typo.

This change makes Layer skip its cleanup of its old shared memory region
when the UserClient object that owned the memory has been freed.

Bug: 3429357
Change-Id: I9e4d8eb190f6914dc043674b9bb8dd28e959901b
/frameworks/native/services/surfaceflinger/Layer.cpp
939fee8819ac714af6f99b1d8e0bd2ff6626a356 17-Mar-2011 Mathias Agopian <mathias@google.com> am e22aa623: am 25594e19: am f40e638e: fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out

* commit 'e22aa62362a3007ee59ac62d4b5969e216987995':
fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
d0b55c011a311b677493ba72804bf1bc4df68224 17-Mar-2011 Mathias Agopian <mathias@google.com> fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out

a memory corruption happned when the buffer pool was resized
(like when playing a video or using camera) and there was
no current active buffer. In this case, the faulty code
would index into an array at position -1 which corrupted
24 bytes of data.

also improved region validation code (ifdef'ed out by default)

Bug: 4093196
Change-Id: I915c581d131148959d720e00e3892e9186ab733d
/frameworks/native/services/surfaceflinger/Layer.cpp
5bf3abefb2745bf0c45b0814cfd44b4682060a6c 12-Mar-2011 Mathias Agopian <mathias@google.com> Fix initialization order warning.

Change-Id: I794dfaaa3a2f2645a89abc6c45de5f76e485f7d0
/frameworks/native/services/surfaceflinger/Layer.cpp
795f5ccf4788b791ff1042426be769ec51db6675 12-Mar-2011 Eric Hassold <hassold@google.com> Merge "Default to NONE format in Layer"
7ffe3807506da6f052535ca0c790636e41a8e310 11-Mar-2011 Eric Hassold <hassold@google.com> Default to NONE format in Layer

mFormat is not initialized with any value in Layer constructor, causing
a call to requestFormat() with no explicit format specified to fallback to
some uninitialized value. Such invalid path actually detected by valgrind.

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

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

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

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

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

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

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

Bug: 3215931
Change-Id: Ib4dff8060ac522d201ff1e74807ac340c17d3fa7
/frameworks/native/services/surfaceflinger/Layer.cpp
3cbe436bfd71b888ff9de97242cc976015b5b635 29-Jan-2011 Mathias Agopian <mathias@google.com> am 8d778b37: am 231da079: Merge "fix [3389263] OMX.Nvidia.h264.decode fails to shutdown" into honeycomb

* commit '8d778b375ccb4945cdcd7cc93272a6d36466ad00':
fix [3389263] OMX.Nvidia.h264.decode fails to shutdown
3cc2677efc2a4bc06297b9667ac529284f6abf9d 29-Jan-2011 Mathias Agopian <mathias@google.com> fix [3389263] OMX.Nvidia.h264.decode fails to shutdown

We were still destroying an ANativeWindow's buffer pretty soon
after it was removed from the window manager. This time
we really wait for the ISurace to go away.

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

To be used by DRM framework, implemented by display HAL

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

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

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

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

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

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

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

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

Change-Id: I6b400b2df79712408b9315a9859290c7fcb1609e
/frameworks/native/services/surfaceflinger/Layer.cpp
dd17b3eaa99f761e265ff457e335b5a0ff83dafb 14-Dec-2010 Mathias Agopian <mathias@google.com> fix [3176642] Camera preview turns completely black for multiple toggles between camera and camcorder app

There was a leak of Surface tokens when a surface was detached from a UserClient.
We now always detach a surface from its client before attaching to the new one,
this guarantees that its token is freed.

Change-Id: Icfad0b16286ed58155bdfafdf36ab161440aa485
/frameworks/native/services/surfaceflinger/Layer.cpp
f345069099a13f0c2dd91f1fa92786643e4becb0 09-Dec-2010 Mathias Agopian <mathias@google.com> [3211070] camera preview image is rendered offset from the UI overlay frame

somehow this change got lost.

Change-Id: I36f6c7ef3f782918042b77e9dc91a4c811d84a40
/frameworks/native/services/surfaceflinger/Layer.cpp
86bdb2f918ffd238d6e0d1ae1f95af882f04d6cb 09-Dec-2010 Mathias Agopian <mathias@google.com> fix [3260137] Sometimes front-facing camera mirroring is wrong

make sure to take the buffer's orientation into account.

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

Change-Id: I4c17021fc269ce66c98cc345353600eda332f980
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/Layer.cpp
b5a00fcb71426492f248ed49a0514a9b8d385065 08-Dec-2010 Mathias Agopian <mathias@google.com> am 48f42f8c: am 4153bf3a: Merge "[3171580] don\'t automatically log GraphicBuffer allocation failures" into gingerbread

* commit '48f42f8c3fbd33b2f46c6290ff5963dd58938cf9':
[3171580] don't automatically log GraphicBuffer allocation failures
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/Layer.cpp
733189d408e13b54fd70971b265244367efd0f51 03-Dec-2010 Mathias Agopian <mathias@google.com> [3171580] Fix two typos related to fixed-size buffers

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

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

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

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

Change-Id: I32044e91b0c944c1b137efdceb3f01dfaa78119d
/frameworks/native/services/surfaceflinger/Layer.cpp
678bdd6349344df254cc0c3377a40fd99e216635 04-Dec-2010 Mathias Agopian <mathias@google.com> [3171580] don't automatically log GraphicBuffer allocation failures

some of these failures are not fatal and even expected in some cases
so they should not emit a dump in the log in those cases.

Change-Id: Idcfa252e3bfa9d74e27fe4ad8f8623aa01aa9c5e
/frameworks/native/services/surfaceflinger/Layer.cpp
040481419473cb9913b632cd8973b1d7065f9c9c 01-Dec-2010 Louis Huemiller <lhuemill@google.com> Remove const_cast to layer handle

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

Change-Id: I7f979c60c06d654aa8265002836277434bc1a64f
Bug: 3095167
/frameworks/native/services/surfaceflinger/Layer.cpp
3b996c96e4cd1057cb6b9531eaf8c01f934d2b2a 10-Oct-2010 Romain Guy <romainguy@google.com> Always create OpenGL accelerated windows in RGBA 8888.

Bug #3081600

The OpenGL renderer in libhwui uses a single EGL context per process and
thus create it with an RGBA 8888 EGL configuration. To ensure that all
windows are compatible with this configuration, this change modifies
the window manager and SurfaceFlinger.

The window manager now checks the window's flags and if the window is
hardware accelerated, it forces the window's pixel format to be
translucent when creating the surface. The window itself is still
marked as opaque if we know that the window will be opaque on screen.
This keeps existing optimizations in place.

Similarly in SurfaceFlinger, a translucent Surface can now be created
with the Surface.OPAQUE flag, indicating SurfaceFlinger that the surface
does not require blending, despite its RGBA 8888 configuration.

Change-Id: Ic747b6b12564ba064412d842117880fcc199eb7c
/frameworks/native/services/surfaceflinger/Layer.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/Layer.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/Layer.cpp
e44d21a247aac5192b8ef397d433a4aefb6ba53e 21-Sep-2010 Mathias Agopian <mathias@google.com> fix [3018216] UI shrinks / stretches while using apps with IME

Change-Id: Ie4c5d8a434b4489355ed8c52af96eb931b4d7167
/frameworks/native/services/surfaceflinger/Layer.cpp
5dda7f7cf23a02fff2e35d7eb6bb7c9f0d620f95 17-Sep-2010 Jamie Gennis <jgennis@google.com> Fix a SurfaceFlinger bug.

The bug caused SurfaceFlinger to constantly trigger reallocation of buffers
that requested a fixed size.

Change-Id: Ic993a60e6474e36a344c8b48d541a0d08b8c4faf
/frameworks/native/services/surfaceflinger/Layer.cpp
413f750501c4392e096c7bed27af0764cbadeb94 26-Aug-2010 Mathias Agopian <mathias@google.com> am 6d4346ce: am 4cffbb47: Merge "fix [2946787] Screen flicker on low resolution setting in camcorder." into gingerbread

Merge commit '6d4346ce35a521d67f45d7c9658c450c0fc461d2'

* commit '6d4346ce35a521d67f45d7c9658c450c0fc461d2':
fix [2946787] Screen flicker on low resolution setting in camcorder.
eff062c49e858d0dd94a1e57f6115bc84dba103e 25-Aug-2010 Mathias Agopian <mathias@google.com> fix [2946787] Screen flicker on low resolution setting in camcorder.

Change-Id: I7e86f2b6d85dcae8dd212890b978fa6ac7de6893
/frameworks/native/services/surfaceflinger/Layer.cpp
e34a3d1a294e1d83caa410f3006e474bef787e1a 25-Aug-2010 Mathias Agopian <mathias@google.com> am 46820412: am 8eb16af2: Merge "don\'t try to lock a buffer that wasn\'t allocated with SW usage bits" into gingerbread

Merge commit '468204124e95bbf74ae8cc000318ade29e311be6'

* commit '468204124e95bbf74ae8cc000318ade29e311be6':
don't try to lock a buffer that wasn't allocated with SW usage bits
f1b38247d4d9c2ddc7315a72b609a95e0ed8050f 21-Aug-2010 Mathias Agopian <mathias@google.com> don't try to lock a buffer that wasn't allocated with SW usage bits

Change-Id: Iabbcec1bfa30dc47d45ece699dd178653f1b675b
/frameworks/native/services/surfaceflinger/Layer.cpp
4ad298c12c43563789fd2213428347caf2f74c64 25-Aug-2010 Mathias Agopian <mathias@google.com> am bc4389ed: am 8395b462: Merge "fix [2931513] Add support for setting the orientation of an ANativeWindow" into gingerbread

Merge commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64'

* commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64':
fix [2931513] Add support for setting the orientation of an ANativeWindow
b661d66013b9803c50dc78ca0247ac39caef443a 20-Aug-2010 Mathias Agopian <mathias@google.com> fix [2931513] Add support for setting the orientation of an ANativeWindow

Also implement support for cropping.

Change-Id: Iba5888dd242bf2feaac9e9ce26e404c1f404c280
/frameworks/native/services/surfaceflinger/Layer.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/Layer.cpp
a350ff98692b3a50cad5cc93f9f83221242ca86a 11-Aug-2010 Mathias Agopian <mathias@google.com> call into hwcomposer HAL when present

Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
/frameworks/native/services/surfaceflinger/Layer.cpp
208cb0772429b9ac800010829ecc7b854bdc2d24 28-Jul-2010 Mathias Agopian <mathias@google.com> fix [2873058] Surface::dequeueBuffer blocks on last buffer, i.e. cannot dequeue all allocated buffers at once.

this situation happened when the last buffer needed to be resized
(or allocated, the first time). the assumption was that the buffer
was in use by SF itself as the current buffer (obviously, this
assumption made no sense when the buffer had never been allocated, btw).

the system would wait until some other buffer became the "front" buffer.

we fix this problem by entirely removing the requirement that the
buffer being resized cannot be the front buffer. instead, we just
allocate a new buffer and replace the front buffer by the new one.

the downside is that this uses more memory (an extra buffer) for a
brief amount of time while the old buffer is being reallocated and
before it has actually been replaced.

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