| 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_device.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 scoped_refptr<DrmDevice::PageFlipManager> page_flip_manager_; | 261 scoped_refptr<DrmDevice::PageFlipManager> page_flip_manager_; |
| 262 | 262 |
| 263 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 263 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 264 | 264 |
| 265 bool paused_; | 265 bool paused_; |
| 266 int fd_; | 266 int fd_; |
| 267 | 267 |
| 268 DISALLOW_COPY_AND_ASSIGN(IOWatcher); | 268 DISALLOW_COPY_AND_ASSIGN(IOWatcher); |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 DrmDevice::DrmDevice(const base::FilePath& device_path) | |
| 272 : device_path_(device_path), | |
| 273 file_(device_path, | |
| 274 base::File::FLAG_OPEN | base::File::FLAG_READ | | |
| 275 base::File::FLAG_WRITE), | |
| 276 page_flip_manager_(new PageFlipManager()) { | |
| 277 LOG_IF(FATAL, !file_.IsValid()) | |
| 278 << "Failed to open '" << device_path_.value() | |
| 279 << "': " << base::File::ErrorToString(file_.error_details()); | |
| 280 } | |
| 281 | |
| 282 DrmDevice::DrmDevice(const base::FilePath& device_path, base::File file) | 271 DrmDevice::DrmDevice(const base::FilePath& device_path, base::File file) |
| 283 : device_path_(device_path), | 272 : device_path_(device_path), |
| 284 file_(file.Pass()), | 273 file_(file.Pass()), |
| 285 page_flip_manager_(new PageFlipManager()) { | 274 page_flip_manager_(new PageFlipManager()) { |
| 286 } | 275 } |
| 287 | 276 |
| 288 DrmDevice::~DrmDevice() { | 277 DrmDevice::~DrmDevice() { |
| 289 if (watcher_) | 278 if (watcher_) |
| 290 watcher_->Shutdown(); | 279 watcher_->Shutdown(); |
| 291 } | 280 } |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 b.push_back(lut[i].b); | 611 b.push_back(lut[i].b); |
| 623 } | 612 } |
| 624 | 613 |
| 625 DCHECK(file_.IsValid()); | 614 DCHECK(file_.IsValid()); |
| 626 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); | 615 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); |
| 627 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], | 616 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], |
| 628 &g[0], &b[0]) == 0); | 617 &g[0], &b[0]) == 0); |
| 629 } | 618 } |
| 630 | 619 |
| 631 } // namespace ui | 620 } // namespace ui |
| OLD | NEW |