Re: Speed problem on 2 monitor

Search this archive.

From: Matan Ziv-Av (matan@svgalib.org)
Date: Thu 31 Aug 2000 - 23:00:17 IDT


On Thu, 31 Aug 2000, alex21cn wrote:

> #include <vga.h>
> main()
> { int i,j;
> int r,g,b;  
> vga_init();
> vga_setmode(G640x480x32K); 
> while(1){
>    for(i=1;i<640;i++)
>  {
>  r=i*255/640;
>  g=128;
>  b=255-r-g;
>  vga_setrgbcolor(r,g,b);
>  vga_drawline(0,0,i,479);
>  vga_setrgbcolor(0,0,0);
>  vga_drawline(0,0,i-1,479);
>  }
>  }
>  vga_setmode(TEXT);
> }

First - use linearmode (simply adding vga_setlinearaddressing(); after
setmode). It is especially helpful for secondary card, since banking is
emulated on such card. It won't help in this case.

> It will draw a line from 0,0 to the bottom line. When only 1
> instance is running, it is quite fluent. But when 2 instances are
> running on 2 differenct monitors, there is a problem:  On monitor 1,
> the program will draw that motion line for a while, and pause.
> During the pause, the program on monitor 2 will draw motion line
> quite fluently, Then it pauses too. So monitor 1 is going, pause,
> monitor 2 is going, pause , monitor 1... Our application will
> capture video from 2 cards, and play them on 2 monitor seperately,
> and the speed must be 20 frame per second. I don't know whether
> svgalib is fast enough to do the output. Could you give me help?

I saw the same affect. I believe the reason is that the problem is that
the programs never sleep, so the kernel is responsible for sharing time
between them. What you see is simply the way the kernel divides
processing time between two running processes of the same priority.
Most programs do sleep some of the time, so there will not be such
problems. I run your program on my primary card, while watching TV
(using a bttv card) on the second monitor, and both video and your
program run as smoothly as when they are alone. 



-- 
Matan Ziv-Av.                         matan@svgalib.org


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST