0

[//media] Remove reverse killswitch for 2c upload of pure SW VideoFrames

Forcing upload of pure software VideoFrames to WebGL to be 2-copy rather
than 1-copy has been live in 120 stable for at least a month on all
platforms with no reported problems. This CL removes the reverse
killswitch that re-enables 1-copy upload.

Bug: b/40062791
Change-Id: Iac36ffcdeb2fe4a209f03d16c26f32ec9d5b4320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5266625
Reviewed-by: Frank Liberato <liberato@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1257244}
This commit is contained in:
Colin Blundell
2024-02-07 09:06:53 +00:00
committed by Chromium LUCI CQ
parent 5606082990
commit 6bfcaaa3c3

@ -742,28 +742,6 @@ BASE_FEATURE(kOneCopyUploadOfVideoFrameToGLTexture,
"OneCopyUploadOfVideoFrameToGLTexture",
base::FEATURE_ENABLED_BY_DEFAULT);
// Controls whether the one-copy path when copying a pure software VideoFrame
// (i.e., a VideoFrame with no textures) to a GL texture is enabled or disabled.
// It is not possible to support this codepath via MultiplanarSharedImage: these
// VideoFrames have format I420, and it is not possible across all platforms to
// upload the VideoFrame's data via raster to a MultiplanarSI with format I420
// that is accessible by WebGL. Such an SI must be backed by a native buffer to
// be accessible to WebGL, and native buffer-backed I420 SharedImages are in
// general not supported (and *cannot* be supported on Windows). 1-copy of pure
// software VideoFrames *is* supported in the legacy 1-copy implementation that
// uses legacy mailboxes to perform the copy, but we are in the process of
// eliminating this implementation. Whether 1 GPU-GPU copy or 2 GPU-GPU copies
// are performed for pure video software upload should not be a significant
// factor in performance, as dominant factor in terms of performance will be the
// fact that the VideoFrame's data needs to be uploaded from the CPU to the GPU.
// This Feature serves as a reverse-killswitch while we roll out the complete
// disabling of this codepath.
// TODO(crbug.com/1410164): Remove the usage of this feature disabling has
// safely rolled out.
BASE_FEATURE(kOneCopyUploadOfPureSoftwareVideoFrameToGLTexture,
"OneCopyUploadOfPureSoftwareVideoFrameToGLTexture",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kOneCopyLegacyMPVideoFrameUploadViaSI,
"OneCopyLegacyMPVideoFrameUploadViaSI",
base::FEATURE_ENABLED_BY_DEFAULT);
@ -1626,9 +1604,18 @@ bool PaintCanvasVideoRenderer::UploadVideoFrameToGLTexture(
return false;
}
if (!video_frame->HasTextures() &&
!base::FeatureList::IsEnabled(
kOneCopyUploadOfPureSoftwareVideoFrameToGLTexture)) {
// It is not possible to support one-copy upload of pure software VideoFrames
// via MultiplanarSharedImage: these VideoFrames have format I420, and it is
// not possible across all platforms to upload the VideoFrame's data via
// raster to a MultiplanarSI with format I420 that is accessible by WebGL.
// Such an SI must be backed by a native buffer to be accessible to WebGL, and
// native buffer-backed I420 SharedImages are in general not supported (and
// *cannot* be supported on Windows). NOTE: Whether 1 GPU-GPU copy or 2
// GPU-GPU copies are performed for pure video software upload should not be a
// significant factor in performance, as the dominant factor in terms of
// performance will be the fact that the VideoFrame's data needs to be
// uploaded from the CPU to the GPU.
if (!video_frame->HasTextures()) {
return false;
}
@ -1638,17 +1625,15 @@ bool PaintCanvasVideoRenderer::UploadVideoFrameToGLTexture(
// We use legacy mailboxes iff one of the following is true:
// * `destination_gl` does not support YUV-RGB conversion.
// * The VideoFrame is holding a legacy mailbox.
// * The VideoFrame is pure software.
// * The Video is not MultiplanarSI and the codepath to handle legacy
// multiplanar via ConvertYUVAMailboxesToTexture() is not enabled.
bool yuv_rgb_conversion_not_supported =
!destination_gl_capabilities.supports_yuv_to_rgb_conversion;
CHECK(video_frame->HasTextures());
bool video_frame_is_legacy_mailbox =
video_frame->HasTextures() &&
!video_frame->mailbox_holder(0).mailbox.IsSharedImage();
bool video_frame_is_pure_sw = !video_frame->HasTextures();
bool video_frame_is_not_mp_si =
video_frame_is_pure_sw ||
video_frame->shared_image_format_type() == SharedImageFormatType::kLegacy;
// It is not possible for VideoFrames holding legacy mailboxes to reach this
@ -1665,7 +1650,6 @@ bool PaintCanvasVideoRenderer::UploadVideoFrameToGLTexture(
bool use_legacy_mailboxes_for_upload =
yuv_rgb_conversion_not_supported || video_frame_is_legacy_mailbox ||
video_frame_is_pure_sw ||
(video_frame_is_not_mp_si &&
!base::FeatureList::IsEnabled(kOneCopyLegacyMPVideoFrameUploadViaSI));
@ -1712,10 +1696,8 @@ bool PaintCanvasVideoRenderer::UploadVideoFrameToGLTexture(
destination_gl->WaitSyncTokenCHROMIUM(
mailbox_holder.sync_token.GetConstData());
if (video_frame->HasTextures()) {
SynchronizeVideoFrameRead(std::move(video_frame), source_ri,
raster_context_provider->ContextSupport());
}
SynchronizeVideoFrameRead(std::move(video_frame), source_ri,
raster_context_provider->ContextSupport());
} else {
// Trigger resource allocation for dst texture to back SkSurface.
// Dst texture size should equal to video frame visible rect.
@ -1737,7 +1719,6 @@ bool PaintCanvasVideoRenderer::UploadVideoFrameToGLTexture(
video_frame->visible_rect().height(), flip_y,
mailbox_holder.mailbox.name);
} else {
CHECK(video_frame->HasTextures());
CHECK_LE(static_cast<int>(video_frame->NumTextures()),
SkYUVAInfo::kMaxPlanes);