Subject: Re: drm on amd64 (drmMap failed)
To: Xning Lee <xning@soforge.com>
From: Matt Thomas <matt@3am-software.com>
List: port-amd64
Date: 04/06/2007 08:52:19
On Apr 5, 2007, at 11:17 PM, Xning Lee wrote:

> Matt Thomas <matt@3am-software.com> writes:
>
>> Xning Lee wrote:
>>> "Blair Sadewitz" <blair.sadewitz@gmail.com> writes:
>>>
>>>> This is exactly the same problem I had on amd64; I've since  
>>>> switched
>>>> to i386 (for reasons other than drm; linux compatability on  
>>>> amd64 for
>>>> EMT64 processors is broken).  Could you file a PR for this, please?
>>>>
>>>> Thanks,
>>>>
>>>
>>> The issue of 'drmMap failed' on amd64 because the function
>>> 'udv_attach' of /usr/src/sys/uvm/uvm_device.c can't accept address
>>> offset value more than 0x7fffffffffffffff: (the type of 'voff_t'  
>>> is int64)
>>
>> This is going to be, ultimately, a sign extension problem.  I'm  
>> guessing
>> that line 176 in drm_ioctl.c would show that the address being  
>> passed in
>> has already been sign-extended.
>>
>
> that because at line 190 in drm_bufs.c, the address
> value('map->handle') that retured by 'malloc' has been more than
> 0x7fffffffffffffff, then at line 197 in drm_bufs.c:
>
> 		map->offset = (unsigned long)map->handle;

Since you can't use a malloc'ed address with mmap, it's probably not  
that offset.
mmap wants a physical address, not a virtual address.