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

Unified Diff: ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.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: rebase after ClientNativePixmap is introduced Created 5 years, 4 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | ui/ozone/platform/drm/gbm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
diff --git a/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc b/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
index 7a943413b2605139256e5efe9630c33d7b2b0080..1aad682cd45e673eb80d40adc2375d2c3bf9cc11 100644
--- a/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
+++ b/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
@@ -11,6 +11,10 @@
#if defined(OZONE_USE_VGEM_MAP)
#include "ui/ozone/platform/drm/gpu/client_native_pixmap_vgem.h"
+
+#include "base/command_line.h"
+#include "ui/ozone/platform/drm/gpu/intel_drm_pixmap.h"
+#include "ui/ozone/public/ozone_switches.h"
#endif
namespace ui {
@@ -22,10 +26,15 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
ClientNativePixmapFactoryGbm() {
#if defined(OZONE_USE_VGEM_MAP)
// TODO(dshwang): remove ad-hoc file open. crrev.com/1248713002
+ static const char kRenderNodePath[] = "/dev/dri/renderD128";
static const char kVgemPath[] = "/dev/dri/renderD129";
- int vgem_fd = open(kVgemPath, O_RDWR | O_CLOEXEC);
+ bool enable_intel_drm = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kOzoneUseIntelDrm);
+ int vgem_fd = open(enable_intel_drm ? kRenderNodePath : kVgemPath,
+ O_RDWR | O_CLOEXEC);
if (vgem_fd < 0) {
- PLOG(ERROR) << "Failed to open: " << kVgemPath;
+ PLOG(ERROR) << "Failed to open: "
+ << (enable_intel_drm ? kRenderNodePath : kVgemPath);
return;
}
vgem_fd_.reset(vgem_fd);
@@ -63,6 +72,14 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
DCHECK_GE(vgem_fd_.get(), 0);
DCHECK(format == gfx::BufferFormat::BGRA_8888);
DCHECK(usage == gfx::BufferUsage::MAP);
+
+ bool enable_intel_drm = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kOzoneUseIntelDrm);
+ if (enable_intel_drm) {
+ return IntelDrmClientPixmap::CreateFromHandle(
+ handle, base::FileDescriptor(vgem_fd_.get(), false), format, size);
+ }
+
return ClientNativePixmapVgem::Create(
handle, base::FileDescriptor(vgem_fd_.get(), false), size);
#else
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | ui/ozone/platform/drm/gbm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698