On Sat, 5 Jun 2021 23:46:12 GMT, Phil Race <p...@openjdk.org> wrote: >> Used MTLDevice recommendedMaxWorkingSetSize property for optimal size of the >> texture pool > > src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m line > 328: > >> 326: if (_maxPoolMemory < MAX_POOL_MEMORY) { >> 327: _maxPoolMemory = MAX_POOL_MEMORY; >> 328: } > > The Apple 5K retina is 5120‑by‑2880 pixels > > So we start off with a number that is too small > #define SCREEN_MEMORY_SIZE_4K (4096*2160*4) //~33,7 mb > and then divide it by 2 > #define MAX_POOL_MEMORY SCREEN_MEMORY_SIZE_4K/2 > > and I have no idea what a typical size is for > self.device.recommendedMaxWorkingSetSize > which we are also dividing by 2. > > So I have no idea what the logic is behind all these numbers.
> The Apple 5K retina is 5120‑by‑2880 pixels > > So we start off with a number that is too small > #define SCREEN_MEMORY_SIZE_4K (4096_2160_4) //~33,7 mb > and then divide it by 2 > #define MAX_POOL_MEMORY SCREEN_MEMORY_SIZE_4K/2 I didn't touch this number here, they worked well within our EA testing cycles. So, I decided to use it as a fallback. We can extend it to 5K though. > and I have no idea what a typical size is for > self.device.recommendedMaxWorkingSetSize > which we are also dividing by 2. This size typically much much bigger than SCREEN_MEMORY_SIZE_4K - 4GB on Radeon Pro 560X 4GB - 1.5GB Intel UHD Graphics 630 1536 MB (MBP 2019) Looks like it corresponds to the amount of VRAM however the doc says that OS may set another value > An approximation of how much memory, in bytes, this device can use with good > performance. I don't think that it's a good idea to take all the recommended VRAM, so decided to divide it by 2. > > So I have no idea what the logic is behind all these numbers. ------------- PR: https://git.openjdk.java.net/jdk/pull/4279