[Intel-gfx] [RFC 04/28] drm/i915: Store some backpointers in struct intel_gt

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 13 13:44:44 UTC 2019


Quoting Tvrtko Ursulin (2019-06-13 14:35:15)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> We need an easy way to get back to i915 and uncore.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c       | 7 ++++++-
>  drivers/gpu/drm/i915/gt/intel_gt.h       | 4 +++-
>  drivers/gpu/drm/i915/gt/intel_gt_types.h | 6 ++++++
>  drivers/gpu/drm/i915/i915_gem.c          | 2 +-
>  4 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index e91ffd2dc4fa..29e8dc766ba4 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -4,12 +4,17 @@
>   * Copyright © 2019 Intel Corporation
>   */
>  
> +#include "i915_drv.h"
> +
>  #include "intel_gt.h"
>  
> -void intel_gt_init(struct intel_gt *gt)
> +void intel_gt_init(struct intel_gt *gt, struct drm_i915_private *i915)
>  {
>         static struct lock_class_key reset_key;
>  
> +       gt->i915 = i915;
> +       gt->uncore = &i915->uncore;
> +
>         INIT_LIST_HEAD(&gt->active_rings);
>         INIT_LIST_HEAD(&gt->closed_vma);
>  
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
> index d0b599dd6d0f..f57ff3758f54 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -9,6 +9,8 @@
>  
>  #include "gt/intel_gt_types.h"
>  
> -void intel_gt_init(struct intel_gt *gt);
> +struct drm_i915_private;
> +
> +void intel_gt_init(struct intel_gt *gt, struct drm_i915_private *i915);
>  
>  #endif /* __INTEL_GT_H__ */
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> index cf32ca401b74..99e30f8cfbe0 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
> @@ -17,7 +17,13 @@
>  #include "i915_vma.h"
>  #include "intel_wakeref.h"
>  
> +struct drm_i915_private;
> +struct intel_uncore;
> +
>  struct intel_gt {
> +       struct drm_i915_private *i915;
> +       struct intel_uncore *uncore;
> +
>         struct i915_gt_timelines {
>                 struct mutex mutex; /* protects list, tainted by GPU */
>                 struct list_head active_list;
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index d5897e13897b..7fdf252f9322 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1749,7 +1749,7 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
>  {
>         int err;
>  
> -       intel_gt_init(&dev_priv->gt);
> +       intel_gt_init(&dev_priv->gt, dev_priv);
>         intel_gt_pm_init(dev_priv);
>  
>         i915_gem_init__mm(dev_priv);

Now this definitely requires mock_gem_device fixes.
Nevertheless,

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


More information about the Intel-gfx mailing list