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

Unified Diff: content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.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
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
index c7030d1b66b02dffe8d6d7d2751ea1ddd3c69cb2..042256223e442608815b79e826cb8918c041d95f 100644
--- a/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
+++ b/content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.cc
@@ -43,16 +43,16 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBuffer(
->GetSurfaceFactoryOzone()
->CreateNativePixmap(surface_handle, size, format, usage);
if (!pixmap.get()) {
- LOG(ERROR) << "Failed to create pixmap " << size.width() << "x"
- << size.height() << " format " << static_cast<int>(format)
- << ", usage " << static_cast<int>(usage);
+ DLOG(ERROR) << "Failed to create pixmap " << size.width() << "x"
+ << size.height() << " format " << static_cast<int>(format)
+ << ", usage " << static_cast<int>(usage);
return gfx::GpuMemoryBufferHandle();
}
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::OZONE_NATIVE_PIXMAP;
- handle.id = id;
- handle.native_pixmap_handle = pixmap->ExportHandle();
+ gfx::GpuMemoryBufferHandle new_handle;
+ new_handle.type = gfx::OZONE_NATIVE_PIXMAP;
+ new_handle.id = id;
+ new_handle.native_pixmap_handle = pixmap->ExportHandle();
{
base::AutoLock lock(native_pixmaps_lock_);
@@ -61,7 +61,7 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBuffer(
native_pixmaps_[key] = pixmap;
}
- return handle;
+ return new_handle;
}
gfx::GpuMemoryBufferHandle
@@ -71,8 +71,28 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBufferFromHandle(
const gfx::Size& size,
gfx::BufferFormat format,
int client_id) {
- NOTIMPLEMENTED();
- return gfx::GpuMemoryBufferHandle();
+ scoped_refptr<ui::NativePixmap> pixmap =
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->CreateNativePixmapFromHandle(handle.native_pixmap_handle);
+ if (!pixmap.get()) {
+ DLOG(ERROR) << "Failed to create pixmap from handle";
+ return gfx::GpuMemoryBufferHandle();
+ }
+
+ gfx::GpuMemoryBufferHandle new_handle;
+ new_handle.type = gfx::OZONE_NATIVE_PIXMAP;
+ new_handle.id = id;
+ new_handle.native_pixmap_handle = pixmap->ExportHandle();
+
+ {
+ base::AutoLock lock(native_pixmaps_lock_);
+ NativePixmapMapKey key(id.id, client_id);
+ DCHECK(native_pixmaps_.find(key) == native_pixmaps_.end());
+ native_pixmaps_[key] = pixmap;
+ }
+
+ return new_handle;
}
void GpuMemoryBufferFactoryOzoneNativePixmap::DestroyGpuMemoryBuffer(
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698