Skip to content

Commit fdb68e0

Browse files
kleinermairlied
authored andcommitted
drm: Zero out invalid vblank timestamp in drm_update_vblank_count.
Since commit 844b03f 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.17, 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. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Cc: <stable@vger.kernel.org> #v3.17+ Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
1 parent 3790e39 commit fdb68e0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/gpu/drm/drm_irq.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,11 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
131131

132132
/* Reinitialize corresponding vblank timestamp if high-precision query
133133
* available. Skip this step if query unsupported or failed. Will
134-
* reinitialize delayed at next vblank interrupt in that case.
134+
* reinitialize delayed at next vblank interrupt in that case and
135+
* assign 0 for now, to mark the vblanktimestamp as invalid.
135136
*/
136-
if (rc) {
137-
tslot = atomic_read(&vblank->count) + diff;
138-
vblanktimestamp(dev, crtc, tslot) = t_vblank;
139-
}
137+
tslot = atomic_read(&vblank->count) + diff;
138+
vblanktimestamp(dev, crtc, tslot) = rc ? t_vblank : (struct timeval) {0, 0};
140139

141140
smp_mb__before_atomic();
142141
atomic_add(diff, &vblank->count);

0 commit comments

Comments
 (0)