diff mbox series

[2/3] drm: Create a drm_connector_helper_funcs hook for Adaptive Sync support

Message ID 20200318063517.3844-2-manasi.d.navare@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/dp: DRM DP helper for reading Ignore MSA from DPCD | expand

Commit Message

Navare, Manasi March 18, 2020, 6:35 a.m. UTC
This patch adds a hook in drm_connector_helper_funcs to get the
support of the driver for adaptive sync functionality.

This can be called in the connector probe helper function after
the connector detect() and get_modes() hooks to also
query the adaptive sync support of the driver.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c       |  4 ++++
 include/drm/drm_modeset_helper_vtables.h | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

Comments

Harry Wentland March 18, 2020, 1:42 p.m. UTC | #1
On 2020-03-18 2:35 a.m., Manasi Navare wrote:
> This patch adds a hook in drm_connector_helper_funcs to get the
> support of the driver for adaptive sync functionality.
> 
> This can be called in the connector probe helper function after
> the connector detect() and get_modes() hooks to also
> query the adaptive sync support of the driver.
> 
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>

Patches 1 and 2 are
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/drm_probe_helper.c       |  4 ++++
>  include/drm/drm_modeset_helper_vtables.h | 16 ++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 576b4b7dcd89..4403817bfb02 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -482,6 +482,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>  
>  	count = (*connector_funcs->get_modes)(connector);
>  
> +	/* Get the Adaptive Sync Support if helper exists */
> +	if (*connector_funcs->get_adaptive_sync_support)
> +		(**connector_funcs->get_adaptive_sync_support)(connector);
> +
>  	/*
>  	 * Fallback for when DDC probe failed in drm_get_edid() and thus skipped
>  	 * override/firmware EDID.
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 7c20b1c8b6a7..0b203fdd25df 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -1079,6 +1079,22 @@ struct drm_connector_helper_funcs {
>  				     struct drm_writeback_job *job);
>  	void (*cleanup_writeback_job)(struct drm_writeback_connector *connector,
>  				      struct drm_writeback_job *job);
> +
> +	/**
> +	 * @get_adaptive_sync_support:
> +	 *
> +	 * This hook is used by the probe helper to get the driver's support
> +	 * for adaptive sync or variable refresh rate.
> +	 * This is called from drm_helper_probe_single_connector_modes()
> +	 * This is called after the @get_modes hook so that the connector modes
> +	 * are already obtained and EDID is parsed to obtain the monitor
> +	 * range descriptor information.
> +	 *
> +	 * This hook is optional and defined only for the drivers and on
> +	 * connectors that advertise adaptive sync support.
> +	 *
> +	 */
> +	void (*get_adaptive_sync_support)(struct drm_connector *connector);
>  };
>  
>  /**
>
Jani Nikula March 19, 2020, 10:07 a.m. UTC | #2
On Tue, 17 Mar 2020, Manasi Navare <manasi.d.navare@intel.com> wrote:
> This patch adds a hook in drm_connector_helper_funcs to get the
> support of the driver for adaptive sync functionality.
>
> This can be called in the connector probe helper function after
> the connector detect() and get_modes() hooks to also
> query the adaptive sync support of the driver.

I can obviously see that from the patch. But this does not explain at
all *why* we need another hook to begin with, and why it neeeds to be
called from ->fill_modes that is set to
drm_helper_probe_single_connector_modes().

> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> ---
>  drivers/gpu/drm/drm_probe_helper.c       |  4 ++++
>  include/drm/drm_modeset_helper_vtables.h | 16 ++++++++++++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 576b4b7dcd89..4403817bfb02 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -482,6 +482,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>  
>  	count = (*connector_funcs->get_modes)(connector);
>  
> +	/* Get the Adaptive Sync Support if helper exists */
> +	if (*connector_funcs->get_adaptive_sync_support)
> +		(**connector_funcs->get_adaptive_sync_support)(connector);
> +

This is in the middle of a sequence figuring out the modes. First
->get_modes, then fallback to other mechanisms. Certainly we don't want
to do something else in the middle.

>  	/*
>  	 * Fallback for when DDC probe failed in drm_get_edid() and thus skipped
>  	 * override/firmware EDID.
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index 7c20b1c8b6a7..0b203fdd25df 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -1079,6 +1079,22 @@ struct drm_connector_helper_funcs {
>  				     struct drm_writeback_job *job);
>  	void (*cleanup_writeback_job)(struct drm_writeback_connector *connector,
>  				      struct drm_writeback_job *job);
> +
> +	/**
> +	 * @get_adaptive_sync_support:
> +	 *
> +	 * This hook is used by the probe helper to get the driver's support
> +	 * for adaptive sync or variable refresh rate.
> +	 * This is called from drm_helper_probe_single_connector_modes()
> +	 * This is called after the @get_modes hook so that the connector modes
> +	 * are already obtained and EDID is parsed to obtain the monitor
> +	 * range descriptor information.
> +	 *
> +	 * This hook is optional and defined only for the drivers and on
> +	 * connectors that advertise adaptive sync support.
> +	 *
> +	 */
> +	void (*get_adaptive_sync_support)(struct drm_connector *connector);
>  };
>  
>  /**
Navare, Manasi March 19, 2020, 10:39 p.m. UTC | #3
On Thu, Mar 19, 2020 at 12:07:37PM +0200, Jani Nikula wrote:
> On Tue, 17 Mar 2020, Manasi Navare <manasi.d.navare@intel.com> wrote:
> > This patch adds a hook in drm_connector_helper_funcs to get the
> > support of the driver for adaptive sync functionality.
> >
> > This can be called in the connector probe helper function after
> > the connector detect() and get_modes() hooks to also
> > query the adaptive sync support of the driver.
> 
> I can obviously see that from the patch. But this does not explain at
> all *why* we need another hook to begin with, and why it neeeds to be
> called from ->fill_modes that is set to
> drm_helper_probe_single_connector_modes().
>

This needs to be called after get_modes that ends up populating the
monitor range after parsing the EDID.

I could have just modified the get_modes hook in the driver to set the
vrr capabilities but that doesnt go with the definition of get_modes() hook
which is purely to obtain modes from edid.

So i added a separate hook which will always return the vrr capabilities if this
hook exists in the driver everytime a connector probe happens.

Would you suggest this elsewhere or some other design?
I am open to better placement of this hook or reusing some other hook or
other suggestions for getting the vrr capabilities in the driver

Manasi
 
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
> > Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c       |  4 ++++
> >  include/drm/drm_modeset_helper_vtables.h | 16 ++++++++++++++++
> >  2 files changed, 20 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 576b4b7dcd89..4403817bfb02 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -482,6 +482,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >  
> >  	count = (*connector_funcs->get_modes)(connector);
> >  
> > +	/* Get the Adaptive Sync Support if helper exists */
> > +	if (*connector_funcs->get_adaptive_sync_support)
> > +		(**connector_funcs->get_adaptive_sync_support)(connector);
> > +
> 
> This is in the middle of a sequence figuring out the modes. First
> ->get_modes, then fallback to other mechanisms. Certainly we don't want
> to do something else in the middle.
> 
> >  	/*
> >  	 * Fallback for when DDC probe failed in drm_get_edid() and thus skipped
> >  	 * override/firmware EDID.
> > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> > index 7c20b1c8b6a7..0b203fdd25df 100644
> > --- a/include/drm/drm_modeset_helper_vtables.h
> > +++ b/include/drm/drm_modeset_helper_vtables.h
> > @@ -1079,6 +1079,22 @@ struct drm_connector_helper_funcs {
> >  				     struct drm_writeback_job *job);
> >  	void (*cleanup_writeback_job)(struct drm_writeback_connector *connector,
> >  				      struct drm_writeback_job *job);
> > +
> > +	/**
> > +	 * @get_adaptive_sync_support:
> > +	 *
> > +	 * This hook is used by the probe helper to get the driver's support
> > +	 * for adaptive sync or variable refresh rate.
> > +	 * This is called from drm_helper_probe_single_connector_modes()
> > +	 * This is called after the @get_modes hook so that the connector modes
> > +	 * are already obtained and EDID is parsed to obtain the monitor
> > +	 * range descriptor information.
> > +	 *
> > +	 * This hook is optional and defined only for the drivers and on
> > +	 * connectors that advertise adaptive sync support.
> > +	 *
> > +	 */
> > +	void (*get_adaptive_sync_support)(struct drm_connector *connector);
> >  };
> >  
> >  /**
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 576b4b7dcd89..4403817bfb02 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -482,6 +482,10 @@  int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
 	count = (*connector_funcs->get_modes)(connector);
 
+	/* Get the Adaptive Sync Support if helper exists */
+	if (*connector_funcs->get_adaptive_sync_support)
+		(**connector_funcs->get_adaptive_sync_support)(connector);
+
 	/*
 	 * Fallback for when DDC probe failed in drm_get_edid() and thus skipped
 	 * override/firmware EDID.
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 7c20b1c8b6a7..0b203fdd25df 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -1079,6 +1079,22 @@  struct drm_connector_helper_funcs {
 				     struct drm_writeback_job *job);
 	void (*cleanup_writeback_job)(struct drm_writeback_connector *connector,
 				      struct drm_writeback_job *job);
+
+	/**
+	 * @get_adaptive_sync_support:
+	 *
+	 * This hook is used by the probe helper to get the driver's support
+	 * for adaptive sync or variable refresh rate.
+	 * This is called from drm_helper_probe_single_connector_modes()
+	 * This is called after the @get_modes hook so that the connector modes
+	 * are already obtained and EDID is parsed to obtain the monitor
+	 * range descriptor information.
+	 *
+	 * This hook is optional and defined only for the drivers and on
+	 * connectors that advertise adaptive sync support.
+	 *
+	 */
+	void (*get_adaptive_sync_support)(struct drm_connector *connector);
 };
 
 /**