Re: Linear for the et6000 video card

Search this archive.

From: Dr. Michael Weller (eowmob@exp-math.uni-essen.de)
Date: Fri 31 Jul 1998 - 16:37:36 IDT


Don wrote at Mon, 27 Jul 1998 17:35:10 -0500 (CDT):

>Michael:
>    I have been working on getting linear to work with my et6000
>card.  I have discovered an error either in vgamisc.c or in a comment in
>the header file vga.h which states that modeinfo->memory is the memory
>of the video card in kBytes.  I put my video card memory in modeinfo in
>kBytes and I checked several other drivers in svgalib and they also give
>memory in kBytes.  The program testlinear calls vga_setlinearaddress in
>vgamisc.c.  That program sets memory = modeinfo->memory;.  It queries my
>driver for a base which I send it.  It then calls
>verify_linear_mapping(mapaddr,memory).  That program is in the same
>file, vgamisc.c.  In that program memory is size and the first statement
>is while(size > 256*256) { For my program size is 2048, 2048Kbytes.  So
>it skips out of the loop without going through it once and tells me my
>card can't do linear.  It seems that this program would only work if
>someone had more than 65MBytes of video memory.  My feeling is, from
>reading the program in detail, that this size should be in bytes.  So I
>changed the statement in vga_setlinearaddressing to
>memory=modeinfo->memory*1024; changing the size to bytes, which is what
>I think is needed here.  Do you think I am right? I have trouble

I checked the source now, and yes I am right. I wonder why it wasn't found
earlier. Now, mach32 linear works, but does not use this setup.

>believing that an error like this could go unnoticed since 1993.
>    With this change the while statement executed the proper number
>of times, calling verify_one_linear_mapping(base,size) in the same file.
>It writes to video memory through the vga_setpage and then calls
>map_framebuffer in the same file.  That program tries to mmap the
>address.  This fails every time it is called.  I included intermediate
>printout and found that the statement mem_fd=open("/dev/mem",O_RDWR); in
>map_framebuffer is failing.  I have read that root permission is turned
>off right after initializing and this certainly happens after
>initializing.  This would mean that to use linear addressing the user
>must override permission, which is warned against in the man pages.

Well, I already wrote that, and now I rechecked: Due to the permissions,
it is DEFINITELY clear, that either "/dev/mem" must be opened and mem_fd
remembered later in vga_init(), or "/dev/mem" is opened and mmaped() and
then close (but the mem mapping is kept).

Before this background. The routine set_linearaddressing as it is, is just
bogus, doesn't work, never will or can't work.

Now, if the et6k supports running a linear framebuffer IN ADDITION to the
normal one. You could just set it up in et6k_init and record the size and
physical address in modeinfo and just forget about the linear function
pointer. That will work (and does for Mach32).

The concept with the linear function pointer, however, is broken by
design. Now, it can probably most easy by cured by opening /dev/mem in
vga_init and just keep it open all the time. Not too secure actually.
Hmm, probably it should at least not be passed on execs() (I think you can
set that with fcntl).

Otherwise, it would be best for the driver to find out where the linear
aperture will be (if it is set), mmap that in vga_init(), and then just
use this mmaped memory region later.

I wonder who wrote the linear() function, and if it actually works for
anyone. (Now, I think most card drivers don't use it anyway).

>    I would very much like to hear thoughts on this problem.  It is
>just this type of linear addressing my video card uses.
>            Best regards
>               Don


--

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.


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