We also saw the same problem running on dual processors, the solution
was to make sure to only do screen updates from the event dispatch
thread.

http://developer.java.sun.com/developer/technicalArticles/Threads/swing/
?frontpage-jdc

http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html


Ted Hill

> -----Original Message-----
> From: Nidel, Michael [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2003 9:40 AM
> To: [EMAIL PROTECTED]
> Subject: [JAVA2D] Strange Component painting on a dual-processor
machine
> 
> We have a video playback engine which uses JMF to display an AVI file.
> During playback, we are also animating a couple of other things in
> different
> windows.
> 
> When testing the application on a dual-processor machine with dual
> monitors,
> we've noticed a strange behavior when painting components. It's rather
> difficult to describe, but I'll try to be clear and concise.
> 
> There is a window containing a fairly small video player and some
playback
> controls. We have implemented our own component to display the
playback
> position, and the component is drawn using the Graphics2D. There is a
> separate window (JFrame) in which we display a "mosaic," a static
image of
> all of the frames of the video, based on the camera movement from
frame to
> frame. This window updates to follow the position of the current frame
> across the mosaic, since a mosaic image can be larger than a
reasonable
> window size. The panel scrolls to expose the relevant part of the
mosaic
> as
> the video plays. The mosaic window is typically 2 or 3 times the size
of
> the
> video player itself. The mosaic image itself is constructed using
> JAI.create("awtImage"...) and displayed with Graphics2D.drawImage().
> 
> There is also a window which displays thumbnails of the frames (at
0.35
> scale), with the current frame in the center and the next and previous
two
> or three frames to the right and left. This component also updates
with
> every frame played, and understandably it only worsens the problem
below.
> 
> What we see is that during playback on the dual-processor machine
(specs
> to
> follow), when the video player frame is in front and the mosaic frame
is
> next behind it, the playback position component occasionally (a few
frames
> a
> second) draws into the mosaic panel, and the region of the mosaic
panel
> that
> was replaced by the playback component appears where in the other
frame
> where the playback position indicator should be. You might say the
pixels
> in
> those two places are "swapped". If this is done on a single-processor
> machine, frames are dropped (or flickered) but the components do not
paint
> "swapped" like this. And if the app is run so that the video and
mosaic
> windows are on separate machines, the painting is correct and there
are
> very
> few dropped frames. Finally, if the app is run so that another window
> (such
> as Notepad or some other application) is BETWEEN the video and mosaic
> windows (in the z-direction), the components paint correctly but
flicker
> much more.
> 
> I don't know whether to chalk this problem up to the complexity of the
> graphics systems involved, and I'm not sure if it's the dual-processor
or
> the dual-headed nature of the machine, or some other aspect that
causes
> the
> "swap." But if anyone has any insights as to why the components might
be
> drawing on the wrong window, that would be helpful. Unfortunately, I
> haven't
> gotten intimately familiar with the code yet, so I haven't had a
chance to
> check for performance optimizations that could eliminate this
problem...
> 
> Systems:
> 
> dual-processor:
> dual Intel Xeon 1.7 GHz processors
> 1GB RAM
> Windows 2000 Pro
> JRE 1.4.1_01
> JMF 2.1.1b
> JAI 1.1.1_01
> 
> single processor:
> Intel P4 1.8 GHz processor
> 768MB RAM
> Windows 2000 Pro
> JRE 1.4.1_01
> JMF 2.1.1b
> JAI 1.1.1_01
> 
> I don't know the graphics adapter information for either machine, but
I
> could get it if it might help.
> 
> 
> thanks,
> 
> Mike Nidel
> 
>
========================================================================
==
> =
> 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".

Reply via email to