Jon Smirl writes:

> Don't the maps always contain the physical address of the object? That
> would provide a unique handle.

No, for _DRM_SHM and _DRM_SCATTER_GATHER maps the offset is a kernel
virtual address (at least at present).  It's only by luck that we
don't see collisions.

Also, using a physical address is not suitable in the long term if we
want 32-bit handles, since physical addresses may well be above 4GB in
future, though for now most systems that we care about seem to put
their AGP and PCI devices at physical addresses below 4GB.

> Where does the handle get used in user space? After I GetMap() to find
> the map I need, I pass the offset back into drmMap() not the handle.
> Offset is the physical address in most cases.

There is a confusing inconsistency between drm_addmap and drm_getmap
here.  drm_addmap has code at the end to return the kernel's
map->offset value in the userspace map->handle field, but drm_getmap
doesn't do that.  So yes, using the map->offset returned by drmGetMap
is correct, at least at present.

That's unfortunate, though, because if we go to 32-bit handles, we'd
really want drm_getmap to return the handle in *handle rather than
*offset, which would mean that it would be the handle value that you
would have to pass to mmap, rather than the offset value.  It seems
that nothing in X or DRI currently uses drmGetMap except for
test/dristat.c, which only prints the offset and handle, so
presumably your stuff would be the only thing that broke if we changed
this. :)

Paul.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to