mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Stephen Boyd <swboyd@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Kuogee Hsieh <quic_khsieh@quicinc.com>
Cc: <dri-devel@lists.freedesktop.org>, <robdclark@gmail.com>,
	<sean@poorly.run>, <dianders@chromium.org>, <vkoul@kernel.org>,
	<daniel@ffwll.ch>, <airlied@gmail.com>, <agross@kernel.org>,
	<andersson@kernel.org>, <quic_jesszhan@quicinc.com>,
	<quic_sbillaka@quicinc.com>, <marijn.suijten@somainline.org>,
	<freedreno@lists.freedesktop.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume()
Date: Thu, 28 Sep 2023 15:35:49 -0700	[thread overview]
Message-ID: <15ccacce-c20b-5fe2-5d89-a0627bd4a9e0@quicinc.com> (raw)
In-Reply-To: <CAE-0n51Ep4zBx6bswL4Yb+F0+8dW+L2kaKQaZBi-91jsVqm_9Q@mail.gmail.com>



On 9/27/2023 2:41 PM, Stephen Boyd wrote:
> Quoting Abhinav Kumar (2023-09-22 18:35:27)
>> On 9/22/2023 2:54 PM, Stephen Boyd wrote:
>>> Quoting Dmitry Baryshkov (2023-09-19 02:50:12)
>>>>
>>>> This should be hpd_notify, who starts link training, not some event.
>>>
>>> I think this driver should train the link during atomic_enable(), not
>>> hpd_notify() (or directly from the irq handler). The drm_bridge_funcs
>>> talk a bit about when the clocks and timing signals are supposed to be
>>> enabled. For example, struct drm_bridge_funcs::atomic_pre_enable() says
>>> the "display pipe (i.e.  clocks and timing signals) feeding this bridge
>>> will not yet be running when this callback is called". And struct
>>> drm_bridge_funcs::atomic_enable() says "this callback must enable the
>>> display link feeding the next bridge in the chain if there is one."
>>>
>>> That looks to me like link training, i.e. the display link, should
>>> happen in the enable path and not hpd_notify. It looks like link
>>> training could fail, but when that happens I believe the driver should
>>> call drm_connector_set_link_status_property() with
>>> DRM_MODE_LINK_STATUS_BAD. The two callers of that which exist in the
>>> tree also call drm_kms_helper_hotplug_event() or
>>> drm_kms_helper_connector_hotplug_event() after updating the link so that
>>> userspace knows to try again.
>>>
>>> It would be nice if there was some drm_bridge_set_link_status_bad() API
>>> that bridge drivers could use to signal that the link status is bad and
>>> call the hotplug helper. Maybe it could also record some diagnostics
>>> about which bridge failed to setup the link and stop the atomic_enable()
>>> chain for that connector.
>>
>> Doing link training when we get hpd instead of atomic_enable() is a
>> design choice we have been following for a while because for the case
>> when link training fails in atomic_enable() and setting the link status
>> property as you mentioned, the compositor needs to be able to handle
>> that and also needs to try with a different resolution or take some
>> other corrective action. We have seen many compositors not able to
>> handle this complexity.
> 
> The chrome compositor handles this case[1]. If the link status is set to
> bad and there are non-zero number of modes on a connected connector it
> resets the status to good to try again.
> 

Thanks for the link. Just resetting the property alone and trying again 
is going to lead to the same failure again. So that alone is 
insufficient and doesn't sound right.

As documented here:

https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties

"When user-space receives the hotplug uevent and detects a "BAD" 
link-status, the sink doesn't receive pixels anymore (e.g. the screen 
becomes completely black). The list of available modes may have changed. 
User-space is expected to pick a new mode if the current one has 
disappeared and perform a new modeset with link-status set to "GOOD" to 
re-enable the connector."

Picking a different mode is a reasonable attempt to try again but even 
that might fail again if it picks a mode which falls in the same link rate.

Thats why, to re-iterate what i mentioned, we need to see if some sort 
of a handshake fallback exists or can be implemented. It will need 
compositor support as well as driver change to maybe remove that mode etc.

We prioritized user experience here to make sure display_enable() wont 
fail otherwise the user might keep waiting for the screen to come up 
forever. With the driver ensuring link is trained and then reporting to 
usermode, its a safer option as the driver will train with the highest 
link rate / lane combination supported and also remove modes which dont 
fall in this bucket in dp_bridge_mode_valid.

Till we validate this, I would prefer to keep this change out of this 
series.

>> So the design sends the hotplug to usermode only
>> after link training succeeds.
> 
> I suspect this is why my trogdor device turns off after rebooting when I
> apply a ChromeOS update with the lid closed and DP connected. Userspace
> wants to know that a display is connected, but this driver is still link
> training by the time userspace boots up so we don't see any drm
> connector indicating status is connected. No drm connectors connected
> means the OS should shutdown.
> 

Interesting use case but I am not sure if thats whats happening till we 
debug that. Why should OS shutdown if connectors are not in "connected" 
state? Agreed, display will be off. But shouldnt compositor be alive in 
case it receives hotplug? The user (in this case you) never turned the 
device off so why should the OS shutdown?

>>
>> I do not think we should change this design unless prototyped with an
>> existing compositor such as chrome or android at this point.
> 
> Is this driver used with android?
> 

There are some internal efforts ongoing with prototyping this but I 
cannot comment more on this right now.

> [1] https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.cc;l=114;drc=67520ac99db89395b10f2ab728b540eef0da8292

  reply	other threads:[~2023-09-28 22:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 21:38 [PATCH v3 0/7] incorporate pm runtime framework and eDP clean up Kuogee Hsieh
2023-09-15 21:38 ` [PATCH v3 1/7] drm/msm/dp: tie dp_display_irq_handler() with dp driver Kuogee Hsieh
2023-09-16  0:29   ` Dmitry Baryshkov
2023-09-18 17:02     ` Kuogee Hsieh
2023-09-19  9:44       ` Dmitry Baryshkov
2023-09-22 23:02     ` Kuogee Hsieh
2023-09-23 18:45       ` Dmitry Baryshkov
2023-09-27 15:25         ` Kuogee Hsieh
2023-09-15 21:38 ` [PATCH v3 2/7] drm/msm/dp: replace is_connected with link_ready Kuogee Hsieh
2023-09-16  1:51   ` Dmitry Baryshkov
2023-09-18 17:09     ` Kuogee Hsieh
2023-09-19  9:44       ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 3/7] drm/msm/dp: use drm_bridge_hpd_notify() to report HPD status changes Kuogee Hsieh
2023-09-16  0:41   ` Dmitry Baryshkov
2023-09-18 20:16     ` Kuogee Hsieh
2023-09-19  9:45       ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 4/7] drm/msm/dp: incorporate pm_runtime framework into DP driver Kuogee Hsieh
2023-09-16  1:07   ` Dmitry Baryshkov
2023-09-20 22:46     ` Kuogee Hsieh
2023-09-25  9:06       ` Dmitry Baryshkov
2023-09-16  5:25   ` kernel test robot
2023-09-15 21:38 ` [PATCH v3 5/7] drm/msm/dp: delete EV_HPD_INIT_SETUP Kuogee Hsieh
2023-09-16  1:09   ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume() Kuogee Hsieh
2023-09-16  1:21   ` Dmitry Baryshkov
2023-09-18 17:47     ` Kuogee Hsieh
2023-09-19  9:50       ` Dmitry Baryshkov
2023-09-20 19:49         ` Kuogee Hsieh
2023-09-22 21:54         ` Stephen Boyd
2023-09-23  1:35           ` Abhinav Kumar
2023-09-25 16:07             ` Kuogee Hsieh
2023-09-27 22:01               ` Stephen Boyd
2023-09-27 22:04                 ` Dmitry Baryshkov
2023-09-29  0:46                 ` Abhinav Kumar
2023-10-02 22:58                   ` Stephen Boyd
2023-10-03  1:32                     ` Abhinav Kumar
2023-10-03  8:00                       ` Dmitry Baryshkov
2023-09-27 21:41             ` Stephen Boyd
2023-09-28 22:35               ` Abhinav Kumar [this message]
2023-09-15 21:38 ` [PATCH v3 7/7] drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe() Kuogee Hsieh
2023-09-16  1:48   ` 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=15ccacce-c20b-5fe2-5d89-a0627bd4a9e0@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=agross@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_jesszhan@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    --cc=vkoul@kernel.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

all inboxes | Powered by JetHome®