diff mbox series

[4/4] drm/i915: Move MOCS setup to intel_mocs.c

Message ID 20190726001208.6971-5-lucas.demarchi@intel.com (mailing list archive)
State New, archived
Headers show
Series Tiger Lake: MOCS table handling | expand

Commit Message

Lucas De Marchi July 26, 2019, 12:12 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Hide the details of MOCS setup from i915_gem by moving both current calls
into one in intel_mocs_init.

Cc: Stuart Summers <stuart.summers@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190713010940.17711-21-lucas.demarchi@intel.com
---
 drivers/gpu/drm/i915/gt/intel_mocs.c | 15 +++++++++++----
 drivers/gpu/drm/i915/gt/intel_mocs.h |  3 +--
 drivers/gpu/drm/i915/i915_gem.c      |  3 +--
 3 files changed, 13 insertions(+), 8 deletions(-)

Comments

Chris Wilson July 26, 2019, 12:23 a.m. UTC | #1
Quoting Lucas De Marchi (2019-07-26 01:12:08)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Hide the details of MOCS setup from i915_gem by moving both current calls
> into one in intel_mocs_init.
> 
> Cc: Stuart Summers <stuart.summers@intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Reviewed-by: Stuart Summers <stuart.summers@intel.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20190713010940.17711-21-lucas.demarchi@intel.com
> ---
>  drivers/gpu/drm/i915/gt/intel_mocs.c | 15 +++++++++++----
>  drivers/gpu/drm/i915/gt/intel_mocs.h |  3 +--
>  drivers/gpu/drm/i915/i915_gem.c      |  3 +--
>  3 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
> index 9399c0ec08f1..d437d35f3347 100644
> --- a/drivers/gpu/drm/i915/gt/intel_mocs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
> @@ -411,14 +411,13 @@ void intel_mocs_init_engine(struct intel_engine_cs *engine)
>   *
>   * This function initializes the MOCS global registers.
>   */
> -void intel_mocs_init_global(struct intel_gt *gt)
> +static void intel_mocs_init_global(struct intel_gt *gt)
>  {
>         struct intel_uncore *uncore = gt->uncore;
>         struct drm_i915_mocs_table table;
>         unsigned int index;
>  
> -       if (!HAS_GLOBAL_MOCS_REGISTERS(gt->i915))
> -               return;
> +       GEM_BUG_ON(!HAS_GLOBAL_MOCS_REGISTERS(gt->i915));
>  
>         if (!get_mocs_settings(gt, &table))
>                 return;
> @@ -587,7 +586,7 @@ static int emit_mocs_l3cc_table(struct i915_request *rq,
>   *
>   * Return: Nothing.
>   */
> -void intel_mocs_init_l3cc_table(struct intel_gt *gt)
> +static void intel_mocs_init_l3cc_table(struct intel_gt *gt)
>  {
>         struct intel_uncore *uncore = gt->uncore;
>         struct drm_i915_mocs_table table;
> @@ -665,3 +664,11 @@ int intel_rcs_context_init_mocs(struct i915_request *rq)
>  
>         return 0;
>  }
> +
> +void intel_mocs_init(struct intel_gt *gt)

* quietly mutters intel_gt_init_mocs() (to be called from
intel_gt_init() [or better name], formerly known as i915_gem_init_hw).
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c
index 9399c0ec08f1..d437d35f3347 100644
--- a/drivers/gpu/drm/i915/gt/intel_mocs.c
+++ b/drivers/gpu/drm/i915/gt/intel_mocs.c
@@ -411,14 +411,13 @@  void intel_mocs_init_engine(struct intel_engine_cs *engine)
  *
  * This function initializes the MOCS global registers.
  */
-void intel_mocs_init_global(struct intel_gt *gt)
+static void intel_mocs_init_global(struct intel_gt *gt)
 {
 	struct intel_uncore *uncore = gt->uncore;
 	struct drm_i915_mocs_table table;
 	unsigned int index;
 
-	if (!HAS_GLOBAL_MOCS_REGISTERS(gt->i915))
-		return;
+	GEM_BUG_ON(!HAS_GLOBAL_MOCS_REGISTERS(gt->i915));
 
 	if (!get_mocs_settings(gt, &table))
 		return;
@@ -587,7 +586,7 @@  static int emit_mocs_l3cc_table(struct i915_request *rq,
  *
  * Return: Nothing.
  */
-void intel_mocs_init_l3cc_table(struct intel_gt *gt)
+static void intel_mocs_init_l3cc_table(struct intel_gt *gt)
 {
 	struct intel_uncore *uncore = gt->uncore;
 	struct drm_i915_mocs_table table;
@@ -665,3 +664,11 @@  int intel_rcs_context_init_mocs(struct i915_request *rq)
 
 	return 0;
 }
+
+void intel_mocs_init(struct intel_gt *gt)
+{
+	intel_mocs_init_l3cc_table(gt);
+
+	if (HAS_GLOBAL_MOCS_REGISTERS(gt->i915))
+		intel_mocs_init_global(gt);
+}
diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.h b/drivers/gpu/drm/i915/gt/intel_mocs.h
index aa3a2df07c82..2c5cbf213819 100644
--- a/drivers/gpu/drm/i915/gt/intel_mocs.h
+++ b/drivers/gpu/drm/i915/gt/intel_mocs.h
@@ -55,8 +55,7 @@  struct intel_engine_cs;
 struct intel_gt;
 
 int intel_rcs_context_init_mocs(struct i915_request *rq);
-void intel_mocs_init_l3cc_table(struct intel_gt *gt);
-void intel_mocs_init_global(struct intel_gt *gt);
+void intel_mocs_init(struct intel_gt *gt);
 void intel_mocs_init_engine(struct intel_engine_cs *engine);
 
 #endif
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 323218854b94..f57ce0d560dd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1252,8 +1252,7 @@  int i915_gem_init_hw(struct drm_i915_private *i915)
 		goto out;
 	}
 
-	intel_mocs_init_global(gt);
-	intel_mocs_init_l3cc_table(gt);
+	intel_mocs_init(gt);
 
 	intel_engines_set_scheduler_caps(i915);