| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 9e3cd0533fa4dbca75d65750f9ffcd9817779c3c
and commit 74c760394aacd5a57ba0acade8cb8151ba14678c.
Initially we made a change to address a performance issue
in SurfaceView caused by holding the mSurfaceLock whenever
we went though the updateSurfaces loop. This had a side
effects of causing an ANR since the locking order changed.
The followup fix removed the lock but broke some API
contracts around lock and unlock canvas.
Subsequent fixes, which never went into QPR, introduced
new issues. Changing the locking order is too risky
QPR so lets revert and try to rework the locking
mechanism in U.
Test: app in b/234006724 does not ANR
Test: app in b/235188096 does not crash
Test: app in b/239895124 does not ANR
Test: app in b/239142077 does not crash
Test: atest SurfaceViewTest
Bug: 235188096
Change-Id: I99c5bb707ecad7c8d3c1fbd8b4105a77d58c145d
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
VRI is not currently waiting for SV to draw since SV may start its draw
before VRI opened the SyncSet. If that happens, VRI will not include SV
in its SyncSet and report draw finished even if SV is not complete.
This fix has SV create its own SyncSet when redrawNeeded. Then if VRI
creates a sync, SV will merge its own SyncSet into that one. If SV
already finished drawing, then nothing will get merged, but it means SV
is ready already. If SV is not finished, VRI will now also wait for SV's
draw to finish before calling finishDraw.
Test: Long delay in surfaceRedrawNeededAsync
Test: SurfaceSyncerTest
Bug: 230998394
Change-Id: I44331b8f54951e6dc633a4845bbf690abde0f95e
|
| |
|
|
|
|
|
|
|
|
| |
Surface already has a lock on the native object so it's safe to call
destroy without holding additional locks. This also fixes ANR issues
where an app is still attempting to render when the window is destroyed.
Test: App from bug doesn't ANR
Bug: 234006724
Change-Id: I0d323c03f299e5857d1950870498f3182d019924
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Native machinery now reports queue stalls from native layer
up to java layer, which can more appropriately handle errors.
The first case we handle is the case of "stuck fences", generally
indicating GPU hangs. In this case we trigger a bespoke ANR rather
than waiting for an ANR in dequeueBuffers later. dequeueBuffers
ANR could have any number of causes, and this large cluster
is difficult to debug.
Bug: 216160569
Test: Existing tests pass
Change-Id: I7b4429ce96d0bbfa1b74534ddf2b447facb22d10
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
mSurfaceLock is used to ensure the Surface object stays valid over
the span of the calls to lockCanvas and unlockCanvasAndPost which could
come from any thread. In API Level 29 and below, updateSurface was
split in to two paths, a first path (which would acquire mSurfaceLock)
for when the Surface could be destroyed, and second path for geometry
updates only. The consolidation of these two paths in updateSurface
created an overlocking of mSurfaceLock, which is now acquired even
when mSurface won't be modified. In fact it's acquired whenever the
geometry changes. This means an application rendering thread which
creates delays between lock and unlock canvas could create undesirable
and needless delays on the main UI thread, if the SurfaceView geometry
updates. We also have some underlocking, where we aren't actually
locking when destroying the SurfaceView.
Test: Manual with test app
Bug: 206846658
Change-Id: Idc17d111eee7a7365af4e94a156e7c46c7ea8171
|
| |\ \
| |/
|/| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The window matrix of the embedded window is not updated if the second
host SurfaceView doesn't have any offset. To esnure the window matrix
is up-to-date, we force to update the matrix when the embedded hierarchy
is initialized.
Bug: 229178859
Test: atest InlineFilteringTest#testFiltering_filtersByPrefix
atest android.accessibilityservice.cts
Change-Id: Ib23af520fcbaa1788e3ef22a1086b90a0801375c
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we destroy and recreate a SurfaceView in the same frame its
possible for positionChanged for the new surface to arrive
before positionLost for the old surface. In this case we
won't clear mRtLastReportedPosition, and so we won't set
any position at all on the new surface.
Bug: 229052731
Test: Existing tests pass
Change-Id: I896496afa5b05848f96b20697d33911cae9639a7
|
| |\ \
| |/
|/|
| | |
into tm-dev
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
VRI can initiate syncs, but they can also happen from other places when
using SurfaceSyncer. When VRI initiates the sync, sometimes the buffer
needs to be synced. Other times, we just want to know the buffer has
drawn, but don't actually need to sync the buffer.
When a sync is initiated from outside VRI, using SurfaceSyncer, we
always want to sync the buffer. This change ensures that if the sync was
started from an outside request, it will set mSyncBuffer to true.
An additional part to clarify the sync logic, renamed mLastSyncId to
mSyncId and renamed isInSync to isInLocalSync to clarify that the
mSyncId only represents VRI initiated syncs.
Test: Internet Dialog syncs buffer
Fixes: 229098223
Change-Id: I99e9e6341a487d59c33a33a61e442be7909518c2
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The attachInfo from ViewRootImpl is not reliable
for DisplayArea manipulation or windowless window.
To fix this problem, we use the transform matrix of
InputWindowHandle, which could transform the bounds
from window coorindate to screen coordinate. We also
transfrom the bounds to logical display coordinates
with the associated display matrix.
Besides, we also record the magnification spec of the window,
which could get the bounds before magnification. We use
this value to decide the property 'visibleToUser'.
Bug: 200797785
Test: atest android.accessibilityservice.cts WindowInfoTest
atest com.android.server.accessibility
Change-Id: I0917b04fe8b027fb2bd932a6f0604ba1449ebc66
|
| |
|
|
|
|
|
|
|
| |
The current code is a bit confuisng to read so cleaned up the code that
handles syncing a buffer when a VRI relayout request creates a sync.
Test: YT, Camera, Chrome
Bug: 200284684
Change-Id: I243ee5ebcb59c478c48461544813cab43a2678d4
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Instead of using the count to keep track of sync information in VRI, use
the SurfaceSyncer to handle this. This also means changing SV since SV
would also increment the VRI counter. This cleans up the logic since
code that's used for the SurfaceSyncer can be re-used in VRI.
Test: seamless rotation, launching apps
Bug: 200284684
Fixes: 225776224
Change-Id: Idb505b35eef9f99b2f76e9d1f1b26f5c50ed9a90
|
| |
|
|
|
|
|
|
| |
This reverts commit f37c024b0049b9cc849c8216fd64c7a7d471fae3.
Reason for revert: Google Camera App has black preview
Change-Id: Ib691cc8f9a80412756855e5dd7bcc2a12f842ce9
|
| |
|
|
|
|
|
|
|
|
|
| |
Instead of using the count to keep track of sync information in VRI, use
the SurfaceSyncer to handle this. This also means changing SV since SV
would also increment the VRI counter. This cleans up the logic since
code that's used for the SurfaceSyncer can be re-used in VRI.
Test: seamless rotation, launching apps
Bug: 200284684
Change-Id: Ia3c1a13b42ceba29a75425295e41e543a00436a3
|
| |\
| |
| |
| | |
logic." into tm-dev
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Modified SurfaceView and ViewRootImpl to provide callbacks when syncing
a transaction instead of sending transactions. This will ensure a clear
ownership of the transaction object since it will be provided in the
callback when BBQ adds a buffer into the transaction. Modified JNI to
add compatibility for native functions.
Test: Manual testing from go/wm-smoke.
Test: BLASTBufferQueueTest
Bug: 210714235.
Change-Id: I1f872d6b2846b0d64d5b33b8866d0b2ec7126c8c
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Re landing with the following changes:
We initially cloned the SurfaceControl handle to avoid locking when
accessing the SurfaceControl from the position listener callbacks
running from RT workers. But this meant the last reference to the
layer handle would only be released by GC. If SurfaceViews are
created and destroyed rapidly, we would be at the mercy of GC to
release buffers.
Original change:
There are three transaction queues that can submit SurfaceView
changes.
1. Buffer updates via BBQ apply token
2. SCC apply token
3. ViewRootImpl BBQ apply token
It makes sense for most SurfaceView changes to be synchronized with
ViewRootImpl draws since the caller can optionally synchronize the
change with main window content.
This change eliminates the tmp transaction that is applied directly
via the SCC apply token and instead applies them with the ViewRootImpl
draw transaction.
Also take the opportunity to scope down mSurfaceControlLock usage.
Test: atest SurfaceViewSyncTest
Test: go/wm-smoke
Test: run mem tests via forrest
Bug: b/217973491, b/221631942
Change-Id: Idba712d146e62d7346920dc4f060cba92d47fada
|
| |\
| |
| |
| | |
into tm-dev
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Revert "SurfaceView: Avoid destination frame updates on multipl..."
Revert submission 16944940-sv-changes-tm-dev
Reason for revert: b/221631942
Reverted Changes:
I0d214e3f7:SurfaceView: Avoid destination frame updates on m...
I0b5741b37:SurfaceView: Synchronize all surface view changes ...
I5226c304b:SurfaceView: Avoid destination frame updates on mu...
Change-Id: I35b7c1be7202ebe89a5309284a9401c8084e9d79
|
| |\ \
| |/
|/| |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add Syncer class that allows callers to add desired syncs into a set and
wait for them to all complete before getting a callback. The purpose of
the Syncer is to be an accounting mechanism so each sync implementation
doesn't need to handle it themselves. The Syncer class is used the
following way.
1. SurfaceSyncer#setupSync is called
2. addToSync is called for every SyncTarget object that wants to be
included in the sync. If the addSync is called for a View or
SurfaceView it needs to be called on the UI thread. When addToSync is
called, it's guaranteed that any UI updates that were requested before
addToSync but after the last frame drew, will be included in the sync.
3. SurfaceSyncer#markSyncReady should be called when all the SyncTargets
have been added to the SyncSet. Now the SyncSet is closed and no more
SyncTargets can be added to it.
4. When all SyncTargets are complete, the final merged Transaction will
either be applied or sent back to the caller.
The following is what happens within the SyncSet
1. Each SyncableTarget will get an onReadyToSync callback that contains
a SyncBufferCallback.
2. Each SyncableTarget needs to invoke SyncBufferCallback#onBufferReady.
This makes sure the SyncSet knows when the SyncTarget is complete,
allowing the SyncSet to get the Transaction that contains the buffer.
3. When the final FrameCallback finishes for the SyncSet, the
syncRequestComplete Consumer will be invoked with the transaction
that contains all information requested in the sync. This could include
buffers and geometry changes. The buffer update will include the UI
changes that were requested for the View.
Test: SurfaceSyncerTest
Test: SurfaceSyncerContinuousTest
Bug: 200284684
Change-Id: Iab87bff8a0483581e57803724eae88f0a3d96c8e
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are three transaction queues that can submit SurfaceView
changes.
1. Buffer updates via BBQ apply token
2. SCC apply token
3. ViewRootImpl BBQ apply token
It makes sense for most SurfaceView changes to be synchronized with
ViewRootImpl draws since the caller can optionally synchronize the
change with main window content.
This change eliminates the tmp transaction that is applied directly
via the SCC apply token and instead applies them with the ViewRootImpl
draw transaction.
Also take the opportunity to scope down mSurfaceControlLock usage.
Test: atest SurfaceViewSyncTest
Test: go/wm-smoke
Bug: 217973491
Change-Id: I0b5741b376e042537c37ec34644e0a048eb4bfe0
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The caller such as SurfaceView can optionally apply destination
frame changes if they wish to synchronize buffer scale with other
scales in the hierarchy. This is hard to synchronize if the buffer
scale changes, since in fixed scaling mode we want the destination
frame to be applied when a buffer of the new size is queued.
This approach is brittle because SurfaceView does not have control
over the buffer production and the app can get into a scenario
where there is scaled incorrectly.
Fix this by configuring BBQ to always apply destination frame
changes or always defer to the caller. If the scaling mode is freeze,
then BBQ will set a flag to ignore the destination frame. This
allows us to synchronize destination frame changes with scale
applied by a parent and avoid unwanted scaling if the scaling
mode changes to freeze.
Test: atest SurfaceViewTest
Test: go/wm-smoke
Bug: 217973491
Change-Id: I5226c304bae9dde890306f8528dfeabf6b015a32
|
| |
|
|
|
|
|
|
|
| |
Replace existing synchronization logic with calls to
ViewRootImpl#applyTransactionOnDraw. There is no functional change.
Test: presubmit
Bug: 217973491
Change-Id: I3b1416c2889d2c3b5c3833ffab4e28a9e0eb5d76
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no need to reparent the SurfacePackage to null, if the
SurfaceView is destroyed it will naturally die, if it's not it will
persist which actually may be the intended behavior if we are
in some sort of exiting state. More so, it creates possible confusion
around releasing one SurfaceView while reparenting the SurfacePackage
to another.
Bug: 196926363
Bug: 217973491
Test: SurfaceViewSurfacePackageValidatorTest#testSurfacePackageNoFlicker
Change-Id: I4f93c4a6928f6b47371d0a264f1fc99c4e82819f
|
| |
|
|
|
|
|
|
|
|
| |
Apply the SurfacePackage reparent transactions with the next
ViewRootImpl draw so the caller can optionally synchronize attaching
SurfacePackages with contents on the main window.
Test: atest CtsWindowManagerDeviceTestCases:SurfaceControlViewHostTests
Bug: 217973491
Change-Id: I87f77cb6a5a2505592f6e9431d2964517fe497cd
|
| |
|
|
|
|
|
|
|
| |
BufferStateLayer is the now the default interface to SurfaceFlinger
and BufferQueueLayer code path is obsolete and non-functional.
Test: presubmit
Bug: 217973491
Change-Id: I0d083230f3a27d4b0380a1d958fdc5c1b6c3aa51
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There is a flicker in wallpaper picker due to a recent change where
SurfaceView creation changes were synchronized with VRI frame. This
breaks wallpaper picker because wallpaper picker doesn't actually
draw into the SV surface, instead they attach a surface package.
The current implementation meant the SurfacePackage would be visible
before it was scaled correctly.
This fix applies the visibility changes along with the scaling changes.
Test: steps in b/211945947
Fixes: 211945947
Change-Id: I4e5107ac2caf634429e1bec3201fdcaa8f5f92bc
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PositionUpdateListener callbacks maybe replaced before they
are applied. We need to merge with the existing transaction
so we don't drop any destination frame updates. But accessing
the previous callback transaction is unsafe since we might fight
with render thread.
Fix this by locking access to the transaction object.
This also fixes a potential SurfaceControl access issue where
we may release the SurfaceControl that is used by render thread
in the UI thread.
Fixes: 211090247
Test: atest SurfaceViewSyncTest
Change-Id: I28ed344754601169c6cefd919668e76ef5a467c3
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes a case where the SurfaceView is stuck with a wrong
scale.
Destination frame scales the buffer to the SurfaceView
fixed size. Currently the initial destination frame is
applied when the first buffer is acquired by BBQ. The
transaction is sent via the BBQ apply token.
Meanwhile if the client updates the SurfaceView fixed
size, the SurfaceView will apply the transaction via
the SCC apply token.
This can cause destframe changes to be applied out of
order causing the app to be stuck with the wrong
scale.
Bug: 195443440
Test: atest BLASTBufferQueueTest
Test: repro steps from bug
Change-Id: Ibf53a0efdebb87291d081e48633c373a98d347b1
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the main window gets a configuration change, the new buffer for the
SV will get applied in the same transaction as the main window. This
will allow apps to implement seamless rotation without a frame or more
of black where the SV was resized, but the buffer was not yet updated.
This also includes an optimization where if only SV change occurs, but
there was no request from WMS to report drawing, VRI can apply the
transaction immediately without reporting to WMS.
Test: SV with seamless rotation enabled
Bug: 200284684
Change-Id: I5569d815eef92acf3bf9d7f753bd5ab94a332cfe
|
| |\
| |
| |
| |
| |
| |
| |
| | |
41d736717e am: 47dd5b7ba1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16192255
Change-Id: I14dfbc7a4a106909dd085e380df4caea719d2f16
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When SV is detached, we will try to clean up the SurfaceControls.
However, we want the clean up to be synced with the main app window.
This is to ensure we don't remove SV's SC before the
app window draws in the hole punched area.
Instead of relying on postionLost to synchronize with the main app
window, we can use applyTransactionOnDraw to ensure the next frame will
merge the remove transaction. Therefore, we no longer have to call
remove in positionLost since it's already handled elsewhere.
Test: No flicker when removing SV
Bug: 199860472
Change-Id: I93a91c45c862949e53ee9fd1b4a3b10404fba6bb
|
| |\|
| |
| |
| |
| |
| |
| |
| | |
transform hint" into sc-v2-dev am: fb19c89e4d am: dd8c200bd2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16040767
Change-Id: If7b74fa458c0a2ee14b876a2b3b8fe393fcc85cb
|
| | |\
| | |
| | |
| | | |
transform hint" into sc-v2-dev
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
transform hint
Fixes: 202797234
Test: atest VulkanPreTransformTest#testVulkanPreTransformNotSetToMatchCurrentTransform
Change-Id: Iddb2e0b045096b4b86c0bc3f8222b61de67994bc
|
| | |\ \
| | |/
| |/|
| | | |
sc-v2-dev
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Use applyTransactionOnDraw to ensure all transaction happen
during the same frame, including
- hide the starting window.
- reparent the remote SurfaceView to client.
Bug: 198593932
Test: continues launch test app several times then verify with winscope
to ensure there is no flicker anymore.
Merged-In: I03c600afdc477ca0c8064b215f2b361468db9f3c
Change-Id: I03c600afdc477ca0c8064b215f2b361468db9f3c
|
| |\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
constants" into sc-v2-dev am: 492bdf0074 am: 030cee8122
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15937682
Change-Id: Ib479110b56925fc373eeee1a2398fd9ad2e46fb7
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
NDK exposes ANativeWindowTransform/NATIVE_WINDOW_TRANSFORM_*. These
constants are aligned with HAL definitions and are used internally to
specify buffer transforms. Native consumers of the transform hint
are expected to generate ANativeWindowTransform from the hint.
Aligning the SDK and the NDK transform values will make the API
less confusing.
Bug: 196167822
Test: atest AttachedSurfaceControlTest
Change-Id: Ib20be045f6c8c6d7befef93a839a27098da55ffa
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Hold the surface control lock in PositionUpdateListener
callbacks before checking if the SurfaceControl will
be null. UI tread might release it after the checks
causing crashes.
Also fix a case where the ViewRootImpl may be null
in the positionChanged callback.
Bug: 199261027
Test: run steps in bug
Test: go/wm-smoke
Change-Id: I5a4cac35fe14356389b29268fddf9703b25c03aa
(cherry picked from commit 2cafd8b44d0b4c13b16fdcd2557352ec5496fcc3)
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use applyTransactionOnDraw to ensure all transaction happen
during the same frame, including
- hide the starting window.
- reparent the remote SurfaceView to client.
Bug: 198593932
Test: continues launch test app several times then verify with winscope
to ensure there is no flicker anymore.
Change-Id: I03c600afdc477ca0c8064b215f2b361468db9f3c
|
| |\ \ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Hold the surface control lock in PositionUpdateListener
callbacks before checking if the SurfaceControl will
be null. UI tread might release it after the checks
causing crashes.
Also fix a case where the ViewRootImpl may be null
in the positionChanged callback.
Bug: 199261027
Test: run steps in bug
Test: go/wm-smoke
Change-Id: I5a4cac35fe14356389b29268fddf9703b25c03aa
|
| |\ \ \
| | |/
| |/|
| | |
| | |
| | |
| | |
| | | |
Surface#destroy" into sc-v2-dev am: 8047839069 am: 28bcedef70
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15720362
Change-Id: Ic9d63f73755f79e96c13c8983920b8184f77a29f
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Surface#destroy
SurfaceView clients may hold on to surface references. In S this means
they would extend the lifetime of the SurfaceControl resulting in
"leaking" buffers until the references are cleared or the app is
terminated.
Fix this by calling a new destroy function on Surface which will
explicitly remove references to the SurfaceControl and BBQ it holds.
This is safe because SurfaceView controls the lifecycle of the Surface
and knows when the Surface will become invalid. Once invalid, the Surface
cannot become valid again.
Test: repro steps in bug
Bug: 198133921
Change-Id: I5c7e43736f025fc0965eae2f19719ba40df3cb70
|
| | |\ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
into sc-dev am: 5d7ae9063a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15462690
Change-Id: If91aa26d1fbfe17f7dd4c2e5e417c58ba03c0874
|