Rather than trying to acquire the state lock without waiting three
times at 1 second intervals in SurfaceFlinger::dump(), just try to
acquire the lock once with a 1 second timeout. Avoids spurious mutex
acquire failures that lead to flaky
com.android.cts.jank.opengl.CtsHostJankOpenGl results.
Bug: 18842510
Change-Id: I00ce6109647de2aef8831dd2f8fa98652ba7f4e0
This code doesn't need to run on the Mac, and the BoringSSL transition
will be easier without references to external/openssl.
Change-Id: I14ea11fa2911af0f4e95e69636e6a2c26126cbe0
Use LOCAL_WHOLE_STATIC_LIBRARIES to instruct static linker
to export symbols from the static library.
(cherry picked from commit 4340a14fbf)
Bug: 18701723
Change-Id: I70f6fdb64b0d1adbadf96c8de85870a903ec186a
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.
This is a squashed commit based on an initial change with a couple of
fixes to avoid breaking certain targets. The source commits are:
d723bd766900d504c06e429ba89cd2
Change-Id: I034abec27bf4020d84af60d7acc1939c59986dd6
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.
Change-Id: I034abec27bf4020d84af60d7acc1939c59986dd6
Enables clang and C++11 for libui/libgui/surfaceflinger, and
eliminates all compile-time warnings.
Change-Id: Ie237fdb5ae44f2bfcddaa884f9c65ec3f08ae50f
(cherry picked from commit f10c46ef85)
"Do less work when using PTS" broke the invalidate path up from HWC
to SurfaceFlinger. When HWC would signal an invalidate, SurfaceFinger
would wake up, see no new buffers, and go back to sleep. This is fine,
except when the invalidate is a result of an HDMI hotplug, in which
case the screen remains blank. This change makes that functionality
work again.
Bug: 18564815
Bug: 18558468
Change-Id: I2e2171d86839945f4e4e6555d66f7e2895bd096a
Count items as they are added and removed rather than iterating over the
entire list to count them.
Increases performance slightly, particularly when tracing is turned on,
which causes count to be queried more often, and when the number of
items in the queues grow large. This can happen due to applications not
responding, for example.
Change-Id: I0f11f7edd46089612af910cdfabfeb3ee685d7d9
clang warns about SensorEventConnection::dump overloading BBinder::dump
in some conditions.
Since the cause isn't fixable without changing the API, tell clang not
to error out on it.
Change-Id: I15659de7c5499d937019599cfefb01305039e6b5
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
A sensor name containing a format string could have interesting side
effects...
Change-Id: If7f1378aa68572d9716c339728eab18faa6b9f2a
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Ensure that the adjusted transparent region is within
the display bounds by clamping after the transformation
is applied and clean up transform's inverse function.
Bug: 18452546
Change-Id: Ia473e483ee8374177bcb84d8192eb1f0e86f022a
* Explicit conversion for atomic_uintptr_t initialization.
* Fix string literal concatenation to not be a UD literal.
* Use __typeof__ instead of typeof (should become decltype once this
actually moves to C++11).
Bug: 18466763
Change-Id: I4eedddfb945a2a703ed27317cb6e2b3041b1ebfc
Currently, SurfaceFlinger is very dumb about how it handles buffer
updates at less than 60fps. If there is a new frame pending, but its
timestamp says not to present it until later SurfaceFlinger will wake
up every vsync until it is time to present it. Even worse, if
SurfaceFlinger has woken up but nothing has changed, it still goes
through the entire composition process.
This change (mostly) fixes that inefficiency. SurfaceFlinger will
still wake up every refresh period while there is a new frame
pending, but if there is no work to do, it will almost immediately go
back to sleep.
Bug: 18111837
Change-Id: I7825bacd37f40bf26edcc6a5e0f051dce45291fb
keyBitmask and ledBitmask are arrays, "!their address" always evaluates to
false. clang complains about this.
Change-Id: I6aed45a203b0eeaad2093dbdebea03a2c2fc1a3d
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
so we can do NULL checks again, and update calls to IInterface::asBinder()
to use the new static version.
Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a
I'm pretty sure I had done this before... Must have been new
dependencies that slipped in when L merged in.
Bug: 15193147
Change-Id: Ib9b1b8a65665d25c33c6141b9476a8e13c4084e0
so we can do NULL checks again, and update calls to IInterface::asBinder()
to use the new static version.
Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a
Enables clang and C++11 for libui/libgui/surfaceflinger, and
eliminates all compile-time warnings.
Change-Id: Ie237fdb5ae44f2bfcddaa884f9c65ec3f08ae50f
This code is no longer necessary and was preventing input from
reaching their desired windows. See bug 17648830.
Change-Id: Ib1c026ece70e6fa98343340b89af4199d6d0ffca
Passes the BufferItem for the queued buffer to the onFrameAvailable
callback so the consumer can track the BufferQueue's contents. Also
adds an onFrameReplaced callback, which is necessary if the consumer
wants to do anything more than simple queue length tracking.
Bug: 18111837
Change-Id: If9d07229c9b586c668e5f99074e9b63b0468feb0
Validate the display binder by adding a NULL check in getDisplayConfigs.
This will prevent a false match if the caller queries the display
configs for an inactive display (whose binder is NULL by default).
Without this change we might end up attempting to index the display
config array, which is unpopulated for inactive displays, and this will
result in a crash. (See getDisplayInfo in SurfaceComposerClient.cpp for
an example of this scenario)
Change-Id: I1a12f43b7c375b9c01998dadd5b658275c733fb2
Acked-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
If SensorService is holding a wake_lock and there are no acknowledgements
from ANY app within 5 seconds, release the wake_lock and reset the wake_lock
refcounts for all connections.
Bug: 16874240
Change-Id: I5e950dd393c20173c439cbd5a4ba614ee09d61f4
warning: comparison of integers of different signs: 'int' and 'size_t'
(aka 'unsigned int') [-Wsign-compare]
arning: comparison of integers of different signs: 'int32_t' (aka
'int') and 'const uint32_t' (aka 'const unsigned int')
[-Wsign-compare]
Change-Id: I823257aa7218c5fd492a3277853210db539bb2e2
(cherry picked from f9bfdc6c94)
warning: struct 'HWComposer' was previously declared as a class
[-Wmismatched-tags]
warning: class 'DisplayInfo' was previously declared as a struct
[-Wmismatched-tags]
Change-Id: I13db9f8aab3a957ce8ff8d64598dae1807d6fe7e
(cherry picked from commit 646f541050)
This change watches for a MAX_VIRTUAL_DISPLAY_DIMENSION value, which
will be set (if necessary) in BoardConfig.mk. If the value is set,
any virtual displays that have a width or a height greater than that
dimension will bypass the hardware composer HAL and be handled only
by SurfaceFlinger.
Bug: 17701816
Change-Id: Ia6ca44dfd6a7a9bc0f054493d3f13006bc32fa14
After creating a syncKHR object with type EGL_SYNC_NATIVE_FENCE_ANDROID,
glFlush must be called before the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute
is populated with a sync fd. We currently call eglDupNativeFenceFDANDROID
before issuing the flush.
Bug 18052459
Taken verbatim from matthew.k.gumbel@intel.com.
Change-Id: I3781d14f92862076e2bca7d27341a6dc6e7e3775
ANativeWindow::queueBuffer takes ownership of the fence fd passed to
it, and will close it before returning. SurfaceFlinger's screenshot
code was also closing the syncFd it passed to queueBuffer. Most of the
time this meant the second close() silently failed, but in a rare race
condition the file descriptor could be reused between the two
close()s.
Bug: 17946343
Change-Id: Ib74fcb1dce52cc21328059c99b7c4c76f41aa3a5
Use LOCAL_WHOLE_STATIC_LIBRARIES to instruct static linker
to export symbols from the static library.
Change-Id: I0e41cf173be96c52cdad72b1ef4a1bf819e65dd2
And export necessary symbols to preempt calls from libart.so
Bug: 15345057
Bug: 15426766
(cherry picked from commit f3da24d8cf)
Change-Id: I03b632e0bf2cbaf4a0e68cd0af4e991f7f6b08e4
Print more details about the exact reason that an ANR has occurred.
Also start checking that the window actually has a registered
input connection that is not in a broken state. These windows
are supposed to be cleaned up by the window manager promptly
as if the app had crashed but the pattern of ANRs we are observing
suggests that broken windows might be sticking around longer than
they should.
Bug: 17721767
Change-Id: Ie2803a3fa9642381ecadc198fec15e1b70d93c20
Blobcache is not yet enabled for surfaceflinger (as it should be).
As a temporary workaround, generate all needed shaders during
surfaceflinger initialization instead of doing the compilation
on-demand during ui transitions.
Change-Id: I14455b20a3f85f177d85c9c8b76d8ccc35379b39
i) Call removeFd() only if the fd in the BitTube has been
previously added to the Looper. Use a flag to determine whether the fd
has been previously added or not.
ii) Increment mPendingFlushEventsToSend after holding a connectionLock.
iii) Store the number of acks that are pending in SensorEventQueue
and send them all at once.
Bug: 17472228
Change-Id: I1ec834fea1112a9cfbd9cddd2198438793698502
Blobcache is not yet enabled for surfaceflinger (as it should be).
As a temporary workaround, generate all needed shaders during
surfaceflinger initialization instead of doing the compilation
on-demand during ui transitions.
Change-Id: I14455b20a3f85f177d85c9c8b76d8ccc35379b39
We normally recompute layer visibility when a layer gets its first
buffer; before then it's treated as invisible. Sideband layers never
get a buffer (as far as SurfaceFlinger knows), so never became
visible. Now we also recompute visibility when a layer gets a new
sideband stream.
Bug: 17752511
Change-Id: I84e150f196eb2eb7bcd2616248e5e3fa73624809
* commit 'b17044adcf951b66ce2ecb7f7835572d7448bd64':
Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections."
When HWC doesn't provide DPI values for a display, we pick a default
DPI based on resolution. The intent was that 1080p and higher displays
would get XHIGH density, and lower resolutions would get TV density.
In KK (and possibly forever) we had a bug that we'd always use TV
density. That was fixed in L, but that fix exposed a pre-existing bug
that we always used the display's height in its native orientation,
rather than in landscape orientation. So an 800x1280 tablet like N7v1
started getting XHIGH density instead of the intended TV density.
Bug: 17461633
Change-Id: Ia57fa49e61f36bdda63ce283ef62c9953297222c
If the destructor of SensorEventConnection gets called when the main
sendEvents loop of SensorService is executing it may result in a deadlock.
The loop promotes each connection to a strong_pointer, calls sendEvents
and cleans up the connection if necessary. It is possible that the sp's
destructor may delete SensorEventConnection which will call the dtor
~SensorEventConnection(). This dtor again needs SensorService mLock to
execute which may result in a deadlock.
Bug: 17617897
Change-Id: I76c244dbe85fadb591c0bd1a9a5eb01d93f56505
* commit '71e351d96b551ccdbc39b52a0c66da86cae83701':
Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections."
* commit '71e351d96b551ccdbc39b52a0c66da86cae83701':
Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections."