Message ID | 20231012123411.17241-1-stanislav.lisovskiy@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: Add bigjoiner force enable option to debugfs | expand |
On Thu, 12 Oct 2023, Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> wrote: > For validation purposes, it might be useful to be able to > force Bigjoiner mode, even if current dotclock/resolution > do not require that. > Lets add such to option to debugfs. > > v2: - Apparently intel_dp_need_bigjoiner can't be used, when > debugfs entry is created so lets just check manually > the DISPLAY_VER. > > v3: - Switch to intel_connector from drm_connector(Jani Nikula) > - Remove redundant modeset lock(Jani Nikula) > - Use kstrtobool_from_user for boolean value(Jani Nikula) > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> > --- > .../drm/i915/display/intel_display_debugfs.c | 72 ++++++++++++++++++- > .../drm/i915/display/intel_display_types.h | 2 + > drivers/gpu/drm/i915/display/intel_dp.c | 6 +- > 3 files changed, 76 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > index fbe75d47a165..dea7bbea83ba 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > @@ -1398,13 +1398,37 @@ out: drm_modeset_unlock(&dev->mode_config.connection_mutex); > return ret; > } > > +static int i915_bigjoiner_enable_show(struct seq_file *m, void *data) > +{ > + struct intel_connector *connector = to_intel_connector(m->private); > + struct drm_crtc *crtc; > + struct intel_encoder *encoder = intel_attached_encoder(connector); > + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > + int ret; > + > + if (!encoder) > + return -ENODEV; > + > + crtc = connector->base.state->crtc; > + if (connector->base.status != connector_status_connected || !crtc) { > + ret = -ENODEV; > + goto out; > + } > + > + seq_printf(m, "Bigjoiner enable: %d\n", intel_dp->force_bigjoiner_enable); > + > +out: > + > + return ret; > +} > + > static ssize_t i915_dsc_output_format_write(struct file *file, > const char __user *ubuf, > size_t len, loff_t *offp) > { > - struct drm_connector *connector = > - ((struct seq_file *)file->private_data)->private; > - struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); > + struct seq_file *m = file->private_data; > + struct intel_connector *connector = m->private; > + struct intel_encoder *encoder = intel_attached_encoder(connector); Ooops, I think you made those changes to the wrong function there. ;) > struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > int dsc_output_format = 0; > int ret; > @@ -1419,12 +1443,39 @@ static ssize_t i915_dsc_output_format_write(struct file *file, > return len; > } > > +static ssize_t i915_bigjoiner_enable_fops_write(struct file *file, > + const char __user *ubuf, > + size_t len, loff_t *offp) > +{ > + struct drm_connector *connector = > + ((struct seq_file *)file->private_data)->private; > + struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); Should be here. > + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > + bool bigjoiner_en = 0; > + int ret; > + > + ret = kstrtobool_from_user(ubuf, len, &bigjoiner_en); > + if (ret < 0) > + return ret; > + > + intel_dp->force_bigjoiner_enable = bigjoiner_en; > + *offp += len; > + > + return len; > +} > + > static int i915_dsc_output_format_open(struct inode *inode, > struct file *file) > { > return single_open(file, i915_dsc_output_format_show, inode->i_private); > } > > +static int i915_bigjoiner_enable_open(struct inode *inode, > + struct file *file) > +{ > + return single_open(file, i915_bigjoiner_enable_show, inode->i_private); > +} > + > static const struct file_operations i915_dsc_output_format_fops = { > .owner = THIS_MODULE, > .open = i915_dsc_output_format_open, > @@ -1434,6 +1485,15 @@ static const struct file_operations i915_dsc_output_format_fops = { > .write = i915_dsc_output_format_write > }; > > +static const struct file_operations i915_bigjoiner_enable_fops = { > + .owner = THIS_MODULE, > + .open = i915_bigjoiner_enable_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = single_release, > + .write = i915_bigjoiner_enable_fops_write > +}; > + > /* > * Returns the Current CRTC's bpc. > * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/i915_current_bpc > @@ -1513,6 +1573,12 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector) > connector, &i915_dsc_output_format_fops); > } > > + if (DISPLAY_VER(dev_priv) >= 11 && > + intel_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { > + debugfs_create_file("i915_bigjoiner_force_enable", 0644, root, > + &intel_connector->base, &i915_bigjoiner_enable_fops); > + } > + > if (connector->connector_type == DRM_MODE_CONNECTOR_DSI || > connector->connector_type == DRM_MODE_CONNECTOR_eDP || > connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index 8d8b2f8d37a9..e0de6eeaf59e 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -1753,6 +1753,8 @@ struct intel_dp { > bool is_mst; > int active_mst_links; > > + bool force_bigjoiner_enable; > + > /* connector directly attached - won't be use for modeset in mst world */ > struct intel_connector *attached_connector; > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c > index 0ef7cb8134b6..daf9bc0d6838 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -1153,7 +1153,11 @@ bool intel_dp_need_bigjoiner(struct intel_dp *intel_dp, > if (!intel_dp_can_bigjoiner(intel_dp)) > return false; > > - return clock > i915->max_dotclk_freq || hdisplay > 5120; > + if (intel_dp->force_bigjoiner_enable) > + drm_dbg_kms(&i915->drm, "Forcing bigjoiner mode\n"); > + > + return clock > i915->max_dotclk_freq || hdisplay > 5120 || > + intel_dp->force_bigjoiner_enable; > } > > static enum drm_mode_status
On Thu, Oct 12, 2023 at 05:59:18PM +0300, Jani Nikula wrote: > On Thu, 12 Oct 2023, Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> wrote: > > For validation purposes, it might be useful to be able to > > force Bigjoiner mode, even if current dotclock/resolution > > do not require that. > > Lets add such to option to debugfs. > > > > v2: - Apparently intel_dp_need_bigjoiner can't be used, when > > debugfs entry is created so lets just check manually > > the DISPLAY_VER. > > > > v3: - Switch to intel_connector from drm_connector(Jani Nikula) > > - Remove redundant modeset lock(Jani Nikula) > > - Use kstrtobool_from_user for boolean value(Jani Nikula) > > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> > > --- > > .../drm/i915/display/intel_display_debugfs.c | 72 ++++++++++++++++++- > > .../drm/i915/display/intel_display_types.h | 2 + > > drivers/gpu/drm/i915/display/intel_dp.c | 6 +- > > 3 files changed, 76 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > index fbe75d47a165..dea7bbea83ba 100644 > > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > > @@ -1398,13 +1398,37 @@ out: drm_modeset_unlock(&dev->mode_config.connection_mutex); > > return ret; > > } > > > > +static int i915_bigjoiner_enable_show(struct seq_file *m, void *data) > > +{ > > + struct intel_connector *connector = to_intel_connector(m->private); > > + struct drm_crtc *crtc; > > + struct intel_encoder *encoder = intel_attached_encoder(connector); > > + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > > + int ret; > > + > > + if (!encoder) > > + return -ENODEV; > > + > > + crtc = connector->base.state->crtc; > > + if (connector->base.status != connector_status_connected || !crtc) { > > + ret = -ENODEV; > > + goto out; > > + } > > + > > + seq_printf(m, "Bigjoiner enable: %d\n", intel_dp->force_bigjoiner_enable); > > + > > +out: > > + > > + return ret; > > +} > > + > > static ssize_t i915_dsc_output_format_write(struct file *file, > > const char __user *ubuf, > > size_t len, loff_t *offp) > > { > > - struct drm_connector *connector = > > - ((struct seq_file *)file->private_data)->private; > > - struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); > > + struct seq_file *m = file->private_data; > > + struct intel_connector *connector = m->private; > > + struct intel_encoder *encoder = intel_attached_encoder(connector); > > Ooops, I think you made those changes to the wrong function there. ;) Ouch, they looked exactly identical! I would say this could have been changed too, but not in that patch indeed :))) Thanks for spotting..probably really time to think about starting using glasses. > > > struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > > int dsc_output_format = 0; > > int ret; > > @@ -1419,12 +1443,39 @@ static ssize_t i915_dsc_output_format_write(struct file *file, > > return len; > > } > > > > +static ssize_t i915_bigjoiner_enable_fops_write(struct file *file, > > + const char __user *ubuf, > > + size_t len, loff_t *offp) > > +{ > > + struct drm_connector *connector = > > + ((struct seq_file *)file->private_data)->private; > > + struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); > > Should be here. > > > + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > > + bool bigjoiner_en = 0; > > + int ret; > > + > > + ret = kstrtobool_from_user(ubuf, len, &bigjoiner_en); > > + if (ret < 0) > > + return ret; > > + > > + intel_dp->force_bigjoiner_enable = bigjoiner_en; > > + *offp += len; > > + > > + return len; > > +} > > + > > static int i915_dsc_output_format_open(struct inode *inode, > > struct file *file) > > { > > return single_open(file, i915_dsc_output_format_show, inode->i_private); > > } > > > > +static int i915_bigjoiner_enable_open(struct inode *inode, > > + struct file *file) > > +{ > > + return single_open(file, i915_bigjoiner_enable_show, inode->i_private); > > +} > > + > > static const struct file_operations i915_dsc_output_format_fops = { > > .owner = THIS_MODULE, > > .open = i915_dsc_output_format_open, > > @@ -1434,6 +1485,15 @@ static const struct file_operations i915_dsc_output_format_fops = { > > .write = i915_dsc_output_format_write > > }; > > > > +static const struct file_operations i915_bigjoiner_enable_fops = { > > + .owner = THIS_MODULE, > > + .open = i915_bigjoiner_enable_open, > > + .read = seq_read, > > + .llseek = seq_lseek, > > + .release = single_release, > > + .write = i915_bigjoiner_enable_fops_write > > +}; > > + > > /* > > * Returns the Current CRTC's bpc. > > * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/i915_current_bpc > > @@ -1513,6 +1573,12 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector) > > connector, &i915_dsc_output_format_fops); > > } > > > > + if (DISPLAY_VER(dev_priv) >= 11 && > > + intel_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { > > + debugfs_create_file("i915_bigjoiner_force_enable", 0644, root, > > + &intel_connector->base, &i915_bigjoiner_enable_fops); > > + } > > + > > if (connector->connector_type == DRM_MODE_CONNECTOR_DSI || > > connector->connector_type == DRM_MODE_CONNECTOR_eDP || > > connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > > index 8d8b2f8d37a9..e0de6eeaf59e 100644 > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > > @@ -1753,6 +1753,8 @@ struct intel_dp { > > bool is_mst; > > int active_mst_links; > > > > + bool force_bigjoiner_enable; > > + > > /* connector directly attached - won't be use for modeset in mst world */ > > struct intel_connector *attached_connector; > > > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c > > index 0ef7cb8134b6..daf9bc0d6838 100644 > > --- a/drivers/gpu/drm/i915/display/intel_dp.c > > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > > @@ -1153,7 +1153,11 @@ bool intel_dp_need_bigjoiner(struct intel_dp *intel_dp, > > if (!intel_dp_can_bigjoiner(intel_dp)) > > return false; > > > > - return clock > i915->max_dotclk_freq || hdisplay > 5120; > > + if (intel_dp->force_bigjoiner_enable) > > + drm_dbg_kms(&i915->drm, "Forcing bigjoiner mode\n"); > > + > > + return clock > i915->max_dotclk_freq || hdisplay > 5120 || > > + intel_dp->force_bigjoiner_enable; > > } > > > > static enum drm_mode_status > > -- > Jani Nikula, Intel
Hi Stanislav, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-tip/drm-tip] url: https://github.com/intel-lab-lkp/linux/commits/Stanislav-Lisovskiy/drm-i915-Add-bigjoiner-force-enable-option-to-debugfs/20231017-105841 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip patch link: https://lore.kernel.org/r/20231012123411.17241-1-stanislav.lisovskiy%40intel.com patch subject: [Intel-gfx] [PATCH] drm/i915: Add bigjoiner force enable option to debugfs config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231017/202310171756.yzfTKqav-lkp@intel.com/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310171756.yzfTKqav-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202310171756.yzfTKqav-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/gpu/drm/i915/display/intel_display_debugfs.c:1413:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (connector->base.status != connector_status_connected || !crtc) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_display_debugfs.c:1422:9: note: uninitialized use occurs here return ret; ^~~ drivers/gpu/drm/i915/display/intel_display_debugfs.c:1413:2: note: remove the 'if' if its condition is always true if (connector->base.status != connector_status_connected || !crtc) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_display_debugfs.c:1407:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 warning generated. vim +1413 drivers/gpu/drm/i915/display/intel_display_debugfs.c 1400 1401 static int i915_bigjoiner_enable_show(struct seq_file *m, void *data) 1402 { 1403 struct intel_connector *connector = to_intel_connector(m->private); 1404 struct drm_crtc *crtc; 1405 struct intel_encoder *encoder = intel_attached_encoder(connector); 1406 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 1407 int ret; 1408 1409 if (!encoder) 1410 return -ENODEV; 1411 1412 crtc = connector->base.state->crtc; > 1413 if (connector->base.status != connector_status_connected || !crtc) { 1414 ret = -ENODEV; 1415 goto out; 1416 } 1417 1418 seq_printf(m, "Bigjoiner enable: %d\n", intel_dp->force_bigjoiner_enable); 1419 1420 out: 1421 1422 return ret; 1423 } 1424
diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index fbe75d47a165..dea7bbea83ba 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -1398,13 +1398,37 @@ out: drm_modeset_unlock(&dev->mode_config.connection_mutex); return ret; } +static int i915_bigjoiner_enable_show(struct seq_file *m, void *data) +{ + struct intel_connector *connector = to_intel_connector(m->private); + struct drm_crtc *crtc; + struct intel_encoder *encoder = intel_attached_encoder(connector); + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); + int ret; + + if (!encoder) + return -ENODEV; + + crtc = connector->base.state->crtc; + if (connector->base.status != connector_status_connected || !crtc) { + ret = -ENODEV; + goto out; + } + + seq_printf(m, "Bigjoiner enable: %d\n", intel_dp->force_bigjoiner_enable); + +out: + + return ret; +} + static ssize_t i915_dsc_output_format_write(struct file *file, const char __user *ubuf, size_t len, loff_t *offp) { - struct drm_connector *connector = - ((struct seq_file *)file->private_data)->private; - struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); + struct seq_file *m = file->private_data; + struct intel_connector *connector = m->private; + struct intel_encoder *encoder = intel_attached_encoder(connector); struct intel_dp *intel_dp = enc_to_intel_dp(encoder); int dsc_output_format = 0; int ret; @@ -1419,12 +1443,39 @@ static ssize_t i915_dsc_output_format_write(struct file *file, return len; } +static ssize_t i915_bigjoiner_enable_fops_write(struct file *file, + const char __user *ubuf, + size_t len, loff_t *offp) +{ + struct drm_connector *connector = + ((struct seq_file *)file->private_data)->private; + struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); + bool bigjoiner_en = 0; + int ret; + + ret = kstrtobool_from_user(ubuf, len, &bigjoiner_en); + if (ret < 0) + return ret; + + intel_dp->force_bigjoiner_enable = bigjoiner_en; + *offp += len; + + return len; +} + static int i915_dsc_output_format_open(struct inode *inode, struct file *file) { return single_open(file, i915_dsc_output_format_show, inode->i_private); } +static int i915_bigjoiner_enable_open(struct inode *inode, + struct file *file) +{ + return single_open(file, i915_bigjoiner_enable_show, inode->i_private); +} + static const struct file_operations i915_dsc_output_format_fops = { .owner = THIS_MODULE, .open = i915_dsc_output_format_open, @@ -1434,6 +1485,15 @@ static const struct file_operations i915_dsc_output_format_fops = { .write = i915_dsc_output_format_write }; +static const struct file_operations i915_bigjoiner_enable_fops = { + .owner = THIS_MODULE, + .open = i915_bigjoiner_enable_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .write = i915_bigjoiner_enable_fops_write +}; + /* * Returns the Current CRTC's bpc. * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/i915_current_bpc @@ -1513,6 +1573,12 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector) connector, &i915_dsc_output_format_fops); } + if (DISPLAY_VER(dev_priv) >= 11 && + intel_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { + debugfs_create_file("i915_bigjoiner_force_enable", 0644, root, + &intel_connector->base, &i915_bigjoiner_enable_fops); + } + if (connector->connector_type == DRM_MODE_CONNECTOR_DSI || connector->connector_type == DRM_MODE_CONNECTOR_eDP || connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 8d8b2f8d37a9..e0de6eeaf59e 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1753,6 +1753,8 @@ struct intel_dp { bool is_mst; int active_mst_links; + bool force_bigjoiner_enable; + /* connector directly attached - won't be use for modeset in mst world */ struct intel_connector *attached_connector; diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 0ef7cb8134b6..daf9bc0d6838 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1153,7 +1153,11 @@ bool intel_dp_need_bigjoiner(struct intel_dp *intel_dp, if (!intel_dp_can_bigjoiner(intel_dp)) return false; - return clock > i915->max_dotclk_freq || hdisplay > 5120; + if (intel_dp->force_bigjoiner_enable) + drm_dbg_kms(&i915->drm, "Forcing bigjoiner mode\n"); + + return clock > i915->max_dotclk_freq || hdisplay > 5120 || + intel_dp->force_bigjoiner_enable; } static enum drm_mode_status
For validation purposes, it might be useful to be able to force Bigjoiner mode, even if current dotclock/resolution do not require that. Lets add such to option to debugfs. v2: - Apparently intel_dp_need_bigjoiner can't be used, when debugfs entry is created so lets just check manually the DISPLAY_VER. v3: - Switch to intel_connector from drm_connector(Jani Nikula) - Remove redundant modeset lock(Jani Nikula) - Use kstrtobool_from_user for boolean value(Jani Nikula) Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> --- .../drm/i915/display/intel_display_debugfs.c | 72 ++++++++++++++++++- .../drm/i915/display/intel_display_types.h | 2 + drivers/gpu/drm/i915/display/intel_dp.c | 6 +- 3 files changed, 76 insertions(+), 4 deletions(-)