aboutsummaryrefslogtreecommitdiff
path: root/shared-core/via_irq.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-08-15 18:07:12 +0000
committerEric Anholt <anholt@freebsd.org>2005-08-15 18:07:12 +0000
commit8c21b783c3e38aa2c2d16e11ec01cf695f8e7f8a (patch)
treec40ed75e583b24b7a9947221766c82d5a4cd061d /shared-core/via_irq.c
parent4f5961eeeee806a2d6e08e159c56262d4f060cba (diff)
Port the VIA DRM to FreeBSD. Original patch by Jake, with some cleanup by
me to match other drivers and avoid ifdeffing. The linux via_drv.c will be moved from shared-core to linux-core soon by repocopy. Submitted by: Jake Burkholder <jake@FreeBSD.org> Tested by: unichrome
Diffstat (limited to 'shared-core/via_irq.c')
-rw-r--r--shared-core/via_irq.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shared-core/via_irq.c b/shared-core/via_irq.c
index e8027f3a..f87b2f2c 100644
--- a/shared-core/via_irq.c
+++ b/shared-core/via_irq.c
@@ -87,7 +87,11 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
if (status & VIA_IRQ_VBLANK_PENDING) {
atomic_inc(&dev->vbl_received);
if (!(atomic_read(&dev->vbl_received) & 0x0F)) {
+#ifdef __linux__
do_gettimeofday(&cur_vblank);
+#else
+ microtime(&cur_vblank);
+#endif
if (dev_priv->last_vblank_valid) {
dev_priv->usec_per_vblank =
time_diff( &cur_vblank,&dev_priv->last_vblank) >> 4;
@@ -237,7 +241,7 @@ void via_driver_irq_preinstall(drm_device_t * dev)
dev_priv->last_vblank_valid = 0;
- // Clear VSync interrupt regs
+ /* Clear VSync interrupt regs */
status = VIA_READ(VIA_REG_INTERRUPT);
VIA_WRITE(VIA_REG_INTERRUPT, status &
~(dev_priv->irq_enable_mask));
@@ -287,8 +291,7 @@ void via_driver_irq_uninstall(drm_device_t * dev)
int via_wait_irq(DRM_IOCTL_ARGS)
{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->head->dev;
+ DRM_DEVICE;
drm_via_irqwait_t __user *argp = (void __user *)data;
drm_via_irqwait_t irqwait;
struct timeval now;
@@ -329,7 +332,11 @@ int via_wait_irq(DRM_IOCTL_ARGS)
ret = via_driver_irq_wait(dev, irqwait.request.irq, force_sequence,
&irqwait.request.sequence);
+#ifdef __linux__
do_gettimeofday(&now);
+#else
+ microtime(&now);
+#endif
irqwait.reply.tval_sec = now.tv_sec;
irqwait.reply.tval_usec = now.tv_usec;