Intel HD Integrated Graphics 3000, Java Trace, Hardware Accelerated?
Hi I hope someone can help me with this problem.
I've noticed that Java seems slower on my laptop especially when viewing animations. I had a hunch that maybe my applications aren't being hardware accelerated so I enabled tracing by doing the following: Code:
System.setProperty("sun.java2d.trace", "count");
On my laptop with Intel HD Integrated Graphics 3000 (Netbook) I got the following results:
Code:
243 calls to sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
240 calls to sun.java2d.loops.FillParallelogram::FillParallelogram(AnyColor, SrcNoEa, AnyInt)
240 calls to sun.java2d.windows.GDIBlitLoops::Blit(IntRgb, SrcNoEa, "GDI")
723 total calls to 3 different primitives
I see a lot of java2d.loops calls which to my understanding indicates rendering is going through the software pipeline.
On my (All in one) desktop AMD Radeon HD 6770M Graphics I get the following results:
Code:
282 calls to sun.java2d.d3d.D3DRTTSurfaceToSurfaceBlit::Blit("D3D Surface (render-to-texture)", AnyAlpha, "D3D Surface")
287 calls to D3DFillRect
282 calls to D3DFillParallelogram
851 total calls to 3 different primitives
Lots of D3D calls as expected indicates hardware accelerated rendering?
So my question, does the above indicate hardware acceleration isn't happening on the laptop? If so why is it not being hardware accelerated? Does it have something to do with the fact that the laptop has integrated graphics?
Thank you for your help :)
Here's the application I created for this example that creates a simple animation moving a rectangle back and forth on the screen:
Code:
import javax.swing.*;
import java.awt.*;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class HardwareAcceleration extends JFrame {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
System.setProperty("sun.java2d.trace", "count");
new HardwareAcceleration().setVisible(true);
}
});
}
PaintSurface canvas = new PaintSurface();
public HardwareAcceleration() {
setSize(500, 500);
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
add(canvas);
}
class PaintSurface extends JPanel {
ScheduledThreadPoolExecutor executor;
int x = 0;
boolean back = false;
Rectangle rect = new Rectangle(0, 0, 100, 100);
public PaintSurface() {
executor = new ScheduledThreadPoolExecutor(1);
executor.scheduleAtFixedRate(new AnimationThread(), 0L, 16L, TimeUnit.MILLISECONDS);
}
class AnimationThread extends Thread {
@Override
public void run() {
if(!back) {
if((rect.x + rect.width) + 2 < getWidth()) {
rect.x += 2;
} else {
rect.x = getWidth() - rect.width;
back = !back;
}
} else {
if(rect.x - 2 > 0) {
rect.x -= 2;
} else {
rect.x = 0;
back = !back;
}
}
repaint();
}
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.darkGray);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(Color.blue);
g2.fill(rect);
}
}
}
Re: Intel HD Integrated Graphics 3000, Java Trace, Hardware Accelerated?
Re: Intel HD Integrated Graphics 3000, Java Trace, Hardware Accelerated?
Quote:
Originally Posted by
DarrylBurke
This is not a cross-post, see bottom. I hate it when moderators label forum posts as being cross-posted. Doing so deters others from helping with the problem at hand.
Definition of Crossposting:
Crossposting is the act of posting the same message to multiple information channels.
My question on this forum was regarding why hardware acceleration is not present on a particular machine, my question on coderanch refers to why a given animation is not fluid and how I might go about improving its performance. This has nothing to do with the lack of hardware acceleration, the netbook, and integrated graphics I question in this post.
It is a separate question. Lets not get over eager when policing for cross-posters before first reading and comparing the questions.
Why is hardware acceleration not present?:
http://www.java-forums.org/java-2d/6...celerated.html
How can I create smooth animations in Java?:
http://www.coderanch.com/t/585900/GU...ooth-animation