From: "Ville Syrjälä" <ville.syrjala@linux•intel.com>
To: Robert Beckett <bob.beckett@collabora•com>
Cc: Maxime Ripard <maxime.ripard@bootlin•com>,
Sean Paul <sean@poorly•run>,
linux-kernel@vger•kernel.org, dri-devel@lists•freedesktop.org,
David Airlie <airlied@linux•ie>,
NXP Linux Team <linux-imx@nxp•com>,
Pengutronix Kernel Team <kernel@pengutronix•de>,
Shawn Guo <shawnguo@kernel•org>,
linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH v3 3/4] drm/vblank: estimate vblank while disabling vblank if interrupt disabled
Date: Wed, 26 Jun 2019 16:27:32 +0300 [thread overview]
Message-ID: <20190626132732.GP5942@intel.com> (raw)
In-Reply-To: <b96132cef4b63118df1026a99b3c345692e3de26.1561483965.git.bob.beckett@collabora.com>
On Tue, Jun 25, 2019 at 06:59:14PM +0100, Robert Beckett wrote:
> If interrupts are disabled (e.g. via vblank_disable_fn) and we come to
> disable vblank, update the vblank count to best guess as to what it
> would be had the interrupts remained enabled, and update the timesamp to
> now.
>
> This avoids a stale vblank event being sent while disabling crtcs during
> atomic modeset.
>
> Fixes: 68036b08b91bc ("drm/vblank: Do not update vblank count if interrupts
> are already disabled.")
I don't understand that commit. drm_vblank_off() should be called
when the power is still present, so it looks to me like that
commit is actually wrong. So I think we may want to just revert
it and figure out what the actual bug was.
>
> Signed-off-by: Robert Beckett <bob.beckett@collabora•com>
> ---
> drivers/gpu/drm/drm_vblank.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 7dabb2bdb733..db68b8cbf797 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -375,9 +375,23 @@ void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
> * interrupts were enabled. This avoids calling the ->disable_vblank()
> * operation in atomic context with the hardware potentially runtime
> * suspended.
> + * If interrupts are disabled (e.g. via blank_disable_fn) then make
> + * best guess as to what it would be now and make sure we have an up
> + * to date timestamp.
> */
> - if (!vblank->enabled)
> + if (!vblank->enabled) {
> + ktime_t now = ktime_get();
> + u32 diff = 0;
> + if (vblank->framedur_ns) {
> + u64 diff_ns = ktime_to_ns(ktime_sub(now, vblank->time));
> + diff = DIV_ROUND_CLOSEST_ULL(diff_ns,
> + vblank->framedur_ns);
> + }
> +
> + store_vblank(dev, pipe, diff, now, vblank->count);
> +
> goto out;
> + }
>
> /*
> * Update the count and timestamp to maintain the
> --
> 2.18.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists•freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-26 13:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 17:59 [PATCH v3 0/4] handle vblank when disabling ctc with interrupt disabled (was [PATCH v2] drm/imx: correct order of crtc disable) Robert Beckett
2019-06-25 17:59 ` [PATCH v3 1/4] drm/vblank: warn on sending stale event Robert Beckett
2019-06-25 20:00 ` Daniel Vetter
2019-06-25 20:02 ` Daniel Vetter
2019-06-25 17:59 ` [PATCH v3 2/4] drm/imx: notify drm core before sending event during crtc disable Robert Beckett
2019-06-25 20:03 ` Daniel Vetter
2019-06-25 17:59 ` [PATCH v3 3/4] drm/vblank: estimate vblank while disabling vblank if interrupt disabled Robert Beckett
2019-06-25 20:11 ` Daniel Vetter
2019-06-26 13:27 ` Ville Syrjälä [this message]
2019-06-26 14:30 ` Daniel Vetter
2019-06-25 17:59 ` [PATCH v3 4/4] drm/imx: only send event on crtc disable if kept disabled Robert Beckett
2019-06-25 20:22 ` Daniel Vetter
2019-06-26 8:33 ` Philipp Zabel
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=20190626132732.GP5942@intel.com \
--to=ville.syrjala@linux$(echo .)intel.com \
--cc=airlied@linux$(echo .)ie \
--cc=bob.beckett@collabora$(echo .)com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=kernel@pengutronix$(echo .)de \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-imx@nxp$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=maxime.ripard@bootlin$(echo .)com \
--cc=sean@poorly$(echo .)run \
--cc=shawnguo@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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