Closed Bug 962517 Opened 11 years ago Closed 11 years ago

add a way to create canvas without hardware acceleration (chrome only)

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 884226

People

(Reporter: gal, Assigned: gal)

References

Details

Attachments

(1 file, 1 obsolete file)

We use skiaGL on FFOS by default. As a result every 2d canvas we create is hardware accelerated. In some cases that doesn't pay off. For example, we snapshot an app during app switching. For this we create a canvas which forces the GL library to be loaded during a very GPU resource intensive animation moment (old app is fading out, new app is being drawn). Spinning up a GL canvas doesn't help here actually. We are repainting the content right now in software and then blit it onto the gralloc-backed canvas. I propose a simple fix here to allow chrome to create a software-backed canvas. I want to do this instead of demote() to avoid loading the GL libraries, especially during the transition itself. syntax: canvas.getContext("software-2d") Again, this is chrome only and won't affect content. For content we probably should queue draw calls and then device whether using GL is worth it and do all of this on a separate thread to boot.
Assignee: nobody → gal
Attachment #8363581 - Attachment is obsolete: true
This makes the app transition animation homescreen -> settings app butter smooth on my nexus 5. The problem here was really loading the GL drivers into the content process and/or creating the new GL canvas for the snapshot. That was locking the GPU somehow. This will likely also hurt on other GPUs and drivers.
Attachment #8363590 - Flags: review?(bgirard)
Blocks: 961348
Comment on attachment 8363590 [details] [diff] [review] Allow chrome to create a software-only canvas. Review of attachment 8363590 [details] [diff] [review]: ----------------------------------------------------------------- bjacob is a better fit for Canvas reviews.
Attachment #8363590 - Flags: review?(bgirard) → review?(bjacob)
According to hg log, I've only ever reviewed 3 patches touching that file, all specific to Skia/GL :-) This piqued my curiosity though, as I had previously been wondering who would be a good reviewer for general Canvas2D change, so here are the 10 top reviewers for this file over the past year: $ hg log -d -365 content/canvas/src/CanvasRenderingContext2D.cpp | grep ^summary | grep 'r=' | sed 's|.*r=||g' | sort |uniq -c | sort -rn | head -n10 21 roc 18 bz 15 mattwoodrow 10 smaug 6 Ms2ger 5 peterv 5 Bas 4 roc,bz 4 bz. 3 snorp Given the contents of the present patch, adding a new canvas context ID, Roc would probably be the right reviewer. That said, adding a new context ID is a really important basic change that needs agreeing on on the conceptual level before reviewing. Roc is again a person to be asked about that, but I would also suggest involving :jrmuizel in this conversation.
Attachment #8363590 - Flags: review?(bjacob)
It seems like this just a dup of bug 884226
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Yes, we're using this in particular to avoid creating SkiaGL canvas in the scenario where doing so would have us OOM, without much benefit if we don't, because we have to read back.
This has been uplifted to 1.2.
Can someone land the rest of the patch please that uses this for screenshots? Might be worth using this elsewhere too in Gaia. Milan please find the right help if your team can't do the changes.
Flags: needinfo?(milan)
Sure, I'll create a Gaia bug for this, so that we don't try and morph this into it.
Flags: needinfo?(milan)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: