Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: ui/ozone/platform/drm/host/drm_display_host_manager.cc

Issue 1661783002: Centralize all gbm ozone host IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: additional proof-reading Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" 5 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h"
6 6
7 #include <fcntl.h>
8 #include <stddef.h>
9 #include <xf86drm.h>
10 #include <utility>
11
12 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h"
7 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "base/threading/thread_restrictions.h"
17 #include "base/threading/worker_pool.h"
18 #include "ui/display/types/display_snapshot.h"
19 #include "ui/events/ozone/device/device_event.h"
20 #include "ui/events/ozone/device/device_manager.h"
21 #include "ui/ozone/common/display_util.h"
8 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" 22 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
dnicoara 2016/02/03 14:54:29 nit: Maybe remove this include.
rjkroege 2016/02/04 00:09:40 Done.
23 #include "ui/ozone/platform/drm/common/drm_util.h"
24 #include "ui/ozone/platform/drm/host/drm_device_handle.h"
9 #include "ui/ozone/platform/drm/host/drm_display_host.h" 25 #include "ui/ozone/platform/drm/host/drm_display_host.h"
10 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
11 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" 26 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h"
27 #include "ui/ozone/platform/drm/host/gpu_thread_adapter.h"
12 28
13 namespace ui { 29 namespace ui {
14 30
31 namespace {
32
33 typedef base::Callback<void(const base::FilePath&,
34 const base::FilePath&,
35 scoped_ptr<DrmDeviceHandle>)>
36 OnOpenDeviceReplyCallback;
37
38 const char kDefaultGraphicsCardPattern[] = "/dev/dri/card%d";
39 const char kVgemDevDriCardPath[] = "/dev/dri/";
40 const char kVgemSysCardPath[] = "/sys/bus/platform/devices/vgem/drm/";
41
42 const char* kDisplayActionString[] = {
43 "ADD", "REMOVE", "CHANGE",
44 };
45
46 // Find sysfs device path for the given device path.
47 base::FilePath MapDevPathToSysPath(const base::FilePath& device_path) {
48 // |device_path| looks something like /dev/dri/card0. We take the basename of
49 // that (card0) and append it to /sys/class/drm. /sys/class/drm/card0 is a
50 // symlink that points to something like
51 // /sys/devices/pci0000:00/0000:00:02.0/0000:05:00.0/drm/card0, which exposes
52 // some metadata about the attached device.
53 return base::MakeAbsoluteFilePath(
54 base::FilePath("/sys/class/drm").Append(device_path.BaseName()));
55 }
56
57 void OpenDeviceOnWorkerThread(
58 const base::FilePath& device_path,
59 const scoped_refptr<base::TaskRunner>& reply_runner,
60 const OnOpenDeviceReplyCallback& callback) {
61 base::FilePath sys_path = MapDevPathToSysPath(device_path);
62
63 scoped_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle());
64 handle->Initialize(device_path, sys_path);
65 reply_runner->PostTask(FROM_HERE,
66 base::Bind(callback, device_path, sys_path,
67 base::Passed(std::move(handle))));
68 }
69
70 base::FilePath GetPrimaryDisplayCardPath() {
71 struct drm_mode_card_res res;
72 for (int i = 0; /* end on first card# that does not exist */; i++) {
73 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i);
74
75 if (access(card_path.c_str(), F_OK) != 0)
76 break;
77
78 int fd = open(card_path.c_str(), O_RDWR | O_CLOEXEC);
79 if (fd < 0) {
80 VPLOG(1) << "Failed to open '" << card_path << "'";
81 continue;
82 }
83
84 memset(&res, 0, sizeof(struct drm_mode_card_res));
85 int ret = drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res);
86 close(fd);
87 if (ret == 0 && res.count_crtcs > 0) {
88 return base::FilePath(card_path);
89 }
90
91 VPLOG_IF(1, ret) << "Failed to get DRM resources for '" << card_path << "'";
92 }
93
94 LOG(FATAL) << "Failed to open primary graphics device.";
95 return base::FilePath(); // Not reached.
96 }
97
98 base::FilePath GetVgemCardPath() {
99 base::FileEnumerator file_iter(base::FilePath(kVgemSysCardPath), false,
100 base::FileEnumerator::DIRECTORIES,
101 FILE_PATH_LITERAL("card*"));
102
103 while (!file_iter.Next().empty()) {
104 // Inspect the card%d directories in the directory and extract the filename.
105 std::string vgem_card_path =
106 kVgemDevDriCardPath + file_iter.GetInfo().GetName().BaseName().value();
107 DVLOG(1) << "VGEM card path is " << vgem_card_path;
108 return base::FilePath(vgem_card_path);
109 }
110 DVLOG(1) << "Don't support VGEM";
111 return base::FilePath();
112 }
113
114 class FindDrmDisplayHostById {
115 public:
116 explicit FindDrmDisplayHostById(int64_t display_id)
117 : display_id_(display_id) {}
118
119 bool operator()(const scoped_ptr<DrmDisplayHost>& display) const {
120 return display->snapshot()->display_id() == display_id_;
121 }
122
123 private:
124 int64_t display_id_;
125 };
126
127 } // namespace
128
15 DrmDisplayHostManager::DrmDisplayHostManager( 129 DrmDisplayHostManager::DrmDisplayHostManager(
16 DrmGpuPlatformSupportHost* proxy, 130 GpuThreadAdapter* proxy,
17 DeviceManager* device_manager, 131 DeviceManager* device_manager,
18 InputControllerEvdev* input_controller) 132 InputControllerEvdev* input_controller)
19 : sender_(new HostManagerIPC(proxy, this)), 133 : proxy_(proxy),
20 core_(new DrmDisplayHostManagerCore(sender_.get(), 134 device_manager_(device_manager),
21 device_manager, 135 input_controller_(input_controller),
22 input_controller)) {} 136 primary_graphics_card_path_(GetPrimaryDisplayCardPath()),
137 weak_ptr_factory_(this) {
138 {
139 // First device needs to be treated specially. We need to open this
140 // synchronously since the GPU process will need it to initialize the
141 // graphics state.
142 base::ThreadRestrictions::ScopedAllowIO allow_io;
143
144 base::FilePath primary_graphics_card_path_sysfs =
145 MapDevPathToSysPath(primary_graphics_card_path_);
146
147 primary_drm_device_handle_.reset(new DrmDeviceHandle());
148 if (!primary_drm_device_handle_->Initialize(
149 primary_graphics_card_path_, primary_graphics_card_path_sysfs)) {
150 LOG(FATAL) << "Failed to open primary graphics card";
151 return;
152 }
153 drm_devices_[primary_graphics_card_path_] =
154 primary_graphics_card_path_sysfs;
155
156 vgem_card_path_ = GetVgemCardPath();
157 }
158
159 device_manager_->AddObserver(this);
160 proxy_->RegisterHandlerForDrmDisplayHostManager(this);
161 proxy_->AddGpuThreadObserver(this);
162
163 ScopedVector<HardwareDisplayControllerInfo> display_infos =
164 GetAvailableDisplayControllerInfos(primary_drm_device_handle_->fd());
165 has_dummy_display_ = !display_infos.empty();
166 for (size_t i = 0; i < display_infos.size(); ++i) {
167 displays_.push_back(make_scoped_ptr(new DrmDisplayHost(
168 proxy_, CreateDisplaySnapshotParams(
169 display_infos[i], primary_drm_device_handle_->fd(),
170 primary_drm_device_handle_->sys_path(), 0, gfx::Point()),
171 true /* is_dummy */)));
172 }
173 }
23 174
24 DrmDisplayHostManager::~DrmDisplayHostManager() { 175 DrmDisplayHostManager::~DrmDisplayHostManager() {
176 device_manager_->RemoveObserver(this);
177 proxy_->UnRegisterHandlerForDrmDisplayHostManager();
25 } 178 }
26 179
27 DrmDisplayHost* DrmDisplayHostManager::GetDisplay(int64_t display_id) { 180 DrmDisplayHost* DrmDisplayHostManager::GetDisplay(int64_t display_id) {
28 return core_->GetDisplay(display_id); 181 auto it = std::find_if(displays_.begin(), displays_.end(),
182 FindDrmDisplayHostById(display_id));
183 if (it == displays_.end())
184 return nullptr;
185
186 return it->get();
29 } 187 }
30 188
31 void DrmDisplayHostManager::AddDelegate(DrmNativeDisplayDelegate* delegate) { 189 void DrmDisplayHostManager::AddDelegate(DrmNativeDisplayDelegate* delegate) {
32 core_->AddDelegate(delegate); 190 DCHECK(!delegate_);
191 delegate_ = delegate;
33 } 192 }
34 193
35 void DrmDisplayHostManager::RemoveDelegate(DrmNativeDisplayDelegate* delegate) { 194 void DrmDisplayHostManager::RemoveDelegate(DrmNativeDisplayDelegate* delegate) {
36 core_->RemoveDelegate(delegate); 195 DCHECK_EQ(delegate_, delegate);
196 delegate_ = nullptr;
37 } 197 }
38 198
39 void DrmDisplayHostManager::TakeDisplayControl( 199 void DrmDisplayHostManager::TakeDisplayControl(
40 const DisplayControlCallback& callback) { 200 const DisplayControlCallback& callback) {
41 core_->TakeDisplayControl(callback); 201 if (display_control_change_pending_) {
202 LOG(ERROR) << "TakeDisplayControl called while change already pending";
203 callback.Run(false);
204 return;
205 }
206
207 if (!display_externally_controlled_) {
208 LOG(ERROR) << "TakeDisplayControl called while display already owned";
209 callback.Run(true);
210 return;
211 }
212
213 take_display_control_callback_ = callback;
214 display_control_change_pending_ = true;
215
216 if (!proxy_->GpuTakeDisplayControl())
217 GpuTookDisplayControl(false);
42 } 218 }
43 219
44 void DrmDisplayHostManager::RelinquishDisplayControl( 220 void DrmDisplayHostManager::RelinquishDisplayControl(
45 const DisplayControlCallback& callback) { 221 const DisplayControlCallback& callback) {
46 core_->RelinquishDisplayControl(callback); 222 if (display_control_change_pending_) {
223 LOG(ERROR)
224 << "RelinquishDisplayControl called while change already pending";
225 callback.Run(false);
226 return;
227 }
228
229 if (display_externally_controlled_) {
230 LOG(ERROR) << "RelinquishDisplayControl called while display not owned";
231 callback.Run(true);
232 return;
233 }
234
235 relinquish_display_control_callback_ = callback;
236 display_control_change_pending_ = true;
237
238 if (!proxy_->GpuRelinquishDisplayControl())
239 GpuRelinquishedDisplayControl(false);
47 } 240 }
48 241
49 void DrmDisplayHostManager::UpdateDisplays( 242 void DrmDisplayHostManager::UpdateDisplays(
50 const GetDisplaysCallback& callback) { 243 const GetDisplaysCallback& callback) {
51 core_->UpdateDisplays(callback); 244 get_displays_callback_ = callback;
52 } 245 if (!proxy_->GpuRefreshNativeDisplays()) {
53 246 get_displays_callback_.Reset();
54 void DrmDisplayHostManager::OnChannelEstablished( 247 RunUpdateDisplaysCallback(callback);
55 int host_id, 248 }
56 scoped_refptr<base::SingleThreadTaskRunner> send_runner, 249 }
57 const base::Callback<void(IPC::Message*)>& send_callback) { 250
58 // The GPU thread may be in a different or the same process. 251 void DrmDisplayHostManager::OnDeviceEvent(const DeviceEvent& event) {
59 core_->GpuThreadStarted(); 252 if (event.device_type() != DeviceEvent::DISPLAY)
60 } 253 return;
61 254
62 void DrmDisplayHostManager::OnChannelDestroyed(int host_id) { 255 event_queue_.push(DisplayEvent(event.action_type(), event.path()));
63 } 256 ProcessEvent();
64 257 }
65 bool DrmDisplayHostManager::OnMessageReceived(const IPC::Message& message) { 258
66 bool handled = true; 259 void DrmDisplayHostManager::ProcessEvent() {
67 260 while (!event_queue_.empty() && !task_pending_) {
68 IPC_BEGIN_MESSAGE_MAP(DrmDisplayHostManager, message) 261 DisplayEvent event = event_queue_.front();
69 IPC_MESSAGE_HANDLER(OzoneHostMsg_UpdateNativeDisplays, OnUpdateNativeDisplays) 262 event_queue_.pop();
70 IPC_MESSAGE_HANDLER(OzoneHostMsg_DisplayConfigured, OnDisplayConfigured) 263 VLOG(1) << "Got display event " << kDisplayActionString[event.action_type]
71 IPC_MESSAGE_HANDLER(OzoneHostMsg_HDCPStateReceived, OnHDCPStateReceived) 264 << " for " << event.path.value();
72 IPC_MESSAGE_HANDLER(OzoneHostMsg_HDCPStateUpdated, OnHDCPStateUpdated) 265 switch (event.action_type) {
73 IPC_MESSAGE_HANDLER(OzoneHostMsg_DisplayControlTaken, OnTakeDisplayControl) 266 case DeviceEvent::ADD:
74 IPC_MESSAGE_HANDLER(OzoneHostMsg_DisplayControlRelinquished, 267 if (event.path == vgem_card_path_)
75 OnRelinquishDisplayControl) 268 continue;
76 IPC_MESSAGE_UNHANDLED(handled = false) 269 if (drm_devices_.find(event.path) == drm_devices_.end()) {
77 IPC_END_MESSAGE_MAP() 270 task_pending_ = base::WorkerPool::PostTask(
78 271 FROM_HERE,
79 return handled; 272 base::Bind(&OpenDeviceOnWorkerThread, event.path,
80 } 273 base::ThreadTaskRunnerHandle::Get(),
81 274 base::Bind(&DrmDisplayHostManager::OnAddGraphicsDevice,
82 void DrmDisplayHostManager::OnUpdateNativeDisplays( 275 weak_ptr_factory_.GetWeakPtr())),
276 false /* task_is_slow */);
277 }
278 break;
279 case DeviceEvent::CHANGE:
280 task_pending_ = base::ThreadTaskRunnerHandle::Get()->PostTask(
281 FROM_HERE,
282 base::Bind(&DrmDisplayHostManager::OnUpdateGraphicsDevice,
283 weak_ptr_factory_.GetWeakPtr()));
284 break;
285 case DeviceEvent::REMOVE:
286 DCHECK(event.path != primary_graphics_card_path_)
287 << "Removing primary graphics card";
288 DCHECK(event.path != vgem_card_path_) << "Removing VGEM device";
289 auto it = drm_devices_.find(event.path);
290 if (it != drm_devices_.end()) {
291 task_pending_ = base::ThreadTaskRunnerHandle::Get()->PostTask(
292 FROM_HERE,
293 base::Bind(&DrmDisplayHostManager::OnRemoveGraphicsDevice,
294 weak_ptr_factory_.GetWeakPtr(), it->second));
295 drm_devices_.erase(it);
296 }
297 break;
298 }
299 }
300 }
301
302 void DrmDisplayHostManager::OnAddGraphicsDevice(
303 const base::FilePath& dev_path,
304 const base::FilePath& sys_path,
305 scoped_ptr<DrmDeviceHandle> handle) {
306 if (handle->IsValid()) {
307 drm_devices_[dev_path] = sys_path;
308 proxy_->GpuAddGraphicsDevice(sys_path,
309 base::FileDescriptor(handle->PassFD()));
310 NotifyDisplayDelegate();
311 }
312
313 task_pending_ = false;
314 ProcessEvent();
315 }
316
317 void DrmDisplayHostManager::OnUpdateGraphicsDevice() {
318 NotifyDisplayDelegate();
319 task_pending_ = false;
320 ProcessEvent();
321 }
322
323 void DrmDisplayHostManager::OnRemoveGraphicsDevice(
324 const base::FilePath& sys_path) {
325 proxy_->GpuRemoveGraphicsDevice(sys_path);
326 NotifyDisplayDelegate();
327 task_pending_ = false;
328 ProcessEvent();
329 }
330
331 void DrmDisplayHostManager::OnGpuThreadReady() {
332 // If in the middle of a configuration, just respond with the old list of
333 // displays. This is fine, since after the DRM resources are initialized and
334 // IPC-ed to the GPU NotifyDisplayDelegate() is called to let the display
335 // delegate know that the display configuration changed and it needs to
336 // update it again.
337 if (!get_displays_callback_.is_null()) {
338 base::ThreadTaskRunnerHandle::Get()->PostTask(
339 FROM_HERE,
340 base::Bind(&DrmDisplayHostManager::RunUpdateDisplaysCallback,
341 weak_ptr_factory_.GetWeakPtr(), get_displays_callback_));
342 get_displays_callback_.Reset();
343 }
344
345 // Signal that we're taking DRM master since we're going through the
346 // initialization process again and we'll take all the available resources.
347 if (!take_display_control_callback_.is_null())
348 GpuTookDisplayControl(true);
349
350 if (!relinquish_display_control_callback_.is_null())
351 GpuRelinquishedDisplayControl(false);
352
353 scoped_ptr<DrmDeviceHandle> handle = std::move(primary_drm_device_handle_);
354 {
355 base::ThreadRestrictions::ScopedAllowIO allow_io;
356
357 drm_devices_.clear();
358 drm_devices_[primary_graphics_card_path_] =
359 MapDevPathToSysPath(primary_graphics_card_path_);
360
361 if (!handle) {
362 handle.reset(new DrmDeviceHandle());
363 if (!handle->Initialize(primary_graphics_card_path_,
364 drm_devices_[primary_graphics_card_path_]))
365 LOG(FATAL) << "Failed to open primary graphics card";
366 }
367 }
368
369 // Send the primary device first since this is used to initialize graphics
370 // state.
371 proxy_->GpuAddGraphicsDevice(drm_devices_[primary_graphics_card_path_],
372 base::FileDescriptor(handle->PassFD()));
373
374 device_manager_->ScanDevices(this);
375 NotifyDisplayDelegate();
376 }
377
378 void DrmDisplayHostManager::OnGpuThreadRetired() {}
379
380 void DrmDisplayHostManager::GpuHasUpdatedNativeDisplays(
83 const std::vector<DisplaySnapshot_Params>& params) { 381 const std::vector<DisplaySnapshot_Params>& params) {
84 core_->GpuHasUpdatedNativeDisplays(params); 382 std::vector<scoped_ptr<DrmDisplayHost>> old_displays;
85 } 383 displays_.swap(old_displays);
86 384 for (size_t i = 0; i < params.size(); ++i) {
87 void DrmDisplayHostManager::OnDisplayConfigured(int64_t display_id, 385 auto it = std::find_if(old_displays.begin(), old_displays.end(),
386 FindDrmDisplayHostById(params[i].display_id));
387 if (it == old_displays.end()) {
388 displays_.push_back(make_scoped_ptr(
389 new DrmDisplayHost(proxy_, params[i], false /* is_dummy */)));
390 } else {
391 (*it)->UpdateDisplaySnapshot(params[i]);
392 displays_.push_back(std::move(*it));
393 old_displays.erase(it);
394 }
395 }
396
397 if (!get_displays_callback_.is_null()) {
398 base::ThreadTaskRunnerHandle::Get()->PostTask(
399 FROM_HERE,
400 base::Bind(&DrmDisplayHostManager::RunUpdateDisplaysCallback,
401 weak_ptr_factory_.GetWeakPtr(), get_displays_callback_));
402 get_displays_callback_.Reset();
403 }
404 }
405
406 void DrmDisplayHostManager::GpuConfiguredDisplay(int64_t display_id,
407 bool status) {
408 DrmDisplayHost* display = GetDisplay(display_id);
409 if (display)
410 display->OnDisplayConfigured(status);
411 else
412 LOG(ERROR) << "Couldn't find display with id=" << display_id;
413 }
414
415 void DrmDisplayHostManager::GpuReceivedHDCPState(int64_t display_id,
416 bool status,
417 HDCPState state) {
418 DrmDisplayHost* display = GetDisplay(display_id);
419 if (display)
420 display->OnHDCPStateReceived(status, state);
421 else
422 LOG(ERROR) << "Couldn't find display with id=" << display_id;
423 }
424
425 void DrmDisplayHostManager::GpuUpdatedHDCPState(int64_t display_id,
88 bool status) { 426 bool status) {
89 core_->GpuConfiguredDisplay(display_id, status); 427 DrmDisplayHost* display = GetDisplay(display_id);
90 } 428 if (display)
91 429 display->OnHDCPStateUpdated(status);
92 void DrmDisplayHostManager::OnHDCPStateReceived(int64_t display_id, 430 else
93 bool status, 431 LOG(ERROR) << "Couldn't find display with id=" << display_id;
94 HDCPState state) { 432 }
95 core_->GpuReceivedHDCPState(display_id, status, state); 433
96 } 434 void DrmDisplayHostManager::GpuTookDisplayControl(bool status) {
97 435 if (take_display_control_callback_.is_null()) {
98 void DrmDisplayHostManager::OnHDCPStateUpdated(int64_t display_id, 436 LOG(ERROR) << "No callback for take display control";
99 bool status) { 437 return;
100 core_->GpuUpdatedHDCPState(display_id, status); 438 }
101 } 439
102 440 DCHECK(display_externally_controlled_);
103 void DrmDisplayHostManager::OnTakeDisplayControl(bool status) { 441 DCHECK(display_control_change_pending_);
104 core_->GpuTookDisplayControl(status); 442
105 } 443 if (status) {
106 444 input_controller_->SetInputDevicesEnabled(true);
107 void DrmDisplayHostManager::OnRelinquishDisplayControl(bool status) { 445 display_externally_controlled_ = false;
108 core_->GpuRelinquishedDisplayControl(status); 446 }
109 } 447
110 448 base::ThreadTaskRunnerHandle::Get()->PostTask(
111 DrmDisplayHostManager::HostManagerIPC::HostManagerIPC( 449 FROM_HERE, base::Bind(take_display_control_callback_, status));
112 DrmGpuPlatformSupportHost* proxy, 450 take_display_control_callback_.Reset();
113 DrmDisplayHostManager* parent) 451 display_control_change_pending_ = false;
114 : proxy_(proxy), parent_(parent) {} 452 }
115 453
116 DrmDisplayHostManager::HostManagerIPC::~HostManagerIPC() { 454 void DrmDisplayHostManager::GpuRelinquishedDisplayControl(bool status) {
117 proxy_->UnregisterHandler(parent_); 455 if (relinquish_display_control_callback_.is_null()) {
118 } 456 LOG(ERROR) << "No callback for relinquish display control";
119 457 return;
120 void DrmDisplayHostManager::HostManagerIPC::RegisterHandler() { 458 }
121 proxy_->RegisterHandler(parent_); 459
122 } 460 DCHECK(!display_externally_controlled_);
123 461 DCHECK(display_control_change_pending_);
124 DrmGpuPlatformSupportHost* 462
125 DrmDisplayHostManager::HostManagerIPC::GetGpuPlatformSupportHost() { 463 if (status) {
126 return proxy_; 464 input_controller_->SetInputDevicesEnabled(false);
127 } 465 display_externally_controlled_ = true;
128 466 }
129 bool DrmDisplayHostManager::HostManagerIPC::RefreshNativeDisplays() { 467
130 return proxy_->Send(new OzoneGpuMsg_RefreshNativeDisplays()); 468 base::ThreadTaskRunnerHandle::Get()->PostTask(
131 } 469 FROM_HERE, base::Bind(relinquish_display_control_callback_, status));
132 470 relinquish_display_control_callback_.Reset();
133 bool DrmDisplayHostManager::HostManagerIPC::TakeDisplayControl() { 471 display_control_change_pending_ = false;
134 return proxy_->Send(new OzoneGpuMsg_TakeDisplayControl()); 472 }
135 } 473
136 474 void DrmDisplayHostManager::RunUpdateDisplaysCallback(
137 bool DrmDisplayHostManager::HostManagerIPC::RelinquishDisplayControl() { 475 const GetDisplaysCallback& callback) const {
138 return proxy_->Send(new OzoneGpuMsg_RelinquishDisplayControl()); 476 std::vector<DisplaySnapshot*> snapshots;
139 } 477 for (const auto& display : displays_)
140 478 snapshots.push_back(display->snapshot());
141 bool DrmDisplayHostManager::HostManagerIPC::AddGraphicsDevice( 479
142 const base::FilePath& path, 480 callback.Run(snapshots);
143 base::FileDescriptor fd) { 481 }
144 return proxy_->Send(new OzoneGpuMsg_AddGraphicsDevice(path, fd)); 482
145 } 483 void DrmDisplayHostManager::NotifyDisplayDelegate() const {
146 484 if (delegate_)
147 bool DrmDisplayHostManager::HostManagerIPC::RemoveGraphicsDevice( 485 delegate_->OnConfigurationChanged();
148 const base::FilePath& path) {
149 return proxy_->Send(new OzoneGpuMsg_RemoveGraphicsDevice(path));
150 } 486 }
151 487
152 } // namespace ui 488 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698