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, ...@@ -74,8 +74,14 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass,
int height, int height,
gl::GLSurface::SwapCompletionCallback completion_callback, gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) override; 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 SupportsPostSubBuffer() override;
bool SupportsCommitOverlayPlanes() override;
bool SupportsAsyncSwap() override; bool SupportsAsyncSwap() override;
gfx::Size GetSize() override; gfx::Size GetSize() override;
void* GetHandle() override; void* GetHandle() override;
...@@ -101,7 +107,6 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass, ...@@ -101,7 +107,6 @@ class ImageTransportSurfaceOverlayMacBase : public BaseClass,
~ImageTransportSurfaceOverlayMacBase() override; ~ImageTransportSurfaceOverlayMacBase() override;
gfx::SwapResult SwapBuffersInternal( gfx::SwapResult SwapBuffersInternal(
const gfx::Rect& pixel_damage_rect,
gl::GLSurface::SwapCompletionCallback completion_callback, gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback); gl::GLSurface::PresentationCallback presentation_callback);
void ApplyBackpressure(); void ApplyBackpressure();
......
...@@ -113,7 +113,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::BufferPresented( ...@@ -113,7 +113,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::BufferPresented(
template <typename BaseClass> template <typename BaseClass>
gfx::SwapResult gfx::SwapResult
ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal( ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
const gfx::Rect& pixel_damage_rect,
gl::GLSurface::SwapCompletionCallback completion_callback, gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) { gl::GLSurface::PresentationCallback presentation_callback) {
TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal"); TRACE_EVENT0("gpu", "ImageTransportSurfaceOverlayMac::SwapBuffersInternal");
...@@ -128,7 +127,7 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal( ...@@ -128,7 +127,7 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
base::TimeTicks before_transaction_time = base::TimeTicks::Now(); base::TimeTicks before_transaction_time = base::TimeTicks::Now();
{ {
TRACE_EVENT0("gpu", "CommitPendingTreesToCA"); 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(); base::TimeTicks after_transaction_time = base::TimeTicks::Now();
UMA_HISTOGRAM_TIMES("GPU.IOSurface.CATransactionTime", UMA_HISTOGRAM_TIMES("GPU.IOSurface.CATransactionTime",
after_transaction_time - before_transaction_time); after_transaction_time - before_transaction_time);
...@@ -204,7 +203,6 @@ template <typename BaseClass> ...@@ -204,7 +203,6 @@ template <typename BaseClass>
gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffers( gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffers(
gl::GLSurface::PresentationCallback callback) { gl::GLSurface::PresentationCallback callback) {
return SwapBuffersInternal( return SwapBuffersInternal(
gfx::Rect(0, 0, pixel_size_.width(), pixel_size_.height()),
base::DoNothing(), std::move(callback)); base::DoNothing(), std::move(callback));
} }
...@@ -213,7 +211,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersAsync( ...@@ -213,7 +211,6 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersAsync(
gl::GLSurface::SwapCompletionCallback completion_callback, gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) { gl::GLSurface::PresentationCallback presentation_callback) {
SwapBuffersInternal( SwapBuffersInternal(
gfx::Rect(0, 0, pixel_size_.width(), pixel_size_.height()),
std::move(completion_callback), std::move(presentation_callback)); std::move(completion_callback), std::move(presentation_callback));
} }
...@@ -224,8 +221,7 @@ gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBuffer( ...@@ -224,8 +221,7 @@ gfx::SwapResult ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBuffer(
int width, int width,
int height, int height,
gl::GLSurface::PresentationCallback callback) { gl::GLSurface::PresentationCallback callback) {
return SwapBuffersInternal(gfx::Rect(x, y, width, height), base::DoNothing(), return SwapBuffersInternal(base::DoNothing(), std::move(callback));
std::move(callback));
} }
template <typename BaseClass> template <typename BaseClass>
...@@ -236,8 +232,22 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBufferAsync( ...@@ -236,8 +232,22 @@ void ImageTransportSurfaceOverlayMacBase<BaseClass>::PostSubBufferAsync(
int height, int height,
gl::GLSurface::SwapCompletionCallback completion_callback, gl::GLSurface::SwapCompletionCallback completion_callback,
gl::GLSurface::PresentationCallback presentation_callback) { gl::GLSurface::PresentationCallback presentation_callback) {
SwapBuffersInternal(gfx::Rect(x, y, width, height), SwapBuffersInternal(std::move(completion_callback),
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)); std::move(presentation_callback));
} }
...@@ -246,6 +256,12 @@ bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsPostSubBuffer() { ...@@ -246,6 +256,12 @@ bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsPostSubBuffer() {
return true; return true;
} }
template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<
BaseClass>::SupportsCommitOverlayPlanes() {
return true;
}
template <typename BaseClass> template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsAsyncSwap() { bool ImageTransportSurfaceOverlayMacBase<BaseClass>::SupportsAsyncSwap() {
return true; return true;
......
...@@ -36,7 +36,7 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator { ...@@ -36,7 +36,7 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator {
// Commit the pending frame's OpenGL backbuffer or CALayer tree to be // Commit the pending frame's OpenGL backbuffer or CALayer tree to be
// attached to the root CALayer. // 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 // Get the root CALayer to display the current frame. This does not change
// over the lifetime of the object. // over the lifetime of the object.
......
...@@ -41,8 +41,7 @@ CARendererLayerTree* CALayerTreeCoordinator::GetPendingCARendererLayerTree() { ...@@ -41,8 +41,7 @@ CARendererLayerTree* CALayerTreeCoordinator::GetPendingCARendererLayerTree() {
return pending_ca_renderer_layer_tree_.get(); return pending_ca_renderer_layer_tree_.get();
} }
void CALayerTreeCoordinator::CommitPendingTreesToCA( void CALayerTreeCoordinator::CommitPendingTreesToCA() {
const gfx::Rect& pixel_damage_rect) {
// Update the CALayer hierarchy. // Update the CALayer hierarchy.
ScopedCAActionDisabler disabler; ScopedCAActionDisabler disabler;
if (pending_ca_renderer_layer_tree_) { 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