aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_drv.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_drv.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_drv.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 88e4ea925900..32ec0cc6be92 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -66,6 +66,10 @@ int radeon_resume_kms(struct drm_device *dev);
66u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc); 66u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc);
67int radeon_enable_vblank_kms(struct drm_device *dev, int crtc); 67int radeon_enable_vblank_kms(struct drm_device *dev, int crtc);
68void radeon_disable_vblank_kms(struct drm_device *dev, int crtc); 68void radeon_disable_vblank_kms(struct drm_device *dev, int crtc);
69int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
70 int *max_error,
71 struct timeval *vblank_time,
72 unsigned flags);
69void radeon_driver_irq_preinstall_kms(struct drm_device *dev); 73void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
70int radeon_driver_irq_postinstall_kms(struct drm_device *dev); 74int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
71void radeon_driver_irq_uninstall_kms(struct drm_device *dev); 75void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -74,6 +78,8 @@ int radeon_dma_ioctl_kms(struct drm_device *dev, void *data,
74 struct drm_file *file_priv); 78 struct drm_file *file_priv);
75int radeon_gem_object_init(struct drm_gem_object *obj); 79int radeon_gem_object_init(struct drm_gem_object *obj);
76void radeon_gem_object_free(struct drm_gem_object *obj); 80void radeon_gem_object_free(struct drm_gem_object *obj);
81extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
82 int *vpos, int *hpos);
77extern struct drm_ioctl_desc radeon_ioctls_kms[]; 83extern struct drm_ioctl_desc radeon_ioctls_kms[];
78extern int radeon_max_kms_ioctl; 84extern int radeon_max_kms_ioctl;
79int radeon_mmap(struct file *filp, struct vm_area_struct *vma); 85int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
@@ -277,6 +283,8 @@ static struct drm_driver kms_driver = {
277 .get_vblank_counter = radeon_get_vblank_counter_kms, 283 .get_vblank_counter = radeon_get_vblank_counter_kms,
278 .enable_vblank = radeon_enable_vblank_kms, 284 .enable_vblank = radeon_enable_vblank_kms,
279 .disable_vblank = radeon_disable_vblank_kms, 285 .disable_vblank = radeon_disable_vblank_kms,
286 .get_vblank_timestamp = radeon_get_vblank_timestamp_kms,
287 .get_scanout_position = radeon_get_crtc_scanoutpos,
280#if defined(CONFIG_DEBUG_FS) 288#if defined(CONFIG_DEBUG_FS)
281 .debugfs_init = radeon_debugfs_init, 289 .debugfs_init = radeon_debugfs_init,
282 .debugfs_cleanup = radeon_debugfs_cleanup, 290 .debugfs_cleanup = radeon_debugfs_cleanup,