src/libANGLE/BlobCache.cpp


Log

Author Commit Date CI Message
Geoff Lang 166b72c9 2024-09-30T19:07:26 GL_ANGLE_blob_cache implementation. Bug: chromium:370538323 Change-Id: Ic51a951e78b48b315e36f518bcc39ff2d54660a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5900761 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@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>
Shahbaz Youssefi 545e3f6e 2024-03-01T23:27:03 Vulkan: Decouple RendererVk from egl::BlobCache The new vk::GlobalOps class abstracts access to egl::BlobCache. This is a step towards decoupling RendererVk from egl::Display for direct use with OpenCL. Bug: angleproject:8564 Change-Id: I7b3910254430df74b889759639da1749735584a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5332082 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8346addb 2024-02-06T15:40:31 Contain X11 includes and free usage of common terms This change undoes workarounds where some terms were avoided so there is no clash with X11 (such as Success, Bool and None). In particular, this helps us make sure we never include the X11 headers in such an unconstrained manner as to clash with our code. Bug: angleproject:8520 Change-Id: I53d9657c5a33164064d2c80a206b96fd52f607f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5273491 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Shahbaz Youssefi 572323cc 2024-01-11T16:20:02 Fix program link after backend rejects program binary If ANGLE believes the program binary is fine, it populates the program executable. If the backend then rejects the program binary, the executable was not reset. After the rejection, ANGLE proceeds to redo the program link, in which case it fails in various ways (ASSERT failures, incorrect data etc) as it tries to accumulate info on top of the previous executable. Bug: angleproject:8471 Change-Id: Ia4d626f5f9643c39a81062da3d5d58aa4c6be762 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189152 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 7cacb537 2023-09-26T11:27:49 Limit the uncompressed data size when decompressing blobs. If the data in the blob cache is invalid for any reason, ANGLE will take the last 32 bits of it an interpret it as a size for decompressing the blob. Add some reasonal upper bounds on the decompressed data size so that if the data is invalid it will simply fail decompression instead of allocating giant buffers. Bug: chromium:1485277 Change-Id: Ifb807f5ea836b692f37734b20789f5daefcca5c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4887599 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jiawei Shao e1da4916 2022-10-18T15:29:53 Remove unused enum CacheResult Bug: angleproject:2516 Change-Id: Ib2f4f66279ebb54e05b26559cf5759ca78020f03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3960887 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jiajia Qin <jiajia.qin@intel.com>
Eddie Hatfield ba4b6913 2022-08-23T09:34:27 Fix data race in BlobCache * Re-enable shader cache feature * Improve BlobCache thread-safety test * Improve EGLProgramCacheControlTest to not check the size of the BlobCache, since the shader cache interferes with this. * Include the arguments to ConstructCompiler() and Compile() in the key hash for the shader cache. Bug: angleproject:7036 Change-Id: Ied4e11f9160552f2f9358d99b5656315239ba856 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3851161 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Eddie Hatfield <eddiehatfield@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>
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>
Amy Liu 95935176 2021-03-26T17:38:21 Handle the compression of big pipeline cache. Big pipeline cache will cost much time to compress. Regarding the perfomance, handle the compression of big pipeline cache in this way: 1)Return when the pipeline cache data is larger than 10M. 2)Use worker thread to complete compression. Bug: angleproject:4722 Change-Id: I62eb69d8c46729261f0502af01450ec301c258f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2788169 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amy Liu 1fb7f648 2021-03-18T16:17:25 Compression of the data from vkGetPipelineCacheData. The size of pipelineCacheData sometimes is greater than 64k which cannot be saved because of the Android blob cache limitation (single cache data size should be < 64k). Implement the compression to store more cache data. Re-land this patch before fixing the performance regression of big pipeline cache. Bug: angleproject:4722 Change-Id: I4bc05a88334c3e7e9e945d1a0877429db1750422 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2771840 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Amy Liu 0ee360de 2021-03-05T06:02:25 Revert "Compression of the data from vkGetPipelineCacheData." This reverts commit cc5083e071e9e0663979c02376e7848c7de11765. Reason for revert: Re-land this patch after fixing the performance regression of big blob cache (discussed in angle issue 4722). Original change's description: > Compression of the data from vkGetPipelineCacheData. > > The size of pipelineCacheData sometimes is greater than > 64k which cannot be saved because of the Android blob cache > limitation (single cache data size should be < 64k). > Implement the compression to store more cache data. > > Bug: angleproject:4722 > Change-Id: I435b086d70d0e6378f1141464ae2bafbe076f193 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631511 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:4722 Change-Id: Ie4de10eabf5cd8f0b4748e2c1a4c3ab6b8ea092c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2739098 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Amy Liu cc5083e0 2021-01-15T10:29:36 Compression of the data from vkGetPipelineCacheData. The size of pipelineCacheData sometimes is greater than 64k which cannot be saved because of the Android blob cache limitation (single cache data size should be < 64k). Implement the compression to store more cache data. Bug: angleproject:4722 Change-Id: I435b086d70d0e6378f1141464ae2bafbe076f193 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2631511 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 62778cb9 2020-09-22T23:10:04 Rename version/commit headers. Prefix the files with angle_ to disambiguate them from other tools. Bug: b/168736059 Change-Id: I7be25ca18fb69d7f2ab71bdf355932865d134954 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425197 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten b55f0f78 2020-06-02T18:01:24 Compress Program binaries saved in blob cache The Android blob cache has a limit of 2MB, so ANGLE should compress the Program binaries that are saved into it to maximize its effectiveness. ANGLE will gzip the program binaries before being stored in the blob cache and then uncompress them when retrieved. Using gzip, the binaries are compressed to ~25% of their size when running the T-Rex benchmark. Some examples (in bytes): Uncompressed: 20193, Compressed: 4455 Uncompressed: 8767, Compressed: 2369 Uncompressed: 11144, Compressed: 2927 This doesn't appear to affect the T-Rex benchmark since all of the programs are loaded/decompressed as part of the benchmark initialization, and the programs are small enough to all fit in the blob cache without compression. Bug: b/155184635 Test: T-Rex, CQ Change-Id: Ie6a101c32ab5fd49baae1cb7aecdd26a934e15af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2227529 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill 0df92012 2020-06-03T17:08:43 Rename Platform.h to PlatformMethods.h. "platform.h" is too common a name and causes headers to be included incorrectly. Disambiguate the header using a more specific name. Solves a problem that came up with the GLES 1 tests and the standalone test harness. Bug: angleproject:3162 Change-Id: I88229a2c9407e0db57f5beee44daa11a4075f700 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2229065 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Rafael Cintron 5d01d538 2020-05-12T18:13:52 Resolve Bad Binary Link Failures When ANGLE_PROGRAM_BINARY_LOAD is enabled, Program::loadBinary unconditionally returns angle::Result::Continue to the caller. The caller, gl::Program::link, postpones the resolution of the link until resolveLinkImpl. Unfortunately, resolveLinkImpl is not able to tell whether the link failed because the shader from the developer is bad or because the loaded binary is not compatible with the backend. The former case should fail link. In the latter case, we should fallback to linking the program from the original shader sources. The loaded binary could be read from the on-disk shader cache and be corrupted or serialized with different revision and subsystem id than the currently loaded ANGLE backend. This fix adjusts Program::loadBinary and ProgramD3D::load so that angle::Result::Incomplete is returned to gl::Program::link when the binary is incompatible with the backend. gl::Program:link falls back to compilation from original shader sources. Since no code checks the return value of SizedMRUCache::eraseByKey, modified it to now return void. Bug: chromium:1079497 Change-Id: Id5271d7badad8627563e87859d1c9fdb81de5785 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197944 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Shahbaz Youssefi 37d2e606 2019-01-10T12:46:16 Make BlobCache use independent from ANGLE_program_cache_control The decision to enable caching or not was based on the size of the cache as directed by eglProgramCacheResizeANGLE, which is incorrect for applications that only use the ANDROID_blob_cache extension. The new behavior is as follows: - If EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE is specifically requested and set to true, but the size of the cache is 0, caching is disabled for the context. - If EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE is specifically requested and set to false, caching is disabled for the context. - Otherwise, caching is left enabled for the context, although the cache possibly has a size of zero, which effectively disables it. During application execution, if the blob cache callbacks are set, the application cache will be used. Bug: 896406, angleproject:2516 Change-Id: Ic0cabda03fb6bf53994e86e3ede30afc8021d67e Reviewed-on: https://chromium-review.googlesource.com/c/1405708 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 996628a4 2018-09-24T16:39:26 Vulkan: Add support for VkPipelineCache The cache is initialized from the application's blob cache and is occasionally written back to it for disk storage. Bug: angleproject:2516 Change-Id: I4cba4b00a7b9641c2983ef07159bc62cd10a5519 Reviewed-on: https://chromium-review.googlesource.com/1241373 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9137adea 2018-08-27T14:22:37 Add support for EGL_ANDROID_blob_cache The functionality of MemoryProgramCache is divided up in two. BlobCache is now a generic binary cache, which interfaces with the callbacks from EGL_ANDROID_blob_cache. MemoryProgramCache handles program [de]serialization and interacts with BlobCache. Bug: angleproject:2516 Change-Id: Ie4328a2e56a26338e033d84f4e53a1103411937d Reviewed-on: https://chromium-review.googlesource.com/1194285 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>