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

Unified Diff: ui/ozone/platform/drm/gpu/gbm_surface_factory.cc

Issue 1381133002: ozone: Implement support for CreateGpuMemoryBufferFromHandle for OzoneNativePixmap backed GMBs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmb-factory-create-from-handle
Patch Set: rebase Created 5 years, 2 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/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*>(

Powered by Google App Engine
This is Rietveld 408576698