[Mesa-dev] [PATCH 5/8] i965/drm: Make BO size a uint64_t rather than unsigned long.

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 11 16:44:54 UTC 2017


On Tue, Apr 11, 2017 at 09:02:48AM -0700, Kenneth Graunke wrote:
> The drm_i915_gem_create ioctl structure uses a __u64 for the size,
> so we should probably use uint64_t to match.  In theory, we could
> probably have a BO larger than 4GB, using a 48-bit PPGTT - it just
> wouldn't be mappable in the CPU's 32-bit address space.
> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.c | 18 +++++++++---------
>  src/mesa/drivers/dri/i965/brw_bufmgr.h |  4 ++--
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> index 40429d8e415..391de547f6b 100644
> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> @@ -93,7 +93,7 @@ atomic_add_unless(int *v, int add, int unless)
>  
>  struct bo_cache_bucket {
>     struct list_head head;
> -   unsigned long size;
> +   uint64_t size;
>  };
>  
>  struct brw_bufmgr {
> @@ -137,8 +137,8 @@ hash_find_bo(struct hash_table *ht, unsigned int key)
>     return entry ? (struct brw_bo *) entry->data : NULL;
>  }
>  
> -static unsigned long
> -bo_tile_size(struct brw_bufmgr *bufmgr, unsigned long size, uint32_t tiling)
> +static uint64_t
> +bo_tile_size(struct brw_bufmgr *bufmgr, uint64_t size, uint32_t tiling)
>  {
>     if (tiling == I915_TILING_NONE)
>        return size;
> @@ -173,7 +173,7 @@ bo_tile_pitch(struct brw_bufmgr *bufmgr, uint32_t pitch, uint32_t tiling)
>  }
>  
>  static struct bo_cache_bucket *
> -bucket_for_size(struct brw_bufmgr *bufmgr, unsigned long size)
> +bucket_for_size(struct brw_bufmgr *bufmgr, uint64_t size)
>  {
>     int i;

for() loop here could be trivally converted to a bsearch.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the mesa-dev mailing list