Index: ui/ozone/platform/drm/gbm_surface_factory.cc |
diff --git a/ui/ozone/platform/drm/gbm_surface_factory.cc b/ui/ozone/platform/drm/gbm_surface_factory.cc |
index 290073bc3ba8166e13eccb1bd382565d013df1ec..4685900279d91eb0330d3850374a0913565fc612 100644 |
--- a/ui/ozone/platform/drm/gbm_surface_factory.cc |
+++ b/ui/ozone/platform/drm/gbm_surface_factory.cc |
@@ -24,6 +24,10 @@ |
#include "ui/ozone/public/surface_ozone_canvas.h" |
#include "ui/ozone/public/surface_ozone_egl.h" |
+#if defined(ARCH_CPU_X86_FAMILY) |
+#include "ui/ozone/platform/drm/gpu/gbm_map_pixmap_intel.h" |
+#endif |
+ |
namespace ui { |
namespace { |
@@ -158,15 +162,23 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
gfx::AcceleratedWidget widget, |
gfx::Size size, |
BufferFormat format, |
- BufferUsage usage) { |
- if (usage == MAP) |
- return nullptr; |
- |
+ BufferUsage usage, |
+ gfx::GpuMemoryBufferHandle* handle) { |
+ DCHECK(handle || usage == SCANOUT); |
scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget); |
DCHECK(gbm); |
- scoped_refptr<GbmBuffer> buffer = |
- GbmBuffer::CreateBuffer(gbm, format, size, true); |
+#if defined(ARCH_CPU_X86_FAMILY) |
+ if (usage == MAP) { |
+ scoped_refptr<GbmMapPixmapIntel> pixmap = |
+ GbmMapPixmapIntel::CreatePixmap(gbm, format, size, handle); |
+ if (!pixmap.get()) |
+ return nullptr; |
+ return pixmap; |
+ } |
+#endif |
+ |
+ scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer(gbm, format, size); |
if (!buffer.get()) |
return nullptr; |
@@ -215,7 +227,6 @@ bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { |
bool GbmSurfaceFactory::CanCreateNativePixmap(BufferUsage usage) { |
switch (usage) { |
case MAP: |
- return false; |
case SCANOUT: |
return true; |
} |