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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 int fd_; | 209 int fd_; |
210 | 210 |
211 DISALLOW_COPY_AND_ASSIGN(IOWatcher); | 211 DISALLOW_COPY_AND_ASSIGN(IOWatcher); |
212 }; | 212 }; |
213 | 213 |
214 DrmDevice::DrmDevice(const base::FilePath& device_path, | 214 DrmDevice::DrmDevice(const base::FilePath& device_path, |
215 base::File file, | 215 base::File file, |
216 bool is_primary_device) | 216 bool is_primary_device) |
217 : device_path_(device_path), | 217 : device_path_(device_path), |
218 file_(file.Pass()), | 218 file_(std::move(file)), |
219 page_flip_manager_(new PageFlipManager()), | 219 page_flip_manager_(new PageFlipManager()), |
220 is_primary_device_(is_primary_device) {} | 220 is_primary_device_(is_primary_device) {} |
221 | 221 |
222 DrmDevice::~DrmDevice() {} | 222 DrmDevice::~DrmDevice() {} |
223 | 223 |
224 bool DrmDevice::Initialize(bool use_atomic) { | 224 bool DrmDevice::Initialize(bool use_atomic) { |
225 // Ignore devices that cannot perform modesetting. | 225 // Ignore devices that cannot perform modesetting. |
226 if (!CanQueryForResources(file_.GetPlatformFile())) { | 226 if (!CanQueryForResources(file_.GetPlatformFile())) { |
227 VLOG(2) << "Cannot query for resources for '" << device_path_.value() | 227 VLOG(2) << "Cannot query for resources for '" << device_path_.value() |
228 << "'"; | 228 << "'"; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 const char* name) { | 363 const char* name) { |
364 TRACE_EVENT2("drm", "DrmDevice::GetProperty", "connector", | 364 TRACE_EVENT2("drm", "DrmDevice::GetProperty", "connector", |
365 connector->connector_id, "name", name); | 365 connector->connector_id, "name", name); |
366 for (int i = 0; i < connector->count_props; ++i) { | 366 for (int i = 0; i < connector->count_props; ++i) { |
367 ScopedDrmPropertyPtr property( | 367 ScopedDrmPropertyPtr property( |
368 drmModeGetProperty(file_.GetPlatformFile(), connector->props[i])); | 368 drmModeGetProperty(file_.GetPlatformFile(), connector->props[i])); |
369 if (!property) | 369 if (!property) |
370 continue; | 370 continue; |
371 | 371 |
372 if (strcmp(property->name, name) == 0) | 372 if (strcmp(property->name, name) == 0) |
373 return property.Pass(); | 373 return property; |
374 } | 374 } |
375 | 375 |
376 return ScopedDrmPropertyPtr(); | 376 return ScopedDrmPropertyPtr(); |
377 } | 377 } |
378 | 378 |
379 bool DrmDevice::SetProperty(uint32_t connector_id, | 379 bool DrmDevice::SetProperty(uint32_t connector_id, |
380 uint32_t property_id, | 380 uint32_t property_id, |
381 uint64_t value) { | 381 uint64_t value) { |
382 DCHECK(file_.IsValid()); | 382 DCHECK(file_.IsValid()); |
383 return !drmModeConnectorSetProperty(file_.GetPlatformFile(), connector_id, | 383 return !drmModeConnectorSetProperty(file_.GetPlatformFile(), connector_id, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 b.push_back(lut[i].b); | 534 b.push_back(lut[i].b); |
535 } | 535 } |
536 | 536 |
537 DCHECK(file_.IsValid()); | 537 DCHECK(file_.IsValid()); |
538 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); | 538 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); |
539 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], | 539 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], |
540 &g[0], &b[0]) == 0); | 540 &g[0], &b[0]) == 0); |
541 } | 541 } |
542 | 542 |
543 } // namespace ui | 543 } // namespace ui |
OLD | NEW |