Nouveau Archive mirror
 help / color / mirror / Atom feed
From: Robert Foss <rfoss@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	Pan@freedesktop.org, Xinhui <Xinhui.Pan@amd.com>
Subject: Re: [RESEND 3/6] drm/radeon: remove radeon_connector_edid() and stop using edid_blob_ptr
Date: Mon, 13 May 2024 18:59:29 +0200	[thread overview]
Message-ID: <CAN6tsi5Og9E_thegG1-spCrYvQzuzq2tSigQ5huLHkOYE65GEw@mail.gmail.com> (raw)
In-Reply-To: <b2bdec9161ddcbf79c8516aeea508a9903bd0074.1715353572.git.jani.nikula@intel.com>

On Fri, May 10, 2024 at 5:08 PM Jani Nikula <jani.nikula@intel.com> wrote:
>
> radeon_connector_edid() copies the EDID from edid_blob_ptr as a side
> effect if radeon_connector->edid isn't initialized. However, everywhere
> that the returned EDID is used, the EDID should have been set
> beforehands.
>
> Only the drm EDID code should look at the EDID property, anyway, so stop
> using it.
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Pan, Xinhui <Xinhui.Pan@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/radeon/radeon_audio.c      |  7 ++++---
>  drivers/gpu/drm/radeon/radeon_connectors.c | 15 ---------------
>  drivers/gpu/drm/radeon/radeon_mode.h       |  2 --
>  3 files changed, 4 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
> index 16c10db3ce6f..0bcd767b9f47 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -303,6 +303,7 @@ void radeon_audio_endpoint_wreg(struct radeon_device *rdev, u32 offset,
>  static void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
>  {
>         struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
> +       struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>         struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
>         struct cea_sad *sads;
>         int sad_count;
> @@ -310,7 +311,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
>         if (!connector)
>                 return;
>
> -       sad_count = drm_edid_to_sad(radeon_connector_edid(connector), &sads);
> +       sad_count = drm_edid_to_sad(radeon_connector->edid, &sads);
>         if (sad_count < 0)
>                 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>         if (sad_count <= 0)
> @@ -326,6 +327,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
>  static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
>  {
>         struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
> +       struct radeon_connector *radeon_connector = to_radeon_connector(connector);
>         struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
>         u8 *sadb = NULL;
>         int sad_count;
> @@ -333,8 +335,7 @@ static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
>         if (!connector)
>                 return;
>
> -       sad_count = drm_edid_to_speaker_allocation(radeon_connector_edid(connector),
> -                                                  &sadb);
> +       sad_count = drm_edid_to_speaker_allocation(radeon_connector->edid, &sadb);
>         if (sad_count < 0) {
>                 DRM_DEBUG("Couldn't read Speaker Allocation Data Block: %d\n",
>                           sad_count);
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 81b5c3c8f658..80879e946342 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -255,21 +255,6 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector,
>         return NULL;
>  }
>
> -struct edid *radeon_connector_edid(struct drm_connector *connector)
> -{
> -       struct radeon_connector *radeon_connector = to_radeon_connector(connector);
> -       struct drm_property_blob *edid_blob = connector->edid_blob_ptr;
> -
> -       if (radeon_connector->edid) {
> -               return radeon_connector->edid;
> -       } else if (edid_blob) {
> -               struct edid *edid = kmemdup(edid_blob->data, edid_blob->length, GFP_KERNEL);
> -               if (edid)
> -                       radeon_connector->edid = edid;
> -       }
> -       return radeon_connector->edid;
> -}
> -
>  static void radeon_connector_get_edid(struct drm_connector *connector)
>  {
>         struct drm_device *dev = connector->dev;
> diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
> index 546381a5c918..e0a5af180801 100644
> --- a/drivers/gpu/drm/radeon/radeon_mode.h
> +++ b/drivers/gpu/drm/radeon/radeon_mode.h
> @@ -701,8 +701,6 @@ extern u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connecto
>  extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector);
>  extern int radeon_get_monitor_bpc(struct drm_connector *connector);
>
> -extern struct edid *radeon_connector_edid(struct drm_connector *connector);
> -
>  extern void radeon_connector_hotplug(struct drm_connector *connector);
>  extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
>                                        struct drm_display_mode *mode);
> --
> 2.39.2
>

Reviewed-by: Robert Foss <rfoss@kernel.org>

  reply	other threads:[~2024-05-13 16:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 15:08 [RESEND 0/6] drm, nouveau/radeon/amdpgu: edid_blob_ptr cleanups Jani Nikula
2024-05-10 15:08 ` [RESEND 1/6] drm/nouveau: convert to using is_hdmi and has_audio from display info Jani Nikula
2024-05-10 19:24   ` Lyude Paul
2024-05-13 12:18     ` Jani Nikula
2024-05-10 15:08 ` [RESEND 2/6] drm/radeon: " Jani Nikula
2024-05-13 16:56   ` Robert Foss
2024-05-10 15:08 ` [RESEND 3/6] drm/radeon: remove radeon_connector_edid() and stop using edid_blob_ptr Jani Nikula
2024-05-13 16:59   ` Robert Foss [this message]
2024-05-10 15:08 ` [RESEND 4/6] drm/amdgpu: remove amdgpu_connector_edid() " Jani Nikula
2024-05-13 17:01   ` Robert Foss
2024-05-10 15:08 ` [RESEND 5/6] drm/edid: add a helper for EDID sysfs property show Jani Nikula
2024-05-10 15:08 ` [RESEND 6/6] drm/connector: update edid_blob_ptr documentation Jani Nikula
2024-05-10 15:45 ` [RESEND 0/6] drm, nouveau/radeon/amdpgu: edid_blob_ptr cleanups Alex Deucher
2024-05-13 12:19   ` Jani Nikula
2024-05-13 13:53     ` Alex Deucher
2024-05-23 13:00       ` 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=CAN6tsi5Og9E_thegG1-spCrYvQzuzq2tSigQ5huLHkOYE65GEw@mail.gmail.com \
    --to=rfoss@kernel.org \
    --cc=Pan@freedesktop.org \
    --cc=Xinhui.Pan@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=nouveau@lists.freedesktop.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).