441 Commits

Author SHA1 Message Date
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
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
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
TreeHugger Robot
98f48b4c95 Merge "Refactor SkImageFilter usage to cache results." into sc-dev 2021-06-12 20:14:14 +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
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
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
85cf59de2f Merge "Add support to toggle different shader behaviors" into sc-dev 2021-05-18 16:27:47 +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
Lucas Dupin
fdda357925 Correctly initialize the noise phase
To make it move smoothly throughout the animation

Fixes: 186130728
Test: manual
Change-Id: I78bb220f72238f13b21055c5874ce8b829171b5d
2021-05-17 16:28:31 -07:00
TreeHugger Robot
5c681088e4 Merge "More benchmark tweaks" into sc-dev 2021-05-13 00:53:03 +00:00
John Reck
3920768c72 More benchmark tweaks
Bug: 187718492
Test: this
Change-Id: Ie0cad91e1c7d1a02704fc4b1007ba2c28cb2b3e7
2021-05-12 19:29:03 -04:00
TreeHugger Robot
c9216d334b Merge "Provide proper transform to mask canvas" into sc-dev 2021-05-12 20:57:56 +00:00
Nader Jawad
9238f59d97 Provide proper transform to mask canvas
Updated mask canvas to have the same
transformation applied to the initial
target canvas and device

Bug: 184297961
Test: manual
Change-Id: Ibdeefba8ec9f95f4acd7e3176f43a5e603e76676
2021-05-12 12:16:26 -07:00
John Reck
f5c2981163 Merge "Add some more scenes, replace linear with uniform" into sc-dev 2021-05-12 15:07:36 +00:00
TreeHugger Robot
f196d46fdf Merge "Macrobenchmark tweaks & gpu memory dumping" into sc-dev 2021-05-12 03:21:29 +00: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
TreeHugger Robot
c5f21ce435 Merge "HWUI: mSerialContext needs to outlive other serializing members" into sc-dev 2021-05-11 23:16:24 +00:00
John Reck
66e06d4ff1 Macrobenchmark tweaks & gpu memory dumping
Add support for glob matching
Ensure glob matches are alphabetically sorted
Add feature to dump GPU memory usage after a test pass
Adjust gpu memory dump to be a bit more compact (skip empty outputs)

Test: this
Bug: 187718492
Change-Id: I6dc80b2d3379d8d10001116e1240727d9914bc10
2021-05-11 17:06:53 -04:00
John Reck
09d9ccadc3 Avoid creating a layer for linear stretch
Bug: 187718492
Test: manual logging no layer updates during benchmark
Change-Id: I9a231625142e404882be6c53fa6d01b2fb81af1a
2021-05-11 12:26:52 -04:00
Ady Abraham
b154792a39 HWUI: mSerialContext needs to outlive other serializing members
mSerialContext is used as the serialization context, and need to
outlive mOpenMultiPicStream and mMultiPic and those are referencing
it in SkSharingSerialContext SkSharingSerialContext::serializeImage

Test: https://buganizer.corp.google.com/issues/182710292#comment16
Bug: 183049238
Change-Id: I25842e492d5efd7a7532964bddca61559d50ebe1
2021-05-11 04:27:54 +00: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
Lucas Dupin
b73fa47929 Merge "Adding force-dark support to RippleDrawable" into sc-dev 2021-05-07 01:08:43 +00:00
Lucas Dupin
00af5271da Adding force-dark support to RippleDrawable
Add force-dark support to RippleDrawable by modifying the ink color.

Test: manual
Test: atest CanvasOp
Fixes: 186130682
Change-Id: I89eaaf3afa5ec53a74d2d08de8cff6484e55a912
2021-05-06 15:17:02 -07:00
Nader Jawad
197743ff9c Update hole punch logic in HWUI
--Updated HWUI holepunch logic for SurfaceView to
also apply the stretch to the hole punch
--Updated RenderNode callbacks to also include
an offset from the ancestor RenderNode that also
has a stretch configured on it
--Added new test activity to verify hole punch
logic

Bug: 179047472
Test: manual
Change-Id: Ibbaf8248a31839ba9dc352ecb9fef54e1276918e
2021-05-03 18:08:47 -07:00
Lucas Dupin
cb071176be Merge "Move sparkle animation to RenderThread" into sc-dev 2021-04-16 15:08:52 +00:00
Lucas Dupin
6d1601a740 Move sparkle animation to RenderThread
The sparkle loop animation was happening on the UI thread and is poses
some interesting challengers:
- Animations freezes when UI thread is busy, for example when
  startActivity is called.
- onDraw calls add unnecessary work to the UI thread, leading to jank
  in some cases, like PIP

Test: manual
Fixes: 184760248
Change-Id: Ie2840c767da61476678839eaac215dc3aff95b5c
2021-04-15 15:26:32 -07:00
TreeHugger Robot
123079969d Merge "Fix size calculation" into sc-dev 2021-04-15 21:37:59 +00:00
John Reck
dc323f27ad Fix size calculation
size is in bytes

Fixes: 185429940
Test: builds
Change-Id: Ib80eecd9ee8830877cfd9861d7126201d88d3f32
2021-04-15 14:04:15 -04:00
John Reck
7e18b475d3 Add GL_CHECKPOINT before invoking webview
Fixes: 185351688
Test: builds
Change-Id: I57d184c4d252efef66cdf22e3b83d377a60c94e4
2021-04-14 14:17:14 -04:00
Greg Daniel
d4fd1b0ce2 Merge "Make SkiaVulkanPipeline go through RenderThread to get VulkanManger." into sc-dev 2021-04-09 13:23:41 +00:00
Greg Daniel
d2317a4983 Make SkiaVulkanPipeline go through RenderThread to get VulkanManger.
Previously the pipeline held a referance to the VulkanManager on
the RenderThread. However if the RenderThread ever deleted or
recreated its VulkanManager the pipline would not update its
reference and cause crashes when accessed. This change makes it
so the pipeline always goes through the RenderThread to get the
VulkanManager.

Test: Manual build and running on phone
Bug: b/184287126, b/183289296
Change-Id: I52b37d0aa85b553e358285fa3654c2169971ffde
2021-04-08 20:21:56 +00:00
Nader Jawad
8f5d66b748 Do not use SkImageFilter for Stretch
Refactor stretch implementation to manually
draw the shader as a rect instead of using
SkImageFilter

Bug: 184184033
Test: Re-ran stretch tests
Change-Id: I6263f5474b185b3f81ef9fd1bec3e43e86da49f2
2021-04-07 16:07:00 -07:00
Nader Jawad
2dc632aee3 Holepunch layers for SurfaceView
Update RenderNodeDrawable to hole punch areas into
layers created for SurfaceView

Bug: 184297961
Test: Added CTS test to SurfaceViewTests
Change-Id: I1f03a4fe34c5a8b7411ebe728ea3d4195fcd1fac
2021-04-06 22:03:00 -07:00
John Reck
064650b3bf Add MultiDisplayList + memory leak fixes
MultiDisplayList can contain either a SkiaDisplayList
or a CanvasOpBuffer. However DisplayList itself
still points to the SkiaDisplayList-only wrapper
to avoid any std::variant or std::visit overhead
just yet.

Also fixes a memory leak in CanvasFrontend from an
uninitialized std::optional and a few minor leaks
in unit tests.

Test: build & hwui_unit passes

Fixes: 184680809
Change-Id: Ifa6b723b6456f5d3eeac1201e76f337250103d6f
Merged-In: Ifa6b723b6456f5d3eeac1201e76f337250103d6f
(cherry picked from commit d34d6cec97c8f1be92f676aeb79c83d57cf8c6ba)
2021-04-06 23:13:17 +00:00
Nader Jawad
6701a6014f Wire SKSL based stretch shader to HWUI
--Ported SKSL based stretch shader from OpenGL prototype
--Hooked up the stretch APIs in RenderNode to the stretch
shader.
--Updated RenderNode layer logic to promote the RenderNode to
a layer if there is a stretch to be applied to it in order
to feed the layer as input to the stretch shader

Bug: 179047472
Test: builds + sample overscroll stretches + updated CTS test
Change-Id: I744ff70099fe251ce07f23d067bf13444a468c08
2021-03-03 14:56:17 -08:00
Nathaniel Nifong
9570000af3 Merge "Respect paints aa setting when drawing bitmap" into sc-dev 2021-03-03 15:38:03 +00:00
Greg Daniel
be2803a817 Remove flushAndSubit from SkiaPipeline renderFrame.
Previously we would submit a command buffer for the
frames draws and then immediately submit a second
command buffer that had no commands and just an attached
semaphore. This merges those two submit calls into Skia
into one call.

Test: manual running of system of benches
Bug: 175913056

Change-Id: If0d054960de8b459814cbfa9289756f8ee9d4a93
(cherry picked from commit f16ba6019400ec7eb6ac7a2adc05ec06ad5661a1)
2021-03-01 13:56:45 +00:00
Nathaniel Nifong
7d25a0f9ca Respect paints aa setting when drawing bitmap
Bug: b/177218339

Test: run test app on pixel 3a which draws rotated bitmat
with and without aa.

Change-Id: Id3719a1206149ffb53fccc3dd47cec309f44f8e1
2021-02-26 11:09:34 -05:00
Mike Reed
bb4cb48800 Simplify paint filtering
Removes complication of copy-on-write intermediate class, and
allows for shaing a single applyLooper() function.

Test: make

Bug: 178700363
Change-Id: Ia74cb8e7c650e469b8429de1d7cf9204821d8f11
2021-02-23 12:49:22 -05:00
Mike Reed
07bee70eb7 Revert "Revert "Simplify calling loopers""
This reverts commit 1edec35288c7f2cb133d2f9f76d490155ec2a3be.

Previous attempt at this mistakenly used a pointer to an rvalue,
which was out of scope when it was used.

e.g.
    const SkPaint* sk_paint = filterBitmap(paint);
    ...
    // now use sk_paint <-- bad

Test: make

Bug: 178700363
Change-Id: I2e2913385e05257c482a5d12eaeaddadd04126e2
2021-02-21 17:08:01 +00:00
Chris Fries
1edec35288 Revert "Simplify calling loopers"
This reverts commit 07c0b7c0d13369a4d20ed833c8fb8e2e52cd216e.

Reason for revert: http://b/180818875 systemui crashloops in libhwui

Change-Id: Id62860d43d7fac572bd94ebc4fe5cc1ff7cc6820
2021-02-21 03:49:09 +00:00
Mike Reed
07c0b7c0d1 Simplify calling loopers
Test: make

Bug: 178700363
Change-Id: I087df21cc78fb60b8075027ba116489a9da63c58
2021-02-18 13:13:38 -05:00
Mike Reed
0f9dce7ed5 Custom looper code for Android
Test: make

Bug: 178700363
Change-Id: I1d328275ab5e0c9b6b9171ef075f71274e50a3f5
2021-02-17 11:30:21 -05:00
John Reck
9a7c192ebe Remove two macros
This is colliding with ag/13519705 and causing
build issues. So replace the macros with constexpr's which are
better

Bug: 179047472
Test: make
Change-Id: Icf7c38077ef608ec97e737d47d3d6c25246190bf
2021-02-08 19:32:21 -05:00
Derek Sollenberger
d7816b6140 Merge "Pass sampling or nothing to surface.draw" into sc-dev 2021-02-02 15:15:09 +00:00
John Reck
7cf75f0b15 Merge "Add stretch plumbing" into sc-dev 2021-02-02 14:49:42 +00:00
Mike Reed
27bf51dc50 Pass sampling or nothing to surface.draw
Test: make

Bug: 178700363
Change-Id: I144c0a1bc2376259640d1a6920d9df4edd652849
2021-02-01 17:15:00 -05:00