Commit Graph

45 Commits

Author SHA1 Message Date
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
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
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
Greg Daniel
eaf310e1ce Update Vulkan skia creation to use apiVersion instead of instanceVersion
This updates to use Skia's new api which takes the vulkan apiVersion
instead of the instance version. This is technically more correct since
the application apiVersion is really the only client modifiable version
value in vulkan.

This change also updates the webview structs to use the apiVersion as
well.

Test: manual build and testing.
Change-Id: I6ce7c20949eb7242f7bbe69955b54c0785696891
2019-01-29 15:03:10 -05:00
Brian Osman
e0cf597556 Remove use of SkColorSpace::Gamut enum
Get the gamut matrix from the color space, compare against sRGB/P3.

Test: Refactoring CL.
Change-Id: I9f5bcae8c1f637919ee9da892266ea882f16208c
2019-01-24 16:05:05 +00:00
Greg Daniel
c407678982 Add support for preTransform in Vulkan swapchain.
Test: manual building and running of apps.
Bug: 110985606
Bug: 122662274
Change-Id: Id53aa1ce028b448b1f12558eec78a60e09512166
2019-01-18 18:56:44 +00:00
Bo Liu
7b8c1eb302 VkFunctorDrawable implementation
Bug: 115613038
Test: Turning on vulkan with appropriate webview apk does not crash and
sort of works.
Change-Id: If1504da7a35e4bd74a994ab2c2a351e6bc415a18
2019-01-15 15:25:04 -08:00
Peiyong Lin
3bff135503 [HWUI] Remove hardcoding around wide color gamut.
Previously we hardcode wide color gamut in HWUI as scRGB color space with FP16
pixel format. However, the hardware composer doesn't support this combination.
This patch plumbs wide color gamut composition preference from composer API to
HWUI such that HWUI can now pick the combination of color space and pixel
format for the surface.

BUG: 111436479
Test: Build, flash and boot, verify with a demo app.
Change-Id: I7a8b4d8deca72ef40069dba9d23a3f5e90dbfe5a
2018-12-15 09:35:25 -08:00
Stan Iliev
bc46258527 Fix temporary stretching when Surface is resized with Vulkan
Set NATIVE_WINDOW_SCALING_MODE_FREEZE scaling mode on the surface
after Vulkan swapchain is created. This is the scaling mode used
by GL as well. Window resize flow depends on preserving this
behavior, because SurfaceComposerClient::Transaction::setSize
calls are not postponed until a new buffer is enqueued.

Test: StatusBar is resized correctly without any glitch.
Bug: 118501234
Change-Id: Icfb6805bc362a742e14b993a0b825e5447d6eeb4
2018-12-10 21:54:58 +00:00
TreeHugger Robot
163e42ca59 Merge "Prefer using 3 buffers in vulkan swapchain." 2018-12-05 02:44:32 +00:00
Greg Daniel
4d5bf2a0f5 Prefer using 3 buffers in vulkan swapchain.
Test: manual build and running.
Bug: 119687951

Change-Id: I799955d8e035d01acb991417e95e424848fe711f
2018-12-04 19:50:38 +00:00
Stan Iliev
987a80c0ca Set color space on Vulkan render target surface
Test: Pass UiRendering tests with Vulkan pipeline
Bug: 116117654
Bug: 111436479
Change-Id: Id58a8a93c6f311402273b1a9e3606c9732f55aec
2018-12-04 11:23:21 -05:00
Greg Daniel
050361732a In VulkanManager enable ycbcr feature on VkDevice.
Test: manual build and test

Change-Id: I820670ee7566e1dd5c86cfa473725b91e4eb6154
2018-11-29 16:42:52 -05:00
Stan Iliev
305e13a293 Handle ANativeWindow resize with Vulkan swapchain
Recreate VulkanSurface, if ANativeWindow has been resized. This
new code is hit when wallpaper is resized from 64x64 to real size.

Bug: 119111018
Test: Wallpaper is shawn correctly with Vulkan rendering
Change-Id: I5e43310e5ee8597a7f326d51b1773e2cf68b603a
2018-11-13 18:44:34 +00:00
Stan Iliev
7a08127e88 Remove SyncFeatures usage from VulkanManager
SyncFeatures is implemented by quering available EGL extensions.
For Vulkan we assume these features are present. SyncFeatures
is crashing for Vulkan, because EGL is not initialized.

Test: TextureViewCameraTest#testTextureViewActivity is passing
Bug: 116117654
Change-Id: I57e6ce1c0f00c1b073d0a2ab2695d9fbecfd2b33
2018-10-26 21:58:50 +00:00
Greg Daniel
8a2a754d15 Cleanup of barriers used in swapching aquiring and presenting.
Test: manual building and running on pixel 2

Change-Id: I72cc95ad7d11634e8d0627737d699a611e8d1d5f
2018-10-04 13:48:05 -04:00
Greg Daniel
962596257c Minor clean up/fixes of VulkanManager api version checks.
Test: manual build and run

Change-Id: I04b0ed0b6c344cc8aac662b1a2a277d1aea0cd2c
2018-10-02 10:47:19 -04:00
Stan Iliev
79351f3912 Add support for wide gamut render targets in Vulkan
Support rendering into FP16 render targets.
Enforce correct color space for both ARGB and F16
color formats.

Test: About 30 additional CTS tests pass with Vulkan
Bug: 116117654
Change-Id: I61941a2d79a0e69837d20816c90d3e936fd7acb0
2018-09-26 11:32:36 -04:00
Greg Daniel
26e0dca4a0 Implemenet fenceWait and createReleaseFence in VulkanManager.
Test: Manual building and testing on walleye device.
Change-Id: I9f5fa259d6457805b546d2b6b11ce4b0800621eb
2018-09-24 11:35:53 -04: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
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
Greg Daniel
a227dbb322 Update VulkanManager to use new skia Vulkan context api.
Test: manual build and run on phone.
Change-Id: Ib21f4091cf11de5655323337e86a35cb7b845b15
2018-08-20 13:23:41 -04:00
Greg Daniel
4aa5867051 No longer create a GrVkInterface in the VulkanManger.
Test: manual

Change-Id: I5debded1f42cab60bacd3b9b9d2f10ada088c86a
2018-07-13 14:04:55 -04:00
Greg Daniel
2ff20271a4 Manually create and manage vulkan instance and device.
Previously we were using a helper in Skia but that is being deleted
and we must manage it ourselves in android.

Test: manual building and running.
Change-Id: Ia3455507d7b07a4a2f29fd5453408dd37d9d570b
2018-06-21 15:07:41 -04:00
Greg Daniel
1834a8cf04 Update to use new skia getBackendRenderTarget calls.
Test: manual building and running.
Change-Id: I0c38f4b9817c8e855ecc8f08cb2b297c5fbfc01a
2018-04-12 12:22:43 -04:00
Greg Daniel
85e0907947 Update skia api for querying maxRenderTargetSize
Test: manual building and testing

Change-Id: I9a97de98d73f25f1c22d275c057c692f5dd3b5dc
2018-04-09 14:27:42 -04:00
Greg Daniel
c9da8e8b4b Convert Skia calls to use SkColorType/BackendFormats instead of GrPixelConfig.
Test: manual testing

Change-Id: I645bcea55f49292309cf0bb5de21891bb5b62dda
2018-03-21 18:09:59 +00:00
Greg Daniel
c9a8945477 Update call to null out GrVkAlloc in VulkanManager
Test: manual testing

Change-Id: Ia0af7526cad2dc4614afc73c31bf07e25890c677
2018-02-23 13:16:59 -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
Greg Daniel
74ea201548 Initialize pointer members in VulkanManager to null
Test: manual local testing

Change-Id: If81db17858354844b96677137cf67449dd91854b
2017-11-10 11:34:22 -05: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
Greg Daniel
ac2d232f21 Update to use GrBackendTexture/RT instead of Descriptors
Test: manual testing

Change-Id: Ide727a39e2c49f226c8d432608e0072214249451
2017-07-12 11:48:00 -04:00
Greg Daniel
53a354365b Use new GrVkBackendContext::Create api
Test: manual testing

Change-Id: Ia8daebd2e028082a8b3d58f29057648746398735
2017-04-25 13:44:51 -04:00
Greg Daniel
4f70887d34 Have Skia Vulkan backend support wait-for-gpu flag on tests
So trying to mimic what the EglManager does in the fence call.
Technically there are two logical queues I could wait on for the device,
the graphics queue and the present queue. Waiting on the device waits
for both these queues to finish. It wasn't obvious to me if the EGL was
waiting for just graphics work or both queues, so I went for both (by
waiting on device). However, so far every device we've seen in Vulkan
has the present and graphics queue combined on the physical device so
waiting for one or both should really be different.

Test: Manual ran macrobench in skiavk and more realistic values compared
to not waiting for gpu.

Change-Id: I17cde70c677a9ad1b6bf9bc9ca4fd5f8f3b807e3
2017-02-03 10:28:52 -05:00
Ben Wagner
eec27d51d2 Use FatVector instead of SkAutoMalloc in VulkanManager.
Skia is looking to make SkAutoMalloc private and will be moving it.
Using FatVector instead will make this code both less dependent on Skia
internals and more performant.

Test: refactoring CL. Existing unit tests still pass.

Change-Id: If9de10059775b75e1ab89078eacede2e20e91299
2017-01-12 11:52:31 -05:00
Greg Daniel
45ec62ba72 Add support for dummy draws for Vulkan webview and texture views.
Test: manual testing
Change-Id: Iaec8c3a34367673c281665ff6c6e97d1ce532265
2017-01-10 15:54:14 -05:00
Greg Daniel
cd55852fcd Make buffer age work in Vulkan
Test: manual testing in skiavk mode

Change-Id: I5b9d8af7d9cecf2f022ef104ec33a5b7477e9e0c
2016-12-09 15:45:15 +00:00
Derek Sollenberger
0e3cba3146 Handle vulkan windowing directly in SkiaVulkanPipeline
Test: manual testing in skiavk mode
Change-Id: I2fab80bae2787bfdacbc70d0402e98450e59406d
2016-11-09 11:58:36 -05:00