aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index a263b7070fc6..9d3a5030b6e1 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -34,6 +34,7 @@
34 */ 34 */
35 35
36#include "drmP.h" 36#include "drmP.h"
37#include "drm_trace.h"
37 38
38#include <linux/interrupt.h> /* For task queue support */ 39#include <linux/interrupt.h> /* For task queue support */
39#include <linux/slab.h> 40#include <linux/slab.h>
@@ -57,6 +58,9 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
57{ 58{
58 struct drm_irq_busid *p = data; 59 struct drm_irq_busid *p = data;
59 60
61 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
62 return -EINVAL;
63
60 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 64 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
61 return -EINVAL; 65 return -EINVAL;
62 66
@@ -211,7 +215,7 @@ int drm_irq_install(struct drm_device *dev)
211 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 215 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
212 return -EINVAL; 216 return -EINVAL;
213 217
214 if (dev->pdev->irq == 0) 218 if (drm_dev_to_irq(dev) == 0)
215 return -EINVAL; 219 return -EINVAL;
216 220
217 mutex_lock(&dev->struct_mutex); 221 mutex_lock(&dev->struct_mutex);
@@ -229,7 +233,7 @@ int drm_irq_install(struct drm_device *dev)
229 dev->irq_enabled = 1; 233 dev->irq_enabled = 1;
230 mutex_unlock(&dev->struct_mutex); 234 mutex_unlock(&dev->struct_mutex);
231 235
232 DRM_DEBUG("irq=%d\n", dev->pdev->irq); 236 DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev));
233 237
234 /* Before installing handler */ 238 /* Before installing handler */
235 dev->driver->irq_preinstall(dev); 239 dev->driver->irq_preinstall(dev);
@@ -302,14 +306,14 @@ int drm_irq_uninstall(struct drm_device * dev)
302 if (!irq_enabled) 306 if (!irq_enabled)
303 return -EINVAL; 307 return -EINVAL;
304 308
305 DRM_DEBUG("irq=%d\n", dev->pdev->irq); 309 DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev));
306 310
307 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 311 if (!drm_core_check_feature(dev, DRIVER_MODESET))
308 vga_client_register(dev->pdev, NULL, NULL, NULL); 312 vga_client_register(dev->pdev, NULL, NULL, NULL);
309 313
310 dev->driver->irq_uninstall(dev); 314 dev->driver->irq_uninstall(dev);
311 315
312 free_irq(dev->pdev->irq, dev); 316 free_irq(drm_dev_to_irq(dev), dev);
313 317
314 return 0; 318 return 0;
315} 319}
@@ -341,7 +345,7 @@ int drm_control(struct drm_device *dev, void *data,
341 if (drm_core_check_feature(dev, DRIVER_MODESET)) 345 if (drm_core_check_feature(dev, DRIVER_MODESET))
342 return 0; 346 return 0;
343 if (dev->if_version < DRM_IF_VERSION(1, 2) && 347 if (dev->if_version < DRM_IF_VERSION(1, 2) &&
344 ctl->irq != dev->pdev->irq) 348 ctl->irq != drm_dev_to_irq(dev))
345 return -EINVAL; 349 return -EINVAL;
346 return drm_irq_install(dev); 350 return drm_irq_install(dev);
347 case DRM_UNINST_HANDLER: 351 case DRM_UNINST_HANDLER:
@@ -587,6 +591,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
587 return -ENOMEM; 591 return -ENOMEM;
588 592
589 e->pipe = pipe; 593 e->pipe = pipe;
594 e->base.pid = current->pid;
590 e->event.base.type = DRM_EVENT_VBLANK; 595 e->event.base.type = DRM_EVENT_VBLANK;
591 e->event.base.length = sizeof e->event; 596 e->event.base.length = sizeof e->event;
592 e->event.user_data = vblwait->request.signal; 597 e->event.user_data = vblwait->request.signal;
@@ -614,6 +619,9 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
614 DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n", 619 DRM_DEBUG("event on vblank count %d, current %d, crtc %d\n",
615 vblwait->request.sequence, seq, pipe); 620 vblwait->request.sequence, seq, pipe);
616 621
622 trace_drm_vblank_event_queued(current->pid, pipe,
623 vblwait->request.sequence);
624
617 e->event.sequence = vblwait->request.sequence; 625 e->event.sequence = vblwait->request.sequence;
618 if ((seq - vblwait->request.sequence) <= (1 << 23)) { 626 if ((seq - vblwait->request.sequence) <= (1 << 23)) {
619 e->event.tv_sec = now.tv_sec; 627 e->event.tv_sec = now.tv_sec;
@@ -621,6 +629,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
621 drm_vblank_put(dev, e->pipe); 629 drm_vblank_put(dev, e->pipe);
622 list_add_tail(&e->base.link, &e->base.file_priv->event_list); 630 list_add_tail(&e->base.link, &e->base.file_priv->event_list);
623 wake_up_interruptible(&e->base.file_priv->event_wait); 631 wake_up_interruptible(&e->base.file_priv->event_wait);
632 trace_drm_vblank_event_delivered(current->pid, pipe,
633 vblwait->request.sequence);
624 } else { 634 } else {
625 list_add_tail(&e->base.link, &dev->vblank_event_list); 635 list_add_tail(&e->base.link, &dev->vblank_event_list);
626 } 636 }
@@ -651,7 +661,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
651 int ret = 0; 661 int ret = 0;
652 unsigned int flags, seq, crtc; 662 unsigned int flags, seq, crtc;
653 663
654 if ((!dev->pdev->irq) || (!dev->irq_enabled)) 664 if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled))
655 return -EINVAL; 665 return -EINVAL;
656 666
657 if (vblwait->request.type & _DRM_VBLANK_SIGNAL) 667 if (vblwait->request.type & _DRM_VBLANK_SIGNAL)
@@ -751,9 +761,13 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc)
751 drm_vblank_put(dev, e->pipe); 761 drm_vblank_put(dev, e->pipe);
752 list_move_tail(&e->base.link, &e->base.file_priv->event_list); 762 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
753 wake_up_interruptible(&e->base.file_priv->event_wait); 763 wake_up_interruptible(&e->base.file_priv->event_wait);
764 trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
765 e->event.sequence);
754 } 766 }
755 767
756 spin_unlock_irqrestore(&dev->event_lock, flags); 768 spin_unlock_irqrestore(&dev->event_lock, flags);
769
770 trace_drm_vblank_event(crtc, seq);
757} 771}
758 772
759/** 773/**