I've attached my current diffs to DRM. I am coverting DRM so that the
server does not have to run as root. The attached code allows this. 
Most of the changes are in AddMap.

1) sarea is prebuilt
2) agp maps are allowed from non-root master but checked to make sure
they are within allocated agp space.
3) I haven't done PCI maps yet they will look like the AGP ones.

I will probaby get rid of the changes where I added an extra parameter
to the IOCTL macros before check in.

>From user space I use loops like this:

for (i = 0;; i++) {
   if (drmGetMap(disp->drmFD, i, &offset, &size, &type, &flags,
&handle, &mtrr) != 0)
      break;
   if (type == DRM_SHM) {
      if (drmMap( disp->drmFD, offset, size,
(drmAddressPtr)(&disp->pSAREA)) < 0) {
           fprintf(stderr, "[drm] drmMap failed\n");
           return 0;
      }
      break;
   }
}
if (!disp->pSAREA)
   return 0;

drmMap never cares about the handle since drmMap turns into mmap and
mmap doesn't know about DRM maps.

-- 
Jon Smirl
[EMAIL PROTECTED]

Attachment: patch
Description: Binary data

Reply via email to