Open Bug 986945 Opened 12 years ago Updated 3 years ago

poor drawImage() video performance

Categories

(Core :: Graphics, defect)

31 Branch
x86_64
macOS
defect

Tracking

()

People

(Reporter: emujagic, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Steps to reproduce: 1. Have a video of about 3000x720 size. 2. Create canvas (of about 800x600). 3. Use drawImage() and requestAnimationFrame() to render part of video on canvas. 4. Measure FPS Actual results: On Mac OS X Mavericks FPS is very low (~5 fps). Expected results: FPS really should be higher. One can try and use different video and canvas sizes, but the results are pretty much the same.
Component: Untriaged → General
OS: Windows 7 → Mac OS X
Product: Firefox → Core
Can you link to a testcase showing the problem? The exact arguments you're passing to drawImage are likely to be very relevant here.
Flags: needinfo?(emujagic)
Hi, here is a test page: http://centrcam.com/firefoxtest
Flags: needinfo?(emujagic)
Thank you. We're saturating 2 cores, at about 10fps. Looking at what we're actually doing on those two cores, about 40% of the time is spent on what looks like 2 (?) video decoding threads. Another 20% is on the compositor thread, and 40% is on the main thread. The compositor thread time is about half glTexImage2D. The main thread time is, not surprisingly, largely under SurfaceFromElement, breaking down about 50/50 as ImageContainer::DeprecatedGetCurrentAsSurface and gfxPlatform::GetSourceSurfaceForSurface. The former seems to be mostly allocating and zeroing the image surface, with a bit of ConvertYCbCrToRGB. The latter is almost all memmove. I do wonder whether we're grabbing _all_ the video data into an image surface here, not just the rect we want to paint. Twice, given the two drawImage calls. And also, why exactly do we end up with all those memmoves?
Status: UNCONFIRMED → NEW
Component: General → Graphics
Ever confirmed: true
Flags: needinfo?(jmuizelaar)
Ah, looks like we might only do it once if we hit the image cache. But we are _definitely_ grabbing all the video pixel data, not just the pieces we need. :(
Is this significantly faster on other platforms or browsers?
Flags: needinfo?(jmuizelaar)
It's about 2x faster in Chrome on Mac.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.