dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Inki Dae <daeinki@gmail.com>
Cc: dri-devel@lists.freedesktop.org,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 04/11] drm/exynos: hdmi: convert to struct drm_edid
Date: Thu, 13 Jun 2024 10:15:20 +0300	[thread overview]
Message-ID: <87wmmtia9j.fsf@intel.com> (raw)
In-Reply-To: <CAAQKjZNhUzyUO4rjPZGGrp=0MsTdQvT2ij3bVV91oDcYjk9EDg@mail.gmail.com>

On Mon, 10 Jun 2024, Inki Dae <daeinki@gmail.com> wrote:
> Hi, Jani Nikula,
>
> Thanks for your contribution and sorry for being late. Below are my comments.
>
> 2024년 5월 14일 (화) 오후 9:57, Jani Nikula <jani.nikula@intel.com>님이 작성:
>>
>> Prefer the struct drm_edid based functions for reading the EDID and
>> updating the connector.
>>
>> The functional change is that the CEC physical address gets invalidated
>> when the EDID could not be read.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>
>> ---
>>
>> Cc: Inki Dae <inki.dae@samsung.com>
>> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Krzysztof Kozlowski <krzk@kernel.org>
>> Cc: Alim Akhtar <alim.akhtar@samsung.com>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-samsung-soc@vger.kernel.org
>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 23 +++++++++++++----------
>>  1 file changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index e968824a4c72..9033e8b66816 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -883,27 +883,30 @@ static const struct drm_connector_funcs hdmi_connector_funcs = {
>>  static int hdmi_get_modes(struct drm_connector *connector)
>>  {
>>         struct hdmi_context *hdata = connector_to_hdmi(connector);
>> -       struct edid *edid;
>> +       const struct drm_display_info *info = &connector->display_info;
>> +       const struct drm_edid *drm_edid;
>>         int ret;
>>
>>         if (!hdata->ddc_adpt)
>>                 return 0;
>>
>> -       edid = drm_get_edid(connector, hdata->ddc_adpt);
>> -       if (!edid)
>> +       drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt);
>
> drm_edid_read_ddc function can return NULL for an error. Could you add
> an exception handling?

If it returns NULL, the below code intentionally passes NULL to
drm_edid_connector_update() to reset the EDID. After that,
cec_notifier_set_phys_addr() also resets the source physical
address. And !drm_edid is handled after that.

>
>> +
>> +       drm_edid_connector_update(connector, drm_edid);
>
> Ditto. drm_edid_connector_update function can return a negative value
> for an error.

Okay.cg

>
>> +
>> +       cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address);
>> +
>> +       if (!drm_edid)
>>                 return 0;
>>
>> -       hdata->dvi_mode = !connector->display_info.is_hdmi;
>> +       hdata->dvi_mode = !info->is_hdmi;
>
> Above change wouldn't be related to this patch.

Yeah, reuses info which is for info->source_physical_address which would
be too long otherwise. Can add another intermediate patch for that.

>
>>         DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n",
>>                           (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
>> -                         edid->width_cm, edid->height_cm);
>> -
>> -       drm_connector_update_edid_property(connector, edid);
>> -       cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid);
>> +                         info->width_mm / 10, info->height_mm / 10);
>
> The purpose of this patch would be to replace edid with drm_edid so
> how about updating the above change like below?
>     drm_edid->edid->width_cm, erm_edid->edid->height_cm);

struct drm_edid is an opaque type and drm_edid->edid is not available
for drivers to look at.

BR,
Jani.

>
> Thanks,
> Inki Dae
>
>>
>> -       ret = drm_add_edid_modes(connector, edid);
>> +       ret = drm_edid_connector_add_modes(connector);
>>
>> -       kfree(edid);
>> +       drm_edid_free(drm_edid);
>>
>>         return ret;
>>  }
>> --
>> 2.39.2
>>
>>

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-06-13  7:15 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 12:55 [PATCH 00/11] drm: conversions to struct drm_edid Jani Nikula
2024-05-14 12:55 ` [PATCH 01/11] drm/rockchip: cdn-dp: get rid of drm_edid_raw() Jani Nikula
2024-06-24  9:14   ` Daniel Vetter
2024-05-14 12:55 ` [PATCH 02/11] drm/sti/sti_hdmi: convert to struct drm_edid Jani Nikula
2024-06-24  9:22   ` Daniel Vetter
2024-08-15 12:55     ` Jani Nikula
2024-08-19 14:04       ` Daniel Vetter
2024-05-14 12:55 ` [PATCH 03/11] drm/bridge: analogix_dp: " Jani Nikula
2024-05-19 21:38   ` Dmitry Baryshkov
2024-05-14 12:55 ` [PATCH 04/11] drm/exynos: hdmi: " Jani Nikula
2024-06-10  9:02   ` Inki Dae
2024-06-13  7:15     ` Jani Nikula [this message]
2024-05-14 12:55 ` [PATCH 05/11] drm/hisilicon/hibmc: " Jani Nikula
2024-05-14 13:07   ` Thomas Zimmermann
2024-05-15 12:34     ` Jani Nikula
2024-05-15 12:37       ` Thomas Zimmermann
2024-05-14 12:55 ` [PATCH 06/11] drm/loongson/7a1000: " Jani Nikula
2024-05-15 17:37   ` [06/11] " Sui Jingfeng
2024-05-14 12:55 ` [PATCH 07/11] drm/loongson/7a2000: " Jani Nikula
2024-05-15 17:41   ` [07/11] " Sui Jingfeng
2024-05-14 12:55 ` [PATCH 08/11] drm/msm/dp: switch " Jani Nikula
2024-05-19  9:01   ` Dmitry Baryshkov
2024-05-20 12:25     ` Jani Nikula
2024-05-20 12:33       ` Dmitry Baryshkov
2024-05-20 16:07     ` Doug Anderson
2024-05-30 12:45       ` Jani Nikula
2024-05-30 12:48         ` Dmitry Baryshkov
2024-05-14 12:55 ` [PATCH 09/11] drm/tegra: convert " Jani Nikula
2024-06-24  9:29   ` Daniel Vetter
2024-08-22 16:32     ` Jani Nikula
2024-08-27 16:38       ` Daniel Vetter
2024-05-14 12:55 ` [PATCH 10/11] drm/imx/tve: " Jani Nikula
2024-05-19 21:35   ` Dmitry Baryshkov
2024-05-20 13:06     ` Jani Nikula
2024-05-14 12:55 ` [PATCH 11/11] drm/imx/ldb: " Jani Nikula
2024-05-19 21:39   ` Dmitry Baryshkov
2024-06-23  7:14 ` [PATCH 00/11] drm: conversions " Dmitry Baryshkov

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=87wmmtia9j.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=daeinki@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sw0312.kim@samsung.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;
as well as URLs for NNTP newsgroup(s).