Commit adc831bf authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Make DRRS debugfs per-crtc/connector

Since I already broke anything that relied on the old contents
of the DRRS debugfs files might as well finish the breakage
and convert the files to be per-crtc/connector so we don't need
to have annoying code in igt to parse these.
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221003113249.16213-4-ville.syrjala@linux.intel.com
parent 2e25c1fb
...@@ -1629,7 +1629,6 @@ void intel_display_debugfs_register(struct drm_i915_private *i915) ...@@ -1629,7 +1629,6 @@ void intel_display_debugfs_register(struct drm_i915_private *i915)
minor->debugfs_root, minor); minor->debugfs_root, minor);
intel_dmc_debugfs_register(i915); intel_dmc_debugfs_register(i915);
intel_drrs_debugfs_register(i915);
intel_fbc_debugfs_register(i915); intel_fbc_debugfs_register(i915);
intel_hpd_debugfs_register(i915); intel_hpd_debugfs_register(i915);
skl_watermark_ipc_debugfs_register(i915); skl_watermark_ipc_debugfs_register(i915);
...@@ -1945,6 +1944,8 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector) ...@@ -1945,6 +1944,8 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector)
if (!root) if (!root)
return; return;
intel_drrs_connector_debugfs_add(intel_connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
debugfs_create_file("i915_panel_timings", S_IRUGO, root, debugfs_create_file("i915_panel_timings", S_IRUGO, root,
connector, &i915_panel_fops); connector, &i915_panel_fops);
...@@ -1997,6 +1998,7 @@ void intel_crtc_debugfs_add(struct drm_crtc *crtc) ...@@ -1997,6 +1998,7 @@ void intel_crtc_debugfs_add(struct drm_crtc *crtc)
return; return;
crtc_updates_add(crtc); crtc_updates_add(crtc);
intel_drrs_crtc_debugfs_add(to_intel_crtc(crtc));
intel_fbc_crtc_debugfs_add(to_intel_crtc(crtc)); intel_fbc_crtc_debugfs_add(to_intel_crtc(crtc));
debugfs_create_file("i915_current_bpc", 0444, crtc->debugfs_entry, crtc, debugfs_create_file("i915_current_bpc", 0444, crtc->debugfs_entry, crtc,
......
...@@ -300,46 +300,26 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc) ...@@ -300,46 +300,26 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc)
static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused) static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
{ {
struct drm_i915_private *i915 = m->private; struct intel_crtc *crtc = m->private;
struct drm_connector_list_iter conn_iter; const struct intel_crtc_state *crtc_state =
struct intel_connector *connector; to_intel_crtc_state(crtc->base.state);
struct intel_crtc *crtc;
drm_connector_list_iter_begin(&i915->drm, &conn_iter);
for_each_intel_connector_iter(connector, &conn_iter) {
seq_printf(m, "[CONNECTOR:%d:%s] DRRS type: %s\n",
connector->base.base.id, connector->base.name,
intel_drrs_type_str(intel_panel_drrs_type(connector)));
}
drm_connector_list_iter_end(&conn_iter);
seq_puts(m, "\n");
for_each_intel_crtc(&i915->drm, crtc) {
const struct intel_crtc_state *crtc_state =
to_intel_crtc_state(crtc->base.state);
seq_printf(m, "[CRTC:%d:%s]:\n", mutex_lock(&crtc->drrs.mutex);
crtc->base.base.id, crtc->base.name);
mutex_lock(&crtc->drrs.mutex);
/* DRRS Supported */ seq_printf(m, "DRRS enabled: %s\n",
seq_printf(m, "\tDRRS enabled: %s\n", str_yes_no(crtc_state->has_drrs));
str_yes_no(crtc_state->has_drrs));
seq_printf(m, "\tDRRS active: %s\n", seq_printf(m, "DRRS active: %s\n",
str_yes_no(intel_drrs_is_active(crtc))); str_yes_no(intel_drrs_is_active(crtc)));
seq_printf(m, "\tDRRS refresh rate: %s\n", seq_printf(m, "DRRS refresh rate: %s\n",
crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ? crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ?
"low" : "high"); "low" : "high");
seq_printf(m, "\tDRRS busy frontbuffer bits: 0x%X\n", seq_printf(m, "DRRS busy frontbuffer bits: 0x%x\n",
crtc->drrs.busy_frontbuffer_bits); crtc->drrs.busy_frontbuffer_bits);
mutex_unlock(&crtc->drrs.mutex); mutex_unlock(&crtc->drrs.mutex);
}
return 0; return 0;
} }
...@@ -348,58 +328,72 @@ DEFINE_SHOW_ATTRIBUTE(intel_drrs_debugfs_status); ...@@ -348,58 +328,72 @@ DEFINE_SHOW_ATTRIBUTE(intel_drrs_debugfs_status);
static int intel_drrs_debugfs_ctl_set(void *data, u64 val) static int intel_drrs_debugfs_ctl_set(void *data, u64 val)
{ {
struct drm_i915_private *i915 = data; struct intel_crtc *crtc = data;
struct intel_crtc *crtc; struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct intel_crtc_state *crtc_state;
struct drm_crtc_commit *commit;
int ret;
for_each_intel_crtc(&i915->drm, crtc) { ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
struct intel_crtc_state *crtc_state; if (ret)
struct drm_crtc_commit *commit; return ret;
int ret;
ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex); crtc_state = to_intel_crtc_state(crtc->base.state);
if (ret)
return ret;
crtc_state = to_intel_crtc_state(crtc->base.state); if (!crtc_state->hw.active ||
!crtc_state->has_drrs)
goto out;
if (!crtc_state->hw.active || commit = crtc_state->uapi.commit;
!crtc_state->has_drrs) if (commit) {
ret = wait_for_completion_interruptible(&commit->hw_done);
if (ret)
goto out; goto out;
}
commit = crtc_state->uapi.commit; drm_dbg(&i915->drm,
if (commit) { "Manually %sactivating DRRS\n", val ? "" : "de");
ret = wait_for_completion_interruptible(&commit->hw_done);
if (ret)
goto out;
}
drm_dbg(&i915->drm,
"Manually %sactivating DRRS\n", val ? "" : "de");
if (val) if (val)
intel_drrs_activate(crtc_state); intel_drrs_activate(crtc_state);
else else
intel_drrs_deactivate(crtc_state); intel_drrs_deactivate(crtc_state);
out: out:
drm_modeset_unlock(&crtc->base.mutex); drm_modeset_unlock(&crtc->base.mutex);
if (ret)
return ret;
}
return 0; return ret;
} }
DEFINE_SIMPLE_ATTRIBUTE(intel_drrs_debugfs_ctl_fops, DEFINE_SIMPLE_ATTRIBUTE(intel_drrs_debugfs_ctl_fops,
NULL, intel_drrs_debugfs_ctl_set, "%llu\n"); NULL, intel_drrs_debugfs_ctl_set, "%llu\n");
void intel_drrs_debugfs_register(struct drm_i915_private *i915) void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc)
{ {
struct drm_minor *minor = i915->drm.primary; debugfs_create_file("i915_drrs_status", 0444, crtc->base.debugfs_entry,
crtc, &intel_drrs_debugfs_status_fops);
debugfs_create_file("i915_drrs_ctl", 0644, crtc->base.debugfs_entry,
crtc, &intel_drrs_debugfs_ctl_fops);
}
debugfs_create_file("i915_drrs_status", 0444, minor->debugfs_root, static int intel_drrs_debugfs_type_show(struct seq_file *m, void *unused)
i915, &intel_drrs_debugfs_status_fops); {
struct intel_connector *connector = m->private;
seq_printf(m, "DRRS type: %s\n",
intel_drrs_type_str(intel_panel_drrs_type(connector)));
return 0;
}
DEFINE_SHOW_ATTRIBUTE(intel_drrs_debugfs_type);
void intel_drrs_connector_debugfs_add(struct intel_connector *connector)
{
if (intel_panel_drrs_type(connector) == DRRS_TYPE_NONE)
return;
debugfs_create_file("i915_drrs_ctl", 0644, minor->debugfs_root, debugfs_create_file("i915_drrs_type", 0444, connector->base.debugfs_entry,
i915, &intel_drrs_debugfs_ctl_fops); connector, &intel_drrs_debugfs_type_fops);
} }
...@@ -24,6 +24,7 @@ void intel_drrs_invalidate(struct drm_i915_private *dev_priv, ...@@ -24,6 +24,7 @@ void intel_drrs_invalidate(struct drm_i915_private *dev_priv,
void intel_drrs_flush(struct drm_i915_private *dev_priv, void intel_drrs_flush(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits); unsigned int frontbuffer_bits);
void intel_crtc_drrs_init(struct intel_crtc *crtc); void intel_crtc_drrs_init(struct intel_crtc *crtc);
void intel_drrs_debugfs_register(struct drm_i915_private *i915); void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc);
void intel_drrs_connector_debugfs_add(struct intel_connector *connector);
#endif /* __INTEL_DRRS_H__ */ #endif /* __INTEL_DRRS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment