Bug 4867 - PgMemFlush() considered expensive (1GLEEJC)
Summary: PgMemFlush() considered expensive (1GLEEJC)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Neutrino
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:24 EDT by Mike Wilson CLA
Modified: 2002-05-27 10:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wilson CLA 2001-10-11 14:24:28 EDT
PJM (10/10/2001 4:45:17 PM)
	we should NOT
	be calling PmMemFlush() after memory context operations, only as 
needed.  Which
	is not at all obvious when that might be.  I guess whenever we draw the 
underlying
	image, or get an ImageData on it.

	I'm going to prototype this to see how workable it is ...

NOTES:

PJM (10/11/2001 12:50:03 PM)
	
	Here are the changes I made to SWT:
		GC:
			added the following static field:
				static final boolean LazyFlushMC = 
(System.getProperty("lfmc") != null);

			added the following to public void drawImage(Image 
image, int x, int y), after the isDisposed() check:
				if (GC.LazyFlushMC) image.internal_flushMCs();

			added the following to public void drawImage(Image 
image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, 
int destWidth, int destHeight)  
			after the isDisposed() check:
				if (GC.LazyFlushMC) image.internal_flushMCs();

			in unsetGC(), changed:
				OS.PmMemFlush(handle, image.handle);
			to:
				if (!GC.LazyFlushMC) OS.PmMemFlush(handle, 
image.handle);

		Image:
			added:
				import java.util.*;

			added inst field:
				private Vector memoryContexts = new Vector();

			added the following to getImageData(), after the 
isDisposed() check:
				if (GC.LazyFlushMC) internal_flushMCs();

			added the following to internal_new_GC(), before the 
return:
				if (GC.LazyFlushMC) memoryContexts.addElement
(new Integer(pmMC));

			added the following to internal_dispose_GC, as the 
first statement:
				if (GC.LazyFlushMC) internal_flushMCs();

			added the following to internal_dispose_GC, as the last 
statement:
				if (GC.LazyFlushMC) memoryContexts.removeElement
(new Integer(pmMC));

			added the following method:
				void internal_flushMCs() {
					if (!GC.LazyFlushMC) return;
	
					for (int i=0; i<memoryContexts.size(); 
i++) {
						int mc = ((Integer) 
(memoryContexts.elementAt(i))).intValue();
						OS.PmMemFlush(mc,handle);
					}
				}

PJM (10/11/2001 1:04:40 PM)
	Timings per step in the Delphi TestIntView sample:
		P3 500Mz before:					60ms 
		P3 500Mz after:						52ms
		P3 500Mz not using mc's:		21ms

		Aspen/Tahoe nofix before: 		590ms
		Aspen/Tahoe nofix before:		521ms

		Aspen/Tahoe twox before:		380ms
		Aspen/Tahoe twox before:		301ms

		Aspen/Tahoe not using mc's:	140ms

	Notes:
		before is WITHOUT -Dlfmc=X
		after is WITH -Dlfmc=X

		The Aspen/Tahoe nofix/twox differences are different
		photon libraries statically linked with the vm.  twox 
		has faster mc functions.

		"not using mc's" is the TestIntView sample rerigged
		to paint all the child gauges directly to the window instead
		of the offscreen image.  Very flashy, but also very quick.
Comment 1 DJ Houghton CLA 2001-10-29 16:45:04 EST
PRODUCT VERSION:

	2.002

Comment 2 Mike Wilson CLA 2002-05-24 19:34:46 EDT
Did we ever do anything about this? If we did (or did something 
equivalent), mark PR as FIXED. If we still want to, mark PR as LATER 
(post R2.0). If we aren't going to mark PR as WONTFIX.
Comment 3 Silenio Quarti CLA 2002-05-27 10:35:13 EDT
This has been fixed for a while.