#include "components/viz/service/display_embedder/skia_output_device_buffer_queue.h"
#include <iterator>
#include <memory>
#include <set>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
#include "base/feature_list.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "components/viz/common/features.h"
#include "components/viz/common/switches.h"
#include "components/viz/service/display/overlay_candidate.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_factory.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "gpu/command_buffer/service/skia_utils.h"
#include "gpu/config/gpu_finch_features.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/core/SkSurfaceProps.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gfx/swap_result.h"
#include "ui/gl/gl_fence.h"
#include "ui/gl/gl_surface.h"
#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace {
BASE_FEATURE(…);
base::TimeTicks g_last_reshape_failure = …;
NOINLINE void CheckForLoopFailuresBufferQueue() { … }
}
namespace viz {
class SkiaOutputDeviceBufferQueue::OverlayData { … };
SkiaOutputDeviceBufferQueue::SkiaOutputDeviceBufferQueue(
std::unique_ptr<OutputPresenter> presenter,
SkiaOutputSurfaceDependency* deps,
gpu::SharedImageRepresentationFactory* representation_factory,
gpu::MemoryTracker* memory_tracker,
const DidSwapBufferCompleteCallback& did_swap_buffer_complete_callback,
const ReleaseOverlaysCallback& release_overlays_callback)
: … { … }
SkiaOutputDeviceBufferQueue::~SkiaOutputDeviceBufferQueue() { … }
const SkiaOutputDeviceBufferQueue::OverlayData*
SkiaOutputDeviceBufferQueue::GetOrCreateOverlayData(const gpu::Mailbox& mailbox,
bool is_root_render_pass,
bool* is_existing) { … }
void SkiaOutputDeviceBufferQueue::ScheduleOverlays(
SkiaOutputSurface::OverlayList overlays) { … }
void SkiaOutputDeviceBufferQueue::Present(
const std::optional<gfx::Rect>& update_rect,
BufferPresentedCallback feedback,
OutputSurfaceFrame frame) { … }
void SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers(
const gfx::Size& size,
OutputSurfaceFrame frame,
std::vector<gpu::Mailbox> overlay_mailboxes,
gfx::SwapCompletionResult result) { … }
void SkiaOutputDeviceBufferQueue::PostReleaseOverlays() { … }
void SkiaOutputDeviceBufferQueue::ReleaseOverlays() { … }
gfx::Size SkiaOutputDeviceBufferQueue::GetSwapBuffersSize() { … }
bool SkiaOutputDeviceBufferQueue::Reshape(const ReshapeParams& params) { … }
void SkiaOutputDeviceBufferQueue::SetViewportSize(
const gfx::Size& viewport_size) { … }
SkSurface* SkiaOutputDeviceBufferQueue::BeginPaint(
std::vector<GrBackendSemaphore>* end_semaphores) { … }
void SkiaOutputDeviceBufferQueue::EndPaint() { … }
size_t SkiaOutputDeviceBufferQueue::OverlayDataHash::operator()(
const OverlayData& o) const { … }
size_t SkiaOutputDeviceBufferQueue::OverlayDataHash::operator()(
const gpu::Mailbox& m) const { … }
bool SkiaOutputDeviceBufferQueue::OverlayDataKeyEqual::operator()(
const OverlayData& lhs,
const OverlayData& rhs) const { … }
bool SkiaOutputDeviceBufferQueue::OverlayDataKeyEqual::operator()(
const OverlayData& lhs,
const gpu::Mailbox& rhs) const { … }
bool SkiaOutputDeviceBufferQueue::OverlayDataKeyEqual::operator()(
const gpu::Mailbox& lhs,
const OverlayData& rhs) const { … }
void SkiaOutputDeviceBufferQueue::SetVSyncDisplayID(int64_t display_id) { … }
}