| OLD | NEW |
| 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> | 7 #include <fcntl.h> |
| 8 #include <xf86drm.h> | 8 #include <xf86drm.h> |
| 9 | 9 |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 "CHANGE", | 39 "CHANGE", |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 void OpenDeviceOnWorkerThread( | 42 void OpenDeviceOnWorkerThread( |
| 43 const base::FilePath& path, | 43 const base::FilePath& path, |
| 44 const scoped_refptr<base::TaskRunner>& reply_runner, | 44 const scoped_refptr<base::TaskRunner>& reply_runner, |
| 45 const OnOpenDeviceReplyCallback& callback) { | 45 const OnOpenDeviceReplyCallback& callback) { |
| 46 scoped_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle()); | 46 scoped_ptr<DrmDeviceHandle> handle(new DrmDeviceHandle()); |
| 47 handle->Initialize(path); | 47 handle->Initialize(path); |
| 48 reply_runner->PostTask( | 48 reply_runner->PostTask( |
| 49 FROM_HERE, base::Bind(callback, path, base::Passed(handle.Pass()))); | 49 FROM_HERE, base::Bind(callback, path, base::Passed(std::move(handle)))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 base::FilePath GetPrimaryDisplayCardPath() { | 52 base::FilePath GetPrimaryDisplayCardPath() { |
| 53 struct drm_mode_card_res res; | 53 struct drm_mode_card_res res; |
| 54 for (int i = 0; /* end on first card# that does not exist */; i++) { | 54 for (int i = 0; /* end on first card# that does not exist */; i++) { |
| 55 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i); | 55 std::string card_path = base::StringPrintf(kDefaultGraphicsCardPattern, i); |
| 56 | 56 |
| 57 if (access(card_path.c_str(), F_OK) != 0) | 57 if (access(card_path.c_str(), F_OK) != 0) |
| 58 break; | 58 break; |
| 59 | 59 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Signal that we're taking DRM master since we're going through the | 321 // Signal that we're taking DRM master since we're going through the |
| 322 // initialization process again and we'll take all the available resources. | 322 // initialization process again and we'll take all the available resources. |
| 323 if (!take_display_control_callback_.is_null()) | 323 if (!take_display_control_callback_.is_null()) |
| 324 OnTakeDisplayControl(true); | 324 OnTakeDisplayControl(true); |
| 325 | 325 |
| 326 if (!relinquish_display_control_callback_.is_null()) | 326 if (!relinquish_display_control_callback_.is_null()) |
| 327 OnRelinquishDisplayControl(false); | 327 OnRelinquishDisplayControl(false); |
| 328 | 328 |
| 329 drm_devices_.clear(); | 329 drm_devices_.clear(); |
| 330 drm_devices_.insert(primary_graphics_card_path_); | 330 drm_devices_.insert(primary_graphics_card_path_); |
| 331 scoped_ptr<DrmDeviceHandle> handle = primary_drm_device_handle_.Pass(); | 331 scoped_ptr<DrmDeviceHandle> handle = std::move(primary_drm_device_handle_); |
| 332 if (!handle) { | 332 if (!handle) { |
| 333 base::ThreadRestrictions::ScopedAllowIO allow_io; | 333 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 334 handle.reset(new DrmDeviceHandle()); | 334 handle.reset(new DrmDeviceHandle()); |
| 335 if (!handle->Initialize(primary_graphics_card_path_)) | 335 if (!handle->Initialize(primary_graphics_card_path_)) |
| 336 LOG(FATAL) << "Failed to open primary graphics card"; | 336 LOG(FATAL) << "Failed to open primary graphics card"; |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Send the primary device first since this is used to initialize graphics | 339 // Send the primary device first since this is used to initialize graphics |
| 340 // state. | 340 // state. |
| 341 proxy_->Send(new OzoneGpuMsg_AddGraphicsDevice( | 341 proxy_->Send(new OzoneGpuMsg_AddGraphicsDevice( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 callback.Run(snapshots); | 468 callback.Run(snapshots); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void DrmDisplayHostManager::NotifyDisplayDelegate() const { | 471 void DrmDisplayHostManager::NotifyDisplayDelegate() const { |
| 472 if (delegate_) | 472 if (delegate_) |
| 473 delegate_->OnConfigurationChanged(); | 473 delegate_->OnConfigurationChanged(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace ui | 476 } // namespace ui |
| OLD | NEW |