Re: [PATCH v8 5/8] drm/i915/edid: convert DP, HDMI and LVDS to drm_edid

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

 



On Fri, 20 Jan 2023, Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> On Thu, Jan 19, 2023 at 06:18:58PM +0200, Jani Nikula wrote:
>> diff --git a/drivers/gpu/drm/i915/display/intel_lvds.c b/drivers/gpu/drm/i915/display/intel_lvds.c
>> index aecec992cd0d..6a98787edf48 100644
>> --- a/drivers/gpu/drm/i915/display/intel_lvds.c
>> +++ b/drivers/gpu/drm/i915/display/intel_lvds.c
>> @@ -479,8 +479,11 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
>>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>>  
>>  	/* use cached edid if we have one */
>> -	if (!IS_ERR_OR_NULL(intel_connector->edid))
>> -		return drm_add_edid_modes(connector, intel_connector->edid);
>> +	if (!IS_ERR_OR_NULL(intel_connector->edid)) {
>> +		drm_edid_connector_update(connector, intel_connector->edid);
>
> Isn't this update redundant?

Maybe far fetched, but if the user does connector force disable via
debugfs, drm_helper_probe_single_connector_modes() will clear the EDID
property and display info. And after that, nobody's going to do the
connector update again unless we do it here.

BR,
Jani.



>
>> +
>> +		return drm_edid_connector_add_modes(connector);
>> +	}
>>  
>>  	return intel_panel_get_modes(intel_connector);
>>  }
>> @@ -834,7 +837,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>>  	struct intel_connector *intel_connector;
>>  	struct drm_connector *connector;
>>  	struct drm_encoder *encoder;
>> -	struct edid *edid;
>> +	const struct drm_edid *drm_edid;
>>  	i915_reg_t lvds_reg;
>>  	u32 lvds;
>>  	u8 pin;
>> @@ -945,27 +948,36 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>>  	 * preferred mode is the right one.
>>  	 */
>>  	mutex_lock(&dev_priv->drm.mode_config.mutex);
>> -	if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC)
>> +	if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC) {
>> +		const struct edid *edid;
>> +
>> +		/* FIXME: Make drm_get_edid_switcheroo() return drm_edid */
>>  		edid = drm_get_edid_switcheroo(connector,
>> -				    intel_gmbus_get_adapter(dev_priv, pin));
>> -	else
>> -		edid = drm_get_edid(connector,
>> -				    intel_gmbus_get_adapter(dev_priv, pin));
>> -	if (edid) {
>> -		if (drm_add_edid_modes(connector, edid)) {
>> -			drm_connector_update_edid_property(connector,
>> -								edid);
>> -		} else {
>> +					       intel_gmbus_get_adapter(dev_priv, pin));
>> +		if (edid) {
>> +			drm_edid = drm_edid_alloc(edid, (edid->extensions + 1) * EDID_LENGTH);
>>  			kfree(edid);
>> -			edid = ERR_PTR(-EINVAL);
>> +		} else {
>> +			drm_edid = NULL;
>> +		}
>> +	} else {
>> +		drm_edid = drm_edid_read_ddc(connector,
>> +					     intel_gmbus_get_adapter(dev_priv, pin));
>> +	}
>> +	if (drm_edid) {
>> +		if (drm_edid_connector_update(connector, drm_edid) ||
>> +		    !drm_edid_connector_add_modes(connector)) {
>> +			drm_edid_connector_update(connector, NULL);
>> +			drm_edid_free(drm_edid);
>> +			drm_edid = ERR_PTR(-EINVAL);
>>  		}
>>  	} else {
>> -		edid = ERR_PTR(-ENOENT);
>> +		drm_edid = ERR_PTR(-ENOENT);
>>  	}
>> -	intel_connector->edid = edid;
>> +	intel_connector->edid = drm_edid;
>>  
>>  	intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL,
>> -				   IS_ERR(edid) ? NULL : edid);
>> +				   IS_ERR_OR_NULL(drm_edid) ? NULL : drm_edid_raw(drm_edid));
>>  
>>  	/* Try EDID first */
>>  	intel_panel_add_edid_fixed_modes(intel_connector, true);
>> -- 
>> 2.34.1

-- 
Jani Nikula, Intel Open Source Graphics Center




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux