* [PATCH] drm/vkms: Avoid extra discount in the timestamp value
@ 2019-05-20 0:12 Rodrigo Siqueira
0 siblings, 0 replies; only message in thread
From: Rodrigo Siqueira @ 2019-05-20 0:12 UTC (permalink / raw)
To: Ville Syrjala, Shayenne Moura, Haneen Mohammed, Daniel Vetter,
David Airlie
Cc: dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2320 bytes --]
After the commit def35e7c5926 ("drm/vkms: Bugfix extra vblank frame")
some of the crc tests (IGT) start to fail in the vkms with the following
error:
[drm:drm_crtc_add_crc_entry [drm]] *ERROR* Overflow of CRC buffer,
userspace reads too slow.
[drm] failed to queue vkms_crc_work_handle
...
The commit def35e7c5926 ("drm/vkms: Bugfix extra vblank frame") added an
operation for decrement the timestamp value returned by
`get_vblank_timestamp()` which solved the problems related to kms_flip
tests. However, each call to `get_vblank_timestamp()` reduces the
timestamp even when it is not required. Such decrement generates a
negative number in the following calculation within
`drm_update_vblank_count()`:
u64 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time));
Next, the DIV_ROUND_CLOSEST_ULL macro is invoked using the diff_ns
value, which generates an undefined result. Therefore, the returned
frame is incorrect, which assign a huge number to the variable
frame_end. In this case, causing the loop (`vkms_crc_work_handle()`)
below to take a long time:
frame_end = drm_crtc_accurate_vblank_count(crtc);
while (frame_start <= frame_end)
drm_crtc_add_crc_entry(crtc, true, frame_start++, &crc32);
This commit fixes this issue by adding a check that validates whether
the current vblank timestamp is still the same, thus avoiding excessive
timestamp decrement of the timestamp value.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Shayenne Moura <shayenneluzmoura@gmail.com>
---
drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 7508815fac11..3ce60e66673e 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -74,9 +74,13 @@ bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
{
struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
struct vkms_output *output = &vkmsdev->output;
+ struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
*vblank_time = output->vblank_hrtimer.node.expires;
+ if (*vblank_time == vblank->time)
+ return true;
+
if (!in_vblank_irq)
*vblank_time -= output->period_ns;
--
2.21.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-20 0:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-20 0:12 [PATCH] drm/vkms: Avoid extra discount in the timestamp value Rodrigo Siqueira
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).