Re: [PATCH v7 12/22] drm/edid: store quirks in display info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 04, 2023 at 12:05:27PM +0200, Jani Nikula wrote:
> Although the quirks are internal to EDID parsing, it'll be helpful to
> store them in display info to avoid having to pass them around.
> 
> This will also help separate adding probed modes (which needs the
> quirks) from updating display info.
> 
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/drm_edid.c  | 42 ++++++++++++++++++-------------------
>  include/drm/drm_connector.h |  5 +++++
>  2 files changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 5cb1d36ce48a..fd8d056e38c1 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -6461,18 +6461,20 @@ static void drm_reset_display_info(struct drm_connector *connector)
>  	kfree(info->vics);
>  	info->vics = NULL;
>  	info->vics_len = 0;
> +
> +	info->quirks = 0;
>  }
>  
> -static u32 update_display_info(struct drm_connector *connector,
> -			       const struct drm_edid *drm_edid)
> +static void update_display_info(struct drm_connector *connector,
> +				const struct drm_edid *drm_edid)
>  {
>  	struct drm_display_info *info = &connector->display_info;
>  	const struct edid *edid = drm_edid->edid;
>  
> -	u32 quirks = edid_get_quirks(drm_edid);
> -
>  	drm_reset_display_info(connector);
>  
> +	info->quirks = edid_get_quirks(drm_edid);
> +
>  	info->width_mm = edid->width_cm * 10;
>  	info->height_mm = edid->height_cm * 10;
>  
> @@ -6543,17 +6545,15 @@ static u32 update_display_info(struct drm_connector *connector,
>  	drm_update_mso(connector, drm_edid);
>  
>  out:
> -	if (quirks & EDID_QUIRK_NON_DESKTOP) {
> +	if (info->quirks & EDID_QUIRK_NON_DESKTOP) {
>  		drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] Non-desktop display%s\n",
>  			    connector->base.id, connector->name,
>  			    info->non_desktop ? " (redundant quirk)" : "");
>  		info->non_desktop = true;
>  	}
>  
> -	if (quirks & EDID_QUIRK_CAP_DSC_15BPP)
> +	if (info->quirks & EDID_QUIRK_CAP_DSC_15BPP)
>  		info->max_dsc_bpp = 15;
> -
> -	return quirks;
>  }
>  
>  static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev,
> @@ -6651,8 +6651,8 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
>  static int _drm_edid_connector_update(struct drm_connector *connector,
>  				      const struct drm_edid *drm_edid)
>  {
> +	struct drm_display_info *info = &connector->display_info;
>  	int num_modes = 0;
> -	u32 quirks;
>  
>  	if (!drm_edid) {
>  		drm_reset_display_info(connector);
> @@ -6665,7 +6665,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
>  	 * To avoid multiple parsing of same block, lets parse that map
>  	 * from sink info, before parsing CEA modes.
>  	 */
> -	quirks = update_display_info(connector, drm_edid);
> +	update_display_info(connector, drm_edid);
>  
>  	/* Depends on info->cea_rev set by update_display_info() above */
>  	drm_edid_to_eld(connector, drm_edid);
> @@ -6684,7 +6684,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
>  	 *
>  	 * XXX order for additional mode types in extension blocks?
>  	 */
> -	num_modes += add_detailed_modes(connector, drm_edid, quirks);
> +	num_modes += add_detailed_modes(connector, drm_edid, info->quirks);
>  	num_modes += add_cvt_modes(connector, drm_edid);
>  	num_modes += add_standard_modes(connector, drm_edid);
>  	num_modes += add_established_modes(connector, drm_edid);
> @@ -6694,20 +6694,20 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
>  	if (drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)
>  		num_modes += add_inferred_modes(connector, drm_edid);
>  
> -	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
> -		edid_fixup_preferred(connector, quirks);
> +	if (info->quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
> +		edid_fixup_preferred(connector, info->quirks);
>  
> -	if (quirks & EDID_QUIRK_FORCE_6BPC)
> -		connector->display_info.bpc = 6;
> +	if (info->quirks & EDID_QUIRK_FORCE_6BPC)
> +		info->bpc = 6;
>  
> -	if (quirks & EDID_QUIRK_FORCE_8BPC)
> -		connector->display_info.bpc = 8;
> +	if (info->quirks & EDID_QUIRK_FORCE_8BPC)
> +		info->bpc = 8;
>  
> -	if (quirks & EDID_QUIRK_FORCE_10BPC)
> -		connector->display_info.bpc = 10;
> +	if (info->quirks & EDID_QUIRK_FORCE_10BPC)
> +		info->bpc = 10;
>  
> -	if (quirks & EDID_QUIRK_FORCE_12BPC)
> -		connector->display_info.bpc = 12;
> +	if (info->quirks & EDID_QUIRK_FORCE_12BPC)
> +		info->bpc = 12;
>  
>  	return num_modes;
>  }
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 1c26c4e72c62..7b5048516185 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -728,6 +728,11 @@ struct drm_display_info {
>  	 * @vics_len: Number of elements in vics. Internal to EDID parsing.
>  	 */
>  	int vics_len;
> +
> +	/**
> +	 * @quirks: EDID based quirks. Internal to EDID parsing.
> +	 */
> +	u32 quirks;
>  };
>  
>  int drm_display_info_set_bus_formats(struct drm_display_info *info,
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux