[Intel-gfx] [PATCH 01/18] drm/i915: add page_size_mask to dev_info

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 5 08:43:34 UTC 2017


On Tue, Apr 04, 2017 at 11:11:11PM +0100, Matthew Auld wrote:
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index fb15684c1d83..27b2b9e681db 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -42,7 +42,22 @@
>  #include "i915_gem_request.h"
>  #include "i915_selftest.h"
>  
> -#define I915_GTT_PAGE_SIZE 4096UL
> +#define I915_GTT_PAGE_SIZE_4K BIT(12)
> +#define I915_GTT_PAGE_SIZE_64K BIT(16)
> +#define I915_GTT_PAGE_SIZE_2M BIT(21)
> +#define I915_GTT_PAGE_SIZE_1G BIT(30)
> +
> +#define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K
> +
> +#define I915_GTT_PAGE_SIZE_MASK (I915_GTT_PAGE_SIZE_4K | \
> +				 I915_GTT_PAGE_SIZE_64K | \
> +				 I915_GTT_PAGE_SIZE_2M | \
> +				 I915_GTT_PAGE_SIZE_1G)
> +
> +#define is_valid_gtt_page_size(page_size) \
> +	(is_power_of_2(page_size) && \
> +	 (page_size) & I915_GTT_PAGE_SIZE_MASK)

({ unsigned int __size = (page_size); (__size & SIZE_MASK) == __size; })

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list