922 Commits

Author SHA1 Message Date
Chavi Weingarten
c1f9e4c0b9 Merge "Add call to disable RT Animations" into tm-dev 2022-03-23 23:23:35 +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
chaviw
01053d4350 Add call to disable RT Animations
HWUI already supports disabling RT animations, but there was no correct
way to call it from the application. Adding a call to enable or disable
RT animations on the RenderThread so RT animations can be disabled
during a blast sync.

Test: Builds
Bug: 200284684
Change-Id: Ia1ae3498c38b84b4975f08d37bc764f0c690ed9f
2022-03-22 15:41:24 -05:00
Jimmy Shiu
06d9139e8c Add postAndWait() trace for calculating frame drawing time
postAndWait() shows the duration that UI Thread waits for RenderThread.
The trace is helpful for perfetto parser to calculate the actual frame
drawing time from CPU resource perspective.

Bug: 224653682
Test: capture trace and check App UI Thread.
Change-Id: Ic3a11b60abb1fea8cc7b44ce6889ab1e3c2788fd
2022-03-15 19:56:10 +08:00
Rachel Lee
1a44c62b74 Rename to VsyncCallback & presentation time.
Bug: 217370454
Test: atest ChoreographerNativeTest
Change-Id: Icf460a82c1f59e930bdfc456e4a75ae341ce4394
2022-02-15 18:25:11 -08:00
Jiang Tian
cd8994f492 Fix full draw power usage increase issue
Full draw will be happened on HWUI under 90/120Hz device,there are
more draw commands under renderFrameImpl than in the 60Hz fps device,
frame.bufferAge() > (int)mSwapHistory.size() resulting in an increase
in power usage.

So need to increase (int)mSwapHistory.size() to 8, set mSwapHistory
add to 7.

Bug: 209371516
Test: Manual

Change-Id: Ic6f21e7b9dc5e7c8f36d03c57b01fa7210cff86f
2022-02-08 09:36:54 -05:00
Bo Liu
77f35083d1 Merge "Performance hint ndk APIs" 2022-01-28 18:57:27 +00:00
Rachel Lee
abe5a0016f Merge changes from topic "scdocs"
* changes:
  Use AVsyncId typedef in hwui.
  Use AVsyncId typedef.
2022-01-24 19:54:35 +00:00
Rachel Lee
5ad064f017 Use AVsyncId typedef in hwui.
Test: atest hwui_unit_tests
Bug: 214063411
Change-Id: I0b5de12d36c7df5e961870d53619af43f7c3ff6d
2022-01-14 15:38:22 -08:00
Rachel Lee
3712a2a7c0 Update hwui with renamed AChoreographer method.
Test: atest hwui_unit_tests
Bug: 214303753
Change-Id: I8f0634306f483d21b85aa74f4c008c88badd5f8f
2022-01-13 14:14:35 -08:00
chaviw
b680371f77 Send syncStatus and return FrameCommitCallback in FrameCallback
FrameCallback sends back the syncStatus and allows the caller to return
a FrameCommitCallback. This is so the caller can evaluate the results of
the sync and determine if it wants to continue waiting for a commit
callback. In cases, where the sync has failed, there will never be a
commit callback so the caller can avoid waiting.

This is partically helpful for VRI because it wants to sync with a frame
that will draw, but also doesn't want to get stuck indefinitely waiting
on the callback. VRI can check the syncStatus and only handle blast sync
and/or reportDraw when its determined that a draw will happen.

This allows VRI to remove frameCompleteCallback since it can now wait
until a buffer has drawn instead of when the vsync has completed. This makes
sure it waits on FrameDropped since that result indicates HWUI will draw on
the next vsync

Test: BlastSync
Bug: 200284684
Change-Id: Ic6e2f08ea21ac8a1634a3389c927fcb68ede3f7b
2021-12-28 11:27:23 -06:00
TreeHugger Robot
94ac5aaac7 Merge "No need for stencil buffer for A8." 2021-12-16 03:58:27 +00:00
Leon Scroggins III
c0cc76e56c No need for stencil buffer for A8.
Brought up in I93a20ef8eb7d73b843e002d84d9fe53240a67c59.
Bug: 193170859
Test: manual

Change-Id: Ia401e1c6ac22d0fc2105a14248c427d1f4141807
2021-12-16 02:02:35 +00:00
TreeHugger Robot
d630967a75 Merge "Defer initialization for mEglConfigA8" 2021-12-16 00:25:22 +00:00
Rachel Lee
7834d38d95 Merge changes from topic "surfacectrl"
* changes:
  Pass start time from HWUI canvas context.
  Implement timeline in libandroid ASurfaceControl.
2021-12-15 20:02:30 +00:00
Leon Scroggins III
e040b29e86 Defer initialization for mEglConfigA8
This will only be used by some devices, when requested by SystemUI.
Defer initialization until its needed. This removes the unnecessary
ALOGE. If the device needs A8 and doesn't have it, it will still emit a
fatal log, which will enclude the EGL error.

Bug: 210501051
Test: make
Change-Id: I2c45d910a272e6bf434b8dae52da88fb927ac82a
2021-12-15 14:51:40 -05:00
Rachel Lee
4fa7484510 Pass start time from HWUI canvas context.
Bug: 198192003
Test: atest CanvasContextTests
Change-Id: If1dc10c001e9a8c493f491abfe5022889ae5544b
2021-12-09 16:29:04 -08:00
Leon Scroggins III
7ccb8a4d98 Plumb support for rendering A8 in Vulkan
VulkanSurface:
- update LOG_TAG
- allow no dataspace + A8
- assign a vkPixelFormat for A8

VulkanManager: use a more descriptive LOG_TAG

Bug: 193170859
Test: TODO

Change-Id: If447c2c393b4f17b718083a77cdd29870fb1cc50
2021-12-09 12:12:26 -05:00
Leon Scroggins III
e157ee878f Plumb through A8 for GL/EGL
Bug: 193170859
Test: TODO

Change-Id: I45993488808457b9a1ea03e9c4a46253d5b45df0
2021-12-09 12:12:26 -05:00
Vasiliy Telezhnikov
372a21b3aa Enable WebView overlays for Vulkan
This CL uses new skia api to determine if we're drawing on screen or
offscreen for vulkan and enables overlays when possible.

Bug: 185730234
Test: manual
Change-Id: Ib7748535431e4dc56b1af6d7ccc729b3b649df96
2021-11-17 19:29:46 +00:00
Bo Liu
2b739bbb63 Performance hint ndk APIs
Test: atest PerformanceHintNativeTestCases
Change-Id: I8f410cf5ee8cee90465d1ce48a42c9ff8bbe80c4
2021-11-10 19:22:22 -05:00
TreeHugger Robot
c6efb5d143 Merge "Add damage rect trace point" 2021-10-19 20:15:08 +00:00
John Reck
8a1ddd7e75 Add damage rect trace point
Fixes: 199541917
Test: took a trace
Change-Id: I938f5ce895d8c55ec027606286e8a3989ecc55e6
2021-10-19 12:25:24 -04:00
John Reck
c8024fc783 Fix daveys when latch_unsignaled is used
Fixes: 202297616
Test: manual
Change-Id: Ibd2edd9a6dbe7f66d990a276fcfb6cec8445086d
2021-10-18 19:30:45 -04: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
John Reck
712eae053c Support dump gfxinfo reset for process' without a Window
Bug: 199791928
Test: manual
Change-Id: I995d236c2c9d60194f72275a3da1c82340f77898
2021-10-01 15:51:48 -04:00
Rachel Lee
798185e4a9 Merge changes from topic "choreo"
* changes:
  HWUI: use public choreographer api
  Choreographer: new libandroid for CTS.
2021-09-29 19:29:03 +00:00
Rachel Lee
432b691184 HWUI: use public choreographer api
Bug: 198192636
Test: atest hwui_unit_tests
Change-Id: Ic8b833d87d2ba381496cfcf7e21bb9557e9ba85f
2021-09-28 15:00:18 -07: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
Pablo Gamito
3a7c2de26d Merge changes from topics "consistent-frame-number-type", "metrics-callback-surface-id", "remove-asc-from-fmcallback"
* changes:
  Get rid of unused ASurfaceControl in frame metrics listener callback
  Set uninitialized frame number to 0
  Make frame number type consistent
  Add unit tests for FrameMetricsReporter
  Update JankTrackerTests to reflect API changes
  Pass surface control id to callback to accurately identify surface metrics belongs to
  Stop reporting frame stats from frames completed before observer was attached
2021-09-08 09:09:37 +00:00
Pablo Gamito
14b28ce9ce Get rid of unused ASurfaceControl in frame metrics listener callback
Test: Existing tests
Change-Id: Ia071814dabfc762d00d3324bfaa343ff94ab8338
2021-09-07 16:47:25 +00:00
Pablo Gamito
7e6a5f29f5 Set uninitialized frame number to 0
Now that the frame number is a uint instead of an int it's clearer if the uninitailized value is 0. Frame numbers start from 1 so 0 doesn't collide with any valid frame numbers. It also means comparing frame numbers to check if the frame is newer always works even when comparing to the uninitialized frame number.

Test: N/A
Change-Id: I0901ffeaefbdd6378e59d8858a06de92b0104cd9
2021-09-07 16:47:25 +00:00
Pablo Gamito
35b80cde92 Make frame number type consistent
The frame numbers are ultimately stored as uint64_t so to avoid any implementation dependent casting we make sure all direct and indirect references to this value are stored as uint64_t

Test: N/A
Change-Id: I080c94b1007f2e884cf0fa3583bf51badc913a05
2021-09-07 16:47:25 +00:00
Pablo Gamito
bc9e529031 Pass surface control id to callback to accurately identify surface metrics belongs to
Avoid getting the wrong frame info when duplicate frame numbers are found in the ring buffer. Will ensure there isn't a mismatch in the metrics data reported.

Test: Existing tests
Bug: 197515602
Change-Id: Iff9ba01f575f94e5a9872ee48c0dd1e5067880c3
2021-09-06 17:23:39 +00:00
chaviw
9c13753526 Rework blast sync callback model
The previous code waited for a frame complete callback from hwui before
notifying WMS that a draw had occurred. However, frame complete callback
was not guaranteed to get called since it only invokes a callback if a
draw actually occured. VRI really needs a signal that RT has completed,
since it just needs to know that a draw was possible so it can notify
WMS that the RT completed its pass.

Instead, rename frameCompleteCallback to frameCommitCallback since that
API is exposed to a public API when a frame was actually drawn.
Create a new callback, frameCompleteCallback, that is invoked when the
draw has completed, regardless if a frame was actually drawn.

When the frameCompleteCallback is invoked, VRI can check to see if a new
frame actually drew. VRI can call into BBQ to see if the frame acquired
matches the frame that was attempted to draw. If so, VRI can wait on a
transaction callback. If not, it can allow VRI to continue. In either case,
it will notify WMS that the draw has finished.

Test: Split over and over
Bug: 195262673
Change-Id: I24dd19ab2746be3fc33e597761abf8c5249f8b5b
2021-09-03 14:50:37 -05:00
Pablo Gamito
88660d77da Stop reporting frame stats from frames completed before observer was attached
Test: Run app from bug report
Fixes: 195699687
Change-Id: If80825dfb41467917b7b9b1e8c9ead1a0dcbffae
2021-08-31 10:33:28 +00:00
Derek Sollenberger
b27f52e4f7 Merge "CanvasContext::draw: flushAndSubmit when not drawing" into sc-dev am: 1171be085c am: 71417b2def
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15481327

Change-Id: Ia55f43fe9352699a06899088523ce0e8d7dccea6
2021-08-09 13:10:11 +00:00
Leon Scroggins III
7fbd0ad0f9 CanvasContext::draw: flushAndSubmit when not drawing
Bug: 195081399
Test: manual + dumpsys gfxinfo

CanvasContext::draw has some conditions under which it will not draw. We
still need to flushAndSubmit to free scratch memory if there were
texture uploads this frame.

Change-Id: I60d230cd36bed310a3155e4f1ca647c99c13c4cd
2021-08-06 13:42:49 -04:00
Bo Liu
15634bdc3c Switch HWUI to use native performance hint API am: 6a3fc60f43 am: 4333a83789
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15326474

Change-Id: Id65a52342eff943a9b644881936f51555a64d77d
2021-07-22 21:50:55 +00:00
Bo Liu
6a3fc60f43 Switch HWUI to use native performance hint API
Test: None
Bug: 194204196
Change-Id: I80dfdb5d56921c465406cc4534e82738c668d46d
2021-07-22 11:33:01 -04:00
TreeHugger Robot
5041120c53 Merge "In VuklanManager make sure we have a valid semaphore context before destroying it." into sc-dev am: f560a753fd am: 77ee61026a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15301696

Change-Id: I23bd624e9f346888193b9b6f98fe4301e0654d8f
2021-07-16 22:06:01 +00:00
TreeHugger Robot
f560a753fd Merge "In VuklanManager make sure we have a valid semaphore context before destroying it." into sc-dev 2021-07-16 21:26:53 +00:00
Greg Daniel
e8dc397bfd In VuklanManager make sure we have a valid semaphore context before destroying it.
If errors occured during finishFrame that caused us to not have a
semaphore or possibly destroy the semaphore early we will end up
with a null mDestroySemaphoreContext in swapBuffers which we tried
to destroy unconditionally.

I haven't repro'd the connected bug, but based on the crash stack
this seems like the likely cause.

Test: manual code inspection and build.
Bug: 191950033
Change-Id: I0fbd33edff3552b91b980da9e3b2c45bc52a2dd0
2021-07-15 13:38:44 -04:00
John Reck
673ed3b9a8 Merge "Always submit after texture uploads" into sc-dev am: 6a84070852 am: 5234aba59d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15287364

Change-Id: I18be243fc2b3c03053280a83d17524a337361f1b
2021-07-15 16:01:37 +00:00
John Reck
cf1170fbda Always submit after texture uploads
Ensure GrContext::submit() is always called after either
Bitmap#prepareToDraw() or if DrawFrameTask skipped drawing.

In either case texture uploads & deletions will be scheduled,
but without the submit they won't actually be performed. This
can end up running out of RAM.

Bug: 189393671
Test: manual test app
Change-Id: I57477c64457558487e9e5ec0a979ad9099a8cb2c
2021-07-14 17:06:28 -04: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
TreeHugger Robot
1e67f86165 Merge "Properly protect mFrameMetricsReporter" into sc-dev 2021-07-11 08:30:13 +00:00
Siarhei Vishniakou
07d35cb7dc Properly protect mFrameMetricsReporter
This field actually requires a special lock, mFrameMetricsReporterMutex.
But there isn't a GUARDED_BY annotation for it. And even if there was,
the compiler feature of -Wthread-safety was not active in this code, so
this error would not have been caught.

To fix this, enable the compiler annotation and add GUARDED_BY
annotation to mFrameMetricsReporter.
And finally, use this lock to properly protect this field.

Bug: 192330836
Test: atest hwui_unit_tests
Change-Id: I76950bfa01bbd7ccdc54c4e8c114430b5aeddf1a
2021-07-09 00:32:29 +00:00