summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
AgeCommit message (Collapse)Author
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-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-05-22Use TraceUtils.h from gui shared library.rnlee
Test: It makes Bug: 183120308 Change-Id: I331262dd2da59817031f0c708f4c102041dcb5e0
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-12More benchmark tweaksJohn Reck
Bug: 187718492 Test: this Change-Id: Ie0cad91e1c7d1a02704fc4b1007ba2c28cb2b3e7
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-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-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-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-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
2021-03-25Move reduceOpsTaskSplitting property to Properties.hAdlai Holler
Bug: 183612348 Change-Id: I26ebb6898e88715b9bd5e6f89f934d843efd49c5
2021-03-25Add a system property to control Skia reduceOpsTaskSplittingAdlai Holler
We are testing this flag with a subset of devices in dogfood and need to have this plumbing available. Bug: 183612348 Change-Id: I8041053ff3da94b08cd6793fac3ff282bc73da9a
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-01-06Check if mGrContext exists when requiring a vk context.Alec Mouri
Vulkan context is shared with HardwareBitmapUploader and the RenderThread, meaning if the upload thread runs prior to the render thread then some configuration is skipped such as recording the max texture size and cache setup, which affects benchmark tools. So we need to check whether the GrContext exists in addition to checking if the shared VkManager has been properly intialized. Bug: 175913056 Test: hwuimacro works for benchmarks that upload HW bitmaps prior to benchmark execution. For example: tvapp_norcEglImage Change-Id: I149c294b39f1e88226fc5d8d72c30bc4fb3d8404
2020-10-09pass frame deadline to ChoreographerAdy Abraham
Pass the frame deadline calculated by SF to Choreographer so hwui would be able to improve its stats by knowing if a frame is likely to be late. Bug: 169858174 Test: manual Change-Id: Ib9fd93638b54f08d8dc72fa6b023e2dd7c276dc7
2020-09-16Shared timeline plumbingSteven Thomas
Add plumbing to get shared timeline data from Surface Flinger to HWUI and back. Bug: 162890382 Bug: 162888881 Bug: 162890407 Test: manual using ALOG messages in SF Change-Id: I85c5eb56d2fa933889518854e7b79b1e65e29af3
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-31Merge "Revert "libhwui: avoid creating GPU context in Zygote""TreeHugger Robot
2020-07-31Revert "libhwui: avoid creating GPU context in Zygote"Yiwei Zhang
The original CL is not needed as HardwareRenderer.preload is not in Zygote but at app launch time. Bug: 162242036 Change-Id: I41e46e22cb9730b350feb9f6acb2021264a18a97 Test: atest CtsUiRenderingTestCases all pass on GL backend Test: atest CtsUiRenderingTestCases no regression on VK backend
2020-07-28Merge "libhwui: avoid creating GPU context in Zygote"TreeHugger Robot
2020-07-28libhwui: avoid creating GPU context in ZygoteYiwei Zhang
Creating GPU context besides loading the GPU driver would potentially affect graphics driver updatability. Currently, we always preload graphics drivers in Zygote to speed up app startup time. Upon using updatable driver, we'll unload the current driver and load the uploaded one. Although the symbol table is fully protected by the linkerconfig we setup in Android 10, we still have to make sure the driver has a clean state upon unloading and reloading. At this moment, Vulkan driver unloading has not been supported yet. So if we are going to turn on skia Vulkan backend by default, we should avoid preloading the Vulkan driver until the unloading feature is supported for Vulkan. Bug: 162242036 Bug: 135536511 Test: atest CtsUiRenderingTestCases all pass on GL backend Test: atest CtsUiRenderingTestCases no regression on VK backend Change-Id: I9084586315a7593be2cfe17710620aacce568d36
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
2020-05-01Revert^2 "hwui: remove FatVector"Jagadeesh Pakaravoor
Revert submission 10449863-revert-fatvector Reason for revert: b/149254345 Original change (of introducing FatVector) was reverted as a stop-gap solution to fix the aforementioned bug. The bug was caused by an ABI lock between Surface's definition (that changed with Region) and lib-imsvt prebuilt. Enabling this change now as we have re-compiled the prebuilt with the change enabled. Doing that via a revert of the revert. Reverted Changes: I8ac66acb8:Revert "hwui: remove FatVector" Ib60dbf3ef:Revert "libui: rewrite Region with FatVector" Original changes: I09dc2fddd:hwui: remove FatVector I265c6c831:libui: rewrite Region with FatVector bug: 149254345 Change-Id: I9fb5e8908434abb9a763992e922445a2dc37e865
2020-03-05Revert "hwui: remove FatVector"Tim Murray
Revert "libui: rewrite Region with FatVector" Revert submission 10248126-fatvector-region Reason for revert: b/149254345 Reverted Changes: I09dc2fddd:hwui: remove FatVector I265c6c831:libui: rewrite Region with FatVector also fix wrong license in FatVector.h Test: boots Bug: 149254345 Change-Id: I8ac66acb8b635324051edd41c5d4092c223157ff
2020-02-07hwui: remove FatVectorTim Murray
FatVector now lives in fw/native/libs/ui. Test: builds, boots, works Bug: 149096186 Change-Id: I09dc2fddd2a238ef47d7853b64b0bfbf74d3f71f
2020-01-10Add memory tracing in HWUIStan Iliev
Add ATRACE memory counters to track memory usage at the end of each frame in HWUI. There are 3 catagories: CPU, GPU and Texture memory. There are 3 more counters for memory that can be purged. This CL deletes GpuMemoryTracker class, which implemented similar function for Android O HWUI renderer. Test: Collected systrace with gmail and setting. Test: memory tracing adds ~0.1ms per frame when ATRACE is enabled Bug: 146580770 Change-Id: Icbcc0478bc426dff578e83726fe7c95df171ed93
2019-12-26[HWUI] use AChoreographer in place of DisplayEventReceiver.Alec Mouri
Bug: 136262896 Test: builds, boots Test: scroll through settings app Test: Toggle between 60/90hz and observe systrace Change-Id: I8eef306a968525c55f3863ae688545faa43b23be
2019-10-25[HWUI] Get DeviceInfo through stable ABIAlec Mouri
This also removes the dependency on ui/DeviceInfo other than in test code. Bug: 136263392 Bug: 136263238 Test: builds, boots Change-Id: I6a4687e981359f0e6beb83be8a5501ed7fd16f15
2019-06-14Replace CLOCK_MONOTONIC with SYSTEM_TIME_MONOTONICJerome Gaillard
Using SYSTEM_TIME_MONOTONIC works for Android (where it translates to CLOCK_MONOTONIC) and host targets, while CLOCK_MONOTONIC is not defined on macOS. Bug: 117921091 Test: existing tests should pass Change-Id: I1fad472881830fb0701a320cf37319e083932ad4
2019-06-07Merge "DisplayEventDispatcher: use eConfigChangedDispatch" into qt-r1-dev ↵Ady Abraham
am: 619946fdc4 am: 8c219250c7 Change-Id: I70fd60cd1324ade4f3bc6b88036ec7b9be6d9e01
2019-06-07DisplayEventDispatcher: use eConfigChangedDispatchAdy Abraham
In order to get DISPLAY_EVENT_CONFIG_CHANGED, eConfigChangedDispatch needs to be used when creating DisplayEventDispatcher. Bug: 131688378 Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest Test: trigger config change and observe logcat Change-Id: I0de8037ee5b024b7d9729750f582be919087be41
2019-05-29Delete wrap_gles capabilityJohn Reck
* Error enforcement doesn't work with libhwui anymore * We can just do the real, proper thing for unit tests & microbenchmarks, which is arguably better anyway * hwui doesn't have much opengl code left that was wrapped Fixes: 128629988 Test: hwuiunit, hwuimacro, and hwuimicro all still run Change-Id: If2568ea0745a67f83e1290860d474c1a01870376
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-12Support render-ahead in vulkanJohn Reck
Bug: 127822449 Test: verified render_ahead working with skiavk Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-04-01Merge "Don't load EGL driver always"TreeHugger Robot
2019-04-01Don't load EGL driver alwaysStan Iliev
EGL driver is preloaded only if HWUI renders with GL. Test: Ran several apps, passed CtsGraphics and CtsUiRendering Change-Id: Ib38d6f51a19a2ee3631c7d9c99283286c389e476
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-19Add support for uploading to AHBs using Vulkan.Greg Daniel
Test: manual build and testing on blueline. Change-Id: I240a5f1e3ba34677b03131eba36ffd8783d99041
2019-03-18Merge "Remove old TaskManager system"John Reck
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-15Fix profile gpu bars to use display fpsJohn Reck
Also adds a 'good' bar at 80% threshold and a 'bad' bar at 150% threshold (where triple buffering would start to get iffy) Fixes: 127371028 Test: eyeball'd it Change-Id: I109cd293f87f8cb9c8f1e66d49fb8fb2188b0bec
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-19Fix RenderThread setForLooperJohn Reck
RenderThread doesn't use ThreadBase::threadLoop so it also needs to explicitly Looper::setForLooper Fixes: 124467483 Test: hwuiunit Change-Id: I3703b5d3dbbbaa68e88fc23756dfccacfce863cb
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-06Fix RenderThread and worker thread names used by toolsStan Iliev
Test: collected systrace and RenderThread hwuiTask1/2 shown Change-Id: I1114ff72a7ed8c9dc86a64ebd15ca783d1b2ff08
2019-02-05Merge "Tell JVM to not wait for HWUI worker threads upon shutdown"TreeHugger Robot
2019-02-05Tell JVM to not wait for HWUI worker threads upon shutdownStan Iliev
RenderThread is setup as a daemon thread, which allows JVM to exit without waiting on it. This CL does same setup for HWUI worker threads, which offload work from the RenderThread. This fixes an issue exposed by Vulkan pipeline, which is pushing different loads to the worker threads and causing some java tests to hang on exit. This is not a Vulkan specific issue, because GL also hangs if worker thread is started. Bug: 123374538 Test: Ran DismissDialogsInstrumentation test Change-Id: Ie4ee94737ced975323a0792f57f8426c958e8056
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-10Invoke Vulkan initialize earlierStan Iliev
Invoke VulkanManager::initialize as soon as the RenderThread is started. This reduces time spent in the first call to CanvasContext::setSurface by ~20ms. Test: Ran Hermetic Startup: EmptyActivity BUg: 122659224 Change-Id: Ifa160b0b0bbe43adc82f061fac51082878164804