[OpenJDK 2D-Dev] <Swing Dev> [14] RFR: JDK-8223158: Docked MacBook cannot start any Java Swing applications

Philip Race philip.race at oracle.com
Wed Sep 25 16:28:46 UTC 2019


Why is this sent to swing-dev ? That's completely the wrong list.
You want 2d-dev. I'll am replying on 2d-dev not swing-dev.



I wonder why I don't see this when I have my Mac closed and connect to 
an external monitor ?
What is special here ?

 > Now, when the main display is closed, the  
CGDisplayIDToOpenGLDisplayMask(displayID) is returning 2 as glMask

The phrasing here is misleading suggesting that "glMask" is an API name.

The method is returning the value 2, which we then store in a variable 
we call glMask ..
and then hand off as the value for NSOpenGLPFAScreenMask

Why would the call error out on this ? It seems like the right thing to do


What is the implication of not having glMask ? If we don't need it, why 
specify it at all ?

What will happen if the second call fails too ? Won't we be back to the 
crash ?

Nits:

1) Can we split that very long debugging trace statement ?

2) I guess we don't need to free "attrs" or "attrs1" since it is stack 
allocated ..
Unfortunate that we have to repeat the entire initialisation minus glMask.
Can you think of a better way to do this ?

-phil.

On 9/25/19, 3:49 AM, Prasanta Sadhukhan wrote:
>
> Hi All,
>
> Please review a fix for an issue where it is seen that if a MacBookPro 
> is attached to an external monitor via dock and macbook lid is closed,
> no Java swing applications will start.
>
> It was found 
> GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration() 
> is returning null in this particular setup.
>
> Since it was difficult to reproduce locally, enabling tracing reveals 
> that CGLGraphicsConfig#getCGLConfigInfo() was failing in 
> NSOpenGLPixelFormat.initWithAttributes()
>
> Appkit documentation 
> https://developer.apple.com/documentation/appkit/nsopenglpixelformat/1436219-initwithattributes?language=objc
> says that it will return "|nil| if an object with the desired 
> attributes could not be initialized".
> Now, when the main display is closed, the
> CGDisplayIDToOpenGLDisplayMask(displayID)
> is returning 2 as glMask which when passed as an attribute to 
> NSOpenGLPixelFormat, it fails to initialize.
> Normally, with main Display being used, glMask is 1.
>
> Proposed fix is to see if first initialization fails, then retry 
> initialization without the offending glMask value for 
> NSOpenGLPFAScreenMask attributes,
> as documentation 
> https://developer.apple.com/documentation/appkit/1436213-opengl_pixel_format_attributes/nsopenglpfascreenmask?language=objc
> says "All screens specified in the bit mask are guaranteed to be 
> supported by the pixel format.", so if it is not guranteed to be 
> supported, initAttributes() might fail.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223158
>
> webrev: http://cr.openjdk.java.net/~psadhukhan/8223158/webrev.0/
>
> Regards
> Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/2d-dev/attachments/20190925/57af50f5/attachment.html>


More information about the 2d-dev mailing list