| 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
|
|
|