He looks to have something here, alright.. the key can be zero, I'm just
updating to trunk at the moment to see if I can reproduce it..

the radeon_dri.c has a similiar issue but it isn't as serious in their
case, they check for freeing the AGP memory if (info->agpMemHandle) they
use the return value to do do the setup... (this might explain some of the
radeon mode switcihing issues??)

so as far as I can see we've probably 3 choices,
a)add isValid variables to the I810Rec strucutre for each handle,
b) switch to signed long types for the handles and use -1 as an illegal
handle
(the keys are only signed ints)
c) leave types as unsigned longs and use 0xFFFFFFFF as an illegal handle
value...

and of course
d) revert back to using memory->memory, requires whoever switched us to
key to explain :-)

Dave.


On Mon, 7 Jul 2003, Keith Whitwell wrote:

> Ronald Baljeu wrote:
> > On Mon, Jul 07, 2003 at 09:59:15AM +0100, Keith Whitwell wrote:
> >
> >>Ronald Baljeu wrote:
> >>The traditional approach would be to do a binary search to narrow down
> >>which change caused the problems -- probably using the DRI cvs tree.
> >>
> >>Keith
> >
> >
> > Ok, after several days of searching I think I found something here.
> >
> > In i810_dri.c of the Xfree CVS (I could not get into the DRI CVS)
> > several calls are made to drmAgpAlloc(). To test whether
> > this call was successful the returned handle is checked: if it
> > is 0 it is assumed the call failed. Like this:
> >
> >    drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle);
> >    if (agpHandle != 0)
> >       /* ok */
> >    else
> >       /* error */
> >
> > However I think 0 is a legal handle. Shouldn't the return value
> > of the call be checked instead?
> >
> > Looking at the kernel modules and header files I noticed how
> > this used to work this way. The agpHandle used to be a pointer
> > internally (in the agp_memory struct), but it has been changed
> > to a key. It's difficult to describe what I mean. Maybe this
> > helps:
> >
> > xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:
> >    call to drmAgpAlloc() as described above
> > xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:
> >    body of drmAgpAlloc(), with a call to ioctl(DRM_IOCTL_AGP_ALLOC)
> > xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:
> >    #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
> > xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:
> >    mapping DRM_IOCTL_AGP_ALLOC to DRM(agp_alloc)
> > xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:
> >    body of DRM(agp_alloc)
> >
> > In the body of DRM(agp_alloc) a small change was made from:
> >    entry->handle    = (unsigned long)memory->memory;
> > to:
> >    entry->handle    = (unsigned long)memory->key;
> >
> > So, tracing this back from kernel to userland, this key is now passed
> > as agpHandle in the example above, instead of the memory pointer.
> > Now the handle can legally be 0, but the source of i810_dri.c still
> > treats it like a pointer of which 0 indicates an error.
> >
> > Could this be the source of the problem?
> > Or am I way off ;-)
>
> Ronald,
>
> If you're way off, at this point it sounds like you've got a better idea than
> I...  I'm forwarding this to dri-devel in the hope that this rings a bell with
> someone there.
>
>  From CVS you can tell who made the change - that might help to get a quick
> response...
>
> Keith
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
> _______________________________________________
> Dri-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dri-devel
>

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [EMAIL PROTECTED]
pam_smb / Linux DECstation / Linux VAX / ILUG person



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to