1 Reply Latest reply on Nov 26, 2012 3:10 PM by gimbal2

    sun.java2d.d3d.D3DRenderQueue.flushBuffer() too slow

    Milan T
      Sometimes my Java desktop app slows down very much and I did thread dump and I can see that it is executing this line of code for about 30 seconds and uses 50% of CPU:

      at sun.java2d.d3d.D3DRenderQueue.flushBuffer(Native Method)
      at sun.java2d.d3d.D3DRenderQueue.flushBuffer(Unknown Source)
      at sun.java2d.d3d.D3DRenderQueue.flushAndInvokeNow(Unknown Source)
      at sun.java2d.d3d.D3DSurfaceData$D3DDataBufferNative.getElem(Unknown Source)
      at sun.awt.image.DataBufferNative.getElem(Unknown Source)
      at java.awt.image.DataBuffer.getElem(Unknown Source)
      at java.awt.image.SinglePixelPackedSampleModel.getDataElements(Unknown Source)
      at java.awt.image.Raster.getDataElements(Unknown Source)
      at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(Unknown Source)
      at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
      at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
      at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
      - locked <0x2c2299d0> (a sun.java2d.loops.MaskBlit$General)
      at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
      at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
      at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
      at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
      at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
      at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
      at sun.java2d.SunGraphics2D.copyImage(Unknown Source)
      at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
      at sun.java2d.SunGraphics2D.drawImage(Unknown Source)

      this happens almost randomly and not with every user.

      Do you have any idea what could be causing flushBuffer() to executes for 30 seconds and use 50% of CPU? How can I find out what is causing problems?

      Thank you in advance,
        • 1. Re: sun.java2d.d3d.D3DRenderQueue.flushBuffer() too slow
          Well you can turn on java2d trace logging to see what calls Java2D is doing under water (google it).

          But likely you can't do anything. Java2D performance is really unpredictable and also partially bound to the quality of your video drivers and whatever else the computer is doing. On top of that Java2D development has basically been halted in favor of the JavaFX 2 prism rendering engine. You could try disabling Direct3D hardware acceleration to see if that takes the problem away; in my experience the old software rendering pipeline used prior to Java 6 update 10 was more stable.
          1 person found this helpful