Skip to main content

Full Screen Mode on Linux

14 replies [Last post]
alexandre_boaventura
Offline
Joined: 2005-04-08

Hi all,

I have a desktop application that should run on Full Screen Mode, and it is running fine on Windows XP/2000. I have many graphic functions that works perfect, but when I try to run it on Linux, it doesn't support full screen.

I have a Red Hat 9 distro, running on a P4 2.00 Ghz, 1 GB RAM, RIVA TNT/2 video card, Java 5.0.

Thanks for some help.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
campbell
Offline
Joined: 2003-06-24

> I am having two problems:
> 1) on fedora core 4, Sun's JDK 1.5 was able to at
> least imitate the full screen exclusive mode. Not
> anymore on fedora 5. (both with gnome and xfce). I
> tried both the current JDK 1.5 and the beta version
> of upcoming JDK 1.6. COuld this be a new Xorg
> problem?
>

Hmm, we've seen a number of reports about strange Xorg issues in FC 5, this could be another. We'll look into it.

> 2) In fc5, only if I use Eclipse I can get the same
> behavior as I got using fc4 (fake FSEM). But even if
> I use JDK 1.6 I can't get the screen update
> synchronize to vertical refresh of my screen. This
> causes unaccaptable tearing artifact. This
> synchronization works very well under WIndows and
> Mac.
>

Are you using BufferStrategy in your fullscreen app? On Linux/Solaris you should have the XDBE extension available (you can check this with "xdpyinfo"). With XDBE, if you are using a FlipBufferStrategy you should be getting vsynced flipping for free. If you're seeing tearing, then you may be running into some new issues in Xorg.

> (I am using the standard xorg (not Xair), I have
> nVidia card and installed the proprietry drivers on
> fc5.)

Have you tried using the OpenGL pipeline (-Dsun.java2d.opengl=True), which works especially well in JDK 6? Nvidia's drivers have vsync on by default for OGL apps, so you shouldn't see tearing in this case.

If you have a small testcase that reproduces these problems, please email it to me and I'll look into it.

Thanks,
Chris

boyaci
Offline
Joined: 2006-03-24

hi,

I've managed to get FSEM work on my Fedora Core 4 properly: true FSEM, no tearing artifacts with correct synchronization to monitor refresh rate. The behavior on Linux is consistent with the behavior on Windows XP and Mac OS X.

For programming I followed this tutorial: http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html

But the same programs fail to work consistently on FC5, using new xorg.X11 version 7.0, on very similar hardware.

Here is my working setup: Fedora Core 4 with xorg.X11 version 6.8; nVidia geforce 6800 running with the latest proprietary linux driver from nVidia; Java 1.6.0 beta release. (use nvidia-settings application to make sure that under OpenGL Settings, Sync to VBlank and Allow FLipping options are enabled). Also use the openGL pipeline: java -Dsun.java2d.opengl=True ....

Chris Campbell

Hi Huseyin,

On Apr 4, 2006, at 8:51 PM, java2d@javadesktop.org wrote:
> hi,
>
> I've managed to get FSEM work on my Fedora Core 4 properly: true
> FSEM, no tearing artifacts with correct synchronization to monitor
> refresh rate. The behavior on Linux is consistent with the behavior
> on Windows XP and Mac OS X.
>

Glad to hear you got it working. Just so we can understand better,
is this working properly on FC4 with both the default (X11-based
pipeline) and with the OGL pipeline enabled (with -
Dsun.java2d.opengl=True)?

> For programming I followed this tutorial: http://java.sun.com/docs/
> books/tutorial/extra/fullscreen/index.html
>
> But the same programs fail to work consistently on FC5, using new
> xorg.X11 version 7.0, on very similar hardware.
>

Similar question as above: is this failing on FC5 for both the
default and OGL pipelines? Does it fail regardless of whether you
have the proprietary Nvidia drivers installed? Is the OGL pipeline
working well for other apps (like do you see "OpenGL pipeline enabled
for..." when you run SwingSet2 or Java2Demo)?

Could you please reply to the list, and also separately send me the
output of "glxinfo" and "xdpyinfo"?

Thanks,
Chris

> Here is my working setup: Fedora Core 4 with xorg.X11 version 6.8;
> nVidia geforce 6800 running with the latest proprietary linux
> driver from nVidia; Java 1.6.0 beta release. (use nvidia-settings
> application to make sure that under OpenGL Settings, Sync to
> VBlank and Allow FLipping options are enabled). Also use the openGL
> pipeline: java -Dsun.java2d.opengl=True ....
> [Message sent by forum member 'boyaci' (boyaci)]
>
> http://forums.java.net/jive/thread.jspa?messageID=100903
>
> ======================================================================
> =====
> To unsubscribe, send email to listserv@java.sun.com and include in
> the body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

boyaci
Offline
Joined: 2006-03-24

Hi,
> Glad to hear you got it working. Just so we can
> understand better,
> is this working properly on FC4 with both the default
> (X11-based
> pipeline) and with the OGL pipeline enabled (with -
> Dsun.java2d.opengl=True)?

No, it works only with the opengl pipeline. The set up I've sent before was "if-and-only-if", anyone missing, it doesn't work. (only FC4, only xorg 6.8, only java 1.6, only nvidia proprietary driver)

>
> Similar question as above: is this failing on FC5 for
> both the
> default and OGL pipelines? Does it fail regardless
> of whether you
> have the proprietary Nvidia drivers installed? Is
> the OGL pipeline
> working well for other apps (like do you see "OpenGL
> pipeline enabled
> for..." when you run SwingSet2 or Java2Demo)?

Yes, it fails regardless of the pipeline used. Though it fails worse without the opengl pipeline. But opengl pipeline is enabled, I get the affirmative verbose output. It is enabled while running the demo programs you mentioned, too. That was for the proprietary driver. With the open source driver I couldn't succeed any better. Actually I couln't even get the opengl pipeline enabled.

> Could you please reply to the list, and also
> separately send me the
> output of "glxinfo" and "xdpyinfo"?
>

boyaci
Offline
Joined: 2006-03-24

Hi Chris,

I noticed one more thing: the nvidia chip on the machine which runs FC4 is GeForce 6800, but the one on the FC5 machine (a laptop) is GeForce GO 6400. To test whether the problem has anything to do with the graphics card, I installed and tested FC4 on the laptop. With exact same xorg extensions and modules, FSEM still doesn't vsync on the laptop. I don't know if this is a nvidia driver problem. Probably a combination of xorg and nvidia?

best.

boyaci
Offline
Joined: 2006-03-24

Hi again,

good news this time. today nvidia released a new driver for linux. With the newer driver true FSEM with vsync works (using jdk 1.6 beta, opengl pipeline enabled, xorg 7, fc5)! I am not sure how and why it didn't work with the former driver installation, but doesn't matter anymore.

tersius
Offline
Joined: 2006-06-16

I'm having trouble to get fullscreen working.

When I run
----------
public class FSETest {
public static void main(String[] args) {
GraphicsDevice[] devices =
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
for (int i = 0; i < devices.length; i++) {
GraphicsDevice device = devices[i];
System.out.println("Device " + i + ": ID string=" +
device.getIDstring());
System.out.println(" Available accelerated memory: " +
device.getAvailableAcceleratedMemory());
System.out.println(" Fullscreen supported: " +
device.isFullScreenSupported());
System.out.println(" Display change supported: " +
device.isDisplayChangeSupported());
System.out.println();
}
}
}
---------
I get this output.
------------------
Device 0: ID string=:0.0
Available accelerated memory: -1
Fullscreen supported: false
Display change supported: false
-----------------

I'm running gentoo linux with xorg 7.0 and jdk-6-rc-bin-b88-linux-i586-15_jun_2006

Chris Campbell

Hi there,

Could you post the output of xdpyinfo?

What is the output of:
% ls -l /usr/lib/Xrandr*

What happens if you set the following before running your test:
% export J2D_TRACE_LEVEL=4

Thanks,
Chris

java2d@javadesktop.org wrote:
> I'm having trouble to get fullscreen working.
>
> When I run
> ----------
> public class FSETest {
> public static void main(String[] args) {
> GraphicsDevice[] devices =
> GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
> for (int i = 0; i < devices.length; i++) {
> GraphicsDevice device = devices[i];
> System.out.println("Device " + i + ": ID string=" +
> device.getIDstring());
> System.out.println(" Available accelerated memory: " +
> device.getAvailableAcceleratedMemory());
> System.out.println(" Fullscreen supported: " +
> device.isFullScreenSupported());
> System.out.println(" Display change supported: " +
> device.isDisplayChangeSupported());
> System.out.println();
> }
> }
> }
> ---------
> I get this output.
> ------------------
> Device 0: ID string=:0.0
> Available accelerated memory: -1
> Fullscreen supported: false
> Display change supported: false
> -----------------
>
> I'm running gentoo linux with xorg 7.0 and jdk-6-rc-bin-b88-linux-i586-15_jun_2006
> [Message sent by forum member 'tersius' (tersius)]
>
> http://forums.java.net/jive/thread.jspa?messageID=123929
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

tersius
Offline
Joined: 2006-06-16

Hi Chris thanks for your quick response.

I have made some progress with my problem since this morning.

It was a rather silly mistake on my behalf. I forgot to change the eclipse JRE to 1.6 so it was still running 1.5.

After changing the jre to 1.6 the program enters fullscreen mode without problems.

Anyway that was not the only problem.
I was now able to go into fullscreenmode but not change the display mode.

It seems using a login manager(GDM in my case) prevents the program from changing the display mode.

If I don't run the GDM and just use $startx to begin my gnome session the java program can also change display modes.

There is just one more thing I'm wondering about.
The test program that I run now states that FSEM is possible but it still says the displaymode can't be changed,altough it can.
I'm wondering what could be causing it to give a false report?

Chris Campbell

Hi,

Although the GraphicsDevice docs aren't perfectly clear about this
(we're working on that), you need to be in fullscreen mode first before
you can query whether display mode changing is possible. If you go into
fullscreen mode and then print the list of available display modes
(GD.getDisplayModes()), does it report more than one?

Also, you can look at your xorg.conf file to figure out what display
modes *should be* available.

I've never heard about GDM preventing display mode changing. If you can
find any docs on the matter, I'd be interested to know.

Thanks,
Chris

java2d@javadesktop.org wrote:
> Hi Chris thanks for your quick response.
>
> I have made some progress with my problem since this morning.
>
> It was a rather silly mistake on my behalf. I forgot to change the eclipse JRE to 1.6 so it was still running 1.5.
>
> After changing the jre to 1.6 the program enters fullscreen mode without problems.
>
> Anyway that was not the only problem.
> I was now able to go into fullscreenmode but not change the display mode.
>
> It seems using a login manager(GDM in my case) prevents the program from changing the display mode.
>
> If I don't run the GDM and just use $startx to begin my gnome session the java program can also change display modes.
>
> There is just one more thing I'm wondering about.
> The test program that I run now states that FSEM is possible but it still says the displaymode can't be changed,altough it can.
> I'm wondering what could be causing it to give a false report?
> [Message sent by forum member 'tersius' (tersius)]
>
> http://forums.java.net/jive/thread.jspa?messageID=123986
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

gunesh
Offline
Joined: 2006-03-15

Not sure about linux, but I did this & it works fine on windows 1440x900

JFrame win = new JFrame();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
win.setSize(screenSize.width, screenSize.height);
win.validate();
//System.out.println(screenSize.width + " : " + screenSize.height);
win.dispose();
win.setUndecorated(true);
win.show();
win.requestFocus();

Hope this helps.

boyaci
Offline
Joined: 2006-03-24

I have similar problem:

neither gcj 1.4 nor SUn's JDK 1.4 or 1.5 has ever had support for full screen exclusive mode (FSEM) for linux. Sun's 1.4 and 1.5 has that mode available for both windows and Mac. A newer version from Sun, JDK 1.6 promises to make FSEM available for linux. (I need the FSEM for my experiments. We present visual stimulus and then scan human observers' brain activity in response using fmri.)

I am having two problems:
1) on fedora core 4, Sun's JDK 1.5 was able to at least imitate the full screen exclusive mode. Not anymore on fedora 5. (both with gnome and xfce). I tried both the current JDK 1.5 and the beta version of upcoming JDK 1.6. COuld this be a new Xorg problem?

2) In fc5, only if I use Eclipse I can get the same behavior as I got using fc4 (fake FSEM). But even if I use JDK 1.6 I can't get the screen update synchronize to vertical refresh of my screen. This causes unaccaptable tearing artifact. This synchronization works very well under WIndows and Mac.

I really don't like to use windows or different platforms other than Java, but there is no other way, the tearing artifacts are not accaptable in my experiments. I am trapped!

Any suggestions? I tried many Xorg configuration options, any recommandations for xorg.conf? Any native methods which can be used to track the vsync signal? I could invoke those methods from my java code.

(I am using the standard xorg (not Xair), I have nVidia card and installed the proprietry drivers on fc5.)

beemer_addict
Offline
Joined: 2006-03-30

I have found a workaround: A kind of 'poor mans' fullscreen mode: You simply maximize the window and
remove the decorations. Works fine both on windows and linux win Java 1.4.2 and 1.5.0.

The code looks like this:

JFrame win = new JFrame();
[...]
win.dispose();
win.setUndecorated(true);
win.show();
win.requestFocus();
gdev.setFullScreenWindow(win);

If you are using a menu, you will surely want it to disappear as well:

JMenuBar menu = win.getJMenuBar();
menu.setVisible(false);

Good luck.

alexandre_boaventura
Offline
Joined: 2005-04-08

That's the same solution I found.

It works very well for my needs. The only problem it generated is that when no full screen is supported, change mode is not allowed too, so I can't change screen dimension automatically. User should do it manually. Bur it works...

I'll try 1.6

I didn't have think about any xorg problem. :-(

Thank you.