Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 1528373002: Replace Pass() with std::move in ui/ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add #include <utility> Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <xf86drmMode.h> 11 #include <xf86drmMode.h>
12 #include <utility>
12 13
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
15 #include "base/task_runner.h" 16 #include "base/task_runner.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
18 #include "third_party/skia/include/core/SkImageInfo.h" 19 #include "third_party/skia/include/core/SkImageInfo.h"
19 #include "ui/display/types/gamma_ramp_rgb_entry.h" 20 #include "ui/display/types/gamma_ramp_rgb_entry.h"
20 #include "ui/ozone/platform/drm/common/drm_util.h" 21 #include "ui/ozone/platform/drm/common/drm_util.h"
21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" 22 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 209
209 int fd_; 210 int fd_;
210 211
211 DISALLOW_COPY_AND_ASSIGN(IOWatcher); 212 DISALLOW_COPY_AND_ASSIGN(IOWatcher);
212 }; 213 };
213 214
214 DrmDevice::DrmDevice(const base::FilePath& device_path, 215 DrmDevice::DrmDevice(const base::FilePath& device_path,
215 base::File file, 216 base::File file,
216 bool is_primary_device) 217 bool is_primary_device)
217 : device_path_(device_path), 218 : device_path_(device_path),
218 file_(file.Pass()), 219 file_(std::move(file)),
219 page_flip_manager_(new PageFlipManager()), 220 page_flip_manager_(new PageFlipManager()),
220 is_primary_device_(is_primary_device) {} 221 is_primary_device_(is_primary_device) {}
221 222
222 DrmDevice::~DrmDevice() {} 223 DrmDevice::~DrmDevice() {}
223 224
224 bool DrmDevice::Initialize(bool use_atomic) { 225 bool DrmDevice::Initialize(bool use_atomic) {
225 // Ignore devices that cannot perform modesetting. 226 // Ignore devices that cannot perform modesetting.
226 if (!CanQueryForResources(file_.GetPlatformFile())) { 227 if (!CanQueryForResources(file_.GetPlatformFile())) {
227 VLOG(2) << "Cannot query for resources for '" << device_path_.value() 228 VLOG(2) << "Cannot query for resources for '" << device_path_.value()
228 << "'"; 229 << "'";
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 const char* name) { 364 const char* name) {
364 TRACE_EVENT2("drm", "DrmDevice::GetProperty", "connector", 365 TRACE_EVENT2("drm", "DrmDevice::GetProperty", "connector",
365 connector->connector_id, "name", name); 366 connector->connector_id, "name", name);
366 for (int i = 0; i < connector->count_props; ++i) { 367 for (int i = 0; i < connector->count_props; ++i) {
367 ScopedDrmPropertyPtr property( 368 ScopedDrmPropertyPtr property(
368 drmModeGetProperty(file_.GetPlatformFile(), connector->props[i])); 369 drmModeGetProperty(file_.GetPlatformFile(), connector->props[i]));
369 if (!property) 370 if (!property)
370 continue; 371 continue;
371 372
372 if (strcmp(property->name, name) == 0) 373 if (strcmp(property->name, name) == 0)
373 return property.Pass(); 374 return property;
374 } 375 }
375 376
376 return ScopedDrmPropertyPtr(); 377 return ScopedDrmPropertyPtr();
377 } 378 }
378 379
379 bool DrmDevice::SetProperty(uint32_t connector_id, 380 bool DrmDevice::SetProperty(uint32_t connector_id,
380 uint32_t property_id, 381 uint32_t property_id,
381 uint64_t value) { 382 uint64_t value) {
382 DCHECK(file_.IsValid()); 383 DCHECK(file_.IsValid());
383 return !drmModeConnectorSetProperty(file_.GetPlatformFile(), connector_id, 384 return !drmModeConnectorSetProperty(file_.GetPlatformFile(), connector_id,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 b.push_back(lut[i].b); 535 b.push_back(lut[i].b);
535 } 536 }
536 537
537 DCHECK(file_.IsValid()); 538 DCHECK(file_.IsValid());
538 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); 539 TRACE_EVENT0("drm", "DrmDevice::SetGamma");
539 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], 540 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0],
540 &g[0], &b[0]) == 0); 541 &g[0], &b[0]) == 0);
541 } 542 }
542 543
543 } // namespace ui 544 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.cc ('k') | ui/ozone/platform/drm/gpu/drm_device_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698