Commit graph

78965 commits

Author SHA1 Message Date
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
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
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
Chong Zhang
2d76a5eb50 Merge "Make libbinder not available to media.swcodec apex" into rvc-dev 2020-05-13 20:13:06 +00:00
TreeHugger Robot
8a908e784f Merge "SF: Remove display lookup in Layer classes" into rvc-dev 2020-05-13 19:45:32 +00:00
Chong Zhang
c5d0344511 Make libbinder not available to media.swcodec apex
media.swcodec no longer depends on libbinder.

bug: 139201422
bug: 139016109
test: builds
Change-Id: I633e733902d4d26c0a9249113b6cf4bdde0877ee
2020-05-13 10:03:25 -07:00
TreeHugger Robot
cc9a52824f Merge "Add locks to InputDispatcher_test" into rvc-dev 2020-05-13 13:46:41 +00:00
Siarhei Vishniakou
cd899e8fc9 Add locks to InputDispatcher_test
The variables inside the policy are being called from the test thread
and the InputDispatcher thread. They are being accessed without a lock
today. This is OK because we are waiting for dispatcher to go to idle
today, but in ag/10847700 we will have dispatcher not idle, and need to
have a way to wait for a policy callback from the test thread with a
certain timeout.

Add locks to the policy variables here to reduce the diff.

Bug: 143459140
Test: atest inputflinger_tests
Change-Id: I77f5ec15cdfd55ce4c4dfcb501071b2c7c961b1b
2020-05-12 22:31:33 -07:00
Ady Abraham
c966483200 SurfaceFlinger: refresh rate heuristic for TextureView
When an app uses a TextureView (or any other hwui based view)
hwui will attach presentation timestamps to each buffer for
for implementing its render ahead logic. SurfaceFlinger looks at
those timestamps and based on the frame rate it may decide to switch
to a refresh rate that better matches the content. When the refresh rate
changes, hwui may stop doing render ahead and therefore stop attaching
presentation timestamps. The way SurfaceFlinger handles that is by
calculating the content refresh rate by looking at the time the buffer
was queued. SurfaceFlinger will look at the queue time only if this
layer was providing presentation timestamps in the past.

Bug: 155710271
Test: Facebook feed playing video
Test: YouTube video with 24, 25, 30, 60 fps content
Change-Id: I3e981d192ec569087aa16d4c952ef9565d6fb234
2020-05-13 01:09:39 +00:00
Ady Abraham
b28c5cc186 Revert "SurfaceFlinger: refresh rate calculation when no timestamps"
This reverts commit 38601a9beb.

Reason for revert: Different fix was applied to b/155710271

Change-Id: Icfa0774f1cf412aa3d7122b0bc7046cf8a0b1077
Bug: 155710271
2020-05-13 01:06:47 +00:00
Ady Abraham
5f489bd938 Revert "SurfaceFlinger: use queueTime as well when calculating refresh rate"
This reverts commit 49e65e422d.

Reason for revert: Different fix was applied to b/155710271

Change-Id: Ic70812309b3acbd85ece80fce7e9769e19126d13
Bug: 155710271
2020-05-13 01:06:30 +00:00
Siarhei Vishniakou
7f0a439ef7 Reduce the usage of goto statements in dispatcher
Currently, there are a lot of uses of goto statements in
InputDispatcher, which makes the code hard to follow. Instead, remove
some unused code and reduce the goto usage.

Bug: 143459140
Test: presubmit
Change-Id: I0ef0b3a0820ce643486cec5d9cbeb0f593344ee6
Merged-In: I0ef0b3a0820ce643486cec5d9cbeb0f593344ee6
(cherry picked from commit 767917f075)
2020-05-12 17:32:36 -07:00
Dominik Laskowski
b7251f427b SF: Remove display lookup in Layer classes
1. Remove DisplayDevice in LayerCreationArgs and updateTransformHint.
2. Pass DisplayDevice to dumping functions instead of calling back into SF.

Bug: 123715322
Test: Print transform hint in ConsumerBase
Change-Id: If41f3506de10f2799b52a73f7a54969b8ef1e960
2020-05-12 14:03:23 -07:00
TreeHugger Robot
942c53703f Merge "Provide a fixed transform hint if the layer is in a fixed orientation 1/2" into rvc-dev 2020-05-11 23:51:56 +00:00
Josh Tsuji
7db72bbbbf Merge "Make TYPE_TRUSTED_APPLICATION_OVERLAY a trusted overlay." into rvc-dev 2020-05-11 20:24:34 +00:00
TreeHugger Robot
01ab4a277f Merge "AChoreographer: Avoid potential NULL dereference" into rvc-dev 2020-05-11 17:59:59 +00:00
Steven Moreland
49b69b8655 Merge "binder tests respect libbinder bitness" into rvc-dev 2020-05-11 17:45:59 +00:00
TreeHugger Robot
3e03a580bf Merge "Add XML used to declare hinge sensor support." into rvc-dev 2020-05-11 14:27:31 +00:00
Greg Kaiser
b66d04b0a2 AChoreographer: Avoid potential NULL dereference
We move our nullptr check to before our dereference of the pointer.

Test: TreeHugger
Bug: 154874011
Change-Id: If1e51b8fb88f72b6b4cbda52543bf093e6c76ca9
2020-05-11 13:53:59 +00:00
Jooyung Han
7bcb89317d Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Exempt-From-Owner-Approval: cherry-pick from aosp

Bug: 152655956
Test: m
Merged-In: Ifea5ed988fad2e0d29271e6e9cbf0e12100b37d9
Change-Id: Ifea5ed988fad2e0d29271e6e9cbf0e12100b37d9
(cherry picked from commit a395c8d9aa)
2020-05-11 08:33:49 +00:00
TreeHugger Robot
f9d44007cc Merge "Fix consumer closed input channel cause an error occurred (2/2)" into rvc-dev 2020-05-11 05:56:35 +00:00
Anthony Stange
02025168df Add XML used to declare hinge sensor support.
Bug: 156049606
Test: Presubmits
Change-Id: I4c453b75fd59987b5bd73d3fb04f535bef0cf765
2020-05-09 22:31:06 -04:00
TreeHugger Robot
0050943c5c Merge "Isolate statsd_write trace when reporting jank." into rvc-dev 2020-05-09 17:26:01 +00:00
Alec Mouri
30843e3b4d Isolate statsd_write trace when reporting jank.
Prior benchmarks shows that this should take 2.6-2.7 micros, but there
exist traces showing that the current slice can take ~700 micros, and
even up to 8 milliseconds, which confounds with the debug log that is
also expected to be cheap. There is evidence that logd occasionally
causes preemption in flinger, so isolate the two calls so that the next
time a bad trace comes in we know what the cause is.

Bug: 144289346
Test: builds
Change-Id: I899e9f99107fad1f5e501b783ce57bfd12300b85
2020-05-08 19:17:57 -07:00
Vishnu Nair
6213bd9001 Provide a fixed transform hint if the layer is in a fixed orientation 1/2
The transform hint is used to prevent allocating a buffer of a
different size when a layer is rotated. The producer can choose to
consume the hint and allocate the buffer with the same size.

Provide the graphic producer a transform hint if the layer and its
children are in an orientation different from the display's
orientation. The caller is responsible for clearing this transform
hint if the layer is no longer in a fixed orientation.

Bug: 152919661
Test: atest VulkanPreTransformTest
Test: confirm with winscope trace, buffers are allocated taking into
account the transform hint in fixed orientation scenarios
Test: go/wm-smoke

Change-Id: Iea9dcf909921802a5be5c44dd61be3274f36bbd8
2020-05-08 17:44:10 -07:00
TreeHugger Robot
16596ab14d Merge "SurfaceFlinger: use queueTime as well when calculating refresh rate" into rvc-dev 2020-05-08 23:56:40 +00:00
Alec Mouri
a511811bd9 Merge "Receive refresh rate callbacks from DMS" into rvc-dev 2020-05-08 23:54:17 +00:00
TreeHugger Robot
4b9467baec Merge "SF: Fix emulator DPI" into rvc-dev 2020-05-08 23:29:57 +00:00
Ady Abraham
49e65e422d SurfaceFlinger: use queueTime as well when calculating refresh rate
When calculating refresh rate, we want to make sure that the refresh
rate of a layer is "stable", meaning that the average we calculated
is correct for all the samples we have. If the app stops frame
production and then resumes we don't want to calculate the refresh
rate average across a different group of frames. This change enhances
the detection of when the app stops to produce a frame by looking at
the queue time of a frame if this frame doesn't have a timestamp.

Bug: 155710271
Test: Start an animation not driven by touch
Change-Id: Icef63a1ba86c1ad063592717115addd700e22cad
2020-05-08 22:15:05 +00:00
Steven Moreland
f9f3de2434 binder tests respect libbinder bitness
Some 32-bit kernels use a binder kernel interface with a different API
controlled by the kernel configuration CONFIG_ANDROID_BINDER_IPC_32BIT.
This changes builds versions of these tests built for this bitness
specially so that they can run and work on these devices.

Test: atest --all binderLibTest{,_IPC_32} binderDriverInterfaceTest{,_IPC_32}
Bug: 154755898

Change-Id: I82b47e8064564a037bf8ed453e9ae7b8901b5667
2020-05-08 13:36:09 -07:00
Dominik Laskowski
d125d0eb52 SF: Fix emulator DPI
ag/9776294 inadvertently set DPI to density.

Bug: 155797799
Test: setprop qemu.sf.lcd_density 440
Change-Id: I5bc6333130f7c79bea892b42435de6b4e4035e96
2020-05-08 12:36:39 -07:00
TreeHugger Robot
ca4cf8ad87 Merge "SF: Fix thread safety for RefreshRateOverlay" into rvc-dev 2020-05-08 19:26:58 +00:00
Jayant Chowdhary
c16fd55277 Merge "Add xml file for camera2 concurrent camera feature." into rvc-dev 2020-05-08 19:05:47 +00:00