Hi,
jal wrote:octavio wrote:Hello,i whant to make a graphic driver to be able to set up 1024*600 videomode on my netbook.
This videomode is not vesa
Did you actually try to enumerate all available VESA modes to see if it is supported? If not, you may wanna do so.
For video cards there's a "pixel clock", which can be set to a range of frequencies - e.g. from 25 MHz to 200 MHz in steps of 2.5 MHz.
Then there's a counter that counts how many "pixel clocks" have passed, which is reset when it reaches the "horizontal total". The horizontal total is the total number of pixels sent to the monitor for each screen line, and includes left blanking, an optional left margin, the visible pixels, an optional right margin, and the right blanking. There's also a horizontal sync pulse in there too (but that's considered part of the right blanking). Basically, when this counter reaches the horizontal total then the video card knows it needs to move to the next screen line.
Then there's a counter that counts how many screen lines have passed, which is reset when it reaches the "vertical total". The vertical total is just like the horizontal total, and counts the number of lines sent to the monitor per frame (and includes top blanking, an optional top margin, the visible lines of pixels, an optional bottom margin and the bottom blanking; with a vertical sync pulse in the bottom blanking). When this counter reaches the vertical total the video card knows it needs to start the next frame.
Basically what I'm saying is that most video cards can actually generate millions of slightly different video modes - typically any horizontal resolution that is a multiple of 8 (e.g. 640 * 480, 648 * 480, 656 * 480, 664 * 380, etc), and any vertical resolution.
However, just because a video card can generate a video mode doesn't mean that the monitor will recognize the video mode and display it correctly. For this there's a list of "established timings" (which are industry standard timings, like "VGA 640 * 480 @ 60 Hz"), plus there's GTF (a Generalized Timing Formula) and CVT (Coordinated Video Timings). The monitor uses EDID to tell the video card (video driver) which video modes it does support.
The VESA/VBE modes are just a set of pre-computed video modes that are slapped into a lookup table in the video card's ROM. They're a very small subset of the full range of possible video modes that the video card could support (and they have nothing to do with what the monitor says it supports).
Also, modern LCD monitors have a preferred video mode (which is typically the native resolution of the monitor, or the actual number of pixels in the LCD screen). Most LCD monitors have "strange" resolutions for their preferred video mode (e.g. 1680 * 1050, or maybe 1024 * 600), partly because most of the standard video modes (established timings) are for a 4:3 aspect ratio, and most LCD monitors are wide screen. Because the VBE/ROM code is set at the factory (and therefore ignores the monitor's EDID) it's entirely possible that the preferred video mode for the monitor isn't listed as one of the possible modes listed by VBE, so you get a mismatched mess if you rely on VBE. For example, for the computer I'm using now the monitor's native resolution is 1680 * 1050, and the closest VBE mode is 1600 * 1024; which means that the monitor scales the image (stretches to 1600 * 1024 image to fit a 1680 * 1050 screen) and I get vertical and horizontal distortion lines where this scaling sucks (where one "video card pixel" is stretched to cover 2 "monitor pixels").
What I'm getting at is that if you're writing a video driver for a specific video card, then you are not restricted to the (very restrictive) set of video modes that are listed by VBE, and (for reasonably modern hardware) you can avoid compatibility problems and provide a much better list of video modes with much more flexibility (e.g. you can find the set of all possible video modes that are supported by the video card and the monitor, and for LCD monitors you can also use the monitor's preferred video mode as the default video mode to avoid scaling issues).
You can even support some more advanced things, like "letterboxing" - e.g. displaying a 4:3 image on a wide-screen monitor with black strips on the left and right so that the aspect ratio isn't messed up and the image looks exactly the same as it would on a 4:3 monitor, or the reverse (wide-screen image on a 4:3 monitor with black strips at top and bottom). Then there's refresh rate control, rotating the image (most Intel drivers support rotation in 90 degree steps, which is useful for some situations), double scanning (to get lower resolution video modes that aren't supported by the monitor by sending each line twice - e.g. "640 * 240" where the monitor thinks it's "640 * 480"), different gamma ramps, etc.
Cheers,
Brendan