On Mon, 03 Nov 2003 17:51:53 +0100, Gerhard W. Gruber wrote: > >I'm working on a kernel debugger which is similar to SoftICE on WIndows. I >would like to take advantage of the graphics mode when a user activates the >debugger under X and so I was investigating how to solve this. When I use >normal VGA mode it doesn't work on my card when I have X running while a >fellow coder has a similar card with also nvidia drvier and it works for him >(more or less). >Now I wonder what is the relation of the video driver to X.
The video driver is part of XFree86. >What is happening when i.e. the user changes to a console? X must save >the current state of the VGA card (i.e. resolution, frequency, etc.) and >switch to a suitable console mode. Basically, yes. It isn't usually necessary to save the graphics state; the driver put the card in a graphics state initially, and since it still knows the parameters requested in the XF86Config file, it can put the card back into that state whenever it wishes. However, the driver does have to save the INITIAL state of the graphics card when the driver starts up so it can restore that before switching back to a console. The console driver does NOT know how to switch back to text mode, so XFree86 must insure that the card is in its original condition before allowing the VT switch to go on. >Similarily when the user switches back to X this has to be reversed and >the state restored. Now I wonder how exactly this is going to happen. Since >nvidia doesn't open it's code I can't look at it, but there has to be some >interface so that X can do this stuff without knowing the details of the >driver. The driver is part of XFree86. Each driver has functions called xxxxEnterVT and xxxxLeaveVT (where xxxx depends on the driver name) that implement the switch to and from a console (VT = virtual terminal). Go look through some of the drivers and you can see how it is done. >Can I use this interface in kernel modules as well? I think it should >be possible. Absolutely not. XFree86 drivers are just user-mode shared object files loaded by the XFree86 executable. They use a custom API and call a bunch of user-mode functions. They will not work in kernel mode. >Another thing is, that I would like to take advantage of the current display >and draw my window directly into the framebuffer. Is this possible? Haven't we had this conversation before? >I know >that I can install the framebuffer support for the kernel and then I would >have an interface to do this, but I wonder how X is doing that. The XFree86 driver has INTIMATE knowledge of the specific graphics card. Typically, the driver goes out and reads the PCI configuration registers (or allows XFree86 to do it) to get the physical addresses assigned to the board. Because the driver knows the card, it knows which of the addresses is the frame buffer and which has the memory-mapped registers. It maps that space into user-mode address space, and starts writing. >Can I get the pointer to the framebuffer and use it, or is there some way >to do this via an interface through the driver. It is not exaclty clear to >me on how X and nvidia.o are related to each other. nvidia.o is part of XFree86. It is a dynamically-loaded library that implements the same interface as all other XFree86 video drivers, and it calls back in to the XFree86 executable and its other drivers for most of its services. >Of course the same holds true for other cards, so the best solution for my >purpose would be to find some way that is more or less independent of the >card, but I guess this is to much to ask for. :) DGA is one was for you to take ownership of the frame buffer, but like all of XFree86, it is a user-mode service. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. _______________________________________________ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
