Commit 085e9bbe authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Support optimized root damage rect for multiple overlays on Windows

If the overlays are the only damages in the frame, we will get a zero
root damage rect with the new way of calculating damage rect
|use_overlay_damage_list_|, which is enabled by default.

The old code of |use_overlay_damage_list_| == false is still working. It
will be cleaned up once the new code is stable.

Bug:1117235

Change-Id: Ibbede44056973a5ba9e052292673bbf0bcb4a50a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434905
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818723}
parent e633c3e3
...@@ -140,10 +140,20 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor ...@@ -140,10 +140,20 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor
gfx::Rect* this_frame_underlay_rect, gfx::Rect* this_frame_underlay_rect,
DCLayerOverlay* dc_layer); DCLayerOverlay* dc_layer);
void UpdateRootDamageRect(const gfx::RectF& display_rect,
gfx::Rect* damage_rect);
void RemoveOverlayDamageRect(const QuadList::Iterator& it,
const gfx::Rect& quad_rectangle,
const gfx::Rect& occluding_damage_rect,
gfx::Rect* damage_rect);
void InsertDebugBorderDrawQuad(const DCLayerOverlayList* dc_layer_overlays, void InsertDebugBorderDrawQuad(const DCLayerOverlayList* dc_layer_overlays,
AggregatedRenderPass* render_pass, AggregatedRenderPass* render_pass,
const gfx::RectF& display_rect, const gfx::RectF& display_rect,
gfx::Rect* damage_rect); gfx::Rect* damage_rect);
bool IsPreviousFrameUnderlayRect(const gfx::Rect& quad_rectangle,
size_t index);
bool has_overlay_support_; bool has_overlay_support_;
const bool use_overlay_damage_list_; const bool use_overlay_damage_list_;
...@@ -162,6 +172,18 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor ...@@ -162,6 +172,18 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor
int previous_frame_processed_overlay_count_ = 0; int previous_frame_processed_overlay_count_ = 0;
int current_frame_processed_overlay_count_ = 0; int current_frame_processed_overlay_count_ = 0;
struct OverlayRect {
gfx::Rect rect;
bool is_overlay; // If false, it's an underlay.
bool operator==(const OverlayRect& b) {
return rect == b.rect && is_overlay == b.is_overlay;
}
bool operator!=(const OverlayRect& b) { return !(*this == b); }
};
std::vector<OverlayRect> previous_frame_overlay_rects_;
std::vector<OverlayRect> current_frame_overlay_rects_;
SurfaceDamageRectList* surface_damage_rect_list_;
scoped_refptr<base::SingleThreadTaskRunner> viz_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> viz_task_runner_;
DISALLOW_COPY_AND_ASSIGN(DCLayerOverlayProcessor); DISALLOW_COPY_AND_ASSIGN(DCLayerOverlayProcessor);
......
...@@ -720,6 +720,7 @@ bool Display::DrawAndSwap(base::TimeTicks expected_display_time) { ...@@ -720,6 +720,7 @@ bool Display::DrawAndSwap(base::TimeTicks expected_display_time) {
// skip the draw and so that the GL swap won't stretch the output. // skip the draw and so that the GL swap won't stretch the output.
last_render_pass.output_rect.set_size(current_surface_size); last_render_pass.output_rect.set_size(current_surface_size);
last_render_pass.damage_rect = last_render_pass.output_rect; last_render_pass.damage_rect = last_render_pass.output_rect;
frame.surface_damage_rect_list_.push_back(last_render_pass.damage_rect);
} }
surface_size = last_render_pass.output_rect.size(); surface_size = last_render_pass.output_rect.size();
have_damage = !last_render_pass.damage_rect.size().IsEmpty(); have_damage = !last_render_pass.damage_rect.size().IsEmpty();
......
...@@ -74,6 +74,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorWin ...@@ -74,6 +74,7 @@ class VIZ_SERVICE_EXPORT OverlayProcessorWin
bool using_dc_layers_ = false; bool using_dc_layers_ = false;
// Number of frames since the last time direct composition layers were used. // Number of frames since the last time direct composition layers were used.
int frames_since_using_dc_layers_ = 0; int frames_since_using_dc_layers_ = 0;
// TODO(weiliangc): Eventually fold DCLayerOverlayProcessor into this class. // TODO(weiliangc): Eventually fold DCLayerOverlayProcessor into this class.
std::unique_ptr<DCLayerOverlayProcessor> dc_layer_overlay_processor_; std::unique_ptr<DCLayerOverlayProcessor> dc_layer_overlay_processor_;
......
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