+ This is needed so that activity manager does not
have to do cpu side rotations when capturing recents
thumbnails.
Change-Id: If998008e675ad01305db8399fd643cf4608b7025
This makes it possible to tell whether two HW vsync signals are too
far apart because one was late, or because we turned HW vsync off
briefly between them.
Bug: 17259382
Change-Id: If4fba2a8a6013568349949ce87c5c36f0468d2a2
Display configs for external displays are stored in the framework
everytime we receive a hot plug to connect. However, since the
configs are not cleared on disconnect, framework will just assume
that the configs are valid. This does not work for use cases when
you connect/disconnect external displays with different resolutions.
e.g. 1080p to 4K and vice-versa
With this change we clear the display configs and repopulate when
we receive a hot plug to connect.
Change-Id: I2eeab186a8d8668a53390a2413b2ce5e044a1845
Acked-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
By not committing the results of composition for empty frames, we
avoid spitting out series of black frames for virtual displays that
don't have visible layers. We still draw one black frame when going
from having layers to not having any. In particular, this avoids
having a series of empty frames due to re-compositing the primary
display in the period between creating the virtual display and adding
layers to it.
Bug: 16786752
Change-Id: I7e9b2ed2e407d8d49c7af736b447d4c6181b0ad8
Do not wait for the screen capture to complete within surface flinger,
instead pass a sync point back with the captured gralloc buffer.
Change-Id: I7137c0e0fc710688d1d61f189159418fb27ea263
Modify SurfaceFlinger to use VirtualDisplaySurface in all cases when a virtual
display is used. Add functionality in VirtualDisplaySurface to resize the
buffers aquired in the QueueBufferOutput. Add transaction support in
SurfaceFlinger for resize. Add the modification of the size in DisplayDevice.
Change-Id: Iae7e3556dc06fd18d470adbbd76f7255f6e6dd6b
Tested: None
This can be used to change the current display mode of the device.
Change-Id: Icdc3fb58389b861dc77b68102083da6f7a96eccb
Tested: None
(cherry picked from commit 2651fa9463)
If available, surfaceflinger will use the hwc setCursorPositionAsync()
api to change the position of supported cursor layers outside of
the usual prepare/set loop.
Change-Id: Ib3fc5c0c390b3489ddbba202379840a1d2748917
Bug: 15116722
- Adds a sticky transform field that can be set from a
SurfaceFlinger client Surface. This transform is
added to any transform applied to the Surface.
Change-Id: Idaa4311dfd027b2d2b8ea5e2c6cba2da5779d753
The existing code worked in practice, but wasn't quite correct in
theory and relied on implementation details of other code. It's still
somewhat unusual and subtle, but now is correct-in-theory (I believe)
and a little better documented.
Bug: 16044767
Change-Id: I22b01d6640f0b7beca7cbfc74981795a3218b064
(cherry picked from commit c61576794e)
This is necessary to use C11/C++11 stdlib atomics, which the next
change will do. This change also fixes a couple bits of syntax that
both GCC and Clang refuse to compile in -std=c++11 mode.
Change-Id: Ia14d9d6b537a3bb106c23e19a277e48be180754c
This forces all SurfaceFlinger sources to be recompiled when the
Makefile changes; that's overkill sometimes but makes sure everything
gets recompiled when compile options (or similar) changes.
Change-Id: I2b3c3090fc1c35078e13c77fbb1a78d447c39158
Removes the dependency on default constructor parameters for
GLConsumer so that a different constructor prototype can safely be
added.
Change-Id: I0da924bbd4c141edbf305598c1be8bc575654680
This adds an allocateBuffers method to BufferQueue, which instructs
it to allocate up to the maximum number of buffers allowed by the
current configuration. The goal is that this method can be called
ahead of render time, which will prevent dequeueBuffers from blocking
in allocation and inducing jank.
This interface is also plumbed up to the native Surface (and, in
another change, up to the Java Surface and ThreadedRenderer).
Bug: 11792166
Change-Id: I4aa96b4351ea1c95ed5db228ca3ef98303229c74
VSYNC power hints are now sent via binder to IPowerManager.
SurfaceFlinger no longer loads a second copy of the PowerHAL.
VSYNC power hints are sent in batches and not on per frame basis.
Change-Id: Ia5a839ab3c857cffae7089f810b4315d4ed23fcf
Rects' right and bottom edges are treated as exclusive, so when
checking against maximum width and height, we should use > instead
of >=.
Change-Id: Ifcdf6813c13fcab1a55f16c21064e765e93d49f0
This replaces the previous low-power mode experiment, which
discarded refresh events, with a new experiment that alters
the refresh period.
(see also I2849e5ea335c0d2509fea1c315392bce7f20451d )
The feature is enabled by specifying a nonzero value for the
"refresh skip count", which indicates the number of periods
to skip. For example, the command:
adb shell service call SurfaceFlinger 1016 i32 1
sets a skip count of '1', yielding a 30Hz refresh rate on a device
with a 60Hz display. Changing the last value to '2' would set the
refresh to 20Hz. '0' returns to the default behavior.
Bug 15523257
Change-Id: I00039c22a55750e74035644c63800e4bee1c774a
If app and SF events aren't using phase offsets, we don't need
to maintain the DispSync model. We just turn hardware VSYNC on
whenever something wants to draw. This avoids some edge cases
where we were doing too much resync work.
Also, updated the systrace output. The "VsyncOn" line was a
combination of SF and app event threads, and would occasionally
be very weird. Removed VsyncOn, renamed VSYNC to VSYNC-app,
and added VSYNC-sf.
Also, added more details to the --dispsync dumpsys output.
Also, renamed global constants to not look like local variables.
Bug 15516453
Change-Id: I0da10b72f0d9a7b7eb5202d87cc18967f698adbd
We replace the blank/unblank calls in surfaceFlinger with a more generic
setPowerMode() routine.
Some displays support different power modes (for example, with reduced
color palettes). Depending on the use case we should be able to toggle
these modes, so as to achieve incremental power savings.
Initially, three power modes will be supported:
- HWC_POWER_MODE_OFF
- HWC_POWER_MODE_DOZE
- HWC_POWER_MODE_NORMAL
HWC_POWER_MODE_OFF will correspond to blanking the display, while
HWC_POWER_MODE_NORMAL will correspond to unblanking. HWC_POWER_MODE_DOZE
will put the display into a low power setting, if it is supported in
hardware.
If such a low power mode is not supported, it should be treated as a
call to set the mode to HWC_POWER_MODE_NORMAL.
As a consequence of adding the mPowerMode field, the mScreenAcquired is
no longer required, and thus references to it are removed and replaced
equivalent references to mPowerMode.
We also add the glue code to connect the services invocation of setting
a power mode and the HAL implementation in HWComposer.
Bug: 13472578
Change-Id: I431595ecf16d2f2c94259272db3dd42f29636204
Signed-off-by: Prashant Malani <pmalani@google.com>
Adds a sourceCrop Rect parameter to screenshot commands, which allows
clients to capture only a portion of the screen instead of the whole
screen.
Bug: 15137922
Change-Id: I629447573cd34ffb96334cde7ba02490b9ea06d8
The "dumpsys SurfaceFlinger" output shows pixel formats in
human-readable form now. Add IMPLEMENTATION_DEFINED.
Change-Id: If567e34dad4b940fbfb4d0b70c65f6ab8cd5f5e7
Dumps the current DispSync state.
Bug 14651879
(this is a near-cherrypick of Ide4e6dbd58b117bc1a6b97b57d10cd92ec86dc84)
Change-Id: I6e6c8452ede5c2d5098db1b884d28226e77d9a03
This allows querying and switching display device configurations
through the ISurfaceComposer/SurfaceComposerClient interface.
Bug: 14320401
Change-Id: I8c22165698950e5da32204c1c4da92122f91a715
the default.
Feature added for the low power mode.
Change-Id: I2849e5ea335c0d2509fea1c315392bce7f20451d
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
If the virtual display consumer disconnects after the
VirtualDisplaySurface dequeues a buffer but before it requests it, the
request will fail. Previously the error was ignored, and the caller
would get a success result but a NULL buffer. Now the dequeued buffer
is cancelled and the error propagated to the caller.
Bug: 14140551
Change-Id: I91547885c2cf6063dc7a8f02d97f2df282cdde2c
This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.
(cherry-pick from master I600365c0fd5d3ad93e04295d26cf9de177ffc79b)
Bug: 12101046
Change-Id: I6182993d53537781aedb522f97a50f06eed8b80f
Increases NUM_BUFFER_SLOTS from 32 to 64 and changes the mask
returned by IGBC::getReleasedBuffers from 32 to 64 bits.
Bug: 13174352
Change-Id: Ie8ef0853916cfb91f83881c7241886bb1950f01a
Adds a new method, IGBP::detachNextBuffer, that effectively does
dequeue + request + detach in a single call, but does not need to
know anything about the dequeued buffer, and will not block on
dequeue. This is mostly for the upcoming StreamSplitter to use in
its onBufferReleased callback.
Change-Id: Ie88a69de109003acebaa486a5b44c8a455726550
It turns out that there's no reason to have both I* and Bn* versions
of the createBufferQueue method, so I removed the Bn* version.
Change-Id: I66aeb09e10458ae540ddf1f38d2d0154ea8f315b
- Notify a listener when sideband stream is set
- Mark a layer as visible when sideband stream is set, even though
no buffer is queued.
Change-Id: I9652bf530f2b5ce331533ec1bb3b10a815ca191c
VSYNC power hints are now sent via binder to IPowerManager.
SurfaceFlinger no longer loads a second copy of the PowerHAL.
VSYNC power hints are sent in batches and not on per frame basis.
Change-Id: Icc2eee5df56135bd24dc244a84e7c12dd5511fec
Add a callback to the producer side, onBufferReleased, which will be
called every time the consumer releases a buffer back to the
BufferQueue. This will enable a buffer stream splitter to work
autonomously without having to block on dequeueBuffer.
The binder object used for the callback replaces the generic IBinder
token that was passed into IGraphicBufferProducer::connect to detect
the death of the producer. If a producer does not wish to listen for
buffer release events, it can pass in an instance of the
DummyProducerListener class defined in IProducerListener.h, if it even
cares about death events (BufferQueue doesn't enforce the token being
non-NULL, though perhaps we should).
Change-Id: I23935760673524abeafea2b58dccc3583b368710
GraphicProducerWrapper(GPW) changed how the methods of
BpGraphicBufferProducer(BpGBP) are executed.
First, "fake" BpGBP is created. Its remote is GPW. The GPW has
wrapped the real BpGBP.
All the method calls to the fake BpGPB will be intercepted by
the GPW inside it when the methods run into remote()->transact().
Then the GPW will invoke the transact() of the real BpGBP. And
Everything runs well except that the GPW forgets to store the
transact status and always return NO_ERROR to the fake BpGBP.
It would be disastrous if the binder call of the IGBP failed and
the out parameter "reply" of transact() was in unkown state.
E.g. the queueBuffer() in the fake BpGBP will try to operate on
the "reply". This will crash the SurfaceFlinger.
Change-Id: I01b31f64e1fc92804da3f16c1fb1420dcfb3b855
Signed-off-by: bdeng3X <bingx.deng@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
Sideband streams are essentially a device-specific buffer queue that
bypasses the BufferQueue system. They can be used for situations with
hard real-time requirements like high-quality TV and video playback
with A/V sync. A handle to the stream is provided by the source HAL,
and attached to a BufferQueue. The sink HAL can read buffers via the
stream handle rather than acquiring individual buffers from the
BufferQueue.
Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
Adds detachBuffer and attachBuffer calls to both the producer and
consumer sides of BufferQueue. Buffers may be detached while dequeued
by the producer or acquired by the consumer, and when attached, enter
the dequeued and acquired states, respectively.
Bug: 13173343
Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
Virtual Display async setting is overridden by eglApi.c causing
stall during composition.
Set the async mode after eglCreateWindowSurface()
b/13139121
Change-Id: I336ca145552e387217cd8bea6e4b7f5f490a274d
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Individual devices may need to force surfaceflinger to compile for
32-bit if they don't have 64-bit GL libraries.
Change-Id: I3703b2f8e36e90cf125d9ed5e6318c3506861948
Moves the "opaque layer" from Layer to Layer::State. This allows
it to be updated as part of a transaction.
Bug 12387406
Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.
Bug: 11805195
Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.
Bug: 12101046
Change-Id: I600365c0fd5d3ad93e04295d26cf9de177ffc79b
Moves the "opaque layer" from Layer to Layer::State. This allows
it to be updated as part of a transaction.
Bug 12387406
Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
b/12487813
SurfaceFlinger crash is observed during simulation of
Secondary display
Note: change 14e8b01a76
removed the initialization leading to the crash when
simulating secondary display. Restore the initialization
to solve the problem.
Change-Id: Iae5845fb82735e01de5cc0dc582d13c27e3c614f
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
MobC00383030
b/12487813
SurfaceFlinger crash is observed while connecting
to Wi-Fi display.
Note: change 14e8b01a76
removed the initialization leading to the crash when
running through the HWC composition path. Restore the
initialization to solve the problem.
Change-Id: I581defc7135ac512080c0da06a62b1dae7d218c4
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Continuing to send the last-rendered framebuffer to HWC on subsequent
frames allows the HWC to read partially-composed regions that haven't
changed, instead of re-composing from scratch.
Bug: 11573910
Change-Id: I8829877d2a06001f1e1b3f168cbba71c7b217b2d
We were already making sure the HWComposer class had the handle before
prepare, but it wasn't passing the handle along to HWC as intended.
Partial fix for bug: 11430248
Change-Id: I25f672c4fdfaa6a81fe0acb24d9ad05153ee17dc
If the virtual display surface is being consumed by the CPU, it can't
be allowed with HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED since there is
no way for the CPU consumer to find out what format gralloc chose. So
for CPU-consumer surfaces, just use the BufferQueue's default format,
which can be set by the consumer.
A better but more invasive change would be to let the consumer require
a certain format (or set of formats?), and disallow the producer from
requesting a different format.
Bug: 11479817
Change-Id: I5b20ee6ac1146550e8799b806e14661d279670c0
This change fixes a bug that caused an extra frame of latency when enabling
vsync event callbacks in DispSync. The bug was related to the logic that
prevents the two events from firing with very little time between them due to
updates to the vsync model.
Bug: 11479720
Change-Id: Ie7eaff9e92ffb7b7b6cb4d3d4402c96cbd29af7e
When this boardconfig is defined, even when all virtual display
composition is done by GLES, the HWC will be forced to copy from the
GLES framebuffer to the output buffer. On some hardware this allows
HWC to do format conversions that would otherwise have to be done by
the consumer, with worse power and/or performance.
Bug: 8316155
Change-Id: If980ecc589f138cef063eafa757f7f748196713e
When GLES isn't writing to the output buffer directly, request an
implementation-defined format with minimal usage flags, leaving the
format choice up to gralloc. On some hardware this allows HWC to do
format conversions during composition that would otherwise need to be
done (with worse power and/or performance) by the consumer.
Bug: 8316155
Change-Id: Iee6ee8404282036f9fd1833067cfe11dbadbf0bf
This change allows SurfaceFlinger to run at a different vsync phase offset from
that used by external listeners.
Bug: 11175503
Change-Id: I561c53a5659fa6dc1e3e4ae30340f3c1a6adceb4
This change adds a new thread for calling HWComposer's eventControl
asynchronously. The DispSync-based vsync approach ends up enabling and
disabling HWComposer's vsync callbacks at arbitrary times, and some HWComposer
implementations do not have these calls optimized.
Bug: 11175503
Change-Id: I719be82bd200b391c61d40863b991c7b59acdfd6