#include "ui/ozone/platform/wayland/gpu/wayland_canvas_surface.h"
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/files/scoped_file.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/numerics/checked_math.h"
#include "base/posix/eintr_wrapper.h"
#include "base/process/memory.h"
#include "base/task/single_thread_task_runner.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h"
namespace ui {
namespace {
constexpr size_t kMaxNumberOfBuffers = …;
}
size_t CalculateStride(int width) { … }
class WaylandCanvasSurface::SharedMemoryBuffer { … };
class WaylandCanvasSurface::VSyncProvider : public gfx::VSyncProvider { … };
WaylandCanvasSurface::PendingFrame::PendingFrame(
uint32_t frame_id,
const gfx::Size& surface_size,
SwapBuffersCallback callback,
gfx::FrameData frame_data,
SharedMemoryBuffer* frame_buffer)
: … { … }
WaylandCanvasSurface::PendingFrame::~PendingFrame() { … }
WaylandCanvasSurface::WaylandCanvasSurface(
WaylandBufferManagerGpu* buffer_manager,
gfx::AcceleratedWidget widget)
: … { … }
WaylandCanvasSurface::~WaylandCanvasSurface() { … }
SkCanvas* WaylandCanvasSurface::GetCanvas() { … }
void WaylandCanvasSurface::ResizeCanvas(const gfx::Size& viewport_size,
float scale) { … }
void WaylandCanvasSurface::PresentCanvas(const gfx::Rect& damage) { … }
bool WaylandCanvasSurface::SupportsAsyncBufferSwap() const { … }
void WaylandCanvasSurface::OnSwapBuffers(SwapBuffersCallback swap_ack_callback,
gfx::FrameData data) { … }
std::unique_ptr<gfx::VSyncProvider>
WaylandCanvasSurface::CreateVSyncProvider() { … }
bool WaylandCanvasSurface::SupportsOverridePlatformSize() const { … }
void WaylandCanvasSurface::MaybeProcessUnsubmittedFrames() { … }
void WaylandCanvasSurface::OnSubmission(uint32_t frame_id,
const gfx::SwapResult& swap_result,
gfx::GpuFenceHandle release_fence) { … }
void WaylandCanvasSurface::OnPresentation(
uint32_t frame_id,
const gfx::PresentationFeedback& feedback) { … }
std::unique_ptr<WaylandCanvasSurface::SharedMemoryBuffer>
WaylandCanvasSurface::CreateSharedMemoryBuffer() { … }
}