Subject: Re: mmap'ing framebuffer memory in MI drivers...
To: None <eeh@netbsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 03/04/1999 10:57:27
On Thu, 4 Mar 1999 09:50:30 -0800 (PST) 
 "Eduardo E. Horvath" <eeh@one-o.com> wrote:

 > Why doesn't the VM layer call the driver mmap() routine and let the driver
 > mmap() routine do the entire operation, possibly using some MD entry point
 > into the pmap layer where all this special information can be passed in as
 > separate parameters?  O.K., so we need another driver vector for munmap(), 
 > I consider this a good thing since it lets the driver keep track of a use
 > count on this resource which are necessary to know if the driver is
 > detachable (if we ever support detach) or allow optimizations in the area
 > of cache flushes, etc.  For example, it lets a video card driver install a
 > locked large page mapping during the map operation and remove it when the
 > mapping goes away.

Because d_mmap() is called many times:

	(1) At mmap time, once for each page to see if the request
	    mmap operation is legal.  No mappings are entered here.

	(2) At fault time, as page faults occur in the mmap'd object,
	    on a per-page basis.

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>