Hi everyone I hope someone can help me solve this problem. I'm having trouble getting hardware acceleration to work on a laptop with Intel Integrated Graphics.
Hardware Acceleration using Java 7 update 11 doesn't appear to be working with Intel Integrated Graphics on a Windows 7 and 8 machine using a BufferStrategy with a JFrame.
Graphics Card: Intel(R) HD Graphics 4000
JRE: Java 7 Update 11
OS: Windows 7, Windows 8
If you want to verify the problem you can download the app I created for testing at: http://ndcubed.com/downloads/GraphicsTest.zip
If you don't feel comfortable downloading a compiled JAR file you can compile the app yourself using the following source code:
package graphicstest;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferStrategy;
public class GraphicsTest extends JFrame {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new GraphicsTest();
}
});
}
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferCapabilities bufferCapabilities;
BufferStrategy bufferStrategy;
int y = 0;
int delta = 1;
public GraphicsTest() {
setTitle("Hardware Acceleration Test");
setSize(500, 300);
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
createBufferStrategy(2);
bufferStrategy = getBufferStrategy();
bufferCapabilities = gc.getBufferCapabilities();
new AnimationThread().start();
}
class AnimationThread extends Thread {
@Override
public void run() {
while(true) {
Graphics2D g2 = null;
try {
g2 = (Graphics2D) bufferStrategy.getDrawGraphics();
draw(g2);
} finally {
if(g2 != null) g2.dispose();
}
bufferStrategy.show();
try {
Thread.sleep(16);
} catch(Exception err) {
err.printStackTrace();
}
}
}
}
public void draw(Graphics2D g2) {
if(!bufferCapabilities.isPageFlipping() || bufferCapabilities.isFullScreenRequired()) {
g2.setColor(Color.black);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(Color.red);
g2.drawString("Hardware Acceleration is not supported...", 100, 100);
g2.setColor(Color.white);
g2.drawString("Page Flipping: " + (bufferCapabilities.isPageFlipping() ? "Available" : "Not Supported"), 100, 130);
g2.drawString("Full Screen Required: " + (bufferCapabilities.isFullScreenRequired() ? "Required" : "Not Required"), 100, 160);
g2.drawString("Multiple Buffer Capable: " + (bufferCapabilities.isMultiBufferAvailable() ? "Yes" : "No"), 100, 190);
} else {
g2.setColor(Color.black);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(Color.white);
g2.drawString("Hardware Acceleration is Working...", 100, 100);
g2.drawString("Page Flipping: " + (bufferCapabilities.isPageFlipping() ? "Available" : "Not Supported"), 100, 130);
g2.drawString("Full Screen Required: " + (bufferCapabilities.isFullScreenRequired() ? "Required" : "Not Required"), 100, 160);
g2.drawString("Multiple Buffer Capable: " + (bufferCapabilities.isMultiBufferAvailable() ? "Yes" : "No"), 100, 190);
}
y += delta;
if((y + 50) > getHeight() || y < 0) {
delta *= -1;
}
g2.setColor(Color.blue);
g2.fillRect(getWidth()-50, y, 50, 50);
}
}
Without hardware acceleration a lot of apps that I've created that require it run slowly on the machine with Integrated Graphics. Its really baffling to me why its not working specifically with this type of graphics card. Anyway thank you for reading all this hopefully we can get to the bottom of this :)!
If you want to use Intel's hardware acceleration and have the CPU do the decoding, yes. Intel's hardware acceleration is handled by QuickSync, which is a feature of their iGPU. If you want hardware acceleration and don't care what is doing the acceleration, then you can use the acceleration provided by a GPU.
This feature is currently not supported by the latest Intel DCH drivers.
If you want to use an Intel graphics card with a GPU, you will need to connect the two using an HDMI cable. Once you have done so, you will need to open the Intel graphics control panel. From here, you will need to select the 'Display' tab. From the display tab, you will need to select the 'GPU Scaling' option.
I just figured it out for anyone who is having this same issue. It was the type of JRE installed. I had the 32bit JRE environment installed on a 64bit machine and for some reason it wasn't utilizing the integrated Intel graphics chip. However after installing the appropriate 64bit JRE, page flipping and hardware acceleration work with the Intel integrated chip.
You can download other versions of the JRE at: http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
Really strange can't believe I stumbled upon the answer. Hope this helps someone in the future :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With