Open Bug 551848 Opened 16 years ago Updated 4 years ago

Categories

(Core :: Graphics, defect)

x86
All
defect

Tracking

()

People

(Reporter: jrmuizel, Unassigned, NeedInfo)

References

()

Details

This demo seems to run better in most other browsers. Nothing obvious jumps out when sharking it.
Just as a comment, D2D seems to offer very little improvement here. I haven't profiled it yet.
I tried sharking too, and 68% of the time is under _cairo_quartz_surface_paint callin CGContextDrawImage. Specifically, in CoreGraphics code; 17% is argb32_sample_argb32, 22% is argb32_image_mark_rgb32, 14% is in argb_image_mark, 10% ripc_AcquireImage, 2% ripc_GetRenderingState. Main callers of this code are nsSVGUtils::PaintFrameWithEffects, nsSVGUtils::CompositePatternMatrix. Another 10% is _moz_cairo_push_group_with_content. 4.5% _moz_cairo_stroke_preserve. 1% _moz_cairo_fill_preserve. That's about 85% of total time; the rest is scattered here and there.
Safari spends an average of 180ms in calls to CGContextDrawImage we spend an average of about 764ms. I suspect this makes the bulk of the difference. My guess here is that Safari is able to use the cache of scaled images and we are not. The cache is afaik is per destination surface. So if the destination surface is created and destroyed during the rendering we lose that cache. Surface creation and destruction can happen if push_group is used.
WebKit uses CGContextBeginTransparencyLayer to implement push_group/pop_group style rendering. This may be what allows them to retain the cached images.
Bug 525947 is related to this. Using CGContextBeginTransparencyLayer in the cairo backend is tricky because cairo's api does not require you to use the transparency layer immediately.

This seems to run fine now. Do you still see problems?

Flags: needinfo?(jmuizelaar)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.