[Intel-gfx] [PATCH v3 08/13] drm/i915/edid: convert DP, HDMI and LVDS to drm_edid

Jani Nikula jani.nikula at intel.com
Thu Jun 23 07:29:18 UTC 2022


On Wed, 22 Jun 2022, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> On Wed, Jun 22, 2022 at 01:59:22PM +0300, Jani Nikula wrote:
>> @@ -948,27 +948,30 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>>  	 * preferred mode is the right one.
>>  	 */
>>  	mutex_lock(&dev->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 {
>> -			kfree(edid);
>> -			edid = ERR_PTR(-EINVAL);
>> +					       intel_gmbus_get_adapter(dev_priv, pin));
>> +		if (edid)
>> +			drm_edid = drm_edid_alloc(edid, (edid->extensions + 1) * EDID_LENGTH);
>
> This one still seems to leak.

Damn, only fixed the DP one. Thanks! New patch in-reply.

BR,
Jani.


>
>> +	} 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_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(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,
>> -- 
>> 2.30.2

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list