Commit a63afbac authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Add CommitOverlayPlanes support to macOS

On macOS, most frames should be submitted by CommitOverlayPlanes. Also
remove the concept of damage, because on macOS it is not meaningful.

Bug: 894929
Change-Id: Idf0d393fd94fbc43f80a1d729bccf8f587431a86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264935Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782081}
parent 6df15d1f
......@@ -74,8 +74,14 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass,
int height,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) override;
gfx::SwapResult CommitOverlayPlanes(
gl::GLSurface::PresentationCallback callback) override;
void CommitOverlayPlanesAsync(
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) override;
bool SupportsPostSubBuffer() override;
bool SupportsCommitOverlayPlanes() override;
bool SupportsAsyncSwap() override;
gfx::Size GetSize() override;
void* GetHandle() override;
......@@ -101,7 +107,6 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass,
~ImageTransportSurfaceOverlayMacBase() override;
gfx::SwapResult SwapBuffersInternal(
const gfx::Rect& pixel_damage_rect,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback);
void ApplyBackpressure();
......
......@@ -113,7 +113,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::BufferPresented(
template <typename BaseClass>
gfx::SwapResult
ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
const gfx::Rect& pixel_damage_rect,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) {
TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal");
......@@ -128,7 +127,7 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
base::TimeTicks before_transaction_time = base::TimeTicks::Now();
{
TRACE_EVENT0("gpu", "CommitPendingTreesToCA");
ca_layer_tree_coordinator_->CommitPendingTreesToCA(pixel_damage_rect);
ca_layer_tree_coordinator_->CommitPendingTreesToCA();
base::TimeTicks after_transaction_time = base::TimeTicks::Now();
UMA_HISTOGRAM_TIMES("GPU.IOSurface.CATransactionTime",
after_transaction_time - before_transaction_time);
......@@ -204,7 +203,6 @@ template <typename BaseClass>
gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffers(
gl::GLSurface::PresentationCallback callback) {
return SwapBuffersInternal(
gfx::Rect(0, 0, pixel_size_.width(), pixel_size_.height()),
base::DoNothing(), std::move(callback));
}
......@@ -213,7 +211,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersAsync(
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) {
SwapBuffersInternal(
gfx::Rect(0, 0, pixel_size_.width(), pixel_size_.height()),
std::move(completion_callback), std::move(presentation_callback));
}
......@@ -224,8 +221,7 @@ gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBuffer(
int width,
int height,
gl::GLSurface::PresentationCallback callback) {
return SwapBuffersInternal(gfx::Rect(x, y, width, height), base::DoNothing(),
std::move(callback));
return SwapBuffersInternal(base::DoNothing(), std::move(callback));
}
template <typename BaseClass>
......@@ -236,8 +232,22 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBufferAsync(
int height,
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) {
SwapBuffersInternal(gfx::Rect(x, y, width, height),
std::move(completion_callback),
SwapBuffersInternal(std::move(completion_callback),
std::move(presentation_callback));
}
template <typename BaseClass>
gfx::SwapResult
ImageTransportSurfaceOverlayMacBase<BaseClass>::CommitOverlayPlanes(
gl::GLSurface::PresentationCallback callback) {
return SwapBuffersInternal(base::DoNothing(), std::move(callback));
}
template <typename BaseClass>
void ImageTransportSurfaceOverlayMacBase<BaseClass>::CommitOverlayPlanesAsync(
gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) {
SwapBuffersInternal(std::move(completion_callback),
std::move(presentation_callback));
}
......@@ -246,6 +256,12 @@ bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsPostSubBuffer() {
return true;
}
template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<
BaseClass>::SupportsCommitOverlayPlanes() {
return true;
}
template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsAsyncSwap() {
return true;
......
......@@ -36,7 +36,7 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator {
// Commit the pending frame's OpenGL backbuffer or CALayer tree to be
// attached to the root CALayer.
void CommitPendingTreesToCA(const gfx::Rect& pixel_damage_rect);
void CommitPendingTreesToCA();
// Get the root CALayer to display the current frame. This does not change
// over the lifetime of the object.
......
......@@ -41,8 +41,7 @@ CARendererLayerTree* CALayerTreeCoordinator::GetPendingCARendererLayerTree() {
return pending_ca_renderer_layer_tree_.get();
}
void CALayerTreeCoordinator::CommitPendingTreesToCA(
const gfx::Rect& pixel_damage_rect) {
void CALayerTreeCoordinator::CommitPendingTreesToCA() {
// Update the CALayer hierarchy.
ScopedCAActionDisabler disabler;
if (pending_ca_renderer_layer_tree_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment