On Wed, 2009-12-23 at 22:55 +0100, Luca Tettamanti wrote:
> On Wed, Dec 23, 2009 at 10:05 PM, Robert Noland <rnol...@2hip.net> wrote:
> > On Wed, 2009-12-23 at 21:36 +0100, Luca Tettamanti wrote:
> >> A drm_handle_t can be safely converted to a pointer and back even on a
> >> 64bit platform (where the size is not the same).
> >>
> >> Signed-off-by: Luca Tettamanti <kronos...@gmail.com>
> >> ---
> >> I looked at the kernel part of the ioctl and it seems that the handle is
> >> always a 32bit quantity, but please double check this patch :)
> >
> > It's size varies with architecture on non-linux.
> 
> Ah, I see. The handle is a long under BSD.
> 
> > This patch shouldn't cause issues,
> 
> Yes, under BSD the cast is superfluous, but harmless.
> 
> > however I would personally really like to see drm_handle_t
> > used consistently and correctly.  If handle were declared as
> > drm_handle_t it would avoid a lot of casting in libdrm and would have
> > allowed me to reliably use arbitrary handles for maps on both i386 and
> > amd64, by defining drm_handle_t to off_t.  As it happens, that requires
> > minor touching of some of the DDX drivers though.
> 
> struct drm_map is used as an ioctl argument, so changing the type
> there would break the ABI. Furthermore I fear that using a type whose
> size changes between i386 and amd64 would result in additional fun in
> maintaining the 32 bit compat interface ;-)

I personally vote for just making it an off_t, which is always 64 bits
for us.  I just had to overhaul all of our mmap stuff and since I still
only have 32 bits to work with on i386, I could only steal the upper 4
bits for a globally unique map id, which limits map size to 256MB.  On
amd64, I stole the upper 24 bits for the map id which still allows any
single map to be up to 1TB in size.

robert.

> Luca
-- 
Robert Noland <rnol...@2hip.net>
2Hip Networks


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to