Dear Maurice Sir,
I tried the test program on my another Fedora machine, that's a 2.93GHz Core 2 Dou E7500 CPU with nVidia GeForce 7050 graphics card, but the result is also much slower than yours too:
1. First GrBitBltNC for copy screen context to bufgrc: 0.04 secs 2. 1000 times GrBitBltNC to copy bufgrc back to screen: 10.27 secs.
But I have the following changes compares to yours:
1. The GrSetDriver is changed to GrSetDriver('win32 gw 1024 gh 768 nc 65536'), that creates a bigger window and color depth that I will need. From my test, it is about 3X slow down than GrSetDriver('win32 gw 640 gh 480 nc 256');
2. I don't install djgpp and mingw on my system, and I use the following gpc commands: gpc --automake \ -o ./page2 page2.pp \ -L/usr/local/grx248/lib/unix \ -L/usr/X11R6/lib \ -L/usr/local/grx248/pascal \ -L/usr/local/grx248/lib/unix/libgrx20X.a \ -lgrx20X -lX11 -lm
This gpc command works fine on both my Linux and Sun Solaris machines.
I'm guessing, is the problem comes from the difference of djgpp/mingw/X11 ?
Regards,
JH
----- Original Message ----- From: "Maurice Lombardi" Maurice.Lombardi@ujf-grenoble.fr To: "jhliu" jhliu@ms2.hinet.net Cc: grx@gnu.de Sent: Saturday, December 18, 2010 4:54 AM Subject: Re: Batch drawing to memory only for less screen flickering
Le 14/12/2010 03:15, jhliu a écrit :
The 3rd and 4th 'line' commands seems to be drew in the memory and then be displayed at the next 'GrSetContext' and 'GrBitBltNC' commands. But the remaining problem is the 'GrBitBltNC' takes about 0.1~0.2 seconds on my Linux system, is there any other alternate method to speed-up this ?
You seem to have a speed problem on your (old ?) machine.
I have currently no direct access to a linux system, because I am out of lab. I have a (4 year old) laptop, centrino duo 2.2 Ghz, nVidia Quadro FX 1500M graphics card, with Windows XP. On it I have installed both a djgpp and a mingw32 system, and compliled grx on both. main gcc is 4.4.4 (djgpp) 4.5.0 (mingw) (grx 2.4.8 with all patches is compiled with it) gpc is 20070904 with 3.4.4 backend (djgpp) and 3.4.5 backend (mingw) I run the following gpc program, which is an adaptation of yours: pure grx instead of mixed graph and grx, time measurement, and a 1000x loop over the second GrBitBlt to have measurable times
program page2(input); {$X+} uses gpc,grx;
VAR scrgrc,bufgrc:GrContextPtr; t1,t2:UnixTimeType; ms1,ms2:CInteger; i:integer; msg: string(80); BEGIN GrSetDriver('win32 gw 640 gh 480 nc 256'); GrSetMode(GR_default_graphics,0,0,0,0,0);
scrgrc:=GrScreenContext; bufgrc:=GrCreateContext(GrMaxX,GrMaxY,NIL,NIL);
GrLine(GrMaxX,GrMaxY,0,0,GrWhite); GrLine(GrMaxX,0,0,GrMaxY,GrWhite); GrKeyRead;
{ copy whole screen context to bufgrc } GrBitBlt(bufgrc,0,0,NIL,0,0,GrMaxX,GrMaxY,GrWRITE);
{ clear screen } GrClearScreen(GrBlack); GrKeyRead;
{ set new drawings to bufgrc } GrSetContext(bufgrc); GrLine(0,GrMaxY DIV 2,GrMaxX,GrMaxY DIV 2,GrWhite); GrLine(GrMaxX DIV 2,0,GrMaxX DIV 2,GrMaxY,GrWhite);
{ copy bufgrc back to screen } GrSetContext(scrgrc); t1:=GetUnixTime(ms1); for i:=1 to 1000 do GrBitBlt(NIL,0,0,bufgrc,0,0,GrMaxX,GrMaxY,GrWRITE); t2:=GetUnixTime(ms2);
WriteStr(msg,(t2-t1)+(ms2-ms1)/1e6); GrTextXY(0, GrMaxY div 2,msg,grWhite,GrBlack); GrKeyRead;
END.
I compile without any optimisation (no -Ox) The only change is the driver name in GrSetDriver
The times are for _one_ GrBitBlt
Win32 0.106 milliseconds VESA 6 milliseconds STDVGA 15 milliseconds
Furthermore I can compile and run on a lab machine (64 bits) with linux (Fedora Core) through a VNC I get there XWIN 0.78 milliseconds
So your times are much too longer. For that reason I suppose you have a very slow machine/ graphics card.
The only remedy I can imagine is to use the two pages mechanism available with VESA, implemented ib graph/BGI. But I do not know how to access the VESA functions on a linuw system, and I have currently no access to such a system.
Maurice
-- Maurice Lombardi Laboratoire de Spectrometrie Physique, Universite Joseph Fourier de Grenoble, BP87 38402 Saint Martin d'Heres Cedex FRANCE Tel: 33 (0)4 76 51 47 51 Fax: 33 (0)4 76 63 54 95 mailto:Maurice.Lombardi@ujf-grenoble.fr from January 1st, 2011, the Laboratoire de Spectrométrie Physique will become the LABORATOIRE INTERDISCIPLINAIRE DE PHYSIQUE (LIPhy).