Changeset 252909 in webkit
- Timestamp:
- Nov 27, 2019 10:59:39 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252907 r252909 1 2019-11-27 James Darpinian <jdarpinian@chromium.org> 2 3 Enable GPU switching with ANGLE 4 https://bugs.webkit.org/show_bug.cgi?id=203916 5 6 This enables the same GPU switching code that we use with OpenGL on ANGLE 7 contexts. ANGLE contexts can now be switched to the high power GPU. 8 9 Reviewed by Dean Jackson. 10 11 * platform/graphics/GraphicsContext3D.h: 12 * platform/graphics/GraphicsContext3DManager.cpp: 13 (WebCore::GraphicsContext3DManager::updateAllContexts): 14 * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: 15 (WebCore::setGPUByRegistryID): 16 (WebCore::GraphicsContext3D::GraphicsContext3D): 17 (WebCore::GraphicsContext3D::updateCGLContext): 18 (WebCore::GraphicsContext3D::screenDidChange): 19 1 20 2019-11-27 Antti Koivisto <antti@apple.com> 2 21 -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r252741 r252909 1200 1200 #endif 1201 1201 1202 #if USE(OPENGL) 1202 #if USE(OPENGL) || USE(ANGLE) 1203 1203 void allocateIOSurfaceBackingStore(IntSize); 1204 1204 void updateFramebufferTextureBackingStoreFromLayer(); 1205 #if PLATFORM(MAC) 1205 1206 void updateCGLContext(); 1206 1207 #endif 1207 1208 #if USE(ANGLE)1209 void allocateIOSurfaceBackingStore(IntSize);1210 void updateFramebufferTextureBackingStoreFromLayer();1211 1208 #endif 1212 1209 #endif // PLATFORM(COCOA) -
trunk/Source/WebCore/platform/graphics/GraphicsContext3DManager.cpp
r252055 r252909 135 135 void GraphicsContext3DManager::updateAllContexts() 136 136 { 137 // FIXME: determine whether to do anything when using ANGLE. 138 #if PLATFORM(MAC) && USE(OPENGL) 137 #if PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE)) 139 138 for (const auto& context : m_contexts) { 140 139 context->updateCGLContext(); -
trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
r252741 r252909 58 58 #elif USE(OPENGL) 59 59 #import <IOKit/IOKitLib.h> 60 #import <OpenGL/CGLRenderers.h>61 60 #import <OpenGL/gl.h> 62 61 #elif USE(ANGLE) … … 85 84 #if PLATFORM(MAC) 86 85 #import "ScreenProperties.h" 86 #if USE(OPENGL) || USE(ANGLE) 87 #import <OpenGL/CGLRenderers.h> 88 #endif 87 89 #endif 88 90 … … 132 134 } 133 135 134 #if PLATFORM(MAC) && USE(OPENGL) // FIXME: This probably should be just USE(OPENGL) - see <rdar://53062794>.135 136 static void setGPUByRegistryID( PlatformGraphicsContext3DcontextObj, CGLPixelFormatObj pixelFormatObj, IORegistryGPUID preferredGPUID)136 #if PLATFORM(MAC) && (USE(OPENGL) || USE(ANGLE)) // FIXME: This probably should be just (USE(OPENGL) || USE(ANGLE)) - see <rdar://53062794>. 137 138 static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixelFormatObj, IORegistryGPUID preferredGPUID) 137 139 { 138 140 // When the WebProcess does not have access to the WindowServer, there is no way for OpenGL to tell which GPU is connected to a display. … … 289 291 290 292 #elif USE(ANGLE) 291 292 UNUSED_PARAM(hostWindow);293 293 294 294 m_displayObj = EGL_GetDisplay(EGL_DEFAULT_DISPLAY); … … 373 373 extensions.ensureEnabled(requiredExtensions[i]); 374 374 } 375 376 EGLDeviceEXT device = nullptr; 377 EGL_QueryDisplayAttribEXT(m_displayObj, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&device)); 378 CGLContextObj cglContext = nullptr; 379 CGLPixelFormatObj pixelFormat = nullptr; 380 EGL_QueryDeviceAttribEXT(device, EGL_CGL_CONTEXT_ANGLE, reinterpret_cast<EGLAttrib*>(&cglContext)); 381 EGL_QueryDeviceAttribEXT(device, EGL_CGL_PIXEL_FORMAT_ANGLE, reinterpret_cast<EGLAttrib*>(&pixelFormat)); 382 auto gpuID = (hostWindow && hostWindow->displayID()) ? gpuIDForDisplay(hostWindow->displayID()) : primaryGPUID(); 383 setGPUByRegistryID(cglContext, pixelFormat, gpuID); 384 #else 385 UNUSED_PARAM(hostWindow); 375 386 #endif // PLATFORM(MAC) 376 387 … … 717 728 718 729 #if USE(ANGLE) 730 731 #if PLATFORM(MAC) 732 void GraphicsContext3D::updateCGLContext() 733 { 734 if (!m_contextObj) 735 return; 736 737 LOG(WebGL, "Detected a mux switch or display reconfiguration. Call CGLUpdateContext. (%p)", this); 738 739 makeContextCurrent(); 740 EGLDeviceEXT device = nullptr; 741 EGL_QueryDisplayAttribEXT(m_displayObj, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&device)); 742 CGLContextObj cglContext = nullptr; 743 EGL_QueryDeviceAttribEXT(device, EGL_CGL_CONTEXT_ANGLE, reinterpret_cast<EGLAttrib*>(&cglContext)); 744 745 CGLUpdateContext(cglContext); 746 m_hasSwitchedToHighPerformanceGPU = true; 747 } 748 #endif 749 719 750 void GraphicsContext3D::allocateIOSurfaceBackingStore(IntSize size) 720 751 { … … 785 816 return; 786 817 #if USE(ANGLE) 787 UNUSED_PARAM(displayID); 818 if (!m_hasSwitchedToHighPerformanceGPU) { 819 EGLDeviceEXT device = nullptr; 820 EGL_QueryDisplayAttribEXT(m_displayObj, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&device)); 821 CGLContextObj cglContext = nullptr; 822 CGLPixelFormatObj pixelFormat = nullptr; 823 EGL_QueryDeviceAttribEXT(device, EGL_CGL_CONTEXT_ANGLE, reinterpret_cast<EGLAttrib*>(&cglContext)); 824 EGL_QueryDeviceAttribEXT(device, EGL_CGL_PIXEL_FORMAT_ANGLE, reinterpret_cast<EGLAttrib*>(&pixelFormat)); 825 setGPUByRegistryID(cglContext, pixelFormat, gpuIDForDisplay(displayID)); 826 } 788 827 #else 789 // FIXME: figure out whether to integrate more code into ANGLE to have this effect.790 828 #if USE(OPENGL) 791 829 if (!m_hasSwitchedToHighPerformanceGPU)
Note: See TracChangeset
for help on using the changeset viewer.