Hi Philip!

> So I'm looking through the AGP stuff, still learning...
> and it seems that there's a whole lot of redundancy in the current API.
> 
> If I'm understanding the sequence properly, generally programs do the
> following:
> 1. open /dev/agpgart
> 2. ioctl(ACQUIRE)
> 3. ioctl(INFO)     to determine amountof memory for AGP
> 4. mmap the device
> 5. ioctl(SETUP)    to set the AGP mode
> 6. ioctl(ALLOCATE) a chunk o memory, specifying offset in aperture
> 7. ioctl(BIND)     that same chunk o memory
> 
> The allocate and bind parts seem to be useless, since the program has
> to call mmap() anyway [right?] 
> 
> Seems to me that programs could perfectly well just mmap the whole chunk of
> memory at once and do what they like to it.
> The agpgart driver could then automatically update the GATT table
> (which I still havent fully figured out, admittedly)
> The allocate and bind calls could just be implicitly done through the
> mmap call.
> What am I missing?

It is not always necessary to memory map the device. For instance with the
I810 driver, just plain 2D, there is no need to mmap the device, but the GTT
(or GATT if you wish) must be populated because the card has no onboard
memory and by default. Since the ALLOCATE ioctl() allocates physical memory
and the BIND ioctl() populates the GTT, the process looks like this:

open /dev/agpgart
ioctl(INFO
ioctl(ACQUIRE)
.
.
.
ioctl(ALLOCATE)
ioctl(BIND)
.
.
.

(see xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c for details)

> Just the "physical" address return, which could perfectly easily be done
> through an agp_allocate() call that would otherwise do nothing, I think.
>  ?

Sometimes, the X driver needs to know the _physical_ location of the page
which it allocates. For instance, there is 2 cases where the I810 series of
chips need this information: 1) hardware cursor and 2) if you want to use
the hardware status page and not do the silly spin until head == tail for
the ring buffer (which btw is the way the Linux driver does this right now).
That is why the agpgart module provides a way to get the physcal location of
a page.

-- 

Regards
 Abraham

You roll my log, and I will roll yours.
                -- Lucius Annaeus Seneca

__________________________________________________________
 Abraham vd Merwe - 2d3D, Inc.

 Device Driver Development, Outsourcing, Embedded Systems

  Cell: +27 82 565 4451         Snailmail:
   Tel: +27 21 761 7549            Block C, Antree Park
   Fax: +27 21 761 7648            Doncaster Road
 Email: [EMAIL PROTECTED]         Kenilworth, 7700
  Http: http://www.2d3d.com        South Africa

Attachment: msg02129/pgp00000.pgp
Description: PGP signature

Reply via email to