public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm: handle override edid and firmware EDID at drm_do_get_edid() level
Date: Thu, 16 Feb 2017 19:54:00 +0200	[thread overview]
Message-ID: <87tw7udnt3.fsf@intel.com> (raw)
In-Reply-To: <20170216154132.GF31595@intel.com>

On Thu, 16 Feb 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Feb 16, 2017 at 12:36:45PM +0200, Jani Nikula wrote:
>> Handle debugfs override edid and firmware edid at the low level to
>> transparently and completely replace the real edid. Previously, we
>> practically only used the modes from the override EDID, and none of the
>> other data. This also prevents actual EDID reads when the EDID is to be
>> overridden, but retains the DDC probe.
>
> Hmm. Isn't that a bad thing? If someone has broken DDC on their cable or
> somethign then the override EDID wouldn't be returned by drm_get_edid().

Isn't this in line with how this currently works?

BR,
Jani.


>
>> 
>> FIXME: validate override edid, deduplicate firmware edid validation.
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c         | 15 +++++++++++++++
>>  drivers/gpu/drm/drm_probe_helper.c | 19 +------------------
>>  2 files changed, 16 insertions(+), 18 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 362036360724..054e2d74eafc 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -1309,6 +1309,10 @@ static void connector_bad_edid(struct drm_connector *connector,
>>   * level, drivers must make all reasonable efforts to expose it as an I2C
>>   * adapter and use drm_get_edid() instead of abusing this function.
>>   *
>> + * The EDID may be overridden using debugfs override_edid or firmare EDID
>> + * (drm_load_edid_firmware()), in this priority order. Having either of them
>> + * bypasses actual EDID reads.
>> + *
>>   * Return: Pointer to valid EDID or NULL if we couldn't find any.
>>   */
>>  struct edid *drm_do_get_edid(struct drm_connector *connector,
>> @@ -1318,6 +1322,17 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
>>  {
>>  	int i, j = 0, valid_extensions = 0;
>>  	u8 *edid, *new;
>> +	struct edid *override = NULL;
>> +
>> +	if (connector->override_edid)
>> +		override = drm_edid_duplicate((const struct edid *)
>> +					      connector->edid_blob_ptr->data);
>> +
>> +	if (!override)
>> +		override = drm_load_edid_firmware(connector);
>> +
>> +	if (!IS_ERR_OR_NULL(override))
>> +		return override;
>>  
>>  	if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
>>  		return NULL;
>> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
>> index 358957118ca9..871326cbc465 100644
>> --- a/drivers/gpu/drm/drm_probe_helper.c
>> +++ b/drivers/gpu/drm/drm_probe_helper.c
>> @@ -199,8 +199,6 @@ drm_connector_detect(struct drm_connector *connector, bool force)
>>   *    drm_mode_probed_add(). New modes start their life with status as OK.
>>   *    Modes are added from a single source using the following priority order.
>>   *
>> - *    - debugfs 'override_edid' (used for testing only)
>> - *    - firmware EDID (drm_load_edid_firmware())
>>   *    - &drm_connector_helper_funcs.get_modes vfunc
>>   *    - if the connector status is connector_status_connected, standard
>>   *      VESA DMT modes up to 1024x768 are automatically added
>> @@ -305,22 +303,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>  		goto prune;
>>  	}
>>  
>> -	if (connector->override_edid) {
>> -		struct edid *edid = (struct edid *) connector->edid_blob_ptr->data;
>> -
>> -		count = drm_add_edid_modes(connector, edid);
>> -		drm_edid_to_eld(connector, edid);
>> -	} else {
>> -		struct edid *edid = drm_load_edid_firmware(connector);
>> -		if (!IS_ERR_OR_NULL(edid)) {
>> -			drm_mode_connector_update_edid_property(connector, edid);
>> -			count = drm_add_edid_modes(connector, edid);
>> -			drm_edid_to_eld(connector, edid);
>> -			kfree(edid);
>> -		}
>> -		if (count == 0)
>> -			count = (*connector_funcs->get_modes)(connector);
>> -	}
>> +	count = (*connector_funcs->get_modes)(connector);
>>  
>>  	if (count == 0 && connector->status == connector_status_connected)
>>  		count = drm_add_modes_noedid(connector, 1024, 768);
>> -- 
>> 2.1.4

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-02-16 17:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 10:36 [PATCH 0/3] drm: handle override/firmware edid at the lowest level Jani Nikula
2017-02-16 10:36 ` [PATCH 1/3] drm: move edid property update and add modes out of edid firmware loader Jani Nikula
2017-02-16 10:36 ` [PATCH 2/3] drm: reset ELD if NULL edid is passed to drm_edid_to_eld Jani Nikula
2017-02-16 15:36   ` Ville Syrjälä
2017-02-17 14:02     ` Jani Nikula
2017-02-17 14:06       ` Ville Syrjälä
     [not found] ` <cover.1487240619.git.jani.nikula@intel.com>
2017-02-16 10:36   ` [PATCH 3/3] drm: handle override edid and firmware adid at drm_do_get_edid() Jani Nikula
2017-02-16 10:40     ` Jani Nikula
2017-02-16 10:36 ` [PATCH 3/3] drm: handle override edid and firmware EDID at drm_do_get_edid() level Jani Nikula
2017-02-16 15:41   ` Ville Syrjälä
2017-02-16 17:54     ` Jani Nikula [this message]
2017-02-16 18:18       ` Ville Syrjälä
2017-02-16 18:59         ` Jani Nikula
2017-02-16 19:14           ` Ville Syrjälä
2017-02-26 20:50             ` Daniel Vetter
2017-02-16 15:00 ` ✗ Fi.CI.BAT: failure for drm: handle override/firmware edid at the lowest level Patchwork

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=87tw7udnt3.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=abdiel.janulgue@linux.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