Commit graph

8357 commits

Author SHA1 Message Date
TreeHugger Robot
38c446365b Merge "Add layer flag to allow creating an effect layer without color fill" into rvc-dev am: 3c62656e42
Original change: undetermined

Change-Id: Ibc04d4e8a4221eecf53de803222bae4eb81ff95d
2020-06-01 23:55:49 +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
Lucas Dupin
e0e480c2d8 Merge "Do not accept blur transaction when disabled" into rvc-dev am: b31d3c81e9
Original change: undetermined

Change-Id: Id7e4e1cf741efa6cb88855ebb2ee1d866df8ee73
2020-06-01 21:48:09 +00: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
TreeHugger Robot
cc2a82e6c0 Merge "Add basic ANR test" into rvc-dev am: 0979ea52c1
Change-Id: I790b02e0012bdc4496de464176a745339a08eb5f
2020-06-01 20:14:11 +00:00
TreeHugger Robot
0979ea52c1 Merge "Add basic ANR test" into rvc-dev 2020-06-01 19:59:54 +00: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
Orion Hodson
499ad88989 Merge "Add dependencies on jni_headers" am: ed38697b9f am: 560de1587b
Change-Id: Idf1fc1cab46e19b6a38350323c53fe7acd7bd91f
2020-06-01 09:58:43 +00:00
Orion Hodson
560de1587b Merge "Add dependencies on jni_headers" am: ed38697b9f
Change-Id: Iea2c5fb12ea7b1ad563f540349063fcda557fbc1
2020-06-01 09:39:13 +00:00
Orion Hodson
ed38697b9f Merge "Add dependencies on jni_headers" 2020-06-01 09:20:10 +00:00
Ady Abraham
34cea217d5 SurfaceFlinger: keep layer history for inactive layers am: 983e568b3c
Change-Id: I0a89efdbae8c48d5aca6149aee8d1876e9d7c550
2020-05-30 01:16:01 +00: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
Treehugger Robot
036b105b6e Merge changes from topics "cursor_type_hotspot", "set_viewport_in_input_reader" am: 43beafe0b0
Change-Id: Ib3930377b494bf7bafce339165dff428a30563b6
2020-05-29 21:57:19 +00: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
Ady Abraham
7826b077fc Merge changes from topic "sf_157096772" into rvc-dev am: b74fe1dc23
Change-Id: Idee6fb1dd148987fd37bfeff0dd0497646cf38ad
2020-05-29 03:59:00 +00: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
74fc4aef8b Merge "Process focus events first" into rvc-dev am: 0b257105a2
Change-Id: I29926515404057126805eb7326615a9e5a907da0
2020-05-28 23:36:58 +00:00
TreeHugger Robot
0b257105a2 Merge "Process focus events first" into rvc-dev 2020-05-28 22:28:05 +00: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
Garfield Tan
0a080c3666 Let InputReader set mouse cursor's display.
InputReader was already responsible to bind device/event and display. It
makes sense to further extend it to control the display where mouse
cursor is shown.

Bug: 146385350
Test: Mouse cursor shows up at expected display.
Test: atest inputflinger_tests
Change-Id: Ie7a9546550b70c8834462b06de929472196fe713
Merged-In: Ie7a9546550b70c8834462b06de929472196fe713
2020-05-28 12:01:35 -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
Chavi Weingarten
a026ce7096 Merge "Hold mMutex lock and check abandoned when accessing mLayer" into rvc-dev am: a38a3e145a
Change-Id: Ib2b021000383a2156e9d6962fac91058944449c8
2020-05-28 00:25:26 +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
15a6c10cb2 Merge "Plumb client target property." into rvc-dev am: ac17aa0a0f
Change-Id: I60e9bed296ff2fc1890be027e4da5e325a5b890a
2020-05-27 23:43:47 +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
33f2fd9c57 Merge "Lock display refresh rate when primary range is a single rate." into rvc-dev am: a9e0d8a9e3
Change-Id: Ia7e254a4b9af6773eae790ee92dabc54d8df1c09
2020-05-27 22:11:41 +00: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
Orion Hodson
a58ef3567b Add dependencies on jni_headers
Preparation for removing implicit include paths for jni.h from soong.

Bug: 152482542
Test: m checkbuild
Change-Id: I06873e61e519b6e54d7325f90231bce732790366
Merged-In: I06873e61e519b6e54d7325f90231bce732790366
Exempt-From-Owner-Approval: build clean-up
(cherry picked from commit e32877afcc)
2020-05-27 16:52:08 +01:00
Marin Shalamanov
d815ba2176 [SF] Make sure destination clip is contained in display bounds am: c7f9e4eea2
Change-Id: I4712fe45bdfa3027e4502bb0794dc622c7c5a403
2020-05-27 04:48:29 +00:00
Marin Shalamanov
c7f9e4eea2 [SF] Make sure destination clip is contained in display bounds
When we render on a framebuffer with smaller size than the
currently active mode the destination clip can get outside
of the display bounds. For examlple, if the currently
active display mode is 4K, but we render on a 1080p framebuffer,
dest clip = 4k, but display bounds =1080p. As a result of that
only the top left quarter of the image is visible on screen.

Bug: 153991408
Test: manually make sure the image is properly displayed on sreen
     1. boot device
     2. turn off HWC with adb shell service call SurfaceFlinger 1008 i32 1
     3. turn on HWC with adb shell service call SurfaceFlinger 1008 i32 1
     4. start a youtube video and repeat 2 and 3.
Test: take a screenshot and check it's correctly displayed
Test: atest libsurfaceflinger_unittest librenderengine_test
Merged-In: Ia7b6ebd311c1b751c1966a34a9294b9b85a2aa0b
Change-Id: Ia7b6ebd311c1b751c1966a34a9294b9b85a2aa0b
(cherry picked from commit fcfe1360a4)
2020-05-25 11:37:56 +00:00
Ady Abraham
dbb46aa5d4 Merge "SurfaceFlinger: tree vote for FrameRateCompatibility::ExactOrMultiple" into rvc-dev am: ff9926fcf2
Change-Id: I07a56f8a0a85cc55eb3ca2692422509937c4d5f1
2020-05-22 07:06:17 +00:00
Ady Abraham
42678780e0 Merge "SurfaceFlinger: tune infrequent detection logic more" into rvc-dev am: 507056a4f4
Change-Id: I9ea6f8c5dbc7ee4dda475accf610cdd3c3a6337d
2020-05-22 02:31:41 +00:00
Ady Abraham
f3b1ef6e63 Merge "SurfaceFlinger: tune MAX_FREQUENT_LAYER_PERIOD_NS for inactive layers" into rvc-dev am: fd201b3cc5
Change-Id: Iba60e685cd1062b3e915b37e331895530e5af5ca
2020-05-22 02:31:32 +00:00
Ady Abraham
d6c3d774b9 Merge "SurfaceFlinger: frame rate heuristic during config change" into rvc-dev am: 36725c77ca
Change-Id: I899cf48235bb79097b2198401bbe9ab66aa99c0c
2020-05-22 02:31:22 +00:00
Ady Abraham
414e8b5cb7 SurfaceFlinger: tree vote for FrameRateCompatibility::ExactOrMultiple
Layers that voted with FrameRateCompatibility::ExactOrMultiple
will still allow touch boost as those layers are typically not
interactive and therefore touch is probably meant for a different
layer. For the same reasoning, we should continue to heuristically
calculate frame rate for layers in the same tree.

Bug: 157254751
Test: run Swappy with statistics overlay and observe refresh rate
Test: run YouTube, play a video, scrolling the recommended videos and observe refresh rate
Change-Id: I9311512a663eba61dfcae6277a52c077e135a244
2020-05-22 00:49:17 +00:00
Treehugger Robot
9876e1fcfb Merge "CompositionEngine: fix HWC transform calculation" am: cc56eff39b
Change-Id: Ic0d70e23586897ebdfd98345f88365d5bd4993db
2020-05-21 23:34:52 +00:00
Treehugger Robot
cc56eff39b Merge "CompositionEngine: fix HWC transform calculation" 2020-05-21 23:20:58 +00:00
Ady Abraham
39db2c9b07 SurfaceFlinger: tune infrequent detection logic more
A layer will be considered frequent unless proven otherwise, in order
to make sure animations will change the refresh rate as soon as possible.
In addition, if a layer is classified infrequent, then we will keep it
infrequent until we get a burst of frames. These two policies combined
allow us to differentiate between an animating layer and a layer that
usually doesn't animate.

Bug: 157096772
Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Cursor blinking on Messages - switch to lowest refresh rate quickly
Change-Id: I3629b6e4786cd43919f51465e347f2abb52234d9
2020-05-21 16:16:56 -07:00
Ady Abraham
eeb74561b6 SurfaceFlinger: tune MAX_FREQUENT_LAYER_PERIOD_NS for inactive layers
Tune the threshold for detecting inactive layers to treat 24fps
videos without presentation timestamps as frequent.

Bug: 157110371
Test: Chrome playing video and observe systrace
Change-Id: I6908761ef2af7e40cd40eda6e1e66c8e1a01393f
2020-05-21 15:45:07 -07:00
Ady Abraham
32efd54dfa SurfaceFlinger: frame rate heuristic during config change
Some devices might takes a few frames to change the refresh rate.
Calculating the frame rate should ignore frames sent while changing
the refresh rate as those might result in an inaccurate frame rate
due to frame misses.

Bug: 156530990
Test: Running Hay Day and observing refresh rate.
Change-Id: I99f364cd1816c3ce2ba3c3145331eb618dcaea71
2020-05-21 15:41:49 -07:00
Rashed Abdel-Tawab
9135ddd59a CompositionEngine: fix HWC transform calculation
Use the correct display transform in calculateOutputRelativeBufferTransform().
When SF_PRIMARY_DISPLAY_ORIENTATION is set, DisplayDevice only updates the
logical to physical transform; OutputCompositionState.orientation doesn't
change.

Test: - OutputLayerTest.displayInstallOrientationBufferTransformSetTo90
      - Run "dumpsys SurfaceFlinger" on a device with SF_PRIMARY_DISPLAY_ORIENTATION
        set to 90 and verify that the HWC transform is 0 (identity)
      - screencap
Change-Id: I079b5ea22de8d47a7fb7233d01decfbd4b578be8
Merged-In: I079b5ea22de8d47a7fb7233d01decfbd4b578be8
2020-05-21 22:02:05 +00:00
Alec Mouri
11232a26ad Lock display refresh rate when primary range is a single rate.
When DMS enforces a fixed refresh rate to hide user-visible flickering,
we must respect that refresh rate to avoid unnecessary switches during
scenarios such as idle and touch boost.

We must still respect app votes when they explicitly provide a frame
rate.

Bug: 156315203
Test: Exoplayer
Test: Modified version of SetFrameRateTest to simulate 60hz video
Test: libsurfaceflinger_unittest
Change-Id: I5fe974ddaff30e2f02e381cb63e0a6418834fdb5
2020-05-21 11:36:01 -07:00
Michael Hoisie
e9c515b964 Merge "Remove unused dependencies in SurfaceFlinger" into rvc-dev am: c30ebd0188
Change-Id: Ic3bd39c9ea9adc46cffb7c6aa318db7d4753670a
2020-05-19 18:25:10 +00:00
Michael Hoisie
c30ebd0188 Merge "Remove unused dependencies in SurfaceFlinger" into rvc-dev 2020-05-19 18:09:55 +00:00
Steven Thomas
fca7172c4a Merge "With content detection off, prefer default frame rate" into rvc-dev am: 98b789db15
Change-Id: I2789caaf1889ac524369a0cbf0de6d5533d2b30c
2020-05-19 18:02:32 +00:00