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

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

Issue 1263323004: Add NativePixmapHandle type & interface for exporting them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK on import failure 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
Index: ui/ozone/platform/drm/gpu/gbm_buffer.cc
diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
index b47dc5438e472e30714fbe7f4cd1d8e076a8c8cd..0a46085fd48472b71df2146f8873680ae33b2f9e 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
@@ -10,8 +10,10 @@
#include <xf86drm.h>
#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
#include "base/trace_event/trace_event.h"
#include "ui/gfx/geometry/size_conversions.h"
+#include "ui/gfx/native_pixmap_handle_ozone.h"
#include "ui/ozone/platform/drm/gpu/drm_window.h"
#include "ui/ozone/platform/drm/gpu/gbm_device.h"
@@ -94,6 +96,20 @@ scoped_refptr<NativePixmap> GbmPixmap::GetScaledPixmap(gfx::Size new_size) {
return scaling_callback_.Run(new_size);
}
+gfx::NativePixmapHandle GbmPixmap::ExportHandle() {
+ gfx::NativePixmapHandle handle;
+
+ int dmabuf_fd = HANDLE_EINTR(dup(dma_buf_));
+ if (dmabuf_fd < 0) {
+ PLOG(ERROR) << "dup";
+ return handle;
+ }
+
+ handle.fd = base::FileDescriptor(base::ScopedFD(dmabuf_fd));
dcheng 2015/08/18 18:43:26 FWIW, I personally don't think having a ScopedFD i
spang 2015/08/18 19:15:17 Done.
+ handle.stride = gbm_bo_get_stride(buffer_->bo());
+ return handle;
+}
+
GbmPixmap::~GbmPixmap() {
if (dma_buf_ > 0)
close(dma_buf_);

Powered by Google App Engine
This is Rietveld 408576698