diff options
author | Mario Kleiner <mario.kleiner@tuebingen.mpg.de> | 2010-10-22 22:42:17 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-11-21 20:48:26 -0500 |
commit | f5a8020903932624cf020dc72455a10a3e005087 (patch) | |
tree | fed9a5a2acadf001d5866d42dad8b308f864ac75 /drivers/gpu/drm/radeon/radeon_drv.c | |
parent | 27641c3f003e7f3b6585c01d8a788883603eb262 (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.c | 8 |
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); | |||
66 | u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc); | 66 | u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc); |
67 | int radeon_enable_vblank_kms(struct drm_device *dev, int crtc); | 67 | int radeon_enable_vblank_kms(struct drm_device *dev, int crtc); |
68 | void radeon_disable_vblank_kms(struct drm_device *dev, int crtc); | 68 | void radeon_disable_vblank_kms(struct drm_device *dev, int crtc); |
69 | int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, | ||
70 | int *max_error, | ||
71 | struct timeval *vblank_time, | ||
72 | unsigned flags); | ||
69 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev); | 73 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev); |
70 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev); | 74 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev); |
71 | void radeon_driver_irq_uninstall_kms(struct drm_device *dev); | 75 | void 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); |
75 | int radeon_gem_object_init(struct drm_gem_object *obj); | 79 | int radeon_gem_object_init(struct drm_gem_object *obj); |
76 | void radeon_gem_object_free(struct drm_gem_object *obj); | 80 | void radeon_gem_object_free(struct drm_gem_object *obj); |
81 | extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, | ||
82 | int *vpos, int *hpos); | ||
77 | extern struct drm_ioctl_desc radeon_ioctls_kms[]; | 83 | extern struct drm_ioctl_desc radeon_ioctls_kms[]; |
78 | extern int radeon_max_kms_ioctl; | 84 | extern int radeon_max_kms_ioctl; |
79 | int radeon_mmap(struct file *filp, struct vm_area_struct *vma); | 85 | int 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, |