Re: [RESEND 4/6] drm/amdgpu: remove amdgpu_connector_edid() and stop using edid_blob_ptr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 10, 2024 at 5:09 PM Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
>
> amdgpu_connector_edid() copies the EDID from edid_blob_ptr as a side
> effect if amdgpu_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@xxxxxxx>
> Cc: Christian König <christian.koenig@xxxxxxx>
> Cc: Pan, Xinhui <Xinhui.Pan@xxxxxxx>
> Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 ----------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h |  1 -
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c         |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c         |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c          |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c          |  4 ++--
>  6 files changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index 9caba10315a8..cae7479c3ecf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -246,22 +246,6 @@ amdgpu_connector_find_encoder(struct drm_connector *connector,
>         return NULL;
>  }
>
> -struct edid *amdgpu_connector_edid(struct drm_connector *connector)
> -{
> -       struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
> -       struct drm_property_blob *edid_blob = connector->edid_blob_ptr;
> -
> -       if (amdgpu_connector->edid) {
> -               return amdgpu_connector->edid;
> -       } else if (edid_blob) {
> -               struct edid *edid = kmemdup(edid_blob->data, edid_blob->length, GFP_KERNEL);
> -
> -               if (edid)
> -                       amdgpu_connector->edid = edid;
> -       }
> -       return amdgpu_connector->edid;
> -}
> -
>  static struct edid *
>  amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev)
>  {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h
> index 61fcef15ad72..eff833b6ed31 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h
> @@ -24,7 +24,6 @@
>  #ifndef __AMDGPU_CONNECTORS_H__
>  #define __AMDGPU_CONNECTORS_H__
>
> -struct edid *amdgpu_connector_edid(struct drm_connector *connector);
>  void amdgpu_connector_hotplug(struct drm_connector *connector);
>  int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector);
>  u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector);
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index b44fce44c066..dddb5fe16f2c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -1299,7 +1299,7 @@ static void dce_v10_0_audio_write_speaker_allocation(struct drm_encoder *encoder
>                 return;
>         }
>
> -       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb);
> +       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
>         if (sad_count < 0) {
>                 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>                 sad_count = 0;
> @@ -1369,7 +1369,7 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
> +       sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
>         if (sad_count < 0)
>                 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>         if (sad_count <= 0)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 80b2e7f79acf..11780e4d7e9f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -1331,7 +1331,7 @@ static void dce_v11_0_audio_write_speaker_allocation(struct drm_encoder *encoder
>                 return;
>         }
>
> -       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb);
> +       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
>         if (sad_count < 0) {
>                 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>                 sad_count = 0;
> @@ -1401,7 +1401,7 @@ static void dce_v11_0_audio_write_sad_regs(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
> +       sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
>         if (sad_count < 0)
>                 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>         if (sad_count <= 0)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index db20012600f5..05c0df97f01d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1217,7 +1217,7 @@ static void dce_v6_0_audio_write_speaker_allocation(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb);
> +       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
>         if (sad_count < 0) {
>                 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>                 sad_count = 0;
> @@ -1292,7 +1292,7 @@ static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
> +       sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
>         if (sad_count < 0)
>                 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>         if (sad_count <= 0)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 5b56100ec902..dc73e301d937 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -1272,7 +1272,7 @@ static void dce_v8_0_audio_write_speaker_allocation(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb);
> +       sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb);
>         if (sad_count < 0) {
>                 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
>                 sad_count = 0;
> @@ -1340,7 +1340,7 @@ static void dce_v8_0_audio_write_sad_regs(struct drm_encoder *encoder)
>                 return;
>         }
>
> -       sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads);
> +       sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads);
>         if (sad_count < 0)
>                 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
>         if (sad_count <= 0)
> --
> 2.39.2
>

Reviewed-by: Robert Foss <rfoss@xxxxxxxxxx>




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux