Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: use pipes, not planes to label vblank data

vblank in the kernel is far simpler if it deals with pipes instead of
planes, so we're changing both user and kernel side.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Keith Packard and committed by
Dave Airlie
42f52ef8 9e44af79

+20 -53
+20 -53
drivers/gpu/drm/i915/i915_irq.c
··· 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 63 * i915_pipe_enabled - check if a pipe is enabled 101 64 * @dev: DRM device 102 65 * @pipe: pipe to check ··· 118 155 src_pitch >>= 2; 119 156 } 120 157 121 - counter[0] = drm_vblank_count(dev, i915_get_plane(dev, 0)); 122 - counter[1] = drm_vblank_count(dev, i915_get_plane(dev, 1)); 158 + counter[0] = drm_vblank_count(dev, 0); 159 + counter[1] = drm_vblank_count(dev, 1); 123 160 124 161 DRM_DEBUG("\n"); 125 162 ··· 285 322 } 286 323 } 287 324 288 - u32 i915_get_vblank_counter(struct drm_device *dev, int plane) 325 + /* Called from drm generic code, passed a 'crtc', which 326 + * we use as a pipe index 327 + */ 328 + u32 i915_get_vblank_counter(struct drm_device *dev, int pipe) 289 329 { 290 330 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 291 331 unsigned long high_frame; 292 332 unsigned long low_frame; 293 333 u32 high1, high2, low, count; 294 - int pipe; 295 334 296 - pipe = i915_get_pipe(dev, plane); 297 335 high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH; 298 336 low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; 299 337 ··· 390 426 else if (pipea_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| 391 427 PIPE_VBLANK_INTERRUPT_STATUS)) { 392 428 vblank++; 393 - drm_handle_vblank(dev, i915_get_plane(dev, 0)); 429 + drm_handle_vblank(dev, 0); 394 430 } 395 431 396 432 I915_WRITE(PIPEASTAT, pipea_stats); ··· 408 444 else if (pipeb_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| 409 445 PIPE_VBLANK_INTERRUPT_STATUS)) { 410 446 vblank++; 411 - drm_handle_vblank(dev, i915_get_plane(dev, 1)); 447 + drm_handle_vblank(dev, 1); 412 448 } 413 449 414 450 if (pipeb_stats & I915_LEGACY_BLC_EVENT_STATUS) ··· 568 604 return i915_wait_irq(dev, irqwait->irq_seq); 569 605 } 570 606 571 - int i915_enable_vblank(struct drm_device *dev, int plane) 607 + /* Called from drm generic code, passed 'crtc' which 608 + * we use as a pipe index 609 + */ 610 + int i915_enable_vblank(struct drm_device *dev, int pipe) 572 611 { 573 612 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 574 - int pipe = i915_get_pipe(dev, plane); 575 613 u32 pipestat_reg = 0; 576 614 u32 pipestat; 577 615 u32 interrupt = 0; ··· 619 653 return 0; 620 654 } 621 655 622 - void i915_disable_vblank(struct drm_device *dev, int plane) 656 + /* Called from drm generic code, passed 'crtc' which 657 + * we use as a pipe index 658 + */ 659 + void i915_disable_vblank(struct drm_device *dev, int pipe) 623 660 { 624 661 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 625 - int pipe = i915_get_pipe(dev, plane); 626 662 u32 pipestat_reg = 0; 627 663 u32 pipestat; 628 664 u32 interrupt = 0; ··· 699 731 drm_i915_private_t *dev_priv = dev->dev_private; 700 732 drm_i915_vblank_swap_t *swap = data; 701 733 drm_i915_vbl_swap_t *vbl_swap, *vbl_old; 702 - unsigned int pipe, seqtype, curseq, plane; 734 + unsigned int pipe, seqtype, curseq; 703 735 unsigned long irqflags; 704 736 struct list_head *list; 705 737 int ret; ··· 720 752 return -EINVAL; 721 753 } 722 754 723 - plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; 724 - pipe = i915_get_pipe(dev, plane); 755 + pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; 725 756 726 757 seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); 727 758 ··· 792 825 if (dev_priv->swaps_pending >= 10) { 793 826 DRM_DEBUG("Too many swaps queued\n"); 794 827 DRM_DEBUG(" pipe 0: %d pipe 1: %d\n", 795 - drm_vblank_count(dev, i915_get_plane(dev, 0)), 796 - drm_vblank_count(dev, i915_get_plane(dev, 1))); 828 + drm_vblank_count(dev, 0), 829 + drm_vblank_count(dev, 1)); 797 830 798 831 list_for_each(list, &dev_priv->vbl_swaps.head) { 799 832 vbl_old = list_entry(list, drm_i915_vbl_swap_t, head);