Gecko:DisplayListBasedInvalidation: Difference between revisions

No edit summary
Line 5: Line 5:
= Basic Outline =
= Basic Outline =


* Display List changes
There are 3 main components to DLBI: Frame invalidation, display list invalidation and layer tree invalidation.
** We want to compare the new display to the old one and invalidate layer regions of anything that has changed.
** We already cache most of the information that we need, and iterate over it in FrameLayerBuilder.
*** We need to add the old bounds of the display item into the cached data
*** Some items (e.g. borders) need two rectangles: an outer rect and an inner rect
** Invalidating display items that no longer exist.
*** How do we do this?
*** We could iterate over the frames DisplayItemData at the end of nsFrame::BuildDisplayList, and send invalidations for any display item types that weren't just created.
*** FrameLayerBuilder already detects items being added to or removed from a layer, so this won't be a problem if we do the processing in FrameLayerBuilder


* Style and other changes
== Frame Invalidation ==
** These should invalidate all (?) display items for the frame, so we can just set a dirty bit on the frame and check this from FrameLayerBuilder
 
Code lives in layout/generic/nsIFrame.h and layout/generic/nsFrame.cpp
 
This is used when a frame has a major change that will affect rendering (such as a style change) and all display items belonging to this frame should redraw their content.
 
nsIFrame::InvalidateFrame() marks the frame as invalid. You can also specify a rect using nsIFrame::InvalidateFrameWithRect, but note that this is a minimum, the display items created by this frame can still choose to invalidate further.
 
== Display List Invalidation ==
 
Compute the area of a ThebesLayer by comparing the current display list being drawn into the layer against the previous display list.
 
Code lives in layout/base/FrameLayerBuilder.cpp, primarily in FrameLayerBuilder::InvalidateForLayerChange(). The nsDisplayItemGeometry classes in layout/base/nsDisplayListInvalidation.h, and layout/base/nsDisplayList.h - nsDisplayItem::AllocateGeometry(), nsDisplayItem::ComputeInvalidationRegion.
 
Every display item is asked to allocate a geometry object that is retained between paints and then used to check for display item changes.
 
When painting, it checks if it has been added or removed from the layer and invalidates the bounds of the display item if so.
 
Items that exist between paints are asked to check for size changes using nsDisplayItem::ComputeInvalidationRegion and will compute the changed area (if any).
 
== Layer Tree Invalidation ==
 
Code lives in gfx/layers/LayerTreeInvalidation.{h,cpp}.
 
Computes changes in layer trees and reports the invalid area.
 
Used to find changes in inactive layer trees, compute widget dirty rects (BasicLayers only) and report MozAfterPaint events.


= Potential Problems =
= Potential Problems =
Confirmed users
44

edits