Commit Graph

5720 Commits

Author SHA1 Message Date
John Reck
0f284da923 Avoid sampling outside BQ crop rect
The region outside of the BQ crop rect is potentially
garbage. Avoid sampling from it.

Fixes: 189656466
Test: CTS PixelCopyTests & DecodeAccuracyTest
Change-Id: I2910d93471f08aaf807ac9f87fdf84cf29cf4143
2021-07-14 14:26:14 -04: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
John Reck
b7039c6aa5 Reduce number of weakrefs per frame
Disable end-to-end input latency metric to reduce the
number of JNI WeakGlobalRef acquires per-frame.

Bug: 189738006
Test: Observe trace section no longer appears in calculator
Change-Id: I062dad8e7cec93cca5599e51d2b0b1a1b6e39a07
2021-07-07 19:18:34 -04:00
Huihong Luo
ec68b7c973 Disable Webview Overlay when invisible
Remove Webview overlays when Webview node is set to invisible

Bug: 187292989
Test: play a video in a Webview, toggle visibility for the view, check
existence of a surface control named as "Webview Overlay
SurfaceControl#0"

Change-Id: If47a78a8ae1f7b65b9e7ab983ec72f580d78191a
2021-07-01 11:50:53 -07:00
Greg Daniel
351080a8f5 Merge "Make sure we check for valid GrContext when pinning images." into sc-dev 2021-07-01 01:59:40 +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
Greg Daniel
f8cb525497 Make sure we check for valid GrContext when pinning images.
Test: manual building and running.
Bug: 187540936
Change-Id: Ie900d80128646c8ca2d4fce41d436019e3cf9c71
2021-06-30 12:06:53 -04:00
Huihong Luo
540fdf89b1 Reparent surface control for Webview overlay
When the root surface control changes, the parent of the Webview surface control must be changed.

Bug: 191900007
Test: switch app, or turn on/off screen
Change-Id: Ib7b34133776fd5944afc638bfee471afe6a17349
2021-06-28 20:36:40 -07:00
TreeHugger Robot
544b5f5b2e Merge "vsyncId should always be incremental" into sc-dev 2021-06-28 23:58:30 +00:00
George Mount
5a1f9df840 Merge "Linearly complete overscroll stretch when close" into sc-dev 2021-06-28 17:10:31 +00:00
John Reck
e947e2e20a Merge "Revert "Delete RenderProxy off of the cleaner thread"" into sc-dev 2021-06-25 19:00:24 +00:00
John Reck
f0b6921e89 Revert "Delete RenderProxy off of the cleaner thread"
This reverts commit da35596834.

Bug: b/192050906

If too many RenderProxies are destroyed too quickly, we can end up jamming up the CommonPool preventing RenderThread from making progress if it's waiting on CommonPool tasks.

Change-Id: I8c324bc60891440d9b7be67961f8d5f881dc0f03
2021-06-25 18:59:47 +00:00
Rob Carr
472d962453 Merge "Delete RenderProxy off of the cleaner thread" into sc-dev 2021-06-25 02:18:17 +00:00
John Reck
da35596834 Delete RenderProxy off of the cleaner thread
Speculation for the cause of an ANR. HardwareRenderer's
cleaner can block on RenderThread, which in turn blocks ART's
cleaner thread. This can potentially cause other blockages, but
it's also poor behavior to have such a long-running Cleaner anyway.

Avoid this by putting cleanup to CommonPool.

Bug: 191514384
Test: make, CtsUiRenderingTestCases still passes

Change-Id: I8190f7862528c3ac39ce636f6fca229322480968
2021-06-24 21:58:05 +00:00
Huihong Luo
4df4151bc0 Fix a crash caused by transaction
A native transaction passed from webview is sent back to native side, so java side does not manage the life cycle of the transaction.

Bug: 191414767
Test: Play a video, switch to another app, wait for 10 seconds
Change-Id: I013052c202b445438d6cb6497f5f9a2fc22a2b85
2021-06-24 11:10:06 -07:00
Ady Abraham
505e730e7d vsyncId should always be incremental
In some conditions of scheduling delays, Choreographer may
synthetically advance the indented vsync time. In that case we can't
send a vsync id since there is no one that corresponds to that time.

Test: TBD
Bug: 191840734
Change-Id: I7b2754d5dcb0a3f5fd6cda00a3a2469041116f67
2021-06-23 15:04:04 -07:00
George Mount
22a9f9c83e Linearly complete overscroll stretch when close
Fixes: 190475978

Damped spring animations asymptotically approach their destinations.
The final pixels can take many frames to complete, but stopping them
means that we get a disruptive jump in those final pixels.

This CL detects when the edge effect animation is close to the finish and
completes the animation with a linear velocity that matches a
common velocity at 8 pixels distant. This means that the animation
terminates quicker so that touch events directed at the contents
after the animation completes (e.g. taps) can interact with the contents
soon.

The CL also adjusts the delta for detecting zero in the stretch
animation as it was jumping by a pixel or more at the end of an otherwise
smooth animation.

Test: manual testing for the visual effect
Change-Id: Ie249b0265c5c5939b597668d5afe4f76d0430821
2021-06-23 21:25:04 +00:00
Nader Jawad
3206cce503 Fix: Release skia resources when RenderNode layer is configured
-Updated StretchEffect to null out the child texture
of the SkRuntimeEffectBuilder after the shader is created
-Release optional mask surface used for
stretching the hole punch
-Release SkRuntimeEffectBuilder instance on RenderNode's
StretchEffect

Fixes: 183592264
Test: manual + re-ran cts tests
Change-Id: I90952666d7489985de9ce798ab792cf3fd7f6087
2021-06-23 11:48:58 -07:00
Huihong Luo
17410b668f Merge "Fix z-order for webview surface control" into sc-dev 2021-06-18 19:53:34 +00:00
TreeHugger Robot
5001447b86 Merge "Remove the extra buffer allocation from hwui" into sc-dev 2021-06-18 17:21:39 +00:00
Huihong Luo
34f42fdecd Fix z-order for webview surface control
Set the root surface control transparent, and set the z order of the newly created child surface control to -1.
A new callback is needed to update root surface control in sync from Java side.

Bug: 186750329
Test: use latest APKs from Webview team, play a video, mini toolbar should be visible
Change-Id: I0b37ee8f83fd2b41ff4f2856dbadd31ff6170baf
2021-06-18 10:14:22 -07:00
Nader Jawad
2b9301d01f Merge "Improve snapshot clearing consistency" into sc-dev 2021-06-17 22:32:33 +00:00
Nader Jawad
b502ad7847 Improve snapshot clearing consistency
Updated snapshot result to clear the
internal SkImage whenever the layer changes.
The previous logic did not clear out the snapshot
in various use cases. Because the implementation
before relied on the snapshot created with SkSurface
this makes the cleanup logic consistent with SkImages
created with SkImage::makeWithFilter

Bug: 188450217
Test: manual testing of discord app
Change-Id: I6391eb3b49794e54705bf5c6a09d2bdfd0564d05
2021-06-17 22:13:24 +00:00
Huihong Luo
1d88151a38 Fix potential ASurfaceTransactionCallback leaks
Change the rerferene to java object from global reference to weak
reference.

Bug: 188555236
Test: check number of ViewRootImpl objects from Systrace
Change-Id: I52347b9efb211691826635d046259bc3c54b194f
2021-06-16 09:47:04 -07:00
Ady Abraham
f558ab782c Remove the extra buffer allocation from hwui
SurfaceFlinger will set the maxAcquiredBufferCount on the buffer queue
to account for the extra buffers needed, depends on the refresh rate
and app/sf durations, and there is no needed for any addional buffer
allocation is hwui.

Test: TBD
Bug: 188553729
Change-Id: Ic441a6feb15f6b084d45c9e538b11b7b24e36a0e
2021-06-15 10:25:29 -07:00
Nader Jawad
dd1fcab19a Add logic to clean up resources more frequently
Added call to Skia's performDeferredCleanup method
to free resources that were not referenced within
the last 100 frames or 10 seconds whichever is
furthest away

Bug: 188450217
Test: manual
Change-Id: I3f37e1b5bd01330dbbc2da4a84b1259d56be2768
2021-06-15 10:14:04 -07:00
Kohsuke Yatoh
7adad678e0 Merge "Read font attributes from buffer." into sc-dev 2021-06-14 20:53:59 +00:00
TreeHugger Robot
2aa8be16f8 Merge "libandroid_runtime & libhwui: use libstats*_lazy" into sc-dev 2021-06-13 11:51:50 +00:00
TreeHugger Robot
98f48b4c95 Merge "Refactor SkImageFilter usage to cache results." into sc-dev 2021-06-12 20:14:14 +00:00
John Reck
b99e72f722 Merge "Improve picture capture debug path" into sc-dev 2021-06-11 18:28:34 +00:00
Nader Jawad
6aff4814a7 Refactor SkImageFilter usage to cache results.
If an SkImageFilter is used, create an image
snapshot with the filter applied to avoid
re-computing it on each draw invocation

Bug: 188450217
Test: Re-ran CTS tests

Change-Id: Ib790669e14ada9d4ebbfac958d699e2b5242f2d7
2021-06-10 23:03:03 -07:00
John Reck
760051854e Improve picture capture debug path
* Fixes hardware bitmap capture
* Fixes mutable bitmap capture (no flickering)
* Adds basic single-frame LRU cache to avoid
  repeated readbacks of GPU resources
* Does up-front readback of GPU resources
* Moves serialization off RenderThread again thanks
  to up-front readback avoiding needing GPU access
  off-thread
* Reduces RAM usage & improves performance by serializing
  directly to output stream instead of first copying to
  a byte[]

Bug: 174223722
Test: PictureCaptureDemo mirrors the content
Change-Id: If7ec208b61d5b917e82087cc312880fc5a38c943
2021-06-11 01:52:14 +00:00
Kohsuke Yatoh
a3f5f22cbc Read font attributes from buffer.
minikin::Font::typeface() is expensive because it will open the font file.
Font attribute getters should avoid calling it.

Bug: 188201287
Test: atest UpdatableSystemFontTest
Test: atest CtsGraphicsTestCases:FontTest
Test: atest CtsGraphicsTestCases:SystemFontsTest
Change-Id: Ic8554f6dfacbe27ddfea6b375633c96bced2cc09
2021-06-10 21:02:24 +00:00
Greg Daniel
d667077899 Make sure to close vulkan fd's in error cases
In one set of the fixed cases we actually were never closing the
fd. In the other set we would crash with a fatal error. Now both
have been updated to handle the failures and correctly close the
fd to make sure it all works.

However, I don't think this is the route case of the leaking fds
from the bug since I don't believe we are seeing any of the
corresponding error messages in the logs.

Test: Manual running on phone and watching logs.
Bug: 187240173
Change-Id: I18babe91b0ec83ca63199f06d3d02ec10e8aea85
2021-06-09 12:11:49 -04:00
Greg Daniel
5da361b85c Merge "Reset buffer tracking state in VulkanSurface." into sc-dev 2021-06-08 21:58:19 +00:00
Greg Daniel
ffc50c689f Reset buffer tracking state in VulkanSurface.
When we fail to create an SkSurface from a dequeued
buffer we then call cancelBuffer on that buffer. However,
we don't update our tracking to say the buffer is no
longer dequeued with and doesn't own the fence any more.

I don't think this is the main issue causing the crash in
the attached bug because I don't think we're seeing the
error in the logs for this chunk of code. However this
possibly related issue was found while tracking down our
use of the dequeue_fence fd.

Test: manual building and running of phone
Bug: 187240173

Change-Id: Icb4099eeea5be6aedd5376e07a6e3454f5d1d1e3
2021-06-08 14:30:24 -04:00
TreeHugger Robot
ad7fb842e8 Merge "Increase the persistent storage size for SkSL Shaders" into sc-dev 2021-06-08 16:55:57 +00:00
Leon Scroggins III
05f5ecaa7a Increase the persistent storage size for SkSL Shaders
Fixes: 190348616
Test: builds

We're now using more complex shaders in more places. This allows us to
store more of them.

Change-Id: I1be3da0458c4b64f7082a2e1bc0d08b0824bbeba
2021-06-07 16:13:13 -04:00
Jorim Jaggi
eb24079b9e Merge "Ensure reportFrameMetrics not being called on deleted instance" into sc-dev 2021-06-04 13:04:52 +00:00
Tej Singh
78f65b6855 libandroid_runtime & libhwui: use libstats*_lazy
Update libandroid_runtime and libhwui, both of which are dependencies of
bootanimation, to use listatssocket_lazy and libstatspull_lazy, which
are new static versions of libstatssocket and libstatspull. This means
that bootanimation does not depend on these libraries, which are shipped
from the statsd apex.

The change enables removing the statsd apex from the bootstrap apexes.

Test: m
Test: boots
Test: no fatal linker errors after removing statsd from the bootstrap
apexes
Bug: 178480419

Change-Id: I78f4abe71f4b3718bbd97522c16f1c5ab88f77ae
2021-06-01 15:42:03 -07:00
Jorim Jaggi
e4a52711e7 Ensure reportFrameMetrics not being called on deleted instance
Since onSurfaceStatsAvailable gets called on binder-thread, we
need to ensure that instance doesn't get released while
onSurfaceStatsAvailable is calling reportFrameMetrics.

Test: Boots
Bug: 188934435
Change-Id: Iafe582d6fe4087a3c4274ee39a2803abaa363fd2
2021-05-31 17:57:50 +02:00
Seigo Nonaka
d5ecababb4 Calculate set of available fonts in native
The previous attempt[1] of improving SystemFonts API is not good enough
for users. To further improve the performance, calculate font uniqueness
in native code. From Android S, the system font information is stored
in native code and has more information for skipping duplication check.

Bug: 188201287
Test: atest FontFamilyUpdateRequestTest
Test: atest FontListParserTest
Test: atest FontManagerTest
Test: atest NativeSystemFontTest
Test: atest PersistentSystemFontConfigTest
Test: atest SystemFontsTest
Test: atest SystemFontsUniqueNameTest
Test: atest UpdatableFontDirTest
Test: atest UpdatableSystemFontTest
Test: minikin_tests
Change-Id: Ib375dcda0f278c93ec8dd21636d7a22b4174f214
2021-05-27 15:54:24 -07:00
Greg Daniel
27e1fa257b In Vk DeferredLayerUpdater make sure we releause buffers to foreign queue.
For Vulkan we need to make sure that when we draw AHBs we must
transition them to and from the foreign queue so that the producer is
able to write new data to them and we are able to see the new writes.

Test: Manual running of Lens app
Bug: 178773035
Change-Id: I807709d2b671bf5a01a82237f3b5838734f0d978
2021-05-26 13:38:33 -04:00
rnlee
ce9762b57f Use TraceUtils.h from gui shared library.
Test: It makes
Bug: 183120308
Change-Id: I331262dd2da59817031f0c708f4c102041dcb5e0
2021-05-22 00:12:43 +00:00
Nader Jawad
c401b23572 Fixed issue where layers were not always used
Fixed issue where requiresLayer logic was filtering
on the type of stretch behavior when it should no
longer be the case in order to maintain consistent
rendering behavior across stretch behaviors

Fixes: 188923672
Test: Added HWUI StretchEffect test
Change-Id: Ief4f010949b97302bd2d71f26f0f892c8e7f374f
2021-05-21 13:08:12 -07:00
John Reck
248d942bb7 Merge "Fix PixelCopy & BQ crop" into sc-dev 2021-05-20 20:27:28 +00:00
Nader Jawad
85cf59de2f Merge "Add support to toggle different shader behaviors" into sc-dev 2021-05-18 16:27:47 +00:00
Jorim Jaggi
19cefb4d21 Merge "Use SwapBuffersCompleted as frame end time" into sc-dev 2021-05-18 15:30:07 +00: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