summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/VulkanManager.h
AgeCommit message (Collapse)Author
2021-05-14Add a mutex to VulkanManager::initialize.Greg Daniel
The initialize call can be made from both an GrallocUploadThread and the RenderThread. So we need a mutex to make sure both threads don't try to initialize in parallel. Bug: 187218890 Test: manual running of device, guessing this could fix bug. Change-Id: I203afd91fad5eacc131c839dff1a1065864b76f8
2021-03-09Use VK_ANDROID_frame_boundary in HWUIHugues Evrard
This extension paves the way to profiling HWUI apps with AGI. Bug: 181645761 Test: manual Change-Id: I03ee66832a9013016dc91904962ce54809b198e6
2021-03-01Remove flushAndSubit from SkiaPipeline renderFrame.Greg Daniel
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-01-13Turn on vk unit testsAlec Mouri
* Degrade error when changing the rendering backend from Properties to no longer be fatal. * Support using a single graphics queue for the Vulkan backend. Cloud devices only support a single queue and some Vulkan implementations such as Swiftshader expose only one queue for simplying their implementation, so we'll need to support one. Bug: 175618060 Bug: 162628999 Test: hwui_unit_tests Test: experiment on Pixel 4 enforcing a single queue (settings app, maps, sysui) Change-Id: I495fcabc3c89bd62bbb833998eab4944c6660f6f
2020-09-03HWUI: remove the redundant present queueYiwei Zhang
This change also fixed that the graphics queue should be the one to wait on upon surface destruction. Bug: 162628999 Bug: 167693610 Test: no new regressions in CtsUiRenderingTestCases with Vulkan backend Change-Id: I919748b85b2194bb4f13e1af6950d6493a17921d
2020-08-20Remove VulkanManager::mCommandPoolLeon Scroggins III
Test: make This is unused. Splitting out from I0289938333e2c3dafcc2ce18e72dca3acf4d5b79. Change-Id: I33eaaa2db86c5d8e3c98c63ba0f6f938e8456cc3
2020-08-17Share Vulkan resources between RenderThread and HardwareBitmapUploaderDerek Sollenberger
The VkInstance and VkDevice are constructs that can be shared between threads and avoid the extra driver allocations associated with them. This CL also fixes a bug where Vulkan uploads were occuring on the thread that invoked the upload and not occuring on the upload thread. Bug: b/162628999 Test: atest CtsUiRenderingTestCases Change-Id: I0289938333e2c3dafcc2ce18e72dca3acf4d5b79
2020-07-28Migrate from GrContext to GrDirectContextAdlai Holler
This is part of an effort to distinguish between different types of contexts in GPU Skia. When using a DeferredDisplayList (DDL) recorder, the context you get is not a direct context and cannot be used for operations like uploading or reading textures. Since Android does not use DDLs, it is not directly affected by this change but other APIs, such as SkImage::MakeFromTexture are being migrated to require a GrDirectContext to increase sanity. Change-Id: I9afbdf3c026a9f9cb6ad2aad904915e189e584d6
2019-11-08Decouple SurfaceTexture from HWUIStan Iliev
Remove all Skia and HWUI types from SurfaceTexture implementation. Move SurfaceTexture to libgui (ag/9578265). Define private C++ API for SurfaceTexture, which is consumed by DeferredLayerUpdater. Move AutoBackendTextureRelease/Skia code from SurfaceTexture to HWUI. Test: pass CtsUiRenderingTestCases and CtsViewTestCases Bug: 136263580 Change-Id: I3f971bb490f64a3ac0b2a66a89ba935bf7f08213
2019-07-29Isolate the graphics classes into their own static libDerek Sollenberger
Update additional headers to include-what-you-use to resolve compiler errors related to moving include paths. Test: CtsUiRenderingTestCases Change-Id: I230408a53610ad1926f9e46d5aff66f52fec4a3a
2019-06-26HWUI-VK: Decouple hwui Vulkan backend from Vulkan WSI APIsYiwei Zhang
1. Android support all transforms as exposed by client composition. 2. Properly exposing min/max image size is tracked in http://b/134182502. 3. Current image size and max buffer count are cached in Surface already. 4. Remove surface support check since hwui does not have YUV + CPU consumer. 5. Since HWUI must require those image usage flags, just use them directly, and those are always supported by Vulkan driver and enforced by cts. Bug: 136110987 Test: CtsUiRenderingTestCases and CtsGraphicsTestCases Change-Id: I89bd9afb69a46e3deca09890ce6348c6b61edddf
2019-05-14Merge "Remove workaround in VulkanSurface for missing vendor flag." into qt-devGreg Daniel
2019-05-14Remove workaround in VulkanSurface for missing vendor flag.Greg Daniel
Test: manual building and testing Bug: b/128923272 Change-Id: I6be67fddbbf06d4eb7efe316f7e6fd12157e2852
2019-04-23Fix deletion of VkSemaphores in VulkanManager.Greg Daniel
We were deleting the VkSemaphore objects too quickly when importing/exporting the semaphores. Even though the semaphore payload gets reset on these operations the VkSemaphore still needs to be finished its use in Vulkan before being deleted. Test: manual build and testing of vulkan apps and vulakn ImageConsumer Bug: b/130643604 Change-Id: I7f03087e477d812c0174ede3a10f12dc1df72ee1
2019-04-12Support render-ahead in vulkanJohn Reck
Bug: 127822449 Test: verified render_ahead working with skiavk Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-04-02Add workaround for qualcomm vulkan AHDARDWAREBUFFER_USAGE_VENDER_0Greg Daniel
Test: manual building and testing on device. Bugs related to lack of flag go away. Bug: 128923272 Change-Id: I2457988c097d73020162947c346a8716d373185e
2019-03-29Invalidate Skia shader cache if Vulkan driver has changedStan Iliev
Test: Ran apps several time and observed shader cache validation Change-Id: I7c2620b9a0eefcb7acedc86647ecf44805518b2f
2019-03-12Merge "Copy extension names to an owning container to prevent use-after-free"TreeHugger Robot
2019-03-11Copy extension names to an owning container to prevent use-after-freeRoman Kiryanov
Bug: 127660235 Test: make -j Change-Id: I3748b7b4b51f99acf59748675223cef02c22bee2 Signed-off-by: Roman Kiryanov <rkir@google.com>
2019-03-08Directly manage buffer presentation in Vulkan using AHardwareBuffers.Derek Sollenberger
Instead of relying on Vulkan swapchains this CL enables HWUI to directly manage the native window. This allows us to preallocate buffers using our own strategy as well as having no longer having to jump through an unecessary translation layer that resulted in code that was hard to reason about and also introduced inefficiencies. Bug: 123541940 Bug: 119687951 Test: CtsUiRenderingTestCases and CtsGraphicsTestCases Change-Id: I7e5930748795e7ca4a998ab2c608c3c9b6363037
2019-02-20Start RenderThread earlier to preload Vulkan/EGL driversStan Iliev
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-13Decouple VulkanManager from RenderThreadStan Iliev
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-04Fix crash when VulkanSurface is no longer validStan Iliev
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-01-29Update Vulkan skia creation to use apiVersion instead of instanceVersionGreg Daniel
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-24Remove use of SkColorSpace::Gamut enumBrian Osman
Get the gamut matrix from the color space, compare against sRGB/P3. Test: Refactoring CL. Change-Id: I9f5bcae8c1f637919ee9da892266ea882f16208c
2019-01-18Add support for preTransform in Vulkan swapchain.Greg Daniel
Test: manual building and running of apps. Bug: 110985606 Bug: 122662274 Change-Id: Id53aa1ce028b448b1f12558eec78a60e09512166
2019-01-15VkFunctorDrawable implementationBo Liu
Bug: 115613038 Test: Turning on vulkan with appropriate webview apk does not crash and sort of works. Change-Id: If1504da7a35e4bd74a994ab2c2a351e6bc415a18
2018-12-20Merge "Fix/suppress renderthread google-explicit-constructor warnings" am: ↵Chih-Hung Hsieh
138aae8eaf am: 2e2028aee4 am: 4e628bc772 Change-Id: I543de7a1c0e3429ca11addd60ae8300d8aedda29
2018-12-20Fix/suppress renderthread google-explicit-constructor warningsChih-Hung Hsieh
* Add explicit to conversion constructors/operators * Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters Bug: 28341362 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor Change-Id: Ib7d634bf1e0e9a1dda35b0a1d92de4d460193296
2018-12-15[HWUI] Remove hardcoding around wide color gamut.Peiyong Lin
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-04Set color space on Vulkan render target surfaceStan Iliev
Test: Pass UiRendering tests with Vulkan pipeline Bug: 116117654 Bug: 111436479 Change-Id: Id58a8a93c6f311402273b1a9e3606c9732f55aec
2018-11-13Handle ANativeWindow resize with Vulkan swapchainStan Iliev
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-10-02Minor clean up/fixes of VulkanManager api version checks.Greg Daniel
Test: manual build and run Change-Id: I04b0ed0b6c344cc8aac662b1a2a277d1aea0cd2c
2018-09-28Merge "Partially revert "[HWUI] Implement legacy color mode.""TreeHugger Robot
2018-09-27Partially revert "[HWUI] Implement legacy color mode."Peiyong Lin
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-26Add support for wide gamut render targets in VulkanStan Iliev
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-24Implemenet fenceWait and createReleaseFence in VulkanManager.Greg Daniel
Test: Manual building and testing on walleye device. Change-Id: I9f5fa259d6457805b546d2b6b11ce4b0800621eb
2018-09-13[HWUI] Implement legacy color mode.Peiyong Lin
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-05Reland "TextureView Vulkan support and optimized OpenGL draw"Stan Iliev
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 a683eb3945320f592f58705c3c31b3c044f4bd72. Bug: 113673613 Test: Ran TextureView CTS and lensblur in camera app Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-04Revert "Revert "Revert "TextureView Vulkan support and optimized OpenGL draw"""Stan Iliev
This reverts commit 85f9096b5272c9a39e592e2e97cbbe6cb0e767ab. Reason for revert: lensblur broken. Change-Id: I83ac163159fc537bc15936a0f8597a7512ca9d6e
2018-08-31Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""Stan Iliev
This reverts commit 867c43de0544217d26c3ee18f4d6603bb2ea97ce. 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-30Merge "Revert "TextureView Vulkan support and optimized OpenGL draw""Stan Iliev
2018-08-30Revert "TextureView Vulkan support and optimized OpenGL draw"John Reck
This reverts commit c8e22a653297837da9a80b0ba65f6854c8986c96. Reason for revert: broke camera, b/113555199 Bug: 113555199 Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-29Merge "TextureView Vulkan support and optimized OpenGL draw"TreeHugger Robot
2018-08-29TextureView Vulkan support and optimized OpenGL drawStan Iliev
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-20Update VulkanManager to use new skia Vulkan context api.Greg Daniel
Test: manual build and run on phone. Change-Id: Ib21f4091cf11de5655323337e86a35cb7b845b15
2018-07-24Have the framework setup android defines for including vulkan.hGreg Daniel
We're moving skia to place where it has its own vulkan header and the clients have theirs. So this sets up the VulkanManager to be able to handle including vulkan.h how it wants to. Test: manual building and running Change-Id: I0818d2fc607bf8a265bf6ddf1e2f737d1228131a
2018-06-22Remove unused member in VulkanManager.Greg Daniel
A large part of the previous change was specifically around removing this ref counted data member, and then I just forgot to delete it... Test: manual testing Change-Id: Ie9a7f7495789d45a65900c08a27a9d83ad64617c
2018-06-21Manually create and manage vulkan instance and device.Greg Daniel
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
2017-11-10Initialize pointer members in VulkanManager to nullGreg Daniel
Test: manual local testing Change-Id: If81db17858354844b96677137cf67449dd91854b