| 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/dri/native_display_delegate_proxy.h" | 5 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/threading/thread_restrictions.h" |
| 10 #include "ui/display/types/display_snapshot.h" | 11 #include "ui/display/types/display_snapshot.h" |
| 11 #include "ui/display/types/native_display_observer.h" | 12 #include "ui/display/types/native_display_observer.h" |
| 12 #include "ui/events/ozone/device/device_event.h" | 13 #include "ui/events/ozone/device/device_event.h" |
| 13 #include "ui/events/ozone/device/device_manager.h" | 14 #include "ui/events/ozone/device/device_manager.h" |
| 14 #include "ui/ozone/common/display_snapshot_proxy.h" | 15 #include "ui/ozone/common/display_snapshot_proxy.h" |
| 15 #include "ui/ozone/common/display_util.h" | 16 #include "ui/ozone/common/display_util.h" |
| 16 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 17 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
| 17 #include "ui/ozone/platform/dri/display_manager.h" | 18 #include "ui/ozone/platform/dri/display_manager.h" |
| 18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 19 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
| 19 | 20 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 device_manager_->RemoveObserver(this); | 57 device_manager_->RemoveObserver(this); |
| 57 proxy_->UnregisterHandler(this); | 58 proxy_->UnregisterHandler(this); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void NativeDisplayDelegateProxy::Initialize() { | 61 void NativeDisplayDelegateProxy::Initialize() { |
| 61 device_manager_->AddObserver(this); | 62 device_manager_->AddObserver(this); |
| 62 device_manager_->ScanDevices(this); | 63 device_manager_->ScanDevices(this); |
| 63 | 64 |
| 64 if (!displays_.empty()) | 65 if (!displays_.empty()) |
| 65 return; | 66 return; |
| 67 DisplaySnapshot_Params params; |
| 68 bool success = false; |
| 69 { |
| 70 // The file generated by frecon that contains EDID for the 1st display. |
| 71 const base::FilePath kEDIDFile("/tmp/display_info.bin"); |
| 66 | 72 |
| 67 DisplaySnapshot_Params params = CreateSnapshotFromCommandLine(); | 73 // Just read it on current thread as this is necessary information |
| 68 if (params.type != DISPLAY_CONNECTION_TYPE_NONE) { | 74 // to start. This access only tmpfs, which is fast. |
| 75 // TODO(dnicoara|oshima): crbug.com/450886. |
| 76 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 77 success = CreateSnapshotFromEDIDFile(kEDIDFile, ¶ms); |
| 78 } |
| 79 |
| 80 // Fallback to command line if the file doesn't exit or failed to read. |
| 81 if (success || CreateSnapshotFromCommandLine(¶ms)) { |
| 82 DCHECK_NE(DISPLAY_CONNECTION_TYPE_NONE, params.type); |
| 69 displays_.push_back(new DriDisplaySnapshotProxy(params, display_manager_)); | 83 displays_.push_back(new DriDisplaySnapshotProxy(params, display_manager_)); |
| 70 has_dummy_display_ = true; | 84 has_dummy_display_ = true; |
| 71 } | 85 } |
| 72 } | 86 } |
| 73 | 87 |
| 74 void NativeDisplayDelegateProxy::GrabServer() { | 88 void NativeDisplayDelegateProxy::GrabServer() { |
| 75 } | 89 } |
| 76 | 90 |
| 77 void NativeDisplayDelegateProxy::UngrabServer() { | 91 void NativeDisplayDelegateProxy::UngrabServer() { |
| 78 } | 92 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void NativeDisplayDelegateProxy::OnDisplayConfigured(int64_t display_id, | 263 void NativeDisplayDelegateProxy::OnDisplayConfigured(int64_t display_id, |
| 250 bool status) { | 264 bool status) { |
| 251 auto it = configure_callback_map_.find(display_id); | 265 auto it = configure_callback_map_.find(display_id); |
| 252 if (it != configure_callback_map_.end()) { | 266 if (it != configure_callback_map_.end()) { |
| 253 it->second.Run(status); | 267 it->second.Run(status); |
| 254 configure_callback_map_.erase(it); | 268 configure_callback_map_.erase(it); |
| 255 } | 269 } |
| 256 } | 270 } |
| 257 | 271 |
| 258 } // namespace ui | 272 } // namespace ui |
| OLD | NEW |