• Show log

    Commit

  • Hash : e5619a5c
    Author : Yuxin Hu
    Date : 2024-10-15T18:27:00

    Use EGL sync global lock for all EGL*sync entrypoint calls
    
    To free EGL sync operations from waiting for other EGL calls
    to finish, we use a separate global lock for EGL*sync entrypoints.
    Below angle::SimpleMutex are added to protect resources that may
    have race condition due to being accessed by EGL*sync calls
    and non EGL*sync calls at the same time:
    
    1. Display::mContextMapMutex that protects Display::mState.contextMap
    
    2. static angle::base::NoDestructor<angle::SimpleMutex>
    anglePlatformDisplayMapMutex that protects static
    angle::base::NoDestructor<ANGLEPlatformDisplayMap> displays
    
    3. static angle::base::NoDestructor<angle::SimpleMutex>
    devicePlatformDisplayMapMutex that protects static
    angle::base::NoDestructor<DevicePlatformDisplayMap> displays
    
    EGL_Terminate() entry point takes both global lock and
    global egl sync lock. This is to protect Display::mSyncMap,
    Display::mSyncPools, and Display::mSyncHandleAllocator being
    get cleared by thread 1 calling eglTerminate, while they are
    still accessed by thread 2 through a call such as eglCreateSync.
    So that we won't have thread 2 finish validating the sync object with
    syncID exists in Display::mSyncMap, but then find the
    mSyncMap.find(syncID) returns a nullptr due to the mSyncMap
    is cleared by thread 1. Same applies to EGL_LabelObjectKHR(),
    EGL_ReleaseThread(), ThreadCleanupCallback().
    
    EGL_Initialize() writes to Display::mInitialized. This is read
    by EGL Sync API validation functions. EGL_Initialize() also takes
    both global lock and global sync lock to prevent race conditions
    between EGL_Initialize() and EGL Sync APIs.
    
    When ANGLE_CAPTURE_ENABLED is enabled, fall back to global lock,
    as the CaptureEGLCallToFrameCapture() touches many resources
    (e.g. mMaxAccessedResourceIDs, mFrameCalls)
    that could lead to race conditions without a global lock.
    
    Bug: b/362604439
    Change-Id: Ic0d54a4cd66743bcd0f48f41f247dd223cff2f5e
    Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5933570
    Reviewed-by: Roman Lavrov <romanl@google.com>
    Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
    Reviewed-by: Igor Nazarov <i.nazarov@samsung.com>
    Commit-Queue: Yuxin Hu <yuxinhu@google.com>
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/angle.git
    Git SSH git@git.kmx.io:kc3-lang/angle.git
    Public access ? public
    Description

    A conformant OpenGL ES implementation for Windows, Mac, Linux, iOS and Android.

    Homepage

    Github

    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg thodg_l
    Tags