Skip to content

Commit

Permalink
cc: Fix damage when the HUD is enabled.
Browse files Browse the repository at this point in the history
When the HUD is on, and partial swaps are enabled, the damage rects
emitted by the renderer do not include the HUD, so the HUD is not
updated correctly on screen.

Previously we disabled partial swap in the renderer compositor to
force the hud to display, but in ubercomp, partial swap is never
used in the renderer, and the damage rect is given to the browser
instead. So we need to update the renderer's damage rect in this
case.

R=enne@chromium.org, piman@chromium.org, caseq, enne
BUG=350495

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256052 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
danakj@chromium.org committed Mar 10, 2014
1 parent 51dacee commit f636ce8
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 101 deletions.
8 changes: 5 additions & 3 deletions cc/debug/debug_rect_history.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DebugRectHistory::~DebugRectHistory() {}

void DebugRectHistory::SaveDebugRectsForCurrentFrame(
LayerImpl* root_layer,
LayerImpl* hud_layer,
const LayerImplList& render_surface_layer_list,
const std::vector<gfx::Rect>& occluding_screen_space_rects,
const std::vector<gfx::Rect>& non_occluding_screen_space_rects,
Expand All @@ -47,7 +48,7 @@ void DebugRectHistory::SaveDebugRectsForCurrentFrame(
SavePaintRects(root_layer);

if (debug_state.show_property_changed_rects)
SavePropertyChangedRects(render_surface_layer_list);
SavePropertyChangedRects(render_surface_layer_list, hud_layer);

if (debug_state.show_surface_damage_rects)
SaveSurfaceDamageRects(render_surface_layer_list);
Expand Down Expand Up @@ -89,7 +90,8 @@ void DebugRectHistory::SavePaintRects(LayerImpl* layer) {
}

void DebugRectHistory::SavePropertyChangedRects(
const LayerImplList& render_surface_layer_list) {
const LayerImplList& render_surface_layer_list,
LayerImpl* hud_layer) {
for (int surface_index = render_surface_layer_list.size() - 1;
surface_index >= 0;
--surface_index) {
Expand All @@ -107,7 +109,7 @@ void DebugRectHistory::SavePropertyChangedRects(
layer, render_surface_layer->id()))
continue;

if (layer->LayerIsAlwaysDamaged())
if (layer == hud_layer)
continue;

if (layer->LayerPropertyChanged()) {
Expand Down
5 changes: 3 additions & 2 deletions cc/debug/debug_rect_history.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class DebugRectHistory {
// reset.
void SaveDebugRectsForCurrentFrame(
LayerImpl* root_layer,
LayerImpl* hud_layer,
const LayerImplList& render_surface_layer_list,
const std::vector<gfx::Rect>& occluding_screen_space_rects,
const std::vector<gfx::Rect>& non_occluding_screen_space_rects,
Expand All @@ -88,8 +89,8 @@ class DebugRectHistory {
DebugRectHistory();

void SavePaintRects(LayerImpl* layer);
void SavePropertyChangedRects(
const LayerImplList& render_surface_layer_list);
void SavePropertyChangedRects(const LayerImplList& render_surface_layer_list,
LayerImpl* hud_layer);
void SaveSurfaceDamageRects(
const LayerImplList& render_surface_layer_list);
void SaveScreenSpaceRects(
Expand Down
2 changes: 0 additions & 2 deletions cc/layers/heads_up_display_layer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ void HeadsUpDisplayLayerImpl::UpdateHudTexture(

void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); }

bool HeadsUpDisplayLayerImpl::LayerIsAlwaysDamaged() const { return true; }

void HeadsUpDisplayLayerImpl::UpdateHudContents() {
const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();

Expand Down
2 changes: 0 additions & 2 deletions cc/layers/heads_up_display_layer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl {

virtual void ReleaseResources() OVERRIDE;

virtual bool LayerIsAlwaysDamaged() const OVERRIDE;

private:
class Graph {
public:
Expand Down
4 changes: 0 additions & 4 deletions cc/layers/layer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,6 @@ void LayerImpl::ResetAllChangeTrackingForSubtree() {
num_dependents_need_push_properties_ = 0;
}

bool LayerImpl::LayerIsAlwaysDamaged() const {
return false;
}

gfx::Vector2dF LayerImpl::ScrollOffsetForAnimation() const {
return TotalScrollOffset();
}
Expand Down
6 changes: 1 addition & 5 deletions cc/layers/layer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,10 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,

void SetStackingOrderChanged(bool stacking_order_changed);

bool LayerPropertyChanged() const {
return layer_property_changed_ || LayerIsAlwaysDamaged();
}
bool LayerPropertyChanged() const { return layer_property_changed_; }

void ResetAllChangeTrackingForSubtree();

virtual bool LayerIsAlwaysDamaged() const;

LayerAnimationController* layer_animation_controller() {
return layer_animation_controller_.get();
}
Expand Down
1 change: 0 additions & 1 deletion cc/output/delegating_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ void DelegatingRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
float device_scale_factor,
const gfx::Rect& device_viewport_rect,
const gfx::Rect& device_clip_rect,
bool allow_partial_swap,
bool disable_picture_quad_image_filtering) {
TRACE_EVENT0("cc", "DelegatingRenderer::DrawFrame");

Expand Down
1 change: 0 additions & 1 deletion cc/output/delegating_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CC_EXPORT DelegatingRenderer : public Renderer {
float device_scale_factor,
const gfx::Rect& device_viewport_rect,
const gfx::Rect& device_clip_rect,
bool allow_partial_swap,
bool disable_picture_quad_image_filtering) OVERRIDE;

virtual void Finish() OVERRIDE {}
Expand Down
16 changes: 6 additions & 10 deletions cc/output/direct_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
float device_scale_factor,
const gfx::Rect& device_viewport_rect,
const gfx::Rect& device_clip_rect,
bool allow_partial_swap,
bool disable_picture_quad_image_filtering) {
TRACE_EVENT0("cc", "DirectRenderer::DrawFrame");
UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount",
Expand All @@ -209,10 +208,9 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,

DrawingFrame frame;
frame.root_render_pass = root_render_pass;
frame.root_damage_rect =
Capabilities().using_partial_swap && allow_partial_swap
? root_render_pass->damage_rect
: root_render_pass->output_rect;
frame.root_damage_rect = Capabilities().using_partial_swap
? root_render_pass->damage_rect
: root_render_pass->output_rect;
frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size()));
frame.device_viewport_rect = device_viewport_rect;
frame.device_clip_rect = device_clip_rect;
Expand All @@ -230,7 +228,7 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
BeginDrawingFrame(&frame);
for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) {
RenderPass* pass = render_passes_in_draw_order->at(i);
DrawRenderPass(&frame, pass, allow_partial_swap);
DrawRenderPass(&frame, pass);

for (ScopedPtrVector<CopyOutputRequest>::iterator it =
pass->copy_requests.begin();
Expand Down Expand Up @@ -331,14 +329,12 @@ void DirectRenderer::SetScissorTestRectInDrawSpace(
void DirectRenderer::FinishDrawingQuadList() {}

void DirectRenderer::DrawRenderPass(DrawingFrame* frame,
const RenderPass* render_pass,
bool allow_partial_swap) {
const RenderPass* render_pass) {
TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass");
if (!UseRenderPass(frame, render_pass))
return;

bool using_scissor_as_optimization =
Capabilities().using_partial_swap && allow_partial_swap;
bool using_scissor_as_optimization = Capabilities().using_partial_swap;
gfx::RectF render_pass_scissor;
bool draw_rect_covers_full_surface = true;
if (frame->current_render_pass == frame->root_render_pass &&
Expand Down
5 changes: 1 addition & 4 deletions cc/output/direct_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class CC_EXPORT DirectRenderer : public Renderer {
float device_scale_factor,
const gfx::Rect& device_viewport_rect,
const gfx::Rect& device_clip_rect,
bool allow_partial_swap,
bool disable_picture_quad_image_filtering) OVERRIDE;

struct CC_EXPORT DrawingFrame {
Expand Down Expand Up @@ -92,9 +91,7 @@ class CC_EXPORT DirectRenderer : public Renderer {

static gfx::Size RenderPassTextureSize(const RenderPass* render_pass);

void DrawRenderPass(DrawingFrame* frame,
const RenderPass* render_pass,
bool allow_partial_swap);
void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass);
bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass);

void RunOnDemandRasterTask(internal::Task* on_demand_raster_task);
Expand Down
Loading

0 comments on commit f636ce8

Please sign in to comment.