[Intel-gfx] [PATCH 04/15] drm/i915: add page_size_mask to dev_info
Chris Wilson
chris at chris-wilson.co.uk
Tue Mar 7 14:40:04 UTC 2017
On Mon, Mar 06, 2017 at 11:54:03PM +0000, Matthew Auld wrote:
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_gem_gtt.h | 14 ++++++++++++++
> drivers/gpu/drm/i915/i915_pci.c | 23 ++++++++++++++++++++++-
> 3 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1fd4128a10b1..e45b8d74cebf 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -913,6 +913,7 @@ struct intel_device_info {
> enum intel_platform platform;
> u8 ring_mask; /* Rings supported by the HW */
> u8 num_rings;
> + unsigned long page_size_mask; /* page sizes supported by the HW */
> #define DEFINE_FLAG(name) u8 name:1
> DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG);
> #undef DEFINE_FLAG
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index fb15684c1d83..6c90a2ffd0e1 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -43,8 +43,18 @@
> #include "i915_selftest.h"
>
> #define I915_GTT_PAGE_SIZE 4096UL
> +#define I915_GTT_PAGE_SIZE_64K 65536UL
> +#define I915_GTT_PAGE_SIZE_2M 2097152UL
> +#define I915_GTT_PAGE_SIZE_1G 1073741824UL
I915_GTT_PAGE_SIZE_4K BIT(12)
I915_GTT_PAGE_SIZE_64K BIT(16)
I915_GTT_PAGE_SIZE_2M BIT(21)
I915_GTT_PAGE_SIZE_1G BIT(30)
#define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K
Still debating the relative merits of a tight enum.
Note that you want to scatter
#define assert_valid_gtt_page_size(page_size) \
GEM_BUG_ON(!is_power_of_2(page_size) || \
page_size & ~I915_GTT_PAGE_SIZE_MASK);
around
or GEM_BUG_ON(is_valid_gtt_page_size(page_size))?
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list