[Intel-gfx] [RFC 03/31] drm/i915: Move intel_gt initialization to a separate file
Rodrigo Vivi
rodrigo.vivi at intel.com
Fri Jun 14 15:32:23 UTC 2019
On Fri, Jun 14, 2019 at 04:17:03PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> As it will grow in a following patch make a new home for it.
>
> v2:
> * Convert mock_gem_device as well. (Chris)
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
> drivers/gpu/drm/i915/Makefile | 1 +
> drivers/gpu/drm/i915/gt/intel_gt.c | 15 +++++++++++++++
> drivers/gpu/drm/i915/gt/intel_gt.h | 14 ++++++++++++++
> drivers/gpu/drm/i915/i915_gem.c | 6 ++----
> drivers/gpu/drm/i915/selftests/mock_gem_device.c | 5 ++---
> 5 files changed, 34 insertions(+), 7 deletions(-)
> create mode 100644 drivers/gpu/drm/i915/gt/intel_gt.c
> create mode 100644 drivers/gpu/drm/i915/gt/intel_gt.h
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index c0a7b2994077..8df1bf2855d0 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -73,6 +73,7 @@ gt-y += \
> gt/intel_context.o \
> gt/intel_engine_cs.o \
> gt/intel_engine_pm.o \
> + gt/intel_gt.o \
> gt/intel_gt_pm.o \
> gt/intel_hangcheck.o \
> gt/intel_lrc.o \
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> new file mode 100644
> index 000000000000..807c5f746110
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -0,0 +1,15 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#include "intel_gt.h"
> +
> +void intel_gt_init(struct intel_gt *gt)
> +{
> + INIT_LIST_HEAD(>->active_rings);
> + INIT_LIST_HEAD(>->closed_vma);
> +
> + spin_lock_init(>->closed_lock);
> +}
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
> new file mode 100644
> index 000000000000..d0b599dd6d0f
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -0,0 +1,14 @@
> +/*
> + * SPDX-License-Identifier: MIT
> + *
> + * Copyright © 2019 Intel Corporation
> + */
> +
> +#ifndef __INTEL_GT__
> +#define __INTEL_GT__
> +
> +#include "gt/intel_gt_types.h"
> +
> +void intel_gt_init(struct intel_gt *gt);
> +
> +#endif /* __INTEL_GT_H__ */
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 7232361973fd..d5897e13897b 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -44,6 +44,7 @@
> #include "gem/i915_gem_pm.h"
> #include "gem/i915_gemfs.h"
> #include "gt/intel_engine_pm.h"
> +#include "gt/intel_gt.h"
> #include "gt/intel_gt_pm.h"
> #include "gt/intel_mocs.h"
> #include "gt/intel_reset.h"
> @@ -1748,12 +1749,9 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
> {
> int err;
>
> + intel_gt_init(&dev_priv->gt);
> intel_gt_pm_init(dev_priv);
>
> - INIT_LIST_HEAD(&dev_priv->gt.active_rings);
> - INIT_LIST_HEAD(&dev_priv->gt.closed_vma);
> - spin_lock_init(&dev_priv->gt.closed_lock);
> -
> i915_gem_init__mm(dev_priv);
> i915_gem_init__pm(dev_priv);
>
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index b7f3fbb4ae89..fbcccc3cf85a 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -25,6 +25,7 @@
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
>
> +#include "gt/intel_gt.h"
> #include "gt/mock_engine.h"
>
> #include "mock_request.h"
> @@ -201,9 +202,7 @@ struct drm_i915_private *mock_gem_device(void)
>
> i915_timelines_init(i915);
>
> - INIT_LIST_HEAD(&i915->gt.active_rings);
> - INIT_LIST_HEAD(&i915->gt.closed_vma);
> - spin_lock_init(&i915->gt.closed_lock);
> + intel_gt_init(&i915->gt);
>
> mutex_lock(&i915->drm.struct_mutex);
>
> --
> 2.20.1
>
More information about the Intel-gfx
mailing list