Commit graph

78997 commits

Author SHA1 Message Date
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
ac17aa0a0f Merge "Plumb client target property." into rvc-dev 2020-05-27 23:28:52 +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
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
Jesse Hall
68904ad94c Merge "libvulkan: support vkGIPA self-query" into rvc-dev 2020-05-22 21:03:03 +00:00
Ady Abraham
ff9926fcf2 Merge "SurfaceFlinger: tree vote for FrameRateCompatibility::ExactOrMultiple" into rvc-dev 2020-05-22 06:43:19 +00:00
Ady Abraham
507056a4f4 Merge "SurfaceFlinger: tune infrequent detection logic more" into rvc-dev 2020-05-22 02:15:10 +00:00
Ady Abraham
fd201b3cc5 Merge "SurfaceFlinger: tune MAX_FREQUENT_LAYER_PERIOD_NS for inactive layers" into rvc-dev 2020-05-22 02:14:56 +00:00
Ady Abraham
36725c77ca Merge "SurfaceFlinger: frame rate heuristic during config change" into rvc-dev 2020-05-22 02:14:41 +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
Jesse Hall
7559c76d12 libvulkan: support vkGIPA self-query
vkGetInstanceProcAddr(nullptr, ...) is valid and is effectively a
globally dispatched function, so it's consistent to support querying
vkGetInstanceProcAddr from itself without an instance.

This is required in Vulkan 1.2 and is supported for all Vulkan versions
by the loader on other platforms. To maximize app compatibility and
minimize surprises, this makes it work on Android also, even for pre-1.2
versions where the result is undefined by the spec.

Bug: 157173922
Test: dEQP-VK.api.version_check.entry_points with
      https://gerrit.khronos.org/#/c/5490/ applied and modified to
      check even on pre-1.2 implementations.
Change-Id: I820dd1239df54a415b7ff5db47cf2c2b349f6155
2020-05-21 16:28:48 -07: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
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
TreeHugger Robot
76ad0655bb Merge "log when waiting on a servicemanager" into rvc-dev 2020-05-20 19:14:41 +00:00
Steven Moreland
fb10b6b588 log when waiting on a servicemanager
Since vndservicemanager is no longer installed by default, this gets hit
on those devices.

Fixes: 156571068
Test: TH
Change-Id: I31af865326e9a69042e5c53b63637b95d6de9ad1
(cherry picked from commit 39a572183a)
Merged-In: I31af865326e9a69042e5c53b63637b95d6de9ad1
2020-05-20 17:58:05 +00:00
Jooyung Han
513a77cffd Merge "setDefaultImpl aborts on a second call" into rvc-dev 2020-05-19 23:00:08 +00:00
Jooyung Han
01097e2410 setDefaultImpl aborts on a second call
The actual problem is that default implementation is set globally.
setDefaultImpl might not work as expected when it is called twice with
different instances.

Because we don't have a proper solution for the problem, we prevent
calling setDefaultImpl() twice by aborting.

Exempt-From-Owner-Approval: approved

Bug: 140139809
Test: ./runtests.sh (in /system/tools/aidl)
Merged-In: I659d3eaad3a45dcba608fa79a08f083f84bc4d58
Change-Id: I659d3eaad3a45dcba608fa79a08f083f84bc4d58
(cherry picked from commit 81087399e9)
2020-05-19 22:59:49 +00:00
Michael Hoisie
c30ebd0188 Merge "Remove unused dependencies in SurfaceFlinger" into rvc-dev 2020-05-19 18:09:55 +00:00
Steven Thomas
98b789db15 Merge "With content detection off, prefer default frame rate" into rvc-dev 2020-05-19 17:47:14 +00:00
Steven Moreland
63da46c3ec Merge "libbinder: do not destruct SM global" into rvc-dev 2020-05-19 17:43:53 +00:00
Michael Hoisie
0b793843b3 Remove unused dependencies in SurfaceFlinger
* Remove libsync from libcompositionengine
* Remove libvr_manager from libsurfaceflinger
* Remove libdl from libsurfaceflinger

Test: m -j
Bug: 156932275
Change-Id: Id4b267c2aa2f902484c683219b4794d934b03901
2020-05-19 12:01:08 -04:00
Steven Thomas
debafed2c7 With content detection off, prefer default frame rate
When content detection is off, or when we have no layer information to
make a decision, prefer the default frame rate.

Bug: 154648391

Test: - Modified a Pixel 4 to turn off content detection, idle, touch,
        and power boost. Confirmed that, without this CL, we have bad
        behavior where calls to setFrameRate() persist after the layer
        goes away, and that this CL fixes that behavior.

- Modified and enhanced the "no layers" unit test in
  RefreshRateConfigsTest.cpp.

Change-Id: I2fd0d64a6ad369580cbb2ebf91cbbed7c31e0281
2020-05-18 18:56:19 -07:00
TreeHugger Robot
efde450428 Merge "gui/math/gralloc: Set min_sdk_version" into rvc-dev 2020-05-19 00:02:04 +00:00
TreeHugger Robot
b79738ea70 Merge "Remove hot-path logging" into rvc-dev 2020-05-18 22:10:38 +00:00
Ady Abraham
51a1625ac0 Merge "SurfaceFlinger: more aggressive infrequent layer detection" into rvc-dev 2020-05-18 21:05:01 +00:00
Ady Abraham
1adbb72759 SurfaceFlinger: more aggressive infrequent layer detection
Change the algorithm that chooses the refresh rate to treat layers as
infrequent unless proven otherwise. This change helps with multiple
switches during scenarios of blinking cursor where the detection of
infrequent layer is too long. The down side on this change is that
animations will be considered infrequent as well for the first few frames.
However the touch boost is a good mitigation of this.

Test: Typing in Messages and observe refresh rate
Test: Settings->About->up time and observe refresh rate
Bug: 155062712
Bug: 156654519
Change-Id: I317c69bd063df5d70f2d5705163cf61c1c9b1fff
2020-05-18 17:49:01 +00:00
Steven Moreland
26476f3e0b libbinder: do not destruct SM global
Let linux clean it up, since this may be accessed by some threads after
the main thread is destructed.

Bug: 154507808 # longterm
Bug: 156785633

Test: w/ repro which calls defaultServiceManager off main thread
Change-Id: Ic109f4bdca3893e6b0b192ac27f3ff03ada6f9e2
(cherry picked from commit 1698ffd088)
Merged-In: Ic109f4bdca3893e6b0b192ac27f3ff03ada6f9e2
2020-05-18 17:36:56 +00:00
Michael Hoisie
9b5bf0f42d Merge "Add null check for fgets in BufferQueueCore" into rvc-dev 2020-05-16 19:59:25 +00:00
TreeHugger Robot
39bf04a268 Merge "Revert "Revert "Revert "Make libbinder not available to media.sw..."" into rvc-dev 2020-05-16 18:03:50 +00:00
Adam Wright
4d360c65f5 Revert "Revert "Revert "Make libbinder not available to media.sw..."
Revert submission 11485868-reland-libbinder

Testing potential culprit for b/156778943 ("pthread_mutex_destroy called on a destroyed mutex" inside libstagefright).

Reason for revert: broken above test
Exempt-From-Owner-Approval: revert due to test breakage.

Reverted Changes:
I045836e10:Use NO_IMEMORY version of libstagefright_foundatio...
I23f41fece:Revert "Revert "Make libbinder not available to me...
bug: 156778943

Change-Id: Idfea55e47cd80dc80c58bfef20e7e274f944dcaf
2020-05-16 18:03:34 +00:00
TreeHugger Robot
692c65bfb6 Merge "Pass BTN_GEAR_DOWN and BTN_GEAR_UP to apps" into rvc-dev 2020-05-16 01:13:57 +00:00
Chong Zhang
12a5e88df9 Merge "Revert "Revert "Make libbinder not available to media.swcodec apex""" into rvc-dev 2020-05-16 00:02:30 +00:00
TreeHugger Robot
b209e7b56b Merge "SF: Enforce thread safety for SurfaceFlinger class" into rvc-dev 2020-05-15 23:38:34 +00:00
TreeHugger Robot
418a9e4235 Merge "Reduce the usage of goto statements in dispatcher" into rvc-dev 2020-05-15 23:16:34 +00:00
TreeHugger Robot
289e402dac Merge "[SF] Rename variables to match style" into rvc-dev 2020-05-15 22:28:40 +00:00
Dominik Laskowski
a19f4b6238 SF: Enforce thread safety for SurfaceFlinger class
Add thread annotations to display state and accessors. Add macros and
RAII helpers as escape hatches that are stricter and more meaningful
than NO_THREAD_SAFETY_ANALYSIS, and emit error on use of the latter.

Bug: 123715322
Test: Build
Change-Id: Ibada81998d70c940c7406ef292b2d487fb02189d
Merged-In: Ibada81998d70c940c7406ef292b2d487fb02189d
2020-05-15 20:42:49 +00:00
Marin Shalamanov
cfeebd4bc9 [SF] Rename variables to match style
This CL renames the variables so they are more readable and changes
snake case to camel case.

Test: m
Bug: 153991408
Change-Id: I80faa91ab514395dbf53c52282d62444c9aa579a
2020-05-15 17:57:41 +00:00
Michael Hoisie
9c6dd35a07 Merge "Update libEGL to use android::base properties instead of cutils" into rvc-dev 2020-05-15 16:18:53 +00:00
Siarhei Vishniakou
a0d2b809f0 Pass BTN_GEAR_DOWN and BTN_GEAR_UP to apps
The Steam controller has 2 large 'paddle' buttons on the back. When used
in USB mode with hid-steam, this sends BTN_GEAR_DOWN and BTN_GEAR_UP to
the user space.

But today, these events never reach the apps, even if they have proper
mappings. This is because these buttons are not considered to be
"keyboard or gamepad". Adjust the checks to include these 2 buttons in
KeyboardInputMapper.

Test: connect Steam controller over USB and check that the paddle
buttons produce events visible in the "gamepad tester" app
Test: atest inputflinger_tests
Bug: 147434575

Change-Id: I43f221c546ccc1277d578a185465bd5eadac9e8e
2020-05-15 09:08:50 -07:00
Michael Hoisie
b5108191c3 Add null check for fgets in BufferQueueCore
When compiling BufferQueueCore for host linux, the following
warning/error occurs:

error: ignoring return value of function declared with
'warn_unused_result' attribute [-Werror,-Wunused-result]

Add a simple null check to avoid this error. This is a no-op in terms of
functionality.

Bug: 156675939
Test: m -j libgui
Change-Id: I460731ebaf0272fd5376f244e65b763da44e14f0
2020-05-14 20:05:17 -04:00
Chong Zhang
6ab8a281af Revert "Revert "Make libbinder not available to media.swcodec apex""
This reverts commit e5b112ae7c.

Reason for revert: reland with fix
bug: 139201422
bug: 139016109
Change-Id: I23f41fecef76c032f82296fec355294ae8530a56
2020-05-14 22:27:54 +00:00
Alec Mouri
f2156e1a32 Remove hot-path logging
Turns out debug logging isn't cheap. Keeping the trace so that we can
still track it.

Bug: 144289346
Test: builds
Change-Id: I5d04f0d7821f89f1fe471ee67b165deef249ab50
2020-05-14 21:08:48 +00:00
Chong Zhang
9adccca5dd Merge "Revert "Make libbinder not available to media.swcodec apex"" into rvc-dev 2020-05-13 22:37:57 +00:00
Chong Zhang
e5b112ae7c Revert "Make libbinder not available to media.swcodec apex"
This reverts commit c5d0344511.

Reason for revert: breaks ndk build on rvc-dev-plus-aosp, not sure why.

https://android-build.googleplex.com/builds/submitted/6492183/ndk/latest/view/logs/build_error.log

Change-Id: Ife18316c47a68a3d93c5a73eb47a142525dbbd0d
bug: 156531370
2020-05-13 21:56:03 +00:00
TreeHugger Robot
6b2f684f07 Merge "SurfaceFlinger: ignore invisible layers" into rvc-dev 2020-05-13 21:49:43 +00:00
TreeHugger Robot
17884fa8ea Merge "Controls API - Flag controls support" into rvc-dev 2020-05-13 20:42:42 +00:00
Ady Abraham
5dde597cab SurfaceFlinger: ignore invisible layers
We keeps around layers that explicitly voted with
setFrameRate API even if those are not visible. This is to be able
to react when those become visible.
However there is a bug in that logic that causes SurfaceFlinger to treat
explicit invisible layers as Max.

Bug: 153111478
Bug: 156506455
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Change-Id: I15dde0b79bf670874edee90336caa812f791cf26
2020-05-13 20:38:06 +00:00