From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: "Shankar, Uma" <uma.shankar@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
"jani.nikula@linux.intel.com" <jani.nikula@linux.intel.com>
Subject: Re: [PATCH] drm/i915: Add bigjoiner force enable option to debugfs
Date: Wed, 14 Feb 2024 11:56:10 +0200 [thread overview]
Message-ID: <ZcyOOj1twhuoKTPj@intel.com> (raw)
In-Reply-To: <ZcuL5K-NtXXHkuUq@intel.com>
On Tue, Feb 13, 2024 at 10:33:56AM -0500, Rodrigo Vivi wrote:
> On Tue, Feb 13, 2024 at 05:21:26PM +0200, Lisovskiy, Stanislav wrote:
> > On Tue, Feb 13, 2024 at 05:11:37PM +0200, Shankar, Uma wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > Sent: Tuesday, February 13, 2024 8:26 PM
> > > > To: Shankar, Uma <uma.shankar@intel.com>
> > > > Cc: intel-gfx@lists.freedesktop.org; Lisovskiy, Stanislav
> > > > <stanislav.lisovskiy@intel.com>; ville.syrjala@linux.intel.com;
> > > > jani.nikula@linux.intel.com
> > > > Subject: Re: [PATCH] drm/i915: Add bigjoiner force enable option to debugfs
> > > >
> > > > On Mon, Feb 12, 2024 at 06:20:11PM +0530, Uma Shankar wrote:
> > > > > From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > > >
> > > > > 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)
> > > > >
> > > > > v4: - Apply the changes to proper function(Jani Nikula)
> > > > >
> > > > > v5: - Removed unnecessary check from i915_bigjoiner_enable_show
> > > > > (Ville Syrjälä)
> > > > > - Added eDP connector check to intel_connector_debugfs_add
> > > > > (Ville Syrjälä)
> > > > > - Removed debug message in order to prevent dmesg flooding
> > > > > (Ville Syrjälä)
> > > > >
> > > > > v6: - Assume now always that m->private is intel_connector
> > > > > - Fixed other similar conflicts
> > > > >
> > > > > v7: - Move bigjoiner force option to intel_connector(Ville Syrjälä)
> > > > > - Use DEFINE_SHOW_STORE_ATTRIBUTE instead of defining fops
> > > > > manually.(Ville Syrjälä)
> > > > >
> > > > > v8: - Pass intel_connector to debugfs_create_file, instead of drm_connector.
> > > > > (Jani Nikula)
> > > > >
> > > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> > > >
> > > > please remind to sign-off when sending someone else's patch.
> > >
> > > Oh yeah, sorry missed it. Was filling in for Stan while he was OOO.
> > > @Lisovskiy, Stanislav Please address rest of the comments raised by Rodrigo.
> >
> > Sorry, had that pushed already in the morning, since it was Acked and I was asked
> > to do it asap.
>
> no worries. if you are confident that the _show function magically works I trust
> your tests more then my eyes and greps.
Well _definitely_ it should not be about trust, confidence or beliefs :)
See:
#define DEFINE_SHOW_STORE_ATTRIBUTE(__name) \
static int __name ## _open(struct inode *inode, struct file *file) \
{ \
return single_open(file, __name ## _show, inode->i_private); \
} \
\
static const struct file_operations __name ## _fops = { \
.owner = THIS_MODULE, \
.open = __name ## _open, \
.read = seq_read, \
.write = __name ## _write, \
.llseek = seq_lseek, \
.release = single_release, \
}
In the patch:
+DEFINE_SHOW_STORE_ATTRIBUTE(i915_bigjoiner_enable);
+
means it will use i915_bigjoiner_enable_show function.
which is defined just as it expects in the patch:
+static int i915_bigjoiner_enable_show(struct seq_file *m, void *data)
+{
+ struct intel_connector *connector = m->private;
+ struct drm_crtc *crtc;
+
+ crtc = connector->base.state->crtc;
+ if (connector->base.status != connector_status_connected || !crtc)
+ return -ENODEV;
+
+ seq_printf(m, "Bigjoiner enable: %d\n", connector->force_bigjoiner_enable);
+
+ return 0;
+}
+
So I don't see any reason here, why it shouldn't work.
If you do, please tell - we need to fix this then.
Stan
>
> >
> > Stan
> >
> > >
> > > Regards,
> > > Uma Shankar
> > >
> > > > > ---
> > > > > .../drm/i915/display/intel_display_debugfs.c | 47 +++++++++++++++++++
> > > > > .../drm/i915/display/intel_display_types.h | 2 +
> > > > > drivers/gpu/drm/i915/display/intel_dp.c | 4 +-
> > > > > 3 files changed, 52 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > > > b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > > > index 6f2d13c8ccf7..a962b48bcf13 100644
> > > > > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > > > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > > > @@ -1391,6 +1391,20 @@ out: drm_modeset_unlock(&i915-
> > > > >drm.mode_config.connection_mutex);
> > > > > return ret;
> > > > > }
> > > > >
> > > > > +static int i915_bigjoiner_enable_show(struct seq_file *m, void *data)
> > > > > +{
> > > > > + struct intel_connector *connector = m->private;
> > > > > + struct drm_crtc *crtc;
> > > > > +
> > > > > + crtc = connector->base.state->crtc;
> > > > > + if (connector->base.status != connector_status_connected || !crtc)
> > > > > + return -ENODEV;
> > > > > +
> > > > > + seq_printf(m, "Bigjoiner enable: %d\n",
> > > > > +connector->force_bigjoiner_enable);
> > > >
> > > > probably better with a yes_or_no string?
> > > >
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > static ssize_t i915_dsc_output_format_write(struct file *file,
> > > > > const char __user *ubuf,
> > > > > size_t len, loff_t *offp)
> > > > > @@ -1412,6 +1426,30 @@ static ssize_t i915_dsc_output_format_write(struct
> > > > file *file,
> > > > > return len;
> > > > > }
> > > > >
> > > > > +static ssize_t i915_bigjoiner_enable_write(struct file *file,
> > > > > + const char __user *ubuf,
> > > > > + size_t len, loff_t *offp)
> > > > > +{
> > > > > + struct seq_file *m = file->private_data;
> > > > > + struct intel_connector *connector = m->private;
> > > > > + struct drm_crtc *crtc;
> > > > > + bool bigjoiner_en = 0;
> > > > > + int ret;
> > > > > +
> > > > > + crtc = connector->base.state->crtc;
> > > > > + if (connector->base.status != connector_status_connected || !crtc)
> > > > > + return -ENODEV;
> > > > > +
> > > > > + ret = kstrtobool_from_user(ubuf, len, &bigjoiner_en);
> > > > > + if (ret < 0)
> > > > > + return ret;
> > > > > +
> > > > > + connector->force_bigjoiner_enable = bigjoiner_en;
> > > > > + *offp += len;
> > > > > +
> > > > > + return len;
> > > > > +}
> > > > > +
> > > > > static int i915_dsc_output_format_open(struct inode *inode,
> > > > > struct file *file)
> > > > > {
> > > > > @@ -1505,6 +1543,8 @@ static const struct file_operations
> > > > i915_dsc_fractional_bpp_fops = {
> > > > > .write = i915_dsc_fractional_bpp_write };
> > > > >
> > > > > +DEFINE_SHOW_STORE_ATTRIBUTE(i915_bigjoiner_enable);
> > > >
> > > > I don't believe this macro here is using the defined _show function, but maybe I'm
> > > > not following that very well since this macro is not widely used.
> > > >
> > > > What about using DEFINE_SIMPLE_ATTRIBUTE instead?
> > > >
> > > > > +
> > > > > /*
> > > > > * Returns the Current CRTC's bpc.
> > > > > * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/i915_current_bpc
> > > > > @@ -1586,6 +1626,13 @@ void intel_connector_debugfs_add(struct
> > > > intel_connector *connector)
> > > > > connector, &i915_dsc_fractional_bpp_fops);
> > > > > }
> > > > >
> > > > > + if (DISPLAY_VER(i915) >= 11 &&
> > > > > + (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
> > > > > + connector_type == DRM_MODE_CONNECTOR_eDP)) {
> > > >
> > > > I wish we had a simpler check, but I couldn't find. :/
> > > >
> > > > > + debugfs_create_file("i915_bigjoiner_force_enable", 0644, root,
> > > > > + connector, &i915_bigjoiner_enable_fops);
> > > > > + }
> > > > > +
> > > > > if (connector_type == DRM_MODE_CONNECTOR_DSI ||
> > > > > connector_type == DRM_MODE_CONNECTOR_eDP ||
> > > > > 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 01eb6e4e6049..0d4012097db1 100644
> > > > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > > > @@ -626,6 +626,8 @@ struct intel_connector {
> > > > >
> > > > > struct intel_dp *mst_port;
> > > > >
> > > > > + bool force_bigjoiner_enable;
> > > > > +
> > > > > struct {
> > > > > struct drm_dp_aux *dsc_decompression_aux;
> > > > > u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
> > > > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> > > > > b/drivers/gpu/drm/i915/display/intel_dp.c
> > > > > index 5045c34a16be..217196196e50 100644
> > > > > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > > > > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > > > > @@ -1205,11 +1205,13 @@ bool intel_dp_need_bigjoiner(struct intel_dp
> > > > *intel_dp,
> > > > > int hdisplay, int clock)
> > > > > {
> > > > > struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> > > > > + struct intel_connector *connector = intel_dp->attached_connector;
> > > > >
> > > > > if (!intel_dp_can_bigjoiner(intel_dp))
> > > > > return false;
> > > > >
> > > > > - return clock > i915->max_dotclk_freq || hdisplay > 5120;
> > > > > + return clock > i915->max_dotclk_freq || hdisplay > 5120 ||
> > > > > + connector->force_bigjoiner_enable;
> > > >
> > > > I'm just not comfortable with the magic _show of that macro and would prefer a
> > > > more simple and straight forward and widely used version.
> > > >
> > > > Other then that everything else looks good to me.
> > > >
> > > > Thanks,
> > > > Rodrigo.
> > > >
> > > > > }
> > > > >
> > > > > static enum drm_mode_status
> > > > > --
> > > > > 2.42.0
> > > > >
next prev parent reply other threads:[~2024-02-14 9:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 12:50 [PATCH] drm/i915: Add bigjoiner force enable option to debugfs Uma Shankar
2024-02-12 16:34 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add bigjoiner force enable option to debugfs (rev7) Patchwork
2024-02-12 16:47 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-12 20:36 ` ✓ Fi.CI.IGT: " Patchwork
2024-02-13 9:21 ` [PATCH] drm/i915: Add bigjoiner force enable option to debugfs Jani Nikula
2024-02-13 14:56 ` Rodrigo Vivi
2024-02-13 15:11 ` Shankar, Uma
2024-02-13 15:21 ` Lisovskiy, Stanislav
2024-02-13 15:33 ` Rodrigo Vivi
2024-02-14 9:56 ` Lisovskiy, Stanislav [this message]
2024-02-14 13:51 ` Rodrigo Vivi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZcyOOj1twhuoKTPj@intel.com \
--to=stanislav.lisovskiy@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=uma.shankar@intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox