documentation for graphics drivers?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

documentation for graphics drivers?

Post by octavio »

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 and the hardware (950gme) is not vga compatible.
I already read some intel docs but they do not explain very much ,and linux sources are hard to understand.
somebody knows where to find good documentation?
User avatar
CmpXchg
Member
Member
Posts: 61
Joined: Mon Apr 28, 2008 12:14 pm
Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime

Re: documentation for graphics drivers?

Post by CmpXchg »

Go find a DataSheet for this device :idea:
Every Man Must Learn David DeAngelo's Stuff, Period.
http://www.doubleyourdating.com/Catalog
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: documentation for graphics drivers?

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

Re: documentation for graphics drivers?

Post by octavio »

Combuster wrote:http://www.x.org/docs/intel/
I know this site and dowloaded some pdf files from there ,but these docs only explay the pci configuration part,not the memory mapped registers of the video chip and any thing about the comand set or protocol.
I think there is no documentation,linux guys still have to do reverse enginiering or wait for the manufacturer closed source driver.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: documentation for graphics drivers?

Post by jal »

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.


JAL
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: documentation for graphics drivers?

Post by Combuster »

octavio wrote:
Combuster wrote:http://www.x.org/docs/intel/
I know this site and dowloaded some pdf files from there ,but these docs only explay the pci configuration part,not the memory mapped registers of the video chip and any thing about the comand set or protocol.
:shock:
That is complete and utter BS. I suggest you try and learn to actually read. I needed only 5 seconds (after downloading) to find the mode setting documentation.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: documentation for graphics drivers?

Post by Brendan »

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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
gedd
Member
Member
Posts: 104
Joined: Thu Apr 10, 2008 1:47 am

Re: documentation for graphics drivers?

Post by gedd »

Hi,
Maybe you can try my VESA function
init->loader->VESA.asm

If you have stage loader written is asm, you can test with few modification you video mode.
Include the file and just change this

Code: Select all

%define WIDTH    1024    ; desired mode width
%define    HEIGHT    768        ; desired mode height
%define    BITS    32        ; desired bit per pixel
Eventualy the adress where block are copied :

Code: Select all

;**********************************************
; Copy VBE mode info block at 0x80000 
; Kernel use it
;**********************************************    
CopyBlockInfo:
        pushad
        ;[ds:si] --> [es:di]
        mov     cx, ModeInfoBlockEnds - VbeInfoBlock
        mov     ax, 0x8000
        push    es
        mov     es, ax
        mov     di, 0x00
        mov     si, VbeInfoBlock
        rep     movsb
        pop     es
        popad
        ret
And call VESA function from your stage 2 before going in Protected Mode

Code: Select all

    ;-------------------------------;
    ;   VESA operation              ;
    ;-------------------------------;
   call        GetVESAInfo
   call        SetVideoMode
   call        CopyBlockInfo
In PM mode from your c or c++ kernel you can use VBE struct and VBE mode struct to write your driver.
Ex : to get physical video memory adress
It's VESA not native but can work if the mode exist.
Remember that all video mode for a defined GPU are not listed in VESA documentation.
Hope that help you, and maybe other.
[ Grub 2 | Visual Studio 2013 | PE File ]
The OsDev E.T.
Don't send OsDev MIB !
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

Re: documentation for graphics drivers?

Post by octavio »

Combuster wrote:http://www.x.org/docs/intel/
Thanks for the link,first time i did not realize is wat not the intel site
No,i have not read this yet, will try again.
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

Re: documentation for graphics drivers?

Post by octavio »

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.


JAL
Yes,and is not listed.
And vga programing also do not works,i tested it with a program that can change the videomode in other computers but not on the acer aspire one.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: documentation for graphics drivers?

Post by jal »

octavio wrote:Yes,and is not listed.
And vga programing also do not works,i tested it with a program that can change the videomode in other computers but not on the acer aspire one.
Intel is usually very good in providing technical details for their graphic cards. Do you know exactly what IGP is used? And did you search the Intel site for it?


JAL
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

Re: documentation for graphics drivers?

Post by octavio »

below is the list of pci devices on this computer, i did a search on intel site for 945 datasheetes but these docs are for bios developpers
not for writing drivers.
These docs:
http://www.x.org/docs/intel/
are for writting drivers, but for the 965 chipset.


[EDIT:JamesM] You misread my edit. What I said was "pipe that output through 'grep -i "intel"'", not "remove my edit text then repost the exact same content in [ code ] tags.[/EDIT].
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: documentation for graphics drivers?

Post by Dex »

@octavio, you should read this it may help you: http://intellinuxgraphics.org/documentation.html
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: documentation for graphics drivers?

Post by jal »

Mmm, that's weird. Although the Intel Linux drivers fully support the 945, there doesn't seem to be any technical documentation...


JAL
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: documentation for graphics drivers?

Post by Combuster »

Because consecutive chipsets are like supersets of one another.

Look at the driver's source, the majority is i830_xxxxx files, except for a few i915_xxxxx and i965_xxxxx files (which have i830 predecessors) These do not include mode setting, only video and hardware acceleration.

Which gets us to the conclusion - those older intel cards are programmed the same way as the latest of the series. I.e. the 945 behaves the same as the 965 wrt to mode setting.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply