Closed Bug 1006353 Opened 11 years ago Closed 10 years ago

same image drawn multiple times with same background-size and different background-position pegs CPU due to repeated rescaling

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: odsasson, Unassigned)

References

Details

Attachments

(2 files)

Attached image all.png (deleted) —
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 (Beta/Release) Build ID: 20140421221237 Steps to reproduce: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> .icon { width: 1em; height: 1em; background-image:url(all.png); /* With out the background-size line everything is fine */ background-size: 30em; background-repeat: no-repeat; display: inline-block; } .t1 { font-size: 3em; background-position:-2em 0 } .t2 { font-size: 1.2em; background-position:-5em 0 } /* i guess the the font-size < 1 is causing high cpu usage */ .t3 { font-size: 0.8em; background-position:-8em 0 } </style> </head> <body style="padding: 1em;"> <p>Blah blah</p> <span class="icon t1"></span> <span class="icon t2"></span> <!-- THE PROBLEMATIC STYLE --> <span class="icon t3"></span> </body> </html> Actual results: cpu usage soars when viewing the page. when removing the element with the t3 style is everything fine. applies to at least version 28 and 29 Expected results: no high cpu usage
I see Nightly 32.0a1 (2014-05-06) using almost a single core viewing the page in comment 0. Given its just static content, that does seem like a problem. Here's a profile, although I'm not sure I caught anything useful: http://people.mozilla.org/~bgirard/cleopatra/#report=6b76aa6e69c220920f4f4c5b114484340c80147e
Status: UNCONFIRMED → NEW
Component: General → Layout
Ever confirmed: true
Attached file HTML from comment 0 (deleted) —
(modified to link to attachment 8417891 [details])
Happens on Linux as well, with some visible size flickering on the middle image too.
OS: Windows 7 → All
Hardware: x86_64 → All
We end up cycling between: #0 nsRefreshDriver::ScheduleViewManagerFlush (this=0x2274ff0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsRefreshDriver.cpp:1362 #1 0x00007fd25a2fc53f in PresShell::ScheduleViewManagerFlush (this=0x20dd640, aType=<optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsPresShell.cpp:3621 #2 0x00007fd25a3b51f4 in nsIFrame::SchedulePaint (this=0x3c68e98, aType=nsIFrame::PAINT_DEFAULT) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/generic/nsFrame.cpp:5032 #3 0x00007fd25a24f4fc in mozilla::css::ImageLoader::DoRedraw ( this=<optimized out>, aFrameSet=0x3bcdc40) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/style/ImageLoader.cpp:353 #4 0x00007fd25a24f582 in mozilla::css::ImageLoader::FrameChanged ( this=0x3bb98f0, aRequest=<optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/style/ImageLoader.cpp:461 #5 0x00007fd25a270aee in mozilla::css::ImageLoader::Notify (this=0x3bb98f0, aRequest=0x3c79730, aType=<optimized out>, aData=<optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/style/ImageLoader.cpp:385 #6 0x00007fd25967c7b0 in imgRequestProxy::OnFrameUpdate (this=0x3c79730, rect=0x3622248) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/imgRequestProxy.cpp:740 #7 0x00007fd25967f53b in imgStatusTracker::FrameChanged (this=0x3c73c60, aDirtyRect=0x3622248) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/imgStatusTracker.cpp:973 #8 0x00007fd2596833d9 in mozilla::image::RasterImage::ScalingDone ( this=0x7fd1d0003c10, request=0x3622210, status=<optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:2570 #9 0x00007fd25968aa5d in DrawRunner::Run (this=0x7fd1c00b8f20) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:317 #10 0x00007fd258f10538 in ProcessNextEvent (result=0x7fffcf14467f, mayWait=false, this=0xa72470) at /home/dbaron/builds/ssd/mozilla-central/mozilla/xpcom/threads/nsThread.cpp:715 and: #0 ScaleRunner::ScaleRunner (this=0x3d74c70, aImage=0x7fd1d0003c10, aScale=..., aSrcFrame=0x3d53aa0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:330 #1 0x00007fd2596892a9 in mozilla::image::RasterImage::DrawWithPreDownscaleIfNeeded (this=0x7fd1d0003c10, aFrame=0x3d53aa0, aContext=0x17cd980, aFilter=FILTER_GOOD, aUserSpaceToImageSpace=..., aFill=..., aSubimage=..., aFlags=24) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:2649 #2 0x00007fd2596895ee in Draw (aFlags=24, aWhichFrame=1, aSubimage=..., aFill=..., aUserSpaceToImageSpace=..., aFilter=FILTER_GOOD, aContext=0x17cd980, this=0x7fd1d0003c10) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:2762 #3 mozilla::image::RasterImage::Draw (this=0x7fd1d0003c10, aContext=0x17cd980, aFilter=FILTER_GOOD, aUserSpaceToImageSpace=..., aFill=..., aSubimage=..., aWhichFrame=1, aFlags=24) at /home/dbaron/builds/ssd/mozilla-central/mozilla/image/src/RasterImage.cpp:2682 #4 0x00007fd25a34dd1b in DrawImageInternal ( aRenderingContext=<optimized out>, aImage=0x7fd1d0003c10, aGraphicsFilter=FILTER_GOOD, aDest=..., aFill=..., aAnchor=..., aDirty=..., aImageSize=..., aSVGContext=0x0, aImageFlags=24) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsLayoutUtils.cpp:4849 #5 0x00007fd25a34deaa in nsLayoutUtils::DrawBackgroundImage ( aRenderingContext=0x21a11c0, aImage=0x7fd1d0003c10, aImageSize=..., aGraphicsFilter=FILTER_GOOD, aDest=..., aFill=..., aAnchor=..., aDirty=..., aImageFlags=16) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsLayoutUtils.cpp:5015 ... #20 0x00007fd25a304d84 in PresShell::Paint (this=0x20dd640, aViewToPaint=<optimized out>, aDirtyRegion=..., aFlags=1) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsPresShell.cpp:5917 #21 0x00007fd259e748bf in nsViewManager::ProcessPendingUpdatesPaint ( this=0x2275fc0, aWidget=0x20c4210) at /home/dbaron/builds/ssd/mozilla-central/mozilla/view/src/nsViewManager.cpp:452 #22 0x00007fd259e74af8 in nsViewManager::ProcessPendingUpdatesForView ( this=<optimized out>, aView=<optimized out>, aFlushDirtyRegion=<optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/view/src/nsViewManager.cpp:393 #23 0x00007fd25a30e79f in nsRefreshDriver::Tick (this=0x2274ff0, aNowEpoch=<optimized out>, aNowTime=...) at /home/dbaron/builds/ssd/mozilla-central/mozilla/layout/base/nsRefreshDriver.cpp:1214 I'm hoping the RasterImage refactoring seth is working on will fix this; maybe seth can add an appropriate bug dependency?
Flags: needinfo?(seth)
Summary: specific css properties for background-image consuming cpu → same image drawn multiple times with same background-size and different background-position pegs CPU due to repeated rescaling
This is probably a dupe of several similar bugs filed already. The plan to fix them is bug 977459.
Blocks: 977459
I've decided to split bug 977459 into multiple smaller bugs. The patch that fixes this particular issue can be found in bug 1060200, so I'm changing the dependencies accordingly.
No longer blocks: 977459
Depends on: 1060200
Flags: needinfo?(seth)
This was fixed by bug 1060200. I just check, and I no longer see the issue.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: