Re: Integrated vs. Discrete Graphics on OS X

2015-05-26 Thread Mike Hearn
The relevant Apple dev doc is here:

https://developer.apple.com/library/mac/technotes/tn2229/_index.html

Essentially it involves setting flags on the GL pixel format. Then you can
receive a callback from the OS either via NSOpenGLView or an old C style
callback which tells you that the active GPU has changed. I haven't read
the JFX Mac GL code so I don't know what APIs it's using. In the callback
you are meant to re-query GL capabilities and redraw, I think.

There's also some extra work required if you use pbuffers or GL textures
instead of framebuffer objects. I don't know which JFX uses.


Re: Integrated vs. Discrete Graphics on OS X

2015-05-25 Thread Mike Hearn
I believe the tricky part is not setting the magic flag in your Info.plist
file but rather handling the GL context changes on the fly. It
requires/would require some code in the Mac GL specific part of JavaFX.
Otherwise if you force it to integrated then some other app causes a switch
to discrete, the app might die because its GL surface just vanished.

On Mon, May 25, 2015 at 5:30 PM, Scott Palmer swpal...@gmail.com wrote:

 I've noticed that it is not possible to run a Java GUI app (Swing or
 JavaFX) on a MacBook Pro without it activating the discrete graphics and
 therefore reducing battery life.

 I believe it is automatically triggered by the use of OpenGL.  Unless you
 explicitly code for the integrated adapter, I don't think you can use
 OpenGL without the discrete adapter kicking in.  It would be nice if
 packaged app bundles done with the javapackager had an entry in the
 Info.plist that would signal that the application does not require the
 discrete adapter.

 This appears to already be filed as a JDK bug at
 https://bugs.openjdk.java.net/browse/JDK-8041900 but it doesn't look like
 it is getting much attention.  Is it likely to be addressed for 9 or an 8uX
 release?


 Regards,

 Scott



Re: Integrated vs. Discrete Graphics on OS X

2015-05-25 Thread Scott Palmer
Yes, I appreciate that the magic flag in the Info.plist would just be a
signal to do something tricky.
I tried setting -Dprism.order=sw in the Info.plist, thinking that would
trick things into not requiring the discrete GPU, but all that happened
when I did that was that I ended up with a pixel-doubled window instead of
nice crisp retina graphics.  It still activated the discrete GPU.

Scott


On Mon, May 25, 2015 at 12:03 PM, Mike Hearn m...@plan99.net wrote:

 I believe the tricky part is not setting the magic flag in your Info.plist
 file but rather handling the GL context changes on the fly. It
 requires/would require some code in the Mac GL specific part of JavaFX.
 Otherwise if you force it to integrated then some other app causes a switch
 to discrete, the app might die because its GL surface just vanished.

 On Mon, May 25, 2015 at 5:30 PM, Scott Palmer swpal...@gmail.com wrote:

 I've noticed that it is not possible to run a Java GUI app (Swing or
 JavaFX) on a MacBook Pro without it activating the discrete graphics and
 therefore reducing battery life.

 I believe it is automatically triggered by the use of OpenGL.  Unless you
 explicitly code for the integrated adapter, I don't think you can use
 OpenGL without the discrete adapter kicking in.  It would be nice if
 packaged app bundles done with the javapackager had an entry in the
 Info.plist that would signal that the application does not require the
 discrete adapter.

 This appears to already be filed as a JDK bug at
 https://bugs.openjdk.java.net/browse/JDK-8041900 but it doesn't look like
 it is getting much attention.  Is it likely to be addressed for 9 or an
 8uX
 release?


 Regards,

 Scott





Re: Integrated vs. Discrete Graphics on OS X

2015-05-25 Thread Jim Graham
I'm not an expert on how to use OpenGL on Mac to avoid the discrete 
grahpics, but I do know that the retina support in the SW pipeline on 
the Mac should be addressed soon in 8u60 as a result of fixing RT-27960. 
 The fix has been pushed to 8u-dev (and 9-dev) and is awaiting a sync 
into the master repo...


...jim

On 5/25/2015 11:03 AM, Scott Palmer wrote:

Yes, I appreciate that the magic flag in the Info.plist would just be a
signal to do something tricky.
I tried setting -Dprism.order=sw in the Info.plist, thinking that would
trick things into not requiring the discrete GPU, but all that happened
when I did that was that I ended up with a pixel-doubled window instead of
nice crisp retina graphics.  It still activated the discrete GPU.

Scott


On Mon, May 25, 2015 at 12:03 PM, Mike Hearn m...@plan99.net wrote:


I believe the tricky part is not setting the magic flag in your Info.plist
file but rather handling the GL context changes on the fly. It
requires/would require some code in the Mac GL specific part of JavaFX.
Otherwise if you force it to integrated then some other app causes a switch
to discrete, the app might die because its GL surface just vanished.

On Mon, May 25, 2015 at 5:30 PM, Scott Palmer swpal...@gmail.com wrote:


I've noticed that it is not possible to run a Java GUI app (Swing or
JavaFX) on a MacBook Pro without it activating the discrete graphics and
therefore reducing battery life.

I believe it is automatically triggered by the use of OpenGL.  Unless you
explicitly code for the integrated adapter, I don't think you can use
OpenGL without the discrete adapter kicking in.  It would be nice if
packaged app bundles done with the javapackager had an entry in the
Info.plist that would signal that the application does not require the
discrete adapter.

This appears to already be filed as a JDK bug at
https://bugs.openjdk.java.net/browse/JDK-8041900 but it doesn't look like
it is getting much attention.  Is it likely to be addressed for 9 or an
8uX
release?


Regards,

Scott