Commit 61564e6c authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Move DRRS debugfs next to the implementation

Move the DRRS debugfs stuff next to the actual implementation
so that it's easier to deal with the whole.
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-2-ville.syrjala@linux.intel.com
parent df2f59c5
...@@ -1023,52 +1023,6 @@ static int i915_ddb_info(struct seq_file *m, void *unused) ...@@ -1023,52 +1023,6 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
return 0; return 0;
} }
static int i915_drrs_status(struct seq_file *m, void *unused)
{
struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct drm_connector_list_iter conn_iter;
struct intel_connector *connector;
struct intel_crtc *crtc;
drm_connector_list_iter_begin(&dev_priv->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(&dev_priv->drm, crtc) {
const struct intel_crtc_state *crtc_state =
to_intel_crtc_state(crtc->base.state);
seq_printf(m, "[CRTC:%d:%s]:\n",
crtc->base.base.id, crtc->base.name);
mutex_lock(&crtc->drrs.mutex);
/* DRRS Supported */
seq_printf(m, "\tDRRS Enabled: %s\n",
str_yes_no(crtc_state->has_drrs));
seq_printf(m, "\tDRRS Active: %s\n",
str_yes_no(intel_drrs_is_active(crtc)));
seq_printf(m, "\tBusy_frontbuffer_bits: 0x%X\n",
crtc->drrs.busy_frontbuffer_bits);
seq_printf(m, "\tDRRS refresh rate: %s\n",
crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ?
"low" : "high");
mutex_unlock(&crtc->drrs.mutex);
}
return 0;
}
static bool static bool
intel_lpsp_power_well_enabled(struct drm_i915_private *i915, intel_lpsp_power_well_enabled(struct drm_i915_private *i915,
enum i915_power_well_id power_well_id) enum i915_power_well_id power_well_id)
...@@ -1567,53 +1521,6 @@ static const struct file_operations i915_cur_wm_latency_fops = { ...@@ -1567,53 +1521,6 @@ static const struct file_operations i915_cur_wm_latency_fops = {
.write = cur_wm_latency_write .write = cur_wm_latency_write
}; };
static int i915_drrs_ctl_set(void *data, u64 val)
{
struct drm_i915_private *dev_priv = data;
struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc;
for_each_intel_crtc(dev, crtc) {
struct intel_crtc_state *crtc_state;
struct drm_crtc_commit *commit;
int ret;
ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
if (ret)
return ret;
crtc_state = to_intel_crtc_state(crtc->base.state);
if (!crtc_state->hw.active ||
!crtc_state->has_drrs)
goto out;
commit = crtc_state->uapi.commit;
if (commit) {
ret = wait_for_completion_interruptible(&commit->hw_done);
if (ret)
goto out;
}
drm_dbg(&dev_priv->drm,
"Manually %sactivating DRRS\n", val ? "" : "de");
if (val)
intel_drrs_activate(crtc_state);
else
intel_drrs_deactivate(crtc_state);
out:
drm_modeset_unlock(&crtc->base.mutex);
if (ret)
return ret;
}
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(i915_drrs_ctl_fops, NULL, i915_drrs_ctl_set, "%llu\n");
static ssize_t static ssize_t
i915_fifo_underrun_reset_write(struct file *filp, i915_fifo_underrun_reset_write(struct file *filp,
const char __user *ubuf, const char __user *ubuf,
...@@ -1687,7 +1594,6 @@ static const struct drm_info_list intel_display_debugfs_list[] = { ...@@ -1687,7 +1594,6 @@ static const struct drm_info_list intel_display_debugfs_list[] = {
{"i915_shared_dplls_info", i915_shared_dplls_info, 0}, {"i915_shared_dplls_info", i915_shared_dplls_info, 0},
{"i915_dp_mst_info", i915_dp_mst_info, 0}, {"i915_dp_mst_info", i915_dp_mst_info, 0},
{"i915_ddb_info", i915_ddb_info, 0}, {"i915_ddb_info", i915_ddb_info, 0},
{"i915_drrs_status", i915_drrs_status, 0},
{"i915_lpsp_status", i915_lpsp_status, 0}, {"i915_lpsp_status", i915_lpsp_status, 0},
}; };
...@@ -1702,7 +1608,6 @@ static const struct { ...@@ -1702,7 +1608,6 @@ static const struct {
{"i915_dp_test_data", &i915_displayport_test_data_fops}, {"i915_dp_test_data", &i915_displayport_test_data_fops},
{"i915_dp_test_type", &i915_displayport_test_type_fops}, {"i915_dp_test_type", &i915_displayport_test_type_fops},
{"i915_dp_test_active", &i915_displayport_test_active_fops}, {"i915_dp_test_active", &i915_displayport_test_active_fops},
{"i915_drrs_ctl", &i915_drrs_ctl_fops},
{"i915_edp_psr_debug", &i915_edp_psr_debug_fops}, {"i915_edp_psr_debug", &i915_edp_psr_debug_fops},
}; };
...@@ -1724,6 +1629,7 @@ void intel_display_debugfs_register(struct drm_i915_private *i915) ...@@ -1724,6 +1629,7 @@ 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);
......
...@@ -297,3 +297,109 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc) ...@@ -297,3 +297,109 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc)
mutex_init(&crtc->drrs.mutex); mutex_init(&crtc->drrs.mutex);
crtc->drrs.cpu_transcoder = INVALID_TRANSCODER; crtc->drrs.cpu_transcoder = INVALID_TRANSCODER;
} }
static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
{
struct drm_i915_private *i915 = m->private;
struct drm_connector_list_iter conn_iter;
struct intel_connector *connector;
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",
crtc->base.base.id, crtc->base.name);
mutex_lock(&crtc->drrs.mutex);
/* DRRS Supported */
seq_printf(m, "\tDRRS Enabled: %s\n",
str_yes_no(crtc_state->has_drrs));
seq_printf(m, "\tDRRS Active: %s\n",
str_yes_no(intel_drrs_is_active(crtc)));
seq_printf(m, "\tBusy_frontbuffer_bits: 0x%X\n",
crtc->drrs.busy_frontbuffer_bits);
seq_printf(m, "\tDRRS refresh rate: %s\n",
crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ?
"low" : "high");
mutex_unlock(&crtc->drrs.mutex);
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(intel_drrs_debugfs_status);
static int intel_drrs_debugfs_ctl_set(void *data, u64 val)
{
struct drm_i915_private *i915 = data;
struct intel_crtc *crtc;
for_each_intel_crtc(&i915->drm, crtc) {
struct intel_crtc_state *crtc_state;
struct drm_crtc_commit *commit;
int ret;
ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
if (ret)
return ret;
crtc_state = to_intel_crtc_state(crtc->base.state);
if (!crtc_state->hw.active ||
!crtc_state->has_drrs)
goto out;
commit = crtc_state->uapi.commit;
if (commit) {
ret = wait_for_completion_interruptible(&commit->hw_done);
if (ret)
goto out;
}
drm_dbg(&i915->drm,
"Manually %sactivating DRRS\n", val ? "" : "de");
if (val)
intel_drrs_activate(crtc_state);
else
intel_drrs_deactivate(crtc_state);
out:
drm_modeset_unlock(&crtc->base.mutex);
if (ret)
return ret;
}
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(intel_drrs_debugfs_ctl_fops,
NULL, intel_drrs_debugfs_ctl_set, "%llu\n");
void intel_drrs_debugfs_register(struct drm_i915_private *i915)
{
struct drm_minor *minor = i915->drm.primary;
debugfs_create_file("i915_drrs_status", 0444, minor->debugfs_root,
i915, &intel_drrs_debugfs_status_fops);
debugfs_create_file("i915_drrs_ctl", 0644, minor->debugfs_root,
i915, &intel_drrs_debugfs_ctl_fops);
}
...@@ -24,5 +24,6 @@ void intel_drrs_invalidate(struct drm_i915_private *dev_priv, ...@@ -24,5 +24,6 @@ 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);
#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