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

Unified Diff: ui/ozone/platform/drm/host/drm_display_host_manager.cc

Issue 1071273002: NotForReview: Implement zero/one-copy texture for ozone freon using Intel DRM Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: depends on https://codereview.chromium.org/1134993003/ Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
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.";

Powered by Google App Engine
This is Rietveld 408576698