[PATCH 5/9] dri1: warning fix

Daniel Stone daniel at fooishbar.org
Fri Dec 31 04:32:26 PST 2010


Hi,

On Fri, Dec 31, 2010 at 12:28:30PM +0100, Mark Kettenis wrote:
> > From: Adam Jackson <ajax at redhat.com>
> > 
> > dri.c: In function ‘DRIScreenInit’:
> > dri.c:434: warning: cast from pointer to integer of different size
> 
> Is just pacifying the compiler the right solution here?  At least the
> name of the variable that's being casted (frameBufferPhysicalAddress)
> suggests that this may potentially be a true 64-bit address.  Casting
> to uintptr_t first makes the warning go away, but not the problem.
> 
> The proper solution is to make drm_handle_t a type with the proper
> width.  On OpenBSD we have:
> 
> typedef unsigned long drm_handle_t;     /**< To mapped regions */
> 
> Since all OpenBSD architectures are either ILP32 or LP64, that works
> just fine.  Perhaps the same should be done on Linux?
> 
> If the resulting ABI break is something that can't be handled (or
> can't be handled right now), perhaps add a check that the address
> realy fits into a drm_handle_t instead of silently truncating it?

Yep, that is the proper solution.  Making it 64-bit makes sense at
first, but then you realise you have no DRI for 32-bit clients, since
they'd have a truncated handle.

See this mail and the follow-on thread for more:
http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg49393.html

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101231/128c5990/attachment-0001.pgp>


More information about the xorg-devel mailing list