0

Cleanup gl::GLSurface

Now that on screen gl::GLSurface can be surfaceless only on Windows
some code is not reachable anymore.

Bug: 1380884
Change-Id: I568a31c79fdf3bdabb670d909381b20a9f2aee4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4113982
Reviewed-by: Robert Kroeger <rjkroege@chromium.org>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1113691}
This commit is contained in:
Vasiliy Telezhnikov
2023-03-07 00:35:30 +00:00
committed by Chromium LUCI CQ
parent 704d0287d3
commit 44e77f4eb5
19 changed files with 28 additions and 306 deletions

@ -157,7 +157,6 @@ class ImageTransferCacheEntryTest
void TearDown() override {
DeletePendingTextures();
gr_context_.reset();
surface_->PrepareToDestroy(gl_context_->IsCurrent(surface_.get()));
surface_.reset();
gl_context_.reset();
share_group_.reset();

@ -258,7 +258,6 @@ SkiaOutputDeviceDCompGLSurface::SkiaOutputDeviceDCompGLSurface(
DCHECK(gl_surface_->SupportsDCLayers());
DCHECK_EQ(gl_surface_->GetOrigin(), gfx::SurfaceOrigin::kTopLeft);
DCHECK(gl_surface_->SupportsGpuVSync());
DCHECK(!gl_surface_->SupportsCommitOverlayPlanes());
capabilities_.supports_post_sub_buffer = gl_surface_->SupportsPostSubBuffer();
capabilities_.supports_delegated_ink = gl_surface_->SupportsDelegatedInk();
@ -639,7 +638,7 @@ bool SkiaOutputDeviceDCompPresenter::ScheduleDCLayer(
void SkiaOutputDeviceDCompPresenter::DoPresent(
const gfx::Rect& rect,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::Presenter::SwapCompletionCallback completion_callback,
BufferPresentedCallback feedback,
gfx::FrameData data) {
if (!ScheduleRootSurfaceAsOverlay()) {

@ -16,12 +16,12 @@
#include "components/viz/service/display_embedder/skia_output_device.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "ui/gfx/frame_data.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/presenter.h"
namespace gl {
class DCLayerOverlayImage;
struct DCLayerOverlayParams;
class GLSurface;
} // namespace gl
namespace gpu {
@ -180,7 +180,7 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceDCompPresenter final
bool ScheduleDCLayer(
std::unique_ptr<gl::DCLayerOverlayParams> params) override;
void DoPresent(const gfx::Rect& rect,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::Presenter::SwapCompletionCallback completion_callback,
BufferPresentedCallback feedback,
gfx::FrameData data) override;

@ -69,8 +69,7 @@ SkiaOutputDeviceGL::SkiaOutputDeviceGL(
}
capabilities_.pending_swap_params.max_pending_swaps =
gl_surface_->GetBufferCount() - 1;
capabilities_.supports_commit_overlay_planes =
gl_surface_->SupportsCommitOverlayPlanes();
capabilities_.supports_commit_overlay_planes = false;
capabilities_.supports_gpu_vsync = gl_surface_->SupportsGpuVSync();
#if BUILDFLAG(IS_ANDROID)
// TODO(weiliangc): This capability is used to check whether we should do
@ -272,28 +271,6 @@ void SkiaOutputDeviceGL::PostSubBuffer(const gfx::Rect& rect,
}
}
void SkiaOutputDeviceGL::CommitOverlayPlanes(BufferPresentedCallback feedback,
OutputSurfaceFrame frame) {
StartSwapBuffers({});
gfx::Size surface_size =
gfx::Size(sk_surface_->width(), sk_surface_->height());
auto data = frame.data;
if (supports_async_swap_) {
auto callback = base::BindOnce(
&SkiaOutputDeviceGL::DoFinishSwapBuffersAsync,
weak_ptr_factory_.GetWeakPtr(), surface_size, std::move(frame));
gl_surface_->CommitOverlayPlanesAsync(std::move(callback),
std::move(feedback), data);
} else {
gfx::SwapResult result =
gl_surface_->CommitOverlayPlanes(std::move(feedback), data);
DoFinishSwapBuffers(surface_size, std::move(frame),
gfx::SwapCompletionResult(result));
}
}
void SkiaOutputDeviceGL::DoFinishSwapBuffersAsync(
const gfx::Size& size,
OutputSurfaceFrame frame,

@ -52,8 +52,6 @@ class SkiaOutputDeviceGL final : public SkiaOutputDevice {
void PostSubBuffer(const gfx::Rect& rect,
BufferPresentedCallback feedback,
OutputSurfaceFrame frame) override;
void CommitOverlayPlanes(BufferPresentedCallback feedback,
OutputSurfaceFrame frame) override;
void EnsureBackbuffer() override;
void DiscardBackbuffer() override;
SkSurface* BeginPaint(

@ -1981,8 +1981,6 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffersInternal(
if (frame) {
if (gl_surface_) {
gl_surface_->SetChoreographerVsyncIdForNextFrame(
frame->choreographer_vsync_id);
if (frame->delegated_ink_metadata) {
gl_surface_->SetDelegatedInkTrailStartPoint(
std::move(frame->delegated_ink_metadata));
@ -2239,8 +2237,6 @@ void SkiaOutputSurfaceImplOnGpu::CheckReadbackCompletion() {
}
void SkiaOutputSurfaceImplOnGpu::PreserveChildSurfaceControls() {
if (gl_surface_)
gl_surface_->PreserveChildSurfaceControls();
if (presenter_) {
presenter_->PreserveChildSurfaceControls();
}

@ -3583,10 +3583,6 @@ gpu::ContextResult GLES2DecoderImpl::Initialize(
context_ = context;
surface_ = surface;
// Set workarounds for the surface.
if (workarounds().rely_on_implicit_sync_for_swap_buffers)
surface_->SetRelyOnImplicitSync();
// Create GPU Tracer for timing values.
gpu_tracer_ = std::make_unique<GPUTracer>(this);
@ -5324,11 +5320,6 @@ void GLES2DecoderImpl::Destroy(bool have_context) {
DCHECK(!have_context || context_->IsCurrent(nullptr));
// Prepare to destroy the surface while the context is still current, because
// some surface destructors make GL calls.
if (surface_)
surface_->PrepareToDestroy(have_context);
#if !BUILDFLAG(IS_ANDROID)
// Destroy any textures that are pending destruction.
if (!have_context) {

@ -28,6 +28,7 @@
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/init/gl_factory.h"

@ -493,11 +493,6 @@ bool InProcessCommandBuffer::DestroyOnGpuThread() {
if (have_context)
cache_use = CreateCacheUse();
// Prepare to destroy the surface while the context is still current, because
// some surface destructors make GL calls.
if (surface_)
surface_->PrepareToDestroy(have_context);
if (decoder_) {
decoder_->Destroy(have_context);
decoder_.reset();

@ -145,38 +145,6 @@ void PassThroughImageTransportSurface::PostSubBufferAsync(
data);
}
gfx::SwapResult PassThroughImageTransportSurface::CommitOverlayPlanes(
PresentationCallback callback,
gfx::FrameData data) {
gfx::SwapResponse response;
StartSwapBuffers(&response);
gfx::SwapResult result = gl::GLSurfaceAdapter::CommitOverlayPlanes(
base::BindOnce(&PassThroughImageTransportSurface::BufferPresented,
weak_ptr_factory_.GetWeakPtr(), std::move(callback),
local_swap_id_),
data);
response.result = result;
FinishSwapBuffers(response, local_swap_id_,
/*release_fence=*/gfx::GpuFenceHandle());
return result;
}
void PassThroughImageTransportSurface::CommitOverlayPlanesAsync(
SwapCompletionCallback callback,
PresentationCallback presentation_callback,
gfx::FrameData data) {
gfx::SwapResponse response;
StartSwapBuffers(&response);
gl::GLSurfaceAdapter::CommitOverlayPlanesAsync(
base::BindOnce(&PassThroughImageTransportSurface::FinishSwapBuffersAsync,
weak_ptr_factory_.GetWeakPtr(), std::move(callback),
response, local_swap_id_),
base::BindOnce(&PassThroughImageTransportSurface::BufferPresented,
weak_ptr_factory_.GetWeakPtr(),
std::move(presentation_callback), local_swap_id_),
data);
}
void PassThroughImageTransportSurface::SetVSyncEnabled(bool enabled) {
if (vsync_enabled_ == enabled)
return;

@ -55,11 +55,6 @@ class PassThroughImageTransportSurface : public gl::GLSurfaceAdapter {
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) override;
gfx::SwapResult CommitOverlayPlanes(PresentationCallback callback,
gfx::FrameData data) override;
void CommitOverlayPlanesAsync(SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) override;
void SetVSyncEnabled(bool enabled) override;
private:

@ -47,8 +47,6 @@ bool GLSurface::Initialize(GLSurfaceFormat format) {
return true;
}
void GLSurface::PrepareToDestroy(bool have_context) {}
bool GLSurface::Resize(const gfx::Size& size,
float scale_factor,
const gfx::ColorSpace& color_space,
@ -74,10 +72,6 @@ bool GLSurface::SupportsPostSubBuffer() {
return false;
}
bool GLSurface::SupportsCommitOverlayPlanes() {
return false;
}
bool GLSurface::SupportsAsyncSwap() {
return false;
}
@ -118,19 +112,6 @@ void GLSurface::PostSubBufferAsync(int x,
NOTREACHED();
}
gfx::SwapResult GLSurface::CommitOverlayPlanes(PresentationCallback callback,
gfx::FrameData data) {
NOTREACHED();
return gfx::SwapResult::SWAP_FAILED;
}
void GLSurface::CommitOverlayPlanesAsync(
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) {
NOTREACHED();
}
bool GLSurface::OnMakeCurrent(GLContext* context) {
return true;
}
@ -163,19 +144,6 @@ gfx::VSyncProvider* GLSurface::GetVSyncProvider() {
void GLSurface::SetVSyncEnabled(bool enabled) {}
bool GLSurface::ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data) {
NOTIMPLEMENTED();
return false;
}
bool GLSurface::ScheduleCALayer(const ui::CARendererLayerParams& params) {
NOTIMPLEMENTED();
return false;
}
bool GLSurface::ScheduleDCLayer(std::unique_ptr<DCLayerOverlayParams> params) {
NOTIMPLEMENTED();
return false;
@ -190,10 +158,6 @@ bool GLSurface::IsSurfaceless() const {
return false;
}
bool GLSurface::SupportsViewporter() const {
return false;
}
gfx::SurfaceOrigin GLSurface::GetOrigin() const {
return gfx::SurfaceOrigin::kBottomLeft;
}
@ -222,12 +186,6 @@ gfx::Vector2d GLSurface::GetDrawOffset() const {
return gfx::Vector2d();
}
void GLSurface::SetRelyOnImplicitSync() {
// Some GLSurface derived classes might not implement this workaround while
// still being allocated on devices where the workaround is enabled.
// It is fine to ignore this call in those cases.
}
bool GLSurface::SupportsSwapTimestamps() const {
return false;
}
@ -320,10 +278,6 @@ bool GLSurface::ExtensionsContain(const char* c_extensions, const char* name) {
GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {}
void GLSurfaceAdapter::PrepareToDestroy(bool have_context) {
surface_->PrepareToDestroy(have_context);
}
bool GLSurfaceAdapter::Initialize(GLSurfaceFormat format) {
return surface_->Initialize(format);
}
@ -394,32 +348,13 @@ void GLSurfaceAdapter::PostSubBufferAsync(
std::move(presentation_callback), data);
}
gfx::SwapResult GLSurfaceAdapter::CommitOverlayPlanes(
PresentationCallback callback,
gfx::FrameData data) {
return surface_->CommitOverlayPlanes(std::move(callback), data);
}
void GLSurfaceAdapter::CommitOverlayPlanesAsync(
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) {
surface_->CommitOverlayPlanesAsync(std::move(completion_callback),
std::move(presentation_callback), data);
}
bool GLSurfaceAdapter::SupportsSwapBuffersWithBounds() {
return surface_->SupportsSwapBuffersWithBounds();
}
bool GLSurfaceAdapter::SupportsPostSubBuffer() {
return surface_->SupportsPostSubBuffer();
}
bool GLSurfaceAdapter::SupportsCommitOverlayPlanes() {
return surface_->SupportsCommitOverlayPlanes();
}
bool GLSurfaceAdapter::SupportsAsyncSwap() {
return surface_->SupportsAsyncSwap();
}
@ -432,10 +367,6 @@ void* GLSurfaceAdapter::GetHandle() {
return surface_->GetHandle();
}
void GLSurfaceAdapter::PreserveChildSurfaceControls() {
surface_->PreserveChildSurfaceControls();
}
unsigned int GLSurfaceAdapter::GetBackingFramebufferObject() {
return surface_->GetBackingFramebufferObject();
}
@ -476,14 +407,6 @@ void GLSurfaceAdapter::SetVSyncEnabled(bool enabled) {
surface_->SetVSyncEnabled(enabled);
}
bool GLSurfaceAdapter::ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data) {
return surface_->ScheduleOverlayPlane(std::move(image), std::move(gpu_fence),
overlay_plane_data);
}
bool GLSurfaceAdapter::ScheduleDCLayer(
std::unique_ptr<DCLayerOverlayParams> params) {
return surface_->ScheduleDCLayer(std::move(params));
@ -497,10 +420,6 @@ bool GLSurfaceAdapter::IsSurfaceless() const {
return surface_->IsSurfaceless();
}
bool GLSurfaceAdapter::SupportsViewporter() const {
return surface_->SupportsViewporter();
}
gfx::SurfaceOrigin GLSurfaceAdapter::GetOrigin() const {
return surface_->GetOrigin();
}
@ -529,10 +448,6 @@ gfx::Vector2d GLSurfaceAdapter::GetDrawOffset() const {
return surface_->GetDrawOffset();
}
void GLSurfaceAdapter::SetRelyOnImplicitSync() {
surface_->SetRelyOnImplicitSync();
}
bool GLSurfaceAdapter::SupportsSwapTimestamps() const {
return surface_->SupportsSwapTimestamps();
}
@ -557,19 +472,10 @@ void GLSurfaceAdapter::SetGpuVSyncEnabled(bool enabled) {
surface_->SetGpuVSyncEnabled(enabled);
}
void GLSurfaceAdapter::SetDisplayTransform(gfx::OverlayTransform transform) {
return surface_->SetDisplayTransform(transform);
}
void GLSurfaceAdapter::SetFrameRate(float frame_rate) {
surface_->SetFrameRate(frame_rate);
}
void GLSurfaceAdapter::SetChoreographerVsyncIdForNextFrame(
absl::optional<int64_t> choreographer_vsync_id) {
surface_->SetChoreographerVsyncIdForNextFrame(choreographer_vsync_id);
}
void GLSurfaceAdapter::SetCurrent() {
surface_->SetCurrent();
}

@ -48,34 +48,15 @@ namespace mojom {
class DelegatedInkPointRenderer;
} // namespace mojom
class ColorSpace;
struct OverlayPlaneData;
class GpuFence;
class VSyncProvider;
} // namespace gfx
namespace ui {
struct CARendererLayerParams;
} // namespace ui
namespace gl {
struct DCLayerOverlayParams;
class GLContext;
class GLImage;
class EGLTimestampClient;
// OverlayImage is a platform specific type for overlay plane image data.
#if BUILDFLAG(IS_OZONE)
using OverlayImage = scoped_refptr<gfx::NativePixmap>;
#elif BUILDFLAG(IS_APPLE)
using OverlayImage = gfx::ScopedIOSurface;
#elif BUILDFLAG(IS_ANDROID)
using OverlayImage =
std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>;
#else
using OverlayImage = GLImage*;
#endif
// Encapsulates a surface that can be rendered to with GL, hiding platform
// specific management.
class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
@ -101,12 +82,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
// Destroys the surface.
virtual void Destroy() = 0;
// Some implementations (macOS), in Destroy, will need to delete GL objects
// that exist in the current GL context. This method is called before the
// context's decoder (and potentially context itself) are destroyed, giving an
// opportunity for this cleanup.
virtual void PrepareToDestroy(bool have_context);
// Resizes the surface, returning success. If failed, it is possible that the
// context is no longer current.
virtual bool Resize(const gfx::Size& size,
@ -144,19 +119,12 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
// Get the underlying platform specific surface "handle".
virtual void* GetHandle() = 0;
// Android SurfaceControl specific, notifies that we should not detach child
// surface controls during destruction.
virtual void PreserveChildSurfaceControls() {}
// Returns whether or not the surface supports SwapBuffersWithBounds
virtual bool SupportsSwapBuffersWithBounds();
// Returns whether or not the surface supports PostSubBuffer.
virtual bool SupportsPostSubBuffer();
// Returns whether or not the surface supports CommitOverlayPlanes.
virtual bool SupportsCommitOverlayPlanes();
// Returns whether SwapBuffersAsync() is supported.
virtual bool SupportsAsyncSwap();
@ -212,23 +180,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
PresentationCallback presentation_callback,
gfx::FrameData data);
// Show overlay planes but don't swap the front and back buffers. This acts
// like SwapBuffers from the point of view of the client, but is cheaper when
// overlays account for all the damage. If it returns SWAP_FAILED,
// it is possible that the context is no longer current.
virtual gfx::SwapResult CommitOverlayPlanes(PresentationCallback callback,
gfx::FrameData data);
// Show overlay planes but don't swap the front and back buffers. On some
// platforms, we want to send SwapBufferAck only after the overlays are
// displayed on screen. The callback can be used to delay sending
// SwapBufferAck till that data is available. The callback should be run on
// the calling thread (i.e. same thread CommitOverlayPlanesAsync is called).
virtual void CommitOverlayPlanesAsync(
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data);
// Called after a context is made current with this surface. Returns false
// on error.
virtual bool OnMakeCurrent(GLContext* context);
@ -261,21 +212,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
// default. Does nothing if vsync cannot be changed.
virtual void SetVSyncEnabled(bool enabled);
// Schedule an overlay plane to be shown at swap time, or on the next
// CommitOverlayPlanes call.
// |image| to be presented by the overlay.
// |bounds_rect| specify where it is supposed to be on the screen in pixels.
// |overlay_plane_data| specifies overlay data such as opacity, z_order, size,
// etc.
virtual bool ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data);
// Schedule a CALayer to be shown at swap time.
// All arguments correspond to their CALayer properties.
virtual bool ScheduleCALayer(const ui::CARendererLayerParams& params);
virtual bool ScheduleDCLayer(std::unique_ptr<DCLayerOverlayParams> params);
// Enables or disables DC layers, returning success. If failed, it is possible
@ -284,10 +220,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
virtual bool IsSurfaceless() const;
// Returns true if this surface permits scheduling an isothetic sub-rectangle
// (i.e. viewport) of its contents for display.
virtual bool SupportsViewporter() const;
virtual gfx::SurfaceOrigin GetOrigin() const;
// Returns true if SwapBuffers or PostSubBuffers causes a flip, such that
@ -310,9 +242,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
// offset.
virtual gfx::Vector2d GetDrawOffset() const;
// Tells the surface to rely on implicit sync when swapping buffers.
virtual void SetRelyOnImplicitSync();
// Support for eglGetFrameTimestamps.
virtual bool SupportsSwapTimestamps() const;
virtual void SetEnableSwapTimestamps();
@ -331,13 +260,7 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
virtual void SetGpuVSyncEnabled(bool enabled);
virtual void SetVSyncDisplayID(int64_t display_id) {}
virtual void SetDisplayTransform(gfx::OverlayTransform transform) {}
virtual void SetFrameRate(float frame_rate) {}
virtual void SetChoreographerVsyncIdForNextFrame(
absl::optional<int64_t> choreographer_vsync_id) {}
static GLSurface* GetCurrent();
virtual void SetCurrent();
@ -358,8 +281,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface>,
// it. Otherwise, return the original input preference.
static GpuPreference AdjustGpuPreference(GpuPreference gpu_preference);
virtual void SetCALayerErrorCode(gfx::CALayerResult ca_layer_error_code) {}
protected:
virtual ~GLSurface();
@ -382,7 +303,6 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
GLSurfaceAdapter& operator=(const GLSurfaceAdapter&) = delete;
bool Initialize(GLSurfaceFormat format) override;
void PrepareToDestroy(bool have_context) override;
void Destroy() override;
bool Resize(const gfx::Size& size,
float scale_factor,
@ -412,18 +332,11 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) override;
gfx::SwapResult CommitOverlayPlanes(PresentationCallback callback,
gfx::FrameData data) override;
void CommitOverlayPlanesAsync(SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback,
gfx::FrameData data) override;
bool SupportsSwapBuffersWithBounds() override;
bool SupportsPostSubBuffer() override;
bool SupportsCommitOverlayPlanes() override;
bool SupportsAsyncSwap() override;
gfx::Size GetSize() override;
void* GetHandle() override;
void PreserveChildSurfaceControls() override;
unsigned int GetBackingFramebufferObject() override;
bool OnMakeCurrent(GLContext* context) override;
bool SetBackbufferAllocation(bool allocated) override;
@ -434,14 +347,9 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
GLSurfaceFormat GetFormat() override;
gfx::VSyncProvider* GetVSyncProvider() override;
void SetVSyncEnabled(bool enabled) override;
bool ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data) override;
bool ScheduleDCLayer(std::unique_ptr<DCLayerOverlayParams> params) override;
bool SetEnableDCLayers(bool enable) override;
bool IsSurfaceless() const override;
bool SupportsViewporter() const override;
gfx::SurfaceOrigin GetOrigin() const override;
bool BuffersFlipped() const override;
bool SupportsDCLayers() const override;
@ -449,17 +357,13 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
bool SupportsOverridePlatformSize() const override;
bool SetDrawRectangle(const gfx::Rect& rect) override;
gfx::Vector2d GetDrawOffset() const override;
void SetRelyOnImplicitSync() override;
bool SupportsSwapTimestamps() const override;
void SetEnableSwapTimestamps() override;
bool SupportsPlaneGpuFences() const override;
int GetBufferCount() const override;
bool SupportsGpuVSync() const override;
void SetGpuVSyncEnabled(bool enabled) override;
void SetDisplayTransform(gfx::OverlayTransform transform) override;
void SetFrameRate(float frame_rate) override;
void SetChoreographerVsyncIdForNextFrame(
absl::optional<int64_t> choreographer_vsync_id) override;
void SetCurrent() override;
bool IsCurrent() override;

@ -1010,17 +1010,6 @@ gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(
return scoped_swap_buffers.result();
}
bool NativeViewGLSurfaceEGL::SupportsCommitOverlayPlanes() {
return false;
}
gfx::SwapResult NativeViewGLSurfaceEGL::CommitOverlayPlanes(
PresentationCallback callback,
gfx::FrameData data) {
NOTREACHED();
return gfx::SwapResult::SWAP_FAILED;
}
bool NativeViewGLSurfaceEGL::OnMakeCurrent(GLContext* context) {
if (presentation_helper_)
presentation_helper_->OnMakeCurrent(context, this);
@ -1041,14 +1030,6 @@ void NativeViewGLSurfaceEGL::SetVSyncEnabled(bool enabled) {
}
}
bool NativeViewGLSurfaceEGL::ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data) {
NOTIMPLEMENTED();
return false;
}
NativeViewGLSurfaceEGL::~NativeViewGLSurfaceEGL() {
Destroy();
}

@ -102,16 +102,9 @@ class GL_EXPORT NativeViewGLSurfaceEGL : public GLSurfaceEGL,
int height,
PresentationCallback callback,
gfx::FrameData data) override;
bool SupportsCommitOverlayPlanes() override;
gfx::SwapResult CommitOverlayPlanes(PresentationCallback callback,
gfx::FrameData data) override;
bool OnMakeCurrent(GLContext* context) override;
gfx::VSyncProvider* GetVSyncProvider() override;
void SetVSyncEnabled(bool enabled) override;
bool ScheduleOverlayPlane(
OverlayImage image,
std::unique_ptr<gfx::GpuFence> gpu_fence,
const gfx::OverlayPlaneData& overlay_plane_data) override;
gfx::SurfaceOrigin GetOrigin() const override;
EGLTimestampClient* GetEGLTimestampClient() override;

@ -17,9 +17,6 @@
#include "ui/gfx/swap_result.h"
#include "ui/gl/gl_export.h"
// This temporary for OverlayImage and FrameData.
#include "ui/gl/gl_surface.h"
#if BUILDFLAG(IS_OZONE)
#include "ui/gfx/native_pixmap.h"
#endif
@ -33,6 +30,9 @@
#endif
namespace gfx {
namespace mojom {
class DelegatedInkPointRenderer;
} // namespace mojom
class ColorSpace;
class GpuFence;
struct OverlayPlaneData;
@ -43,6 +43,20 @@ struct CARendererLayerParams;
} // namespace ui
namespace gl {
class GLContext;
struct DCLayerOverlayParams;
// OverlayImage is a platform specific type for overlay plane image data.
#if BUILDFLAG(IS_OZONE)
using OverlayImage = scoped_refptr<gfx::NativePixmap>;
#elif BUILDFLAG(IS_APPLE)
using OverlayImage = gfx::ScopedIOSurface;
#elif BUILDFLAG(IS_ANDROID)
using OverlayImage =
std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>;
#else
struct OverlayImage {};
#endif
// Provides an abstraction around system api for presentation of the overlay
// planes and control presentations parameters (e.g frame rate). Temporarily is

@ -14,6 +14,7 @@
#include "base/memory/weak_ptr.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gl/gl_display.h"
#include "ui/gl/gl_surface_overlay.h"
#include "ui/gl/presenter.h"
#include "ui/gl/scoped_binders.h"
@ -95,7 +96,6 @@ class GbmSurfaceless : public gl::Presenter {
// The native surface. Deleting this is allowed to free the EGLNativeWindow.
const gfx::AcceleratedWidget widget_;
std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
std::vector<std::unique_ptr<PendingFrame>> unsubmitted_frames_;
std::unique_ptr<PendingFrame> submitted_frame_;
std::unique_ptr<gfx::GpuFence> submitted_frame_gpu_fence_;

@ -18,6 +18,7 @@
#include "ui/gfx/gpu_fence.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_display.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h"
#include "ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom.h"

@ -20,6 +20,10 @@
#include "ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h"
#include "ui/ozone/public/swap_completion_callback.h"
namespace gl {
class GLDisplayEGL;
}
namespace ui {
class WaylandBufferManagerGpu;