JSR231 and Java2D gpu/memory interaction

Hi all

I 'm working on an application which uses java2d to produce some images (using afine transformations), to be used as textures for a 3d scene rendered using JSR231 (latest version). Everything goes well, but after some random time (1-10 minutes of rendering and creating textures), the CPU load for my application goes to 100%. I’m using a thread that is responsible for creating textures from java2d created images, and a queue which contains all the “jobs” waiting to be transformed into images by the thread. After the CPU load goes to 100%, no jobs from queue are processed further.

I got the following thread dump when that happened:

“TilePainter3D 0” daemon prio=2 tid=0x0d9e7650 nid=0x870 runnable [0x1a3ef000…0x1a3efd68]
at sun.java2d.loops.ScaledBlit.Scale(Native Method)
at sun.java2d.pipe.DrawImage.scaleSurfaceData(Unknown Source)
at sun.java2d.pipe.DrawImage.renderImageScale(Unknown Source)
at sun.java2d.pipe.DrawImage.tryCopyOrScale(Unknown Source)
at sun.java2d.pipe.DrawImage.transformImage(Unknown Source)
at sun.java2d.pipe.DrawImage.transformImage(Unknown Source)
at sun.java2d.pipe.DrawImage.transformImage(Unknown Source)
at sun.java2d.pipe.ValidatePipe.transformImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawRenderedImage(Unknown Source)
at gr.talent.map.painters.layer.SimpleImagePainter.drawGeographicFeatures(SimpleImagePainter.java:110)
at gr.talent.map.rendering.Renderer2D.paintGeographicFeatures(Renderer2D.java:832)
at gr.talent.map.rendering.Renderer2D.renderImpl(Renderer2D.java:750)
- locked <0x0341fd88> (a gr.talent.map.rendering.Renderer2D)
at gr.talent.map.rendering.Renderer2D.renderImmediately(Renderer2D.java:347)
at gr.talent.globe.DataHandler.updateImageData(DataHandler.java:130)
- locked <0x041a8ad0> (a java.awt.image.BufferedImage)
at gr.talent.globe.TileRenderingJob.execute(TileRenderingJob.java:49)
at gr.talent.utils.JobScheduler$JobRunnable.run(JobScheduler.java:456)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

This (if I’m correct) shows that there is an infinite loop at sun.java2d.loops.ScaledBlit.Scale(), and that’s why everything freezes. I’m wondering if the following is a java2d problem, or is related to the use of JSR231. At first, I thought that I might go low on gpu memory, and that causes problems on java2d processes. I checked my gpu memory (using the ATI tray tool, I’m using an ATI Mobility Radeon 9000), but it stays well above critical limits. Can Jogl/OpenGL affect the java2d processes? Has anyone come across such a problem?

Most important, how can I isolate this to see if it is a java 2d problem, or it is related to opengl processes?

Thanks in advance
N

You’re running on WIndows, correct? Have you specified -Dsun.java2d.noddraw=true on the command line? My first guess would be that maybe there is some DirectDraw work being done inside the Java2D implementation during your BufferedImage rendering, and DirectDraw and OpenGL are incompatible at the driver level.

Yes, Windows it is. I haven’t specified the noddraw parameter, so this might be the cause. I’ll give it an extensive try. I also mentioned this problem to a person a lot more experienced in java2d than me, and he suggested that numeric extremities in affine transformations used image rendering could cause such erroneous behavior. I’ll look into that direction also, in case something goes wrong with my arguments in image rendering .

Thanks again, Ken!