Commit Graph

93 Commits

Author SHA1 Message Date
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
TreeHugger Robot
d91a716cf3 Merge "Don't load EGL driver always" 2019-04-01 17:32:35 +00:00
Stan Iliev
30b9096352 Don't load EGL driver always
EGL driver is preloaded only if HWUI renders with GL.

Test: Ran several apps, passed CtsGraphics and CtsUiRendering
Change-Id: Ib38d6f51a19a2ee3631c7d9c99283286c389e476
2019-04-01 15:20:06 +00:00
Stan Iliev
bf99c4450b Invalidate Skia shader cache if Vulkan driver has changed
Test: Ran apps several time and observed shader cache validation
Change-Id: I7c2620b9a0eefcb7acedc86647ecf44805518b2f
2019-03-29 11:18:21 -04:00
Greg Daniel
c073252f76 Add support for uploading to AHBs using Vulkan.
Test: manual build and testing on blueline.

Change-Id: I240a5f1e3ba34677b03131eba36ffd8783d99041
2019-03-19 10:09:53 -04: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
Stan Iliev
898123b6a3 Start RenderThread earlier to preload Vulkan/EGL drivers
This CL should fix application startup regression for Vulkan
detected by "Hermetic Startup: EmptyActivity" test.
EGL drivers are loaded in a temp thread to leave more time
in RenderThread for other work. Loading EGL drivers
on the RenderThread may cause a perf regression.

Test: Ran cold-dropcache-test test.
Bug: 122659224
Bug: 123361175
Change-Id: I8ca818e98fac196a41d079be15594caca5cb1bab
2019-02-20 02:10:52 +00:00
John Reck
700079e817 Fix RenderThread setForLooper
RenderThread doesn't use ThreadBase::threadLoop
so it also needs to explicitly Looper::setForLooper

Fixes: 124467483
Test: hwuiunit
Change-Id: I3703b5d3dbbbaa68e88fc23756dfccacfce863cb
2019-02-19 10:38:50 -08:00
Stan Iliev
981afe773a Decouple VulkanManager from RenderThread
This CL allows for more than one VulkanManager to exist.
VulkanManager ctor are public allowing for classes other
than RenderThread to instantiate it.
Secondary VulkanManager can be used to render on a thread
other than RT.

Test: Ran HWUI unit tests and several apps
Change-Id: Ibfd76c86ff67e01617a500902bba7431b928f5c0
2019-02-13 15:55:45 -05:00
Stan Iliev
978d5321b4 Fix RenderThread and worker thread names used by tools
Test: collected systrace and RenderThread hwuiTask1/2 shown
Change-Id: I1114ff72a7ed8c9dc86a64ebd15ca783d1b2ff08
2019-02-06 12:02:28 -05:00
TreeHugger Robot
b3cd68bc82 Merge "Tell JVM to not wait for HWUI worker threads upon shutdown" 2019-02-05 23:41:59 +00:00
Stan Iliev
80dbc35555 Tell JVM to not wait for HWUI worker threads upon shutdown
RenderThread is setup as a daemon thread, which allows JVM to
exit without waiting on it. This CL does same setup for HWUI
worker threads, which offload work from the RenderThread.
This fixes an issue exposed by Vulkan pipeline, which is pushing
different loads to the worker threads and causing some java tests
to hang on exit. This is not a Vulkan specific issue, because GL
also hangs if worker thread is started.

Bug: 123374538
Test: Ran DismissDialogsInstrumentation test
Change-Id: Ie4ee94737ced975323a0792f57f8426c958e8056
2019-02-05 16:26:58 -05:00
Stan Iliev
90276c8621 Fix crash when VulkanSurface is no longer valid
SkiaVulkanPipeline::mVkSurface can become obsolete if
RenderThread destroys Vulkan context. This CL enables
RenderThread to notify active Vulkan pipelines that their
surface is invalid.
Improve error handling, when trying to draw a frame with null
VulkanSurface.

Bug: 123640274
Bug: 123541940
Test: Ran several apps
Change-Id: If7fba00713d097192c96179df36e90b54f4f8090
2019-02-04 11:51:20 -05:00
Stan Iliev
150001aaa7 Invoke Vulkan initialize earlier
Invoke VulkanManager::initialize as soon as the RenderThread is
started. This reduces time spent in the first call to
CanvasContext::setSurface by ~20ms.

Test: Ran Hermetic Startup: EmptyActivity
BUg: 122659224
Change-Id: Ifa160b0b0bbe43adc82f061fac51082878164804
2019-01-10 18:31:55 -05: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
Derek Sollenberger
5a5a648b69 Fix crash when EGLSurface is no longer valid.
The EGLSurface stored in the pipeline can become obsolete if the
EglManager/RenderThread has to destroy the context.  This CL enables the
RenderThread to notify all active pipelines that their surface is invalid.

Bug: 115290937
Test: hwui_unit_tests
Change-Id: Ib3054822273bc35406630b7442229a81b39a2c91
2018-09-20 13:35:19 -04:00
Derek Sollenberger
17662389b9 Refactor DeviceInfo in HWUI
Remove the need for both Vulkan and EGL managers to initialize
it. Also remove unused code paths.

Test: hwui_unit_tests
Change-Id: I33ad881468eddbf91ec63207f0d82bed8d97f5ad
2018-09-18 09:30:13 -04: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
Yichi Chen
9f95955620 Add cache validation to ensure the validity
Create cache identity from GL_VERSION and store in ShaderCache.
In the next time ShaderCache is restored from disk, compare the
cache identity to ensure its validity. If GL_VERSION changes in
between, flush out entire FileBlobCache and start from an empty
one.

Bug: b/71800782
Test: Wrote a new unit test to save and restore ShaderCache
Test: hwui_unit_tests
Change-Id: Ie573dc4f18733eee090725be30445d879765231b
2018-09-04 04:04:58 +00:00
Stan Iliev
e6cfb09cc4 Merge "Revert "TextureView Vulkan support and optimized OpenGL draw"" 2018-08-30 18:56:41 +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
TreeHugger Robot
54b9892f3c Merge "TextureView Vulkan support and optimized OpenGL draw" 2018-08-29 15:51:15 +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
Derek Sollenberger
333a83c02f Prefer ES 2.0 with external image support vs ES 3.0 without that support
We currently attempt to use ES 3.0 shaders even if it lacks the
extension for external images.  This CL reverts back to ES 2.0 in
the event that we find that the OES_EGL_image_external_essl3 is not
present.

Test: no change in graphics output
Bug: 111220579
Change-Id: I6bd7145026d9686cfcf49393a19580208db8a367
2018-08-15 10:17:45 -04:00
John Reck
b5fc209b35 Remove unneeded pipeline check
Test: none
Change-Id: I1123567c51efff3eef6c09f76c1624e48f71c802
2018-04-30 14:43:22 -07:00
John Reck
b90d4cb3be Move all non-GL HW Bitmap work off RT
Bug: 78288006
Test: hwuiunit passes, systrace showed work distribution as expected,
and photos using HW bitmaps still works

Change-Id: Id3285b637b5d74d3c5891ed3051ac1e44015987a
2018-04-27 12:39:45 -07: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
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
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
Stan Iliev
a31973fe3a Create an empty stub for Vulkan readback
Create a stub for Vulkan readback. This avoids crashing,
because OpenGL readback does not work for Vulkan.

Test: Ran calc and gmail apps with skiavk pipeline.
Change-Id: I11cddde0a1efae1aa549e7a47d01051ec975f470
2018-01-12 11:50:29 -05:00
Greg Daniel
660d6eca99 Update GrContext creation calls to use sk_sp
Test: manual testing

Change-Id: I68d8706ffa7bc7c6622ea0b8c45d7297a131f6bf
2017-12-11 09:39:16 -05:00
John Reck
259b25a310 Switch RenderThread to a Java daemon thread
Bug: 69962494
Test: device boots, hwui unit tests pass
Change-Id: I9d5f2fccebf845328914c82aa97285cf605a4354
2017-12-01 16:35:06 -08:00
Stan Iliev
01b439475c Disable skia shader cache
Disable skia shader cache, which is causing image rendering
issues.

Test: Ran CNN app and images are OK.
Bug: 69264347
Change-Id: Ie81f3398074f28ac1670333f1fd3c95267b2beb3
2017-11-14 13:42:42 -05:00
John Reck
47f5c3a234 Fix leak of FILE* in dumping
Avoid fdopen as fclose, which frees the FILE*, will close
the FD which we don't want. Just normalize on dprintf instead,
and we can add buffering if it turns out to matter at some point

Test: ran 'dumpsys gfxinfo framestats' in a loop while observing PSS
Change-Id: I7808753641aa1055cfdf570c3e017017f11f1dee
2017-11-13 11:32:39 -08:00
Stan Iliev
d495f43992 Implement SkSL cache
Implement SkSL cache by reusing code and logic from egl_cache_t.

Test: Improves startup times for gmail by 15ms and 10ms for calc app.
Bug: 66740665
Change-Id: I9ba479c649ba97a2c29a48d40579ba001264c957
2017-11-08 18:55:41 +00: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
6b894d7746 Release VectorDrawable cache surface on render thread
Release VectorDrawable cache surface on render thread.
This is fixing an assert in skia GrSingleOwner.h:33.

Test: Ran gmail before and after the change.
Bug: 64842607
Change-Id: I46e0c2557ac5b2fc3be2cc2d35abf96f6d6c9399
2017-08-25 10:25:11 -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
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
Stan Iliev
7bc3bc6028 Implement HW Bitmap for Skia pipeline
Implement HW Bitmap for Skia pipeline. Use new Skia
SkImage::MakeFromAHardwareBuffer API, which will enable to
record HW Bitmap into a picture. Move logic that uploads
SkBitmap into a GraphicBuffer into pipeline specific classes.

Test: All CTS and other tests pass for HWUI pipleine. For Skia
pipeline graphics CTS tests pass, 2 UIRendering CTS tests which
excise HW bitmaps with color spaces fail, bitmapShaderEglImage
macrobench fails (to be fixed by a CL in Skia), HWUI unit tests
pass, no EGL leaks found.

Change-Id: Id5926d7cccd81af8b55400f44fb524a427543d05
2017-06-02 15:59:42 -04:00
John Reck
59069e00a8 Revert "Fix recent apps in system UI for Skia pipeline"
This reverts commit b33013fb3c.

Reason for revert: Caused a memory leak, b/38330767
Bug: 38136140
Bug: 38330767
Test: manual, verified memory isn't leaking doing the steps in b/38330767

Change-Id: I98b2dfd750be57a15785808e2d5723616e2ce20a
2017-05-17 00:23:44 +00:00
Stan Iliev
b33013fb3c Fix recent apps in system UI for Skia pipeline
Enable HW Bitmaps for Skia pipeline just enough to make
recent apps list working by adding support for BitmapShader.
Drawing HW bitmaps in a canvas is also supported.

Test: recent apps work, HWUI unit tests pass, CTS tests pass.
bug: 38136140
Change-Id: Ibd06c859c86dc213310d5ce5272497e1882d0cc6
2017-05-12 11:28:55 -04:00