| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gbm_device.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_device.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 namespace ui { | 10 namespace ui { |
| 10 | 11 |
| 11 GbmDevice::GbmDevice(const base::FilePath& device_path, | 12 GbmDevice::GbmDevice(const base::FilePath& device_path, |
| 12 base::File file, | 13 base::File file, |
| 13 bool is_primary_device) | 14 bool is_primary_device) |
| 14 : DrmDevice(device_path, file.Pass(), is_primary_device) {} | 15 : DrmDevice(device_path, std::move(file), is_primary_device) {} |
| 15 | 16 |
| 16 GbmDevice::~GbmDevice() { | 17 GbmDevice::~GbmDevice() { |
| 17 if (device_) | 18 if (device_) |
| 18 gbm_device_destroy(device_); | 19 gbm_device_destroy(device_); |
| 19 } | 20 } |
| 20 | 21 |
| 21 bool GbmDevice::Initialize(bool use_atomic) { | 22 bool GbmDevice::Initialize(bool use_atomic) { |
| 22 if (!DrmDevice::Initialize(use_atomic)) | 23 if (!DrmDevice::Initialize(use_atomic)) |
| 23 return false; | 24 return false; |
| 24 | 25 |
| 25 device_ = gbm_create_device(get_fd()); | 26 device_ = gbm_create_device(get_fd()); |
| 26 if (!device_) { | 27 if (!device_) { |
| 27 PLOG(ERROR) << "Unable to initialize GBM for " << device_path().value(); | 28 PLOG(ERROR) << "Unable to initialize GBM for " << device_path().value(); |
| 28 return false; | 29 return false; |
| 29 } | 30 } |
| 30 | 31 |
| 31 return true; | 32 return true; |
| 32 } | 33 } |
| 33 | 34 |
| 34 } // namespace ui | 35 } // namespace ui |
| OLD | NEW |