United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4492517 VolatileImage and Image performance slow on Linux
4492517 : VolatileImage and Image performance slow on Linux

Details
Type:
Bug
Submit Date:
2001-08-15
Status:
Resolved
Updated Date:
2001-09-25
Project Name:
JDK
Resolved Date:
2001-09-25
Component:
client-libs
OS:
linux_2.4
Sub-Component:
2d
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.0

Related Reports

Sub Tasks

Description
###@###.### 2001-08-15

J2SE Version (please include all output from java -version flag):
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b72)
Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b72, mixed mode)


Does this problem occur on J2SE 1.3?  Yes / No (pick one)
No.


Operating System Configuration Information (be specific):
RedHat 7.1, Kernel 2.4.3, glibc 2.2.2, XFree 4.0.3


Hardware Configuration Information (be specific):
Athlon 1GHz, 256 MB RAM, Ati Xpert 98 graphics adapter


Bug Description:

The performace of drawImage on Image and VolatileImage objects in JDK 1.4 is
worse than the performance of drawImage on Image objects in JDK 1.3.1 (on
Linux using a local X server).


Steps to Reproduce (be specific):

Run the attached Java program(VolatileImageTest.java &
ImageTest.java) on JDK 1.3.1 and on JDK 1.4 and look at
the output.

Average times for blitting a 600x600 image in milliseconds on Linux (local X
server):

Image JDK 1.3.1: 6-7 ms
Image JDK 1.4cap: 17-19 ms
VolatileImage JDK 1.4cap: 17-19 ms

Not be able to measure the performance on a comparable Win2K machine using
this test (too fast).


                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
merlin-beta3

FIXED IN:
merlin-beta3

INTEGRATED IN:
merlin-beta3


                                     
2004-06-14
EVALUATION

This is due to the fact that we don't use Shared Memory Extension in 1.4 
and we did in 1.3.x .
When 1.3.1 is run with NO_AWT_MITSHM env variable set to false
the rate drops below 1.4.

We probably won't be able to add shmem support in this late stage.
There is a workaround, though.

###@###.### 2001-08-16

We've been able to work on performance for all unix
platforms in beta3.

  The highlights:
   - store images in pixmaps anytime DGA is 
     not available, even in local case which imroves
     performance of apps using swing.
     The 'pmoffscreen' property controls this and can be used
     to override the default. 
     - a new method X11SurfaceData.isDgaAvailable
       is introduced. Returns true if we can actually
       use dga (i.e. we can dga_grab the drawable and we have
       a lib for this framebuffer)
       It returns false on Linux and Solaris x86 as well as in remote
       case on any platform so we'll use pixmaps in these cases.
   - caching of X images on per-surface basis (may be changed
     later to per-screen)
   - Use of MitShMem extension:
    - use mitshmem ext for rendering to the screen or
      server (non-shared) pixmaps (similar to the way it was used in
      1.3.x and prior).
      The NO_J2D_MITSHM env variable disables use of mitshm.
    - use Shared Mem Pixmaps for storing images
      which are often read from.
      By default all images first created as normal pixmaps,
      which potentially means that they might be stored
      in vram. If we detect that the image is 
      often read from (using Chet's new heuristic)
      the image is punt to a Shm Pixmap.

      Unfortunately there is no way to find if a pixmap
      is stored in a vram, so we need this punting 
      to avoid problems with modern Linux X servers similar
      to ones we have had on Win32 with compositing.

      Env variable J2D_PIXMAPS=shared/server
      overrides the default and forces use of either shared or
      'normal' pixmaps.

      After spending some quality time with Linux
      I've traced a bug in Linux XFree86 4.0 X server. Rendering to a
      16-bit shared pixmap may result in x server crash.
      I wrote a pure c program which demonstrates this.
      It renders a line (by XDrawLine) which touches the last
      pixel of the pixmap - it's that simple. 
      Interestingly, we ourselves render the line just fine (if it's
      transparent, for example). The crash doesn't happen
      if I increase amount of shared memory allocated for 
      the image - so it looks like they have problems caclulating
      scan line stride similar to ones I had earlier.

  Note that by default Solaris OS has about 1M limit for a shared
  segment, which is not much.
  Use '/usr/sbin/sysdef -i | grep SHM' to find out your machine setup.
  On Linux: '/usr/bin/ipcs -m -l'
 
  To change the default settings on Solaris,
  modify system's settings in /etc/system : add, for example,
  the following lines, then reboot:
  set shmsys:shminfo_shmmax=10000000
  set shmsys:shminfo_shmmni=200
  set shmsys:shminfo_shmseg=150


###@###.### 2001-09-24
                                     
2001-09-24
SUGGESTED FIX

http://javaweb.sfbay/~tdv/bugs/slowvi/fix2/webrev

###@###.### 2001-09-24
                                     
2001-09-24
WORK AROUND

Use caching offscreen images in pixmaps by running 1.4 with argument -Dsun.java2d.pmoffscreen=true

The results with the provided testcase (modified to call Toolkit.sync()
after the drawImage):
1.3.1 : 31
  1.4 : 51
1.4+pm: 11

###@###.### 2001-08-16
                                     
2001-08-16



Hardware and Software, Engineered to Work Together