Bug 59929 - [Chromium] Make accelerated 2d canvas enabled by default with skia
Summary: [Chromium] Make accelerated 2d canvas enabled by default with skia
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 05:33 PDT by Justin Novosad
Modified: 2011-12-22 11:53 PST (History)
8 users (show)

See Also:


Attachments
Patch (12.61 KB, patch)
2011-05-02 08:32 PDT, Justin Novosad
no flags Details | Formatted Diff | Diff
Patch (7.67 KB, patch)
2011-05-03 11:54 PDT, Justin Novosad
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Novosad 2011-05-02 05:33:24 PDT
The setting acceleratedCanvas2DEnabled will soon be turned on by default in Chromium.  The effect of this run-time flag must be changed so that it enables the Skia-based GPU acceleration of the 2D canvas.
Furthermore, a new runtime flag must be added in order to enable the legacy accelerated 2D canvas.  The legacy flag will have priority when both flags are enabled simultaneously.
Comment 1 Justin Novosad 2011-05-02 08:32:45 PDT
Created attachment 91924 [details]
Patch
Comment 2 Stephen White 2011-05-02 08:36:36 PDT
Comment on attachment 91924 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91924&action=review

> Source/WebCore/page/Page.cpp:752
> +      m_sharedGraphicsContext3D = SharedGraphicsContext3D::create(chrome(), settings()->legacyAccelerated2dCanvasEnabled() ? 0 : SharedGraphicsContext3D::UseSkiaGPU);

Since this now makes skia-gpu the default path for accelerated canvas, won't we also need to add all failing tests to test_expectations along with this change?
Comment 3 Vangelis Kokkevis 2011-05-02 10:08:22 PDT
Comment on attachment 91924 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91924&action=review

> Source/WebCore/page/Settings.cpp:722
> +void Settings::setLegacyAccelerated2dCanvasEnabled(bool enabled)

This is a chromium-only flag so I think it should only exist in the chromium websettings files much like it was done with the compositeToTexture flag in :

https://bugs.webkit.org/show_bug.cgi?id=52311

It will actually simplify things and you won't have to touch quite that many files.
Comment 4 Justin Novosad 2011-05-02 13:17:25 PDT
Delivery plan proposed by Stephen White:

1:  Add --enable-legacy-accelerated-2d-canvas flag to both Chrome and DRT (won't do anything yet, since old path is still the default)
2:  Change the --accelerated-2d-canvas flag to mean Ganesh, not the old path, and remove the double-meaning of --enable-accelerated-drawing (have it mean only Alok's compositor -> skia stuff, not canvas2D).  This should be a 1-liner in the code.  Along with this change, submit suppressions to test_expectations for the new failures.
3:  Make canvas2D GPU (skia path) on by default in Chrome.  Replace the --enable-accelerated-2d-canvas flag with --disable-accelerated-2d-canvas.  Pass --disable-accelerated-2d-canvas to the CPU step on the canary and trybots, and remove --enable-accelerated-2d-canvas from the GPU step.
4.  Rebaseline the fast/canvas tests that need new pixel results, and remove the suppressions from test_expectations.
Comment 5 Vangelis Kokkevis 2011-05-03 10:12:51 PDT
(In reply to comment #4)
> Delivery plan proposed by Stephen White:
> 
> 1:  Add --enable-legacy-accelerated-2d-canvas flag to both Chrome and DRT (won't do anything yet, since old path is still the default)
> 2:  Change the --accelerated-2d-canvas flag to mean Ganesh, not the old path, and remove the double-meaning of --enable-accelerated-drawing (have it mean only Alok's compositor -> skia stuff, not canvas2D).  This should be a 1-liner in the code.  Along with this change, submit suppressions to test_expectations for the new failures.
> 3:  Make canvas2D GPU (skia path) on by default in Chrome.  Replace the --enable-accelerated-2d-canvas flag with --disable-accelerated-2d-canvas.  Pass --disable-accelerated-2d-canvas to the CPU step on the canary and trybots, and remove --enable-accelerated-2d-canvas from the GPU step.
> 4.  Rebaseline the fast/canvas tests that need new pixel results, and remove the suppressions from test_expectations.

Sounds good.  We should probably flip #3 and #4 so that we have the tests producing the correct results before we turn this on by default.
Comment 6 Justin Novosad 2011-05-03 10:46:55 PDT
(In reply to comment #3)
> (From update of attachment 91924 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=91924&action=review
> 
> > Source/WebCore/page/Settings.cpp:722
> > +void Settings::setLegacyAccelerated2dCanvasEnabled(bool enabled)
> 
> This is a chromium-only flag so I think it should only exist in the chromium websettings files much like it was done with the compositeToTexture flag in :
> 
> https://bugs.webkit.org/show_bug.cgi?id=52311
> 
> It will actually simplify things and you won't have to touch quite that many files.

I tried to do what you suggest, but the problem is that I can't figure out a clean way to access WebSettings from outside of WebKit/chromium/src.  I think your suggestion might not work for what we are trying to do here, unless I am missing something?
Comment 7 Kenneth Russell 2011-05-03 11:12:50 PDT
Comment on attachment 91924 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=91924&action=review

>>> Source/WebCore/page/Settings.cpp:722
>>> +void Settings::setLegacyAccelerated2dCanvasEnabled(bool enabled)
>> 
>> This is a chromium-only flag so I think it should only exist in the chromium websettings files much like it was done with the compositeToTexture flag in :
>> 
>> https://bugs.webkit.org/show_bug.cgi?id=52311
>> 
>> It will actually simplify things and you won't have to touch quite that many files.
> 
> I tried to do what you suggest, but the problem is that I can't figure out a clean way to access WebSettings from outside of WebKit/chromium/src.  I think your suggestion might not work for what we are trying to do here, unless I am missing something?

No, you are correct. You can't access the Chromium WebKit API from WebCore. You can access it from Chrome sources and from within WebKit/chromium/src. The way you've done things looks fine.

> Source/WebCore/page/Settings.h:492
> +        bool m_legacyAcceleratedCanvas2dEnabled : 1;

You need to initialize this new bit to false in the Settings constructor.

> Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h:100
> +#define WebKitLegacyAccelerated2dCanvasEnabledPreferenceKey @"WebKitLegacyAccelerated2dCanvasEnabled"

You don't need to touch any of these Mac-specific files. The Chromium port is the only one using this legacy accelerated canvas 2D code at this point, so it's better not to add the new flag to any of the other ports' WebPreferences-like classes.
Comment 8 Justin Novosad 2011-05-03 11:54:24 PDT
Created attachment 92099 [details]
Patch
Comment 9 Kenneth Russell 2011-05-03 11:58:36 PDT
Comment on attachment 92099 [details]
Patch

Looks fine.
Comment 10 WebKit Commit Bot 2011-05-03 23:25:37 PDT
Comment on attachment 92099 [details]
Patch

Clearing flags on attachment: 92099

Committed r85720: <http://trac.webkit.org/changeset/85720>
Comment 11 WebKit Commit Bot 2011-05-03 23:25:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Justin Novosad 2011-05-04 08:58:45 PDT
(In reply to comment #11)
> All reviewed patches have been landed.  Closing bug.
The patch that was landed is only phase 1.
Further work on this issue continues here:
https://bugs.webkit.org/show_bug.cgi?id=60173
Comment 13 Simon Fraser (smfr) 2011-12-22 10:55:27 PST
Add legacyAccelerated2dCanvasEnabled to Settings with no explanatory comment is a bad thing to do. I have no idea what the difference is between these two prefs.
Comment 14 Justin Novosad 2011-12-22 11:53:42 PST
(In reply to comment #13)
> Add legacyAccelerated2dCanvasEnabled to Settings with no explanatory comment is a bad thing to do. I have no idea what the difference is between these two prefs.

Thanks for spotting this. This code is now vestigial, and should be cleaned out.  Just created: https://bugs.webkit.org/show_bug.cgi?id=75108