aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_kms.c
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner@tuebingen.mpg.de>2010-10-22 22:42:17 -0400
committerDave Airlie <airlied@redhat.com>2010-11-21 20:48:26 -0500
commitf5a8020903932624cf020dc72455a10a3e005087 (patch)
treefed9a5a2acadf001d5866d42dad8b308f864ac75 /drivers/gpu/drm/radeon/radeon_kms.c
parent27641c3f003e7f3b6585c01d8a788883603eb262 (diff)
drm/kms/radeon: Add support for precise vblank timestamping.
This patch adds new functions for use by the drm core: .get_vblank_timestamp() provides a precise timestamp for the end of the most recent (or current) vblank interval of a given crtc, as needed for the DRI2 implementation of the OML_sync_control extension. It is a thin wrapper around the drm function drm_calc_vbltimestamp_from_scanoutpos() which does almost all the work and is shared across drivers. .get_scanout_position() provides the current horizontal and vertical video scanout position and "in vblank" status of a given crtc, as needed by the drm for use by drm_calc_vbltimestamp_from_scanoutpos(). The function is also used by the dynamic gpu reclocking code to determine when it is safe to reclock inside vblank. For that purpose radeon_pm_in_vbl() is modified to accomodate a small change in the function prototype of the radeon_get_crtc_scanoutpos() which is hooked up to .get_scanout_position(). This code has been tested on AVIVO hardware, a RV530 (ATI Mobility Radeon X1600) in a Intel Core-2 Duo MacBookPro and some R600 variant (FireGL V7600) in a single cpu AMD Athlon 64 PC. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_kms.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 8fbbe1c6ebbd..4bf423ca4c12 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -277,6 +277,27 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
277 radeon_irq_set(rdev); 277 radeon_irq_set(rdev);
278} 278}
279 279
280int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
281 int *max_error,
282 struct timeval *vblank_time,
283 unsigned flags)
284{
285 struct drm_crtc *drmcrtc;
286 struct radeon_device *rdev = dev->dev_private;
287
288 if (crtc < 0 || crtc >= dev->num_crtcs) {
289 DRM_ERROR("Invalid crtc %d\n", crtc);
290 return -EINVAL;
291 }
292
293 /* Get associated drm_crtc: */
294 drmcrtc = &rdev->mode_info.crtcs[crtc]->base;
295
296 /* Helper routine in DRM core does all the work: */
297 return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error,
298 vblank_time, flags,
299 drmcrtc);
300}
280 301
281/* 302/*
282 * IOCTL. 303 * IOCTL.