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" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); | 229 std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); |
230 if (it == devices_.end()) { | 230 if (it == devices_.end()) { |
231 VLOG(2) << "Got request to remove non-existent device '" << path.value() | 231 VLOG(2) << "Got request to remove non-existent device '" << path.value() |
232 << "'"; | 232 << "'"; |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 devices_.erase(it); | 236 devices_.erase(it); |
237 } | 237 } |
238 | 238 |
239 void DrmGpuDisplayManager::SetGammaRamp(int64_t id, | |
240 const std::vector<uint16_t>& r, | |
241 const std::vector<uint16_t>& g, | |
242 const std::vector<uint16_t>& b) { | |
243 DrmDisplaySnapshot* display = FindDisplaySnapshot(id); | |
244 if (!display) { | |
245 LOG(ERROR) << "There is no display with ID " << id; | |
246 return; | |
247 } | |
248 | |
249 if (r.size() != g.size() || g.size() != b.size()) { | |
250 LOG(ERROR) << "Gamma ramp channels must all the same length."; | |
251 } | |
252 | |
253 if (!display->drm()->SetGammaRamp( | |
254 display->crtc(), r.size(), const_cast<uint16_t*>(&r[0]), | |
255 const_cast<uint16_t*>(&g[0]), const_cast<uint16_t*>(&b[0]))) { | |
spang
2015/04/13 18:22:43
Please move the casts closer to the ioctl in DrmDe
robert.bradford
2015/04/17 16:42:46
Done.
| |
256 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " | |
257 << display->crtc() << " size = " << r.size(); | |
258 } | |
259 } | |
260 | |
239 DrmDisplaySnapshot* DrmGpuDisplayManager::FindDisplaySnapshot(int64_t id) { | 261 DrmDisplaySnapshot* DrmGpuDisplayManager::FindDisplaySnapshot(int64_t id) { |
240 for (size_t i = 0; i < cached_displays_.size(); ++i) | 262 for (size_t i = 0; i < cached_displays_.size(); ++i) |
241 if (cached_displays_[i]->display_id() == id) | 263 if (cached_displays_[i]->display_id() == id) |
242 return cached_displays_[i]; | 264 return cached_displays_[i]; |
243 | 265 |
244 return NULL; | 266 return NULL; |
245 } | 267 } |
246 | 268 |
247 const DrmDisplayMode* DrmGpuDisplayManager::FindDisplayMode( | 269 const DrmDisplayMode* DrmGpuDisplayManager::FindDisplayMode( |
248 const gfx::Size& size, | 270 const gfx::Size& size, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 | 428 |
407 if (it == old_displays.end()) { | 429 if (it == old_displays.end()) { |
408 screen_manager_->AddDisplayController(new_displays[i]->drm(), | 430 screen_manager_->AddDisplayController(new_displays[i]->drm(), |
409 new_displays[i]->crtc(), | 431 new_displays[i]->crtc(), |
410 new_displays[i]->connector()); | 432 new_displays[i]->connector()); |
411 } | 433 } |
412 } | 434 } |
413 } | 435 } |
414 | 436 |
415 } // namespace ui | 437 } // namespace ui |
OLD | NEW |