Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/gbm_surface_factory.cc |
| diff --git a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc |
| index 060f7be7a90044edaf2b249d583bcdef49796f1b..97118659019b7181d7bd723f59c1cbafca37abff 100644 |
| --- a/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc |
| +++ b/ui/ozone/platform/drm/gpu/gbm_surface_factory.cc |
| @@ -7,6 +7,7 @@ |
| #include <gbm.h> |
| #include "base/files/file_path.h" |
| +#include "base/posix/eintr_wrapper.h" |
| #include "third_party/khronos/EGL/egl.h" |
| #include "ui/ozone/common/egl_util.h" |
| #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| @@ -128,13 +129,26 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| if (!buffer.get()) |
| return nullptr; |
| - scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer, this)); |
| - if (!pixmap->Initialize()) |
| + scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); |
| + if (!pixmap->InitializeFromBuffer(buffer)) |
| return nullptr; |
| return pixmap; |
| } |
| +scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( |
| + const gfx::NativePixmapHandle& handle) { |
| + int dmabuf_fd = HANDLE_EINTR(dup(handle.fd.fd)); |
|
piman
2015/10/08 23:24:36
Why do we need to dup here, and if so, where is th
reveman
2015/10/09 12:47:02
Good call. We shouldn't dup it here. This just hap
|
| + if (dmabuf_fd < 0) { |
| + PLOG(ERROR) << "dup"; |
| + return nullptr; |
| + } |
| + |
| + scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); |
| + pixmap->Initialize(dmabuf_fd, handle.stride); |
| + return pixmap; |
| +} |
| + |
| scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( |
| gfx::AcceleratedWidget widget) { |
| return static_cast<GbmDevice*>( |