Commit Graph

88 Commits

Author SHA1 Message Date
John Reck
5f66fb8162 Change how memory policy is configured
Should be a mostly no-op but adds a handful of new options

* Adds a 'MemoryPolicy' to mostly consolidate memory settings
* Moves trim handling into HWUI proper
* Adds settings for UI hidden & context destruction that's not
  dependent on TRIM signals
* Treats persistent process the same as system_server
* Tweaks HardwareBitmapUploader timeout to reduce churn

Bug: 245565051
Test: builds & boots

Change-Id: I1f1b3db884ef7fa45ff2556436464a99440b998e
2022-09-28 10:47:56 -04:00
TreeHugger Robot
3ec8ebaff2 Merge "Revert "HWUI: Turn on Skia tracing by default"" into tm-dev 2022-05-13 22:16:21 +00:00
Leon Scroggins
3c815c92a7 Revert "HWUI: Turn on Skia tracing by default"
This reverts commit 7024d83459.

Reason for revert: Performance regression

Bug: 221813628
Fixes: 224677119
Change-Id: I276067cd8183b5b30914a78cbe48315ad7d7170d
Test: perfetto
2022-05-05 21:14:28 +00:00
chaviw
adba0b1861 Add forceDrawNextFrame function for HardwareRenderer
The forceDraw flag in HardwareRenderer will ensure a frame is drawn when
requested even if it would end up drawing multiple frames in a single
vsync.

This is to help blast sync when we want to synchronize the
buffer. We want to make sure we are guaranteed a callback since we don't
want to wait for retries, especially in the case when trying to synchronize
multiple buffers.

There was already a global flag to handle this, but would use the flag
for all draws. This new function is set per draw so once a frame is
drawn it's unset. The global flag was only used for tests so updated the
test to set the flag before every draw and deleted the global property.

Test: Underlying code was in place. This is just piping a new setter. No
usages yet.
Test: TestSceneRunner
Bug: 200284684

Change-Id: Ie1c9950cabb7331cfed1721564a51a1a15cd1624
2022-03-22 18:08:38 -05:00
Leon Scroggins III
7024d83459 HWUI: Turn on Skia tracing by default
This can provide useful information when diagnosing jank. It also
introduces a little bit of overhead, which is why we haven't turned it
on before. That said, the overhead is only relevant during tracing.

Bug: 221813628
Test: perfetto
Change-Id: I311d902797e0b9ecf53631f2f9f2df6cf4860635
2022-03-10 16:12:27 -05:00
Nader Jawad
9d0e2db31e Merge "Update RenderEffectCache capability query" into sc-v2-dev am: 58745e540e am: 6c8f89e428
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16007299

Change-Id: I6c4f7dd465be57034b8f32aa4539c3a098330dfa
2021-10-08 20:54:32 +00:00
Nader Jawad
086645d88a Update RenderEffectCache capability query
Updated logic to determine if RenderEffectCache
is supported to very both the vendor name as well
as the corresponding driver version.

Bug: 193145089
Test: Added test to EglManagerTests + RenderEffectCapabilityQueryTests
Change-Id: Ia0fd66c40790b94566f495d2c4128c4988d406b6
2021-10-08 00:00:45 +00:00
Nader Jawad
c465378de4 Merge "Conditionally cache RenderEffect results" into sc-qpr1-dev am: 69617682e4 am: 53290d8b19 am: 15fcba18e1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15882028

Change-Id: I9112e09456fb346e370446246c4f01a42ac63d43
2021-09-23 06:58:05 +00:00
Nader Jawad
4a6b60a5a8 Conditionally cache RenderEffect results
Added property to conditionally cache SkImage instances
with SkImageFilters applied. Some GL vendor implementations
invoke Fence::waitForver without signalling, leading
to ANRs throughout the system.

Bug: 193145089
Test: manual
Change-Id: I3e478b11b66205d96e9499a362f7412a1d6e952d
2021-09-22 02:27:33 +00:00
Huihong Luo
5e4c93aec5 Merge "Turn on Webview Overlays" into sc-dev am: a43c6c4f2c am: 0d8ee15a18
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15559504

Change-Id: I9438a92ab7df133bd77ae9e59c6aa82f8809535d
2021-08-17 00:51:13 +00:00
Huihong Luo
35b1dde19b Turn on Webview Overlays
Change the default value of the sysprop to be true.

Bug: 173671170
Test: install webview apks from Vasiliy, make sure surface control is
used.

Change-Id: Idf495a2be3b2bdba4fdaa380a5dbe9fd96158a97
2021-08-16 19:39:21 +00:00
Brett Chabot
074ba590e6 Lazy load Properties::isDrawingEnabled.
Properties::isDrawingEnabled can unexpectedly return true
even if the system property debug.hwui.drawing_enabled is false,
if its called before RenderThread is created.

This commit changes the underlying logic to lazy load the
debug.hwui.drawing_enabled prop value.

Bug: 193920054
Test: call HardwareRendererCompat.isDrawingEnabled()) from a new test
Change-Id: Ib69577745c26595ed3964a4341086138dd5d34b0
(cherry picked from commit 8e1ab42f51c501949211746c46a02a7564ebf292)
2021-07-16 22:33:39 +00:00
Brett Chabot
856db9e316 Add ability to disable GL draws.
This feature is intended for use in headless test environments,
where disabling drawing has minimal compatibility impact and can
save significant resource usage when running UI tests.

This feature is controlled via a new system property
'debug.hwui.drawing_enabled', and a HardwareRenderer public API that can
override the property value on a per-process basis.

Bug: 188559292
Test: boot emulator, atest CtsGraphicsTestCases
Change-Id: I93c21e680382e03342f235dbf58bd7a5c8a6f767
2021-07-13 20:01:47 +00:00
Huihong Luo
eb93107b57 Add a sys prop to control WebView Overlays support
The boolean system property is named as "debug.hwui.webview_overlays_enabled"

Bug: 192267127
Test: change the property value, check presence of Webview Surface
Control

Change-Id: I01e3e26282a5fa79aa504a6e49c5abe1a1c3ea02
2021-06-30 11:47:21 -07:00
Nader Jawad
93d6e248de Add support to toggle different shader
behaviors

Updated HWUI to toggle overscroll stretch
implementation based on whether the
device supports high end graphics
or not

Bug: 187718492
Test: manual
Change-Id: I13a91a8861c07bec8af43268ba22d0f5b7060b4f
2021-05-17 22:42:15 -07:00
John Reck
8088f8e505 Add some more scenes, replace linear with uniform
Test: this
Bug: 187718492
Change-Id: I171b5c15cd18645c2da1cffffa9635f83f8877e6
2021-05-11 20:53:30 -04:00
Nader Jawad
9272f21612 Updated StretchEffect types
Added additional shader stretch effect type
to distinguish between shader based stretches that
are configured in HWUI as well as those that
are configured in both HWUI and SurfaceFlinger

Bug: 184297961
Test: manual
Change-Id: Ie1083cef7cbaf4f877783d67d429af7f5edd0a3c
2021-05-10 16:38:09 -07:00
John Reck
8ed00dc56d Add a linear variant of the stretch effect
Supports SurfaceViews & everything

Test: setprop debug.hwui.stretch_mode 1
Bug: 187718492
Change-Id: I9a222fa4c1a40e80a74cdaf75becb9524cbeed9b
2021-05-10 11:33:20 -07:00
Bo Liu
027b218847 Integrate HWUI with PerformanceHintManager
PerformanceHintManager.Session is in java, so add JNI and a HintSessionWrapper
class in HardwareRenderer. Then pass the two calls as two std::functions
into DrawFrameTask.

Note Session is created per HardwareRenderer, not global (per
RenderThread).

Session includes UI thread, render thread, and the thread pool.
Desired duration is from the intended start duration to the frame
deadline. Add an actual frame start time to compute

Add system properties:
debug.hwui.use_hint_manager to enable PerformanceHintManager
debug.hwui.target_cpu_time_percent to control percentage of frame time
  to be used for target cpu duration.

Test: Manual test that there are no crashes and values make sense.
Bug: 158791282
Change-Id: I83f25433c10daa20033803fb7c4ae45eab34f1d3
2021-04-10 10:21:17 -07:00
Treehugger Robot
83a6070d12 Merge "Use ro.boot.qemu to check if the device is an emulator" am: 62d82e0b33 am: 4ba8fde9ba am: de535f6eb2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625662

Change-Id: Ia613c23fb779697882f9928b15684fb1ff97e9cd
2021-03-17 16:09:12 +00:00
Roman Kiryanov
d6a9f42566 Use ro.boot.qemu to check if the device is an emulator
`ro.kernel.qemu` is deprecated.

Bug: 182291166
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Id42d79af90b1fe7e182a96c53c84248e81a7c259
2021-03-10 23:41:31 -08:00
Ady Abraham
7bb70faa04 Remove render ahead from hwui
As HWUI uses vsync id to send buffers to SF, SF applies the right
amount of render ahead by latching the buffers at the configured time.

Test: launch an app and observe systrace
Bug: 178148035
Change-Id: Ifd3e1a2971aad0a085cb35d33e950194046aa634
2021-02-08 18:13:45 +00:00
John Reck
f516e3a36e Fix render_ahead properties
0 and -1 both meant default when 0 should mean
0 and -1 should mean default

Test: manual
Fixes: 179290765
Change-Id: Ia9aa5e3d83757282bfff776e083d6b3d7d29e9c0
2021-02-03 15:30:05 -08:00
Alec Mouri
aa3e498bbc Turn on vk unit tests
* Degrade error when changing the rendering backend from Properties to
no longer be fatal.
* Support using a single graphics queue for the Vulkan backend. Cloud
devices only support a single queue and some Vulkan implementations such
as Swiftshader expose only one queue for simplying their implementation,
so we'll need to support one.

Bug: 175618060
Bug: 162628999
Test: hwui_unit_tests
Test: experiment on Pixel 4 enforcing a single queue (settings app,
maps, sysui)

Change-Id: I495fcabc3c89bd62bbb833998eab4944c6660f6f
2021-01-13 14:35:58 -08:00
John Reck
f42ff762f2 Allow controlling the SDR white point
Test: this
Change-Id: I9ee059afd73ca0850e41072c068c9effe8362382
2020-08-06 17:32:10 -07:00
Alec Mouri
22d753f74d [HWUI] Get DeviceInfo through stable ABI
This also removes the dependency on ui/DeviceInfo other than in test
code.

Bug: 136263392
Bug: 136263238
Test: builds, boots
Change-Id: I6a4687e981359f0e6beb83be8a5501ed7fd16f15
2019-10-25 13:30:42 -07:00
John Reck
fa93e3cefc Merge "Delete wrap_gles capability" 2019-05-31 20:48:01 +00:00
John Reck
23462d88f5 Delete wrap_gles capability
* Error enforcement doesn't work with libhwui anymore
* We can just do the real, proper thing for unit tests
  & microbenchmarks, which is arguably better anyway
* hwui doesn't have much opengl code left that was wrapped

Fixes: 128629988
Test: hwuiunit, hwuimacro, and hwuimicro all still run
Change-Id: If2568ea0745a67f83e1290860d474c1a01870376
2019-05-29 16:55:06 -07:00
Jerome Gaillard
21e7e2d9b1 Build native android graphics library for desktop
The purpose of this is to be able to use the native graphics code from
the Android platform directly in Android Studio (running on desktop) to
do layout rendering.

This creates a host library that is a subset of libandroid_runtime
including only the JNI files relevant to Android graphics. It also
includes LayoutlibLoader.cpp which is used to load the JNI when using
it as part of layoutlib (the graphics library for Android Studio).

This also creates libhwui-host, a host library that is a subset of
libhwui.

Bug: 117921091
Test: lunch sdk && m libandroid_runtime
Change-Id: I3850020d2d4c13c85e377476bc463d3eb6a01c6d
2019-05-29 15:48:53 +01:00
Jerome Gaillard
a02a12d765 Use libbase API to access system properties in libhwui
Calls to licutils properties API are replaced by calls to libbase
properties API. This will make it easier to make a host target for
libhwui as libbase provides a host implementation for its properties
API.

Bug: 117921091
Test: N/A
Change-Id: I15b4fe1a16d2bc7b271387d8cf3403940b8aae2d
2019-05-28 18:35:29 +01:00
TreeHugger Robot
862a21c977 Merge "Zygote: add a way to preload Vulkan driver" into qt-dev 2019-04-26 05:20:34 +00:00
Yiwei Zhang
4bf3d9eda4 Zygote: add a way to preload Vulkan driver
Since HWUI render pipeline has both GL and Vulkan backends now, we'd
like to preload either GL or Vulkan driver based upon HWUI's choice on
the render backend.

1) Keep using ro.zygote.disable_gl_preload property to disable Vulkan
driver preloading if HWUI's render pipeline uses Vulkan backend.
Properly rename the corresponding APIs for driver preloading.

2) Add a path to preload Vulkan driver based on HWUI's render backend.

Bug: 131249898
Test: build, flash and boot.
Test: verified with set USE_VULKAN=true
Test: verified with setprop debug.hwui.renderer skiagl/skiavk
Change-Id: Ie0bf5d18edcf907c75a25ac3249e2620ec21b63c
2019-04-25 14:29:34 -07:00
John Reck
8915167a88 Fix some force_dark prop behaviors
* Make it persist.hwui.force_dark so the dev option
  survices reboots.

* Remove the internal super-override behavior it applied
  using only the intended ViewRootImpl theme-aware behavior.

Fixes: 127350499
Fixes: 130354206
Test: set dev option, verified nothing went dark. Set dark
theme, verified non-dark apps were force-darked. Rebooted
and verified property still set.

Change-Id: I43adcbc25320669510fb03b162c98cbd14612f55
2019-04-25 10:59:23 -07:00
John Reck
cf185f5b0d Dynamically adjust renderahead
Tracks refresh rate changes and adjusts renderahead
based off of the active refresh rate.

Default is 60hz = 0 render ahead & > 70hz is render ahead 1

Bug: 127822449
Test: systraced stuff

Change-Id: I9849aa065262f21f7602d44cd1761373279dc28d
2019-04-18 14:20:56 -07:00
John Reck
0fa0cbcade Support render-ahead in vulkan
Bug: 127822449
Test: verified render_ahead working with skiavk
Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-04-12 13:33:25 -07:00
John Reck
4d527226fd Add back render-ahead support
Currently only supported in the EGL path.
Vulkan support Coming Soon

Bug: 127822449
Test: trace of hwuimacro
Change-Id: Iac2b039e11d964aab5b8ca1bdf2a5430b187e2ea
2019-04-04 18:03:35 +00:00
Stan Iliev
b8811aa52f Read product property to set Vulkan as default render pipeline
Bug: 119267168
Test: Booted pixel 3 with Vulkan rendering
Change-Id: Ibc4b2e00d791b1fb333c0e0f5db2b5f084808c24
2018-12-14 22:36:40 +00:00
TreeHugger Robot
85c34682bb Merge "Remove unused HWUI properties." 2018-12-05 16:31:25 +00:00
Derek Sollenberger
fd1c87914a Remove unused HWUI properties.
Test: compile only
Change-Id: Ifef24fe53edcab63af3f9b634849d996dc7960ec
2018-12-04 16:22:58 -05:00
Chris Blume
7b8a808b7d Remove ; from closing namespaces in libs/hwui
When closing a namespace a } is sufficient. It doesn't need to be };
like closing a class or enum.

Within frameworks/base/libs/hwui there is a mix between } and }; when
closing a namespace. There are even mixes between a .h and the
corresponding .cpp files.

In a separate CL I was asked to not close with };. That was a good
comment. I adopted the style from nearby code. This CL cleans up the
nearby code.

Test: I made sure the code still built as expected.
Change-Id: Ieb314a4f48d6e33752463f3be4361fdc9be97482
2018-12-03 16:05:14 -08:00
John Reck
5711911bd3 Enable smart dark
Bug: 116860870
Test: builds, smart dark applies for targetSdk >= Q && night mode is
enabled
Change-Id: I66e4ec4ad3e5c886c5260137fd48e2c92ee59552
2018-10-25 15:25:51 -07:00
John Reck
bb3a358317 Wire-up default force-dark based off of isLightTheme
Bug: 102591313
Test: Compared settings in light & dark UI modes with
force_dark set to true. Observed that force_dark fixes
were not present when UI mode was set to dark, indicating
force_dark was appropriately globally-disabled

Change-Id: I5882829bb5871829fc8fc9911682f52a6ba5f445
2018-09-27 19:38:13 +00:00
John Reck
9ce2bf7e0c Auto-dark mode prototype
Experimental force_dark prototype mode. Enabled
by setting debug.hwui.force_dark to true.

Test: verified nothing changes without prop being set

Change-Id: Ib02f3f1a9c591cab1f312b827451f04c782c2f41
2018-07-09 10:16:25 -07:00
Stan Iliev
02daab6ff2 Add a debug property to enable Skia systrace
Add a "debug.hwui.skia_atrace_enabled" property that allows to
record a systrace with skia drawing ops. App need to be restarted
after setting the new propety to true.

Test: collected skia trace with systemui
Change-Id: I2d1c5911714bfc911894f633ec2df2f6bb953b48
2018-07-02 13:45:53 +00:00
John Reck
1a4a981199 Revert "Add support for render-ahead"
This reverts commit ec100976e0.

Reason for revert: b/77971494
Test: hwuiunit passes

Change-Id: I2e7dc719d2df1dd939b275496c0edc38e458c434
2018-04-18 16:18:17 -07:00
John Reck
1072fffddb Remove Properties::isSkiaPipeline (3/!?)
Test: hwuiunit & CtsUiRenderingTestCases pass
Change-Id: Ie7b336eacdd1b8660e09653c64eb6ea0a7b4a258
2018-04-12 15:21:21 -07:00
John Reck
18f442eb2d Remove RenderPipelineType::OpenGL (1/many)
Just removes the define & all things referencing the define.

Test: hwui_unit passes
Change-Id: I3f98c271e23ef696c40addf260abdc0fb149a70d
2018-04-11 13:39:19 -07:00
John Reck
ec100976e0 Add support for render-ahead
For periods of time during which latency is less important
allow a client to request a deeper render-ahead pipeline.

The latency tradeoff results in less overall visual jank

Test: none, only used by macrobench

Change-Id: I516203b70bdc75b6415fa08bf9c4fb1b598b0102
2018-04-09 10:58:15 -07:00
Jorim Jaggi
767e25ed61 Add ability to change context priority of RT GL context
Test: Use method, observe GPU preemption behavior
Bug: 75985430
Change-Id: Idc08d37f8c95f52c5aab7edf09c0cbff72b8482d
2018-04-06 12:12:07 +00:00
John Reck
564284759f Don't use IPC in isolateProcess
Fixes: 74395652
Test: hwuiunit passes in 'shell stop' state (pseudo-isolated process),
      manually checked non-isolated processes still have working vsync
      via systrace of RT animations demo

Change-Id: I630ea011dc7eb2efa265b25673d3304b3b2510d3
2018-03-16 17:34:02 -07:00