-
Bug
-
Resolution: Unresolved
-
P4
-
8
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "1.8.0_25"
ADDITIONAL OS VERSION INFORMATION :
Fedora 20
Linux mazinger 3.17.2-200.fc20.x86_64 #1 SMP Tue Nov 4 18:04:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
01:00.0 VGA compatible controller: NVIDIA Corporation GF114 [GeForce GTX 560] (rev a1)
NVRM: loading NVIDIA UNIX x86_64 Kernel Module 331.89 Tue Jul 1 13:30:18 PDT 2014
A DESCRIPTION OF THE PROBLEM :
The screen isn't repainted correctly.
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://docs.oracle.com/javase/tutorial/extra/fullscreen/examples/MultiBufferTest.java
Exec this example with Java 8 and with Java 7 and watch the difference between them using:
java MultiBufferTest 4
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The screen starts to change colour slowly. Then, the change rate is faster and finally a fast colour change is shown, watching color stripes at the end.
ACTUAL -
The screen starts to change colour slowly. When the rate change is faster some colours are not shown. When faster is the change, more colours are not shown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* This test takes a number up to 13 as an argument (assumes 2 by
* default) and creates a multiple buffer strategy with the number of
* buffers given. This application enters full-screen mode, if available,
* and flips back and forth between each buffer (each signified by a different
* color).
*/
import java.awt.*;
import java.awt.image.BufferStrategy;
public class MultiBufferTest {
private static Color[] COLORS = new Color[] {
Color.red, Color.blue, Color.green, Color.white, Color.black,
Color.yellow, Color.gray, Color.cyan, Color.pink, Color.lightGray,
Color.magenta, Color.orange, Color.darkGray };
private static DisplayMode[] BEST_DISPLAY_MODES = new DisplayMode[] {
new DisplayMode(640, 480, 32, 0),
new DisplayMode(640, 480, 16, 0),
new DisplayMode(640, 480, 8, 0)
};
Frame mainFrame;
public MultiBufferTest(int numBuffers, GraphicsDevice device) {
try {
GraphicsConfiguration gc = device.getDefaultConfiguration();
mainFrame = new Frame(gc);
mainFrame.setUndecorated(true);
mainFrame.setIgnoreRepaint(true);
device.setFullScreenWindow(mainFrame);
if (device.isDisplayChangeSupported()) {
chooseBestDisplayMode(device);
}
Rectangle bounds = mainFrame.getBounds();
mainFrame.createBufferStrategy(numBuffers);
BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();
for (float lag = 2000.0f; lag > 0.00000006f; lag = lag / 1.33f) {
for (int i = 0; i < numBuffers; i++) {
Graphics g = bufferStrategy.getDrawGraphics();
if (!bufferStrategy.contentsLost()) {
g.setColor(COLORS[i]);
g.fillRect(0,0,bounds.width, bounds.height);
bufferStrategy.show();
g.dispose();
}
try {
Thread.sleep((int)lag);
} catch (InterruptedException e) {}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
device.setFullScreenWindow(null);
}
}
private static DisplayMode getBestDisplayMode(GraphicsDevice device) {
for (int x = 0; x < BEST_DISPLAY_MODES.length; x++) {
DisplayMode[] modes = device.getDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == BEST_DISPLAY_MODES[x].getWidth()
&& modes[i].getHeight() == BEST_DISPLAY_MODES[x].getHeight()
&& modes[i].getBitDepth() == BEST_DISPLAY_MODES[x].getBitDepth()
) {
return BEST_DISPLAY_MODES[x];
}
}
}
return null;
}
public static void chooseBestDisplayMode(GraphicsDevice device) {
DisplayMode best = getBestDisplayMode(device);
if (best != null) {
device.setDisplayMode(best);
}
}
public static void main(String[] args) {
try {
int numBuffers = 2;
if (args != null && args.length > 0) {
numBuffers = Integer.parseInt(args[0]);
if (numBuffers < 2 || numBuffers > COLORS.length) {
System.err.println("Must specify between 2 and "
+ COLORS.length + " buffers");
System.exit(1);
}
}
GraphicsEnvironment env = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
MultiBufferTest test = new MultiBufferTest(numBuffers, device);
} catch (Exception e) {
e.printStackTrace();
}
System.exit(0);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The problem don't happens when the OpenGL path is used with -Dsun.java2d.opengl=True.
java version "1.8.0_25"
ADDITIONAL OS VERSION INFORMATION :
Fedora 20
Linux mazinger 3.17.2-200.fc20.x86_64 #1 SMP Tue Nov 4 18:04:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
01:00.0 VGA compatible controller: NVIDIA Corporation GF114 [GeForce GTX 560] (rev a1)
NVRM: loading NVIDIA UNIX x86_64 Kernel Module 331.89 Tue Jul 1 13:30:18 PDT 2014
A DESCRIPTION OF THE PROBLEM :
The screen isn't repainted correctly.
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://docs.oracle.com/javase/tutorial/extra/fullscreen/examples/MultiBufferTest.java
Exec this example with Java 8 and with Java 7 and watch the difference between them using:
java MultiBufferTest 4
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The screen starts to change colour slowly. Then, the change rate is faster and finally a fast colour change is shown, watching color stripes at the end.
ACTUAL -
The screen starts to change colour slowly. When the rate change is faster some colours are not shown. When faster is the change, more colours are not shown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* This test takes a number up to 13 as an argument (assumes 2 by
* default) and creates a multiple buffer strategy with the number of
* buffers given. This application enters full-screen mode, if available,
* and flips back and forth between each buffer (each signified by a different
* color).
*/
import java.awt.*;
import java.awt.image.BufferStrategy;
public class MultiBufferTest {
private static Color[] COLORS = new Color[] {
Color.red, Color.blue, Color.green, Color.white, Color.black,
Color.yellow, Color.gray, Color.cyan, Color.pink, Color.lightGray,
Color.magenta, Color.orange, Color.darkGray };
private static DisplayMode[] BEST_DISPLAY_MODES = new DisplayMode[] {
new DisplayMode(640, 480, 32, 0),
new DisplayMode(640, 480, 16, 0),
new DisplayMode(640, 480, 8, 0)
};
Frame mainFrame;
public MultiBufferTest(int numBuffers, GraphicsDevice device) {
try {
GraphicsConfiguration gc = device.getDefaultConfiguration();
mainFrame = new Frame(gc);
mainFrame.setUndecorated(true);
mainFrame.setIgnoreRepaint(true);
device.setFullScreenWindow(mainFrame);
if (device.isDisplayChangeSupported()) {
chooseBestDisplayMode(device);
}
Rectangle bounds = mainFrame.getBounds();
mainFrame.createBufferStrategy(numBuffers);
BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();
for (float lag = 2000.0f; lag > 0.00000006f; lag = lag / 1.33f) {
for (int i = 0; i < numBuffers; i++) {
Graphics g = bufferStrategy.getDrawGraphics();
if (!bufferStrategy.contentsLost()) {
g.setColor(COLORS[i]);
g.fillRect(0,0,bounds.width, bounds.height);
bufferStrategy.show();
g.dispose();
}
try {
Thread.sleep((int)lag);
} catch (InterruptedException e) {}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
device.setFullScreenWindow(null);
}
}
private static DisplayMode getBestDisplayMode(GraphicsDevice device) {
for (int x = 0; x < BEST_DISPLAY_MODES.length; x++) {
DisplayMode[] modes = device.getDisplayModes();
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == BEST_DISPLAY_MODES[x].getWidth()
&& modes[i].getHeight() == BEST_DISPLAY_MODES[x].getHeight()
&& modes[i].getBitDepth() == BEST_DISPLAY_MODES[x].getBitDepth()
) {
return BEST_DISPLAY_MODES[x];
}
}
}
return null;
}
public static void chooseBestDisplayMode(GraphicsDevice device) {
DisplayMode best = getBestDisplayMode(device);
if (best != null) {
device.setDisplayMode(best);
}
}
public static void main(String[] args) {
try {
int numBuffers = 2;
if (args != null && args.length > 0) {
numBuffers = Integer.parseInt(args[0]);
if (numBuffers < 2 || numBuffers > COLORS.length) {
System.err.println("Must specify between 2 and "
+ COLORS.length + " buffers");
System.exit(1);
}
}
GraphicsEnvironment env = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
MultiBufferTest test = new MultiBufferTest(numBuffers, device);
} catch (Exception e) {
e.printStackTrace();
}
System.exit(0);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The problem don't happens when the OpenGL path is used with -Dsun.java2d.opengl=True.
- relates to
-
JDK-8299047 On Ubuntu 22.04 text cursor in TextArea stops blinking after couple of cycles
- Open