lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 24 May 2024 12:43:18 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Jayesh Choudhary <j-choudhary@...com>
Cc: linux-kernel@...r.kernel.org, andrzej.hajda@...el.com, 
	neil.armstrong@...aro.org, rfoss@...nel.org, Laurent.pinchart@...asonboard.com, 
	mripard@...nel.org, dri-devel@...ts.freedesktop.org, jonas@...boo.se, 
	jernej.skrabec@...il.com, maarten.lankhorst@...ux.intel.com, tzimmermann@...e.de, 
	airlied@...il.com, daniel@...ll.ch, u.kleine-koenig@...gutronix.de, 
	a-bhatia1@...com, javierm@...hat.com, nikhil.nd@...com, jani.nikula@...el.com, 
	amishin@...rgos.ru
Subject: Re: [PATCH] drm: bridge: cdns-mhdp8546: Add mode_valid hook for the
 drm_bridge_funcs

On Fri, May 24, 2024 at 12:43:48PM +0530, Jayesh Choudhary wrote:
> With the support for the 'DRM_BRIDGE_ATTACH_NO_CONNECTOR' case,
> the connector_helper funcs are not initialized if the encoder has this
> flag in its bridge_attach call. Till now we had mode_valid hook only in
> the drm_connector_helper_funcs. Add this hook in drm_bridge_funcs to
> validate the modes in this case as well.
> 
> Signed-off-by: Jayesh Choudhary <j-choudhary@...com>
> ---
>  .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 31 +++++++++++++++----
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> index 8a91ef0ae065..0aee038f5db7 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> @@ -1617,12 +1617,10 @@ bool cdns_mhdp_bandwidth_ok(struct cdns_mhdp_device *mhdp,
>  	return true;
>  }
>  
> -static
> -enum drm_mode_status cdns_mhdp_mode_valid(struct drm_connector *conn,
> -					  struct drm_display_mode *mode)
> +static enum
> +drm_mode_status cdns_mhdp_mode_valid(struct cdns_mhdp_device *mhdp,
> +				     const struct drm_display_mode *mode)
>  {
> -	struct cdns_mhdp_device *mhdp = connector_to_mhdp(conn);
> -
>  	mutex_lock(&mhdp->link_mutex);
>  
>  	if (!cdns_mhdp_bandwidth_ok(mhdp, mode, mhdp->link.num_lanes,
> @@ -1635,6 +1633,16 @@ enum drm_mode_status cdns_mhdp_mode_valid(struct drm_connector *conn,
>  	return MODE_OK;
>  }
>  
> +static enum drm_mode_status
> +cdns_mhdp_connector_mode_valid(struct drm_connector *conn,
> +			       struct drm_display_mode *mode)
> +{
> +	struct cdns_mhdp_device *mhdp = connector_to_mhdp(conn);
> +	const struct drm_display_mode *mod = mode;
> +
> +	return cdns_mhdp_mode_valid(mhdp, mod);
> +}
> +
>  static int cdns_mhdp_connector_atomic_check(struct drm_connector *conn,
>  					    struct drm_atomic_state *state)
>  {
> @@ -1678,7 +1686,7 @@ static int cdns_mhdp_connector_atomic_check(struct drm_connector *conn,
>  static const struct drm_connector_helper_funcs cdns_mhdp_conn_helper_funcs = {
>  	.detect_ctx = cdns_mhdp_connector_detect,
>  	.get_modes = cdns_mhdp_get_modes,
> -	.mode_valid = cdns_mhdp_mode_valid,
> +	.mode_valid = cdns_mhdp_connector_mode_valid,

Just move it to bridge_funcs and drop it from connector_helper_funcs. It
should be enough.

>  	.atomic_check = cdns_mhdp_connector_atomic_check,
>  };
>  
> @@ -2233,6 +2241,16 @@ static const struct drm_edid *cdns_mhdp_bridge_edid_read(struct drm_bridge *brid
>  	return cdns_mhdp_edid_read(mhdp, connector);
>  }
>  
> +static enum drm_mode_status
> +cdns_mhdp_bridge_mode_valid(struct drm_bridge *bridge,
> +			    const struct drm_display_info *info,
> +			    const struct drm_display_mode *mode)
> +{
> +	struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
> +
> +	return cdns_mhdp_mode_valid(mhdp, mode);
> +}
> +
>  static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
>  	.atomic_enable = cdns_mhdp_atomic_enable,
>  	.atomic_disable = cdns_mhdp_atomic_disable,
> @@ -2247,6 +2265,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
>  	.edid_read = cdns_mhdp_bridge_edid_read,
>  	.hpd_enable = cdns_mhdp_bridge_hpd_enable,
>  	.hpd_disable = cdns_mhdp_bridge_hpd_disable,
> +	.mode_valid = cdns_mhdp_bridge_mode_valid,
>  };
>  
>  static bool cdns_mhdp_detect_hpd(struct cdns_mhdp_device *mhdp, bool *hpd_pulse)
> -- 
> 2.25.1
> 

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ