Bug 1763727 [Wayland] Paint to Gtk owned wl_surface in main thread r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D143266
This commit is contained in:
stransky 2022-04-11 12:56:26 +00:00
Родитель 6bf955b1fb
Коммит 3b94e78ae2
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -161,6 +161,23 @@ WindowSurfaceProvider::StartRemoteDrawingInRegion(
void WindowSurfaceProvider::EndRemoteDrawingInRegion( void WindowSurfaceProvider::EndRemoteDrawingInRegion(
gfx::DrawTarget* aDrawTarget, const LayoutDeviceIntRegion& aInvalidRegion) { gfx::DrawTarget* aDrawTarget, const LayoutDeviceIntRegion& aInvalidRegion) {
#if defined(MOZ_WAYLAND)
if (GdkIsWaylandDisplay() && moz_container_wayland_is_commiting_to_parent(
mWidget->GetMozContainer())) {
// If we're drawing directly to wl_surface owned by Gtk we need to use it
// in main thread to sync with Gtk access to it.
NS_DispatchToMainThread(NS_NewRunnableFunction(
"WindowSurfaceProvider::EndRemoteDrawingInRegion",
[RefPtr{mWidget}, this, aInvalidRegion]() {
MutexAutoLock lock(mMutex);
// Commit to mWindowSurface only when we have a valid one.
if (mWindowSurface && mWindowSurfaceValid) {
mWindowSurface->Commit(aInvalidRegion);
}
}));
return;
}
#endif
MutexAutoLock lock(mMutex); MutexAutoLock lock(mMutex);
// Commit to mWindowSurface only when we have a valid one. // Commit to mWindowSurface only when we have a valid one.
if (mWindowSurface && mWindowSurfaceValid) { if (mWindowSurface && mWindowSurfaceValid) {