Eric Anholt writes:
>
> I've taken a look, and started writing down my understanding of handles
> and offsets here:
> http://dri.freedesktop.org/wiki/DrmMapHandling
Thanks for putting together this page!
>
> As far as I could tell, math was not being done on handles. This makes
> sense, since the DRM mmap handler is comparing whether the passed in
> offset is exactly equal to (not just in the range of) a map's
> offset/length. But I'm really concerned about the mixing of handles and
Right. However I came across one place where map handles were used
as base address of a physical range. Then an offset was added. This
had nothing to do with using handles in mmap().
The 'handles' seemed to be some multi purpose thing.
Please take a look at
https://bugs.freedesktop.org/attachment.cgi?id=2363
and the following change:
diff -rNu ../unpatched/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c
Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c
--- ../unpatched/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c 2004-12-16
01:23:47.000000000 +0100
+++ Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c 2005-04-05 21:26:38.000000000
+0200
@@ -612,8 +612,7 @@
_tnl_allow_pixel_fog( ctx, GL_FALSE );
_tnl_allow_vertex_fog( ctx, GL_TRUE );
- mmesa->primary_offset = mmesa->mgaScreen->primary.handle;
-
+ mmesa->primary_offset = drmAgpBase(sPriv->fd);
ctx->DriverCtx = (void *) mmesa;
mmesa->glCtx = ctx;
If you look at mgaioctl.c you will find code that does arithmetic
with mmesa->primary_offset.
In my opinion the assignment:
mmesa->primary_offset = mmesa->mgaScreen->primary.handle;
is a bug.
I've made sure that the kernel code still works even without my changes
however there is the small but >0 possibility that it doesn't as this
address might have been taken when when squeezing a 64bit address into
32 bit, in which case the HandleID() macro creates a different handle.
One could argue that the physical address spaces are usually added
before SHMs are so this chance never exists.
> offsets that I'm seeing, which I really can't reconcile with the code
> actually working. But if we could confirm that all DRI drivers were
> using handles to map from, then I think we've got a lot of freedom in
> deciding what type a handle is.
Right.
>
> If someone who's looked at this as well could read that page and correct
> anything I've misunderstood, that would be great.
>
Will do.
Egbert.
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel