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

Unified Diff: components/mus/gles2/command_buffer_local.cc

Issue 1857243005: Scan-out capable buffers (aka ui::NativePixmap) for Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: components/mus/gles2/command_buffer_local.cc
diff --git a/components/mus/gles2/command_buffer_local.cc b/components/mus/gles2/command_buffer_local.cc
index 719ffddf7a7fdd1e5f059eb93c536864b460066a..6aee38e072f10898718f21af6f5e3a4b40c73a9e 100644
--- a/components/mus/gles2/command_buffer_local.cc
+++ b/components/mus/gles2/command_buffer_local.cc
@@ -233,44 +233,54 @@ int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer,
mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer =
mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
- gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
bool requires_sync_point = false;
- if (handle.type != gfx::SHARED_MEMORY_BUFFER) {
- requires_sync_point = true;
- NOTIMPLEMENTED();
- return -1;
- }
- base::SharedMemoryHandle dupd_handle =
- base::SharedMemory::DuplicateHandle(handle.handle);
+ if (gpu_memory_buffer->GetBufferType() == gfx::SHARED_MEMORY_BUFFER) {
+ gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
+ base::SharedMemoryHandle dupd_handle =
+ base::SharedMemory::DuplicateHandle(handle.handle);
Fady Samuel 2016/04/06 22:02:02 I don't think we need this. Please add a TODO to v
rjkroege 2016/04/06 22:45:45 Done.
#if defined(OS_WIN)
- HANDLE platform_handle = dupd_handle.GetHandle();
+ HANDLE platform_handle = dupd_handle.GetHandle();
#else
- int platform_handle = dupd_handle.fd;
+ int platform_handle = dupd_handle.fd;
#endif
- MojoHandle mojo_handle = MOJO_HANDLE_INVALID;
- MojoResult create_result =
- MojoCreatePlatformHandleWrapper(platform_handle, &mojo_handle);
- // |MojoCreatePlatformHandleWrapper()| always takes the ownership of the
- // |platform_handle|, so we don't need close |platform_handle|.
- if (create_result != MOJO_RESULT_OK) {
+ MojoHandle mojo_handle = MOJO_HANDLE_INVALID;
+ MojoResult create_result =
+ MojoCreatePlatformHandleWrapper(platform_handle, &mojo_handle);
+ // |MojoCreatePlatformHandleWrapper()| always takes the ownership of the
+ // |platform_handle|, so we don't need to close |platform_handle|.
+ if (create_result != MOJO_RESULT_OK) {
+ NOTIMPLEMENTED();
+ return -1;
+ }
+ mojo::ScopedHandle scoped_handle;
+ scoped_handle.reset(mojo::Handle(mojo_handle));
+
+ const int32_t format = static_cast<int32_t>(gpu_memory_buffer->GetFormat());
+ gpu_state_->command_buffer_task_runner()->PostTask(
+ driver_.get(),
+ base::Bind(&CommandBufferLocal::CreateImageOnGpuThread,
+ base::Unretained(this), new_id, base::Passed(&scoped_handle),
+ handle.type, base::Passed(&size), format, internal_format));
+ } else if (gpu_memory_buffer->GetBufferType() == gfx::OZONE_NATIVE_PIXMAP) {
+ gpu_state_->command_buffer_task_runner()->PostTask(
+ driver_.get(),
+ base::Bind(&CommandBufferLocal::CreateImageNativeOzoneOnGpuThread,
+ base::Unretained(this), new_id,
+ gpu_memory_buffer->GetBufferType(),
+ gpu_memory_buffer->GetSize(), gpu_memory_buffer->GetFormat(),
+ internal_format,
+ base::RetainedRef(gpu_memory_buffer->GetNativePixmap())));
+
+ } else {
NOTIMPLEMENTED();
return -1;
}
- mojo::ScopedHandle scoped_handle;
- scoped_handle.reset(mojo::Handle(mojo_handle));
-
- const int32_t format = static_cast<int32_t>(gpu_memory_buffer->GetFormat());
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::CreateImageOnGpuThread,
- base::Unretained(this), new_id, base::Passed(&scoped_handle),
- handle.type, base::Passed(&size), format, internal_format));
if (requires_sync_point) {
- NOTIMPLEMENTED();
+ NOTIMPLEMENTED() << "Require sync points";
// TODO(jam): need to support this if we support types other than
// SHARED_MEMORY_BUFFER.
// gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
@@ -511,6 +521,19 @@ bool CommandBufferLocal::CreateImageOnGpuThread(
return true;
}
+bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread(
+ int32_t id,
+ int32_t type,
+ gfx::Size size,
+ gfx::BufferFormat format,
+ uint32_t internal_format,
+ ui::NativePixmap* pixmap) {
+ DCHECK(driver_->IsScheduled());
+ driver_->CreateImageNativeOzone(id, type, size, format, internal_format,
+ pixmap);
+ return true;
+}
+
bool CommandBufferLocal::DestroyImageOnGpuThread(int32_t id) {
DCHECK(driver_->IsScheduled());
driver_->DestroyImage(id);

Powered by Google App Engine
This is Rietveld 408576698