Hash :
e5619a5c
Author :
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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
{
"scripts/egl_angle_ext.xml":
"b3bef068d5c832d52adf78047a22b467",
"scripts/entry_point_packed_egl_enums.json":
"a72ae855c6b403912103b519139951a1",
"scripts/entry_point_packed_gl_enums.json":
"57a3a729fd25032bc336f4b6a55bc238",
"scripts/generate_entry_points.py":
"650fe5fb60ff13aebfdf704c564ad998",
"scripts/gl_angle_ext.xml":
"b63b35cce3edd88219d2ffd0a78c708d",
"scripts/registry_xml.py":
"5553bbd65b566e784fe675048833a4ca",
"src/common/entry_points_enum_autogen.cpp":
"c4d9643dce069cdd462c4d68958adf3c",
"src/common/entry_points_enum_autogen.h":
"394491a8e3851e0f254622ffa7641c5f",
"src/common/frame_capture_utils_autogen.cpp":
"f5dc057d49cdbbfd875fda6bb726161c",
"src/common/frame_capture_utils_autogen.h":
"7c5fa2a738625602eda6cd44d880093d",
"src/libANGLE/Context_gles_1_0_autogen.h":
"cb1cfe652972d301a5a98b4f233fcc4f",
"src/libANGLE/Context_gles_2_0_autogen.h":
"bf03a51e6a27817e503bb822868d290e",
"src/libANGLE/Context_gles_3_0_autogen.h":
"d1697421290173be5ca0bc236fd479b4",
"src/libANGLE/Context_gles_3_1_autogen.h":
"17b51301bb3edd475460e8e77ff21a1c",
"src/libANGLE/Context_gles_3_2_autogen.h":
"cf9900e0067812fc6773e8ae4664da33",
"src/libANGLE/Context_gles_ext_autogen.h":
"9f9ddb327a10f6dacf0339d81d2ac44f",
"src/libANGLE/capture/capture_egl_autogen.cpp":
"330861bd692183c0973402af31adbcd6",
"src/libANGLE/capture/capture_egl_autogen.h":
"c6027dcc52d91e3eb343de409443aa38",
"src/libANGLE/capture/capture_gles_1_0_autogen.cpp":
"d203de86be595ac05578ef01b362380a",
"src/libANGLE/capture/capture_gles_1_0_autogen.h":
"141838b474dda3d9a6122e73d3621972",
"src/libANGLE/capture/capture_gles_2_0_autogen.cpp":
"94f04888c6130a39539bcd7cef1244ff",
"src/libANGLE/capture/capture_gles_2_0_autogen.h":
"73d813905e7e938cf11d1722f98de84b",
"src/libANGLE/capture/capture_gles_3_0_autogen.cpp":
"6705cab4f78501fcbca133b169671037",
"src/libANGLE/capture/capture_gles_3_0_autogen.h":
"5b8aacc112d422326de384edc9425326",
"src/libANGLE/capture/capture_gles_3_1_autogen.cpp":
"a266d12eab9874144d2c948755ee1b76",
"src/libANGLE/capture/capture_gles_3_1_autogen.h":
"414b92fe8db95146d8af3c13830e3685",
"src/libANGLE/capture/capture_gles_3_2_autogen.cpp":
"7e6560b176108a579e281f727d75c410",
"src/libANGLE/capture/capture_gles_3_2_autogen.h":
"74ed7366af3a46c0661397cfa29ec6fc",
"src/libANGLE/capture/capture_gles_ext_autogen.cpp":
"a6537c88a08110224c4859daff403fbf",
"src/libANGLE/capture/capture_gles_ext_autogen.h":
"febb8b4ccc6b66617caee0b608a3972a",
"src/libANGLE/context_private_call_autogen.h":
"faa8cc9fc573c8f138d6c057a50467be",
"src/libANGLE/validationCL_autogen.h":
"0022d0cdb6a9e2ef4a59b71164f62333",
"src/libANGLE/validationEGL_autogen.h":
"b5d9cb7b2ab70a2418e481b893c9e77d",
"src/libANGLE/validationES1_autogen.h":
"06762456388a02b9258d6262c1bf4a1b",
"src/libANGLE/validationES2_autogen.h":
"42a3c5a51ed936d5e47ab08ef2a17c9e",
"src/libANGLE/validationES31_autogen.h":
"1ed81afa47644b88a05e1e2bd72b3393",
"src/libANGLE/validationES32_autogen.h":
"03fbf790c2db53d5b677747d40f5bbd6",
"src/libANGLE/validationES3_autogen.h":
"29b3f384a582a4ffd45a898a481839fd",
"src/libANGLE/validationESEXT_autogen.h":
"f05128142e2f2e3b73fa5a99652ec35f",
"src/libEGL/libEGL_autogen.cpp":
"9f99287bd11f1080c4419406a84e43f8",
"src/libEGL/libEGL_autogen.def":
"8725ff26952f20ef27ad1dbc8b10d250",
"src/libGLESv2/cl_stubs_autogen.h":
"90de40afa78b7574558f8514f53dbab8",
"src/libGLESv2/egl_context_lock_autogen.h":
"84ad500c75a0ee5b21fc7f3ce5bba07b",
"src/libGLESv2/egl_ext_stubs_autogen.h":
"4ee0192e22137991ece292e0d4c7ee21",
"src/libGLESv2/egl_get_labeled_object_data.json":
"2f4148b2ddf34e62670e32c5e6da4937",
"src/libGLESv2/egl_stubs_autogen.h":
"66ee6957861e78ae4090ef6dd735202a",
"src/libGLESv2/entry_points_cl_autogen.cpp":
"09d22bca1c1fc96778d28fd9abc6257a",
"src/libGLESv2/entry_points_cl_autogen.h":
"dde2f94c3004874a7da995dae69da811",
"src/libGLESv2/entry_points_egl_autogen.cpp":
"bf57c0c2a6197ab0c7734676626c4c40",
"src/libGLESv2/entry_points_egl_autogen.h":
"3bc7a8df9deadd7cfd615d0cfad0c6a8",
"src/libGLESv2/entry_points_egl_ext_autogen.cpp":
"c11c764937e694b99ad903bcc8bd8a0c",
"src/libGLESv2/entry_points_egl_ext_autogen.h":
"a1084e21a2abeeff68758a5d874452a7",
"src/libGLESv2/entry_points_gles_1_0_autogen.cpp":
"8a9b44ae11ffe4f631075de4f87b9dc1",
"src/libGLESv2/entry_points_gles_1_0_autogen.h":
"1d3aef77845a416497070985a8e9cb31",
"src/libGLESv2/entry_points_gles_2_0_autogen.cpp":
"9e04f533914a733d102070fe9f75fdb3",
"src/libGLESv2/entry_points_gles_2_0_autogen.h":
"691c60c2dfed9beca68aa1f32aa2c71b",
"src/libGLESv2/entry_points_gles_3_0_autogen.cpp":
"596a4f87774e14ed088f5f3f1dc1d62c",
"src/libGLESv2/entry_points_gles_3_0_autogen.h":
"4ac2582759cdc6a30f78f83ab684d555",
"src/libGLESv2/entry_points_gles_3_1_autogen.cpp":
"b957324c536c9b2d26e298f34a638d06",
"src/libGLESv2/entry_points_gles_3_1_autogen.h":
"a7327c330a91665fc31accbb78793b42",
"src/libGLESv2/entry_points_gles_3_2_autogen.cpp":
"325244982d8c2da41629988c51f6e96a",
"src/libGLESv2/entry_points_gles_3_2_autogen.h":
"647f932a299cdb4726b60bbba059f0d2",
"src/libGLESv2/entry_points_gles_ext_autogen.cpp":
"dda440847362a1fa82f66b93b2e3be65",
"src/libGLESv2/entry_points_gles_ext_autogen.h":
"af2a57a1a6dda8157384dab5d2c81cf8",
"src/libGLESv2/libGLESv2_autogen.cpp":
"4249ea407f503176480b36f2fe09c85d",
"src/libGLESv2/libGLESv2_autogen.def":
"5a2dfff868d1e3e3703d3d127a85fc63",
"src/libGLESv2/libGLESv2_no_capture_autogen.def":
"692d82abce1a5b199b90e3c36b9c9b35",
"src/libGLESv2/libGLESv2_with_capture_autogen.def":
"be224888d3cd3724b326be3f2bd50788",
"src/libOpenCL/libOpenCL_autogen.cpp":
"10849978c910dc1af5dd4f0c815d1581",
"third_party/EGL-Registry/src/api/egl.xml":
"2056d54ea07156f1988ca1366bdee21a",
"third_party/OpenCL-Docs/src/xml/cl.xml":
"6d0bf09e20a8f8c3ae440d79eda08bf9",
"third_party/OpenGL-Registry/src/xml/gl.xml":
"49f0afe5cac23951c74420e457b0cb23",
"third_party/OpenGL-Registry/src/xml/glx.xml":
"94f3eee4b076801d117804eb466714b7",
"third_party/OpenGL-Registry/src/xml/wgl.xml":
"eae784bf4d1b983a42af5671b140b7c4",
"util/capture/frame_capture_replay_autogen.cpp":
"68a6a05cc7766841b3138aeff5bb5231"
}