Skip to content

Commit

Permalink
drm: Skip the waitqueue setup for vblank queries
Browse files Browse the repository at this point in the history
Avoid adding to the waitqueue and reprobing the current vblank if the
caller is only querying the current vblank sequence and timestamp, where
we know that the wait would return immediately.

v2: Add CRTC identifier to debug messages

Signed-off-by: Chris Wilson <[email protected]>
Cc: Ville Syrjälä <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Michel Dänzer <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Dave Airlie <[email protected]>,
Cc: Mario Kleiner <[email protected]>
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-and-tested-by: Mario Kleiner <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
ickle authored and danvet committed Mar 16, 2017
1 parent 608b205 commit 82c8e02
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions drivers/gpu/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,

ret = drm_vblank_get(dev, pipe);
if (ret) {
DRM_DEBUG("failed to acquire vblank counter, %d\n", ret);
DRM_DEBUG("crtc %d failed to acquire vblank counter, %d\n", pipe, ret);
return ret;
}
seq = drm_vblank_count(dev, pipe);
Expand Down Expand Up @@ -1638,13 +1638,15 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
return drm_queue_vblank_event(dev, pipe, vblwait, file_priv);
}

DRM_DEBUG("waiting on vblank count %u, crtc %u\n",
vblwait->request.sequence, pipe);
DRM_WAIT_ON(ret, vblank->queue, 3 * HZ,
(((drm_vblank_count(dev, pipe) -
vblwait->request.sequence) <= (1 << 23)) ||
!vblank->enabled ||
!dev->irq_enabled));
if (vblwait->request.sequence != seq) {
DRM_DEBUG("waiting on vblank count %u, crtc %u\n",
vblwait->request.sequence, pipe);
DRM_WAIT_ON(ret, vblank->queue, 3 * HZ,
(((drm_vblank_count(dev, pipe) -
vblwait->request.sequence) <= (1 << 23)) ||
!vblank->enabled ||
!dev->irq_enabled));
}

if (ret != -EINTR) {
struct timeval now;
Expand All @@ -1653,10 +1655,10 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
vblwait->reply.tval_sec = now.tv_sec;
vblwait->reply.tval_usec = now.tv_usec;

DRM_DEBUG("returning %u to client\n",
vblwait->reply.sequence);
DRM_DEBUG("crtc %d returning %u to client\n",
pipe, vblwait->reply.sequence);
} else {
DRM_DEBUG("vblank wait interrupted by signal\n");
DRM_DEBUG("crtc %d vblank wait interrupted by signal\n", pipe);
}

done:
Expand Down

0 comments on commit 82c8e02

Please sign in to comment.