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

Changeset 291566 in webkit


Ignore:
Timestamp:
Mar 21, 2022, 10:53:58 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Accessing WebGL content crashes in macOS Recovery OS
​https://bugs.webkit.org/show_bug.cgi?id=238139

Patch by Kimmo Kinnunen <​kkinnunen@apple.com> on 2022-03-21
Reviewed by Antti Koivisto.

Add a quick fix trying to circumvent a Recovery OS crash.
Parts of this will be reverted once the true source is found.

  • platform/graphics/cocoa/GraphicsContextGLCocoa.mm:

(WebCore::platformSupportsMetal):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r291564 r291566  
     12022-03-21  Kimmo Kinnunen  <kkinnunen@apple.com>
     2
     3        Accessing WebGL content crashes in macOS Recovery OS
     4        https://bugs.webkit.org/show_bug.cgi?id=238139
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add a quick fix trying to circumvent a Recovery OS crash.
     9        Parts of this will be reverted once the true source is found.
     10
     11        * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
     12        (WebCore::platformSupportsMetal):
     13
    1142022-03-21  Tim Horton  <timothy_horton@apple.com>
    215
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm

    r291468 r291566  
    4242#import <pal/spi/cocoa/MetalSPI.h>
    4343#import <wtf/BlockObjCExceptions.h>
     44#import <wtf/darwin/WeakLinking.h>
    4445#import <wtf/text/CString.h>
    4546
    … …  
    5758#import "ImageRotationSessionVT.h"
    5859#endif
     60
     61// Metal may not be available, for example in recovery OS.
     62WTF_WEAK_LINK_FORCE_IMPORT(MTLCreateSystemDefaultDevice);
    5963
    6064namespace WebCore {
    … …  
    97101static bool platformSupportsMetal(bool isWebGL2)
    98102{
     103    // FIXME: Figure out why WebKit runs in recovery system using -framework Metal, but seemingly cannot call into Metal.
     104    // The hunk about runnningInRecoverySystem should be removed once it is clear how WebKit can link strongly to Metal
     105    // but run without Metal.
     106    static bool runningInRecoverySystem = [] {
     107        if (getenv("__OSINSTALL_ENVIRONMENT")) {
     108            WTFLogAlways("WebGL: Running in recovery. Has access to Metal: %s", !MTLCreateSystemDefaultDevice ? "no" : "yes");
     109            return true;
     110        }
     111        return false;
     112    }();
     113    if (runningInRecoverySystem)
     114        return false;
     115
     116    if (!MTLCreateSystemDefaultDevice)
     117        return false;
     118
    99119    auto device = adoptNS(MTLCreateSystemDefaultDevice());
    100120
Note: See TracChangeset for help on using the changeset viewer.