Commit ad1716ec authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm: Clean up drm_calc_vbltimestamp_from_scanoutpos() vbl_status

Avoid confusion and don't use 'vbl_status' as both the
.get_scanout_position() return value and the return value from
drm_calc_vbltimestamp_from_scanoutpos().

While at it make 'vbl_status' unsigned and print it as hex in the
debug prints since it's a bitmask.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent facfb062
...@@ -695,10 +695,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, ...@@ -695,10 +695,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
{ {
struct timeval tv_etime; struct timeval tv_etime;
ktime_t stime, etime; ktime_t stime, etime;
int vbl_status; unsigned int vbl_status;
int ret = DRM_VBLANKTIME_SCANOUTPOS_METHOD;
int vpos, hpos, i; int vpos, hpos, i;
int delta_ns, duration_ns; int delta_ns, duration_ns;
bool invbl;
if (pipe >= dev->num_crtcs) { if (pipe >= dev->num_crtcs) {
DRM_ERROR("Invalid crtc %u\n", pipe); DRM_ERROR("Invalid crtc %u\n", pipe);
...@@ -738,7 +738,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, ...@@ -738,7 +738,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
/* Return as no-op if scanout query unsupported or failed. */ /* Return as no-op if scanout query unsupported or failed. */
if (!(vbl_status & DRM_SCANOUTPOS_VALID)) { if (!(vbl_status & DRM_SCANOUTPOS_VALID)) {
DRM_DEBUG("crtc %u : scanoutpos query failed [%d].\n", DRM_DEBUG("crtc %u : scanoutpos query failed [0x%x].\n",
pipe, vbl_status); pipe, vbl_status);
return -EIO; return -EIO;
} }
...@@ -765,7 +765,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, ...@@ -765,7 +765,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
* within vblank area, counting down the number of lines until * within vblank area, counting down the number of lines until
* start of scanout. * start of scanout.
*/ */
invbl = vbl_status & DRM_SCANOUTPOS_IN_VBLANK; if (vbl_status & DRM_SCANOUTPOS_IN_VBLANK)
ret |= DRM_VBLANKTIME_IN_VBLANK;
/* Convert scanout position into elapsed time at raw_time query /* Convert scanout position into elapsed time at raw_time query
* since start of scanout at first display scanline. delta_ns * since start of scanout at first display scanline. delta_ns
...@@ -788,17 +789,13 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, ...@@ -788,17 +789,13 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
etime = ktime_sub_ns(etime, delta_ns); etime = ktime_sub_ns(etime, delta_ns);
*vblank_time = ktime_to_timeval(etime); *vblank_time = ktime_to_timeval(etime);
DRM_DEBUG("crtc %u : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", DRM_DEBUG("crtc %u : v 0x%x p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
pipe, (int)vbl_status, hpos, vpos, pipe, vbl_status, hpos, vpos,
(long)tv_etime.tv_sec, (long)tv_etime.tv_usec, (long)tv_etime.tv_sec, (long)tv_etime.tv_usec,
(long)vblank_time->tv_sec, (long)vblank_time->tv_usec, (long)vblank_time->tv_sec, (long)vblank_time->tv_usec,
duration_ns/1000, i); duration_ns/1000, i);
vbl_status = DRM_VBLANKTIME_SCANOUTPOS_METHOD; return ret;
if (invbl)
vbl_status |= DRM_VBLANKTIME_IN_VBLANK;
return vbl_status;
} }
EXPORT_SYMBOL(drm_calc_vbltimestamp_from_scanoutpos); EXPORT_SYMBOL(drm_calc_vbltimestamp_from_scanoutpos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment