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

Changeset 279303 in webkit


Ignore:
Timestamp:
Jun 25, 2021, 5:39:22 PM (5 years ago)
Author:
mmaxfield@apple.com
Message:

[macOS] WebGL content is unable to use the discrete GPU
​https://bugs.webkit.org/show_bug.cgi?id=227408
<rdar://problem/79216506>

Reviewed by Dean Jackson.

Source/ThirdParty/ANGLE:

There appears to be a key collision:

Source/ThirdParty/ANGLE/include/platform/PlatformMethods.h:#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x3482
Source/ThirdParty/ANGLE/include/EGL/eglext_angle.h:#define EGL_POWER_PREFERENCE_ANGLE 0x3482

Both these keys seem to be accepted by EGL_GetPlatformDisplayEXT().

This patch just changes the value of one of them to a value I picked out of a hat, just so they don't conflict.
We should work with upstream to either:
A) Find a better solution (maybe disambiguate these values based on which function is accepting them), or
B) Make a robust way to make sure keys don't collide in the future.

  • include/platform/PlatformMethods.h:

Source/WebCore:

Simply pass along the power preference into ANGLE. This is read in
DisplayMtl::getMetalDeviceMatchingAttribute().

No new tests. I _think_ this is untestable, because the web exposed power preference is being set correctly.
We’re correctly reporting to the web content that they have successfully asked for a high power context.
We’re just not honoring that internally. If the test is a performance test, or checks the renderer string,
that test would be hardware-dependent, and couldn’t be a regular layout test.

  • platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:

(WebCore::InitializeEGLDisplay):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r279251 r279303  
     12021-06-25  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [macOS] WebGL content is unable to use the discrete GPU
     4        https://bugs.webkit.org/show_bug.cgi?id=227408
     5        <rdar://problem/79216506>
     6
     7        Reviewed by Dean Jackson.
     8
     9        There appears to be a key collision:
     10
     11        Source/ThirdParty/ANGLE/include/platform/PlatformMethods.h:#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x3482
     12        Source/ThirdParty/ANGLE/include/EGL/eglext_angle.h:#define EGL_POWER_PREFERENCE_ANGLE 0x3482
     13
     14        Both these keys seem to be accepted by EGL_GetPlatformDisplayEXT().
     15
     16        This patch just changes the value of one of them to a value I picked out of a hat, just so they don't conflict.
     17        We should work with upstream to either:
     18        A) Find a better solution (maybe disambiguate these values based on which function is accepting them), or
     19        B) Make a robust way to make sure keys don't collide in the future.
     20
     21        * include/platform/PlatformMethods.h:
     22
    1232021-06-24  John Cunningham  <johncunningham@apple.com>
    224
  • trunk/Source/ThirdParty/ANGLE/include/platform/PlatformMethods.h

    r277241 r279303  
    1414#include <array>
    1515
    16 #define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x3482
     16#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x34FD
    1717
    1818#if !defined(ANGLE_PLATFORM_EXPORT)
  • trunk/Source/WebCore/ChangeLog

    r279301 r279303  
     12021-06-25  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [macOS] WebGL content is unable to use the discrete GPU
     4        https://bugs.webkit.org/show_bug.cgi?id=227408
     5        <rdar://problem/79216506>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Simply pass along the power preference into ANGLE. This is read in
     10        DisplayMtl::getMetalDeviceMatchingAttribute().
     11
     12        No new tests. I _think_ this is untestable, because the web exposed power preference is being set correctly.
     13        We’re correctly reporting to the web content that they have successfully asked for a high power context.
     14        We’re just not honoring that internally. If the test is a performance test, or checks the renderer string,
     15        that test would be hardware-dependent, and couldn’t be a regular layout test.
     16
     17        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
     18        (WebCore::InitializeEGLDisplay):
     19
    1202021-06-25  Myles C. Maxfield  <mmaxfield@apple.com>
    221
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm

    r279298 r279303  
    122122    }
    123123    LOG(WebGL, "Attempting to use ANGLE's %s backend.\n", attrs.useMetal ? "Metal" : "OpenGL");
     124    if (attrs.powerPreference != GraphicsContextGLAttributes::PowerPreference::Default) {
     125        displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
     126        if (attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower)
     127            displayAttributes.append(EGL_LOW_POWER_ANGLE);
     128        else {
     129            ASSERT(attrs.powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance);
     130            displayAttributes.append(EGL_HIGH_POWER_ANGLE);
     131        }
     132    }
    124133    displayAttributes.append(EGL_NONE);
    125134    display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(EGL_DEFAULT_DISPLAY), displayAttributes.data());
Note: See TracChangeset for help on using the changeset viewer.