Commit graph

79044 commits

Author SHA1 Message Date
Ady Abraham
dfd6216090 SurfaceFlinger: missing configChanged event on idle
This change fixes a condition where a configChanged event
will be dropped due to idle timer.

Change-Id: I803f478c261be9fceb3495526576b495d7d0f385
Bug: 155367075
Test: CtsGraphicsTestCases
2020-06-11 17:04:36 -07:00
Ady Abraham
0ccd79b10b SurfaceFlinger: stabilize heuristic refresh rate calculation
When calculating layer's refresh rate heuristically, also store
a history of the last refresh rate calculated. We use this list to
determine how consistent is the refresh rate. If the refresh rate is
not consistent, then we keep reporting the last consistent refresh rate
and wait for the refresh rate to stabilize again.

Test: Play at 60fps video in XPlayer
Bug: 157540021

Change-Id: If3b525820d298cc5835dddf73f327501c8a18964
2020-06-11 11:17:09 -07:00
Ady Abraham
b1b9d41c73 SurfaceFlinger: define a known frame rates list
Keep a list of known frame rates that would be used when we calculated
heuristically the frame rate of a layer. This keeps the signal to the
algorithm that chooses the refresh rate steady and avoid strange
frame rates like 57.2 due to inconsistent presentation timestamps.

Bug: 157540021
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Change-Id: I97a24b74605256646e9b8444bd9f3818fe0a4a2a
2020-06-09 16:59:33 -07:00
TreeHugger Robot
607a0c6d5a Merge "[RESTRICT AUTOMERGE]gpuservice: always dump all in BugReport" into rvc-dev 2020-06-08 16:33:20 +00:00
Kevin DuBois
0bc7c5294b Merge "SF: avoid updating queue if schedule() is called." into rvc-dev 2020-06-08 15:02:50 +00:00
Marin Shalamanov
810a75538b Merge "[SF] Don't reset display state on reconnection" into rvc-dev 2020-06-08 13:54:22 +00:00
Yiwei Zhang
90153a1f6c [RESTRICT AUTOMERGE]gpuservice: always dump all in BugReport
Bug: 158386226
Test: take a bugreport and verify dumpsys gpu is not empty
Change-Id: Ib2827a72819ef3ccd3267144aaea2e5977f01745
2020-06-07 16:57:10 -07:00
Kevin DuBois
5c18c1cf64 SF: avoid updating queue if schedule() is called.
Avoids a rarish race condition where a callback is scheduled in the
interim time between the TimerDispatch starting to run and the callback
for that scheduled callback is invoked. In this condition, the code will
now have the next callback pend until the timer queue processes the when
to wakeup next.

Bug: 154303580
Test: 3 new unit tests
Test: boot to home, check some animations
Test: overnight dogfood with patch.

Change-Id: I0e7e2e3698ed6d1765082db20d9cf25f6e6c2db2
2020-06-05 07:50:52 -07:00
JW Wang
5bcc8f8a38 Merge "Delete APK snapshots during restoration (3/n)" into rvc-dev 2020-06-05 01:29:08 +00:00
TreeHugger Robot
a8d1de82db Merge "Fix issue where surface corner rounding is ignored" into rvc-dev 2020-06-04 21:51:09 +00:00
Marin Shalamanov
4c5e301006 [SF] Don't reset display state on reconnection
Currently we reset the display state when hotplug reconnect
is received for an already connected display. This is not
correct, instead the state has to be updated by DisplayManager.

This fixes a bug when config_maxUiWidth is set in frameworks/
base. In this case the framework sets the display viewport to
match the limited layer stack size but this setting is lost
after a hotplug.

Bug: 157549449
Test: build, flash, plug out and in the display, make sure the
          picture is still properly displayed
Change-Id: If8536963a4b912a6ff7d41a0fe54181cae35cc65
2020-06-04 21:44:37 +02:00
Muhammad Hasan Khan
501178aac0 Merge "arc: Implement smaller dumpstate output" into rvc-dev 2020-06-04 19:39:41 +00:00
Lucas Dupin
eab7ea0e64 Fix issue where surface corner rounding is ignored
It's not correct to only check the diagonal of the transform matrix
for scaling. The scale will be distributed across four components
when the layer is rotated.

Test: manual
Test: atest LayerTypeAndRenderTypeTransaction
Fixes: 147415720
Change-Id: I140b373efd7fad705d0cd54aa6e86b4142e190e5
2020-06-04 11:47:34 -07:00
Rhed Jao
e1b7671b90 Merge "Sorts the vector of files by the mtimes" into rvc-dev 2020-06-04 02:29:00 +00:00
Rhed Jao
01dc0c657a Sorts the vector of files by the mtimes
GetDumpFds should return a vector sorted with descending
order by the mtimes of dumps.

Bug: 149242559
Test: atest dumpstate_test
Test: adb bugreport && verify last anr dumped
Change-Id: I1ed9ceb35ec93b10660f2fb31785899d50bd285d
2020-06-03 19:48:25 +08:00
Rob Carr
c43da98656 Merge "DO NOT MERGE: SurfaceFlinger: Don't wake for pending transactions." into rvc-dev 2020-06-02 20:21:05 +00:00
TreeHugger Robot
ab63fa0eb5 Merge "Stop requantizing complex derived sensors" into rvc-dev 2020-06-02 19:09:51 +00:00
Anthony Stange
5dc55cac38 Stop requantizing complex derived sensors
Sensors that derive their output from physical sensors and effectively
apply an irreversible filter onto their data. Requantizing this
information has little benefit and can potentially increase floating
point inaccuracy due to the additional math.

Bug: 157986376
Test: presubmits
Change-Id: I4158739abb6b74d978abe75bd8e03ac32ad4e998
2020-06-02 13:56:35 -04:00
TreeHugger Robot
19e96d089f Merge "SF: Reconfirm all period changes, ignore HWC" into rvc-dev 2020-06-02 17:24:24 +00:00
TreeHugger Robot
c8f7d50cd0 Merge "Fix logical error in UID idle/active handling" into rvc-dev 2020-06-02 14:31:58 +00:00
TreeHugger Robot
d9f4f88929 Merge "SurfaceFlinger: record layer history for TX with eAnimation" into rvc-dev 2020-06-02 03:20:45 +00:00
TreeHugger Robot
3c62656e42 Merge "Add layer flag to allow creating an effect layer without color fill" into rvc-dev 2020-06-01 23:41:12 +00:00
Arthur Ishiguro
3cc2c3593d Fix logical error in UID idle/active handling
There is a bug where the sensor is not properly deactivated
when ann app becomes idle. This CL fixes the issue, and also
avoids calling batch() if no active clients exist.

Bug: 157934995
Test: Flash, verify sensor is disabled when app goes idle
and re-enabled when app becomes active again

Change-Id: I403b02a20dc89c5ce0630de6ddfd6242bf38ec37
2020-06-01 16:23:40 -07:00
Lucas Dupin
b31d3c81e9 Merge "Do not accept blur transaction when disabled" into rvc-dev 2020-06-01 21:14:14 +00:00
Lucas Dupin
130e55ca93 Do not accept blur transaction when disabled
Bug: 155420902
Test: forrest
Change-Id: I5f0437f28c25465091cec4cb78e8f5c55bc94f0e
2020-06-01 21:14:00 +00:00
Dan Stoza
027d365531 SF: Reconfirm all period changes, ignore HWC
This change includes two separate fixes to make waking up from idle more
robust when using a kernel idle timer:

  1) Always reconfirm the refresh rate when we resync to hardware vsync.
     This is because if the kernel idle timer is enabled, we may not
     immediately be in the refresh rate we expect to be.
  2) Ignore the refresh rate reported by the hardware vsync callbacks,
     since that refresh rate may not reflect the actual refresh rate
     when the kernel idle timer is in effect.

Bug: 154303580
Test: systrace
Test: libsurfaceflinger_unittest
Change-Id: I79c66faeaed262acd9c5925fe2202a9fb3f10b7b
2020-06-01 13:54:50 -07:00
Steven Thomas
5234f933a4 Merge "Clarify FRAME_RATE_COMPATIBILITY_* params" into rvc-dev 2020-06-01 20:44:30 +00:00
TreeHugger Robot
0979ea52c1 Merge "Add basic ANR test" into rvc-dev 2020-06-01 19:59:54 +00:00
Robert Carr
7ec777d945 DO NOT MERGE: SurfaceFlinger: Don't wake for pending transactions.
When we still have pending transactions (e.g. we are waiting on the
other side of a deferred transaction), we need to set the transaction
flags on SurfaceFlinger, so SurfaceFlinger will continue to call
doTransaction and give us a chance to process them. However when
we set the transaction flags, we trigger a wake up! This isn't
desirable, as the frame might have not come in. If the frame did come
in we will get to INVALIDATE, and from INVALIDATE observe the
transaction flags. This means we can set the transaction flags without
scheduling a wakeup and rely on the incoming frame to eventually wake
us up. I also considered triggering the transaction processing from
onFrameAvailable but at that point we are too late in the composition
cycle.

Bug: 157685525
Test: Existing tests pass
Change-Id: Ia54bc9f48a80906fc8f21c46debc72fabadd3e07
2020-06-01 18:44:05 +00:00
Ady Abraham
5def733be3 SurfaceFlinger: record layer history for TX with eAnimation
If a transaction is posted with ISurfaceComposer::eAnimation flag,
record it with layer history. Layers with eAnimation are considered
animating and will vote for peak refresh rate.

Bug: 157695685
Test: Play 24fps video in YouTube PIP mode with setFrameRate and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Change-Id: If62e11b395c44d9e5fd40b74864fefd068953413
2020-06-01 11:20:23 -07:00
Siarhei Vishniakou
ffaa2b1630 Add basic ANR test
To reduce the delta of the upcoming ANR refactor, add a basic ANR test
here. This will also help highlight the difference in behaviour from the
current code to the new code.

To cause an ANR today, the socket needs to be blocked, which means that
we need to send ~ 50 events to the unresponsive window.

These workarounds will be removed when the ANRs are refactored.

Bug: 143459140
Test: adb shell -t /data/nativetest64/inputflinger_tests/inputflinger_tests --gtest_filter="*InputDispatcherSingleWindowAnr*" --gtest_repeat=1000
--gtest_break_on_failure

Change-Id: I0a1b28c2785d03d8870691641e0f7c6b1ca3b85e
Merged-In: I0a1b28c2785d03d8870691641e0f7c6b1ca3b85e
2020-06-01 09:56:09 -07:00
Ady Abraham
983e568b3c SurfaceFlinger: keep layer history for inactive layers
The current implementation of layer history discards all the history
if a layer is considered inactive. This leads to an issue in the scenario
that a layer is posting infrequent updates so slow, that by the time we
get the next buffer, the layer is considered inactive, and we bump the
refresh rate to Max, instead of detecting that layer as infrequent.

As a fix, we keep around the layer history even if it is inactive.
To avoid cases where detect animations too late, we clear the history
on touch event.

Bug: 156654519
Test: add a new unit test that simulates the buffer pattern
of a Netflix playback

Change-Id: Ie076891806d74dde814fbbb3b1a73c38e0b2ae34
2020-05-29 16:22:50 -07:00
Vishnu Nair
c43a23c149 Add layer flag to allow creating an effect layer without color fill
This change allows creating an effect layers without a color fill so
we can avoid an additional sf transactions when creating effect
layers.

Fixes: 157646690
Test: go/wm-smoke
Test: atest SurfaceFlinger_test
Change-Id: I3d8a4f4820d7b8fb05daab697c25cff8def612c1
2020-05-29 14:38:30 -07:00
mhasank
f56bbb2bc0 arc: Implement smaller dumpstate output
Adds a -A commandline option to indicate a much smaller set of
dumpstate output safe for ARC++ bug reports.

Implements output of system logcat, event logs, networking, and dropbox
system server crash/system app crashes only.

Bug: 142684959
Bug: 136273873
Test: atest dumpstate_test

Change-Id: I192be7ed841cee0a8847e1057209ef2b164bab07
2020-05-29 13:16:18 -07:00
JW Wang
9b9b1aa062 Delete APK snapshots during restoration (3/n)
The snapshots are no longer needed after restore is done.

We do this in keeping with the fact that apk/apex code data is
deleted immediately after the rollback is committed.

See go/rollbackmanager-snapshot-deletion for more details.

Bug: 151805360
Test: N/A. Will be added in the next CL.

Merged-In: I5a7540aa08922c4b0c617c9cb37e1bec2ff23fc1
Change-Id: I5a7540aa08922c4b0c617c9cb37e1bec2ff23fc1
2020-05-29 16:18:17 +08:00
Ady Abraham
b74fe1dc23 Merge changes from topic "sf_157096772" into rvc-dev
* changes:
  SurfaceFlinger: clear LayerHistory on first touch
  Revert "SurfaceFlinger: more aggressive infrequent layer detection"
  Revert "SurfaceFlinger: tune MAX_FREQUENT_LAYER_PERIOD_NS for inactive layers"
  Revert "SurfaceFlinger: tune infrequent detection logic more"
2020-05-29 03:45:06 +00:00
TreeHugger Robot
0b257105a2 Merge "Process focus events first" into rvc-dev 2020-05-28 22:28:05 +00:00
Steven Thomas
710db09fe4 Clarify FRAME_RATE_COMPATIBILITY_* params
Bug: 155894036
Test: n/a
Change-Id: I23124fc3da0d870aa9a8b571cd7900aabf5a1326
2020-05-28 14:23:43 -07:00
Siarhei Vishniakou
de1bc4a4e3 Process focus events first
While refactoring ANR logic, we discovered that an existing Q behaviour
was broken by the focus refactoring. The behaviour aims to prevent keys
from being sent to incorrect windows.

The desired behaviour is as follows: if there are any unfinished events,
then do not process key events (keep them pending), which would allow
these key events to go to a new window, if one becomes focused. The
intent is that if the user hits "Alt+Tab" to switch to another window,
and starts typing right away, we want to make sure that we have
processed the focus event for the new window prior to determining where
to send the new key events after Alt+Tab.

The behaviour is broken today because we put the focus events at the
back of the queue. So even if we process the focus event first, it would
still go to the app after the key event, which would mean that the new
window may receive it, but would drop it because that window does not
yet have focus (since we haven't sent the focused event to it).

The proposed solution is to always put the focus events in the front of
the queue. But, we still need to preserve the relative order of focus
events. To account for that, we put a new focus event always at the
front of the queue, but behind any other focus events that may be there.

Bug: 143459140
Test: added in ANR CL because this behaviour is updated there.
Change-Id: I95256bd3f57988d1990cf1f21267c8f405892e8e
Merged-In: I95256bd3f57988d1990cf1f21267c8f405892e8e
2020-05-28 14:05:17 -07:00
Ady Abraham
a6b676e33a SurfaceFlinger: clear LayerHistory on first touch
- Restructure the code in RefreshRateConfigs to be able to clear
   LayerHistory frames on the first touch event. Without this change we
   clear the history on every frame as long as the touch timer hasn't
   expired.
 - Add log prints for debugging

Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Bug: 157096772
Change-Id: I7cabecd6ea27ec335e773aa22bb111fa8ec89195
2020-05-28 18:48:29 +00:00
Ady Abraham
dfb63ba78b Revert "SurfaceFlinger: more aggressive infrequent layer detection"
This reverts commit 1adbb72759.

Reason for revert: Causing regression with b/157096772

Change-Id: Ib2009f7a4ecbd268ea69304853a91bd22674ec1e
Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Bug: 157096772
Bug: 155062712
Bug: 156654519
2020-05-28 18:48:22 +00:00
Ady Abraham
f5bc779caa Revert "SurfaceFlinger: tune MAX_FREQUENT_LAYER_PERIOD_NS for inactive layers"
This reverts commit eeb74561b6.

Reason for revert: Causing regression with b/157096772

Change-Id: I031219588cedf5cfcb75255430f707428ed59f72
Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Bug: 157096772
Bug: 157110371
2020-05-28 18:42:59 +00:00
Ady Abraham
af6d8a4142 Revert "SurfaceFlinger: tune infrequent detection logic more"
This reverts commit 39db2c9b07.

Reason for revert: Causing regression with b/157096772

Change-Id: I058d6f8efa637cb36371276761281f51b7aa3dd3
Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Bug: 157096772
2020-05-28 18:41:02 +00:00
TreeHugger Robot
69c7197c3e Merge "Generate ACTION_CANCEL event when screen turned off by proximity sensor." into rvc-dev 2020-05-28 18:35:08 +00:00
TreeHugger Robot
6de39e03fb Merge "gralloc4: Support RAW type in PlaneLayoutComponentType" into rvc-dev 2020-05-28 02:13:29 +00:00
Chavi Weingarten
a38a3e145a Merge "Hold mMutex lock and check abandoned when accessing mLayer" into rvc-dev 2020-05-28 00:16:11 +00:00
TreeHugger Robot
ac17aa0a0f Merge "Plumb client target property." into rvc-dev 2020-05-27 23:28:52 +00:00
chaviw
1a4dba4b2b Hold mMutex lock and check abandoned when accessing mLayer
The Layer lifecycle is tied to BufferLayerConsumer so when the Layer is
removed, the BufferLayerConsumer is abandoned. However, abandoned
doesn't necessarily mean it was cleaned up yet. Therefore, we need to
check whether the BufferLayerConsumer was abandoned before accessing the
raw pointer mLayer. If the BufferLayerConsumer was not abandoned, then
mLayer will be valid.

Test: Builds and runs. Hard to reproduce race condition
Fixes: 157535966
Fixes: 155679049
Change-Id: I8b309c9e1fe57746bceabab1deda56248087b189
2020-05-27 15:16:15 -07:00
Alec Mouri
a9e0d8a9e3 Merge "Lock display refresh rate when primary range is a single rate." into rvc-dev 2020-05-27 21:55:30 +00:00
Yichi Chen
706933754b gralloc4: Support RAW type in PlaneLayoutComponentType
The patch creates RAW type in PlaneLayoutComponentType to make list
complete.

Bug: b/157534008
Test: VtsHalGraphicsMapperV4_0TargetTest
Change-Id: I871f90756eafb848cf7489b9710f4df47f8f8ec2
2020-05-27 16:24:43 +08:00