This feature is intended for use in headless test environments,
where disabling drawing has minimal compatibility impact and can
save significant resource usage when running UI tests.
This feature is controlled via a new system property
'debug.hwui.drawing_enabled', and a HardwareRenderer API that can
override the property value on a per-process basis.
Bug: 201691826
Test: boot emulator
Merged-In: I93c21e680382e03342f235dbf58bd7a5c8a6f767
Change-Id: I391c841e3a0cdcfcc6c7910a316a4dd5e970547d
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
- 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
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
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