Index: ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc |
diff --git a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc |
index a987e6fb308466fb01c4e5adaca000f299f3dd57..cccf203f3c43476f31e9c5f661b8e5978bcafaae 100644 |
--- a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc |
+++ b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc |
@@ -73,6 +73,7 @@ class GLImageOzoneNativePixmapDmaBuf : public gfx::GLImageLinuxDMABuffer { |
gfx::OverlayTransform transform, |
const gfx::Rect& bounds_rect, |
const gfx::RectF& crop_rect) override { |
+ DCHECK_EQ(pixmap_->GetBufferUsage(), NativePixmap::SCANOUT); |
return pixmap_ && |
pixmap_->ScheduleOverlayPlane(widget, z_order, transform, |
bounds_rect, crop_rect); |
@@ -178,7 +179,8 @@ GpuMemoryBufferFactoryOzoneNativeBuffer:: |
~GpuMemoryBufferFactoryOzoneNativeBuffer() { |
} |
-bool GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( |
+gfx::GpuMemoryBufferHandle |
+GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( |
gfx::GpuMemoryBufferId id, |
const gfx::Size& size, |
gfx::GpuMemoryBuffer::Format format, |
@@ -193,11 +195,22 @@ bool GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( |
if (!pixmap.get()) { |
LOG(ERROR) << "Failed to create pixmap " << size.width() << "x" |
<< size.height() << " format " << format << ", usage " << usage; |
- return false; |
+ return gfx::GpuMemoryBufferHandle(); |
+ } |
+ |
+ gfx::GpuMemoryBufferHandle handle; |
+ handle.type = gfx::OZONE_NATIVE_BUFFER; |
+ handle.id = id; |
+ if (usage == gfx::GpuMemoryBuffer::MAP) { |
+ handle.handle = |
+ OzonePlatform::GetInstance()->GetSurfaceFactoryOzone()->ExportDmaBuf( |
spang
2015/07/24 22:08:25
What's the reason to have a SurfaceFactoryOzone::E
dshwang
2015/07/28 15:23:12
good point! Done.
|
+ surface_handle, pixmap); |
+ DCHECK(handle.handle.fd > 0) << "Fail to export dma_buf."; |
} |
+ |
base::AutoLock lock(native_pixmap_map_lock_); |
native_pixmap_map_[GetIndex(id, client_id)] = pixmap; |
- return true; |
+ return handle; |
} |
void GpuMemoryBufferFactoryOzoneNativeBuffer::DestroyGpuMemoryBuffer( |