diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 73 |
1 files changed, 20 insertions, 53 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 862375694431..26f48932a51e 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -60,43 +60,6 @@ i915_disable_irq(drm_i915_private_t *dev_priv, u32 mask) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * i915_get_pipe - return the the pipe associated with a given plane | ||
64 | * @dev: DRM device | ||
65 | * @plane: plane to look for | ||
66 | * | ||
67 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
68 | * rather than a pipe number, since they may not always be equal. This routine | ||
69 | * maps the given @plane back to a pipe number. | ||
70 | */ | ||
71 | static int | ||
72 | i915_get_pipe(struct drm_device *dev, int plane) | ||
73 | { | ||
74 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
75 | u32 dspcntr; | ||
76 | |||
77 | dspcntr = plane ? I915_READ(DSPBCNTR) : I915_READ(DSPACNTR); | ||
78 | |||
79 | return dspcntr & DISPPLANE_SEL_PIPE_MASK ? 1 : 0; | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * i915_get_plane - return the the plane associated with a given pipe | ||
84 | * @dev: DRM device | ||
85 | * @pipe: pipe to look for | ||
86 | * | ||
87 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
88 | * rather than a plane number, since they may not always be equal. This routine | ||
89 | * maps the given @pipe back to a plane number. | ||
90 | */ | ||
91 | static int | ||
92 | i915_get_plane(struct drm_device *dev, int pipe) | ||
93 | { | ||
94 | if (i915_get_pipe(dev, 0) == pipe) | ||
95 | return 0; | ||
96 | return 1; | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * i915_pipe_enabled - check if a pipe is enabled | 63 | * i915_pipe_enabled - check if a pipe is enabled |
101 | * @dev: DRM device | 64 | * @dev: DRM device |
102 | * @pipe: pipe to check | 65 | * @pipe: pipe to check |
@@ -155,8 +118,8 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
155 | src_pitch >>= 2; | 118 | src_pitch >>= 2; |
156 | } | 119 | } |
157 | 120 | ||
158 | counter[0] = drm_vblank_count(dev, i915_get_plane(dev, 0)); | 121 | counter[0] = drm_vblank_count(dev, 0); |
159 | counter[1] = drm_vblank_count(dev, i915_get_plane(dev, 1)); | 122 | counter[1] = drm_vblank_count(dev, 1); |
160 | 123 | ||
161 | DRM_DEBUG("\n"); | 124 | DRM_DEBUG("\n"); |
162 | 125 | ||
@@ -322,15 +285,16 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
322 | } | 285 | } |
323 | } | 286 | } |
324 | 287 | ||
325 | u32 i915_get_vblank_counter(struct drm_device *dev, int plane) | 288 | /* Called from drm generic code, passed a 'crtc', which |
289 | * we use as a pipe index | ||
290 | */ | ||
291 | u32 i915_get_vblank_counter(struct drm_device *dev, int pipe) | ||
326 | { | 292 | { |
327 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 293 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
328 | unsigned long high_frame; | 294 | unsigned long high_frame; |
329 | unsigned long low_frame; | 295 | unsigned long low_frame; |
330 | u32 high1, high2, low, count; | 296 | u32 high1, high2, low, count; |
331 | int pipe; | ||
332 | 297 | ||
333 | pipe = i915_get_pipe(dev, plane); | ||
334 | high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH; | 298 | high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH; |
335 | low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; | 299 | low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; |
336 | 300 | ||
@@ -426,7 +390,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
426 | else if (pipea_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| | 390 | else if (pipea_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| |
427 | PIPE_VBLANK_INTERRUPT_STATUS)) { | 391 | PIPE_VBLANK_INTERRUPT_STATUS)) { |
428 | vblank++; | 392 | vblank++; |
429 | drm_handle_vblank(dev, i915_get_plane(dev, 0)); | 393 | drm_handle_vblank(dev, 0); |
430 | } | 394 | } |
431 | 395 | ||
432 | I915_WRITE(PIPEASTAT, pipea_stats); | 396 | I915_WRITE(PIPEASTAT, pipea_stats); |
@@ -444,7 +408,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
444 | else if (pipeb_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| | 408 | else if (pipeb_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| |
445 | PIPE_VBLANK_INTERRUPT_STATUS)) { | 409 | PIPE_VBLANK_INTERRUPT_STATUS)) { |
446 | vblank++; | 410 | vblank++; |
447 | drm_handle_vblank(dev, i915_get_plane(dev, 1)); | 411 | drm_handle_vblank(dev, 1); |
448 | } | 412 | } |
449 | 413 | ||
450 | if (pipeb_stats & I915_LEGACY_BLC_EVENT_STATUS) | 414 | if (pipeb_stats & I915_LEGACY_BLC_EVENT_STATUS) |
@@ -604,10 +568,12 @@ int i915_irq_wait(struct drm_device *dev, void *data, | |||
604 | return i915_wait_irq(dev, irqwait->irq_seq); | 568 | return i915_wait_irq(dev, irqwait->irq_seq); |
605 | } | 569 | } |
606 | 570 | ||
607 | int i915_enable_vblank(struct drm_device *dev, int plane) | 571 | /* Called from drm generic code, passed 'crtc' which |
572 | * we use as a pipe index | ||
573 | */ | ||
574 | int i915_enable_vblank(struct drm_device *dev, int pipe) | ||
608 | { | 575 | { |
609 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 576 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
610 | int pipe = i915_get_pipe(dev, plane); | ||
611 | u32 pipestat_reg = 0; | 577 | u32 pipestat_reg = 0; |
612 | u32 pipestat; | 578 | u32 pipestat; |
613 | u32 interrupt = 0; | 579 | u32 interrupt = 0; |
@@ -653,10 +619,12 @@ int i915_enable_vblank(struct drm_device *dev, int plane) | |||
653 | return 0; | 619 | return 0; |
654 | } | 620 | } |
655 | 621 | ||
656 | void i915_disable_vblank(struct drm_device *dev, int plane) | 622 | /* Called from drm generic code, passed 'crtc' which |
623 | * we use as a pipe index | ||
624 | */ | ||
625 | void i915_disable_vblank(struct drm_device *dev, int pipe) | ||
657 | { | 626 | { |
658 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 627 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
659 | int pipe = i915_get_pipe(dev, plane); | ||
660 | u32 pipestat_reg = 0; | 628 | u32 pipestat_reg = 0; |
661 | u32 pipestat; | 629 | u32 pipestat; |
662 | u32 interrupt = 0; | 630 | u32 interrupt = 0; |
@@ -731,7 +699,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
731 | drm_i915_private_t *dev_priv = dev->dev_private; | 699 | drm_i915_private_t *dev_priv = dev->dev_private; |
732 | drm_i915_vblank_swap_t *swap = data; | 700 | drm_i915_vblank_swap_t *swap = data; |
733 | drm_i915_vbl_swap_t *vbl_swap, *vbl_old; | 701 | drm_i915_vbl_swap_t *vbl_swap, *vbl_old; |
734 | unsigned int pipe, seqtype, curseq, plane; | 702 | unsigned int pipe, seqtype, curseq; |
735 | unsigned long irqflags; | 703 | unsigned long irqflags; |
736 | struct list_head *list; | 704 | struct list_head *list; |
737 | int ret; | 705 | int ret; |
@@ -752,8 +720,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
752 | return -EINVAL; | 720 | return -EINVAL; |
753 | } | 721 | } |
754 | 722 | ||
755 | plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; | 723 | pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; |
756 | pipe = i915_get_pipe(dev, plane); | ||
757 | 724 | ||
758 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); | 725 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); |
759 | 726 | ||
@@ -825,8 +792,8 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
825 | if (dev_priv->swaps_pending >= 10) { | 792 | if (dev_priv->swaps_pending >= 10) { |
826 | DRM_DEBUG("Too many swaps queued\n"); | 793 | DRM_DEBUG("Too many swaps queued\n"); |
827 | DRM_DEBUG(" pipe 0: %d pipe 1: %d\n", | 794 | DRM_DEBUG(" pipe 0: %d pipe 1: %d\n", |
828 | drm_vblank_count(dev, i915_get_plane(dev, 0)), | 795 | drm_vblank_count(dev, 0), |
829 | drm_vblank_count(dev, i915_get_plane(dev, 1))); | 796 | drm_vblank_count(dev, 1)); |
830 | 797 | ||
831 | list_for_each(list, &dev_priv->vbl_swaps.head) { | 798 | list_for_each(list, &dev_priv->vbl_swaps.head) { |
832 | vbl_old = list_entry(list, drm_i915_vbl_swap_t, head); | 799 | vbl_old = list_entry(list, drm_i915_vbl_swap_t, head); |