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

Unified Diff: gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc

Issue 1837703002: gpu: Export/import buffers created by Ozone GMB factory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move dup() to ShareGpuMemoryBufferToGpuProcess Created 4 years, 6 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: gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc
diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc b/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc
index 1d4f5f5fadecd74c7e3fb8db09f886d439723280..05aad59c588c8a3b6c2202709691bd23bc7dc07f 100644
--- a/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc
+++ b/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc
@@ -7,6 +7,7 @@
#include "ui/gl/gl_image_ozone_native_pixmap.h"
#include "ui/ozone/public/client_native_pixmap.h"
#include "ui/ozone/public/client_native_pixmap_factory.h"
+#include "ui/ozone/public/native_pixmap.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
@@ -41,14 +42,6 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBuffer(
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;
}
@@ -59,40 +52,15 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateGpuMemoryBufferFromHandle(
const gfx::Size& size,
gfx::BufferFormat format,
int client_id) {
- scoped_refptr<ui::NativePixmap> pixmap =
- ui::OzonePlatform::GetInstance()
- ->GetSurfaceFactoryOzone()
- ->CreateNativePixmapFromHandle(size, format,
- handle.native_pixmap_handle);
- if (!pixmap.get()) {
- DLOG(ERROR) << "Failed to create pixmap from handle";
- return gfx::GpuMemoryBufferHandle();
- }
-
+ // TODO(reveman): Remove implementation of this function when GMB import
+ // is handled client side.
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;
- }
-
+ new_handle.native_pixmap_handle = handle.native_pixmap_handle;
return new_handle;
}
-void GpuMemoryBufferFactoryOzoneNativePixmap::DestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- int client_id) {
- base::AutoLock lock(native_pixmaps_lock_);
- auto it = native_pixmaps_.find(NativePixmapMapKey(id.id, client_id));
- DCHECK(it != native_pixmaps_.end());
- native_pixmaps_.erase(it);
-}
-
ImageFactory* GpuMemoryBufferFactoryOzoneNativePixmap::AsImageFactory() {
return this;
}
@@ -105,15 +73,14 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateImageForGpuMemoryBuffer(
unsigned internalformat,
int client_id) {
DCHECK_EQ(handle.type, gfx::OZONE_NATIVE_PIXMAP);
- scoped_refptr<ui::NativePixmap> pixmap;
- {
- base::AutoLock lock(native_pixmaps_lock_);
- NativePixmapMap::iterator it =
- native_pixmaps_.find(NativePixmapMapKey(handle.id.id, client_id));
- if (it == native_pixmaps_.end()) {
- return nullptr;
- }
- pixmap = it->second;
+ scoped_refptr<ui::NativePixmap> pixmap =
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->CreateNativePixmapFromHandle(size, format,
+ handle.native_pixmap_handle);
+ if (!pixmap.get()) {
+ DLOG(ERROR) << "Failed to create pixmap from handle";
+ return nullptr;
}
scoped_refptr<gl::GLImageOzoneNativePixmap> image(
« no previous file with comments | « gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.h ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698