From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Subject: [PATCH 3/5] drm: Zero out invalid vblank timestamp in drm_update_vblank_count. (v2)
Date: Mon, 4 May 2015 06:29:46 +0200 [thread overview]
Message-ID: <1430713787-29687-4-git-send-email-mario.kleiner.de@gmail.com> (raw)
In-Reply-To: <1430713787-29687-1-git-send-email-mario.kleiner.de@gmail.com>
Since commit 844b03f27739135fe1fed2fef06da0ffc4c7a081 we make
sure that after vblank irq off, we return the last valid
(vblank count, vblank timestamp) pair to clients, e.g., during
modesets, which is good.
An overlooked side effect of that commit for kms drivers without
support for precise vblank timestamping is that at vblank irq
enable, when we update the vblank counter from the hw counter, we
can't update the corresponding vblank timestamp, so now we have a
totally mismatched timestamp for the new count to confuse clients.
Restore old client visible behaviour from before Linux 3.18, but
zero out the timestamp at vblank counter update (instead of disable
as in original implementation) if we can't generate a meaningful
timestamp immediately for the new vblank counter. This will fix
this regression, so callers know they need to retry again later
if they need a valid timestamp, but at the same time preserves
the improvements made in the commit mentioned above.
v2: Rebased on top of Daniel Vetter's fixup and documentation
patch for timestamp updates. Drop request for stable kernel
backport as this would be more difficult, unless the original
patch would get applied to stable kernels.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/drm_irq.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 152d1de..44e6a20b 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -161,10 +161,13 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
/*
* Only reinitialize corresponding vblank timestamp if high-precision query
- * available and didn't fail. Will reinitialize delayed at next vblank
- * interrupt in that case.
+ * available and didn't fail. Otherwise reinitialize delayed at next vblank
+ * interrupt and assign 0 for now, to mark the vblanktimestamp as invalid.
*/
- store_vblank(dev, crtc, diff, rc ? &t_vblank : NULL);
+ if (!rc)
+ t_vblank = (struct timeval) {0, 0};
+
+ store_vblank(dev, crtc, diff, &t_vblank);
}
/*
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-05-04 4:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 4:29 Tiny fixes - resent Mario Kleiner
2015-05-04 4:29 ` [PATCH 1/5] drm/tegra: Don't use vblank_disable_immediate on incapable driver Mario Kleiner
2015-05-04 4:29 ` [PATCH 2/5] drm: Prevent invalid use of vblank_disable_immediate. (v2) Mario Kleiner
2015-05-04 4:29 ` Mario Kleiner [this message]
2015-05-04 4:29 ` [PATCH 4/5] drm/qxl: Fix qxl_noop_get_vblank_counter() Mario Kleiner
2015-05-04 9:15 ` Tiny fixes - resent Daniel Vetter
2015-05-08 23:20 ` Mario Kleiner
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=1430713787-29687-4-git-send-email-mario.kleiner.de@gmail.com \
--to=mario.kleiner.de@gmail.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.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