Chromium Code Reviews| Index: ui/ozone/platform/drm/host/drm_display_host_manager.cc |
| diff --git a/ui/ozone/platform/drm/host/drm_display_host_manager.cc b/ui/ozone/platform/drm/host/drm_display_host_manager.cc |
| index 3d7b7b4f245c81d4646f4651f7f9699753fa66e9..fff3c590a8376ef6a565f8d0c6ba532bb10323bc 100644 |
| --- a/ui/ozone/platform/drm/host/drm_display_host_manager.cc |
| +++ b/ui/ozone/platform/drm/host/drm_display_host_manager.cc |
| @@ -23,6 +23,9 @@ |
| #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" |
| #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" |
| +#include "base/command_line.h" |
| +#include "ui/ozone/public/ozone_switches.h" |
| + |
| namespace ui { |
| namespace { |
| @@ -129,6 +132,11 @@ DrmDisplayHostManager::DrmDisplayHostManager( |
| } |
| drm_devices_.insert(primary_graphics_card_path_); |
| + int duped_handle = HANDLE_EINTR(dup(primary_drm_device_handle_->GetFD())); |
| + if (duped_handle < 0) |
| + LOG(FATAL) << "Failed to dup primary graphics card for renderer"; |
| + primary_drm_device_file_.reset(duped_handle); |
| + |
| vgem_card_path_ = GetVgemCardPath(); |
| if (!vgem_card_path_.empty()) { |
| int fd = HANDLE_EINTR( |
| @@ -156,13 +164,23 @@ DrmDisplayHostManager::DrmDisplayHostManager( |
| } |
| base::FileDescriptor DrmDisplayHostManager::DupVgemFd() { |
| - if (vgem_card_path_.empty()) |
| + int device_fd = vgem_card_device_file_.get(); |
| + base::FilePath* device_path = &vgem_card_path_; |
| + |
| + bool enable_intel_drm = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kOzoneUseIntelDrm); |
| + if (enable_intel_drm) { |
| + device_fd = primary_drm_device_file_.get(); |
|
dshwang
2015/06/29 17:42:07
When --ozone-use-intel-drm, "/dev/dri/card0" is se
|
| + device_path = &primary_graphics_card_path_; |
| + } |
| + |
| + if (device_path->empty()) |
| return base::FileDescriptor(); |
| int duped_handle = -1; |
| { |
| base::ThreadRestrictions::ScopedAllowIO allow_io; |
| - duped_handle = HANDLE_EINTR(dup(vgem_card_device_file_.get())); |
| + duped_handle = HANDLE_EINTR(dup(device_fd)); |
| } |
| if (duped_handle < 0) { |
| PLOG(ERROR) << "dup() failed."; |