src/libANGLE/Display.cpp


Log

Author Commit Date CI Message
Kramer Ge dcc715ee 2025-06-19T15:35:53 Enable EGL_PLATFORM_GBM_KHR platform with device selection FunctionsEGL.cpp: - Allow EGL_PLATFORM_GBM_KHR platform and explicit device selection. - Skip getPreferredDisplay if an explicit device is specified. Display.cpp: - Use DisplayEGL impl with EGL_PLATFORM_GBM_KHR. - Wayland can use GBM platform, and OPENGLES. angle.gni: - Rename ozone_platform_gbm to ozone_platform_drm since its deprecated. Bug: angleproject:425569857, b/396434686 Change-Id: I9493118f9dc95f78ebe46277bb4fcfeb7a29d465 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6663699 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kramer Ge <fangzhoug@chromium.org>
Shahbaz Youssefi b64d380e 2025-04-15T00:54:22 Vulkan: Ghost texture's image backing if overwritten If the texture's image is in use by the GPU but is overwritten completely, this change releases the old image and creates a fresh one. If the texture was used in a render pass, this avoids breaking the render pass. Otherwise, it allows the new image to be initialized with VK_EXT_host_image_copy functionality. In the very least, an unnecessary barrier is avoided. As a targeted optimization, this functionality is limited to non-array 2D color textures which are known to benefit from this ghosting in applications. Other texture types can be easily added, but need lots of tests to be added. Bug: angleproject:42265356 Change-Id: I18a7587599e36f9f70109264ddc1003b24b8b2df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6456345 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 5b343e8f 2025-03-11T11:35:08 Vulkan: Remove support for Stadia Bug: angleproject:42262714 Change-Id: Icae5fe828fe4e0bcd287d297df1bc586708ef86e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6344390 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Roman Lavrov cfb430c8 2025-02-10T13:19:05 Remove angle::ErrorStream helper Most uses of the helper either use just the code or a fixed string, which compiles to a few instructions. Using this helper adds 200+ bytes of assembly to each use, due to the unneeded instantiation of ostringstream which allocates a buffer etc. The combined effect of this CL on an Android perf build is ~12KB (0.2%) reduction in size. The cases where the message is actually formatted are converted to an explicit use of ostringstream. Removing the helper so that the new code is explicit about the intent to use ostringstream, or an alternative way to format the message. Discovered accidentally while looking into size reduction due to __builtin_unreachable() Semi-automated code change, risk of copy-paste mistakes should be minimal. Bug: angleproject:394129077 Change-Id: I47c2642d750d31416b08a1cfa435d5463c294e35 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6250078 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi bbc0d702 2024-12-27T07:44:01 Vulkan: Add entry points to lock the Vulkan queue ... which can be retrieved via EGL_ANGLE_device_vulkan. Otherwise the application is unable to use the VkQueue that is retrieved out of ANGLE from other threads (such as Chromium's DrDC feature). Bug: chromium:380295059 Change-Id: Ife80f54440777486f72fc61697a68fb0c2b2d0f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6116046 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Steven Noonan 3226a3df 2024-12-13T14:06:55 Reland: vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid Implement the ability to select a specific device and driver combination through a few new selection criteria: VkPhysicalDeviceIDProperties::deviceUUID VkPhysicalDeviceIDProperties::driverUUID VkPhysicalDeviceDriverProperties::driverID Earlier version had problems due to a test build issue. Per syoussefi@, going to rework the test into a separate CL so that we get the core change merged. Bug: angleproject:351866412 Change-Id: I0a3f4f1a2154a06bf6286a037c9ad4834ef4dda2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6165286 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Steven Noonan <steven@uplinklabs.net>
Yuly Novikov 3b092269 2025-01-09T08:54:00 Revert "vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid" This reverts commit 96abb2c3d9e296ae12e50e0026bf5d3a7b925e7e. Reason for revert: breaks rolling into Chromium https://chromium-review.googlesource.com/c/chromium/src/+/6158098 Original change's description: > vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid > > Implement the ability to select a specific device and driver combination > through a few new selection criteria: > > VkPhysicalDeviceIDProperties::deviceUUID > VkPhysicalDeviceIDProperties::driverUUID > VkPhysicalDeviceDriverProperties::driverID > > Bug: angleproject:351866412 > Change-Id: Ia6716aaed658d2563612d8b5d81287df97b57462 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5686557 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Auto-Submit: Steven Noonan <steven@uplinklabs.net> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:351866412 Change-Id: Ic7cf9dcf6a950556cc44f5920498db429c866340 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6164164 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Steven Noonan 96abb2c3 2024-12-13T14:06:55 vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid Implement the ability to select a specific device and driver combination through a few new selection criteria: VkPhysicalDeviceIDProperties::deviceUUID VkPhysicalDeviceIDProperties::driverUUID VkPhysicalDeviceDriverProperties::driverID Bug: angleproject:351866412 Change-Id: Ia6716aaed658d2563612d8b5d81287df97b57462 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5686557 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Steven Noonan <steven@uplinklabs.net> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxiang Qian a1be7e61 2024-11-26T14:39:18 Implement EGL_EXT_surface_compression This patch adds implementation of EGL_EXT_surface_compression to ANGLE, including new API eglQuerySupportedCompressionRatesEXT and adding EGL_SURFACE_COMPRESSION_EXT in EGLQuerySurface and EGLCreateWindowSurface/EGLCreatePlatformWindowSurface. Angle end2end test is added to verify the extension. Bug: angleproject:375496226 Change-Id: I06926930d94485a378fc831d552cf55fe7938a57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6073355 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Le Hoang Quyen 6bb1bc9b 2024-12-10T16:56:33 Add an extension to report total memory usage of all GL objects Currently the extension will only count GL buffers, textures and render buffers' memory. Fixed: angleproject:383256300 Change-Id: I33ce6fafae8aa5b60071e66366d35dc098e1313b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6084013 Auto-Submit: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Roman Lavrov 42f9c200 2024-11-19T08:50:35 Comments: www.anglebug.com -> anglebug.com The former doesn't work. Bug: None Change-Id: Ib16b005adb5b61a3a1277588e240c3d68705205c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6034293 Reviewed-by: Cody Northrop <cnorthrop@google.com>
Yuxin Hu e5619a5c 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>
Shahbaz Youssefi bd9d0285 2024-10-26T01:12:23 Remove feature description / condition enums Since ANGLE no longer produces anything for these strings, Chromium no longer queries them and they can be removed. Bug: chromium:371512561 Change-Id: I921cbd91a3328df99b15262d31d52986d4a7b806 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5966697 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a0586d6e 2024-10-26T00:32:27 Remove feature description / condition strings These strings show up in chrome://gpu so they can marginally be useful, but are otherwise dead weight for most uses of ANGLE / users of ANGLE. While slightly less convenient, the feature name can always be linked back to the source code if needed so the presence of such metadata is not necessary either. This shaves 40KB from the binary size of ANGLE when built with Vulkan only on Android. Bug: chromium:371512561 Change-Id: I3959961bb7de95cc60a85130d0ff38a7fd533fb7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5968453 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 78f146e3 2024-10-14T00:00:00 Remove EAGL support Fixed: angleproject:362530620 Change-Id: I6157655a7ad5b1e30c5d0a155d3ae3e8a81997e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938872 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Yuxin Hu 0de7c43f 2024-09-19T16:57:23 Remove unused functions Static function Display::GetEglDisplaySet() is no longer used. The function was first introduced in https://chromium-review.googlesource.com/c/angle/angle/+/3294581, but the usage was removed in https://chromium-review.googlesource.com/c/angle/angle/+/4742383. Remove the unused function. Bug: b/362604439 Change-Id: I007a5850f642a46f6d141ee88cfd6e221f9358fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5877313 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 67d8d8c8 2024-07-29T13:44:37 WebGL: Reject shaders with infinite loops Bug: chromium:350528343 Change-Id: I1b2fc152cf285b0e69c4c294351c1cf2389cc234 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746714 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Steven Noonan 87e9ee9c 2024-07-08T14:07:05 egl: add missing extension string for D3D LUID This extension was never announcing itself. Bug: angleproject:351866412 Change-Id: I9a6e4aae1ea3a8aba49ed036cb7cc14ec1a9151f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5686555 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Steven Noonan <steven@uplinklabs.net>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 7ce42b42 2024-05-30T16:08:12 Skip Display::prepareForCall calls everywhere except Mac. Display::prepareForCall was added for CGL and EAGL backends which need to know when an EGL call on a new thread is about to happen. Making this virtual call on all EGL calls on all platforms adds overhead which we can avoid so compile out prepareForCall everywhere except Mac. Bug: angleproject:8434 Change-Id: I7b50463ed405a73eb993e18eb4f83434b4a4fd6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5582015 Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang ccd9a43b 2024-05-22T11:15:39 Split EGL_ANGLE_device_d3d into D3D9 and D3D11 versions. Add EGL_ANGLE_device_d3d9 and EGL_ANGLE_device_d3d11 which make it possible to know what type of device can be queried ahead of time without generating EGL errors. Refactor the DeviceD3D class into Device9 and Device11. Remove the getType method now that it's not needed for internal validation. Keep EGL_ANGLE_device_d3d for backwards compatibility. Bug: angleproject:342096132 Change-Id: Ib950abad58e46a5be269891ea7afd0cb8534cbe8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5559163 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang a70ef7fc 2024-04-25T14:19:50 Add EGL_ANGLE_no_error for disabling EGL validation. Chrome makes many small EGL calls that can have proportionally expensive validation. Bug: angleproject:8434 Change-Id: I4f4d0e6eff64839f76a0f7bf48e5c94b8df9d809 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5491459 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c3a1cae4 2024-04-15T14:58:55 Use angle::SimpleMutex everywhere in libGLESv2 Only cases left that use std::mutex are: - Share group and the context ErrorSet mutexes as they need try_lock() - Anywhere mutexes are used in conjunction with std::condition_variables (as they explicitly require std::mutex) Bug: angleproject:8667 Change-Id: Ib6d68938b0886f9e7c43e023162557990ecfb300 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5453294 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 7220307b 2024-03-13T16:13:45 Conditionally support EGL_OPENGL_API Advertize support for EGL_OPENGL_API only if angle_enable_gl_desktop_frontend is enabled. Bug: b/322142833 Tests: EGLQueryContextTest.DesktopGlApi* Change-Id: I680ea985e45e793d92fc087d21f38fd5d38f0241 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5369641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi aba3705b 2024-03-02T21:58:34 Vulkan: Completely remove egl::Display from RendererVk This class is now independent of EGL. The only mentions of EGL is egl::ContextPriority, which is just an enum and is tolerable for now. OpenCL can now instantiate RendererVk without having to create a temp egl::Display. Bug: angleproject:8564 Change-Id: Ia78cfcb3a48c97f397441cf7cda71d74cfaddd8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5335581 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f044aaf8 2024-03-02T00:51:33 Vulkan: Create instance/device without access to Display The feature overrides are now encapsulated in a struct, a reference to which is passed around until features are initialized. Additionally, some window system information needed to decide which extensions to use or workarounds to apply are passed around. This is a step towards decoupling RendererVk from egl::Display for direct use with OpenCL. Bug: angleproject:8564 Change-Id: Id6c5d1c3b38aafcd4397e54cc6cad32bf849eeda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5335823 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4e6fe5e0 2024-02-29T15:01:06 Vulkan: Cache ImageLoadContext in context This avoids the need to requery this from the display every time. Bug: angleproject:8564 Change-Id: Ied650e7789741f59b7662c0f97c55132b105778d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5332074 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Liza Burakova e8a3493f 2024-02-14T21:51:00 Initialize DisplayWgpu This change adds basic initialize to DisplayWgpu as well as adding APIs for DisplayGLX and DisplayWgpu. These APIs are necessary to ensure DisplayWgpu doesn't pull in necessary X11 headers that break builds. Bug: angleproject:8477 Change-Id: Icc6d9e7246a741def7a0337a296f9c1f9cec1415 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5259979 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Liza Burakova 157088ad 2024-01-30T20:24:50 Add EGL extension for WebGPU Bug: angleproject:8476 Change-Id: Ic5aad4eb56239d9346c6ba1f812d070ce85131a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5245895 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Geoff Lang c27a4a1d 2023-11-27T14:44:07 Re-use EGL sync object allocations. Create a pool of EGL sync objects with their implementations that can be re-used. Update all backend implementations to support multiple calls to initialize/destroy. Pool size of 32 chosen through experimentation using Chrome. Bug: angleproject:8430 Change-Id: I86fea41aed35eddccc953efb3802bf5fdb7f3cb2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5063341 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 1ff6a6f2 2023-11-27T13:08:29 Pass the attribute map to egl::Sync::initialize. The attribute map was typically passed to the impl objects in the constructors. Instead, pass it to the initialize function. This removes the need for many member variables in different backends and opens up the future optimization of re-using sync objects by calling initialize on them with new attributes. Bug: angleproject:8430 Change-Id: If69970462cfed39d9a205034adb5ddd937c5ea31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5063335 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 2155534b 2023-11-06T11:49:20 Don't set dirty bits for attribs that are out of range. PrivateState::setAllDirtyBits sets all bits in mDirtyCurrentValues. When the context has fewer max attibutes than MAX_VERTEX_ATTRIBS, this can cause out-of-bounds access to PrivateState::mVertexAttribCurrentValues if the dirty bits are iterated over without range validation. Bug: chromium:1496378 Change-Id: I65481c432263a6e353a9361bba741b97dc5e20b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5008034 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Igor Nazarov 4b724130 2023-06-27T18:08:27 Rename SharedContexMutex into ContexMutex Follow up after: Replace (Single/Shared)ContextMutex classed with ContextMutex Renamed build option: angle_enable_shared_context_mutex -> angle_enable_context_mutex Renamed because there is no more SharedContexMutex class and ContextMutex is now used for both Shared and not Shared Contexts. Bug: angleproject:8226 Change-Id: I68eea84aa59441d9c5b19870910b2bb499311e08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4650350 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Igor Nazarov ca4dc52e 2023-06-22T15:20:12 Replace (Single/Shared)ContextMutex classed with ContextMutex This CL removes `SingleContextMutex` class and not 100% safe `Context::lockAndActivateSharedContextMutex()` method. `SharedContextMutex<>` was replaced with `ContextMutex` with static mutex type which is defined in "SharedContextMutex.h": - ContextMutexType = std::mutex Above refactoring also allows storing `State::mContext` by value, instead by pointer. Actual mutex is referenced by `ContextMutex::mRoot` member. This removes extra pointer indirection and slightly improves performance. If newly created Context uses shared textures/samplers, then it uses `Display::mManagersMutex` root as its root. Performance in Single/Shared cases now will be the same, and it should be slightly faster then old Shared case (because of the reduced complexity). Bug: angleproject:8226 Change-Id: I7ca4d9ea008c665cbea98ace1c6e7bbc544f54b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4632729 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov f1345d1c 2023-08-02T14:23:59 Call ReleaseThread() entry point from ThreadCleanupCallback Change relevant only for the Android platform. Fixes problems: 1. Current code calls `thread->setCurrent(nullptr)` in `Display::threadCleanup()` method, while not executing other code that will actually unmake Context from current. This will affect following EGL calls from the application's side in its own thread cleanup callback. For example, calls to `eglMakeCurrent()` (to unmake from current) or `eglReleaseThread()` will be no-op. This may lead to memory leak if context was previously marked for destruction. 2. The `Display::threadCleanup()` did not also clears the `CurrentValidContext`. This may cause crashes or other UB if an application will call some GLES API in its thread termination callback (for example `glFinish()`), if ANGLE already destroyed the context in its ThreadCleanupCallback (use after delete). 3. Context will remain current to a thread that terminated. Current implementation of GLES drivers on Mali/Adreno GPUs automatically unmade context from current, so the application may make this context current to some other thread. ANGLE should mimic this behavior to avoid possible bugs. All of the above problems may be fixed by simply calling from the ThreadCleanupCallback either: - MakeCurrent(t, d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) - ReleaseThread(t) This CL choose to call `ReleaseThread()` because this is the API that the application may call in its own thread cleanup callback. And if application's callback will be called later than ANGLE's callback, then application's `eglReleaseThread()` call we be a no-op. Even if the application does not have its own thread cleanup callback (like most of the applications), there is no harm to call `ReleaseThread()` anyway. The only difference with `MakeCurrent()` is that it will also cleanup invalid objects and some other memory depending on the backend. This CL naturally replaces existing logic with Display termination when there is no active threads thanks to the previous CL: "Perform Display terminate(InternalCleanup) from makeCurrent()". Bug: angleproject:6723 Bug: angleproject:8283 Test: angle_end2end_tests --gtest_filter=EGLContextSharingTest.ThreadCleanupCallback* Test: angle_end2end_tests --gtest_filter=EGLContextSharingTest.UnmakeFromCurrentOnThreadExit* Change-Id: I8c5b31f34f91c4bfdac165ac30c213ff5fef992e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4742383 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Mohan Maiya 9740b01b 2023-09-08T16:30:08 Enhance UnlockedTailCall run method UnlockedTailCall::CallType is now std::function<void(void *)> This is in preparation for upcoming changes where unlocked tail calls need access to objects outside block and namespace scope. Bug: angleproject:8340 Tests: UnlockedTailCall* Change-Id: Ida6822b701c5c11ce4b8f6e3aae53108755e2cad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4852021 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Phan Quang Minh e408fc53 2023-08-09T06:25:38 Add support for EGL_MESA_platfrom_surfaceless extension This adds support for the EGL_PLATFORM_SURFACELESS_MESA platform type to allow applications to obtain an EGLDisplay that's independent of any native windowing systems. This will be used in Ozone/Wayland to create surfaceless EGLDisplays. Bug: angleproject:8331 Change-Id: If2ae7a811cfa63ab9f49d54d78f5a3782c8c2fed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749337 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Steven Noonan f395f34b 2023-08-03T13:58:43 features: frontload feature overrides This allows us to have features that depend on the state of other features more reliably. For example, let's say you have two features: ANGLE_FEATURE_CONDITION(&mFeatures, allowX, (benefitsFromX || isSpecificHardware) && !isBadHardware); ANGLE_FEATURE_CONDITION(&mFeatures, supportsX, hardware.featureXSupported && mFeatures.allowX.enabled); Before this change, if you overrode allowX, the override would be applied too late for the supportsX test. This also helps with disabling dependent features via overrides. For example, if you disable "supportsRenderpass2", it will also disable features depending on it, such as "supportsDepthStencilResolve" and "supportsFragmentShadingRate". By frontloading the feature overrides, we can have cross-dependencies between "feature supported on this platform" and "allow this feature by policy". Bug: angleproject:8291 Change-Id: Id6da2c89428fa896d677fe8d5a41369277a21b31 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749524 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Steven Noonan <steven@uplinklabs.net> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brian Ho d2a6b2a0 2023-08-04T14:15:11 Use offscreen DisplayVk on ChromeOS Currently, we always use DisplayVkHeadless on ChromeOS which can fail if the drivers do not support VK_EXT_headless_surface (like on Intel). At the end of the day, CrOS never really uses Vulkan WSI, so it shouldn't need a WSI extension anyways. This CL introduces a simple DisplayVkOffscreen that requires no WSI. We then configure CrOS to use this new DisplayVk. Bug: b/292249282 Change-Id: I1fcbb48d187eb656c6e03bc7ac7b15ac8ad0a4ae Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4752416 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brian Ho <hob@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Steven Noonan dbae1804 2023-07-02T18:39:14 Display: remove redundant 'metal' ANGLE_DEFAULT_PLATFORM This one is already handled only a few lines before. Bug: angleproject:8285 Change-Id: Ib62ce6062551faf39360371c46a05f9cc4a70b07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749295 Auto-Submit: Steven Noonan <steven@uplinklabs.net> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov c95ffadf 2023-07-24T13:00:32 Perform Display terminate(InternalCleanup) from makeCurrent() Current state: - Call to `eglTerminate()` is canceled if there are Contexts current. - All not current Contexts are invalidated in `eglTerminate()` call. - Full Display termination will happen only when last Context is actually destroyed in `eglDestroyContext()` or last active thread terminates (Android only). Problem: - Context is not marked invalid after it is unmade from current when `eglTerminate()` was already called. - If `eglDestroyContext()` was called while context was current, it will be destroyed when unmade from current - in this case actual Display termination will NOT happen. After this change: - Context immediately invalidated after it is unmade from current when `eglTerminate()` was already called. - Full Display termination will happen after the last Context is unmade from current (all Contexts are invalid). Bug: angleproject:6798 Test: angle_end2end_tests --gtest_filter=EGLDisplayTest.ContextLeakAfterTerminate* Change-Id: Idcce94b041649db58d3d879858fba99109347baf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4708328 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Igor Nazarov 959ccb96 2023-08-02T13:40:16 Add EGL_BAD_ACCESS validation into ValidateMakeCurrent Current code does not generate EGL_BAD_ACCESS in `eglMakeCurrent()` according to the specification: - If context is current to some other thread, or if either draw or read are bound to contexts in another thread, an EGL_BAD_ACCESS error is generated. Additional changes: - replace `Context::getRefCount()` with `isReferenced()` for consistency with added `Surface::isReferenced()` method. - remove duplicate `ValidateSurface` call for the `drawSurface` in case if `readSurface` is the same. - remove duplicate `ValidateCompatibleSurface()` call for the `readSurface` in case if `drawSurface` is different. - Fix EGLContextASANTest.DestroyContextInUse test. - Fix EGLContextSharingTestNoSyncTextureUploads.NoSync test. Bug: angleproject:8282 Change-Id: I2af0d7f50019c2445b42279bdd0e0197dd8ad20f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4742382 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Brian Ho 6dc0c9d6 2023-07-31T22:54:03 Revert "Use DisplayVkSimple on ChromeOS" This reverts commit b8ddba2a674158ec6135eda18c3371be84ad6ff7. Reason for revert: Breaks Chromium Original change's description: > Use DisplayVkSimple on ChromeOS > > Currently, we always use DisplayVkHeadless on ChromeOS which can fail > if the drivers do not support VK_EXT_headless_surface (e.g. Intel). > This CL changes the default to use DisplayVkSimple which requires > VK_KHR_display which is better supported. At the end of the day, CrOS > never really uses Vulkan WSI, so the actual WSI extension used > doesn't matter. > > Bug: b/292249282 > Change-Id: I0f8cfafa635405850cda97c84ad45d3f6aec5103 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4727450 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Brian Ho <hob@chromium.org> Bug: b/292249282 Change-Id: If3ab1a39cb86dae1bf0652ca16bba323f497fcc4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4734578 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Brian Ho <hob@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Brian Ho b8ddba2a 2023-07-28T14:30:53 Use DisplayVkSimple on ChromeOS Currently, we always use DisplayVkHeadless on ChromeOS which can fail if the drivers do not support VK_EXT_headless_surface (e.g. Intel). This CL changes the default to use DisplayVkSimple which requires VK_KHR_display which is better supported. At the end of the day, CrOS never really uses Vulkan WSI, so the actual WSI extension used doesn't matter. Bug: b/292249282 Change-Id: I0f8cfafa635405850cda97c84ad45d3f6aec5103 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4727450 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Brian Ho <hob@chromium.org>
Mohan Maiya 451b3c31 2023-07-26T10:45:36 Account for overridden features in ANGLEPlatformDisplay key Overridden features were not included in ANGLEPlatformDisplay key causing false cache hits when querying for displays with different feature override requirements. On platforms that reuse displays across end2end test runs it resulted in the tests using the wrong display. Bug: angleproject:8275 Change-Id: Id67f3cefb821d4d0be5945f66e34f366d0768346 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4720468 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9f9284b7 2023-07-17T15:41:27 Move ShareGroup to its own files Bug: angleproject:8224 Change-Id: Id6d272018bb5ee8c3e35488f641efa4d99fa836d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4690003 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 1d496191 2023-07-13T14:14:08 Revert "Terminate the display if initialization fails." This reverts commit ebaadc6c2cba4085e0d31ca7deebd00192e33f64. Reason for revert: Breaking some Chrome/Dawn tests that use the VK backend Original change's description: > Terminate the display if initialization fails. > > If DisplayImpl::initialize fails, call terminate to ensure no resources > are leaked. > > This is a speculative fix for dual GPU macs not falling back to the > low power GPU. DisplayMtl leaks the metal device if it fails to > initialize due to unsupported GPU families or vendors. > > Bug: chromium:1322521 > Change-Id: Ie227216bc92ef2834ec50190fbb78bec45e9c053 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4641107 > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> Bug: chromium:1322521 Change-Id: I379521130071623a8d050d2cadf2059c0b696d32 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678359 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang ebaadc6c 2023-06-24T08:41:15 Terminate the display if initialization fails. If DisplayImpl::initialize fails, call terminate to ensure no resources are leaked. This is a speculative fix for dual GPU macs not falling back to the low power GPU. DisplayMtl leaks the metal device if it fails to initialize due to unsupported GPU families or vendors. Bug: chromium:1322521 Change-Id: Ie227216bc92ef2834ec50190fbb78bec45e9c053 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4641107 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi f5ad056b 2023-07-10T22:13:34 GL: Fix ScalarizeVecAndMatConstructorArgs and move to gl/ This transformation was buggy and was disabled. Originally, it was intended to be used everywhere. It is now needed for a GL driver workaround. This change reimplements this transformation and uses it as a GL workaround. Bug: chromium:1420130 Change-Id: I42d63fa5844bcf683ac41e61925aa637e033ca2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4676634 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Steven Noonan 113f847b 2023-06-26T12:07:52 centralize basic OS/platform detection functions We had multiple different places that defined these, and with varying naming schemes. Centralize them to be defined in platform_helpers.h. Also renaming the IsApple(uint32_t) functions to IsAppleGPU(uint32_t) to avoid ambiguous meaning: "IsApple" should mean "is Apple-vended OS" while "IsAppleGPU" should mean "is Apple GPU vendor ID". Bug: angleproject:8229 Change-Id: If4e3fc5ac1b5b8ad416663950a1b2ee912ccad99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4647291 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Steven Noonan <steven@uplinklabs.net> Auto-Submit: Steven Noonan <steven@uplinklabs.net> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 0fe6f282 2023-06-24T14:06:17 Reset and then populate frontend features during display initialize Overwritten features were never reset even if a display was terminated. On platforms that reuse displays for all tests in the end2end suite, overridden feature would leak into subsequent tests causing unexpected failure. Bug: angleproject:8235 Change-Id: I1b359bc762a2bca8db4e4dbc7a587604e5bd6a5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4643453 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Igor Nazarov 3545ae0c 2023-06-09T16:11:47 Add isContextMutexStateConsistent() ASSERT Added `gl::Context::isContextMutexStateConsistent()` method. This method is primarily used to check if "SharedContextMutex" activation worked successfully. It is automatically called in the updated `ScopedContextMutexLock` before unlocking. This is to catch possible errors using ASSERT during normal ANGLE operation in applications and tests. The `ScopedContextMutexLock` is now also used instead of the `std::lock_guard<egl::ContextMutex>` in the `SCOPED_SHARE_CONTEXT_LOCK`. No performance regression observed. Important note: `lockAndActivateSharedContextMutex()` is NOT 100% safe regardless of the `kActivationDelayMicro` value, so `ASSERT` may still fail. However, failure does not necessary mean that there will be an undefined behavior, it means that UB might happen. Bug: angleproject:6957 Bug: chromium:1336126 Change-Id: Iee7357fede0d37fa315fe2cc7d27a4e30a304194 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4610227 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Igor Nazarov 36c3e0f5 2023-01-17T17:42:59 Implement "Shared Context Mutex" functionality. Existing implementation uses single `GlobalMutex` for - EGL calls - GL calls for Contexts with concurrent access. This CL introduces abstract `egl::ContextMutex` with two implementations: - SingleContextMutex; - SharedContextMutex<Mutex>; Note: `std::mutex` is used in this commit. It is very easy to change mutex type either at compile-time or at run-time (single type per Display). When Context: - is not Shared; - does not use `EGLImage`s; - does not use EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE - does not use EGL_DISPLAY_SEMAPHORE_SHARE_GROUP_ANGLE then it will be using `SingleContextMutex` with minimal overhead. Before such Context is used as `shareContext` or uses `EGLImage` its mutex replaced by `SharedContextMutex<Mutex>`. The `GlobalMutex` is only used for EGL calls, while `egl::ContextMutex` implementations for GL calls. Because some EGL calls use Context, explicit `egl::ContextMutex` lock is required. This is implemented by generating "egl_context_mutex_autogen.h" header, and insertion of `ANGLE_EGL_SCOPED_CONTEXT_LOCK()` macro before `ANGLE_EGL_VALIDATE()` in each EGL entry point. Implementation in "egl_context_lock_impl.h" returns lock for required APIs. Special cases of `egl::ContextMutex` lock handled separately. `std::unique_lock<>` is not used for performance reasons. `egl::ContextMutex` explicitly locked when capturing EGL calls. Fixes EGLImage problem: https://chromium.googlesource.com/angle/angle/+/e18240d136d15e5cdfa4fa4a6355ca21c8d807b6 Mark contexts as shared when importing EGL images. Details: - EGLImage inherits Context's mutex when created. Mutex is used when the EGLImage accessed or destroyed. - When EGLImage is used in Context with other `egl::ContextMutex`, two mutexes are merged into one. - After the mutex merge, Context Groups will remain separate, but will not be able to run in parallel. Fixes race when checking `context->isShared()` in the `SCOPED_SHARE_CONTEXT_LOCK()` macro. One Context may start executing GL call while not "Shared", but become "Shared" inside the call. New (second) "Shared" Context may immediately start using GL and potentially corrupt some "Shared" state. Possible performance benefit: allows parallel execution in some cases, when single `GlobalMutex` would block. Important note: Process of replacing the `SingleContextMutex` by `SharedContextMutex<Mutex>` is not 100% safe. This mean that original Context may still be using `SingleContextMutex` after activating `SharedContextMutex<Mutex>`. However, this was always the case before introduction of this CL. Old `Context::mShared` member update was not synchronized in any way at all. In other words, this solution does not 100% fix the original problem. For 100% safe solution `SingleContextMutex` should not be used (always pass `SharedContextMutex<Mutex>` to the `gl::Context` constructor). See `lockAndActivateSharedContextMutex()` for more details. CL adds new build option: angle_enable_shared_context_mutex = true Behavior with other build options: - When: `angle_enable_shared_context_mutex` is disabled or `angle_enable_share_context_lock` is disabled or `angle_force_context_check_every_call` is enabled, Contexts will always have `SingleContextMutex`, however it will be only used in special cases. `SCOPED_SHARE_CONTEXT_LOCK()` will use `GlobalMutex` when applicable. - Otherwise, `SCOPED_SHARE_CONTEXT_LOCK()` will use `egl::ContextMutex`. Some GFXBench "1080p Driver Overhead 2 Offscreen" performance numbers. Tested on S906B (Samsung Galaxy S22+) on old ANGLE base: https://chromium.googlesource.com/angle/angle/+/807c94ea85e046c6f279d081d99f0fb1bcf1191a Capture/Replay: Adjust tests do adhere to capture limits Each test result is an average frame number from 6 runs. SingleContextMutex 6579 ( +0.13%) (old) GetContextLock() (mShared is false) 6570 Forced `mShared = true` or NOT using `SingleContextMutex`. SharedContextMutex<std::mutex> FORCE 5061 (-22.97%) (old) GetContextLock() FORCE 4766 (-27.46%) Bug: angleproject:6957 Bug: chromium:1336126 Change-Id: Idcd919f9d4bf482b9ae489bd8b4415ec96048e32 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4374545 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya cfb5d2de 2023-04-06T16:06:35 Remove thread from mActiveThreads during eglTerminate When eglTerminate is called remove the thread from the active thread set if there is no context current. This allows for proper cleanup of invalid EGL objects during certain EGL terminate related end2end tests. Also perform appropriate cleanup in EGLBlobCacheTest test. Bug: angleproject:6723 Bug: angleproject:6798 Test: EGLMultiContextTest.ReuseUnterminatedDisplay* Change-Id: I5a637938d463d6556f594d8bb0cf457efca92355 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4408364 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Roman Lavrov <romanl@google.com>
Justin Novosad fbff065c 2023-05-03T22:19:07 Replace GetResourceFromHashSet with map lookup Function GetResourceFromHashSet had linear time complexity because it was sweeping through the set until a resource with a matching ID was found. This change replaces hash sets with hash maps to get constant time lookup. This solves, among other things, O(N^2) time complexity for rendering scenes containing a large number of surfaces. Function GetResourceFromHashSet was consuming over 50% of all CPU time on the main thread of Chrome's GPU process while running the MotionMark 1.2 Images test. With this change, the benchmark score increases by 70% on an M1 MacBook running a PGO official build of Chrome. Bug: chromium:1435066 Change-Id: I895ac0141a91d324c63adec2c0efb8e030d9675b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4505950 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Justin Novosad <junov@chromium.org> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi 2ceb04e0 2023-05-02T10:45:11 Initialize display TLS at thread creation time Bug: chromium:1441754 Change-Id: I611c6f591f2a6d3439e3c5d1250e2fde996c0ecf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4496673 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 144f2d2c 2023-04-24T12:52:27 Vulkan: Use thread-local space for EGL errors The assumption in anglebug.com/3041 that ANGLE is "single-threaded anyway" no longer holds. Bug: angleproject:3041 Change-Id: I613395c8003cad60764362d2776aaf7b6804b788 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4468107 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 1328f2f3 2023-04-17T16:43:12 Vulkan: Destroy the surface without holding the EGL lock This change defers surface destruction to the end of the entry point that causes it so that it is done without holding the EGL lock. This works around a specific deadlock in Android. On this platform: - For EGL applications, parts of surface creation and destruction are handled by the platform, and parts of it are done by the native EGL driver. Namely, on surface destruction, native_window_api_disconnect is called outside the EGL driver. - For Vulkan applications, vkDestroySurfaceKHR takes full responsibility for destroying the surface, including calling native_window_api_disconnect. Unfortunately, native_window_api_disconnect may use EGL sync objects and can lead to calling into the EGL driver. For ANGLE, this is particularly problematic because it is simultaneously a Vulkan application and the EGL driver, causing `vkDestroySurfaceKHR` to call back into ANGLE and attempt to reacquire the EGL lock. Since there are no users of the surface when calling vkDestroySurfaceKHR, it is safe for ANGLE to destroy it without holding the EGL lock. Note that only eglDestroySurface and eglMakeCurrent may lead to the destruction of a window surface. Bug: b/275176234 Bug: angleproject:8127 Change-Id: I02dc52e53e150943457e3f503e7ef30469f96b05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428754 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 20b6624a 2023-04-17T13:55:09 Metal: Support compiling on iOS without EAGL Makes EAGL and CGL compilation exclusive to each other. Catalyst would compile with both on ARM64, but only use EAGL. Remove use of GLSL generation in MSL. Generating GLSL for MSL compute and geometry shaders do not make sense. Remove compilation of RewriteRowMajorMatrices for Metal. It was removed from Metal in: b23bf47c9e999532a684beab9ac901552420b0b8 Reland "Metal: rewrite default uniforms and uniform blocks" Remove use of ANGLE_ENABLE_APPLE_WORKAROUNDS and gn variable angle_enable_apple_translator_workarounds. The workarounds are just unconditional business-as-usual implementation of ANGLE when ANGLE is compile for PLATFORM_APPLE. Fixed: angleproject:8129 Change-Id: I3af249708803fba816e2a7c92c35dddb84ce6946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428875 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Dan Glastonbury <djg@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Scott Violet 4e6cea96 2023-04-17T15:56:40 Removes UNREACHABLE in display initialization As it's possible for metal to be unavailable, UNREACHABLE() should not be used. Chrome has started shipping some builds with asserts enabled, so that it's possible for the gpu to crash here. Removing the UNREACHABLE makes it so the code doesn't crash and gpu fallback happens. Bug: chromium:1354718 Change-Id: I613c44b428c1de73b4b9937505e151d9416388ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4437615 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Scott Violet <sky@chromium.org>
Kimmo Kinnunen c19b66f6 2023-04-06T11:30:03 EAGL: Define ANGLE_ENABLE_EAGL in build system ANGLE_ENABLE_EAGL is a "build system" decision. Set this and new variable ANGLE_ENABLE_CGL in BUILD.gn file. This is consistent with the other backends. Remove ANGLE_CPU_ARM64. This was used to do ANGLE_ENABLE_EAGL=TRUE when on Catalyst. Instead, let the build system set this. For ANGLE/Chrome buildsystem, this is not set, as Catalyst is not implemented. For WebKit, this should be set at WebKit build settings. Replace `defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_CPU_ARM64)` with simpler expression: `defined(ANGLE_ENABLE_EAGL)`. Replace `defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_IOS)` with simpler expression: `defined(ANGLE_PLATFORM_APPLE)`. Bug: angleproject:8121 Change-Id: I3a0bbabb4347ad11f693e3f7c336ff12f66203d7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4404160 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Dan Glastonbury <djg@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 51ddcabf 2023-03-02T17:52:46 Enable pixel local storage by default We're ready to start hooking this extension up in Chrome. Bug: angleproject:7279 Change-Id: I5cb887a6641aa61c2da0dfcc24d2195cf0494f20 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4305361 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Peng Huang 1633a1bb 2023-02-17T15:16:06 Fix EGLImage importing problem Chrome DrDC uses EGLImage to share textures between contexts. Sometimes, chrome will create texture with a GLES 3.x context, and then create EGLImage from it, and then import EGLImage to a GLES 2.0 (WebGL 1.0) context. In this case, ANGLE may report errors if the original texture is created with formats which are not supported with GLES 2.0, but actually the texture can be sampled and rendered by ANGLE. Fix the problem by adding mIsTexturable & mIsRenderable in Image, and calculating them against the original context which owns the texture. Bug: chromium:1417294 Change-Id: I4c304422f0d0fc01a48c942d05758f8c2ce438e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4265252 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jonah Ryan-Davis 13e8dabc 2023-02-15T14:34:05 Add EGL_PLATFORM_ANGLE_DISPLAY_KEY_ANGLE To allow the creation of multiple EGLDisplays on the same graphics device, we need a value to key for the display cache. When the display key is specified, the cache will return a new display for that key, even if there is an existing display on the same graphics device. Bug: chromium:1251724 Change-Id: I55e169776770734fc33b8bc8e1265ea6f7472fe3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4255730 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Gert Wollny a52c0a6c 2023-02-06T16:01:27 Capture/Replay: Add and handle new resource type for EGLSync So far calls involving EGLSync were not tracking the actual sync objects, and this may lead to race conditions in multi-threaded and multi-context scenarios. This CL adds the type EGLSyncID and some specialized code handling of egl::Sync to distinguish EGLSync from the already existing GLSync objects in order to track them separately. Bug: angleproject:7911 Change-Id: I91b188a41069bc0620f51c55ee516d23b55bdd38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4200095 Commit-Queue: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Yuly Novikov 1e32988c 2022-12-21T15:53:15 Revert "Metal: expose Metal backend only on supported GPUs." This reverts commit 9364246f08d34a378252e517210b68e97282f764. Reason for revert: iOS build fails Original change's description: > Metal: expose Metal backend only on supported GPUs. > > Query all the GPUs on the system during ANGLE's initialization, and do > not expose the EGL_ANGLE_platform_angle_metal client extension unless > all of them support the required GPU families or feature sets. > > Tested locally on a 2015 MacBook Pro with dual Intel Iris Pro and AMD > Radeon R9 M370X GPUs. The AMD GPU supports Metal GPU family macOS 2, > but the Intel GPU, only family macOS 1. With this change, Chrome > properly falls back to using ANGLE's OpenGL backend when > --use-angle=metal is specified, and renders correctly. > > Bug: chromium:1365598 > Change-Id: I2c3533afe733e0d06d7755cae272bbd12aa9e676 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4117716 > Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> > Reviewed-by: Gregg Tavares <gman@chromium.org> > Commit-Queue: Kenneth Russell <kbr@chromium.org> Bug: chromium:1365598 Change-Id: Iedbe8978f2a2d39a33359fa236a1d305c284266e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4114291 Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Kenneth Russell 9364246f 2022-12-19T16:28:44 Metal: expose Metal backend only on supported GPUs. Query all the GPUs on the system during ANGLE's initialization, and do not expose the EGL_ANGLE_platform_angle_metal client extension unless all of them support the required GPU families or feature sets. Tested locally on a 2015 MacBook Pro with dual Intel Iris Pro and AMD Radeon R9 M370X GPUs. The AMD GPU supports Metal GPU family macOS 2, but the Intel GPU, only family macOS 1. With this change, Chrome properly falls back to using ANGLE's OpenGL backend when --use-angle=metal is specified, and renders correctly. Bug: chromium:1365598 Change-Id: I2c3533afe733e0d06d7755cae272bbd12aa9e676 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4117716 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Gregg Tavares <gman@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 1a8bcbda 2022-12-17T20:12:41 Vulkan: Re-enable async pipeline cache sync by default This is a reland of c7414946b84410bfcc8705759a902577c13d9fc4 The change here is that the program, shader and blob caches are now reset _after_ the backend is torn down. Otherwise the pipeline cache sync thread's use of the caches races with that. Bug: b/246683126 Change-Id: Ifc3d67279de50a2ee2866476aa5df85d4c10d30d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4111972 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Gregg Tavares be9e8e7b 2022-12-14T14:13:39 Add EGL_ANGLE_wait_until_work_scheduled extension We're changing eglReleaseTexImage so it calls flushCommandBuffer(mtl::NoWait) instead of flushCommandBuffer(mtl::WaitUntilScheduled) and then adding an extension to allow us to WaitUntilScheduled. This is because Chrome calls eglReleaseTexImage for every canvas and having it WaitUntilScheduled per call is very slow. So instead we'll call eglWaitUntilWorkScheduledANGLE once which will effectively wait just once. Bug: angleproject:7890 Change-Id: I87bc9f9a1a7f4a0f99d93736cc3083799e76afeb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4109311 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Gregg Tavares <gman@chromium.org>
Mohan Maiya eafdf206 2022-12-01T12:33:11 Reset thread context during threadCleanup Once thread cleanup is complete reset its mContext member to nullptr. Running CTS tests in batches sometimes exposes a bug where Thread::mContext is accessed after Display::threadCleanup is complete. Bug: angleproject:6723 Bug: angleproject:6798 Change-Id: Ie252954e60b5d4565697095939fd19d002dfccf3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4072208 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang f37a32f0 2022-11-14T14:11:06 Remove DisplayGbm and SurfaceGbm. The Gbm classes were used to emulate WindowSurfaces on ChromeOS for testing. These emulated features are not used in any shipping configuration and cause issues because ANGLE opens drm devices uneccessarily. Bug: chromium:1344962 Change-Id: If564e40744f7825035bbbd63c141b154c534ed72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4023096 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Brian Ho <hob@chromium.org>
Shahbaz Youssefi 70cf2322 2022-11-16T10:25:07 Vulkan: Move async pipeline cache sync feature to backend Bug: b/246683126 Change-Id: I194e488e04580cee7055c0674091f1228984edf9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031486 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Solti Ho <solti@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Greg Schlomoff 81a244de 2022-10-10T15:32:25 Adding a class to perform ASTC texture decompression on the CPU This significantly improves performance by caching and re-using the ASTC decoder context, and using multi-threaded decompression. This code was originally written for gfxstream. Bug: b/250688943 Change-Id: I1727447907f2e25cf9b854ffcc9ccfc04db2fb91 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3929008 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 8403e4c5 2022-10-10T20:59:29 EGL: Resource IDs for Surface, Context and EGL Image. This will make these classes play nicely with resource maps. As these objects are used in a lot of places, and simplified C can't handle unordered_map, it's necessary to index the maps by simple packed IDs in capture/replay code. This indirection will also have increased safety as we validate EGL resource ID handle values before accessing the memory directly. Also hides some of the other EGL capture methods behind helper methods to simplify the C code and hide assignments and other complex maps. Bug: angleproject:7758 Change-Id: Ibc7bb56430d3068bd38877c9dfb011979d4ea234 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3957164 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 025504b9 2022-10-17T17:03:03 Pass worker pools to image load functions In preparation for the ASTC decoder using threaded decoding. Bug: b/250688943 Change-Id: I70d669bcb57b900dbb633304182e174aec362203 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3961339 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Greg Schlomoff <gregschlom@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b5929ac6 2022-10-17T18:06:32 Move worker pools to Display It doesn't make sense for each context to have its own set of CPU-count workers. This change also facilitates access to the thread pools where gl::Context is not available (but egl::Display is). Bug: b/250688943 Change-Id: I240353abba26c15338d59631b4179a58dfd662f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3961334 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 0d203aef 2022-10-16T10:08:01 EGL: Add ID types for egl::Surface and egl::Image. This is in preparation for using resource maps for Context, Surface and EGLImage. The map change will make it much easier to work with the trace fixture. It will also have a small benefit in safety as we will longer be casting raw pointers for these types. As these objects are used in a lot of places, and simplified C can't handle unordered_map, it's necessary to index the maps by simple packed IDs in capture/replay code. Bug: angleproject:7758 Change-Id: Ib1d19622a4f2a6f0458cc28f5bbe30bb9f349b98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3957163 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 01285f16 2022-09-26T23:19:28 Remove Platform.h Overloaded name. Causing trouble with gles1's platform.h on case-insensitive file systems despite the different case. Bug: angleproject:3408 Change-Id: Icc1644a4c6a9c9076a2bbafbfb1d6eac578b731a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3920895 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 818a8ace 2022-09-26T19:50:03 Revert "Vulkan: Add missing part for supporting GBM Platform type" This reverts commit 43354edbe671af534c469089066e0259731563c7. Reason for revert: Fails on ChromeOS bots in Chrome. Original change's description: > Vulkan: Add missing part for supporting GBM Platform type > > Adds missing part to support GBM platform type. > > Bug: angleproject:7481 > Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> > Change-Id: I46caa4a958274de1111b30b144df592ac4cdcf6e > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3736243 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jeff Vigil <j.vigil@samsung.com> > Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com> Bug: angleproject:7481 Bug: angleproject:7696 Change-Id: I76fa4e38ea1f866575bc38725c23b697d17b53a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3918856 Reviewed-by: Geoff Lang <geofflang@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Roman Lavrov <romanl@google.com>
Sungyong Choi 43354edb 2022-06-30T10:18:41 Vulkan: Add missing part for supporting GBM Platform type Adds missing part to support GBM platform type. Bug: angleproject:7481 Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Change-Id: I46caa4a958274de1111b30b144df592ac4cdcf6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3736243 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Shahbaz Youssefi 9c17232a 2022-09-02T16:05:48 Vulkan: Make robustness affect all of share group Since contexts in a share group can share their program, if any context in the share group is robust, programs in all contexts in the share group need to be created with robustness in mind. This fixes the situation when the programs are created after a robust context has been created. However, if programs are created first, then a robust context is added to a share group, there remains a bug where the old programs aren't recreated to have robust behavior. Bug: angleproject:7629 Change-Id: I4922091962a32ca75a6107343df0cd87e5e9592d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3872506 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Eddie Hatfield 3960e63b 2022-08-09T14:02:59 Infra: Enable angle_deqp_gl46_tests on SwiftShader This change disables the WGL frontend by default on Windows when building ANGLE for desktop GL. This is because the WGL frontend is not yet fully implemented and it causes some of the trace tests to fail. The WGL frontend should be enabled by default on windows when more of its functionality gets implemented. Test: angle_deqp_gl46_tests --use-angle=swiftshader Bug: angleproject:7566 Bug: angleproject:7628 Change-Id: I69c695eb56d3858f715eeb86d28cc805e25c60eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3858142 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Eddie Hatfield 955adb77 2022-08-12T10:14:48 Cache compiled shader By storing the compiled shader in the blob cache, the time to recompile the same shader is reduced. Based on work by <hckim.kim@samsung.com> Bug: angleproject:7036 Change-Id: I884ae40e715c49a9ccd12903012e8327811e3557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3808235 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Mohan Maiya 7a87e90d 2022-07-16T11:39:08 An inactive but alive thread shouldn't prevent cleanup 1. Acquire EGL global lock before thread cleanup and remove all clean up related mutexes 2. Mark contexts that are not current as invalid during terminate 3. During thread exit, if there are other active threads, terminate with TerminateReason::InternalCleanup. This gives an opportunity for well behaved threads to cleanup up invalid objects. Bug: angleproject:6723 Bug: angleproject:6798 Test: EGLContextSharingTestNoFixture.InactiveThreadDoesntPreventCleanup* Change-Id: I418e5f8b486d3d309bd58c4cfb04b7dc1149ffc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3768667 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Peng Huang b9fd47b8 2022-08-12T10:55:49 Not use Android TLS slot for chromium In the profile, GetGlobalContext() & GetValidGlobalContext() have extra overhead for checking angle::gUseAndroidOpenGLTlsSlot. Since angle::gUseAndroidOpenGLTlsSlot is always false for now, so add a build flag to disable it for chromium build. In the profile, with angle_use_android_tls_slot = false, GetValidGlobalContext() is reduced from 0.153% to 0.044%. Bug: chromium:1336126 Change-Id: Id5e1752b0a03289fb299e8de2ed6e962e35291c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3827955 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Peng Huang 44791792 2022-08-12T00:13:45 Use angle::FlatUnorderedSet for ImageSibling::mSourcesOf As my test with Chromium on Android, ImageSibling::mSourcesOf only contains one item, so change it to angle::FlatUnorderedSet with default size 2. Bug: chromium:1336126 Change-Id: Ie1ba3ebb195170ad5c9f4713b599a91de5052702 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3828444 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang afdd5106 2022-08-11T21:14:23 Use angle::FlatUnorderedMap in Display.cpp Bug: chromium:1336126 Change-Id: I57d97d37749de2abbba88b6558bde31fa8346764 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3828442 Commit-Queue: Peng Huang <penghuang@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang 4cab7f38 2022-08-10T20:33:07 Fix EGL_ANGLE_program_cache_control for eglCreateContext EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE is an attribute for creating EGL context, but ANGLE reads it from mAttributeMap which is not the attribs passed to eglCreateContext(). Bug: chromium:1336126 Change-Id: Id3ea1955f927a7e051285c79b590dcf1f11f22ed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3823621 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Peng Huang <penghuang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang 0d5ba4dc 2022-08-05T19:43:54 Minor performance improvement Use angle::FixedVector to replace std::vector in SyncEGL::initialize() Use std::move() to avoid copy in Display::destroyInvalidEglObjects Bug: chromium:1336126 Change-Id: If4c13babb14ed9995caf3c3dd3cfc362124b24cf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812561 Auto-Submit: Peng Huang <penghuang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis de5c6c79 2022-08-03T13:56:11 Remove unused ANGLE histograms This CL removes the following histograms: GPU.ANGLE.D3DCompileMS GPU.ANGLE.DisplayInitializeMS GPU.ANGLE.ProgramCache.CacheResult GPU.ANGLE.ProgramCache.LoadBinarySuccess GPU.ANGLE.ProgramCache.ProgramBinarySizeBytes Bug: chromium:1317194 Change-Id: Iad01cff591df83c015bc79fe4e7b7c094357f02a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3807767 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Eddie Hatfield c54ed790 2022-07-21T10:38:47 Get desktop GL conformance tests to build The target for these tests is angle_deqp_gl_tests. Bug: angleproject:7533 Change-Id: I290822671d99da020f9a6a1f02bee43987644bf9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3766435 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Eddie Hatfield <eddiehatfield@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Steven Noonan b8e741d2 2022-06-23T13:36:17 Vulkan: allow selecting render device by PCI device/vendor IDs The EGL_ANGLE_platform_angle_device_id extension is deliberately vague about the meaning of "device ID high" and "device ID low", stating it's platform-specific. We can use these for representing the PCI device/vendor IDs that can be discovered via various (OS-specific) external means. Bug: angleproject:7460 Change-Id: Iff462687749e815fa074ef8ff392b6730ef46fa8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3720733 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Chris Dalton 15cc0013 2022-07-14T23:32:05 Add a GL_ANGLE_shader_pixel_local_storage extension Plumbs through "GL_ANGLE_shader_pixel_local_storage" and "GL_ANGLE_shader_pixel_local_storage_coherent" extension strings advertised by ANGLE and stubs out an initial spec document. This change doesn't add any new procedures or shader constructs, but it does allow the PLS tests to start checking for the real extension strings and requiring the GL_ANGLE_shader_pixel_local_storage extension. Bug: angleproject:7279 Change-Id: I36877fe4117185a2121f803288123cd69a447cf3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739590 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Mohan Maiya 12efe5b2 2022-06-21T15:43:42 Cleanup invalid EGL handles only if app called eglTermiate Maintain set of active threads instead of a global refCount and free display's invalid EGL resources iff - 1. app previously called eglTerminate on that display 2. there are no more active threads associated with that display Bug: angleproject:6723 Test: EGLMultiContextTest.RepeatedEglInitAndTerminate* Test: EGLMultiContextTest.ReuseUnterminatedDisplay* Change-Id: I868491bbbf0664e9129dcb0d1fa9e2243ef36d82 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3717277 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Antonio Caggiano 44d8bf76 2022-03-16T14:38:37 Vulkan: Support EGL_EXT_platform_wayland Improve GetPlatformDisplay by supporting EGL_PLATFORM_WAYLAND_EXT. Bug: angleproject:6902 Change-Id: Ia4c342097f47b7c41778ac02517451f51a94d8be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3528758 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 9d08c29a 2022-05-25T11:39:29 Expose the EGL Display Context Set in the DisplayState. This will let the Vulkan back-end iterate through and flush pending command buffers in other Contexts. Bug: angleproject:5664 Change-Id: I0d22eb68fa754a97b4836ec8c59ff8c6e5ef2d96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3668145 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Ian Elliott 0f8f760d 2022-06-07T17:52:52 Disable KHR_no_error for Android/SwiftShader Speculatively fix crash in Skia on ANGLE that has been happening. In addition, prevent other crashes in the future. Bug: b/220069903 Change-Id: I01b9896a6feb8be524849dafbc1df9526fc98754 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3694160 Commit-Queue: Ian Elliott <ianelliott@google.com> Auto-Submit: Ian Elliott <ianelliott@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Antonio Caggiano 68634d5c 2022-01-05T20:33:32 Vulkan: Enable VK_EXT_platform_wayland Bug: angleproject:6902 Change-Id: I6a27e3f610bd48dd31937255b287b11fe84c05ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3528756 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Faye Zhang c608df69 2022-05-23T17:19:02 Code Cleanup In Debug.h, we unconditionally set UNREACHABLE_IS_NORETURN to 0. Since UNREACHABLE_IS_NORETURN is only used in #if directives and it is always false, we can remove all uses of UNREACHABLE_IS_NORETURN. Bug: angleproject:6134 Change-Id: I3aa88d802099d70990eae697d4f056a3f650b48d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3661376 Commit-Queue: Faye Zhang <ffz@google.com> Auto-Submit: Faye Zhang <ffz@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Faye Zhang <ffz@google.com>