Simply recalculate as needed so that we can remove the
workarounds structure in dev_priv.

Signed-off-by: Oscar Mateo <oscar.ma...@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c      | 34 ++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/i915_drv.h          |  9 ---------
 drivers/gpu/drm/i915/intel_workarounds.c |  4 ----
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 8a6fef4..8fa8c68 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3392,11 +3392,28 @@ static void check_wa_registers(struct seq_file *m,
        }
 }
 
+static uint count_wa_registers(const struct i915_wa_reg_table *wa_table,
+                              uint table_count)
+{
+       uint total = 0;
+       int i, j;
+
+       for (i = 0; i < table_count; i++) {
+               const struct i915_wa_reg *wa = wa_table[i].table;
+
+               for (j = 0; j < wa_table[i].count; j++) {
+                       if (wa[j].applied)
+                               total++;
+               }
+       }
+
+       return total;
+}
+
 static int i915_wa_registers(struct seq_file *m, void *unused)
 {
        struct drm_i915_private *dev_priv = node_to_i915(m->private);
        struct drm_device *dev = &dev_priv->drm;
-       struct i915_workarounds *workarounds = &dev_priv->workarounds;
        const struct i915_wa_reg_table *wa_table;
        uint table_count;
        int i, j, ret;
@@ -3407,9 +3424,9 @@ static int i915_wa_registers(struct seq_file *m, void 
*unused)
 
        intel_runtime_pm_get(dev_priv);
 
-       seq_printf(m, "Context workarounds applied: %d\n",
-                  workarounds->ctx_count);
        intel_ctx_workarounds_get(dev_priv, &wa_table, &table_count);
+       seq_printf(m, "Context workarounds applied: %d\n",
+                  count_wa_registers(wa_table, table_count));
        for (i = 0; i < table_count; i++) {
                const struct i915_wa_reg *wa = wa_table[i].table;
 
@@ -3427,20 +3444,21 @@ static int i915_wa_registers(struct seq_file *m, void 
*unused)
 
        intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
 
-       seq_printf(m, "GT workarounds applied: %d\n", workarounds->gt_count);
        intel_gt_workarounds_get(dev_priv, &wa_table, &table_count);
+       seq_printf(m, "GT workarounds applied: %d\n",
+                  count_wa_registers(wa_table, table_count));
        check_wa_registers(m, wa_table, table_count);
        seq_putc(m, '\n');
 
-       seq_printf(m, "Display workarounds applied: %d\n",
-                  workarounds->disp_count);
        intel_display_workarounds_get(dev_priv, &wa_table, &table_count);
+       seq_printf(m, "Display workarounds applied: %d\n",
+                  count_wa_registers(wa_table, table_count));
        check_wa_registers(m, wa_table, table_count);
        seq_putc(m, '\n');
 
-       seq_printf(m, "Whitelist workarounds applied: %d\n",
-                  workarounds->hw_whitelist_count[RCS]);
        intel_whitelist_workarounds_get(dev_priv, &wa_table, &table_count);
+       seq_printf(m, "Whitelist workarounds applied: %d\n",
+                  count_wa_registers(wa_table, table_count));
        check_wa_registers(m, wa_table, table_count);
        seq_putc(m, '\n');
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f781d1c..7efb59b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2007,13 +2007,6 @@ struct i915_wa_reg_table {
        int count;
 };
 
-struct i915_workarounds {
-       u32 ctx_count;
-       u32 gt_count;
-       u32 disp_count;
-       u32 hw_whitelist_count[I915_NUM_ENGINES];
-};
-
 struct i915_virtual_gpu {
        bool active;
        u32 caps;
@@ -2452,8 +2445,6 @@ struct drm_i915_private {
 
        int dpio_phy_iosf_port[I915_NUM_PHYS_VLV];
 
-       struct i915_workarounds workarounds;
-
        struct i915_frontbuffer_tracking fb_tracking;
 
        struct intel_atomic_helper {
diff --git a/drivers/gpu/drm/i915/intel_workarounds.c 
b/drivers/gpu/drm/i915/intel_workarounds.c
index 5a532a0..74e59bb 100644
--- a/drivers/gpu/drm/i915/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/intel_workarounds.c
@@ -551,7 +551,6 @@ static uint ctx_workarounds_init(struct drm_i915_private 
*dev_priv,
                }
        }
 
-       dev_priv->workarounds.ctx_count = total_count;
        DRM_DEBUG_DRIVER("Number of context specific w/a: %u\n", total_count);
 
        return total_count;
@@ -868,7 +867,6 @@ void intel_gt_workarounds_apply(struct drm_i915_private 
*dev_priv)
        intel_gt_workarounds_get(dev_priv, &wa_table, &table_count);
        total_count = mmio_workarounds_apply(dev_priv, wa_table, table_count);
 
-       dev_priv->workarounds.gt_count = total_count;
        DRM_DEBUG_DRIVER("Number of GT specific w/a: %u\n", total_count);
 }
 
@@ -988,7 +986,6 @@ void intel_display_workarounds_apply(struct 
drm_i915_private *dev_priv)
        intel_display_workarounds_get(dev_priv, &wa_table, &table_count);
        total_count = mmio_workarounds_apply(dev_priv, wa_table, table_count);
 
-       dev_priv->workarounds.disp_count = total_count;
        DRM_DEBUG_DRIVER("Number of Display specific w/a: %u\n", total_count);
 }
 
@@ -1133,7 +1130,6 @@ int intel_whitelist_workarounds_apply(struct 
intel_engine_cs *engine)
                }
        }
 
-       dev_priv->workarounds.hw_whitelist_count[engine->id] = total_count;
        DRM_DEBUG_DRIVER("%s: Number of whitelist w/a: %u\n", engine->name,
                         total_count);
 
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to