Always create opaque Vulkan external semaphores in ExternalSemaphore [chromium/src : main]

24 views
Skip to first unread message

Peng Huang (Gerrit)

unread,
Aug 1, 2023, 9:50:04 AM8/1/23
to Quang Minh Phan, cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Austin Eng

Attention is currently required from: Austin Eng, Quang Minh Phan.

View Change

1 comment:

To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
Gerrit-Change-Number: 4689122
Gerrit-PatchSet: 14
Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Reviewer: Austin Eng <en...@chromium.org>
Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Zijie He <zij...@google.com>
Gerrit-Attention: Austin Eng <en...@chromium.org>
Gerrit-Attention: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Comment-Date: Tue, 01 Aug 2023 13:49:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Quang Minh Phan (Gerrit)

unread,
Aug 1, 2023, 9:51:22 AM8/1/23
to cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Peng Huang, Austin Eng

Attention is currently required from: Austin Eng, Peng Huang.

View Change

1 comment:

  • File gpu/command_buffer/service/external_semaphore_pool.cc:

    • VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT is now used on both Android and Linux so this no longer applies for IS_ANDROID.

To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
Gerrit-Change-Number: 4689122
Gerrit-PatchSet: 14
Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Reviewer: Austin Eng <en...@chromium.org>
Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Zijie He <zij...@google.com>
Gerrit-Attention: Peng Huang <peng...@chromium.org>
Gerrit-Attention: Austin Eng <en...@chromium.org>
Gerrit-Comment-Date: Tue, 01 Aug 2023 13:51:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Peng Huang <peng...@chromium.org>

Peng Huang (Gerrit)

unread,
Aug 1, 2023, 10:02:54 AM8/1/23
to Vasiliy Telezhnikov, cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Quang Minh Phan, Austin Eng

Attention is currently required from: Austin Eng, Quang Minh Phan, Vasiliy Telezhnikov.

Peng Huang would like Vasiliy Telezhnikov to review this change authored by Quang Minh Phan.

View Change

Always create opaque Vulkan external semaphores in ExternalSemaphore

Instead of relying on the platform VulkanImplementation to be using
opaque semaphores as the primary external semaphore handle type, we now
create opaque external semaphores directly to ensure that
ExternalVkImageBacking always work even if the VulkanImplementation is
using e.g. sync files as the primary external semaphore handle type.

Bug: 1411745
Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
---
M gpu/command_buffer/service/external_semaphore.cc
M gpu/command_buffer/service/external_semaphore_pool.cc
2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/gpu/command_buffer/service/external_semaphore.cc b/gpu/command_buffer/service/external_semaphore.cc
index 9c814e7..77154fa 100644
--- a/gpu/command_buffer/service/external_semaphore.cc
+++ b/gpu/command_buffer/service/external_semaphore.cc
@@ -81,14 +81,13 @@
// static
ExternalSemaphore ExternalSemaphore::Create(
viz::VulkanContextProvider* context_provider) {
- auto* implementation = context_provider->GetVulkanImplementation();
VkDevice device = context_provider->GetDeviceQueue()->GetVulkanDevice();

- VkSemaphore semaphore = implementation->CreateExternalSemaphore(device);
+ VkSemaphore semaphore = CreateVkOpaqueExternalSemaphore(device);
if (semaphore == VK_NULL_HANDLE)
return {};

- auto handle = implementation->GetSemaphoreHandle(device, semaphore);
+ auto handle = ExportVkOpaqueExternalSemaphore(device, semaphore);
if (!handle.is_valid()) {
vkDestroySemaphore(device, semaphore, /*pAllocator=*/nullptr);
return {};
diff --git a/gpu/command_buffer/service/external_semaphore_pool.cc b/gpu/command_buffer/service/external_semaphore_pool.cc
index b724c59..91bdba6d 100644
--- a/gpu/command_buffer/service/external_semaphore_pool.cc
+++ b/gpu/command_buffer/service/external_semaphore_pool.cc
@@ -15,11 +15,7 @@
namespace gpu {
namespace {

-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
-// On Android, semaphores are created with handle type
-// VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT. With this handle type,
-// the semaphore will not be reset to un-signalled state after waiting,
-// so semaphores cannot be reused on Android.
+#if BUILDFLAG(IS_FUCHSIA)
// On Fuchsia semaphores are passed to scenic as zx::event. Scenic doesn't reset
// them after waiting, so they would have to be reset explicitly to be reused.
// OTOH new semaphores are cheap, so reuse doesn't provide significant benefits.

To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
Gerrit-Change-Number: 4689122
Gerrit-PatchSet: 14
Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Reviewer: Austin Eng <en...@chromium.org>
Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Zijie He <zij...@google.com>
Gerrit-Attention: Austin Eng <en...@chromium.org>
Gerrit-Attention: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>

Peng Huang (Gerrit)

unread,
Aug 1, 2023, 10:02:59 AM8/1/23
to Quang Minh Phan, cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Vasiliy Telezhnikov, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Austin Eng

Attention is currently required from: Austin Eng, Quang Minh Phan, Vasiliy Telezhnikov.

View Change

1 comment:

  • Patchset:

To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
Gerrit-Change-Number: 4689122
Gerrit-PatchSet: 14
Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Reviewer: Austin Eng <en...@chromium.org>
Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Zijie He <zij...@google.com>
Gerrit-Attention: Austin Eng <en...@chromium.org>
Gerrit-Attention: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-Comment-Date: Tue, 01 Aug 2023 14:02:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Vasiliy Telezhnikov (Gerrit)

unread,
Aug 3, 2023, 2:52:16 PM8/3/23
to Quang Minh Phan, cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Peng Huang, Austin Eng

Attention is currently required from: Austin Eng, Peng Huang, Quang Minh Phan.

Patch set 14:Code-Review +1

View Change

1 comment:

  • File gpu/command_buffer/service/external_semaphore_pool.cc:

    • VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT is now used on both Android and Linux so this no lon […]

      GL_EXT_semaphore support on android is practically non-existent, so most of the time we're in a separate texture mode anyway.

      ExternalVkImage backing is only used on devices with vulkan, but not DrDc for the software videos. We probably should force those devices to yuv=>rgb conversion on cpu too, but it's out of the scope here.

      I believe before this change external memory path was actually broken if it would be supported, as GL_EXT_semaphore requires it to be OPAQUE_FD.

To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
Gerrit-Change-Number: 4689122
Gerrit-PatchSet: 14
Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Reviewer: Austin Eng <en...@chromium.org>
Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-CC: Zijie He <zij...@google.com>
Gerrit-Attention: Peng Huang <peng...@chromium.org>
Gerrit-Attention: Austin Eng <en...@chromium.org>
Gerrit-Attention: Quang Minh Phan <phanquan...@gmail.com>
Gerrit-Comment-Date: Thu, 03 Aug 2023 18:52:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Peng Huang <peng...@chromium.org>
Comment-In-Reply-To: Quang Minh Phan <phanquan...@gmail.com>

Quang Minh Phan (Gerrit)

unread,
Aug 3, 2023, 10:19:28 PM8/3/23
to cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Vasiliy Telezhnikov, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Peng Huang, Austin Eng

Attention is currently required from: Austin Eng, Peng Huang, Quang Minh Phan.

Patch set 14:Commit-Queue +2

View Change

    To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
    Gerrit-Change-Number: 4689122
    Gerrit-PatchSet: 14
    Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
    Gerrit-Reviewer: Austin Eng <en...@chromium.org>
    Gerrit-Reviewer: Peng Huang <peng...@chromium.org>
    Gerrit-Reviewer: Quang Minh Phan <phanquan...@gmail.com>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-CC: Zijie He <zij...@google.com>
    Gerrit-Attention: Peng Huang <peng...@chromium.org>
    Gerrit-Attention: Austin Eng <en...@chromium.org>
    Gerrit-Attention: Quang Minh Phan <phanquan...@gmail.com>
    Gerrit-Comment-Date: Fri, 04 Aug 2023 02:19:17 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes

    Chromium LUCI CQ (Gerrit)

    unread,
    Aug 3, 2023, 11:19:11 PM8/3/23
    to Quang Minh Phan, cblume...@chromium.org, emi...@google.com, fuchsia...@chromium.org, headless...@chromium.org, mac-r...@chromium.org, ozone-...@chromium.org, penghuan...@chromium.org, spang...@chromium.org, Vasiliy Telezhnikov, Zijie He, chromium...@chromium.org, David Worsham, Robert Kroeger, Peng Huang, Austin Eng

    Chromium LUCI CQ submitted this change.

    View Change

    Approvals: Quang Minh Phan: Commit Vasiliy Telezhnikov: Looks good to me
    Always create opaque Vulkan external semaphores in ExternalSemaphore

    Instead of relying on the platform VulkanImplementation to be using
    opaque semaphores as the primary external semaphore handle type, we now
    create opaque external semaphores directly to ensure that
    ExternalVkImageBacking always work even if the VulkanImplementation is
    using e.g. sync files as the primary external semaphore handle type.

    Bug: 1411745
    Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4689122
    Commit-Queue: Quang Minh Phan <phanquan...@gmail.com>
    Reviewed-by: Vasiliy Telezhnikov <vas...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1179417}

    To view, visit change 4689122. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia4bd9dbc2abaf89765db11bce89b6f618d1042e9
    Gerrit-Change-Number: 4689122
    Gerrit-PatchSet: 15
    Gerrit-Owner: Quang Minh Phan <phanquan...@gmail.com>
    Gerrit-Reviewer: Austin Eng <en...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Reply all
    Reply to author
    Forward
    0 new messages