chromium/components/viz/service/display/skia_renderer.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/viz/service/display/skia_renderer.h"

#include <limits>
#include <optional>
#include <string>
#include <utility>

#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/numerics/angle_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/base/math_util.h"
#include "cc/debug/debug_colors.h"
#include "cc/paint/render_surface_filters.h"
#include "components/viz/common/display/renderer_settings.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_util.h"
#include "components/viz/common/quads/aggregated_render_pass.h"
#include "components/viz/common/quads/aggregated_render_pass_draw_quad.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/debug_border_draw_quad.h"
#include "components/viz/common/quads/picture_draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/quads/tile_draw_quad.h"
#include "components/viz/common/quads/yuv_video_draw_quad.h"
#include "components/viz/common/resources/platform_color.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "components/viz/common/skia_helper.h"
#include "components/viz/service/debugger/viz_debugger.h"
#include "components/viz/service/display/delegated_ink_handler.h"
#include "components/viz/service/display/delegated_ink_point_renderer_skia.h"
#include "components/viz/service/display/display_resource_provider.h"
#include "components/viz/service/display/display_resource_provider_skia.h"
#include "components/viz/service/display/output_surface.h"
#include "components/viz/service/display/output_surface_frame.h"
#include "components/viz/service/display/renderer_utils.h"
#include "components/viz/service/display/resource_fence.h"
#include "components/viz/service/display/skia_output_surface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/common/swap_buffers_complete_params.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/config/gpu_finch_features.h"
#include "media/base/media_switches.h"
#include "skia/ext/opacity_filter_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkPixelRef.h"
#include "third_party/skia/include/core/SkShader.h"
#include "third_party/skia/include/core/SkString.h"
#include "third_party/skia/include/effects/SkColorMatrix.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "third_party/skia/include/effects/SkImageFilters.h"
#include "third_party/skia/include/effects/SkOverdrawColorFilter.h"
#include "third_party/skia/include/effects/SkRuntimeEffect.h"
#include "third_party/skia/include/effects/SkShaderMaskFilter.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/private/chromium/GrDeferredDisplayList.h"
#include "third_party/skia/modules/skcms/skcms.h"
#include "third_party/skia/src/core/SkCanvasPriv.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/color_transform.h"
#include "ui/gfx/geometry/axis_transform2d.h"
#include "ui/gfx/geometry/linear_gradient.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/geometry/transform_util.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gfx/hdr_metadata.h"

#if BUILDFLAG(IS_ANDROID)
#include "components/viz/service/display/overlay_processor_surface_control.h"
#endif

namespace viz {

namespace {

// Feature to temporarily create a dump in the case where we try and sample from
// a render pass that has never been drawn to.
// See: crbug.com/344458294, crbug.com/345673794
// TODO(crbug.com/347909405): Remove this
BASE_FEATURE();

#if BUILDFLAG(IS_WIN)
// Use BufferQueue for the primary plane instead of a DXGI swap chain or DComp
// surface.
BASE_FEATURE(kBufferQueue, "BufferQueue", base::FEATURE_DISABLED_BY_DEFAULT);
#endif

// Smallest unit that impacts anti-aliasing output. We use this to determine
// when an exterior edge (with AA) has been clipped (no AA). The specific value
// was chosen to match that used by gl_renderer.
static const float kAAEpsilon =;

// The gfx::QuadF draw_region passed to DoDrawQuad, converted to Skia types
struct SkDrawRegion {};

SkDrawRegion::SkDrawRegion(const gfx::QuadF& draw_region) {}

bool IsTextureResource(DisplayResourceProviderSkia* resource_provider,
                       ResourceId resource_id) {}

unsigned GetCornerAAFlags(const DrawQuad* quad,
                          const SkPoint& vertex,
                          unsigned edge_mask) {}

// This is slightly different than Transform::IsPositiveScaleAndTranslation()
// in that it also allows zero scales. This is because in the common
// orthographic case the z scale is 0.
bool Is2dScaleTranslateTransform(const gfx::Transform& transform) {}

bool IsExteriorEdge(unsigned corner_mask1, unsigned corner_mask2) {}

unsigned GetRectilinearEdgeFlags(const DrawQuad* quad) {}

// This also modifies draw_region to clean up any degeneracies
void GetClippedEdgeFlags(const DrawQuad* quad,
                         unsigned* edge_mask,
                         SkDrawRegion* draw_region) {}

bool IsAAForcedOff(const DrawQuad* quad) {}

bool UseNearestNeighborSampling(const DrawQuad* quad) {}

SkSamplingOptions GetSampling(const DrawQuad* quad) {}

// Returns kFast if sampling outside of vis_tex_coords due to AA or bilerp will
// not go outside of the content area, or if the content area is the full image
// (in which case hardware clamping handles it automatically). Different quad
// types have different rules for the content area within the image.
SkCanvas::SrcRectConstraint GetTextureConstraint(
    const SkImage* image,
    const gfx::RectF& vis_tex_coords,
    const gfx::RectF& valid_texel_bounds) {}

// Return a color filter that multiplies the incoming color by the fixed alpha
sk_sp<SkColorFilter> MakeOpacityFilter(float alpha, sk_sp<SkColorFilter> in) {}

// Porter-Duff blend mode utility functions, where the final color is
// represented as a weighted sum of the incoming src and existing dst color.
// See [https://skia.org/user/api/SkBlendMode_Reference]

bool IsPorterDuffBlendMode(SkBlendMode blendMode) {}

// Returns true if drawing transparent black with |blendMode| would modify the
// destination buffer. If false is returned, the draw would have no discernible
// effect on the pixel color so the entire draw can be skipped.
bool TransparentBlackAffectsOutput(SkBlendMode blendMode) {}

// Returns true if src content drawn with |blendMode| into a RenderPass would
// produce the exact same image as the original src content.
bool RenderPassPreservesContent(SkBlendMode blendMode) {}

// Returns true if src content draw with |blendMode| into an empty RenderPass
// would produce a transparent black image.
bool RenderPassRemainsTransparent(SkBlendMode blendMode) {}

SkYUVAInfo::Subsampling SubsamplingFromTextureSizes(gfx::Size ya_size,
                                                    gfx::Size uv_size) {}

#if BUILDFLAG(ENABLE_VULKAN) && BUILDFLAG(IS_CHROMEOS) && \
    BUILDFLAG(USE_V4L2_CODEC)
constexpr size_t kMaxProtectedContentWidth = 3840;
constexpr size_t kMaxProtectedContentHeight = 2160;
#endif

}  // namespace

// A helper class to emit Viz debugger messages that has access to SkiaRenderer
// internals.
class SkiaRenderer::VizDebuggerLog {};

SkiaRenderer::RenderPassBacking::RenderPassBacking() = default;

SkiaRenderer::RenderPassBacking::RenderPassBacking(
    const SkiaRenderer::RenderPassBacking&) = default;

SkiaRenderer::RenderPassBacking& SkiaRenderer::RenderPassBacking::operator=(
    const SkiaRenderer::RenderPassBacking&) = default;

SkiaRenderer::RenderPassBacking::RenderPassBacking(
    gfx::Size size,
    bool generate_mipmap,
    gfx::ColorSpace color_space,
    RenderPassAlphaType alpha_type,
    SharedImageFormat format,
    gpu::Mailbox mailbox,
    bool is_root,
    bool is_scanout,
    bool scanout_dcomp_surface)
    :{}
// chrome style prevents this from going in skia_renderer.h, but since it
// uses std::optional, the style also requires it to have a declared ctor
SkiaRenderer::BatchedQuadState::BatchedQuadState() = default;

// State calculated from a DrawQuad and current renderer state, that is common
// to all DrawQuad rendering.
struct SkiaRenderer::DrawQuadParams {};

SkiaRenderer::DrawQuadParams::DrawQuadParams(const gfx::Transform& cdt,
                                             const gfx::RectF& rect,
                                             const gfx::RectF& visible_rect,
                                             unsigned aa_flags,
                                             SkBlendMode blend_mode,
                                             float opacity,
                                             const SkSamplingOptions& sampling,
                                             const gfx::QuadF* draw_region)
    :{}

#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)
struct SkiaRenderer::RenderPassOverlayParams {};
#endif

enum class SkiaRenderer::BypassMode {};

// Scoped helper class for building SkImage from resource id.
class SkiaRenderer::ScopedSkImageBuilder {};

SkiaRenderer::ScopedSkImageBuilder::ScopedSkImageBuilder(
    SkiaRenderer* skia_renderer,
    ResourceId resource_id,
    bool maybe_concurrent_reads,
    SkAlphaType alpha_type,
    GrSurfaceOrigin origin,
    sk_sp<SkColorSpace> override_color_space,
    bool raw_draw_if_possible,
    bool force_rgbx) {}

class SkiaRenderer::ScopedYUVSkImageBuilder {};

// Parameters needed to draw a CompositorRenderPassDrawQuad.
struct SkiaRenderer::DrawRPDQParams {};

sk_sp<SkShader> SkiaRenderer::DrawRPDQParams::MaskShader::GetOrCreateSkShader(
    SkiaRenderer* renderer) const {}

void SkiaRenderer::DrawRPDQParams::SetBackdropFilterClip(
    SkCanvas* canvas,
    const DrawQuadParams* params) const {}

void SkiaRenderer::DrawRPDQParams::ClearOutsideBackdropBounds(
    SkCanvas* canvas,
    const DrawQuadParams* params) const {}

// A read lock based fence that is signaled after gpu commands are completed
// meaning the resource has been read.
// TODO(fangzhoug): Move this out of this file s.t. it can be referenced in
// display_resource_provider_skia_unittest.cc.
class SkiaRenderer::FrameResourceGpuCommandsCompletedFence
    : public ResourceFence {};

// FrameResourceFence that gets a ReleaseFence which is later set to returned
// resources.
// TODO(fangzhoug): Move this out of this file s.t. it can be referenced in
// display_resource_provider_skia_unittest.cc.
class SkiaRenderer::FrameResourceReleaseFence : public ResourceFence {};

SkiaRenderer::SkiaRenderer(const RendererSettings* settings,
                           const DebugRendererSettings* debug_settings,
                           OutputSurface* output_surface,
                           DisplayResourceProviderSkia* resource_provider,
                           OverlayProcessorInterface* overlay_processor,
                           SkiaOutputSurface* skia_output_surface)
    :{}

SkiaRenderer::~SkiaRenderer() = default;

bool SkiaRenderer::CanPartialSwap() {}

void SkiaRenderer::BeginDrawingFrame() {}

void SkiaRenderer::FinishDrawingFrame() {}

#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(ENABLE_VULKAN) && \
    BUILDFLAG(USE_V4L2_CODEC)
// Simple scheme for de-allocating protected buffers: if we go one SwapBuffer
// cycle without needing a protected shared image, we can delete the protected
// buffer queue.
gpu::Mailbox SkiaRenderer::GetProtectedSharedImage(bool is_10bit) {
  is_protected_pool_idle_ = false;

  protected_buffer_queue_->Reshape(
      gfx::Size(kMaxProtectedContentWidth, kMaxProtectedContentHeight),
      gfx::ColorSpace::CreateSRGB(), RenderPassAlphaType::kPremul,
      (is_10bit &&
       base::FeatureList::IsEnabled(media::kEnableArmHwdrm10bitOverlays))
          ? SinglePlaneFormat::kBGRA_1010102
          : SinglePlaneFormat::kBGRA_8888);

  return protected_buffer_queue_->GetCurrentBuffer();
}

void SkiaRenderer::MaybeFreeProtectedPool() {
  if (is_protected_pool_idle_ && protected_buffer_queue_) {
    protected_buffer_queue_->DestroyBuffers();
    skia_output_surface_->CleanupImageProcessor();
  } else {
    is_protected_pool_idle_ = true;
  }
}
#endif

void SkiaRenderer::SwapBuffers(SwapFrameData swap_frame_data) {}

void SkiaRenderer::SwapBuffersSkipped() {}

void SkiaRenderer::SwapBuffersComplete(
    const gpu::SwapBuffersCompleteParams& params,
    gfx::GpuFenceHandle release_fence) {}

void SkiaRenderer::BuffersPresented() {}

void SkiaRenderer::DidReceiveReleasedOverlays(
    const std::vector<gpu::Mailbox>& released_overlays) {}

void SkiaRenderer::EnsureScissorTestDisabled() {}

void SkiaRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) {}

void SkiaRenderer::ClearCanvas(SkColor4f color) {}

void SkiaRenderer::ClearFramebuffer() {}

bool SkiaRenderer::NeedsLayerForColorConversion(
    const AggregatedRenderPass* render_pass) {}

gfx::ColorSpace SkiaRenderer::CurrentDrawLayerColorSpace() const {}

void SkiaRenderer::BeginDrawingRenderPass(
    const AggregatedRenderPass* render_pass,
    bool needs_clear,
    const gfx::Rect& render_pass_update_rect,
    const gfx::Size& viewport_size) {}

void SkiaRenderer::DoDrawQuad(const DrawQuad* quad,
                              const gfx::QuadF* draw_region) {}

void SkiaRenderer::DrawQuadInternal(const DrawQuad* quad,
                                    const DrawRPDQParams* rpdq_params,
                                    DrawQuadParams* params) {}

void SkiaRenderer::PrepareCanvas(
    const std::optional<gfx::Rect>& scissor_rect,
    const std::optional<gfx::MaskFilterInfo>& mask_filter_info,
    const gfx::Transform* cdt) {}

#define MaskColor(a)

void SkiaRenderer::PrepareGradient(
    const std::optional<gfx::MaskFilterInfo>& mask_filter_info) {}

void SkiaRenderer::PrepareCanvasForRPDQ(const DrawRPDQParams& rpdq_params,
                                        DrawQuadParams* params) {}

void SkiaRenderer::PreparePaintOrCanvasForRPDQ(
    const DrawRPDQParams& rpdq_params,
    DrawQuadParams* params,
    SkPaint* paint) {}

void SkiaRenderer::PrepareColorOrCanvasForRPDQ(
    const DrawRPDQParams& rpdq_params,
    DrawQuadParams* params,
    SkColor4f* content_color) {}

SkiaRenderer::DrawQuadParams SkiaRenderer::CalculateDrawQuadParams(
    const gfx::AxisTransform2d& target_to_device,
    const std::optional<gfx::Rect>& scissor_rect,
    const DrawQuad* quad,
    const gfx::QuadF* draw_region) const {}

void SkiaRenderer::DrawQuadParams::ApplyScissor(
    const SkiaRenderer* renderer,
    const DrawQuad* quad,
    const std::optional<gfx::Rect>& scissor_to_apply) {}

const DrawQuad* SkiaRenderer::CanPassBeDrawnDirectly(
    const AggregatedRenderPass* pass,
    const RenderPassRequirements& requirements) {}

SkiaRenderer::BypassMode SkiaRenderer::CalculateBypassParams(
    const DrawQuad* bypass_quad,
    DrawRPDQParams* rpdq_params,
    DrawQuadParams* params) const {}

SkCanvas::ImageSetEntry SkiaRenderer::MakeEntry(
    const SkImage* image,
    int matrix_index,
    const DrawQuadParams& params) const {}

SkCanvas::SrcRectConstraint SkiaRenderer::ResolveTextureConstraints(
    const SkImage* image,
    const gfx::RectF& valid_texel_bounds,
    DrawQuadParams* params) const {}

bool SkiaRenderer::MustFlushBatchedQuads(const DrawQuad* new_quad,
                                         const DrawRPDQParams* rpdq_params,
                                         const DrawQuadParams& params) const {}

void SkiaRenderer::AddQuadToBatch(const SkImage* image,
                                  const gfx::RectF& valid_texel_bounds,
                                  DrawQuadParams* params) {}

void SkiaRenderer::FlushBatchedQuads() {}

void SkiaRenderer::DrawColoredQuad(SkColor4f color,
                                   const DrawRPDQParams* rpdq_params,
                                   DrawQuadParams* params) {}

void SkiaRenderer::DrawSingleImage(const SkImage* image,
                                   const gfx::RectF& valid_texel_bounds,
                                   const DrawRPDQParams* rpdq_params,
                                   SkPaint* paint,
                                   DrawQuadParams* params) {}

void SkiaRenderer::DrawPaintOpBuffer(
    const cc::PaintOpBuffer* buffer,
    const std::optional<SkColor4f>& clear_color,
    const TileDrawQuad* quad,
    const DrawQuadParams* params) {}

void SkiaRenderer::DrawDebugBorderQuad(const DebugBorderDrawQuad* quad,
                                       DrawQuadParams* params) {}

void SkiaRenderer::DrawPictureQuad(const PictureDrawQuad* quad,
                                   DrawQuadParams* params) {}

void SkiaRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad,
                                      const DrawRPDQParams* rpdq_params,
                                      DrawQuadParams* params) {}

void SkiaRenderer::DrawTextureQuad(const TextureDrawQuad* quad,
                                   const DrawRPDQParams* rpdq_params,
                                   DrawQuadParams* params) {}

void SkiaRenderer::DrawTileDrawQuad(const TileDrawQuad* quad,
                                    const DrawRPDQParams* rpdq_params,
                                    DrawQuadParams* params) {}

void SkiaRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
                                    const DrawRPDQParams* rpdq_params,
                                    DrawQuadParams* params) {}

void SkiaRenderer::DrawUnsupportedQuad(const DrawQuad* quad,
                                       const DrawRPDQParams* rpdq_params,
                                       DrawQuadParams* params) {}

void SkiaRenderer::ScheduleOverlays() {}

sk_sp<SkColorFilter> SkiaRenderer::GetColorSpaceConversionFilter(
    const gfx::ColorSpace& src,
    std::optional<uint32_t> src_bit_depth,
    std::optional<gfx::HDRMetadata> src_hdr_metadata,
    const gfx::ColorSpace& dst,
    bool is_video_frame) {}

namespace {
SkColorMatrix ToColorMatrix(const SkM44& mat) {}
}  // namespace

sk_sp<SkColorFilter> SkiaRenderer::GetContentColorFilter() {}

SkiaRenderer::DrawRPDQParams SkiaRenderer::CalculateRPDQParams(
    const gfx::AxisTransform2d& target_to_device,
    const AggregatedRenderPassDrawQuad* quad,
    const DrawQuadParams* params) {}

void SkiaRenderer::DrawRenderPassQuad(
    const AggregatedRenderPassDrawQuad* quad,
    const DrawRPDQParams* bypassed_rpdq_params,
    DrawQuadParams* params) {}

void SkiaRenderer::CopyDrawnRenderPass(
    const copy_output::RenderPassGeometry& geometry,
    std::unique_ptr<CopyOutputRequest> request) {}

void SkiaRenderer::DidChangeVisibility() {}

void SkiaRenderer::FinishDrawingRenderPass() {}

void SkiaRenderer::UpdateRenderPassTextures(
    const AggregatedRenderPassList& render_passes_in_draw_order,
    const base::flat_map<AggregatedRenderPassId, RenderPassRequirements>&
        render_passes_in_frame) {}

void SkiaRenderer::AllocateRenderPassResourceIfNeeded(
    const AggregatedRenderPassId& render_pass_id,
    const RenderPassRequirements& requirements) {}

void SkiaRenderer::FlushOutputSurface() {}

#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)
bool SkiaRenderer::CanSkipRenderPassOverlay(
    AggregatedRenderPassId render_pass_id,
    const AggregatedRenderPassDrawQuad* rpdq,
    RenderPassOverlayParams** output_render_pass_overlay) {}

std::optional<SkiaRenderer::RenderPassBacking>
SkiaRenderer::GetRenderPassBackingForDirectScanout(
    const AggregatedRenderPassId& render_pass_id) const {}

SkiaRenderer::RenderPassOverlayParams*
SkiaRenderer::GetOrCreateRenderPassOverlayBacking(
    AggregatedRenderPassId render_pass_id,
    const AggregatedRenderPassDrawQuad* rpdq,
    SharedImageFormat buffer_format,
    gfx::ColorSpace color_space,
    const gfx::Size& buffer_size) {}

void SkiaRenderer::PrepareRenderPassOverlay(
    OverlayProcessorInterface::PlatformOverlayCandidate* overlay) {}
#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)

void SkiaRenderer::EndPaint(const gfx::Rect& update_rect,
                            bool failed,
                            bool is_overlay) {}

bool SkiaRenderer::IsRenderPassResourceAllocated(
    const AggregatedRenderPassId& render_pass_id) const {}

gfx::Size SkiaRenderer::GetRenderPassBackingPixelSize(
    const AggregatedRenderPassId& render_pass_id) {}

gfx::Rect SkiaRenderer::GetRenderPassBackingDrawnRect(
    const AggregatedRenderPassId& render_pass_id) const {}

void SkiaRenderer::SetRenderPassBackingDrawnRect(
    const AggregatedRenderPassId& render_pass_id,
    const gfx::Rect& drawn_rect) {}

void SkiaRenderer::SetDelegatedInkPointRendererSkiaForTest(
    std::unique_ptr<DelegatedInkPointRendererSkia> renderer) {}

void SkiaRenderer::DrawDelegatedInkTrail() {}

DelegatedInkPointRendererBase* SkiaRenderer::GetDelegatedInkPointRenderer(
    bool create_if_necessary) {}

bool SkiaRenderer::SupportsBGRA() const {}

void SkiaRenderer::SetDelegatedInkMetadata(
    std::unique_ptr<gfx::DelegatedInkMetadata> metadata) {}

bool SkiaRenderer::UsingSkiaForDelegatedInk() const {}

gfx::Rect SkiaRenderer::GetCurrentFramebufferDamage() const {}

void SkiaRenderer::Reshape(const OutputSurface::ReshapeParams& reshape_params) {}

void SkiaRenderer::EnsureMinNumberOfBuffers(int n) {}

gpu::Mailbox SkiaRenderer::GetPrimaryPlaneOverlayTestingMailbox() {}

#if BUILDFLAG(IS_OZONE)

DBG_FLAG_FBOOL("delegated.overlay.background_candidate.colored",
               toggle_background_overlay_color)  // False by default.

void SkiaRenderer::MaybeScheduleBackgroundImage(
    OverlayProcessorInterface::CandidateList& overlay_list) {}

#endif  // BUILDFLAG(IS_OZONE)

#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)
SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef::
    ScopedInFlightRenderPassOverlayBackingRef(SkiaRenderer* renderer,
                                              const gpu::Mailbox& mailbox)
    :{}

void SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef::Reset() {}

SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef::
    ~ScopedInFlightRenderPassOverlayBackingRef() {}

SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef::
    ScopedInFlightRenderPassOverlayBackingRef(
        SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef&& other) {}

SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef&
SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef::
    ScopedInFlightRenderPassOverlayBackingRef::operator=(
        SkiaRenderer::ScopedInFlightRenderPassOverlayBackingRef&& other) {}
#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)

SkiaRenderer::OverlayLock::OverlayLock(
    DisplayResourceProvider* resource_provider,
    ResourceId resource_id) {}

SkiaRenderer::OverlayLock::~OverlayLock() = default;

SkiaRenderer::OverlayLock::OverlayLock(SkiaRenderer::OverlayLock&& other) {}

SkiaRenderer::OverlayLock& SkiaRenderer::OverlayLock::OverlayLock::operator=(
    SkiaRenderer::OverlayLock&& other) {}

#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)
SkiaRenderer::OverlayLock::OverlayLock(SkiaRenderer* renderer,
                                       const gpu::Mailbox& mailbox) {}
#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_WIN)

#if BUILDFLAG(IS_APPLE)
std::size_t SkiaRenderer::OverlayLockHash::operator()(
    const OverlayLock& o) const {
  return std::hash<gpu::Mailbox>{}(o.mailbox());
}

std::size_t SkiaRenderer::OverlayLockHash::operator()(
    const gpu::Mailbox& m) const {
  return std::hash<gpu::Mailbox>{}(m);
}

bool SkiaRenderer::OverlayLockKeyEqual::operator()(
    const OverlayLock& lhs,
    const OverlayLock& rhs) const {
  return lhs.mailbox() == rhs.mailbox();
}

bool SkiaRenderer::OverlayLockKeyEqual::operator()(
    const OverlayLock& lhs,
    const gpu::Mailbox& rhs) const {
  return lhs.mailbox() == rhs;
}
#endif

}  // namespace viz