drm/i915: Move MOCS setup to intel_mocs.c
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 30 Jul 2019 18:04:07 +0000 (11:04 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 31 Jul 2019 14:40:35 +0000 (07:40 -0700)
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
Link: https://patchwork.freedesktop.org/patch/msgid/20190730180407.5993-6-lucas.demarchi@intel.com
drivers/gpu/drm/i915/gt/intel_mocs.c
drivers/gpu/drm/i915/gt/intel_mocs.h
drivers/gpu/drm/i915/i915_gem.c

index 764e47131c067c2735004f050f8ac1ab4ddcdd3e..77ddb307346ac226ebbb4841cbab5191c5c69e10 100644 (file)
@@ -426,14 +426,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;
@@ -599,7 +598,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;
@@ -678,3 +677,11 @@ int intel_mocs_emit(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);
+}
index d5d3558caf4e885afd1e6367fb8957379b9e0519..2ae816b7ca197f27d3a8196b1b4463ac69246223 100644 (file)
@@ -53,8 +53,7 @@ struct i915_request;
 struct intel_engine_cs;
 struct intel_gt;
 
-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);
 
 int intel_mocs_emit(struct i915_request *rq);
index 295702ab99e1e0e95578ca22f619d793b823fc73..62eefe860bcdc4a07aa9ef9babd8b21ad60b6feb 100644 (file)
@@ -1247,8 +1247,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);