0

[//ash] Guard RoundedDisplayFrameFactory SCANOUT usage by SI support

RoundedDisplayFrameFactory adds SCANOUT SharedImage usage in contexts
where overlays are not actually supported (e.g., Flex in production and
ChromeOS-on-Linux in testing). As a result, GLTextureImageBacking needs
to support SCANOUT usage even though it is not actually capable of
producing overlays.

This CL guards RoundedDisplayFrameFactory's addition of SCANOUT usage by
the relevant SharedImage support for scanout being present.  For safety,
this change is under a killswitch.

Bug: 330865436
Change-Id: I1fad4c3261291b360e8671295ebc22eceea81abd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5938547
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Zoraiz Naeem <zoraiznaeem@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1373573}
This commit is contained in:
Colin Blundell
2024-10-24 21:00:22 +00:00
committed by Chromium LUCI CQ
parent 65d738b9a7
commit b74efb8957
4 changed files with 26 additions and 6 deletions

@ -1,6 +1,7 @@
include_rules = [
"+gpu/command_buffer/client/client_shared_image.h",
"+gpu/command_buffer/client/gpu_memory_buffer_manager.h",
"+gpu/command_buffer/common/shared_image_capabilities.h",
"+gpu/command_buffer/client/shared_image_interface.h",
"+gpu/command_buffer/common/shared_image_usage.h",
]

@ -13,6 +13,7 @@
#include "ash/frame_sink/ui_resource_manager.h"
#include "ash/rounded_display/rounded_display_gutter.h"
#include "base/check.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "components/viz/common/quads/compositor_frame.h"
@ -23,7 +24,9 @@
#include "components/viz/common/resources/transferable_resource.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_capabilities.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/config/gpu_finch_features.h"
#include "ipc/common/surface_handle.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
@ -136,7 +139,18 @@ RoundedDisplayFrameFactory::CreateUiResource(const gfx::Size& size,
gpu::SharedImageUsageSet usage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ;
if (is_overlay) {
bool add_scanout_usage = is_overlay;
// Scanout usage should be added only if scanout of SharedImages is supported.
// However, historically this was not checked.
// TODO(crbug.com/330865436): Remove killswitch post-safe rollout.
if (base::FeatureList::IsEnabled(
features::
kRoundedDisplayAddScanoutUsageOnlyIfSupportedBySharedImage)) {
add_scanout_usage &= sii->GetCapabilities().supports_scanout_shared_images;
}
if (add_scanout_usage) {
usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT;
}

@ -361,12 +361,15 @@ BASE_FEATURE(kSkiaGraphiteDawnUseD3D12,
base::FEATURE_DISABLED_BY_DEFAULT);
#endif
// If enabled, SharedImages created for SW video frames have SCANOUT usage added
// only if SharedImageCapabilities indicates that there is support. Serves as
// killswitch for this rollout. Lives in //gpu as backings that are rolling out
// restrictions on supporting SCANOUT usage must check the value of this
// base::Feature.
// If enabled, SharedImages created for the impacted clients have SCANOUT usage
// added only if SharedImageCapabilities indicates that there is support. Serve
// as killswitches for these rollouts. Live in //gpu as backings that are
// rolling out restrictions on supporting SCANOUT usage must check the value of
// these base::Features.
// TODO(crbug.com/330865436): Remove post-safe rollout.
BASE_FEATURE(kRoundedDisplayAddScanoutUsageOnlyIfSupportedBySharedImage,
"RoundedDisplayAddScanoutUsageOnlyIfSupportedBySharedImage",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kSWVideoFrameAddScanoutUsageOnlyIfSupportedBySharedImage,
"SWVideoFrameAddScanoutUsageOnlyIfSupportedBySharedImage",
base::FEATURE_ENABLED_BY_DEFAULT);

@ -71,6 +71,8 @@ GPU_EXPORT extern const base::FeatureParam<bool>
GPU_EXPORT BASE_DECLARE_FEATURE(kSkiaGraphiteDawnUseD3D12);
#endif
GPU_EXPORT BASE_DECLARE_FEATURE(
kRoundedDisplayAddScanoutUsageOnlyIfSupportedBySharedImage);
GPU_EXPORT BASE_DECLARE_FEATURE(
kSWVideoFrameAddScanoutUsageOnlyIfSupportedBySharedImage);