Cygwin/X causes NVIDIA Optimus to run all of the time

NVIDIA Optimus is a technology that is used in systems with both an integrated Intel GPU and a discrete NVIDIA GPU.  Speaking of modern systems, this is pretty much any system with an NVIDIA GPU, as all Sandy Bridge and Ivy Bridge CPUs from Intel contain an Intel GPU on the chip.  Naturally, the Intel GPU is less capable than the NVIDIA GPU, but it uses considerably less power and is completely adequate for all but the most demanding graphics tasks.  So, Optimus allows the Intel GPU to run most of the time, kicking in the NVIDIA GPU only when it is needed for games or graphically-intensive applications.  Since the NVIDIA GPU is able to be powered off most of the time, the system uses less power, less heat, and lasts longer on battery.

NVIDIA will automatically guess which apps should be used for which GPU based on profiles that are managed by NVIDIA and updated regularly.  However, you have the choice to override this behavior and decide on an app-by-app basis which GPU should be used.  I have my machine set up to use the integrated GPU for everything by default, and have a list of just a few apps that will kick in the NVIDIA GPU.

Cygwin/X, or XWin, is an X server that you can run on Windows that allows you to run X applications (locally, or remotely via SSH tunnel).

I was recently poking around and discovered that Cygwin/X causes Optimus to activate the NVIDIA GPU (regardless of what is set in the NVIDIA control panel).

cygxoptimus

I couldn’t find any information on this issue so I posted on the Cygwin/X mailing list.  I was given a great reply by Jon Turney¬†with some hints that point in the right direction.  Looking in the XWin log, you can see that indeed the NVIDIA card is used to provide OpenGL support for the X server.  OpenGL can be disabled (or rather, forced to a software rendering mode) by passing the -nowgl flag to XWin at launch.  This successfully prevents NVIDIA from automatically switching over to use XWin for Optimus.  I don’t need OpenGL in the X apps that I run so this works fine for me.

This is the command that I am now passing to initialize XWin without OpenGL:

C:\cygwin\bin\XWin.exe :0 -multiwindow -nowgl

Leave a Reply

Your email address will not be published. Required fields are marked *

*