Re: 2x vga_init

Search this archive.

From: Dr. Michael Weller (eowmob@exp-math.uni-essen.de)
Date: Tue 09 Apr 2002 - 13:42:34 IDT


On Mon, 8 Apr 2002, Karel Kulhavy wrote:

> Hello
> 
> Is it OK to do this thing in svgalib program?:
> 
> vga_init();
> vga_init();
> 
> 
> The "man vga_init" says nothing about it.
> 
> I think there should be written either
> "vga_init may not be called twice during the run of the program"
> or
> "It is allowed to call vga_init twice. If you do it it does this and that".

Well, its the same as with the last mail. It's not documented, so anything
is allowed to happen which means don't do it.

Again, I don't see why such a comment this shouldn't be added to a
manpage, so the maintainers are probably happy to add it.

In the meantime, as far as I remember the internals of svgalib, I
would rather recommend not to call vga_init() sereral times. AFAIK,
it won't just ignore subsequent calls but happily reinitialize everything
(but not clean enough to allow a different graphic card or driver option
in the second call) s.t. some status may be lost.

For example, it seems possible to me, that a setmode(TEXT) after a second
call to vga_init() made after a graphics setmode will no longer correctly
return to a textmode (and not to the first graphics mode either, at least
on cards with complex programming interfaces).

Now you say.. ok, so make the second call to vga_init() a noop. That could
be done, but it would still stop you from using uninitialized other
vga_calls. Now one could a) Make those fail, but it still means you need
to check the initialization status in even the simplest draw primitive. 
b) Make those silently do vga_init(), which is not nice either since
vga_init() must be called as root which you might wish to give up in your
application as soon as possible.

As a general answer to both mails of you.. I don't see a problem adding
those comments to the man page.. But there will still be one or the other
'undefined' leftover elsewhere, and I think we aren't able to get rid of
those except saying everywhere:
'undefined' means don't do that. 

That is the price to pay for an 'as simple as possible' hack to deal with
the graphics card. 

--

Michael Weller: eowmob@exp-math.uni-essen.de, eowmob@ms.exp-math.uni-essen.de,
or even mat42b@spi.power.uni-essen.de. If you encounter an eowmob account on
any machine in the net, it's very likely it's me.


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


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