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/gpu/drm_gpu_display_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_descriptor_posix.h" | 9 #include "base/file_descriptor_posix.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "ui/display/types/gamma_ramp_rgb_entry.h" |
12 #include "ui/display/types/native_display_observer.h" | 13 #include "ui/display/types/native_display_observer.h" |
13 #include "ui/events/ozone/device/device_event.h" | 14 #include "ui/events/ozone/device/device_event.h" |
14 #include "ui/ozone/common/display_util.h" | 15 #include "ui/ozone/common/display_util.h" |
15 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 16 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
16 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 17 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
17 #include "ui/ozone/platform/drm/gpu/drm_display_mode.h" | 18 #include "ui/ozone/platform/drm/gpu/drm_display_mode.h" |
18 #include "ui/ozone/platform/drm/gpu/drm_display_snapshot.h" | 19 #include "ui/ozone/platform/drm/gpu/drm_display_snapshot.h" |
19 #include "ui/ozone/platform/drm/gpu/drm_util.h" | 20 #include "ui/ozone/platform/drm/gpu/drm_util.h" |
20 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 21 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
21 #include "ui/ozone/public/ozone_switches.h" | 22 #include "ui/ozone/public/ozone_switches.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); | 186 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); |
186 for (const auto& drm : devices) { | 187 for (const auto& drm : devices) { |
187 if (!drm->DropMaster()) { | 188 if (!drm->DropMaster()) { |
188 LOG(ERROR) << "Failed to relinquish control of the display"; | 189 LOG(ERROR) << "Failed to relinquish control of the display"; |
189 return false; | 190 return false; |
190 } | 191 } |
191 } | 192 } |
192 return true; | 193 return true; |
193 } | 194 } |
194 | 195 |
| 196 void DrmGpuDisplayManager::SetGammaRamp( |
| 197 int64_t id, |
| 198 const std::vector<GammaRampRGBEntry>& lut) { |
| 199 DrmDisplaySnapshot* display = FindDisplaySnapshot(id); |
| 200 if (!display) { |
| 201 LOG(ERROR) << "There is no display with ID " << id; |
| 202 return; |
| 203 } |
| 204 |
| 205 if (!display->drm()->SetGammaRamp(display->crtc(), lut)) { |
| 206 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " |
| 207 << display->crtc() << " size = " << lut.size(); |
| 208 } |
| 209 } |
| 210 |
195 DrmDisplaySnapshot* DrmGpuDisplayManager::FindDisplaySnapshot(int64_t id) { | 211 DrmDisplaySnapshot* DrmGpuDisplayManager::FindDisplaySnapshot(int64_t id) { |
196 for (size_t i = 0; i < cached_displays_.size(); ++i) | 212 for (size_t i = 0; i < cached_displays_.size(); ++i) |
197 if (cached_displays_[i]->display_id() == id) | 213 if (cached_displays_[i]->display_id() == id) |
198 return cached_displays_[i]; | 214 return cached_displays_[i]; |
199 | 215 |
200 return NULL; | 216 return NULL; |
201 } | 217 } |
202 | 218 |
203 const DrmDisplayMode* DrmGpuDisplayManager::FindDisplayMode( | 219 const DrmDisplayMode* DrmGpuDisplayManager::FindDisplayMode( |
204 const gfx::Size& size, | 220 const gfx::Size& size, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 374 |
359 if (it == old_displays.end()) { | 375 if (it == old_displays.end()) { |
360 screen_manager_->AddDisplayController(new_displays[i]->drm(), | 376 screen_manager_->AddDisplayController(new_displays[i]->drm(), |
361 new_displays[i]->crtc(), | 377 new_displays[i]->crtc(), |
362 new_displays[i]->connector()); | 378 new_displays[i]->connector()); |
363 } | 379 } |
364 } | 380 } |
365 } | 381 } |
366 | 382 |
367 } // namespace ui | 383 } // namespace ui |
OLD | NEW |