History log of /frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6f96080f333c70104424f42ac263c4c9c7a9dd2a 20-May-2011 Mathias Agopian <mathias@google.com> Fix a race that could cause GL commands to be executed from the wrong thread.

Bug: 4483050
Change-Id: I37f0f3156059c208c6168ee6131d0e267d823188
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
fa21cb2e58838761157d3ee929a77e23b602bd01 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.

Bug: 4483049

Change-Id: Ibb5989312f871339928ee1aa3f9567770d72969b
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
a725ccda9e0e9aec80f9f0b1a63d94d46a13c4b4 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.

Bug: 4483046

Change-Id: I5262bf1124d9a65ec6f8ffd8e367356fc33a7536
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
cf8b94562c7cbd5c7ced01dca9bbca25011a04e8 10-Mar-2011 Mathias Agopian <mathias@google.com> revert the surface purgatory list and dependent changes.

6d0f6cb Revert "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only"
6154412 Revert "partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)"
37c2a37 fix [3408713] Dialog window invisible sometimes

It looks like there is a surface leak, it's unclear where it is.
Without those reverts, this would cause a leak of the associated buffers
which is far more problematic. this change might hide the surface leak.

Bug: 4078032
Change-Id: Iedcda3ffcdd2f69d41047b5c3134c1e867ff90d7
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
951d3fec41c8c77f5ce86a5394573e8180d93927 10-Feb-2011 Mathias Agopian <mathias@google.com> Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only

37c2a37 fix [3408713] Dialog window invisible sometimes
d35c666 fix [3385504] Surface flinger hang when adding dim surface
1723b04 fix [3389263] OMX.Nvidia.h264.decode fails to shutdown
1b0114f fix a surface leak in SurfaceFlinger

Bug: 3513017

Change-Id: Ia13ed8c9cdcb1f484e177cdcaff687e7c88a10c3
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
c86d904b71be950ad973d803d1a19c6cd13be669 11-Feb-2011 Jamie Gennis <jgennis@google.com> Prevent SurfaceFlinger from using layer token 31.

Bug: 2964479
Change-Id: I81e948924bff35b8b300d409f2c09f3779bcdeec
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
21956040a77808909ebda426fbd3cce6c8ed059f 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/base/services/surfaceflinger/SurfaceFlinger.cpp
68d3478860fecc9b8fbf256796a832a037434555 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/base/services/surfaceflinger/SurfaceFlinger.cpp
8aa11d82f33be8089a53feb3ba3c40fd8a33ad95 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/base/services/surfaceflinger/SurfaceFlinger.cpp
84c6f5a44c431a36a9e4395a7e23ab26480ba689 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/base/services/surfaceflinger/SurfaceFlinger.cpp
ee5a3aca5752f201b69fe0307414ca16ca492f0e 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/base/services/surfaceflinger/SurfaceFlinger.cpp
025005f562f695c3b1785745c2e5c184fc3a2330 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/base/services/surfaceflinger/SurfaceFlinger.cpp
dfa08fbfd8a5ebd013c122e391282b7f21f6342f 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/base/services/surfaceflinger/SurfaceFlinger.cpp
d4e03f37423bee383d17f7292753a5f67e497a28 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/base/services/surfaceflinger/SurfaceFlinger.cpp
8b6a0545adb968f15ba8bb8c7587ff9ba356db13 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/base/services/surfaceflinger/SurfaceFlinger.cpp
a6cd6d310473e9896c5148946fe9a5fc57db173b 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/base/services/surfaceflinger/SurfaceFlinger.cpp
2d2b803a92ba531cf6c4bb7042326653255b8780 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/base/services/surfaceflinger/SurfaceFlinger.cpp
aab758e87991d1460ca94d4a5f22c0ef34641e2d 11-Oct-2010 Mathias Agopian <mathias@google.com> turn off the electron beam

Change-Id: I335fb6719f1d5a3f1c6f37a046fd1c2c4ed2bbc6
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
597c7f67b5f2491c6098a1de241a3f0fd274688a 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/base/services/surfaceflinger/SurfaceFlinger.cpp
ca5edbeba92b96913291792a4df984e158853b6d 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/base/services/surfaceflinger/SurfaceFlinger.cpp
e20a56d929fc8fedc2b468ea6d1900bd2aa6e81a 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/base/services/surfaceflinger/SurfaceFlinger.cpp
04262e9f842edf20168399b6a70f0d67e518fe69 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/base/services/surfaceflinger/SurfaceFlinger.cpp
cfa275908a220c5e1cf496f7fdde1c04e24e95da 18-Aug-2010 Mathias Agopian <mathias@google.com> revert hwcomposer HAL changes. DO NOT MERGE.

This reverts commit:
94364b91a2894bf037b8beb027132fbb812e1434
f8e705dea48f77f1c2532fdbadd4997dd1851af0
b59beb5ca68d0228f60dda60d85e2d0226b33215
e0d5f5bcf5a8b26f4ad75f549cbf380b2c9faf20
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
94364b91a2894bf037b8beb027132fbb812e1434 13-Aug-2010 Erik Gilling <konkers@android.com> surfaceflinger: don't check HWComposer numLayers unless one exists

Change-Id: I4b83f7bf7ba1318c70054117f14e759fe0ad105c
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
f8e705dea48f77f1c2532fdbadd4997dd1851af0 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/base/services/surfaceflinger/SurfaceFlinger.cpp
e0d5f5bcf5a8b26f4ad75f549cbf380b2c9faf20 11-Aug-2010 Mathias Agopian <mathias@google.com> call into hwcomposer HAL when present

Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp
1efba9a61716356014f4c452fd9e099c5ebe9bd0 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/base/services/surfaceflinger/SurfaceFlinger.cpp
ff1d4102882ae9641a61fc4a3937866521bb72dc 11-Aug-2010 Mathias Agopian <mathias@google.com> keep a list of visible sorted surfaces

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

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