dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 5/8] drm/i915/edid: convert DP, HDMI and LVDS to drm_edid
Date: Mon, 23 Jan 2023 12:15:04 +0200	[thread overview]
Message-ID: <87o7qp8slz.fsf@intel.com> (raw)
In-Reply-To: <Y8riBdt+O6zDVlFz@intel.com>

On Fri, 20 Jan 2023, Ville Syrjälä <ville.syrjala@linux.intel.com> 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

  reply	other threads:[~2023-01-23 10:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 16:18 [PATCH v8 0/8] drm/edid: info & modes parsing and drm_edid refactors Jani Nikula
2023-01-19 16:18 ` [PATCH v8 1/8] drm/edid: split HDMI VSDB info and mode parsing Jani Nikula
2023-01-19 16:18 ` [PATCH v8 2/8] drm/edid: refactor _drm_edid_connector_update() and rename Jani Nikula
2023-01-19 16:18 ` [PATCH v8 3/8] drm/edid: add separate drm_edid_connector_add_modes() Jani Nikula
2023-01-19 16:18 ` [PATCH v8 4/8] drm/edid: remove redundant _drm_connector_update_edid_property() Jani Nikula
2023-01-23  9:59   ` Jani Nikula
2023-01-19 16:18 ` [PATCH v8 5/8] drm/i915/edid: convert DP, HDMI and LVDS to drm_edid Jani Nikula
2023-01-20 18:48   ` Ville Syrjälä
2023-01-23 10:15     ` Jani Nikula [this message]
2023-01-23 18:22       ` Ville Syrjälä
2023-01-19 16:18 ` [PATCH v8 6/8] drm/i915/bios: convert intel_bios_init_panel() " Jani Nikula
2023-01-20 18:48   ` Ville Syrjälä
2023-01-19 16:19 ` [PATCH v8 7/8] drm/i915/opregion: convert intel_opregion_get_edid() to struct drm_edid Jani Nikula
2023-01-20 18:49   ` Ville Syrjälä
2023-01-19 16:19 ` [PATCH v8 8/8] drm/i915/panel: move panel fixed EDID to struct intel_panel Jani Nikula
2023-01-20 18:49   ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7qp8slz.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox