SF could end-up in an infinite crash-loop during startup if it
was stopped while the screen was off. This happened because
the thread that manages screen blanking was started before
other important pieces of SF were initialized.
Change-Id: I0dded11dbf2395fdd57b673859a7aa0fa9eb32b6
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
In some situations SF would mark a window as "has a pending update"
but would never process that update because the window is not
visible (fully transparent, hidden by another window, etc...), this
window would then be "stuck" until some other window updated.
Change-Id: Ifa18a9aef3a53f2593b473556702688ae62d9503
recent changes in SF introduced a hang where some windows would
stop being refreshed.
This is an attemp to fix that.
Change-Id: I6aa32ac0d6f1c0a6aea8f6195825dc4f4e6f93f9
we now exit the Display thread on any error happening on these files.
also refactor the code and remove a lot of unused stuff.
Change-Id: I8d080c35b211890ca20ae09fa36fbdccdf5669a8
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
vsync events were sometimes delivered to connected
client who didn't request them. this happened if
another client requested the delivery and that client
was first in the client list.
also fix the vsync test which didn't request any events as
well as DisplayEventReveiver documentation which was misleading
about the necessity to request vsync events.
Change-Id: Ie990fda3f337f8f0042745c4b2cde67936c45686
--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
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
Some implementations of NPOT, particular those derived from core
GLES2, require the wrap mode to be CLAMP_TO_EDGE. Set the required
wrap mode for the screenshot texture so it passes the completeness
check.
Change-Id: I735016123e4acaf54b40d1435bd70281cef88a31
Several source files privately defined macros LIKELY and UNLIKELY in terms
of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and
CC_UNLIKELY which are intended for this purpose. So rename the private
uses to use the standard names.
In addition, AudioFlinger was relying on the macro expanding to extra ( ).
Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.
- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.
Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
the deadlock would happen when the pipe became invalid and SF
trying to remove the connection from its list.
we know make sure to process events without holding a lock.
Change-Id: I39927ed8824fc7811e16db3c7608a2ebc72d9642
Layer::lockPageFlip() and layer::onRemove() could be called on
different threads and race such that lockPageFlip() successfully
called mSurfaceTexture->updateTexImage() but then gets NULL back from
mSurfaceTexture->getCurrentBuffer(), leading to a crash.
This change moves Layer::onRemove() calls to
SurfaceFlinger::commitTransaction() so they happen after the Layer is
done being drawn from and only happen on the main surfaceflinger
thread.
Change-Id: I4b550caadff4cc1878d7c3bca6129193fb0c713e
This change adds a compile-time option for SurfaceTexture to use the
EGL_KHR_fence_sync extension to synchronize access to Gralloc buffers.
Bug: 5122031
Change-Id: I7e973a358631fff5308acf377581b811911fe790
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.
Bug: 1475048
Change-Id: Ia720f64d1b950328b47b22c6a86042e481d35f09
Revert "Add support for sending VSYNC events to the framework"
This reverts commit f3918c5bd4bc9f02f74da42995564150ca2dd382.
Change-Id: I998e3e1aa3fa310829ae973b64fe11b01f6f468f
* changes:
Add support for sending VSYNC events to the framework
BitTube::read now handles EAGAIN
split ComposerService out of SurfaceComposerClient.h
rewrite SF's message loop on top of Looper
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.
Bug: 1475048
Change-Id: If4126023fc9c067e56087ec7d16a8fd542ce1794
- don't advertise extensions that are not supported
by any implementation
- remove EGL_ANDROID_swap_rectangle which is not
implemented by anybody and confuses people
- add some comments about mandatory extensions
Bug: 5428001
Change-Id: Id8dc48116ac1d1eb79ec9ef55d03e29d4257c1f3
This fixes the issue:
"Call not sent" dialog takes too long to dismiss after hitting OK"
Note: the system would recover after a 5 second timeout.
Bug: 5534520
Change-Id: Ifa37e594b50581f498479a5858672441b3d7dd87
The ScreenShot layer is now created hidden. The screenshot itself
is aquired during the transaction when the layer is made visible.
This guarantees the screenshot and the layer happen atomically
with respect to screen updates.
Bug: 5534521
Change-Id: Ida23e1f13d5716ec83b78a15712e0646d6cf8729
We now have mInvalidateRegion which holds the region to invalidate, it
can be set from any thread as long as mInvalidateLock is held. We use
fine-grained locking here because mInvalidateRegion can be set from anywhere,
in particular frmo HWC callbacks.
Bug: 5466774
Change-Id: Iafca20aa3f5b25a87755e65bde7b769aa8f997bc
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
there was situations where SF's main loop would run (as if there was
an invalidate), but the dirty region was empty (so no new buffers
were retired). In this case we return early and don't swap, which
would cause drawing artifacts.
Bug: 5476838
Change-Id: Id3b7bf4b7aabec7919c50d9278eb2165973a4c3d
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
removed a test that could violate this guarantee. note that we
have no proof tha this ever happened, but consequences could be
hard lock-ups.
the code here was intended to track the region to update for displays
that can do partial update. the logic discarded the update entirely
if that region was empty. instead we just redraw the whole thing
(note that we should never be there with an empty region and retired
buffers though).
Bug: 5466259
Change-Id: I91ccab3b1a599e729e438eb833939e2236da6854
This change removes the dead code from SurfaceFlinger that resulted from
disabling support for freezing the display.
Change-Id: I4e5ff00c94b4c7a79af2f65c9850c135210068ed
This change adds two tests for SurfaceFlinger's behavior when updating
the position and size of a layer.
Change-Id: Id5e3ca1d7e629a3bd2c2d28275d80c7f9256d6da
This change enables a layer or orientation update transaction sent to
SurfaceFlinger to explicitly request a synchronous transaction.
Change-Id: I97cbba610c13679849f66114b216fa6dbf12f2a9
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
This change merges the ISurfaceComposer::setOrientation functionality
into ISurfaceComposer::setTransactionState. It enables the window
manager to atomically update both the display orientation and the
position and size of the windows in a single transaction with
SurfaceFlinger.
Bug: 5439574
Change-Id: I18a8ccc564d7d760ef8afb2d015ccdb7a7963900
this would happen when toggling on/off/on very fast, the screen
could stay black (while the panel is on).
Bug: 5429724
Change-Id: Ic8aa6aff066e6267923c0d47ef65e314e7bb6d41
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
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
when areas of the FB are undefined (transparent windows on top of
nothing), we clear those areas before composition.
however, it makes no sense to do this when the FB is not in use
(case where hwc handles all layers)
Bug: 5360529
Change-Id: I761a7d3664228ebbee0944aca8b0cc278fc94c9c
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
when areas of the FB are undefined (transparent windows on top of
nothing), we clear those areas before composition.
however, it makes no sense to do this when the FB is not in use
(case where hwc handles all layers)
Bug: 5360529
Change-Id: If51bb669307e8419bbe1f3a89d1c88e0ec1f216c
Bug: 4981385
Simplify the orientation changing code path in the
WindowManager. Instead of the policy calling setRotation()
when the sensor determined orientation changes, it calls
updateRotation(), which figures everything out. For the most
part, the rotation actually passed to setRotation() was
more or less ignored and just added confusion, particularly
when handling deferred orientation changes.
Ensure that 180 degree rotations are disallowed even when
the application specifies SCREEN_ORIENTATION_SENSOR_*.
These rotations are only enabled when docked upside-down for
some reason or when the application specifies
SCREEN_ORIENTATION_FULL_SENSOR.
Ensure that special modes like HDMI connected, lid switch,
dock and rotation lock all cause the sensor to be ignored
even when the application asks for sensor-based orientation
changes. The sensor is not relevant in these modes because
some external factor (or the user) is determining the
preferred rotation.
Currently, applications can still override the preferred
rotation even when there are special modes in play that
might say otherwise. We could tweak this so that some
special modes trump application choices completely
(resulting in a letter-boxed application, perhaps).
I tested this sort of tweak (not included in the patch)
and it seems to work fine, including transitions between
applications with varying orientation.
Delete dead code related to animFlags.
Handle pausing/resuming orientation changes more precisely.
Ensure that a deferred orientation change is performed when
a drag completes, even if endDragLw() is not called because the
drag was aborted before the drop happened. We pause
the orientation change in register() and resume in unregister()
because those methods appear to always be called as needed.
Change-Id: If0a31de3d057251e581fdee64819f2b19e676e9a
we need to clear the whole framebuffer in that situation because
we can't trust the content of the FB when partial (fb preserving)
updates are used.
Bug: 5318492
Change-Id: I3f0e01b0fb665a34e44d88ad9f0f54a5d990060b
we need to clear the whole framebuffer in that situation because
we can't trust the content of the FB when partial (fb preserving)
updates are used.
Bug: 5318492
Change-Id: I3f0e01b0fb665a34e44d88ad9f0f54a5d990060b
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
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
we were not redrawing and/or clearing the FB properly when
hwc moved a layer from/to FB to/from OVERLAY.
In these cases we needed to expand the dirty region to include
the layer that changed mode.
Also split composeSurfaces() which was becoming quite large.
Change-Id: Id6fa1acfc4ff694037fddf7efd037a4405732073
this happened when the overlays were in use, since the animation
is rendered in the FB and the FB is not used.
we now have a way to turn hwc off temporarily.
Change-Id: I3385f0c25bb9cc91948e7b26e7cd31ed18c36ace
these were due to the "preserve backbuffer" optimization
interfering with hw composer. basically the screen needed
to be redrawn in the areas that move from GL to
overlay.
Bug: 5245513
Change-Id: I9bf75c4fe905f3ef62005e52108b94edae692304
Added Surface.setPosition(float, float) which allows to set a surface's
position in float.
Bug: 5239859
Change-Id: I903aef4ad5b5999142202fb8ea30fe216d805711
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
When taking screenshots we need to use the full drawing state list
instead of the visible list.
Bug: 5186823
Change-Id: I214ee0203aaf8e2c038e44581f7f1ae36edf08c5
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
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
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
this is disabled by default. To enable:
setprop debug.sf.ddms 1
this debug option requires to restart SurfaceFlinger
Change-Id: Ic2f8050b29911b55bcd21721648b6978700c277d
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
the first time a surface was connected, the values returned
by query NATIVE_WINDOW_DEFAULT_{WIDTH|HEIGHT} and
NATIVE_WINDOW_TRANSFORM_HINT were wrong until a call
to queueBuffer was performed.
Bug: 5137366, 5121607
Change-Id: I7ac6b5b0daa876638f6bed7c20f286a6e6d984f6
This is useful in various situations, for instance if the HAL
wants to change its compositing strategy.
Bug: 4488017
Change-Id: I5afc14e5917c6db7926d7417d48677d5aba50caa
This change makes SurfaceFlinger's SurfaceTexture objects default to
async mode whenever a camera or video decoder connects. This behavior
can be disabled by #defining NEVER_DEFAULT_TO_ASYNC_MODE.
Change-Id: I8965951d1775915da180e4af298dd7af3afafecc
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
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
- fixed uninitialized variable
- set hint to indentity when transform is too complex
- make sure FrameBufferNativeWindow doesn't fail on needed perform commands
Bug: 4487161
Change-Id: I7cb2b0869b72404732eca7cb2d145ff669e2ed9b
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
- surfaceflinger now uses the GL-convention of
placing the origin in the left-bottom corner
- map texture coordinates of the screen capture
properly
- add the ability to control the animation
speed through a debug property
Bug: 4989276
Change-Id: Ifb3297bb578078b47146fff666c01f85417e0d6f