Commit 8aa00fc2 authored by ccameron's avatar ccameron Committed by Commit bot

Mac overlays: Isolate partial swap support

The logic to maintain a CALayer tree for partial swap support is
complicated and should be removed, but that would compromise battery
usage. Once the CoreAniamtion renderer is handling ~99% of the frames,
we can remove it. In the mean time, isolate it.

Create a CALayerPartialDamageTree to track the layer tree of partially
swapped backbuffers. Do this in-place to minimize diffs, so that this
patch can be reasonably reviewed. A follow-on patch will move it to
a separate file.

Slightly reorganize the logic so that CALayerPartialDamageTree matches
the general structure of CALayerTree, where this a pending (not swapped)
tree, a tree for each pending swap, and a tree for what is currently
being displayed.

BUG=533681

Review URL: https://codereview.chromium.org/1640093002

Cr-Commit-Position: refs/heads/master@{#371831}
parent 95e79fa8
......@@ -22,6 +22,7 @@
namespace content {
class CALayerTree;
class CALayerPartialDamageTree;
class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
public ImageTransportSurface,
......@@ -78,13 +79,6 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect);
void UpdateRootAndPartialDamagePlanes(
const linked_ptr<OverlayPlane>& new_root_plane,
const gfx::RectF& pixel_damage_rect);
void UpdateRootAndPartialDamageCALayers(float scale_factor);
void UpdateCALayerTree(scoped_ptr<CALayerTree> ca_layer_tree,
float scale_factor);
// Returns true if the front of |pending_swaps_| has completed, or has timed
// out by |now|.
bool IsFirstPendingSwapReadyToDisplay(
......@@ -125,7 +119,7 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
// Planes that have been scheduled, but have not had a subsequent SwapBuffers
// call made yet.
linked_ptr<OverlayPlane> pending_root_plane_;
scoped_ptr<CALayerPartialDamageTree> pending_partial_damage_tree_;
scoped_ptr<CALayerTree> pending_ca_layer_tree_;
// A queue of all frames that have been created by SwapBuffersInternal but
......@@ -134,8 +128,7 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
std::deque<linked_ptr<PendingSwap>> pending_swaps_;
// The planes that are currently being displayed on the screen.
linked_ptr<OverlayPlane> current_root_plane_;
std::list<linked_ptr<OverlayPlane>> current_partial_damage_planes_;
scoped_ptr<CALayerPartialDamageTree> current_partial_damage_tree_;
scoped_ptr<CALayerTree> current_ca_layer_tree_;
// The time of the last swap was issued. If this is more than two vsyncs, then
......@@ -147,10 +140,6 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
base::TimeTicks vsync_timebase_;
base::TimeDelta vsync_interval_;
// Calls to ScheduleCALayer come in back-to-front. This is reset to 1 at each
// swap and increments with each call to ScheduleCALayer.
int next_ca_layer_z_order_;
base::Timer display_pending_swap_timer_;
base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_;
};
......
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