| Index: ui/ozone/platform/drm/gpu/drm_device_manager.cc
|
| diff --git a/ui/ozone/platform/drm/gpu/drm_device_manager.cc b/ui/ozone/platform/drm/gpu/drm_device_manager.cc
|
| index b01664abb706586b1332aee3d22d82fa6f87a5f0..5c8ce8dd6e86455604e509f1544ef72fa6874683 100644
|
| --- a/ui/ozone/platform/drm/gpu/drm_device_manager.cc
|
| +++ b/ui/ozone/platform/drm/gpu/drm_device_manager.cc
|
| @@ -38,8 +38,17 @@ DrmDeviceManager::~DrmDeviceManager() {
|
| }
|
|
|
| bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path,
|
| - const base::FileDescriptor& fd) {
|
| + const base::FileDescriptor& fd,
|
| + bool is_vgem) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK(fd.auto_close);
|
| +
|
| + if (is_vgem) {
|
| + vgem_device_.reset(fd.fd);
|
| + vgem_path_ = path;
|
| + return true;
|
| + }
|
| +
|
| base::File file(fd.fd);
|
| auto it =
|
| std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
|
| @@ -67,6 +76,12 @@ bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path,
|
|
|
| void DrmDeviceManager::RemoveDrmDevice(const base::FilePath& path) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| + if (vgem_path_ == path) {
|
| + vgem_device_.reset();
|
| + vgem_path_ = base::FilePath();
|
| + return;
|
| + }
|
| +
|
| auto it =
|
| std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
|
| if (it == devices_.end()) {
|
| @@ -123,4 +138,9 @@ const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const {
|
| return devices_;
|
| }
|
|
|
| +int DrmDeviceManager::GetVgemDevice() const {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + return vgem_device_.get();
|
| +}
|
| +
|
| } // namespace ui
|
|
|