Commit 7c4b7d21 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Convert ui/ozone/public/mojom/wayland/wayland_buffer_manager.mojom to handle<platform>

Bug: 778317
Change-Id: I4e61655092747c02a18faae294d836876e6015a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063211Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742629}
parent 9fb7a501
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "base/message_loop/message_pump_type.h" #include "base/message_loop/message_pump_type.h"
#include "base/task/single_thread_task_executor.h" #include "base/task/single_thread_task_executor.h"
#include "mojo/core/embedder/embedder.h" #include "mojo/core/embedder/embedder.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h"
...@@ -132,9 +131,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -132,9 +131,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
EXPECT_CALL(*server.zwp_linux_dmabuf_v1(), CreateParams(_, _, _)); EXPECT_CALL(*server.zwp_linux_dmabuf_v1(), CreateParams(_, _, _));
auto* manager_host = connection->buffer_manager_host(); auto* manager_host = connection->buffer_manager_host();
manager_host->CreateDmabufBasedBuffer( manager_host->CreateDmabufBasedBuffer(
widget, mojo::WrapPlatformHandle(mojo::PlatformHandle(std::move(fd))), widget, mojo::PlatformHandle(std::move(fd)), buffer_size, strides,
buffer_size, strides, offsets, modifiers, kFormat, kPlaneCount, offsets, modifiers, kFormat, kPlaneCount, kBufferId);
kBufferId);
// Wait until the buffers are created. // Wait until the buffers are created.
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/message_loop/message_loop_current.h" #include "base/message_loop/message_loop_current.h"
#include "base/process/process.h" #include "base/process/process.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/linux/drm_util_linux.h" #include "ui/gfx/linux/drm_util_linux.h"
#include "ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h" #include "ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h"
...@@ -174,9 +173,8 @@ void WaylandBufferManagerGpu::CreateDmabufBasedBufferInternal( ...@@ -174,9 +173,8 @@ void WaylandBufferManagerGpu::CreateDmabufBasedBufferInternal(
DCHECK(io_thread_runner_->BelongsToCurrentThread()); DCHECK(io_thread_runner_->BelongsToCurrentThread());
DCHECK(remote_host_); DCHECK(remote_host_);
remote_host_->CreateDmabufBasedBuffer( remote_host_->CreateDmabufBasedBuffer(
mojo::WrapPlatformHandle(mojo::PlatformHandle(std::move(dmabuf_fd))), mojo::PlatformHandle(std::move(dmabuf_fd)), size, strides, offsets,
size, strides, offsets, modifiers, current_format, planes_count, modifiers, current_format, planes_count, buffer_id);
buffer_id);
} }
void WaylandBufferManagerGpu::CreateShmBasedBufferInternal( void WaylandBufferManagerGpu::CreateShmBasedBufferInternal(
...@@ -186,9 +184,8 @@ void WaylandBufferManagerGpu::CreateShmBasedBufferInternal( ...@@ -186,9 +184,8 @@ void WaylandBufferManagerGpu::CreateShmBasedBufferInternal(
uint32_t buffer_id) { uint32_t buffer_id) {
DCHECK(io_thread_runner_->BelongsToCurrentThread()); DCHECK(io_thread_runner_->BelongsToCurrentThread());
DCHECK(remote_host_); DCHECK(remote_host_);
remote_host_->CreateShmBasedBuffer( remote_host_->CreateShmBasedBuffer(mojo::PlatformHandle(std::move(shm_fd)),
mojo::WrapPlatformHandle(mojo::PlatformHandle(std::move(shm_fd))), length, length, size, buffer_id);
size, buffer_id);
} }
void WaylandBufferManagerGpu::CommitBufferInternal( void WaylandBufferManagerGpu::CommitBufferInternal(
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/linux/drm_util_linux.h" #include "ui/gfx/linux/drm_util_linux.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_drm.h" #include "ui/ozone/platform/wayland/host/wayland_drm.h"
...@@ -679,7 +678,7 @@ void WaylandBufferManagerHost::SetWaylandBufferManagerGpu( ...@@ -679,7 +678,7 @@ void WaylandBufferManagerHost::SetWaylandBufferManagerGpu(
} }
void WaylandBufferManagerHost::CreateDmabufBasedBuffer( void WaylandBufferManagerHost::CreateDmabufBasedBuffer(
mojo::ScopedHandle dmabuf_fd, mojo::PlatformHandle dmabuf_fd,
const gfx::Size& size, const gfx::Size& size,
const std::vector<uint32_t>& strides, const std::vector<uint32_t>& strides,
const std::vector<uint32_t>& offsets, const std::vector<uint32_t>& offsets,
...@@ -693,7 +692,7 @@ void WaylandBufferManagerHost::CreateDmabufBasedBuffer( ...@@ -693,7 +692,7 @@ void WaylandBufferManagerHost::CreateDmabufBasedBuffer(
TRACE_EVENT2("wayland", "WaylandBufferManagerHost::CreateDmabufBasedBuffer", TRACE_EVENT2("wayland", "WaylandBufferManagerHost::CreateDmabufBasedBuffer",
"Format", format, "Buffer id", buffer_id); "Format", format, "Buffer id", buffer_id);
base::ScopedFD fd = mojo::UnwrapPlatformHandle(std::move(dmabuf_fd)).TakeFD(); base::ScopedFD fd = dmabuf_fd.TakeFD();
// Validate data and ask surface to create a buffer associated with the // Validate data and ask surface to create a buffer associated with the
// |buffer_id|. // |buffer_id|.
...@@ -723,7 +722,7 @@ void WaylandBufferManagerHost::CreateDmabufBasedBuffer( ...@@ -723,7 +722,7 @@ void WaylandBufferManagerHost::CreateDmabufBasedBuffer(
} }
} }
void WaylandBufferManagerHost::CreateShmBasedBuffer(mojo::ScopedHandle shm_fd, void WaylandBufferManagerHost::CreateShmBasedBuffer(mojo::PlatformHandle shm_fd,
uint64_t length, uint64_t length,
const gfx::Size& size, const gfx::Size& size,
uint32_t buffer_id) { uint32_t buffer_id) {
...@@ -733,7 +732,7 @@ void WaylandBufferManagerHost::CreateShmBasedBuffer(mojo::ScopedHandle shm_fd, ...@@ -733,7 +732,7 @@ void WaylandBufferManagerHost::CreateShmBasedBuffer(mojo::ScopedHandle shm_fd,
TRACE_EVENT1("wayland", "WaylandBufferManagerHost::CreateShmBasedBuffer", TRACE_EVENT1("wayland", "WaylandBufferManagerHost::CreateShmBasedBuffer",
"Buffer id", buffer_id); "Buffer id", buffer_id);
base::ScopedFD fd = mojo::UnwrapPlatformHandle(std::move(shm_fd)).TakeFD(); base::ScopedFD fd = shm_fd.TakeFD();
// Validate data and create a buffer associated with the |buffer_id|. // Validate data and create a buffer associated with the |buffer_id|.
if (!ValidateDataFromGpu(fd, length, size, buffer_id) || if (!ValidateDataFromGpu(fd, length, size, buffer_id) ||
!CreateBuffer(size, buffer_id)) { !CreateBuffer(size, buffer_id)) {
......
...@@ -109,7 +109,7 @@ class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost, ...@@ -109,7 +109,7 @@ class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost,
// Called by the GPU and asks to import a wl_buffer based on a gbm file // Called by the GPU and asks to import a wl_buffer based on a gbm file
// descriptor using zwp_linux_dmabuf protocol. Check comments in the // descriptor using zwp_linux_dmabuf protocol. Check comments in the
// ui/ozone/public/mojom/wayland/wayland_connection.mojom. // ui/ozone/public/mojom/wayland/wayland_connection.mojom.
void CreateDmabufBasedBuffer(mojo::ScopedHandle dmabuf_fd, void CreateDmabufBasedBuffer(mojo::PlatformHandle dmabuf_fd,
const gfx::Size& size, const gfx::Size& size,
const std::vector<uint32_t>& strides, const std::vector<uint32_t>& strides,
const std::vector<uint32_t>& offsets, const std::vector<uint32_t>& offsets,
...@@ -120,7 +120,7 @@ class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost, ...@@ -120,7 +120,7 @@ class WaylandBufferManagerHost : public ozone::mojom::WaylandBufferManagerHost,
// Called by the GPU and asks to import a wl_buffer based on a shared memory // Called by the GPU and asks to import a wl_buffer based on a shared memory
// file descriptor using wl_shm protocol. Check comments in the // file descriptor using wl_shm protocol. Check comments in the
// ui/ozone/public/mojom/wayland/wayland_connection.mojom. // ui/ozone/public/mojom/wayland/wayland_connection.mojom.
void CreateShmBasedBuffer(mojo::ScopedHandle shm_fd, void CreateShmBasedBuffer(mojo::PlatformHandle shm_fd,
uint64_t length, uint64_t length,
const gfx::Size& size, const gfx::Size& size,
uint32_t buffer_id) override; uint32_t buffer_id) override;
......
...@@ -35,7 +35,7 @@ interface WaylandBufferManagerHost { ...@@ -35,7 +35,7 @@ interface WaylandBufferManagerHost {
// very first CommitBuffer request comes from viz to browser process. // very first CommitBuffer request comes from viz to browser process.
// If the buffer has been committed at least once, it is not possible to // If the buffer has been committed at least once, it is not possible to
// reassign it to another AcceleratedWidget. // reassign it to another AcceleratedWidget.
CreateDmabufBasedBuffer(handle dmabuf_fd, CreateDmabufBasedBuffer(handle<platform> dmabuf_fd,
gfx.mojom.Size size, gfx.mojom.Size size,
array<uint32> strides, array<uint32> strides,
array<uint32> offsets, array<uint32> offsets,
...@@ -52,7 +52,7 @@ interface WaylandBufferManagerHost { ...@@ -52,7 +52,7 @@ interface WaylandBufferManagerHost {
// very first CommitBuffer request comes from viz to browser process. If // very first CommitBuffer request comes from viz to browser process. If
// the buffer has been committed at least once, it is not possible to // the buffer has been committed at least once, it is not possible to
// reassign it to another AcceleratedWidget. // reassign it to another AcceleratedWidget.
CreateShmBasedBuffer(handle shm_fd, CreateShmBasedBuffer(handle<platform> shm_fd,
uint64 length, uint64 length,
gfx.mojom.Size size, gfx.mojom.Size size,
uint32 buffer_id); uint32 buffer_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment