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

drm/i915/pfit: convert moved code to struct intel_display

The recently relocated ilk/i9xx panel fitter code is still using struct
drm_i915_private. Convert to struct intel_display.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9967c49291c725037c3266832db4d9d8451dfa38.1740564009.git.jani.nikula@intel.com

+25 -26
+25 -26
drivers/gpu/drm/i915/display/intel_pfit.c
··· 3 3 * Copyright © 2024 Intel Corporation 4 4 */ 5 5 6 - #include "i915_drv.h" 7 6 #include "i915_reg.h" 8 7 #include "i915_utils.h" 9 8 #include "intel_de.h" ··· 556 557 557 558 void ilk_pfit_enable(const struct intel_crtc_state *crtc_state) 558 559 { 560 + struct intel_display *display = to_intel_display(crtc_state); 559 561 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 560 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 561 562 const struct drm_rect *dst = &crtc_state->pch_pfit.dst; 562 563 enum pipe pipe = crtc->pipe; 563 564 int width = drm_rect_width(dst); ··· 572 573 * Force use of hard-coded filter coefficients as some pre-programmed 573 574 * values are broken, e.g. x201. 574 575 */ 575 - if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) 576 - intel_de_write_fw(dev_priv, PF_CTL(pipe), PF_ENABLE | 576 + if (display->platform.ivybridge || display->platform.haswell) 577 + intel_de_write_fw(display, PF_CTL(pipe), PF_ENABLE | 577 578 PF_FILTER_MED_3x3 | PF_PIPE_SEL_IVB(pipe)); 578 579 else 579 - intel_de_write_fw(dev_priv, PF_CTL(pipe), PF_ENABLE | 580 + intel_de_write_fw(display, PF_CTL(pipe), PF_ENABLE | 580 581 PF_FILTER_MED_3x3); 581 - intel_de_write_fw(dev_priv, PF_WIN_POS(pipe), 582 + intel_de_write_fw(display, PF_WIN_POS(pipe), 582 583 PF_WIN_XPOS(x) | PF_WIN_YPOS(y)); 583 - intel_de_write_fw(dev_priv, PF_WIN_SZ(pipe), 584 + intel_de_write_fw(display, PF_WIN_SZ(pipe), 584 585 PF_WIN_XSIZE(width) | PF_WIN_YSIZE(height)); 585 586 } 586 587 587 588 void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state) 588 589 { 590 + struct intel_display *display = to_intel_display(old_crtc_state); 589 591 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 590 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 591 592 enum pipe pipe = crtc->pipe; 592 593 593 594 /* ··· 597 598 if (!old_crtc_state->pch_pfit.enabled) 598 599 return; 599 600 600 - intel_de_write_fw(dev_priv, PF_CTL(pipe), 0); 601 - intel_de_write_fw(dev_priv, PF_WIN_POS(pipe), 0); 602 - intel_de_write_fw(dev_priv, PF_WIN_SZ(pipe), 0); 601 + intel_de_write_fw(display, PF_CTL(pipe), 0); 602 + intel_de_write_fw(display, PF_WIN_POS(pipe), 0); 603 + intel_de_write_fw(display, PF_WIN_SZ(pipe), 0); 603 604 } 604 605 605 606 void ilk_pfit_get_config(struct intel_crtc_state *crtc_state) 606 607 { 608 + struct intel_display *display = to_intel_display(crtc_state); 607 609 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 608 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 609 610 u32 ctl, pos, size; 610 611 enum pipe pipe; 611 612 612 - ctl = intel_de_read(dev_priv, PF_CTL(crtc->pipe)); 613 + ctl = intel_de_read(display, PF_CTL(crtc->pipe)); 613 614 if ((ctl & PF_ENABLE) == 0) 614 615 return; 615 616 616 - if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) 617 + if (display->platform.ivybridge || display->platform.haswell) 617 618 pipe = REG_FIELD_GET(PF_PIPE_SEL_MASK_IVB, ctl); 618 619 else 619 620 pipe = crtc->pipe; 620 621 621 622 crtc_state->pch_pfit.enabled = true; 622 623 623 - pos = intel_de_read(dev_priv, PF_WIN_POS(crtc->pipe)); 624 - size = intel_de_read(dev_priv, PF_WIN_SZ(crtc->pipe)); 624 + pos = intel_de_read(display, PF_WIN_POS(crtc->pipe)); 625 + size = intel_de_read(display, PF_WIN_SZ(crtc->pipe)); 625 626 626 627 drm_rect_init(&crtc_state->pch_pfit.dst, 627 628 REG_FIELD_GET(PF_WIN_XPOS_MASK, pos), ··· 634 635 * ivb/hsw (since we don't use the higher upscaling modes which 635 636 * differentiates them) so just WARN about this case for now. 636 637 */ 637 - drm_WARN_ON(&dev_priv->drm, pipe != crtc->pipe); 638 + drm_WARN_ON(display->drm, pipe != crtc->pipe); 638 639 } 639 640 640 641 void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state) ··· 679 680 intel_de_write(display, PFIT_CONTROL(display), 0); 680 681 } 681 682 682 - static bool i9xx_has_pfit(struct drm_i915_private *dev_priv) 683 + static bool i9xx_has_pfit(struct intel_display *display) 683 684 { 684 - if (IS_I830(dev_priv)) 685 + if (display->platform.i830) 685 686 return false; 686 687 687 - return DISPLAY_VER(dev_priv) >= 4 || 688 - IS_PINEVIEW(dev_priv) || IS_MOBILE(dev_priv); 688 + return DISPLAY_VER(display) >= 4 || 689 + display->platform.pineview || display->platform.mobile; 689 690 } 690 691 691 692 void i9xx_pfit_get_config(struct intel_crtc_state *crtc_state) 692 693 { 694 + struct intel_display *display = to_intel_display(crtc_state); 693 695 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 694 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 695 696 enum pipe pipe; 696 697 u32 tmp; 697 698 698 - if (!i9xx_has_pfit(dev_priv)) 699 + if (!i9xx_has_pfit(display)) 699 700 return; 700 701 701 - tmp = intel_de_read(dev_priv, PFIT_CONTROL(dev_priv)); 702 + tmp = intel_de_read(display, PFIT_CONTROL(display)); 702 703 if (!(tmp & PFIT_ENABLE)) 703 704 return; 704 705 705 706 /* Check whether the pfit is attached to our pipe. */ 706 - if (DISPLAY_VER(dev_priv) >= 4) 707 + if (DISPLAY_VER(display) >= 4) 707 708 pipe = REG_FIELD_GET(PFIT_PIPE_MASK, tmp); 708 709 else 709 710 pipe = PIPE_B; ··· 713 714 714 715 crtc_state->gmch_pfit.control = tmp; 715 716 crtc_state->gmch_pfit.pgm_ratios = 716 - intel_de_read(dev_priv, PFIT_PGM_RATIOS(dev_priv)); 717 + intel_de_read(display, PFIT_PGM_RATIOS(display)); 717 718 }