#include "ui/ozone/platform/wayland/host/wayland_frame_manager.h"
#include <presentation-time-client-protocol.h>
#include <sync/sync.h>
#include <cstdint>
#include "base/containers/adapters.h"
#include "base/containers/fixed_flat_set.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "build/chromeos_buildflags.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rrect_f.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/overlay_priority_hint.h"
#include "ui/ozone/platform/wayland/host/surface_augmenter.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_backing.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_handle.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_subsurface.h"
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
namespace ui {
namespace {
constexpr uint32_t kMaxNumberOfFrames = …;
constexpr uint32_t kMaxFramesInFlight = …;
constexpr base::TimeDelta kPresentationFlushTimerDuration = …;
constexpr base::TimeDelta kPresentationFlushTimerStopThreshold = …;
constexpr char kBoundsRectNanOrInf[] = …;
bool potential_compositor_buffer_lock = …;
bool ValidateRect(const gfx::RectF& rect) { … }
uint32_t GetPresentationKindFlags(uint32_t flags) { … }
}
WaylandFrame::WaylandFrame(
uint32_t frame_id,
const gfx::FrameData& data,
WaylandSurface* root_surface,
wl::WaylandOverlayConfig root_config,
base::circular_deque<
std::pair<WaylandSubsurface*, wl::WaylandOverlayConfig>>
subsurfaces_to_overlays)
: … { … }
WaylandFrame::WaylandFrame(
WaylandSurface* root_surface,
wl::WaylandOverlayConfig root_config,
base::circular_deque<
std::pair<WaylandSubsurface*, wl::WaylandOverlayConfig>>
subsurfaces_to_overlays)
: … { … }
WaylandFrame::~WaylandFrame() = default;
WaylandFrameManager::WaylandFrameManager(WaylandWindow* window,
WaylandConnection* connection)
: … { … }
WaylandFrameManager::~WaylandFrameManager() { … }
void WaylandFrameManager::RecordFrame(std::unique_ptr<WaylandFrame> frame) { … }
void WaylandFrameManager::MaybeProcessPendingFrame() { … }
void WaylandFrameManager::PlayBackFrame(std::unique_ptr<WaylandFrame> frame) { … }
void WaylandFrameManager::DiscardFrame(std::unique_ptr<WaylandFrame> frame) { … }
bool WaylandFrameManager::ApplySurfaceConfigure(
WaylandFrame* frame,
WaylandSurface* surface,
wl::WaylandOverlayConfig& config,
bool set_opaque_region) { … }
void WaylandFrameManager::OnFrameDone(void* data,
wl_callback* callback,
uint32_t time) { … }
void WaylandFrameManager::HandleFrameCallback(wl_callback* callback) { … }
void WaylandFrameManager::OnSyncOutput(
void* data,
struct wp_presentation_feedback* presentation_feedback,
wl_output* output) { … }
void WaylandFrameManager::OnPresented(
void* data,
struct wp_presentation_feedback* presentation_feedback,
uint32_t tv_sec_hi,
uint32_t tv_sec_lo,
uint32_t tv_nsec,
uint32_t refresh,
uint32_t seq_hi,
uint32_t seq_lo,
uint32_t flags) { … }
void WaylandFrameManager::OnDiscarded(
void* data,
struct wp_presentation_feedback* presentation_feedback) { … }
void WaylandFrameManager::HandlePresentationFeedback(
struct wp_presentation_feedback* presentation_feedback,
const gfx::PresentationFeedback& feedback,
bool discarded) { … }
void WaylandFrameManager::VerifyNumberOfSubmittedFrames() { … }
bool WaylandFrameManager::EnsureWlBuffersExist(WaylandFrame& frame) { … }
void WaylandFrameManager::OnExplicitBufferRelease(WaylandSurface* surface,
wl_buffer* buffer,
base::ScopedFD fence) { … }
void WaylandFrameManager::OnWlBufferRelease(WaylandSurface* surface,
wl_buffer* buffer) { … }
void WaylandFrameManager::MaybeProcessSubmittedFrames() { … }
void WaylandFrameManager::ProcessOldSubmittedFrame(WaylandFrame* frame) { … }
std::vector<wl::WaylandPresentationInfo>
WaylandFrameManager::GetReadyPresentations() { … }
bool WaylandFrameManager::HaveReadyPresentations() const { … }
void WaylandFrameManager::ClearProcessedSubmittedFrames() { … }
void WaylandFrameManager::FreezeTimeout() { … }
void WaylandFrameManager::Hide() { … }
void WaylandFrameManager::ClearStates() { … }
base::TimeDelta
WaylandFrameManager::GetPresentationFlushTimerDurationForTesting() { … }
void WaylandFrameManager::UpdatePresentationFlushTimer() { … }
void WaylandFrameManager::OnPresentationFlushTimerFired() { … }
}