| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gpu/drm_device_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/file_descriptor_posix.h" | 9 #include "base/file_descriptor_posix.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (it != drm_device_map_.end()) | 83 if (it != drm_device_map_.end()) |
| 84 drm_device_map_.erase(it); | 84 drm_device_map_.erase(it); |
| 85 } | 85 } |
| 86 | 86 |
| 87 scoped_refptr<DrmDevice> DrmDeviceManager::GetDrmDevice( | 87 scoped_refptr<DrmDevice> DrmDeviceManager::GetDrmDevice( |
| 88 gfx::AcceleratedWidget widget) { | 88 gfx::AcceleratedWidget widget) { |
| 89 if (widget == gfx::kNullAcceleratedWidget) | 89 if (widget == gfx::kNullAcceleratedWidget) |
| 90 return primary_device_; | 90 return primary_device_; |
| 91 | 91 |
| 92 auto it = drm_device_map_.find(widget); | 92 auto it = drm_device_map_.find(widget); |
| 93 DCHECK(it != drm_device_map_.end()) | 93 DLOG_IF(WARNING, it == drm_device_map_.end()) |
| 94 << "Attempting to get device for unknown widget " << widget; | 94 << "Attempting to get device for unknown widget " << widget; |
| 95 // If the widget isn't associated with a display (headless mode) we can | 95 // If the widget isn't associated with a display (headless mode) we can |
| 96 // allocate buffers from any controller since they will never be scanned out. | 96 // allocate buffers from any controller since they will never be scanned out. |
| 97 // Use the primary DRM device as a fallback when allocating these buffers. | 97 // Use the primary DRM device as a fallback when allocating these buffers. |
| 98 if (!it->second) | 98 if (it == drm_device_map_.end() || !it->second) |
| 99 return primary_device_; | 99 return primary_device_; |
| 100 | 100 |
| 101 return it->second; | 101 return it->second; |
| 102 } | 102 } |
| 103 | 103 |
| 104 scoped_refptr<DrmDevice> DrmDeviceManager::GetPrimaryDrmDevice() { | 104 scoped_refptr<DrmDevice> DrmDeviceManager::GetPrimaryDrmDevice() { |
| 105 return primary_device_; | 105 return primary_device_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const { | 108 const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const { |
| 109 return devices_; | 109 return devices_; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace ui | 112 } // namespace ui |
| OLD | NEW |