dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: bbaa <bbaa@bbaa.fun>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [Bug Report] drm/edid: drm_edid_override_connector_update returns a incorrect value
Date: Thu, 07 Dec 2023 11:54:34 +0200	[thread overview]
Message-ID: <87jzpq1go5.fsf@intel.com> (raw)
In-Reply-To: <930E9B4C7D91FDFF+29b34d89-8658-4910-966a-c772f320ea03@bbaa.fun>

On Thu, 07 Dec 2023, bbaa <bbaa@bbaa.fun> wrote:
> Hello everyone,
>
> drm_edid_override_connector_update seem return a incorrect value.
>
> drivers/gpu/drm/drm_edid.c (Linux 6.7-rc4)
>    2294	/**
>    2295	 * drm_edid_override_connector_update - add modes from override/firmware EDID
>    2296	 * @connector: connector we're probing
>    2297	 *
>    2298	 * Add modes from the override/firmware EDID, if available. Only to be used from
>    2299	 * drm_helper_probe_single_connector_modes() as a fallback for when DDC probe
>    2300	 * failed during drm_get_edid() and caused the override/firmware EDID to be
>    2301	 * skipped.
>    2302	 *
>    2303	 * Return: The number of modes added or 0 if we couldn't find any.
>    2304	 */

Thanks for the report. I've sent a patch to hopefully fix this [1].

[1] https://patchwork.freedesktop.org/patch/msgid/20231207093821.2654267-1-jani.nikula@intel.com

However, please read the documentation comment above: "Only to be used
from drm_helper_probe_single_connector_modes() ..."

The function is a fallback for a *very* specific and rare scenario.

> This will break the EDID override behavior on Nvidia graphics cards.
>
> NVIDIA/open-gpu-kernel-modules:
> kernel-open/nvidia-drm/nvidia-drm-connector.c:
>    103  #if defined(NV_DRM_CONNECTOR_HAS_OVERRIDE_EDID)   104      if 
> (connector->override_edid) {   105  #else   106      if 
> (drm_edid_override_connector_update(connector) > 0) {   107  #endif 
>    108          const struct drm_property_blob *edid = 
> connector->edid_blob_ptr;   109 
> drm_edid_override_connector_update(connector)  will return zero here.

That's an out-of-tree driver that doesn't follow the documentation
above. Drivers have no business calling the function.

All of the override/firmware EDID handling should be covered
transparently via the drm_edid_read*() and drm_get_edid() functions, and
the drivers shouldn't have to ever care about overrides, at all. Drivers
shouldn't really use connector->edid_blob_ptr directly either.

Please report and get that fixed downstream.


BR,
Jani.


-- 
Jani Nikula, Intel

  reply	other threads:[~2023-12-07  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 17:28 [Bug Report] drm/edid: drm_edid_override_connector_update returns a incorrect value bbaa
2023-12-07  9:54 ` Jani Nikula [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-06 17:23 bbaa
2023-12-07 10:07 ` Jani Nikula

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=87jzpq1go5.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=bbaa@bbaa.fun \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).