diff options
Diffstat (limited to 'chromium/gpu/ipc/client')
4 files changed, 58 insertions, 7 deletions
diff --git a/chromium/gpu/ipc/client/client_shared_image_interface.cc b/chromium/gpu/ipc/client/client_shared_image_interface.cc index f9a9acbd066..dbfb3874876 100644 --- a/chromium/gpu/ipc/client/client_shared_image_interface.cc +++ b/chromium/gpu/ipc/client/client_shared_image_interface.cc @@ -40,8 +40,10 @@ void ClientSharedImageInterface::PresentSwapChain(const SyncToken& sync_token, #if defined(OS_FUCHSIA) void ClientSharedImageInterface::RegisterSysmemBufferCollection( gfx::SysmemBufferCollectionId id, - zx::channel token) { - proxy_->RegisterSysmemBufferCollection(id, std::move(token)); + zx::channel token, + gfx::BufferFormat format, + gfx::BufferUsage usage) { + proxy_->RegisterSysmemBufferCollection(id, std::move(token), format, usage); } void ClientSharedImageInterface::ReleaseSysmemBufferCollection( @@ -58,6 +60,11 @@ SyncToken ClientSharedImageInterface::GenVerifiedSyncToken() { return proxy_->GenVerifiedSyncToken(); } +void ClientSharedImageInterface::WaitSyncToken( + const gpu::SyncToken& sync_token) { + proxy_->WaitSyncToken(sync_token); +} + void ClientSharedImageInterface::Flush() { proxy_->Flush(); } @@ -124,6 +131,12 @@ uint32_t ClientSharedImageInterface::UsageForMailbox(const Mailbox& mailbox) { return proxy_->UsageForMailbox(mailbox); } +void ClientSharedImageInterface::NotifyMailboxAdded(const Mailbox& mailbox, + uint32_t usage) { + AddMailbox(mailbox); + proxy_->NotifyMailboxAdded(mailbox, usage); +} + Mailbox ClientSharedImageInterface::AddMailbox(const gpu::Mailbox& mailbox) { if (mailbox.IsZero()) return mailbox; diff --git a/chromium/gpu/ipc/client/client_shared_image_interface.h b/chromium/gpu/ipc/client/client_shared_image_interface.h index 78771d64ef4..64e6edca80a 100644 --- a/chromium/gpu/ipc/client/client_shared_image_interface.h +++ b/chromium/gpu/ipc/client/client_shared_image_interface.h @@ -32,11 +32,14 @@ class GPU_EXPORT ClientSharedImageInterface : public SharedImageInterface { const Mailbox& mailbox) override; #if defined(OS_FUCHSIA) void RegisterSysmemBufferCollection(gfx::SysmemBufferCollectionId id, - zx::channel token) override; + zx::channel token, + gfx::BufferFormat format, + gfx::BufferUsage usage) override; void ReleaseSysmemBufferCollection(gfx::SysmemBufferCollectionId id) override; #endif // defined(OS_FUCHSIA) SyncToken GenUnverifiedSyncToken() override; SyncToken GenVerifiedSyncToken() override; + void WaitSyncToken(const gpu::SyncToken& sync_token) override; void Flush() override; scoped_refptr<gfx::NativePixmap> GetNativePixmap( const Mailbox& mailbox) override; @@ -62,6 +65,7 @@ class GPU_EXPORT ClientSharedImageInterface : public SharedImageInterface { void DestroySharedImage(const SyncToken& sync_token, const Mailbox& mailbox) override; uint32_t UsageForMailbox(const Mailbox& mailbox) override; + void NotifyMailboxAdded(const Mailbox& mailbox, uint32_t usage) override; private: Mailbox AddMailbox(const Mailbox& mailbox); diff --git a/chromium/gpu/ipc/client/shared_image_interface_proxy.cc b/chromium/gpu/ipc/client/shared_image_interface_proxy.cc index 64b88276295..3085268e547 100644 --- a/chromium/gpu/ipc/client/shared_image_interface_proxy.cc +++ b/chromium/gpu/ipc/client/shared_image_interface_proxy.cc @@ -260,6 +260,28 @@ SyncToken SharedImageInterfaceProxy::GenUnverifiedSyncToken() { next_release_id_); } +void SharedImageInterfaceProxy::WaitSyncToken(const SyncToken& sync_token) { + if (!sync_token.HasData()) + return; + + std::vector<SyncToken> dependencies; + dependencies.push_back(sync_token); + SyncToken& new_token = dependencies.back(); + if (!new_token.verified_flush()) { + // Only allow unverified sync tokens for the same channel. + DCHECK_EQ(sync_token.namespace_id(), gpu::CommandBufferNamespace::GPU_IO); + int sync_token_channel_id = + ChannelIdFromCommandBufferId(sync_token.command_buffer_id()); + DCHECK_EQ(sync_token_channel_id, host_->channel_id()); + new_token.SetVerifyFlush(); + } + { + base::AutoLock lock(lock_); + last_flush_id_ = host_->EnqueueDeferredMessage(GpuChannelMsg_Nop(), + std::move(dependencies)); + } +} + void SharedImageInterfaceProxy::Flush() { base::AutoLock lock(lock_); host_->EnsureFlush(last_flush_id_); @@ -390,9 +412,11 @@ void SharedImageInterfaceProxy::PresentSwapChain(const SyncToken& sync_token, #if defined(OS_FUCHSIA) void SharedImageInterfaceProxy::RegisterSysmemBufferCollection( gfx::SysmemBufferCollectionId id, - zx::channel token) { - host_->Send( - new GpuChannelMsg_RegisterSysmemBufferCollection(route_id_, id, token)); + zx::channel token, + gfx::BufferFormat format, + gfx::BufferUsage usage) { + host_->Send(new GpuChannelMsg_RegisterSysmemBufferCollection( + route_id_, id, token, format, usage)); } void SharedImageInterfaceProxy::ReleaseSysmemBufferCollection( @@ -427,4 +451,10 @@ uint32_t SharedImageInterfaceProxy::UsageForMailbox(const Mailbox& mailbox) { return it->second; } +void SharedImageInterfaceProxy::NotifyMailboxAdded(const Mailbox& mailbox, + uint32_t usage) { + base::AutoLock lock(lock_); + AddMailbox(mailbox, usage); +} + } // namespace gpu diff --git a/chromium/gpu/ipc/client/shared_image_interface_proxy.h b/chromium/gpu/ipc/client/shared_image_interface_proxy.h index b22b61d3237..0ad687fde81 100644 --- a/chromium/gpu/ipc/client/shared_image_interface_proxy.h +++ b/chromium/gpu/ipc/client/shared_image_interface_proxy.h @@ -41,6 +41,7 @@ class SharedImageInterfaceProxy { void DestroySharedImage(const SyncToken& sync_token, const Mailbox& mailbox); SyncToken GenVerifiedSyncToken(); SyncToken GenUnverifiedSyncToken(); + void WaitSyncToken(const SyncToken& sync_token); void Flush(); SharedImageInterface::SwapChainMailboxes CreateSwapChain( @@ -52,13 +53,16 @@ class SharedImageInterfaceProxy { #if defined(OS_FUCHSIA) void RegisterSysmemBufferCollection(gfx::SysmemBufferCollectionId id, - zx::channel token); + zx::channel token, + gfx::BufferFormat format, + gfx::BufferUsage usage); void ReleaseSysmemBufferCollection(gfx::SysmemBufferCollectionId id); #endif // defined(OS_FUCHSIA) scoped_refptr<gfx::NativePixmap> GetNativePixmap(const gpu::Mailbox& mailbox); uint32_t UsageForMailbox(const Mailbox& mailbox); + void NotifyMailboxAdded(const Mailbox& mailbox, uint32_t usage); private: bool GetSHMForPixelData(base::span<const uint8_t> pixel_data, |