summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordnicoara <dnicoara@chromium.org>2015-03-20 15:02:37 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-20 22:03:09 +0000
commitd818104f773a0d49ba316e0aa8ab1629052d8c97 (patch)
tree5abd39997216a6bd6df105a29fa2754eac57342e
parentd317e89dc1ae054c4d5e1672ebde8ed0ad3d8899 (diff)
downloadchromium_src-d818104f773a0d49ba316e0aa8ab1629052d8c97.zip
chromium_src-d818104f773a0d49ba316e0aa8ab1629052d8c97.tar.gz
chromium_src-d818104f773a0d49ba316e0aa8ab1629052d8c97.tar.bz2
[Ozone-Drm] Notify cursor of channel established last
The cursor is special since movements don't need to be routed to the UI thread, instead they are directly dispatched to the GPU process from the IO-thread. During the recovery of a crashed GPU process, the windowing state needs to be re-created on the new GPU. As such we need to make sure that the windows are re-created on the GPU before the cursor can send targeted events (to a specific window). BUG=468485 Review URL: https://codereview.chromium.org/1024083002 Cr-Commit-Position: refs/heads/master@{#321645}
-rw-r--r--ui/ozone/platform/drm/host/drm_cursor.cc12
-rw-r--r--ui/ozone/platform/drm/host/drm_cursor.h6
-rw-r--r--ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc13
-rw-r--r--ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h6
-rw-r--r--ui/ozone/platform/drm/ozone_platform_drm.cc9
-rw-r--r--ui/ozone/platform/drm/ozone_platform_gbm.cc11
6 files changed, 28 insertions, 29 deletions
diff --git a/ui/ozone/platform/drm/host/drm_cursor.cc b/ui/ozone/platform/drm/host/drm_cursor.cc
index 0cb6329..f58b8c6 100644
--- a/ui/ozone/platform/drm/host/drm_cursor.cc
+++ b/ui/ozone/platform/drm/host/drm_cursor.cc
@@ -10,7 +10,6 @@
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
-#include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
#include "ui/ozone/platform/drm/host/drm_window_host.h"
#include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
@@ -20,18 +19,11 @@
namespace ui {
-DrmCursor::DrmCursor(DrmWindowHostManager* window_manager,
- DrmGpuPlatformSupportHost* gpu_platform_support_host)
- : window_manager_(window_manager),
- gpu_platform_support_host_(gpu_platform_support_host) {
+DrmCursor::DrmCursor(DrmWindowHostManager* window_manager)
+ : window_manager_(window_manager) {
}
DrmCursor::~DrmCursor() {
- gpu_platform_support_host_->UnregisterHandler(this);
-}
-
-void DrmCursor::Init() {
- gpu_platform_support_host_->RegisterHandler(this);
}
void DrmCursor::SetCursor(gfx::AcceleratedWidget window,
diff --git a/ui/ozone/platform/drm/host/drm_cursor.h b/ui/ozone/platform/drm/host/drm_cursor.h
index 8482d07..06d409c 100644
--- a/ui/ozone/platform/drm/host/drm_cursor.h
+++ b/ui/ozone/platform/drm/host/drm_cursor.h
@@ -31,12 +31,9 @@ class DrmWindowHostManager;
class DrmCursor : public CursorDelegateEvdev, public GpuPlatformSupportHost {
public:
- explicit DrmCursor(DrmWindowHostManager* window_manager,
- DrmGpuPlatformSupportHost* sender);
+ explicit DrmCursor(DrmWindowHostManager* window_manager);
~DrmCursor() override;
- void Init();
-
// Change the cursor over the specifed window.
void SetCursor(gfx::AcceleratedWidget window, PlatformCursor platform_cursor);
@@ -90,7 +87,6 @@ class DrmCursor : public CursorDelegateEvdev, public GpuPlatformSupportHost {
void SendLocked(IPC::Message* message);
DrmWindowHostManager* window_manager_; // Not owned.
- DrmGpuPlatformSupportHost* gpu_platform_support_host_; // Not owned.
// Task runner for main thread.
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
diff --git a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
index 3c6f4e8..f375c97 100644
--- a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
+++ b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
@@ -8,10 +8,12 @@
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
#include "ui/ozone/platform/drm/host/channel_observer.h"
+#include "ui/ozone/platform/drm/host/drm_cursor.h"
namespace ui {
-DrmGpuPlatformSupportHost::DrmGpuPlatformSupportHost() : host_id_(-1) {
+DrmGpuPlatformSupportHost::DrmGpuPlatformSupportHost(DrmCursor* cursor)
+ : host_id_(-1), cursor_(cursor) {
}
DrmGpuPlatformSupportHost::~DrmGpuPlatformSupportHost() {
@@ -64,11 +66,20 @@ void DrmGpuPlatformSupportHost::OnChannelEstablished(
FOR_EACH_OBSERVER(ChannelObserver, channel_observers_,
OnChannelEstablished());
+
+ // The cursor is special since it will process input events on the IO thread
+ // and can by-pass the UI thread. This means that we need to special case it
+ // and notify it after all other observers/handlers are notified such that the
+ // (windowing) state on the GPU can be initialized before the cursor is
+ // allowed to IPC messages (which are targeted to a specific window).
+ cursor_->OnChannelEstablished(host_id, send_runner_, send_callback_);
}
void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) {
TRACE_EVENT1("drm", "DrmGpuPlatformSupportHost::OnChannelDestroyed",
"host_id", host_id);
+ cursor_->OnChannelDestroyed(host_id);
+
if (host_id_ == host_id) {
host_id_ = -1;
send_runner_ = nullptr;
diff --git a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h
index bad5b38..25f37da 100644
--- a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h
+++ b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h
@@ -21,11 +21,12 @@ class Point;
namespace ui {
class ChannelObserver;
+class DrmCursor;
class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
public IPC::Sender {
public:
- DrmGpuPlatformSupportHost();
+ DrmGpuPlatformSupportHost(DrmCursor* cursor);
~DrmGpuPlatformSupportHost() override;
void RegisterHandler(GpuPlatformSupportHost* handler);
@@ -55,7 +56,8 @@ class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
scoped_refptr<base::SingleThreadTaskRunner> send_runner_;
base::Callback<void(IPC::Message*)> send_callback_;
- std::vector<GpuPlatformSupportHost*> handlers_;
+ std::vector<GpuPlatformSupportHost*> handlers_; // Not owned.
+ DrmCursor* cursor_; // Not owned.
ObserverList<ChannelObserver> channel_observers_;
};
diff --git a/ui/ozone/platform/drm/ozone_platform_drm.cc b/ui/ozone/platform/drm/ozone_platform_drm.cc
index 98bba6e..09c6d3a 100644
--- a/ui/ozone/platform/drm/ozone_platform_drm.cc
+++ b/ui/ozone/platform/drm/ozone_platform_drm.cc
@@ -103,6 +103,7 @@ class OzonePlatformDrm : public OzonePlatform {
ForceInitializationOfPrimaryDisplay(drm_, screen_manager_.get());
drm_device_manager_.reset(new DrmDeviceManager(drm_));
display_manager_.reset(new DisplayManager());
+ cursor_.reset(new DrmCursor(window_manager_.get()));
surface_factory_ozone_.reset(
new DrmSurfaceFactory(&window_delegate_manager_));
scoped_ptr<DrmGpuDisplayManager> ndd(new DrmGpuDisplayManager(
@@ -111,12 +112,10 @@ class OzonePlatformDrm : public OzonePlatform {
gpu_platform_support_.reset(new DrmGpuPlatformSupport(
drm_device_manager_.get(), &window_delegate_manager_,
screen_manager_.get(), ndd.Pass()));
- gpu_platform_support_host_.reset(new DrmGpuPlatformSupportHost());
+ gpu_platform_support_host_.reset(
+ new DrmGpuPlatformSupportHost(cursor_.get()));
window_manager_.reset(new DrmWindowHostManager());
cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
- cursor_.reset(
- new DrmCursor(window_manager_.get(), gpu_platform_support_host_.get()));
- cursor_->Init();
#if defined(USE_XKBCOMMON)
KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(
new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_)));
@@ -148,8 +147,8 @@ class OzonePlatformDrm : public OzonePlatform {
// Objects in the "Browser" process.
scoped_ptr<DeviceManager> device_manager_;
scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
- scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<DrmCursor> cursor_;
+ scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<DrmWindowHostManager> window_manager_;
scoped_ptr<DisplayManager> display_manager_;
scoped_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_;
diff --git a/ui/ozone/platform/drm/ozone_platform_gbm.cc b/ui/ozone/platform/drm/ozone_platform_gbm.cc
index 370e5b4..a4ad4cf 100644
--- a/ui/ozone/platform/drm/ozone_platform_gbm.cc
+++ b/ui/ozone/platform/drm/ozone_platform_gbm.cc
@@ -154,12 +154,11 @@ class OzonePlatformGbm : public OzonePlatform {
if (!surface_factory_ozone_)
surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
device_manager_ = CreateDeviceManager();
- gpu_platform_support_host_.reset(new DrmGpuPlatformSupportHost());
+ cursor_.reset(new DrmCursor(window_manager_.get()));
+ gpu_platform_support_host_.reset(
+ new DrmGpuPlatformSupportHost(cursor_.get()));
window_manager_.reset(new DrmWindowHostManager());
cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
- cursor_.reset(
- new DrmCursor(window_manager_.get(), gpu_platform_support_host_.get()));
- cursor_->Init();
#if defined(USE_XKBCOMMON)
KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(
new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_)));
@@ -218,13 +217,13 @@ class OzonePlatformGbm : public OzonePlatform {
scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_;
scoped_ptr<DrmWindowManager> window_delegate_manager_;
- // Obejcts in the Browser process.
+ // Objects in the Browser process.
base::FilePath primary_graphics_card_path_;
scoped_ptr<DeviceManager> device_manager_;
scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
+ scoped_ptr<DrmCursor> cursor_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_;
- scoped_ptr<DrmCursor> cursor_;
scoped_ptr<DrmWindowHostManager> window_manager_;
scoped_ptr<DisplayManager> display_manager_;