summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.h
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-07-09Properly protect mFrameMetricsReporterSiarhei Vishniakou
This field actually requires a special lock, mFrameMetricsReporterMutex. But there isn't a GUARDED_BY annotation for it. And even if there was, the compiler feature of -Wthread-safety was not active in this code, so this error would not have been caught. To fix this, enable the compiler annotation and add GUARDED_BY annotation to mFrameMetricsReporter. And finally, use this lock to properly protect this field. Bug: 192330836 Test: atest hwui_unit_tests Change-Id: I76950bfa01bbd7ccdc54c4e8c114430b5aeddf1a
2021-06-28Reparent surface control for Webview overlayHuihong Luo
When the root surface control changes, the parent of the Webview surface control must be changed. Bug: 191900007 Test: switch app, or turn on/off screen Change-Id: Ib7b34133776fd5944afc638bfee471afe6a17349
2021-06-24Fix a crash caused by transactionHuihong Luo
A native transaction passed from webview is sent back to native side, so java side does not manage the life cycle of the transaction. Bug: 191414767 Test: Play a video, switch to another app, wait for 10 seconds Change-Id: I013052c202b445438d6cb6497f5f9a2fc22a2b85
2021-06-18Fix z-order for webview surface controlHuihong Luo
Set the root surface control transparent, and set the z order of the newly created child surface control to -1. A new callback is needed to update root surface control in sync from Java side. Bug: 186750329 Test: use latest APKs from Webview team, play a video, mini toolbar should be visible Change-Id: I0b37ee8f83fd2b41ff4f2856dbadd31ff6170baf
2021-06-15Add logic to clean up resources more frequentlyNader Jawad
Added call to Skia's performDeferredCleanup method to free resources that were not referenced within the last 100 frames or 10 seconds whichever is furthest away Bug: 188450217 Test: manual Change-Id: I3f37e1b5bd01330dbbc2da4a84b1259d56be2768
2021-05-31Ensure reportFrameMetrics not being called on deleted instanceJorim Jaggi
Since onSurfaceStatsAvailable gets called on binder-thread, we need to ensure that instance doesn't get released while onSurfaceStatsAvailable is calling reportFrameMetrics. Test: Boots Bug: 188934435 Change-Id: Iafe582d6fe4087a3c4274ee39a2803abaa363fd2
2021-05-08Ignore blocked-on-sf time for ADPFBo Liu
Subtract out time spent blocked in dequeueBuffer. Also subtract out any time UI spents waiting on render thread while render thread is blocked dequeueBuffer, though this calculation is fairly crude. Test: Checked bouncyball returns reasonable-ish numbers even when HWUI is ahead of surface flinger Bug: 187556381 Change-Id: I368c446d93990ff8b7b645e30509405ba799c79c
2021-04-17Webview overlay supportHuihong Luo
The basic idea is to create a child surface control from the root surface control passed from ViewRootImpl to the render thread. Transactions are sent back to the java layer to get merged. In case of offscreen layers, SurfaceControl must be disabled. This new feature is disabled for Vulkan at the moment, a new CL will be used to enable the support. Bug: 173671170 Test: manual, webview apks Change-Id: I119405d13eca3c59fd3ec78e50dc7739f78411d4
2021-03-05Pass actual present time to ViewRootImplSiarhei Vishniakou
To measure end-to-end touch latency, we need to report the actual present time to ViewRootImpl. ViewRootImpl, in turn, will report this information to InputDispatcher. Finally, InputDispatcher will combine all known information for a specific input event, and will report this data to westworld. In another patch, we will add a new call, 'reportLatencyInfo', to InputPublisher. This call will allow the app to send this latency data to InputDispatcher. Bug: 169866723 Test: printed the input event present times inside ViewRootImpl Change-Id: Ibd3a2cfeb1a340eb15cd2165071df1f8589634af
2021-02-17Add GPU completion to FrameMetrics (1/3)Jorim Jaggi
- Add SurfaceStatsCallback to TransactionCompletedListener - Register a callback in RenderProxy to be called when we have surface stats from SF via the BLAST callback. - Instead of finishing a frame for frame metrics reporting immediately, wait until BLAST callback fires, note GPU completion time and finish frame. - Expose GPU_COMPLETION in FrameMetrics - Modify TOTAL_DURATION to also include GPU_COMPLETION Test: FrameMetricsListenerTest Fixes: 171046219 Change-Id: I16fa1d80cfc4e7a5527c18fec7e885409f17ee4d
2021-02-16Add SurfaceControl to hwuiHuihong Luo
add a method, setSurfaceControl, for java layer to pass surface control to the render thread Bug: 173671170 Test: call setSurfaceControl method in ViewRootImpl.java Change-Id: I886a79c377938f19cf38b9058f2bec64e1439000
2021-02-08Remove render ahead from hwuiAdy Abraham
As HWUI uses vsync id to send buffers to SF, SF applies the right amount of render ahead by latching the buffers at the configured time. Test: launch an app and observe systrace Bug: 178148035 Change-Id: Ifd3e1a2971aad0a085cb35d33e950194046aa634
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-04-09Remove unecessary exported symbols from libhwui.soDerek Sollenberger
Test: compiles and links Bug: 150782769 Change-Id: Ib49c1bf914b6bfaad1fb29371115df7c9eec08d2
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-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-01-30[HWUI] Use ANativeWindow inteception methods in ReliableSurfaceAlec Mouri
Test: boots Test: manually test with opening and scrolling through settings app Change-Id: I8d7a44d3ead0b2350318e1514153e256f97ccca5
2019-11-21Fix for Surface#lockHardwareCanvas lockupsJohn Reck
By avoiding setting a dequeue buffer timeout we avoid hitting a different path in BufferQueue that prevents async behavior from happening. This restores P's behavior in this path. Bug: 143860379 Test: repro app in bug Change-Id: Iffbd9f9e6689a40876ff3aa74c10020e3f09fc6a
2019-10-31Fix wrong surfaceRequiresRedraw checkJohn Reck
We only need to redraw if the size /changed/ not if it was the same. Also fix damageId to not use frameNumber as repeated redraws of the same frame would toggle. Bug: 143711430 Test: systrace Change-Id: I8ac4629c9ff4fd51de33d1be7aa46ccc995ba342
2019-10-21Fix buffer damage for quad-bufferJohn Reck
Test: none Change-Id: I4789d84945e381d67e96ef37554a161dbd0ab16c
2019-08-01Add GPU draw stats to gfxinfo and GraphicsStatsServiceStan Iliev
Test: ran dumpsys with gfxinfo and graphicsstats Change-Id: Id9950de87dc4343c6878baa6a6dd42fbc8aeddef
2019-07-31Merge "Include more precise dependencies"Fedor Kudasov
2019-07-31Remove unused methodFedor Kudasov
Bug: 117921091 Test: all tests should pass Change-Id: I8830e061e30a73e1ea2accda8c9a4268818f5b80
2019-07-31Include more precise dependenciesFedor Kudasov
Bug: 117921091 Test: all tests should pass Change-Id: I3be0eeef413aaf69a3a9e27e0bc7f2841a1f5f95
2019-06-26Remove EGL references from CanvasContext headerFedor Kudasov
Bug: 117921091 Test: all tests should pass Change-Id: Ib8ff068c8dcbc4f9855cc91c4af1d704d66dde7b
2019-04-25Fix some force_dark prop behaviorsJohn Reck
* Make it persist.hwui.force_dark so the dev option survices reboots. * Remove the internal super-override behavior it applied using only the intended ViewRootImpl theme-aware behavior. Fixes: 127350499 Fixes: 130354206 Test: set dev option, verified nothing went dark. Set dark theme, verified non-dark apps were force-darked. Rebooted and verified property still set. Change-Id: I43adcbc25320669510fb03b162c98cbd14612f55
2019-04-18Dynamically adjust renderaheadJohn Reck
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-16Merge "Do not cache AVDs that are off screen" into qt-devLeon Scroggins
2019-04-12Support render-ahead in vulkanJohn Reck
Bug: 127822449 Test: verified render_ahead working with skiavk Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-04-12Do not cache AVDs that are off screenLeon Scroggins III
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-04Add back render-ahead supportJohn Reck
Currently only supported in the EGL path. Vulkan support Coming Soon Bug: 127822449 Test: trace of hwuimacro Change-Id: Iac2b039e11d964aab5b8ca1bdf2a5430b187e2ea
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-03-07Re-enable empty damage drop optimizationJohn Reck
Fixes: 113796161 Test: device seemed to behave correctly? Change-Id: Id43e1eaad29d07c06c1003c0653e5d1ee7084cfe
2019-01-22Add continuous SKP capture test apiJohn Reck
Bug: 122856066 Test: PictureCaptureDemo Change-Id: Iaf3a4bc1c8a2c18c7dff635c5f1cf726b331f8bf
2018-12-06Revert "Revert "Make HWUI's surface Reliable^TM""John Reck
This reverts commit dd08224e4d75689c42bf452d44617f84072649a1. 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-03Revert "Make HWUI's surface Reliable^TM"Bo Hu
This reverts commit 650bd9a7b35139354916d2522b59cc57eb5fddc3. Reason for revert: broken emulator b/120342364 Exempt-From-Owner-Approval: Change-Id: If05d9d87325e1d836375d7dc79ff66ef057d228d
2018-11-28Make HWUI's surface Reliable^TMJohn Reck
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-08Refactors and a potential public API for renderingJohn Reck
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-09-27Wire-up default force-dark based off of isLightThemeJohn Reck
Bug: 102591313 Test: Compared settings in light & dark UI modes with force_dark set to true. Observed that force_dark fixes were not present when UI mode was set to dark, indicating force_dark was appropriately globally-disabled Change-Id: I5882829bb5871829fc8fc9911682f52a6ba5f445
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-09-10Refactor HWUI readback code to be backend independentStan Iliev
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-05-31Attempting to fix the black flickerJohn Reck
Bug: 79231206 Test: Repro steps from bug Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-17Merge "AnimatedImageDrawable: Eliminate unnecessary calls to redraw" into ↵Leon Scroggins III
pi-dev am: a2113aa4ad am: 6353ff5bb5 Change-Id: I5258721b49834aba58e9bf19162e6a4588f68f0f
2018-05-16AnimatedImageDrawable: Eliminate unnecessary calls to redrawLeon Scroggins III
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-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-18Revert "Add support for render-ahead"John Reck
This reverts commit ec100976e0655acaa204c8800dfb83dadae20cc8. Reason for revert: b/77971494 Test: hwuiunit passes Change-Id: I2e7dc719d2df1dd939b275496c0edc38e458c434
2018-04-10Merge "Remove dead code"TreeHugger Robot