summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/SkiaPipeline.cpp
AgeCommit message (Collapse)Author
2021-07-14Always submit after texture uploadsJohn Reck
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-06-30Make sure we check for valid GrContext when pinning images.Greg Daniel
Test: manual building and running. Bug: 187540936 Change-Id: Ie900d80128646c8ca2d4fce41d436019e3cf9c71
2021-06-11Improve picture capture debug pathJohn Reck
* 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-05-22Use TraceUtils.h from gui shared library.rnlee
Test: It makes Bug: 183120308 Change-Id: I331262dd2da59817031f0c708f4c102041dcb5e0
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-29Modernize calls to drawImageMike Reed
1. drawBitmap --> drawImage 2. drawImage now always requires sampling parameter Bug:178700363 Test: make Change-Id: I96f610a180b3774ba955cc334949fd62b1cf4d69
2021-01-25Use onEndPage callback in hwui skp recordingNathaniel Nifong
Test: so far none, need to find an app that uses AHardwareBuffer via hwui Change-Id: Ia8c2fa32bff9762a8ed0e66f9961650dbd2e19d5
2021-01-14Convert DisplayList to a value-type wrapperJohn Reck
Make DisplayList its own type instead of an alias, pushing the Skia aspect behind it mostly. Removes a bunch of manual memory management and opens the door to DisplayList being a union type with multiple implementations Test: builds (somehow), boots, hwuiunit passes, CtsUiRendering passes Change-Id: I1d7806aa3afc5d9ece08b06959920078a5814c59
2020-09-18Migrate from SkCanvas::getGrContext to SkCanvas::recordingContextAdlai Holler
This is part of API cleanup as we make DDL usage more mainstream in Skia. Since Android doesn't use DDLs, the cast from recordingContext to directContext will always succeed and there's no functional change. Change-Id: Ie585cf6c97d01fecf082f146d5692999371fd39d
2020-07-30Wire-up colorMode="hdr"John Reck
Fow now it uses a fixed white point of 150nits TBD if this is disabled or adjusted Test: Demo app Change-Id: Iac13597b3d7633fdef3feaf7ec1da0c27c87904c
2020-05-14Update skia flush call APIs.Greg Daniel
Test: manual Change-Id: I72fa57b04f1b4ea594063ddb4ce6af9507b1fcdb
2020-04-07Don't reset the capture mode after each frame when using the CallbackAPIDerek Sollenberger
When multiframe skp support was introduced it set the capture mode to none for everything but the multiframe use case. This was incorrect in the case of the CallbackAPI where we want to continue to capture frames. Bug: 152084866 Test: hwui_unit_tests Change-Id: I7e3caf41a3725d03252df1ab7bedfe1b69a238c2
2020-02-15Merge "[HWUI] Remove references to gui/Surface."TreeHugger Robot
2020-02-14[HWUI] Remove references to gui/Surface.Alec Mouri
ANativeWindow usage now has enough feature parity so that we can use that instead. Bug: 137012798 Test: builds Test: Scroll through settings Change-Id: I0054315058b28bcb5e779a6f71a3cfb164625a5f
2020-02-14Use updated factory for SkOverdrawColorFilterMike Reed
Test: make Change-Id: Ibf67a37e90152326b3088d2f15f17a6ad261658c
2020-02-06Ensure SkiaPipeline always has a valid colorspace.Derek Sollenberger
Previously we didn't assign a colorspace to the pipeline until it was provided a surface to render into. This resulted in undefined behavior if the application attempted to render an offscreen layer before the OS provided the main window with its surface. Now instead of deferring setting whether or not the application is wide gamut we do initialize it to a default setting when the pipeline is created. Bug: 148042673 Test: apct/device_boot_health_check_extra_postsubmit Change-Id: I84d743511e949ac977486470bb14eec936de7f88
2020-02-04Merge "Provide a typeface proc during SKP serialization that forces ↵Nathaniel Nifong
typefaces to be written."
2020-01-30Provide a typeface proc during SKP serialization that forces typefaces to be ↵Nathaniel Nifong
written. Test: flashed to Pixel 3, confirmed system typeface is written, normal drawing unaffected. Change-Id: I0016224f628b4e564670cc05b982460ff001b6ac
2020-01-17Do not clip draw commands during recording of SKP filesNathaniel Nifong
Test: Confirmed drawing is unaffected on pixel 3, confirmed all commands are recorded. Change-Id: Ib543730c321f5082d9a2331241873f9b2e8289c8 Bug: skia:9758
2020-01-09[MSKP] Record android device clip restriction (dirty region) with each frame.Nathaniel Nifong
Test: Confirm recording and normal rendering unaffected on pixel 3 Change-Id: I368a24371317aba26e234649194ae1b05ab0396d
2019-12-11When saving MSKP files, record layers as SkPictures with annotations.Nathaniel Nifong
No change when saving single frame SKP files. Layer redraws (full or partial) that occur at the beginning of frames are recorded as SkPictures written as the first commands in the frame, each preceded by an annotation recording the node id of the layer drawn to, and the dirty area of the draw. When rendered layers are used, the drawImageRect command is preceded by an annotation that provides the node id of the relevant layer. the skia debugger or skpbench could then use this information to play back the animation's layers. Test: tested by capturing both multi and single frame files on apps that use and do not use layers. normal rendering isn't affected, and capturing works as intended. Change-Id: Ic8f6947ebcc168334b6b740b3d63fc1788509b54
2019-11-11Remove unused argument 'layers' from renderFrameImpl and renderOverdrawNathaniel Nifong
Test: Flashed Pixel 3 and viewed home screen. Change-Id: I2cd38e33cdc13c25c270c355702e8c4c842b105a
2019-10-04Delete VectorDrawableAtlasJohn Reck
Poking around in a few apps it doesn't appear that the VectorDrawableAtlas is achieving sufficient utilization to justify its existence. The potential for draw call merging doesn't seem warranted for the RAM cost of the atlas. Bug: 137853925 Test: builds Change-Id: Id2419bc6dccb6316636d50c568f8fac75a2d563f
2019-09-19Check for null surface pointer in renderOverdrawNathaniel Nifong
Bug: 141160420 Test: built Change-Id: I5d6d4fc11f95f27ab6aa31377d3b94e71f14dca4
2019-09-06Switch to using GrContext::setResourceCacheLimit and getResourceCacheLimitRobert Phillips
The old version that took a maxResourceCount are now deprecated Test: does it compile Change-Id: Ib4d69c8907169329c7765c648f46fa5e4a10bf7a
2019-07-12Resolve drawable when playing back DisplayListData in the RenderThread.Nathaniel Nifong
Drawables are mutable, and not expected to produce the same content if retained for longer than the duration of the frame. This becomes relevant when recording multi-frame SKPs because the serialization step forces drawables to be played back long after the frame completed. By resolving the drawable when we are drawing the frame we avoid ref'ing the SkDrawable and do not extend its lifetime beyond the frame. Bug: skia:9234 Test: Captured SKPs on a Pixel 3 Change-Id: I5d317dd14e20be9d5e18675df8667327bd05aff0
2019-07-03Introduce multi-frame SKP capturing in SkiaPipelineNathaniel Nifong
Capture script usage is the same as before, but all frames are combined into a single file which shares the images between frames, reducing the file size and serialization time somewhat. This brings us closer to the objective of realistic performance measurements, but to do that correctly, a second format is needed, (skbug.com/9174) Single frame captures still produce the same format. Test: The method used for serialization is tested in skia's DM unit tests, in MultiSkpTest.cpp Test: Tested manually with the libs/hwui/tests/scripts/skp-capture.sh script Bug: skbug.com/9210 Change-Id: I69da8d191640ebb444991f107d60389f1519a9db
2019-06-19Split lighting out of SkiaPipelineFedor Kudasov
ReorderBarierDrawables includes SkiaPipeline just for the sake of lighting, however SkiaPipeline brings much more unnecessary dependencies. Splitting lighting our of SkiaPipeline should make dependency resolution simpler. Bug: 117921091 Test: all tests should pass Change-Id: I6adf7c43555cfa3ff7090a1197fc11160d3a85ec
2019-05-28Use libbase API to access system properties in libhwuiJerome Gaillard
Calls to licutils properties API are replaced by calls to libbase properties API. This will make it easier to make a host target for libhwui as libbase provides a host implementation for its properties API. Bug: 117921091 Test: N/A Change-Id: I15b4fe1a16d2bc7b271387d8cf3403940b8aae2d
2019-05-23Fix light center position for layersStan Iliev
SkiaLayer::inverseTransformInWindow should be the inverse matrix of Layer transform. This CL fixes a bug, that matrix value was not inverted. This matrix is used in one place: to transform light center coordinates from device to RenderNode/layer coordinate space. Bug: 132758858 Test: Ran test app attached to bug. Manually compared coordinates. Change-Id: Id8e887276a5296091a8264d7a0b1bcc955620a6a (cherry picked from commit 36b75f79611b9ed6f49dc0ec8d93f1cc945368ac)
2019-04-12Support render-ahead in vulkanJohn Reck
Bug: 127822449 Test: verified render_ahead working with skiavk Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-03-18Remove old TaskManager systemJohn Reck
Replace it with a newer, fancier, WorkQueue-inspired one that's just a global common thread pool. Test: hwuiunit passes Change-Id: Ib5d03104a08bbac9a4ec67a1bfc0db2b35d6700f
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-22Add continuous SKP capture test apiJohn Reck
Bug: 122856066 Test: PictureCaptureDemo Change-Id: Iaf3a4bc1c8a2c18c7dff635c5f1cf726b331f8bf
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-14Standardize the surface origin for each HWUI pipeline.Derek Sollenberger
OpenGL prefers a bottom-left origin while Vulkan prefers the top-left. Prior to this change we were inconsistent in Vulkan by creating layers with a bottom-left origin which was different from the primary buffer. Test: CtsUiRenderingTestCases Change-Id: Icfeed4085021cae941aeab58720406e3b3e37923
2018-12-18Merge "New WebViewFunctor API"John Reck
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-14New WebViewFunctor APIJohn Reck
Should function alongside existing functor API. Bug: 120997728 Test: hwuiunit passes Change-Id: I8f6143d0be1111431b55016f34de319f6b8c8910
2018-11-07Set the color space to sRGB on the Surface and remove colorFilter.Derek Sollenberger
Also for a canvas wrapping a bitmap the colorspace of the bitmap will be used to correctly blend content. Test: CtsUiRenderingTestCases Bug: 111436479 Change-Id: I63ad7a30605a7f725cc0ef4716d42ea978fb03e3
2018-09-20Refactor RenderState and remove unused functionality.Derek Sollenberger
Test: hwui_unit_tests still pass Change-Id: Ie943671535ab8c5da1bac05985e815e0cb842dc1
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-05-03Delete a bunch of codeJohn Reck
This removes the duality of DisplayList, removing a small amount of overhead Test: buids & hwuiunit passes Change-Id: I8bb3a20e9ead1caec4b4a8a3e9f2c08f717a7096
2018-04-30Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositingDerek Sollenberger
This CL extracts the android_dataspace from the GLConsumer and converts it to a SkColorSpace. HWUI always expects to composite into an sRGB destination so when we draw the layer we run the draw through a colorFilter that converts the input colorSpace into that of the destination. Test: CtsViewTestCases Bug: 78016220 Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
2018-04-12Unpin bitmaps but don't purge all scratch resources.Derek Sollenberger
This is a partial revert of b1f27aae89a9da9fbf3cb15a47f1a401db5a7974. Test: hwui_unit_tests Bug: 77654081 Change-Id: I5a58c156a280edfe3e9973ac3a8a30c97a2cff8b
2018-03-28Better error reporting for createOrUpdateLayerStan Iliev
Pass error handler down to the pipeline object, which allows skia pipelines to print cache memory usage. In case of an error, print arguments that were used to invoke SkSurface::MakeRenderTarget. Test: Ran android build on a device Bug: 76115654 Change-Id: I5baddfa66debd505eddc3117cf94aa6ae69bedaa
2018-03-23Clear the frame buffer for F16 pixel formatStan Iliev
This is a workaround for Qualcomm bug and should be reverted after a proper fixed is found. Bug: 74976293 Test: Ran Photo app Change-Id: I9e0a4634f02c3553635f058eb588b510a63273ba
2018-01-29Use a separate thread to decode AnimatedImageDrawableLeon Scroggins III
Bug: 63908092 Test: Manual: Ie18811ba29a1db163aca08472b04ae185e9344f0 Depends on https://skia-review.googlesource.com/#/c/skia/+/101544. That change removes the Skia class's time checks, and leaving it up to the client to keep track of the time. In this case, the client wants to keep track of the time because it only wants to update while it is being drawn. If it goes off screen (for example), it will just resume where it left off when it returns on screen. This allows for smooth animations. If an AnimatedImageDrawable is being drawn to a SkiaRecordingCanvas, decode on the new (lazily-created) AnimatedImageThread. When running, always decode one frame ahead on the AnimatedImageThread so that it will be ready when it is time to display. During prepareTree, update the time and check whether there is a new frame ready to draw or the next frame needs to be decoded. In either case, return true. The next frame to be decoded will be triggered by onDraw. Change-Id: If447976e9df417060a950f658dbca9cf7980dd02
2018-01-24Initial implmentation of AnimatedImageDrawables on the RenderThread.Derek Sollenberger
The current implementation schedules the next frame of the images to be decoded after the current frame completes but potentially schedules tasks that will result in a no-op execution if a new frame is not yet needed. Test: HwAccelerationTest Change-Id: I0510cb5a1b801abd651327e924deb586af0306d6
2017-12-13SkPixelSerialize is deprecated (and unneeded in this case)Mike Reed
Test: make Change-Id: Icc421586de82a516cb5e32b60949315d1108a9a3