Changeset 252055 in webkit


Ignore:
Timestamp:
Nov 5, 2019 8:52:31 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Enable powerPreference controlled GPU switching with ANGLE
https://bugs.webkit.org/show_bug.cgi?id=203773

GPU switching can't be controlled from within ANGLE running in the content process
due to sandbox restrictions. So we need to continue using the existing
HighPerformanceGPUManager path with ANGLE.

Although the high power GPU is activated on request with this change, ANGLE does
not use it yet.

Patch by James Darpinian <James Darpinian> on 2019-11-05
Reviewed by Alex Christensen.

  • platform/graphics/GraphicsContext3D.cpp:
  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/GraphicsContext3DManager.cpp:

(WebCore::GraphicsContext3DManager::updateHighPerformanceState):
(WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):

  • platform/graphics/cocoa/GraphicsContext3DCocoa.mm:

(WebCore::GraphicsContext3D::GraphicsContext3D):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252047 r252055  
     12019-11-05  James Darpinian  <jdarpinian@chromium.org>
     2
     3        Enable powerPreference controlled GPU switching with ANGLE
     4        https://bugs.webkit.org/show_bug.cgi?id=203773
     5
     6        GPU switching can't be controlled from within ANGLE running in the content process
     7        due to sandbox restrictions. So we need to continue using the existing
     8        HighPerformanceGPUManager path with ANGLE.
     9
     10        Although the high power GPU is activated on request with this change, ANGLE does
     11        not use it yet.
     12
     13        Reviewed by Alex Christensen.
     14
     15        * platform/graphics/GraphicsContext3D.cpp:
     16        * platform/graphics/GraphicsContext3D.h:
     17        * platform/graphics/GraphicsContext3DManager.cpp:
     18        (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
     19        (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
     20        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
     21        (WebCore::GraphicsContext3D::GraphicsContext3D):
     22
    1232019-11-05  youenn fablet  <youenn@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp

    r229858 r252055  
    657657}
    658658
    659 #if !(PLATFORM(COCOA) && USE(OPENGL))
     659#if !(PLATFORM(COCOA) && (USE(OPENGL) || USE(ANGLE)))
    660660void GraphicsContext3D::setContextVisibility(bool)
    661661{
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r247452 r252055  
    15681568#endif
    15691569
    1570 #if PLATFORM(COCOA) && USE(OPENGL)
     1570#if PLATFORM(COCOA) && (USE(OPENGL) || USE(ANGLE))
    15711571    bool m_hasSwitchedToHighPerformanceGPU { false };
    15721572#endif
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp

    r247453 r252055  
    3636#endif
    3737
    38 #if PLATFORM(MAC) && USE(OPENGL)
     38#if PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE))
    3939#include "SwitchingGPUClient.h"
    4040#include <OpenGL/OpenGL.h>
     
    223223void GraphicsContext3DManager::updateHighPerformanceState()
    224224{
    225 #if PLATFORM(MAC) && USE(OPENGL)
     225#if PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE))
    226226    if (!hasLowAndHighPowerGPUs())
    227227        return;
     
    263263
    264264    m_requestingHighPerformance = false;
    265 #if PLATFORM(MAC) && USE(OPENGL)
     265#if PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE))
    266266    SwitchingGPUClient::singleton().releaseHighPerformanceGPU();
    267267#endif
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

    r250740 r252055  
    179179}
    180180
    181 #endif // PLATFORM(MAC) && USE(OPENGL)
     181#endif // PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE))
    182182
    183183GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle, GraphicsContext3D* sharedContext)
     
    185185    , m_private(makeUnique<GraphicsContext3DPrivate>(this))
    186186{
     187
     188#if HAVE(APPLE_GRAPHICS_CONTROL)
     189    m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
     190#else
     191    m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
     192#endif
     193
    187194#if !USE(ANGLE)
    188195#if USE(OPENGL_ES)
     
    209216        ::glEnable(GraphicsContext3D::PRIMITIVE_RESTART_FIXED_INDEX);
    210217#elif USE(OPENGL)
    211 
    212 #if HAVE(APPLE_GRAPHICS_CONTROL)
    213     m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
    214 #else
    215     m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
    216 #endif
    217218
    218219    bool useMultisampling = m_attrs.antialias;
     
    700701}
    701702
     703#endif // USE(OPENGL)
     704
     705#if USE(OPENGL) || USE(ANGLE)
    702706void GraphicsContext3D::setContextVisibility(bool isVisible)
    703707{
     
    709713    }
    710714}
    711 #endif // USE(OPENGL)
     715#endif // USE(OPENGL) || USE(ANGLE)
    712716
    713717#if USE(ANGLE)
Note: See TracChangeset for help on using the changeset viewer.