Replace WrapNativeTextures() with WrapSharedImages()
As part of the ClientSharedImage refactorization, this CL replaces the usage of WrapNativeTextures() with WrapSharedImages() in GpuMemoryBufferVideoFramePool. Bug: 1494911 Change-Id: I470108851f9275a4cc4f7f0eff8b8f36aa9106c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5381365 Commit-Queue: Mingjing Zhang <mjzhang@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Cr-Commit-Position: refs/heads/main@{#1277846}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e533152012
commit
8b64b26d72
media
@ -486,7 +486,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapSharedImages(
|
||||
if (shared_images[i]) {
|
||||
frame->mailbox_holders_[i] = gpu::MailboxHolder(
|
||||
shared_images[i]->mailbox(), sync_token, texture_target);
|
||||
frame->shared_images_[i] = shared_images[i];
|
||||
frame->shared_images_[i] = shared_images[i]->MakeUnowned();
|
||||
}
|
||||
}
|
||||
frame->mailbox_holders_and_gmb_release_cb_ =
|
||||
|
@ -1248,7 +1248,7 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes];
|
||||
scoped_refptr<gpu::ClientSharedImage> shared_images[VideoFrame::kMaxPlanes];
|
||||
bool is_webgpu_compatible = false;
|
||||
// Set up the planes creating the mailboxes needed to refer to the textures.
|
||||
for (size_t plane = 0; plane < NumSharedImages(output_format_); plane++) {
|
||||
@ -1294,8 +1294,6 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
|
||||
}
|
||||
#endif
|
||||
|
||||
const gfx::BufferFormat buffer_format =
|
||||
GpuMemoryBufferFormat(output_format_, plane);
|
||||
// Bind the texture and create or rebind the image. This image may be read
|
||||
// via the raster interface for import into canvas and/or 2-copy import into
|
||||
// WebGL as well as potentially being read via the GLES interface for 1-copy
|
||||
@ -1342,26 +1340,25 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
|
||||
sii->UpdateSharedImage(frame_resources->sync_token,
|
||||
plane_resource.shared_image->mailbox());
|
||||
}
|
||||
auto texture_target = plane_resource.shared_image->GetTextureTarget(
|
||||
gfx::BufferUsage::SCANOUT_CPU_READ_WRITE, buffer_format);
|
||||
mailbox_holders[plane] =
|
||||
gpu::MailboxHolder(plane_resource.shared_image->mailbox(),
|
||||
gpu::SyncToken(), texture_target);
|
||||
shared_images[plane] = plane_resource.shared_image;
|
||||
}
|
||||
|
||||
// Insert a sync_token, this is needed to make sure that the textures the
|
||||
// mailboxes refer to will be used only after all the previous commands posted
|
||||
// in the SharedImageInterface have been processed.
|
||||
gpu::SyncToken sync_token = sii->GenUnverifiedSyncToken();
|
||||
for (size_t plane = 0; plane < NumSharedImages(output_format_); plane++)
|
||||
mailbox_holders[plane].sync_token = sync_token;
|
||||
const gfx::BufferFormat buffer_format =
|
||||
GpuMemoryBufferFormat(output_format_, 0);
|
||||
auto texture_target = shared_images[0]->GetTextureTarget(
|
||||
gfx::BufferUsage::SCANOUT_CPU_READ_WRITE, buffer_format);
|
||||
|
||||
VideoPixelFormat frame_format = VideoFormat(output_format_);
|
||||
|
||||
// Create the VideoFrame backed by native textures.
|
||||
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures(
|
||||
frame_format, mailbox_holders, VideoFrame::ReleaseMailboxCB(), coded_size,
|
||||
visible_rect, natural_size, timestamp);
|
||||
scoped_refptr<VideoFrame> frame = VideoFrame::WrapSharedImages(
|
||||
frame_format, shared_images, sync_token, texture_target,
|
||||
VideoFrame::ReleaseMailboxCB(), coded_size, visible_rect, natural_size,
|
||||
timestamp);
|
||||
|
||||
if (!frame) {
|
||||
frame_resources->MarkUnused(tick_clock_->NowTicks());
|
||||
|
Reference in New Issue
Block a user