⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 155409 in webkit


Ignore:
Timestamp:
Sep 9, 2013, 6:27:23 PM (13 years ago)
Author:
dino@apple.com
Message:

[WebGL] Allow multithreaded OpenGL contexts
https://bugs.webkit.org/show_bug.cgi?id=121062

Reviewed by Simon Fraser.

Expose a new preference "multithreadedWebGLEnabled".

Source/WebCore:

Also examine the value of that preference and, on Mac,
tell the CGLContext that it should go to multithreaded mode.

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::create): Look at the value of the new setting, and
toggle a flag on the context attributes.

  • page/Settings.in: New Setting "multithreadedWebGLEnabled".
  • platform/graphics/GraphicsContext3D.h:

(WebCore::GraphicsContext3D::Attributes::Attributes): Add a "multithreaded" flag.

  • platform/graphics/mac/GraphicsContext3DMac.mm:

(WebCore::GraphicsContext3D::GraphicsContext3D): If the context attributes
suggest we should, tell the OpenGL context to go into multithreaded mode.

Source/WebKit/mac:

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):
(-[WebPreferences multithreadedWebGLEnabled]):
(-[WebPreferences setMultithreadedWebGLEnabled:]):

  • WebView/WebPreferencesPrivate.h:
  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

Source/WebKit2:

  • Shared/WebPreferencesStore.h:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetMultithreadedWebGLEnabled):
(WKPreferencesGetMultithreadedWebGLEnabled):

  • UIProcess/API/C/WKPreferencesPrivate.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

  • mac/WebKit2.order:
Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155408 r155409  
     12013-09-09  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Allow multithreaded OpenGL contexts
     4        https://bugs.webkit.org/show_bug.cgi?id=121062
     5
     6        Reviewed by Simon Fraser.
     7
     8        Expose a new preference "multithreadedWebGLEnabled".
     9
     10        Also examine the value of that preference and, on Mac,
     11        tell the CGLContext that it should go to multithreaded mode.
     12
     13        * html/canvas/WebGLRenderingContext.cpp:
     14        (WebCore::WebGLRenderingContext::create): Look at the value of the new setting, and
     15        toggle a flag on the context attributes.
     16        * page/Settings.in: New Setting "multithreadedWebGLEnabled".
     17        * platform/graphics/GraphicsContext3D.h:
     18        (WebCore::GraphicsContext3D::Attributes::Attributes): Add a "multithreaded" flag.
     19        * platform/graphics/mac/GraphicsContext3DMac.mm:
     20        (WebCore::GraphicsContext3D::GraphicsContext3D): If the context attributes
     21        suggest we should, tell the OpenGL context to go into multithreaded mode.
     22
    1232013-09-09  Ryosuke Niwa  <rniwa@webkit.org>
    224
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r155262 r155409  
    430430    attributes.shareResources = false;
    431431    attributes.preferDiscreteGPU = true;
     432
     433    if (frame->settings().multithreadedWebGLEnabled())
     434        attributes.multithreaded = true;
    432435
    433436    RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow));
  • trunk/Source/WebCore/page/Settings.in

    r153696 r155409  
    106106webGLErrorsToConsoleEnabled initial=true
    107107openGLMultisamplingEnabled initial=true
     108multithreadedWebGLEnabled initial=false
    108109privilegedWebGLExtensionsEnabled initial=false
    109110accelerated2dCanvasEnabled initial=false
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r155358 r155409  
    445445            , shareResources(true)
    446446            , preferDiscreteGPU(false)
     447            , multithreaded(false)
    447448        {
    448449        }
     
    457458        bool shareResources;
    458459        bool preferDiscreteGPU;
     460        bool multithreaded;
    459461    };
    460462
  • trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm

    r153728 r155409  
    161161    // Set the current context to the one given to us.
    162162    CGLSetCurrentContext(m_contextObj);
     163
     164    if (attrs.multithreaded) {
     165        err = CGLEnable(m_contextObj, kCGLCEMPEngine);
     166        if (err != kCGLNoError) {
     167            // We could not create a multi-threaded context.
     168            m_contextObj = 0;
     169            return;
     170        }
     171    }
    163172   
    164173    validateAttributes();
  • trunk/Source/WebKit/mac/ChangeLog

    r155379 r155409  
     12013-09-09  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Allow multithreaded OpenGL contexts
     4        https://bugs.webkit.org/show_bug.cgi?id=121062
     5
     6        Reviewed by Simon Fraser.
     7
     8        Expose a new preference "multithreadedWebGLEnabled".
     9
     10        * WebView/WebPreferenceKeysPrivate.h:
     11        * WebView/WebPreferences.mm:
     12        (+[WebPreferences initialize]):
     13        (-[WebPreferences multithreadedWebGLEnabled]):
     14        (-[WebPreferences setMultithreadedWebGLEnabled:]):
     15        * WebView/WebPreferencesPrivate.h:
     16        * WebView/WebView.mm:
     17        (-[WebView _preferencesChanged:]):
     18
    1192013-09-09  Dean Jackson  <dino@apple.com>
    220
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r153736 r155409  
    103103#define WebKitWebAudioEnabledPreferenceKey @"WebKitWebAudioEnabled"
    104104#define WebKitWebGLEnabledPreferenceKey @"WebKitWebGLEnabled"
     105#define WebKitMultithreadedWebGLEnabledPreferenceKey @"WebKitMultithreadedWebGLEnabled"
    105106#define WebKitAccelerated2dCanvasEnabledPreferenceKey @"WebKitAccelerated2dCanvasEnabled"
    106107#define WebKitFrameFlatteningEnabledPreferenceKey @"WebKitFrameFlatteningEnabled"
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r155379 r155409  
    382382        [NSNumber numberWithBool:NO],   WebKitShowRepaintCounterPreferenceKey,
    383383        [NSNumber numberWithBool:YES],  WebKitWebGLEnabledPreferenceKey,
     384        [NSNumber numberWithBool:NO],   WebKitMultithreadedWebGLEnabledPreferenceKey,
    384385        [NSNumber numberWithBool:NO],   WebKitAccelerated2dCanvasEnabledPreferenceKey,
    385386        [NSNumber numberWithBool:NO],   WebKitFrameFlatteningEnabledPreferenceKey,
     
    14531454}
    14541455
     1456- (BOOL)multithreadedWebGLEnabled
     1457{
     1458    return [self _boolValueForKey:WebKitMultithreadedWebGLEnabledPreferenceKey];
     1459}
     1460
     1461- (void)setMultithreadedWebGLEnabled:(BOOL)enabled
     1462{
     1463    [self _setBoolValue:enabled forKey:WebKitMultithreadedWebGLEnabledPreferenceKey];
     1464}
     1465
    14551466- (BOOL)accelerated2dCanvasEnabled
    14561467{
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r152234 r155409  
    212212- (void)setWebGLEnabled:(BOOL)enabled;
    213213
     214- (BOOL)multithreadedWebGLEnabled;
     215- (void)setMultithreadedWebGLEnabled:(BOOL)enabled;
     216
    214217- (BOOL)accelerated2dCanvasEnabled;
    215218- (void)setAccelerated2dCanvasEnabled:(BOOL)enabled;
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r155164 r155409  
    15091509    settings.setShowRepaintCounter([preferences showRepaintCounter]);
    15101510    settings.setWebGLEnabled([preferences webGLEnabled]);
     1511    settings.setMultithreadedWebGLEnabled([preferences multithreadedWebGLEnabled]);
    15111512    settings.setAccelerated2dCanvasEnabled([preferences accelerated2dCanvasEnabled]);
    15121513    settings.setLoadDeferringEnabled(shouldEnableLoadDeferring());
  • trunk/Source/WebKit2/ChangeLog

    r155379 r155409  
     12013-09-09  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Allow multithreaded OpenGL contexts
     4        https://bugs.webkit.org/show_bug.cgi?id=121062
     5
     6        Reviewed by Simon Fraser.
     7
     8        Expose a new preference "multithreadedWebGLEnabled".
     9
     10        * Shared/WebPreferencesStore.h:
     11        * UIProcess/API/C/WKPreferences.cpp:
     12        (WKPreferencesSetMultithreadedWebGLEnabled):
     13        (WKPreferencesGetMultithreadedWebGLEnabled):
     14        * UIProcess/API/C/WKPreferencesPrivate.h:
     15        * WebProcess/WebPage/WebPage.cpp:
     16        (WebKit::WebPage::updatePreferences):
     17        * mac/WebKit2.order:
     18
    1192013-09-09  Dean Jackson  <dino@apple.com>
    220
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r155379 r155409  
    9494    macro(CSSCustomFilterEnabled, cssCustomFilterEnabled, Bool, bool, true) \
    9595    macro(WebGLEnabled, webGLEnabled, Bool, bool, true) \
     96    macro(MultithreadedWebGLEnabled, multithreadedWebGLEnabled, Bool, bool, false) \
    9697    macro(Accelerated2dCanvasEnabled, accelerated2dCanvasEnabled, Bool, bool, false) \
    9798    macro(CSSRegionsEnabled, cssRegionsEnabled, Bool, bool, true) \
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r152273 r155409  
    480480}
    481481
     482void WKPreferencesSetMultithreadedWebGLEnabled(WKPreferencesRef preferencesRef, bool flag)
     483{
     484    toImpl(preferencesRef)->setMultithreadedWebGLEnabled(flag);
     485}
     486
     487bool WKPreferencesGetMultithreadedWebGLEnabled(WKPreferencesRef preferencesRef)
     488{
     489    return toImpl(preferencesRef)->multithreadedWebGLEnabled();
     490}
     491
    482492void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag)
    483493{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h

    r153879 r155409  
    9696WK_EXPORT bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef);
    9797
    98 // Defaults to false.
     98// Defaults to true.
    9999WK_EXPORT void WKPreferencesSetWebGLEnabled(WKPreferencesRef, bool);
    100100WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
     101
     102// Defaults to false.
     103WK_EXPORT void WKPreferencesSetMultithreadedWebGLEnabled(WKPreferencesRef, bool);
     104WK_EXPORT bool WKPreferencesGetMultithreadedWebGLEnabled(WKPreferencesRef);
    101105
    102106// Defaults to false.
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r155194 r155409  
    24972497    settings.setRegionBasedColumnsEnabled(store.getBoolValueForKey(WebPreferencesKey::regionBasedColumnsEnabledKey()));
    24982498    settings.setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
     2499    settings.setMultithreadedWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::multithreadedWebGLEnabledKey()));
    24992500    settings.setAccelerated2dCanvasEnabled(store.getBoolValueForKey(WebPreferencesKey::accelerated2dCanvasEnabledKey()));
    25002501    settings.setMediaPlaybackRequiresUserGesture(store.getBoolValueForKey(WebPreferencesKey::mediaPlaybackRequiresUserGestureKey()));
  • trunk/Source/WebKit2/mac/WebKit2.order

    r153775 r155409  
    192192__ZN6WebKit17WebPreferencesKey25cssCustomFilterEnabledKeyEv
    193193__ZN6WebKit17WebPreferencesKey15webGLEnabledKeyEv
     194__ZN6WebKit17WebPreferencesKey28multithreadedWebGLEnabledKeyEv
    194195__ZN6WebKit17WebPreferencesKey29accelerated2dCanvasEnabledKeyEv
    195196__ZN6WebKit17WebPreferencesKey20cssRegionsEnabledKeyEv
     
    469470_WKPreferencesSetWebGLEnabled
    470471__ZN6WebKit14WebPreferences15setWebGLEnabledERKb
     472_WKPreferencesSetMultithreadedWebGLEnabled
     473__ZN6WebKit14WebPreferences28setMultithreadedWebGLEnabledERKb
    471474_WKMutableArrayCreate
    472475__ZN6WebKit12MutableArrayC1Ev
     
    78027805_WKPreferencesGetWebGLEnabled
    78037806__ZNK6WebKit14WebPreferences12webGLEnabledEv
     7807_WKPreferencesGetMultithreadedWebGLEnabled
     7808__ZNK6WebKit14WebPreferences25multithreadedWebGLEnabledEv
    78047809_WKPageCopyCustomUserAgent
    78057810_WKPageReload
Note: See TracChangeset for help on using the changeset viewer.