aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-wam/chromium/files/add-a-delay-to-agl-ready-event.patch
blob: 20caccbf66fa92e7fcce35038fe46385bf5c6751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From d2d09d3e13a3874961971d343553106a1f3d5ac7 Mon Sep 17 00:00:00 2001
From: Roger Zanoni <rzanoni@igalia.com>
Date: Thu, 3 Jun 2021 10:53:40 +0200
Subject: [PATCH] Add a delay to agl ready event

Delay ready() to ensure that all the window and surfaces setup
is done before notifying the compositor
---
 .../ozone/platform/wayland/host/wayland_window.cc  | 14 +++++++++++++-
 .../ozone/platform/wayland/host/wayland_window.h   |  5 +++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/ui/ozone/platform/wayland/host/wayland_window.cc b/src/ui/ozone/platform/wayland/host/wayland_window.cc
index d2a9b0dae5..27749fd70d 100644
--- a/src/ui/ozone/platform/wayland/host/wayland_window.cc
+++ b/src/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -299,7 +299,19 @@ WaylandWindow::SetAglReady(void)
   if (!connection_->agl_shell_manager) {
       return;
   }
-  connection_->agl_shell_manager->ready();
+
+  // Delay activation to ensure that all the setup is done
+  // TODO(rzanoni): find a more deterministic way of doing this
+  set_ready_timer_.Start(FROM_HERE,
+                         base::TimeDelta::FromMilliseconds(500),
+                         this,
+                         &WaylandWindow::SetReadyCallback);
+}
+
+
+void WaylandWindow::SetReadyCallback() {
+    connection_->agl_shell_manager->ready();
+    connection_->ScheduleFlush();
 }
 
 bool WaylandWindow::CanDispatchEvent(const PlatformEvent& event) {
diff --git a/src/ui/ozone/platform/wayland/host/wayland_window.h b/src/ui/ozone/platform/wayland/host/wayland_window.h
index 2acac98ae9..c10db38d21 100644
--- a/src/ui/ozone/platform/wayland/host/wayland_window.h
+++ b/src/ui/ozone/platform/wayland/host/wayland_window.h
@@ -15,6 +15,7 @@
 #include "base/containers/flat_set.h"
 #include "base/gtest_prod_util.h"
 #include "base/memory/ref_counted.h"
+#include "base/timer/timer.h"
 #include "ui/events/platform/platform_event_dispatcher.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/native_widget_types.h"
@@ -232,6 +233,8 @@ class WaylandWindow : public PlatformWindow, public PlatformEventDispatcher {
   // Returns a root parent window.
   WaylandWindow* GetRootParentWindow();
 
+  void SetReadyCallback();
+
   // Install a surface listener and start getting wl_output enter/leave events.
   void AddSurfaceListener();
 
@@ -311,6 +314,8 @@ class WaylandWindow : public PlatformWindow, public PlatformEventDispatcher {
   // The type of the current WaylandWindow object.
   ui::PlatformWindowType type_ = ui::PlatformWindowType::kWindow;
 
+  base::OneShotTimer set_ready_timer_;
+
   DISALLOW_COPY_AND_ASSIGN(WaylandWindow);
 };
 
-- 
2.32.0