Re: [JAVA2D] How to detect hardware acceleration?
To let the user decide to enable such an option is OK. However I think possibly there still exists a performance bug. The test case below causes an avererage of 5% CPU utilization for opaque window and 50% CPU utilization for non-opaque windows even if the animated panel is placed on an opaque panel (tested on the older machine). [code] public class NonOpaqueWindowPerformanceTest extends JFrame { public NonOpaqueWindowPerformanceTest() { super(); setLayout(new BorderLayout()); JPanel p = new JPanel(); p.setBorder(new LineBorder(Color.GREEN)); p.setBackground(Color.RED); p.setOpaque(true); final JPanel p2 = new JPanel(); p2.setOpaque(true); p2.setBorder(new LineBorder(Color.blue)); p2.setPreferredSize(new Dimension(300,300)); p.add(p2); add(p); //remarking the following line means 90% less CPU-utilization on Windows XP setWindowNonOpaque(this); setTitle(getClass().getSimpleName()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 600); setLocationRelativeTo(null); setVisible(true); new Thread(){ public void run() { while (true) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { Color color = new Color(new Random().nextInt(0xFF)); p2.setBackground(color); } }); } } }.start(); } private void setWindowNonOpaque(Window w) { try { Class? c = Class.forName(com.sun.awt.AWTUtilities); Method m = c.getMethod(setWindowOpaque, Window.class, boolean.class); m.invoke(null, w, false); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { EventQueue.invokeLater(new Runnable(){ public void run() { JFrame.setDefaultLookAndFeelDecorated(true); new NonOpaqueWindowPerformanceTest(); } }); } } [/code] [Message sent by forum member 'wzberger' (wzberger)] http://forums.java.net/jive/thread.jspa?messageID=287511 === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] How to detect hardware acceleration?
even if the animated panel is placed on an opaque panel This doesn't matter. If the window is made non-opaque, then every component inside that window will have to pay the price. I don't believe this is a bug. This is a performance limitation of non-opaque windows on Windows platform - there's nothing we can do about it. Non-opaque windows were not originally intended for windows with high update rate. Every update means that we have to update whole window using GDI, which is not hw accelerated (in this case anyway). There's no magic here, the pixels need to get from system memory to vram. The faster the bus (like pcix), the better the performance. Older systems with PCI or AGP buses will have performance penalty. Thanks, Dmitri [EMAIL PROTECTED] wrote: To let the user decide to enable such an option is OK. However I think possibly there still exists a performance bug. The test case below causes an avererage of 5% CPU utilization for opaque window and 50% CPU utilization for non-opaque windows even if the animated panel is placed on an opaque panel (tested on the older machine). [code] public class NonOpaqueWindowPerformanceTest extends JFrame { public NonOpaqueWindowPerformanceTest() { super(); setLayout(new BorderLayout()); JPanel p = new JPanel(); p.setBorder(new LineBorder(Color.GREEN)); p.setBackground(Color.RED); p.setOpaque(true); final JPanel p2 = new JPanel(); p2.setOpaque(true); p2.setBorder(new LineBorder(Color.blue)); p2.setPreferredSize(new Dimension(300,300)); p.add(p2); add(p); //remarking the following line means 90% less CPU-utilization on Windows XP setWindowNonOpaque(this); setTitle(getClass().getSimpleName()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 600); setLocationRelativeTo(null); setVisible(true); new Thread(){ public void run() { while (true) { try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { Color color = new Color(new Random().nextInt(0xFF)); p2.setBackground(color); } }); } } }.start(); } private void setWindowNonOpaque(Window w) { try { Class? c = Class.forName(com.sun.awt.AWTUtilities); Method m = c.getMethod(setWindowOpaque, Window.class, boolean.class); m.invoke(null, w, false); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { EventQueue.invokeLater(new Runnable(){ public void run() { JFrame.setDefaultLookAndFeelDecorated(true); new NonOpaqueWindowPerformanceTest(); } }); } } [/code] [Message sent by forum member 'wzberger' (wzberger)] http://forums.java.net/jive/thread.jspa?messageID=287511 === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help. === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] How to detect hardware acceleration?
Thanks for the info. Wolfgang [Message sent by forum member 'wzberger' (wzberger)] http://forums.java.net/jive/thread.jspa?messageID=287672 === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
Re: [JAVA2D] vertical synchronization in full screen exclusive mode problem
[EMAIL PROTECTED] wrote: Not at this point. We'll be adding API to do that in Java 7 hopefully. In 6u10 we added some internal API to request a vsync-ed strategy. This API is in sun.* package so it may change or go away in the future so I'm not sure of how much use it is. Is this all specific to Linux or is it a general, OS independent problem? Not sure what you mean. The internal API is not specific to Linux if that's what you're asking. Hm, I don't believe we supported fullscreen mode on Linux until 6, so I'm not sure how you could get it to work there. True FSEM doesn't even work in 6u10 with Linux anymore. Things seem to get worse. Our experiences differ, then. It works just fine if you have RANDR extension set up and configured. Try running your application with J2D_TRACE_LEVEL=4 env. variable set, see if it prints out any errors. We have only seen a handful of people using full screen mode on linux - in part because it takes a lot to configure the linux system to work. There's a lot of variables (xinerama, randr, xrender extensions, compositing window managers) which affect the ability of applications (not just Java) to enter FSEM. I think in 5 we used DBE (double buffer extension) for creating implementing buffer strategy, may be something changed in 6 - I can't think of what though. This is very discomforting. One wonders what's not gonna work next time. You're the first to complain about this. Thanks, Dmitri === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.
[JAVA2D] Final version of VSync available...
For your testing purposes -- http://pancyl.com/VSync.htm Source: http://pancyl.com/java/vsync/VSyncApplet.java http://pancyl.com/java/vsync/VSyncCanvas.java http://pancyl.com/java/vsync/VSyncFS.java === To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message signoff JAVA2D-INTEREST. For general help, send email to [EMAIL PROTECTED] and include in the body of the message help.