Direct Driver(Video) Programming

Discussion in 'General Software Discussion' started by Elemancer, May 8, 2005.

  1. Elemancer

    Elemancer New Member

    Joined:
    May 8, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Alright, I have this obsession being a computer engineer:

    I HAVE to know how to program directly into the driver of any device I use. OR I'd even settle for a good open source driver for ATI cards that I can peruse and finger out what the procedure is to get to the video card without pissing off windows.

    Currently, I am doing some things in 3d, but I find learning the d3d API a bit boring...I want to get to the guts of my video card. I use a Radeon 9800 PRO AIW...I could've sworn omega drivers were open source but they don't seem to have the source code posted.

    Basically, anyone have a nifty little library that gives me some good linkage via c++ to plink with the card driver. I'll even settle for c, but this damn free MSVC compiler gets a little bitchy when I go to C.

    On a side note, anyone happen to have a good resource for instruction sets of these GPUs?
     
  2. logos1

    logos1 New Member

    Joined:
    Feb 8, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    hahaha.. man, you're in for one hell of a ride. computer engineering ain't easy by a long shot, and what u learn is hardly related to what you're asking about. if u do computer engineering, at the shallowest level.. you'll learn how to analyze basic circuitry using elementary first order and second order ordinary differential equations.. how to analyze the non-linear characteristics of more complex circuit components using numerical methods and partial differential equations.. and, most importantly, how to apply those concepts to design, debug, and improve hardware.

    back on ur question.. the term "instruction set" doesn't apply to video cores.. what u got for video cores is a set of procedures defined by and designed for the directx/opengl spec. each procedure is implemented on the video card as a sequence of sub-procedures (kinda like the concept of uops in a superscalar architecture). if you're trying to improve the performance of the api, then don't use the c/c++ front-end.. do all the coding in assembly. if you want to avoid an api absolutely.. then be ready for horrible performance. this is how u'd code without any use of an api..
    Code:
    push es
    mov ax, 0A000h
    mov es, ax ; set the segment register to io space
    mov ax, 0Fh
    int 10h ; get mode
    
    push ax
    xor ax, 1Ch
    int 10h ; set mode -- 320 x 240
    
    mov di, 677h
    mov al, 4 ; set color
    
    L1: sub di, 600h
    stosb ; color pixel in middle of row x
    
    add di, 73Fh ; inc to next row
    jnc L1 ; loop 320 times
    
    pop ax
    int 10h
    pop es
    that's the assembly code to draw a line down the middle of a 320x240 screen.. the code will be limited completely by the speed of the memory. using that code, a rage 128 will draw this just as fast as a radeon x800 on the same processor.
     
    Last edited: May 8, 2005
  3. Scar_T

    Scar_T New Member

    Joined:
    Oct 18, 2004
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    Well ... That's using BIOS interruptions, I mean, you are using your BIOS as an interface to get access to the video card, but you can'tl never get all of the capabalities of your vcard through this method. Another point against this approach is that you won't be able to run your apps under WinXP or Win2k, because you can't access the BIOS directly under these SOs (because they are running under protected mode).
     
  4. Elemancer

    Elemancer New Member

    Joined:
    May 8, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    because you can't access the BIOS directly under these SOs

    I was afraid of this...and yes, I'm vaguely new to low level software implementation for GPUs. I should've known better than to hope for an instruction set...

    So, let me get this straight, the API doesn't merely link you to the driver, and simplify the calls made by that driver? I always have my term driver confused me thinks. Or is the driver simply a collection of calls that most operating systems use? I guess I could start reading into this...

    I know, in general, how things are layed out in a very basic sense. I haven't been exposed much to super scalar architecture. Basically, I'm trying to get a thorough understanding from top to bottom, and see where I enjoy it the most. Front end is okay...I'm currently on the logic/device level of optimized design...going below device does not appeal at all, been there done that. Its the middle parts I have trouble with, and hate being so remote from hardware, though understand the need for the collection of stuff for easy programming.

    Recently, I came into a scuffle with the winsock API, so I'm not exactly a fan of APIs especially when most things I want to do involve very little code, and APIs orient themselves for large scale software design. Call me a software engineer and I'll punch you in the face....[​IMG]
     
  5. Scar_T

    Scar_T New Member

    Joined:
    Oct 18, 2004
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    DirectX is a simplification that an application uses in order to be able to use your video card. (but of course it has A LOT of more features :))

    Now, a driver is not a collection of common calls that most SOs uses, a driver is specific for every piece of hardware. Windows (in this case) gives a standard on which function should be implemented in driver, so Windows calls to this function, becuase it knows that must be there, and the driver executes this request according to the respective hardware.
     
  6. logos1

    logos1 New Member

    Joined:
    Feb 8, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    well yea.. you can't access the bios after u set the proc in protected mode, but that's the only way you're going to be able to access it without the use of an api.. i don't know what the kernel call will be or where the hal maps the io memory for the video card so i left it in dos. but i'd imagine that there would be some software interrupt that allows you to do this.

    directx isn't just a simplification that apps use.. it's the sole basis for the driver. it does, like every other driver, require a minimal set of functions for windows to interface with.. but aside from the most basic of elements, the rest of the functions pertain to a specific api.
    the api defines a set of functions, such as drawing a 3d rectangle, which gets decoded by the driver as a combination of procedural calls to the video card (if u want a list.. call ur local ati or nvidia rep and ask em.. most likely u'll have to sign a nda tho). that's what drivers do.. interface the hardware with an api.
    just drawing a stationary object without any effects shouldn't be too hard.. but if you did want to, it'd require knowledge on matrix algebra and linear 1:1 transformations on top of the code. u won't need to know how to write them, but u would need to know how to use em.. i.e. take an image, transform it from 1 domain to another.. do some arithmetic on it or take another transform (and inverse), then take the inverse transform of the previous image to get computed image.
    well.. aside from all this, i'm takin a class on computer graphics next semester, so i'll know more after that.
     
    Last edited: May 22, 2005
  7. agenthex

    agenthex New Member

    Joined:
    Jan 11, 2005
    Messages:
    66
    Likes Received:
    0
    Trophy Points:
    0
    You might want to cruise ATI's developer site to see what the full APIs are for interacting with the drivers. Also, if you're bored with D3D, have you tried OpenGL?
     

Share This Page

visited