[Mesa-dev] [libdrm PATCH] intel: Create a new drm_intel_bo offset64 field.

Kenneth Graunke kenneth at whitecape.org
Mon Jan 13 16:33:39 PST 2014


On 01/13/2014 03:56 PM, Kenneth Graunke wrote:
> The existing 'offset' field is unfortunately typed as 'unsigned long',
> which is unfortunately only 4 bytes with a 32-bit userspace.
> 
> Traditionally, the hardware has only supported 32-bit virtual addresses,
> so even though the kernel uses a __u64, the value would always fit.
> 
> However, Broadwell supports 48-bit addressing.  So with a 64-bit kernel,
> the card virtual address may be too large to fit in the 'offset' field.
> 
> Ideally, we would change the type of 'offset' to be a uint64_t---but
> this would break the libdrm ABI.  Instead, we create a new 'offset64'
> field to hold the full 64-bit value from the kernel, and store the
> 32-bit truncation in the existing 'offset' field, for compatibility.
> 
> Cc: Eric Anholt <eric at anholt.net>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Ben Widawsky <ben at bwidawsk.net>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  intel/intel_bufmgr.h     | 12 +++++++++---
>  intel/intel_bufmgr_gem.c | 16 ++++++++++------
>  2 files changed, 19 insertions(+), 9 deletions(-)
> 
> I didn't update the bufmgr_fake stuff.  Do I need to...?

Here's the testing I've done:

- Piglit with old libdrm and old Mesa
- Piglit with libdrm patch, but old Mesa
  (proves offset still works)
- Piglit with libdrm patch and Mesa patches
  (proves offset64 also works)

I have not tested the Broadwell patch because the kernel doesn't
actually ever put objects > 4G today.


More information about the mesa-dev mailing list