Commit Graph

301 Commits

Author SHA1 Message Date
Miguel de Dios
509627ba33 Revert "hwui: ro.hwui.render_ahead=0 queue on high FPS"
This reverts commit f802abe47f.

Reason for revert: We're seeing jank increase after this patch.

Change-Id: Ic8d77df3fbbeeedeed4b8f31737454d9c056f8b0
Bug: 132733305
2019-05-14 23:56:21 +00:00
Kevin DuBois
f802abe47f hwui: ro.hwui.render_ahead=0 queue on high FPS
ro.hwui.render_ahead was behaving the same as -1 when it was set
to zero. Correct it so that ro.hwui.render_ahead will queue frames
when set to zero on any display rate FPS.

Fixes: 131340980
Test: Test presence or not of timestamps with -1,0,1,2 settings
Change-Id: Ibd1974253e947130fb03a0b86f599e0e5f5eac38
2019-04-25 16:05:01 -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
Leon Scroggins
949305fe52 Merge "Do not cache AVDs that are off screen" into qt-dev 2019-04-16 12:15:16 +00: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
Leon Scroggins III
6c5864c098 Do not cache AVDs that are off screen
Bug: 128805564
Test: Manual + systrace; hwui_unit_tests; CtsUiRenderingTestCases

Only update a VectorDrawable's cache if it is onscreen. This fixes a
Twitter use case where the app has a ProgressBar that is exactly one
pixel offscreen. Prior to this CL, we repeatedly drew the ProgressBar's
AVD to a GPU surface, even though we clip it out later and never draw
that GPU surface. Now, we recognize that the AVD is outside of the
bounds of the screen, so we never draw to the GPU surface.

TreeInfo:
- store the size of the screen, retrieved from
  CanvasContext::getNextFrameSize.
SkiaDisplayList:
- Store the matrix at the time of recording a VectorDrawable. Concat
  that with the current matrix to determine whether the VD is on screen,
  based on the TreeInfo. If it is offscreen, do not add it to the list
  of AVDs that need to be updated ahead of rendering.
- In addition, if it is offscreen (or not dirty), do not call
  setPropertyChangeWillBeConsumed(true). This prevents triggering
  dispatchFrameCallbacks to update on the RenderThread when there is no
  need to. This also mimics what would happen if the View/RenderNode had
  been completely offscreen.
- Add a method to append an AVD to mVectorDrawables. Now that the vector
  is of Pairs, this simplifies the call sites. Add a second helper to
  just add an AVD without a matrix, for use in tests.
SkiaRecordingCanvas:
- get the current matrix and store it in the display list along with the
  AVD.
CanvasContext:
- add getNextFrameSize, for reporting the size of the next frame without
  dequeuing it
VectorDrawable.cpp:
- call quickReject to potentially short circuit drawing. This is for a
  hypothetical use case (verified in a test app) where the containing
  RenderNode is partially onscreen, but the AVD itself is not. Even
  without the change to VectorDrawable.cpp, we skip uploading to the GPU
  cache, the SkiaDisplayList still attempts to draw it. This change
  keeps us from drawing it at all.
SkiaDisplayListTests.cpp:
- Now that I've hidden mVectorDrawables, call the new public APIs.
- prepareListAndChildren test
  - for the clean VD, assert that getPropertyChangeWillBeConsumed
    returns FALSE. This is due to the behavior change that we do not
    set it unless the VD is dirty.
  - set the bounds, so our onscreen check works.
- Add another test for prepareListAndChildren, which puts VDs offscreen.

Change-Id: Iae0a07adcf58e7884e0854720de644e7b2faf2bf
2019-04-12 14:31:31 -04: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
John Reck
09e2fbe605 Merge "Remove old TaskManager system" 2019-03-18 20:31:22 +00:00
John Reck
322b8ab774 Remove old TaskManager system
Replace it with a newer, fancier, WorkQueue-inspired
one that's just a global common thread pool.

Test: hwuiunit passes
Change-Id: Ib5d03104a08bbac9a4ec67a1bfc0db2b35d6700f
2019-03-18 09:34:11 -07:00
John Reck
3c0f563786 Fix profile gpu bars to use display fps
Also adds a 'good' bar at 80% threshold
and a 'bad' bar at 150% threshold (where triple
buffering would start to get iffy)

Fixes: 127371028
Test: eyeball'd it

Change-Id: I109cd293f87f8cb9c8f1e66d49fb8fb2188b0bec
2019-03-15 16:49:25 -07:00
John Reck
0b19a7370a Re-enable empty damage drop optimization
Fixes: 113796161
Test: device seemed to behave correctly?
Change-Id: Id43e1eaad29d07c06c1003c0653e5d1ee7084cfe
2019-03-07 17:18:25 -08:00
John Reck
283bb46846 New WebViewFunctor API
Should function alongside existing functor API.

Bug: 120997728
Test: hwuiunit passes
Change-Id: I8f6143d0be1111431b55016f34de319f6b8c8910
2018-12-14 14:07:18 -08:00
John Reck
848f651554 Revert "Revert "Make HWUI's surface Reliable^TM""
This reverts commit dd08224e4d.

Bug: 120097554
Bug: 120342364
Bug: 120421537

Test: verified emulator can boot OK, with no log warnings
Test: verified keyboard works in landscape

Change-Id: Iae2cd1140d81755b126adfb21ec885181f3bc6b6
2018-12-06 15:18:27 -08:00
John Reck
46045217e3 Remove dead code
No longer needed

Test: none
Change-Id: Id260e4a2b1026b9ccd853f277f5e527fb7568f69
2018-12-03 14:58:28 -08:00
Bo Hu
dd08224e4d Revert "Make HWUI's surface Reliable^TM"
This reverts commit 650bd9a7b3.

Reason for revert: broken emulator b/120342364

Exempt-From-Owner-Approval:

Change-Id: If05d9d87325e1d836375d7dc79ff66ef057d228d
2018-12-03 13:59:49 +00:00
John Reck
650bd9a7b3 Make HWUI's surface Reliable^TM
You won't believe this one weird trick to make
EGL_BAD_ALLOC errors never happen again! libgui
hates it!

Bug: way too many to list
Test: none - there probably should be, though
Change-Id: I8e7fc3e584f90c01e0fd932497604a1d93710ba6
2018-11-28 13:39:07 -08:00
John Reck
8785ceb3b9 Refactors and a potential public API for rendering
Split out the View/ViewRootImpl bits from the
hardware rendering bits.

Create a potential public API surface for
hardware rendering

Bug: 112709971
Test: builds & boots

Change-Id: I9e6f44b07a170574a905f42338282c4bb7e95f56
2018-11-08 15:32:35 -08:00
Peiyong Lin
189021b408 Partially revert "[HWUI] Implement legacy color mode."
Reason for partially revert: Step back a little bit to think about how we want
to move the view system forward.

This patch removes the legacy mode we have added, as well as move color type
and color space of the surface to SkiaPipeline.

BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger

Change-Id: I1ab7b88d41347284d87649618e5a15f5c6bcf8fe
2018-09-27 18:00:52 -07:00
Derek Sollenberger
28a4d9935c Refactor RenderState and remove unused functionality.
Test: hwui_unit_tests still pass
Change-Id: Ie943671535ab8c5da1bac05985e815e0cb842dc1
2018-09-20 14:47:08 -04:00
Peiyong Lin
1f6aa122a5 [HWUI] Implement legacy color mode.
Previously, HWUI always produces SRGB buffers. We introduced new APIs for
SurfaceFlinger, a.k.a. the composer service to return to composition preference
for data space, and pixel format. This patch makes HWUI query composition
preference from composer service, and creates the corresponding EGL surface
with the correct attributes.

In legacy mode, HWUI will take the pixel value from source color space, and
interpret it as pixel value in destination color space.

BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger
Change-Id: I64562d5ea6f653076c8b448feb56b5e0624bc81c
2018-09-13 13:50:27 -07:00
Stan Iliev
1a025a7163 Refactor HWUI readback code to be backend independent
Implement readback from Surface, TextureView and HW Bitmap
for Vulkan pipeline by wrapping the graphics buffer in an SkImage.
Refactor both Vulkan and GL readback to use common code.
TextureView readback is moved from IRenderPipeline interface to
Readback class. Refactor all 3 readback flows to use common
implementation.

Test: Passed all view, uirendering and graphics CTS tests with GL
Test: Passed many CTS test with Vulkan, that require readback
Bug: 113673613
Change-Id: Ifbfd8170a5401f87a709b4b1b9fa058e8e11768d
2018-09-10 13:18:04 -04:00
Stan Iliev
564ca3e2c9 Reland "TextureView Vulkan support and optimized OpenGL draw"
Fix an issue with incorrect texture matrix, when there is 90/270 rotation.
This happened, because after refactoring SkImage has buffer width/height,
instead of layer width/height.
This reverts commit a683eb3945.

Bug: 113673613
Test: Ran TextureView CTS and lensblur in camera app
Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-05 01:58:34 +00:00
Stan Iliev
a683eb3945 Revert "Revert "Revert "TextureView Vulkan support and optimized OpenGL draw"""
This reverts commit 85f9096b52.

Reason for revert: lensblur broken.

Change-Id: I83ac163159fc537bc15936a0f8597a7512ca9d6e
2018-09-04 15:42:18 +00:00
Stan Iliev
85f9096b52 Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""
This reverts commit 867c43de05.

Reason for revert: Fixed issue with unsupported hardware buffer formats by landing https://skia-review.googlesource.com/c/skia/+/150470 "Support more hardware buffer formats"

Bug: 113673613
Change-Id: I1f7c528f138e290160e75833c8d989d9535002ee
2018-08-31 22:13:15 +00:00
John Reck
867c43de05 Revert "TextureView Vulkan support and optimized OpenGL draw"
This reverts commit c8e22a6532.

Reason for revert: broke camera, b/113555199

Bug: 113555199
Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-30 18:42:08 +00:00
Stan Iliev
c8e22a6532 TextureView Vulkan support and optimized OpenGL draw
Render TextureView as hardware bitmaps, instead of GL textures.
Cache SkImage for each observed GraphicBuffer, which is faster
even for GL.
Implement C++ SurfaceTexture, which allows Java SurfaceTexture
to be used with Vulkan HWUI render thread and application GL.
threads. Delete GLLayer and VkLayer classes and texture code
from old HWUI pipeline.

Test: Ran skiagl and skiavk pipeline with a TextureView app.
Test: TextureView CTS tests pass for GL pipeline.
Test: Ran Android NDK Native codec sample app.
Change-Id: Idc94f864ce2d34fd6ceff4be4fc7d3327e99879c
2018-08-29 10:22:03 -04:00
Yu Jia
c4d7698190 Merge "cts case com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef am: d490e788f1
am: 048c6751d7

Change-Id: I89d6290789324a38a28de5e03bd139e450297b23
2018-06-04 19:52:48 -07:00
Yu Jia
048c6751d7 Merge "cts case com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef
am: d490e788f1

Change-Id: I6e3507cfb5b6501dd28fb2b6019fdbb74fb745f0
2018-06-04 19:42:29 -07:00
John Reck
5b02c629bd Attempting to fix the black flicker
Bug: 79231206
Test: Repro steps from bug

Merged-In: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-31 12:56:28 -07:00
John Reck
cc2eee89c8 Attempting to fix the black flicker
Bug: 79231206
Test: Repro steps from bug

Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-31 19:55:54 +00:00
Yu Jia
e57493ab19 cts case
com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in
modue CtsIncidentHostTestCases failed

This cts case design 20 frames, every 4 frames include 700ms frame and
150ms frame

When activity launched, first 3 frames need allocate buffer during
dequeue buffer, bug some low-end platform took too long (>6ms), so
it will skip the fourth frame(150ms) and post a new draw callback that will cause cts failed
2018-05-30 13:34:19 +08:00
Leon Scroggins III
117f0c2833 Merge "AnimatedImageDrawable: Eliminate unnecessary calls to redraw" into pi-dev am: a2113aa4ad
am: 6353ff5bb5

Change-Id: I5258721b49834aba58e9bf19162e6a4588f68f0f
2018-05-17 13:16:13 -07:00
Leon Scroggins III
4afdd1caa4 AnimatedImageDrawable: Eliminate unnecessary calls to redraw
Bug: 78866720
Test: Manual + systrace; existing CTS

Previously, we set hasAnimations to true when the AnimatedImageDrawable,
so that we would get a call to redraw. But if the image does not need to
show its next frame yet, the redraw was unnecessary.

Instead, add a new field to TreeInfo::Out, representing the delay time
until the image will need to be redrawn - i.e. when the duration of the
current frame has passed. Each call to prepareTree will post at most one
message to redraw, in time for the earliest animated image to be
redrawn. Post the message for one rendered frame ahead of time, so that
when it is time to show the next frame, the image has already gotten the
message to update.

On a screen with a single animated image, this drops the number of calls
to dispatchFrameCallbacks to as infrequent as possible. It is called
only when we need to draw a new frame of the image. On a screen with
multiple animated images, the calls may be redundant, but they will not
be more frequent than they would be without this change.

Switch to nsecs_t and systemTime internally, matching the rest of HWUI.

Remove mDidDraw and related. Its purpose was to prevent advancing the
animation while the image is not being drawn. But it isn't really
necessary. If it's not drawn, onDraw is not called, which is where we
trigger decoding. And onDraw already has a defense against getting too
far ahead - if its timer indicates that it should skip a frame or show
it very briefly, it will back up its timer. More importantly, mDidDraw
caused a bug, when combined with less frequent redraws. If the display
list containing the drawable doesn't need to be redrawn for other
reasons, the drawable's timer never advanced, so its animation stopped.

Fix software drawing. Compute the milliseconds in the future to draw the
next frame, and add that to SystemClock.uptimeMillis() to compute the
time to pass to scheduleSelf.

Change-Id: I13aab49922fa300f73b327be25561d7120c09ec4
2018-05-16 18:51:07 -04:00
Mike Reed
e7f688bd01 remove BakedOps and much of renderstate
Test: make

Change-Id: If070b7436b848c6840abfac5f051b0f5b6cb17ce
2018-05-04 15:21:49 -04:00
John Reck
1e51071240 Remove RenderThread from EglManager
Refactor to make EglManager re-usable.

Test: hwuiunit passes, hwuimacro works

Change-Id: Ie8e9398c703fada1dc5d8baca5f42485eadea202
2018-04-26 13:46:12 -07: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
44627c264f So long OpenGLPipeline & OpenGLReadback (2/??)
Hello EglReadback

Test: hwuiunit & PixelCopyTests pass
Change-Id: I36a8cb45b11141b09e75a2e978ed13e336425625
2018-04-12 13:58:13 -07:00
John Reck
55665d499c Merge "Remove RenderPipelineType::OpenGL (1/many)" 2018-04-11 22:06:37 +00: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
TreeHugger Robot
413a3c3812 Merge "Remove dead code" 2018-04-10 01:16:30 +00:00
John Reck
617673f83f Remove dead code
Remove an old protobuf serialization experiement, skp capture
does this better

Test: builds

Change-Id: Icd875eabee6b517729f901841e48e579d0e8de4d
2018-04-09 14:50:40 -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
John Reck
6f75da0474 Remove old workaround for display issues
Bug: 76086140
Test: A bunch of systraces, things looked OK
Change-Id: I447e976a937160c0bb3b52afd57661e7ffa0c9ec
2018-03-21 14:43:40 -07:00
John Reck
9f51644abf Extreme battery saver: Allow lowering framerate for experiments.
Bug: 68769804
Test: manual
Change-Id: Ic0c95f32c7ba6d86a997997e480e6d8a5f228f25
2017-12-06 13:59:19 -08:00
John Reck
1bcacfdcab Format the world (or just HWUI)
Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-11-03 10:57:44 -07:00
John Reck
f8441e6552 Switch to a fancy new queue
Test: unit tests & benchmarks pass/faster

Change-Id: I9521432172d6dd6039c5280b1265479a36a86247
2017-10-27 13:39:55 -07:00
Stan Iliev
47fed6ba6a Fix crash in "Tree::updateBitmapCache"
Fix crash caused by updating vectordrawable cache for objects
from previous frames, which may have been deleted.

Bug: 67940327
Test: Ran CtsUiRenderingTestCases test
Change-Id: I4466235e78e9b7937a0d4428240574d9e3d0989f
2017-10-20 16:03:25 -04:00
John Reck
34781b2530 Move frame history into jank tracker
Test: hwui_unit_tests & manual
Change-Id: If761947652750640268217cd8cd97c8382441b44
2017-07-05 16:48:09 -07:00
Romain Guy
07ae505d40 Use RGBA16F layers when wide color gamut rendering is on
Layers created using View.setLayerType() or Canvas.saveLayer() need
to be RGBA16F/scRGB-nl when within a window that requested wide color
gamut rendering.

Bug: 29940137
Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, hwui_unit_tests
Change-Id: I42fd6355448c92041491a7109e3ac8a153d38bf9
2017-06-14 13:44:08 -07:00
Derek Sollenberger
f9e45d1d81 Implement CacheManager for the Skia pipelines.
The core of the implementation is complete and provides heuristic
cache sizing based on the size of the surface being used. This CL
will also be used to add the following features in the future...

1) Support Vulkan pipeline reporting on the size of the surface.
2) Complete the VectorDrawableAtlas stub code
3) Automatic purging of stale resources for low memory devices.

Test: hwui_unit_tests (new test added) and CtsUiRendering
Bug: 62260637
Change-Id: Ib85159cca28b646fe249f2190b07f1b7e0f50d8f
2017-06-06 14:19:37 -04:00