All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Foss <robert.foss@linaro.org>
To: Pin-yen Lin <treapking@chromium.org>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	allen chen <allen.chen@ite.com.tw>,
	linux-kernel@vger.kernel.org, David Airlie <airlied@gmail.com>,
	dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH] drm/bridge: it6505: Add caching for EDID
Date: Tue, 13 Dec 2022 16:51:52 +0100	[thread overview]
Message-ID: <CAG3jFys7gbB7tyLmpByZcamAXMSRWdEY_4rjCXWwXtT67DFLdQ@mail.gmail.com> (raw)
In-Reply-To: <20221115112720.911158-1-treapking@chromium.org>

On Tue, 15 Nov 2022 at 12:27, Pin-yen Lin <treapking@chromium.org> wrote:
>
> Add caching when EDID is read, and invalidate the cache until the
> bridge detects HPD low or sink count changes on HPD_IRQ.
>
> It takes 1.2s for IT6505 bridge to read a 3-block EDID, and skipping
> one EDID read would be a notable difference on user experience.
>
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
>
> ---
>
>  drivers/gpu/drm/bridge/ite-it6505.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 21a9b8422bda..4b818f31668f 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -457,6 +457,8 @@ struct it6505 {
>
>         /* it6505 driver hold option */
>         bool enable_drv_hold;
> +
> +       struct edid *cached_edid;
>  };
>
>  struct it6505_step_train_para {
> @@ -2244,6 +2246,13 @@ static void it6505_plugged_status_to_codec(struct it6505 *it6505)
>                                    status == connector_status_connected);
>  }
>
> +
> +static void it6505_remove_edid(struct it6505 *it6505)
> +{
> +       kfree(it6505->cached_edid);
> +       it6505->cached_edid = NULL;
> +}
> +
>  static int it6505_process_hpd_irq(struct it6505 *it6505)
>  {
>         struct device *dev = &it6505->client->dev;
> @@ -2270,6 +2279,7 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
>                 it6505_reset_logic(it6505);
>                 it6505_int_mask_enable(it6505);
>                 it6505_init(it6505);
> +               it6505_remove_edid(it6505);
>                 return 0;
>         }
>
> @@ -2353,6 +2363,7 @@ static void it6505_irq_hpd(struct it6505 *it6505)
>                         it6505_video_reset(it6505);
>         } else {
>                 memset(it6505->dpcd, 0, sizeof(it6505->dpcd));
> +               it6505_remove_edid(it6505);
>
>                 if (it6505->hdcp_desired)
>                         it6505_stop_hdcp(it6505);
> @@ -3016,16 +3027,18 @@ static struct edid *it6505_bridge_get_edid(struct drm_bridge *bridge,
>  {
>         struct it6505 *it6505 = bridge_to_it6505(bridge);
>         struct device *dev = &it6505->client->dev;
> -       struct edid *edid;
>
> -       edid = drm_do_get_edid(connector, it6505_get_edid_block, it6505);
> +       if (!it6505->cached_edid) {
> +               it6505->cached_edid = drm_do_get_edid(connector, it6505_get_edid_block,
> +                                                     it6505);
>
> -       if (!edid) {
> -               DRM_DEV_DEBUG_DRIVER(dev, "failed to get edid!");
> -               return NULL;
> +               if (!it6505->cached_edid) {
> +                       DRM_DEV_DEBUG_DRIVER(dev, "failed to get edid!");
> +                       return NULL;
> +               }
>         }
>
> -       return edid;
> +       return drm_edid_duplicate(it6505->cached_edid);
>  }
>
>  static const struct drm_bridge_funcs it6505_bridge_funcs = {
> @@ -3367,6 +3380,7 @@ static void it6505_i2c_remove(struct i2c_client *client)
>         drm_dp_aux_unregister(&it6505->aux);
>         it6505_debugfs_remove(it6505);
>         it6505_poweroff(it6505);
> +       it6505_remove_edid(it6505);
>  }
>
>  static const struct i2c_device_id it6505_id[] = {
> --
> 2.38.1.493.g58b659f92b-goog
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>

WARNING: multiple messages have this Message-ID (diff)
From: Robert Foss <robert.foss@linaro.org>
To: Pin-yen Lin <treapking@chromium.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Jonas Karlman <jonas@kwiboo.se>,
	allen chen <allen.chen@ite.com.tw>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [PATCH] drm/bridge: it6505: Add caching for EDID
Date: Tue, 13 Dec 2022 16:51:52 +0100	[thread overview]
Message-ID: <CAG3jFys7gbB7tyLmpByZcamAXMSRWdEY_4rjCXWwXtT67DFLdQ@mail.gmail.com> (raw)
In-Reply-To: <20221115112720.911158-1-treapking@chromium.org>

On Tue, 15 Nov 2022 at 12:27, Pin-yen Lin <treapking@chromium.org> wrote:
>
> Add caching when EDID is read, and invalidate the cache until the
> bridge detects HPD low or sink count changes on HPD_IRQ.
>
> It takes 1.2s for IT6505 bridge to read a 3-block EDID, and skipping
> one EDID read would be a notable difference on user experience.
>
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
>
> ---
>
>  drivers/gpu/drm/bridge/ite-it6505.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 21a9b8422bda..4b818f31668f 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -457,6 +457,8 @@ struct it6505 {
>
>         /* it6505 driver hold option */
>         bool enable_drv_hold;
> +
> +       struct edid *cached_edid;
>  };
>
>  struct it6505_step_train_para {
> @@ -2244,6 +2246,13 @@ static void it6505_plugged_status_to_codec(struct it6505 *it6505)
>                                    status == connector_status_connected);
>  }
>
> +
> +static void it6505_remove_edid(struct it6505 *it6505)
> +{
> +       kfree(it6505->cached_edid);
> +       it6505->cached_edid = NULL;
> +}
> +
>  static int it6505_process_hpd_irq(struct it6505 *it6505)
>  {
>         struct device *dev = &it6505->client->dev;
> @@ -2270,6 +2279,7 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
>                 it6505_reset_logic(it6505);
>                 it6505_int_mask_enable(it6505);
>                 it6505_init(it6505);
> +               it6505_remove_edid(it6505);
>                 return 0;
>         }
>
> @@ -2353,6 +2363,7 @@ static void it6505_irq_hpd(struct it6505 *it6505)
>                         it6505_video_reset(it6505);
>         } else {
>                 memset(it6505->dpcd, 0, sizeof(it6505->dpcd));
> +               it6505_remove_edid(it6505);
>
>                 if (it6505->hdcp_desired)
>                         it6505_stop_hdcp(it6505);
> @@ -3016,16 +3027,18 @@ static struct edid *it6505_bridge_get_edid(struct drm_bridge *bridge,
>  {
>         struct it6505 *it6505 = bridge_to_it6505(bridge);
>         struct device *dev = &it6505->client->dev;
> -       struct edid *edid;
>
> -       edid = drm_do_get_edid(connector, it6505_get_edid_block, it6505);
> +       if (!it6505->cached_edid) {
> +               it6505->cached_edid = drm_do_get_edid(connector, it6505_get_edid_block,
> +                                                     it6505);
>
> -       if (!edid) {
> -               DRM_DEV_DEBUG_DRIVER(dev, "failed to get edid!");
> -               return NULL;
> +               if (!it6505->cached_edid) {
> +                       DRM_DEV_DEBUG_DRIVER(dev, "failed to get edid!");
> +                       return NULL;
> +               }
>         }
>
> -       return edid;
> +       return drm_edid_duplicate(it6505->cached_edid);
>  }
>
>  static const struct drm_bridge_funcs it6505_bridge_funcs = {
> @@ -3367,6 +3380,7 @@ static void it6505_i2c_remove(struct i2c_client *client)
>         drm_dp_aux_unregister(&it6505->aux);
>         it6505_debugfs_remove(it6505);
>         it6505_poweroff(it6505);
> +       it6505_remove_edid(it6505);
>  }
>
>  static const struct i2c_device_id it6505_id[] = {
> --
> 2.38.1.493.g58b659f92b-goog
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>

  reply	other threads:[~2022-12-13 15:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 11:27 [PATCH] drm/bridge: it6505: Add caching for EDID Pin-yen Lin
2022-11-15 11:27 ` Pin-yen Lin
2022-12-13 15:51 ` Robert Foss [this message]
2022-12-13 15:51   ` Robert Foss
2022-12-14 16:51 ` Robert Foss
2022-12-14 16:51   ` Robert Foss
2022-12-15  8:36   ` Pin-yen Lin
2022-12-15  8:36     ` Pin-yen Lin
2022-12-15 10:29     ` Robert Foss
2022-12-15 10:29       ` Robert Foss
2022-12-15 10:45 ` Robert Foss
2022-12-15 10:45   ` Robert Foss

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=CAG3jFys7gbB7tyLmpByZcamAXMSRWdEY_4rjCXWwXtT67DFLdQ@mail.gmail.com \
    --to=robert.foss@linaro.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=allen.chen@ite.com.tw \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=treapking@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.