RFR: 8305578: X11GraphicsDevice.pGetBounds() is slow in remote X11 sessions [v4]

Sergey Bylokhov serb at openjdk.org
Fri Apr 21 20:20:44 UTC 2023


On Mon, 17 Apr 2023 10:19:37 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:

>>> II suggest to check how it works on win/mac, does we trigger displayChanged in that case?
>> 
>> I doubt it: see comments in [CGraphicsDevice.getScreenInsets()](https://github.com/openjdk/jdk/blob/2a062f165491d599eb0dcfb6050eb9186ae31b71/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java#L185)
>> 
>>         // the insets are queried synchronously and are not cached
>>         // since there are no Quartz or Cocoa means to receive notifications
>>         // on insets changes (e.g. when the Dock is resized):
>>         // the existing CGDisplayReconfigurationCallBack is not notified
>>         // as well as the NSApplicationDidChangeScreenParametersNotification
>>         // is fired on the Dock location changes only
>
>> it is better to inject the field to the GC, and update it on demand
> 
> I'm not sure this will look as pretty as in `CGraphicsDevice`. The code to obtain insets is located in `XToolkit` and is not easily moveable; insets are queried from and updated in `XToolkit` also, so by moving insets outside of `XToolkit` we're going to create more cross-package dependencies without really improving anything. Redesigning the entire toolkit so that insets fit more naturally to be a property of `X11GraphicsConfig` (or rather `X11GraphicsDevice` where I think they belong) is a task way beyond the scope of 8305578.

You do not need to move the code around, just cache it in the GC instead of the hashmap, and then re-cache it by some notification.

BTW Are you sure that hashmap does not required some synchronization to update/read?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13346#discussion_r1174132446



More information about the client-libs-dev mailing list