summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread
AgeCommit message (Collapse)Author
2022-03-15Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Idfdd94e902f656ac65a2a75dfdd199f6f85ba472
2021-09-22Conditionally cache RenderEffect resultsNader Jawad
Added property to conditionally cache SkImage instances with SkImageFilters applied. Some GL vendor implementations invoke Fence::waitForver without signalling, leading to ANRs throughout the system. Bug: 193145089 Test: manual Change-Id: I3e478b11b66205d96e9499a362f7412a1d6e952d
2021-08-06CanvasContext::draw: flushAndSubmit when not drawingLeon Scroggins III
Bug: 195081399 Test: manual + dumpsys gfxinfo CanvasContext::draw has some conditions under which it will not draw. We still need to flushAndSubmit to free scratch memory if there were texture uploads this frame. Change-Id: I60d230cd36bed310a3155e4f1ca647c99c13c4cd
2021-07-22Switch HWUI to use native performance hint APIBo Liu
Test: None Bug: 194204196 Change-Id: I80dfdb5d56921c465406cc4534e82738c668d46d
2021-07-16Merge "In VuklanManager make sure we have a valid semaphore context before ↵TreeHugger Robot
destroying it." into sc-dev
2021-07-15In VuklanManager make sure we have a valid semaphore context before ↵Greg Daniel
destroying it. If errors occured during finishFrame that caused us to not have a semaphore or possibly destroy the semaphore early we will end up with a null mDestroySemaphoreContext in swapBuffers which we tried to destroy unconditionally. I haven't repro'd the connected bug, but based on the crash stack this seems like the likely cause. Test: manual code inspection and build. Bug: 191950033 Change-Id: I0fbd33edff3552b91b980da9e3b2c45bc52a2dd0
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-07-11Merge "Properly protect mFrameMetricsReporter" into sc-devTreeHugger Robot
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-07-07Reduce number of weakrefs per frameJohn Reck
Disable end-to-end input latency metric to reduce the number of JNI WeakGlobalRef acquires per-frame. Bug: 189738006 Test: Observe trace section no longer appears in calculator Change-Id: I062dad8e7cec93cca5599e51d2b0b1a1b6e39a07
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-28Merge "vsyncId should always be incremental" into sc-devTreeHugger Robot
2021-06-25Merge "Revert "Delete RenderProxy off of the cleaner thread"" into sc-devJohn Reck
2021-06-25Revert "Delete RenderProxy off of the cleaner thread"John Reck
This reverts commit da3559683482a61d93b06bed6f46349f6f01dc63. Bug: b/192050906 If too many RenderProxies are destroyed too quickly, we can end up jamming up the CommonPool preventing RenderThread from making progress if it's waiting on CommonPool tasks. Change-Id: I8c324bc60891440d9b7be67961f8d5f881dc0f03
2021-06-25Merge "Delete RenderProxy off of the cleaner thread" into sc-devRob Carr
2021-06-24Delete RenderProxy off of the cleaner threadJohn Reck
Speculation for the cause of an ANR. HardwareRenderer's cleaner can block on RenderThread, which in turn blocks ART's cleaner thread. This can potentially cause other blockages, but it's also poor behavior to have such a long-running Cleaner anyway. Avoid this by putting cleanup to CommonPool. Bug: 191514384 Test: make, CtsUiRenderingTestCases still passes Change-Id: I8190f7862528c3ac39ce636f6fca229322480968
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-23vsyncId should always be incrementalAdy Abraham
In some conditions of scheduling delays, Choreographer may synthetically advance the indented vsync time. In that case we can't send a vsync id since there is no one that corresponds to that time. Test: TBD Bug: 191840734 Change-Id: I7b2754d5dcb0a3f5fd6cda00a3a2469041116f67
2021-06-18Merge "Fix z-order for webview surface control" into sc-devHuihong Luo
2021-06-18Merge "Remove the extra buffer allocation from hwui" into sc-devTreeHugger Robot
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-15Remove the extra buffer allocation from hwuiAdy Abraham
SurfaceFlinger will set the maxAcquiredBufferCount on the buffer queue to account for the extra buffers needed, depends on the refresh rate and app/sf durations, and there is no needed for any addional buffer allocation is hwui. Test: TBD Bug: 188553729 Change-Id: Ic441a6feb15f6b084d45c9e538b11b7b24e36a0e
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-06-11Merge "Improve picture capture debug path" into sc-devJohn Reck
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-06-09Make sure to close vulkan fd's in error casesGreg Daniel
In one set of the fixed cases we actually were never closing the fd. In the other set we would crash with a fatal error. Now both have been updated to handle the failures and correctly close the fd to make sure it all works. However, I don't think this is the route case of the leaking fds from the bug since I don't believe we are seeing any of the corresponding error messages in the logs. Test: Manual running on phone and watching logs. Bug: 187240173 Change-Id: I18babe91b0ec83ca63199f06d3d02ec10e8aea85
2021-06-08Reset buffer tracking state in VulkanSurface.Greg Daniel
When we fail to create an SkSurface from a dequeued buffer we then call cancelBuffer on that buffer. However, we don't update our tracking to say the buffer is no longer dequeued with and doesn't own the fence any more. I don't think this is the main issue causing the crash in the attached bug because I don't think we're seeing the error in the logs for this chunk of code. However this possibly related issue was found while tracking down our use of the dequeue_fence fd. Test: manual building and running of phone Bug: 187240173 Change-Id: Icb4099eeea5be6aedd5376e07a6e3454f5d1d1e3
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-22Use TraceUtils.h from gui shared library.rnlee
Test: It makes Bug: 183120308 Change-Id: I331262dd2da59817031f0c708f4c102041dcb5e0
2021-05-20Merge "Fix PixelCopy & BQ crop" into sc-devJohn Reck
2021-05-18Fix PixelCopy & BQ cropJohn Reck
Change Surface to return the original crop rect + transform int instead of a matrix in GL's bottom-left origin in 0..1 space. This avoids doing an extreme amount of matrix pulling apart to try and guess at the inputs and map rects around to make it maybe work sometimes along with avoiding the need to convert that matrix into skia's top-left non-unit space. This also opens the door to avoiding the 1 texel crop problem if ASurfaceTexture is similarly adjusted to return the crop+transform instead of a float[16] matrix as we are using a proper srcRect to sample from instead of purely done via matrix manipulation. This CL continues to pass kFast_SrcRectConstraint so we don't actually benefit but it at least COULD. Fixes: 183553027 Test: atest android.view.cts.PixelCopyTest (+new testBufferQueueCrop) Change-Id: I5f638153baed7f67dc43fe9ecb4587f579222b5d
2021-05-17Use SwapBuffersCompleted as frame end timeJorim Jaggi
...in case GPU completes really quickly. Fixes: 181899835 Test: atest FrameMetricsListenerTest --iterations 50 Change-Id: I73b9380f92eb15f94ae4754746ee98c7fbc4e6c7
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-05-14Merge "Fix leakage of ASurfaceTransactionCallback" into sc-devHuihong Luo
2021-05-13Fix some FD lifecycle issuesJohn Reck
Use unique_fd, it's cool Bug: 186919605 Test: make, guessing from a pretty clear error message & documentation Change-Id: Ied546565261708b7e4c2d220dce6d6a89725cc06
2021-05-12More benchmark tweaksJohn Reck
Bug: 187718492 Test: this Change-Id: Ie0cad91e1c7d1a02704fc4b1007ba2c28cb2b3e7
2021-05-12Merge "Macrobenchmark tweaks & gpu memory dumping" into sc-devTreeHugger Robot
2021-05-12Merge "Ignore blocked-on-sf time for ADPF" into sc-devTreeHugger Robot
2021-05-11Macrobenchmark tweaks & gpu memory dumpingJohn Reck
Add support for glob matching Ensure glob matches are alphabetically sorted Add feature to dump GPU memory usage after a test pass Adjust gpu memory dump to be a bit more compact (skip empty outputs) Test: this Bug: 187718492 Change-Id: I6dc80b2d3379d8d10001116e1240727d9914bc10
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-05-07Always use Skia reduceOpsTaskSplittingAdlai Holler
This feature was previously limited to high-end devices, but now that there is a fallback when VRAM is limited, it will be enabled globally. After the feature is rolled out to all major Skia clients, it will be the only way things work. Bug: 183612348 Change-Id: Ia99ec154b498ab9315ec5f5285241fde8136c4ab
2021-05-07Fix leakage of ASurfaceTransactionCallbackHuihong Luo
The callback needs to set to null when thread renderer is destroyed. Bug: 187419942 Bug: 186869429 Test: blaze test --test_strategy=local --test_arg=--device_broker_type=LOCAL_ADB_SERVER //javatests/com/google/android/testing/elizabot/internal/sanity/subscriptionleak:SubscriptionLeakTest_generic_phone_google_31_x86 Change-Id: Ic80c58f102ee5f21830542030021828f6231cc37
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-04-14Merge "Fix a logspam" into sc-devJohn Reck
2021-04-13Fix a logspamJohn Reck
On skiavk the flush to GPU happens sooner than it does on skiagl, which was resulting in false-positive warning logs. Adjust the condition to avoid this, so it should now only log if the GPU fence time is significantly incorrect. Fixes: 180488606 Test: doesn't log on skiavk Change-Id: Ie6546b788663b5d863fb064f55245bead4eb0160
2021-04-13Change hwui jank detection to use deadline & gpu completion (1/2)Jorim Jaggi
- Use GPU finish time as well as actual deadline to determine jank rate. - Use dynamic interval to adjust for 60/90hz switching - Move frame metrics reporting into JankTracker to adjust the deadline communicated to the app when in stuffing scenario. - Adjust double-stuffing detection to be a bit more readable. Test: GraphicsStatsValidationTest.java Test: adb shell dumpsys gfxinfo Test: FrameMetricsListenerTest Test: Log output of FrameMetricsObserver Bug: 169858044 Change-Id: I3a6b8ed163e2cf9cf2b67667110340ebe35f98a1
2021-04-10Integrate HWUI with PerformanceHintManagerBo Liu
PerformanceHintManager.Session is in java, so add JNI and a HintSessionWrapper class in HardwareRenderer. Then pass the two calls as two std::functions into DrawFrameTask. Note Session is created per HardwareRenderer, not global (per RenderThread). Session includes UI thread, render thread, and the thread pool. Desired duration is from the intended start duration to the frame deadline. Add an actual frame start time to compute Add system properties: debug.hwui.use_hint_manager to enable PerformanceHintManager debug.hwui.target_cpu_time_percent to control percentage of frame time to be used for target cpu duration. Test: Manual test that there are no crashes and values make sense. Bug: 158791282 Change-Id: I83f25433c10daa20033803fb7c4ae45eab34f1d3
2021-04-08In CanvasContext check at start of frame if GrContext is abandoned.Greg Daniel
On Vulkan part of the abandoned check also checks for device lost. Following what we currently do in GL, we now crash if we are ever in this state. Test: local build Bug: 183722403 Change-Id: I2a41005fd6892e32a8b23dacbc0170d5542fe072
2021-04-02Merge "libhwui: RenderThread: fix UAF" into sc-devSteven Moreland
2021-04-02libhwui: RenderThread: fix UAFSteven Moreland
Thread::run uses RefBase semantics and may delete the RenderThread out from under the client. Bug: 184196278 Test: no longer crashes when enhanced sp<> checks are enabled Change-Id: I9dc306c14339b7142bae5f801970600d75221eb6