Skip to content

Commit

Permalink
[//gpu] Pass ClientSI to GPU thread in SIIInProcess::DestroySI(ClientSI)
Browse files Browse the repository at this point in the history
In preparation for having ClientSharedImage own its associated GMB, this
CL passes the ClientSI instance given to SIIInProcess::DestroySI() to
the GPU thread. This ensures that it will stay alive until the Mailbox
is destroyed, which is when the GMB should be destroyed (and currently
is destroyed).

Bug: 1500611
Change-Id: I45888538ae024f3666d6ab0874349e3e19aca311
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5028360
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224797}
  • Loading branch information
colinblundell authored and Chromium LUCI CQ committed Nov 15, 2023
1 parent faf206c commit 178ad2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gpu/command_buffer/service/shared_image_interface_in_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,13 @@ void SharedImageInterfaceInProcess::DestroySharedImage(
const SyncToken& sync_token,
scoped_refptr<ClientSharedImage> client_shared_image) {
CHECK(client_shared_image->HasOneRef());
DestroySharedImage(sync_token, client_shared_image->mailbox());
// Use sync token dependency to ensure that the destroy task does not run
// before sync token is released.
ScheduleGpuTask(
base::BindOnce(
&SharedImageInterfaceInProcess::DestroyClientSharedImageOnGpuThread,
base::Unretained(this), std::move(client_shared_image)),
{sync_token});
}

void SharedImageInterfaceInProcess::DestroySharedImageOnGpuThread(
Expand All @@ -726,6 +732,11 @@ void SharedImageInterfaceInProcess::DestroySharedImageOnGpuThread(
}
}

void SharedImageInterfaceInProcess::DestroyClientSharedImageOnGpuThread(
scoped_refptr<ClientSharedImage> client_shared_image) {
DestroySharedImageOnGpuThread(client_shared_image->mailbox());
}

void SharedImageInterfaceInProcess::WaitSyncTokenOnGpuThread(
const SyncToken& sync_token) {
DCHECK_CALLED_ON_VALID_SEQUENCE(gpu_sequence_checker_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ class GPU_GLES2_EXPORT SharedImageInterfaceInProcess
void UpdateSharedImageOnGpuThread(const Mailbox& mailbox,
const SyncToken& sync_token);
void DestroySharedImageOnGpuThread(const Mailbox& mailbox);
void DestroyClientSharedImageOnGpuThread(
scoped_refptr<ClientSharedImage> client_shared_image);
void WaitSyncTokenOnGpuThread(const SyncToken& sync_token);
void WrapTaskWithGpuUrl(base::OnceClosure task);
void GetCapabilitiesOnGpu(base::WaitableEvent* completion,
Expand Down

0 comments on commit 178ad2e

Please sign in to comment.