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

Merge tag 'drm-intel-next-2025-03-10' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next

drm/i915 feature pull #2 for v6.15:

Features and functionality:
- FBC dirty rectangle support for display version 30+ (Vinod)
- Update plane scalers via DSB based commits (Ville)
- Move runtime power status info to display power debugfs (Jani)

Refactoring and cleanups:
- Convert i915 and xe to DRM client setup (Thomas)
- Refactor and clean up CDCLK/bw/dbuf readout/sanitation (Ville)
- Conversions from drm_i915_private to struct intel_display (Jani, Suraj)
- Refactor display reset for better separation between display and core (Jani)
- Move panel fitter code together (Jani)
- Add mst and hdcp sub-structs to display structs for clarity (Jani)
- Header refactoring to clarify separation between display and i915 core (Jani)

Fixes:
- Fix DP MST max stream count to match number of pipes (Jani)
- Fix encoder HW state readout of DP MST UHBR (Imre)
- Fix ICL+ combo PHY cursor and coeff polarity programming (Ville)
- Fix pipeDMC and ATS fault handling (Ville)
- Display workarounds (Gustavo)
- Remove duplicate forward declaration (Vinod)
- Improve POWER_DOMAIN_*() macro type safety (Gustavo)
- Move CDCLK post plane programming later (Ville)

DRM core changes:
- Add client-hotplug helper (Thomas)
- Send pending hotplug events after client resume (Thomas)
- Add fb_restore and fb_set_suspend fb helper hooks (Thomas)
- Remove struct fb_probe fb helper hook (Thomas)
- Add const qualifier to drm_atomic_helper_damage_merged() (Vinod)

Xe driver changes:
- Convert i915 and xe to DRM client setup (Thomas)
- Refactor i915 compat headers (Jani)
- Fix fbdev GGTT mapping handling (Maarten)
- Figure out pxp instance from the gem object (Jani)

Merges:
- Backmerge drm-next to fix conflicts with drm-xe-next (Jani)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87o6y9gpub.fsf@intel.com

+2545 -2374
+28 -13
drivers/gpu/drm/drm_client_event.c
··· 49 49 } 50 50 EXPORT_SYMBOL(drm_client_dev_unregister); 51 51 52 + static void drm_client_hotplug(struct drm_client_dev *client) 53 + { 54 + struct drm_device *dev = client->dev; 55 + int ret; 56 + 57 + if (!client->funcs || !client->funcs->hotplug) 58 + return; 59 + 60 + if (client->hotplug_failed) 61 + return; 62 + 63 + if (client->suspended) { 64 + client->hotplug_pending = true; 65 + return; 66 + } 67 + 68 + client->hotplug_pending = false; 69 + ret = client->funcs->hotplug(client); 70 + drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 71 + if (ret) 72 + client->hotplug_failed = true; 73 + } 74 + 52 75 /** 53 76 * drm_client_dev_hotplug - Send hotplug event to clients 54 77 * @dev: DRM device ··· 84 61 void drm_client_dev_hotplug(struct drm_device *dev) 85 62 { 86 63 struct drm_client_dev *client; 87 - int ret; 88 64 89 65 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 90 66 return; ··· 94 72 } 95 73 96 74 mutex_lock(&dev->clientlist_mutex); 97 - list_for_each_entry(client, &dev->clientlist, list) { 98 - if (!client->funcs || !client->funcs->hotplug) 99 - continue; 100 - 101 - if (client->hotplug_failed) 102 - continue; 103 - 104 - ret = client->funcs->hotplug(client); 105 - drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 106 - if (ret) 107 - client->hotplug_failed = true; 108 - } 75 + list_for_each_entry(client, &dev->clientlist, list) 76 + drm_client_hotplug(client); 109 77 mutex_unlock(&dev->clientlist_mutex); 110 78 } 111 79 EXPORT_SYMBOL(drm_client_dev_hotplug); ··· 164 152 drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 165 153 166 154 client->suspended = false; 155 + 156 + if (client->hotplug_pending) 157 + drm_client_hotplug(client); 167 158 168 159 return ret; 169 160 }
+1 -1
drivers/gpu/drm/drm_damage_helper.c
··· 308 308 * True if there is valid plane damage otherwise false. 309 309 */ 310 310 bool drm_atomic_helper_damage_merged(const struct drm_plane_state *old_state, 311 - struct drm_plane_state *state, 311 + const struct drm_plane_state *state, 312 312 struct drm_rect *rect) 313 313 { 314 314 struct drm_atomic_helper_damage_iter iter;
+14 -6
drivers/gpu/drm/drm_fb_helper.c
··· 245 245 if (do_delayed) 246 246 drm_fb_helper_hotplug_event(fb_helper); 247 247 248 + if (fb_helper->funcs->fb_restore) 249 + fb_helper->funcs->fb_restore(fb_helper); 250 + 248 251 return ret; 249 252 } 250 253 ··· 757 754 */ 758 755 void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend) 759 756 { 760 - if (fb_helper && fb_helper->info) 757 + if (!fb_helper || !fb_helper->info) 758 + return; 759 + 760 + if (fb_helper->funcs->fb_set_suspend) 761 + fb_helper->funcs->fb_set_suspend(fb_helper, suspend); 762 + else 761 763 fb_set_suspend(fb_helper->info, suspend); 762 764 } 763 765 EXPORT_SYMBOL(drm_fb_helper_set_suspend); ··· 808 800 } 809 801 } 810 802 811 - fb_set_suspend(fb_helper->info, suspend); 803 + drm_fb_helper_set_suspend(fb_helper, suspend); 812 804 console_unlock(); 813 805 } 814 806 EXPORT_SYMBOL(drm_fb_helper_set_suspend_unlocked); ··· 1634 1626 struct fb_info *info; 1635 1627 int ret; 1636 1628 1629 + if (drm_WARN_ON(dev, !dev->driver->fbdev_probe)) 1630 + return -EINVAL; 1631 + 1637 1632 ret = drm_fb_helper_find_sizes(fb_helper, &sizes); 1638 1633 if (ret) { 1639 1634 /* First time: disable all crtc's.. */ ··· 1646 1635 } 1647 1636 1648 1637 /* push down into drivers */ 1649 - if (dev->driver->fbdev_probe) 1650 - ret = dev->driver->fbdev_probe(fb_helper, &sizes); 1651 - else if (fb_helper->funcs) 1652 - ret = fb_helper->funcs->fb_probe(fb_helper, &sizes); 1638 + ret = dev->driver->fbdev_probe(fb_helper, &sizes); 1653 1639 if (ret < 0) 1654 1640 return ret; 1655 1641
+1 -1
drivers/gpu/drm/i915/display/g4x_dp.c
··· 1311 1311 1312 1312 intel_encoder->devdata = devdata; 1313 1313 1314 - mutex_init(&dig_port->hdcp_mutex); 1314 + mutex_init(&dig_port->hdcp.mutex); 1315 1315 1316 1316 if (drm_encoder_init(display->drm, &intel_encoder->base, 1317 1317 &intel_dp_enc_funcs, DRM_MODE_ENCODER_TMDS,
+1 -1
drivers/gpu/drm/i915/display/g4x_hdmi.c
··· 715 715 716 716 intel_encoder->devdata = devdata; 717 717 718 - mutex_init(&dig_port->hdcp_mutex); 718 + mutex_init(&dig_port->hdcp.mutex); 719 719 720 720 if (drm_encoder_init(display->drm, &intel_encoder->base, 721 721 &intel_hdmi_enc_funcs, DRM_MODE_ENCODER_TMDS,
+4 -14
drivers/gpu/drm/i915/display/i9xx_wm.c
··· 3902 3902 mutex_unlock(&dev_priv->display.wm.wm_mutex); 3903 3903 } 3904 3904 3905 - static void g4x_wm_get_hw_state_and_sanitize(struct drm_i915_private *i915) 3906 - { 3907 - g4x_wm_get_hw_state(i915); 3908 - g4x_wm_sanitize(i915); 3909 - } 3910 - 3911 3905 static void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv) 3912 3906 { 3913 3907 struct vlv_wm_values *wm = &dev_priv->display.wm.vlv; ··· 4049 4055 mutex_unlock(&dev_priv->display.wm.wm_mutex); 4050 4056 } 4051 4057 4052 - static void vlv_wm_get_hw_state_and_sanitize(struct drm_i915_private *i915) 4053 - { 4054 - vlv_wm_get_hw_state(i915); 4055 - vlv_wm_sanitize(i915); 4056 - } 4057 - 4058 4058 /* 4059 4059 * FIXME should probably kill this and improve 4060 4060 * the real watermark readout/sanitation instead ··· 4110 4122 .initial_watermarks = vlv_initial_watermarks, 4111 4123 .optimize_watermarks = vlv_optimize_watermarks, 4112 4124 .atomic_update_watermarks = vlv_atomic_update_fifo, 4113 - .get_hw_state = vlv_wm_get_hw_state_and_sanitize, 4125 + .get_hw_state = vlv_wm_get_hw_state, 4126 + .sanitize = vlv_wm_sanitize, 4114 4127 }; 4115 4128 4116 4129 static const struct intel_wm_funcs g4x_wm_funcs = { 4117 4130 .compute_watermarks = g4x_compute_watermarks, 4118 4131 .initial_watermarks = g4x_initial_watermarks, 4119 4132 .optimize_watermarks = g4x_optimize_watermarks, 4120 - .get_hw_state = g4x_wm_get_hw_state_and_sanitize, 4133 + .get_hw_state = g4x_wm_get_hw_state, 4134 + .sanitize = g4x_wm_sanitize, 4121 4135 }; 4122 4136 4123 4137 static const struct intel_wm_funcs pnv_wm_funcs = {
+1 -1
drivers/gpu/drm/i915/display/icl_dsi.c
··· 1647 1647 if (ret) 1648 1648 return ret; 1649 1649 1650 - ret = intel_panel_fitting(pipe_config, conn_state); 1650 + ret = intel_pfit_compute_config(pipe_config, conn_state); 1651 1651 if (ret) 1652 1652 return ret; 1653 1653
+2
drivers/gpu/drm/i915/display/intel_acpi.c
··· 9 9 #include <linux/acpi.h> 10 10 #include <acpi/video.h> 11 11 12 + #include <drm/drm_print.h> 13 + 12 14 #include "i915_utils.h" 13 15 #include "intel_acpi.h" 14 16 #include "intel_display_core.h"
-1
drivers/gpu/drm/i915/display/intel_atomic.h
··· 14 14 struct drm_crtc; 15 15 struct drm_crtc_state; 16 16 struct drm_device; 17 - struct drm_i915_private; 18 17 struct drm_property; 19 18 struct intel_atomic_state; 20 19 struct intel_connector;
+82 -44
drivers/gpu/drm/i915/display/intel_atomic_plane.c
··· 36 36 37 37 #include <drm/drm_atomic_helper.h> 38 38 #include <drm/drm_blend.h> 39 + #include <drm/drm_damage_helper.h> 39 40 #include <drm/drm_fourcc.h> 40 41 #include <drm/drm_gem.h> 41 42 #include <drm/drm_gem_atomic_helper.h> 42 43 43 - #include "i915_drv.h" 44 + #include "gem/i915_gem_object.h" 44 45 #include "i915_config.h" 46 + #include "i915_scheduler_types.h" 47 + #include "i915_vma.h" 45 48 #include "i9xx_plane_regs.h" 46 49 #include "intel_atomic_plane.h" 47 50 #include "intel_cdclk.h" ··· 134 131 intel_state->ggtt_vma = NULL; 135 132 intel_state->dpt_vma = NULL; 136 133 intel_state->flags = 0; 134 + intel_state->damage = DRM_RECT_INIT(0, 0, 0, 0); 137 135 138 136 /* add reference to fb */ 139 137 if (intel_state->hw.fb) ··· 168 164 169 165 bool intel_plane_needs_physical(struct intel_plane *plane) 170 166 { 171 - struct drm_i915_private *i915 = to_i915(plane->base.dev); 167 + struct intel_display *display = to_intel_display(plane); 172 168 173 169 return plane->id == PLANE_CURSOR && 174 - DISPLAY_INFO(i915)->cursor_needs_physical; 170 + DISPLAY_INFO(display)->cursor_needs_physical; 175 171 } 176 172 177 173 bool intel_plane_can_async_flip(struct intel_plane *plane, u64 modifier) ··· 276 272 struct intel_plane *plane, 277 273 bool *need_cdclk_calc) 278 274 { 279 - struct drm_i915_private *dev_priv = to_i915(plane->base.dev); 275 + struct intel_display *display = to_intel_display(plane); 280 276 const struct intel_plane_state *plane_state = 281 277 intel_atomic_get_new_plane_state(state, plane); 282 278 struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); ··· 321 317 cdclk_state->min_cdclk[crtc->pipe]) 322 318 return 0; 323 319 324 - drm_dbg_kms(&dev_priv->drm, 320 + drm_dbg_kms(display->drm, 325 321 "[PLANE:%d:%s] min cdclk (%d kHz) > [CRTC:%d:%s] min cdclk (%d kHz)\n", 326 322 plane->base.base.id, plane->base.name, 327 323 new_crtc_state->min_cdclk[plane->id], ··· 338 334 drm_framebuffer_put(plane_state->hw.fb); 339 335 340 336 memset(&plane_state->hw, 0, sizeof(plane_state->hw)); 337 + } 338 + 339 + static void 340 + intel_plane_copy_uapi_plane_damage(struct intel_plane_state *new_plane_state, 341 + const struct intel_plane_state *old_uapi_plane_state, 342 + const struct intel_plane_state *new_uapi_plane_state) 343 + { 344 + struct intel_display *display = to_intel_display(new_plane_state); 345 + struct drm_rect *damage = &new_plane_state->damage; 346 + 347 + /* damage property tracking enabled from display version 12 onwards */ 348 + if (DISPLAY_VER(display) < 12) 349 + return; 350 + 351 + if (!drm_atomic_helper_damage_merged(&old_uapi_plane_state->uapi, 352 + &new_uapi_plane_state->uapi, 353 + damage)) 354 + /* Incase helper fails, mark whole plane region as damage */ 355 + *damage = drm_plane_state_src(&new_uapi_plane_state->uapi); 341 356 } 342 357 343 358 void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, ··· 434 411 const struct intel_crtc_state *old_crtc_state, 435 412 const struct intel_crtc_state *new_crtc_state) 436 413 { 437 - struct drm_i915_private *i915 = to_i915(plane->base.dev); 414 + struct intel_display *display = to_intel_display(plane); 438 415 439 416 if (!plane->async_flip) 440 417 return false; ··· 455 432 * extend this so other scanout parameters (stride/etc) could 456 433 * be changed as well... 457 434 */ 458 - return DISPLAY_VER(i915) < 9 || old_crtc_state->uapi.async_flip; 435 + return DISPLAY_VER(display) < 9 || old_crtc_state->uapi.async_flip; 459 436 } 460 437 461 438 static bool i9xx_must_disable_cxsr(const struct intel_crtc_state *new_crtc_state, ··· 559 536 const struct intel_plane_state *old_plane_state, 560 537 struct intel_plane_state *new_plane_state) 561 538 { 539 + struct intel_display *display = to_intel_display(new_crtc_state); 562 540 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); 563 541 struct intel_plane *plane = to_intel_plane(new_plane_state->uapi.plane); 564 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 565 542 bool mode_changed = intel_crtc_needs_modeset(new_crtc_state); 566 543 bool was_crtc_enabled = old_crtc_state->hw.active; 567 544 bool is_crtc_enabled = new_crtc_state->hw.active; 568 545 bool turn_off, turn_on, visible, was_visible; 569 546 int ret; 570 547 571 - if (DISPLAY_VER(dev_priv) >= 9 && plane->id != PLANE_CURSOR) { 548 + if (DISPLAY_VER(display) >= 9 && plane->id != PLANE_CURSOR) { 572 549 ret = skl_update_scaler_plane(new_crtc_state, new_plane_state); 573 550 if (ret) 574 551 return ret; ··· 577 554 was_visible = old_plane_state->uapi.visible; 578 555 visible = new_plane_state->uapi.visible; 579 556 580 - if (!was_crtc_enabled && drm_WARN_ON(&dev_priv->drm, was_visible)) 557 + if (!was_crtc_enabled && drm_WARN_ON(display->drm, was_visible)) 581 558 was_visible = false; 582 559 583 560 /* ··· 601 578 turn_off = was_visible && (!visible || mode_changed); 602 579 turn_on = visible && (!was_visible || mode_changed); 603 580 604 - drm_dbg_atomic(&dev_priv->drm, 581 + drm_dbg_atomic(display->drm, 605 582 "[CRTC:%d:%s] with [PLANE:%d:%s] visible %i -> %i, off %i, on %i, ms %i\n", 606 583 crtc->base.base.id, crtc->base.name, 607 584 plane->base.base.id, plane->base.name, ··· 611 588 if (visible || was_visible) 612 589 new_crtc_state->fb_bits |= plane->frontbuffer_bit; 613 590 614 - if (HAS_GMCH(dev_priv) && 591 + if (HAS_GMCH(display) && 615 592 i9xx_must_disable_cxsr(new_crtc_state, old_plane_state, new_plane_state)) 616 593 new_crtc_state->disable_cxsr = true; 617 594 618 - if ((IS_IRONLAKE(dev_priv) || IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv)) && 595 + if ((display->platform.ironlake || display->platform.sandybridge || display->platform.ivybridge) && 619 596 ilk_must_disable_cxsr(new_crtc_state, old_plane_state, new_plane_state)) 620 597 new_crtc_state->disable_cxsr = true; 621 598 ··· 708 685 struct intel_plane * 709 686 intel_crtc_get_plane(struct intel_crtc *crtc, enum plane_id plane_id) 710 687 { 711 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 688 + struct intel_display *display = to_intel_display(crtc); 712 689 struct intel_plane *plane; 713 690 714 - for_each_intel_plane_on_crtc(&i915->drm, crtc, plane) { 691 + for_each_intel_plane_on_crtc(display->drm, crtc, plane) { 715 692 if (plane->id == plane_id) 716 693 return plane; 717 694 } ··· 728 705 const struct intel_plane_state *old_plane_state = 729 706 intel_atomic_get_old_plane_state(state, plane); 730 707 const struct intel_plane_state *new_primary_crtc_plane_state; 708 + const struct intel_plane_state *old_primary_crtc_plane_state; 731 709 struct intel_crtc *crtc = intel_crtc_for_pipe(display, plane->pipe); 732 710 const struct intel_crtc_state *old_crtc_state = 733 711 intel_atomic_get_old_crtc_state(state, crtc); ··· 743 719 744 720 new_primary_crtc_plane_state = 745 721 intel_atomic_get_new_plane_state(state, primary_crtc_plane); 722 + old_primary_crtc_plane_state = 723 + intel_atomic_get_old_plane_state(state, primary_crtc_plane); 746 724 } else { 747 725 new_primary_crtc_plane_state = new_plane_state; 726 + old_primary_crtc_plane_state = old_plane_state; 748 727 } 728 + 729 + intel_plane_copy_uapi_plane_damage(new_plane_state, 730 + old_primary_crtc_plane_state, 731 + new_primary_crtc_plane_state); 749 732 750 733 intel_plane_copy_uapi_to_hw_state(new_plane_state, 751 734 new_primary_crtc_plane_state, ··· 818 787 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 819 788 820 789 trace_intel_plane_update_noarm(plane_state, crtc); 790 + 791 + if (plane->fbc) 792 + intel_fbc_dirty_rect_update_noarm(dsb, plane); 821 793 822 794 if (plane->update_noarm) 823 795 plane->update_noarm(dsb, plane, crtc_state, plane_state); ··· 960 926 struct intel_atomic_state *state, 961 927 struct intel_crtc *crtc) 962 928 { 963 - struct drm_i915_private *i915 = to_i915(state->base.dev); 929 + struct intel_display *display = to_intel_display(state); 964 930 965 - if (DISPLAY_VER(i915) >= 9) 931 + if (DISPLAY_VER(display) >= 9) 966 932 skl_crtc_planes_update_arm(dsb, state, crtc); 967 933 else 968 934 i9xx_crtc_planes_update_arm(dsb, state, crtc); ··· 973 939 int min_scale, int max_scale, 974 940 bool can_position) 975 941 { 976 - struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); 942 + struct intel_display *display = to_intel_display(plane_state); 977 943 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); 978 944 struct drm_framebuffer *fb = plane_state->hw.fb; 979 945 struct drm_rect *src = &plane_state->uapi.src; ··· 993 959 hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); 994 960 vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); 995 961 if (hscale < 0 || vscale < 0) { 996 - drm_dbg_kms(&i915->drm, 962 + drm_dbg_kms(display->drm, 997 963 "[PLANE:%d:%s] invalid scaling "DRM_RECT_FP_FMT " -> " DRM_RECT_FMT "\n", 998 964 plane->base.base.id, plane->base.name, 999 965 DRM_RECT_FP_ARG(src), DRM_RECT_ARG(dst)); ··· 1010 976 1011 977 if (!can_position && plane_state->uapi.visible && 1012 978 !drm_rect_equals(dst, clip)) { 1013 - drm_dbg_kms(&i915->drm, 979 + drm_dbg_kms(display->drm, 1014 980 "[PLANE:%d:%s] plane (" DRM_RECT_FMT ") must cover entire CRTC (" DRM_RECT_FMT ")\n", 1015 981 plane->base.base.id, plane->base.name, 1016 982 DRM_RECT_ARG(dst), DRM_RECT_ARG(clip)); ··· 1025 991 1026 992 int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state) 1027 993 { 1028 - struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev); 994 + struct intel_display *display = to_intel_display(plane_state); 1029 995 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); 1030 996 const struct drm_framebuffer *fb = plane_state->hw.fb; 1031 997 struct drm_rect *src = &plane_state->uapi.src; ··· 1059 1025 if (fb->format->format == DRM_FORMAT_RGB565 && rotated) { 1060 1026 hsub = 2; 1061 1027 vsub = 2; 1062 - } else if (DISPLAY_VER(i915) >= 20 && 1028 + } else if (DISPLAY_VER(display) >= 20 && 1063 1029 intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) { 1064 1030 /* 1065 1031 * This allows NV12 and P0xx formats to have odd size and/or odd 1066 - * source coordinates on DISPLAY_VER(i915) >= 20 1032 + * source coordinates on DISPLAY_VER(display) >= 20 1067 1033 */ 1068 1034 hsub = 1; 1069 1035 vsub = 1; 1070 1036 1071 1037 /* Wa_16023981245 */ 1072 - if ((DISPLAY_VERx100(i915) == 2000 || 1073 - DISPLAY_VERx100(i915) == 3000) && 1038 + if ((DISPLAY_VERx100(display) == 2000 || 1039 + DISPLAY_VERx100(display) == 3000) && 1074 1040 src_x % 2 != 0) 1075 1041 hsub = 2; 1076 1042 } else { ··· 1082 1048 hsub = vsub = max(hsub, vsub); 1083 1049 1084 1050 if (src_x % hsub || src_w % hsub) { 1085 - drm_dbg_kms(&i915->drm, 1051 + drm_dbg_kms(display->drm, 1086 1052 "[PLANE:%d:%s] src x/w (%u, %u) must be a multiple of %u (rotated: %s)\n", 1087 1053 plane->base.base.id, plane->base.name, 1088 1054 src_x, src_w, hsub, str_yes_no(rotated)); ··· 1090 1056 } 1091 1057 1092 1058 if (src_y % vsub || src_h % vsub) { 1093 - drm_dbg_kms(&i915->drm, 1059 + drm_dbg_kms(display->drm, 1094 1060 "[PLANE:%d:%s] src y/h (%u, %u) must be a multiple of %u (rotated: %s)\n", 1095 1061 plane->base.base.id, plane->base.name, 1096 1062 src_y, src_h, vsub, str_yes_no(rotated)); ··· 1153 1119 { 1154 1120 struct i915_sched_attr attr = { .priority = I915_PRIORITY_DISPLAY }; 1155 1121 struct intel_plane *plane = to_intel_plane(_plane); 1122 + struct intel_display *display = to_intel_display(plane); 1156 1123 struct intel_plane_state *new_plane_state = 1157 1124 to_intel_plane_state(_new_plane_state); 1158 1125 struct intel_atomic_state *state = 1159 1126 to_intel_atomic_state(new_plane_state->uapi.state); 1160 - struct drm_i915_private *dev_priv = to_i915(plane->base.dev); 1161 1127 struct intel_plane_state *old_plane_state = 1162 1128 intel_atomic_get_old_plane_state(state, plane); 1163 1129 struct drm_gem_object *obj = intel_fb_bo(new_plane_state->hw.fb); ··· 1215 1181 * that are not quite steady state without resorting to forcing 1216 1182 * maximum clocks following a vblank miss (see do_rps_boost()). 1217 1183 */ 1218 - intel_display_rps_mark_interactive(dev_priv, state, true); 1184 + intel_display_rps_mark_interactive(display, state, true); 1219 1185 1220 1186 return 0; 1221 1187 ··· 1236 1202 intel_cleanup_plane_fb(struct drm_plane *plane, 1237 1203 struct drm_plane_state *_old_plane_state) 1238 1204 { 1205 + struct intel_display *display = to_intel_display(plane->dev); 1239 1206 struct intel_plane_state *old_plane_state = 1240 1207 to_intel_plane_state(_old_plane_state); 1241 1208 struct intel_atomic_state *state = 1242 1209 to_intel_atomic_state(old_plane_state->uapi.state); 1243 - struct drm_i915_private *dev_priv = to_i915(plane->dev); 1244 1210 struct drm_gem_object *obj = intel_fb_bo(old_plane_state->hw.fb); 1245 1211 1246 1212 if (!obj) 1247 1213 return; 1248 1214 1249 - intel_display_rps_mark_interactive(dev_priv, state, false); 1215 + intel_display_rps_mark_interactive(display, state, false); 1250 1216 1251 1217 intel_plane_unpin_fb(old_plane_state); 1252 1218 } ··· 1335 1301 struct intel_crtc *crtc) 1336 1302 { 1337 1303 struct intel_display *display = to_intel_display(state); 1338 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 1339 1304 struct intel_crtc_state *crtc_state = 1340 1305 intel_atomic_get_new_crtc_state(state, crtc); 1341 1306 struct intel_plane_state *plane_state; 1342 1307 struct intel_plane *plane; 1343 1308 int i; 1344 1309 1345 - if (DISPLAY_VER(dev_priv) < 11) 1310 + if (DISPLAY_VER(display) < 11) 1346 1311 return 0; 1347 1312 1348 1313 /* ··· 1369 1336 if ((crtc_state->nv12_planes & BIT(plane->id)) == 0) 1370 1337 continue; 1371 1338 1372 - for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, y_plane) { 1339 + for_each_intel_plane_on_crtc(display->drm, crtc, y_plane) { 1373 1340 if (!icl_is_nv12_y_plane(display, y_plane->id)) 1374 1341 continue; 1375 1342 ··· 1384 1351 } 1385 1352 1386 1353 if (!y_plane_state) { 1387 - drm_dbg_kms(&dev_priv->drm, 1354 + drm_dbg_kms(display->drm, 1388 1355 "[CRTC:%d:%s] need %d free Y planes for planar YUV\n", 1389 1356 crtc->base.base.id, crtc->base.name, 1390 1357 hweight8(crtc_state->nv12_planes)); ··· 1401 1368 struct intel_crtc *crtc, 1402 1369 u8 plane_ids_mask) 1403 1370 { 1404 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 1371 + struct intel_display *display = to_intel_display(state); 1405 1372 struct intel_plane *plane; 1406 1373 1407 - for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) { 1374 + for_each_intel_plane_on_crtc(display->drm, crtc, plane) { 1408 1375 struct intel_plane_state *plane_state; 1409 1376 1410 1377 if ((plane_ids_mask & BIT(plane->id)) == 0) ··· 1431 1398 new_crtc_state->enabled_planes); 1432 1399 } 1433 1400 1434 - static bool active_planes_affects_min_cdclk(struct drm_i915_private *dev_priv) 1401 + static bool active_planes_affects_min_cdclk(struct intel_display *display) 1435 1402 { 1436 1403 /* See {hsw,vlv,ivb}_plane_ratio() */ 1437 - return IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv) || 1438 - IS_CHERRYVIEW(dev_priv) || IS_VALLEYVIEW(dev_priv) || 1439 - IS_IVYBRIDGE(dev_priv); 1404 + return display->platform.broadwell || display->platform.haswell || 1405 + display->platform.cherryview || display->platform.valleyview || 1406 + display->platform.ivybridge; 1440 1407 } 1441 1408 1442 1409 static u8 intel_joiner_affected_planes(struct intel_atomic_state *state, ··· 1515 1482 1516 1483 int intel_atomic_check_planes(struct intel_atomic_state *state) 1517 1484 { 1518 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 1485 + struct intel_display *display = to_intel_display(state); 1519 1486 struct intel_crtc_state *old_crtc_state, *new_crtc_state; 1520 1487 struct intel_plane_state __maybe_unused *plane_state; 1521 1488 struct intel_plane *plane; ··· 1529 1496 for_each_new_intel_plane_in_state(state, plane, plane_state, i) { 1530 1497 ret = intel_plane_atomic_check(state, plane); 1531 1498 if (ret) { 1532 - drm_dbg_atomic(&dev_priv->drm, 1499 + drm_dbg_atomic(display->drm, 1533 1500 "[PLANE:%d:%s] atomic driver check failed\n", 1534 1501 plane->base.base.id, plane->base.name); 1535 1502 return ret; ··· 1549 1516 * the planes' minimum cdclk calculation. Add such planes 1550 1517 * to the state before we compute the minimum cdclk. 1551 1518 */ 1552 - if (!active_planes_affects_min_cdclk(dev_priv)) 1519 + if (!active_planes_affects_min_cdclk(display)) 1553 1520 continue; 1554 1521 1555 1522 old_active_planes = old_crtc_state->active_planes & ~BIT(PLANE_CURSOR); ··· 1564 1531 } 1565 1532 1566 1533 return 0; 1534 + } 1535 + 1536 + u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_state) 1537 + { 1538 + return i915_ggtt_offset(plane_state->ggtt_vma); 1567 1539 }
+2
drivers/gpu/drm/i915/display/intel_atomic_plane.h
··· 88 88 struct intel_crtc *crtc); 89 89 int intel_atomic_check_planes(struct intel_atomic_state *state); 90 90 91 + u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_state); 92 + 91 93 #endif /* __INTEL_ATOMIC_PLANE_H__ */
+3 -1
drivers/gpu/drm/i915/display/intel_audio.c
··· 190 190 */ 191 191 static bool needs_wa_14020863754(struct intel_display *display) 192 192 { 193 - return DISPLAY_VER(display) == 20 || display->platform.battlemage; 193 + return DISPLAY_VERx100(display) == 3000 || 194 + DISPLAY_VERx100(display) == 2000 || 195 + DISPLAY_VERx100(display) == 1401; 194 196 } 195 197 196 198 /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+2 -3
drivers/gpu/drm/i915/display/intel_bios.c
··· 2902 2902 static void 2903 2903 init_vbt_missing_defaults(struct intel_display *display) 2904 2904 { 2905 - struct drm_i915_private *i915 = to_i915(display->drm); 2906 2905 unsigned int ports = DISPLAY_RUNTIME_INFO(display)->port_mask; 2907 2906 enum port port; 2908 2907 ··· 2911 2912 for_each_port_masked(port, ports) { 2912 2913 struct intel_bios_encoder_data *devdata; 2913 2914 struct child_device_config *child; 2914 - enum phy phy = intel_port_to_phy(i915, port); 2915 + enum phy phy = intel_port_to_phy(display, port); 2915 2916 2916 2917 /* 2917 2918 * VBT has the TypeC mode (native,TBT/USB) and we don't want 2918 2919 * to detect it. 2919 2920 */ 2920 - if (intel_phy_is_tc(i915, phy)) 2921 + if (intel_phy_is_tc(display, phy)) 2921 2922 continue; 2922 2923 2923 2924 /* Create fake child device config */
+56 -18
drivers/gpu/drm/i915/display/intel_bw.c
··· 806 806 return DIV_ROUND_UP_ULL(mul_u32_u32(intel_bw_crtc_data_rate(crtc_state), 10), 512); 807 807 } 808 808 809 - void intel_bw_crtc_update(struct intel_bw_state *bw_state, 810 - const struct intel_crtc_state *crtc_state) 811 - { 812 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 813 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 814 - 815 - bw_state->data_rate[crtc->pipe] = 816 - intel_bw_crtc_data_rate(crtc_state); 817 - bw_state->num_active_planes[crtc->pipe] = 818 - intel_bw_crtc_num_active_planes(crtc_state); 819 - bw_state->force_check_qgv = true; 820 - 821 - drm_dbg_kms(&i915->drm, "pipe %c data rate %u num active planes %u\n", 822 - pipe_name(crtc->pipe), 823 - bw_state->data_rate[crtc->pipe], 824 - bw_state->num_active_planes[crtc->pipe]); 825 - } 826 - 827 809 static unsigned int intel_bw_num_active_planes(struct drm_i915_private *dev_priv, 828 810 const struct intel_bw_state *bw_state) 829 811 { ··· 1402 1420 new_bw_state->force_check_qgv = false; 1403 1421 1404 1422 return 0; 1423 + } 1424 + 1425 + static void intel_bw_crtc_update(struct intel_bw_state *bw_state, 1426 + const struct intel_crtc_state *crtc_state) 1427 + { 1428 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1429 + struct drm_i915_private *i915 = to_i915(crtc->base.dev); 1430 + 1431 + bw_state->data_rate[crtc->pipe] = 1432 + intel_bw_crtc_data_rate(crtc_state); 1433 + bw_state->num_active_planes[crtc->pipe] = 1434 + intel_bw_crtc_num_active_planes(crtc_state); 1435 + bw_state->force_check_qgv = true; 1436 + 1437 + drm_dbg_kms(&i915->drm, "pipe %c data rate %u num active planes %u\n", 1438 + pipe_name(crtc->pipe), 1439 + bw_state->data_rate[crtc->pipe], 1440 + bw_state->num_active_planes[crtc->pipe]); 1441 + } 1442 + 1443 + void intel_bw_update_hw_state(struct intel_display *display) 1444 + { 1445 + struct intel_bw_state *bw_state = 1446 + to_intel_bw_state(display->bw.obj.state); 1447 + struct intel_crtc *crtc; 1448 + 1449 + if (DISPLAY_VER(display) < 9) 1450 + return; 1451 + 1452 + bw_state->active_pipes = 0; 1453 + 1454 + for_each_intel_crtc(display->drm, crtc) { 1455 + const struct intel_crtc_state *crtc_state = 1456 + to_intel_crtc_state(crtc->base.state); 1457 + enum pipe pipe = crtc->pipe; 1458 + 1459 + if (crtc_state->hw.active) 1460 + bw_state->active_pipes |= BIT(pipe); 1461 + 1462 + if (DISPLAY_VER(display) >= 11) 1463 + intel_bw_crtc_update(bw_state, crtc_state); 1464 + } 1465 + } 1466 + 1467 + void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc) 1468 + { 1469 + struct intel_display *display = to_intel_display(crtc); 1470 + struct intel_bw_state *bw_state = 1471 + to_intel_bw_state(display->bw.obj.state); 1472 + enum pipe pipe = crtc->pipe; 1473 + 1474 + if (DISPLAY_VER(display) < 9) 1475 + return; 1476 + 1477 + bw_state->data_rate[pipe] = 0; 1478 + bw_state->num_active_planes[pipe] = 0; 1405 1479 } 1406 1480 1407 1481 static struct intel_global_state *
+4 -2
drivers/gpu/drm/i915/display/intel_bw.h
··· 14 14 15 15 struct drm_i915_private; 16 16 struct intel_atomic_state; 17 + struct intel_crtc; 17 18 struct intel_crtc_state; 19 + struct intel_display; 18 20 19 21 struct intel_dbuf_bw { 20 22 unsigned int max_bw[I915_MAX_DBUF_SLICES]; ··· 75 73 void intel_bw_init_hw(struct drm_i915_private *dev_priv); 76 74 int intel_bw_init(struct drm_i915_private *dev_priv); 77 75 int intel_bw_atomic_check(struct intel_atomic_state *state); 78 - void intel_bw_crtc_update(struct intel_bw_state *bw_state, 79 - const struct intel_crtc_state *crtc_state); 80 76 int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv, 81 77 u32 points_mask); 82 78 int intel_bw_calc_min_cdclk(struct intel_atomic_state *state, 83 79 bool *need_cdclk_calc); 84 80 int intel_bw_min_cdclk(struct drm_i915_private *i915, 85 81 const struct intel_bw_state *bw_state); 82 + void intel_bw_update_hw_state(struct intel_display *display); 83 + void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc); 86 84 87 85 #endif /* __INTEL_BW_H__ */
+29 -1
drivers/gpu/drm/i915/display/intel_cdclk.c
··· 2788 2788 return min_cdclk; 2789 2789 } 2790 2790 2791 - int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) 2791 + static int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) 2792 2792 { 2793 2793 int min_cdclk; 2794 2794 ··· 3338 3338 new_cdclk_state->actual.voltage_level); 3339 3339 3340 3340 return 0; 3341 + } 3342 + 3343 + void intel_cdclk_update_hw_state(struct intel_display *display) 3344 + { 3345 + struct intel_cdclk_state *cdclk_state = 3346 + to_intel_cdclk_state(display->cdclk.obj.state); 3347 + struct intel_crtc *crtc; 3348 + 3349 + cdclk_state->active_pipes = 0; 3350 + 3351 + for_each_intel_crtc(display->drm, crtc) { 3352 + const struct intel_crtc_state *crtc_state = 3353 + to_intel_crtc_state(crtc->base.state); 3354 + enum pipe pipe = crtc->pipe; 3355 + 3356 + if (crtc_state->hw.active) 3357 + cdclk_state->active_pipes |= BIT(pipe); 3358 + 3359 + cdclk_state->min_cdclk[pipe] = intel_crtc_compute_min_cdclk(crtc_state); 3360 + cdclk_state->min_voltage_level[pipe] = crtc_state->min_voltage_level; 3361 + } 3362 + } 3363 + 3364 + void intel_cdclk_crtc_disable_noatomic(struct intel_crtc *crtc) 3365 + { 3366 + struct intel_display *display = to_intel_display(crtc); 3367 + 3368 + intel_cdclk_update_hw_state(display); 3341 3369 } 3342 3370 3343 3371 static int intel_compute_max_dotclk(struct intel_display *display)
+3 -1
drivers/gpu/drm/i915/display/intel_cdclk.h
··· 12 12 #include "intel_global_state.h" 13 13 14 14 struct intel_atomic_state; 15 + struct intel_crtc; 15 16 struct intel_crtc_state; 16 17 struct intel_display; 17 18 ··· 59 58 bool disable_pipes; 60 59 }; 61 60 62 - int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state); 63 61 void intel_cdclk_init_hw(struct intel_display *display); 64 62 void intel_cdclk_uninit_hw(struct intel_display *display); 65 63 void intel_init_cdclk_hooks(struct intel_display *display); ··· 83 83 int intel_cdclk_state_set_joined_mbus(struct intel_atomic_state *state, bool joined_mbus); 84 84 struct intel_cdclk_state * 85 85 intel_atomic_get_cdclk_state(struct intel_atomic_state *state); 86 + void intel_cdclk_update_hw_state(struct intel_display *display); 87 + void intel_cdclk_crtc_disable_noatomic(struct intel_crtc *crtc); 86 88 87 89 #define to_intel_cdclk_state(global_state) \ 88 90 container_of_const((global_state), struct intel_cdclk_state, base)
+2
drivers/gpu/drm/i915/display/intel_combo_phy_regs.h
··· 133 133 #define TX_TRAINING_EN REG_BIT(31) 134 134 #define TAP2_DISABLE REG_BIT(30) 135 135 #define TAP3_DISABLE REG_BIT(29) 136 + #define CURSOR_PROGRAM REG_BIT(26) 137 + #define COEFF_POLARITY REG_BIT(25) 136 138 #define SCALING_MODE_SEL_MASK REG_GENMASK(20, 18) 137 139 #define SCALING_MODE_SEL(x) REG_FIELD_PREP(SCALING_MODE_SEL_MASK, (x)) 138 140 #define RTERM_SELECT_MASK REG_GENMASK(5, 3)
+2 -2
drivers/gpu/drm/i915/display/intel_connector.c
··· 145 145 146 146 drm_connector_cleanup(connector); 147 147 148 - if (intel_connector->port) 149 - drm_dp_mst_put_port_malloc(intel_connector->port); 148 + if (intel_connector->mst.port) 149 + drm_dp_mst_put_port_malloc(intel_connector->mst.port); 150 150 151 151 kfree(connector); 152 152 }
+1
drivers/gpu/drm/i915/display/intel_crt.c
··· 54 54 #include "intel_load_detect.h" 55 55 #include "intel_pch_display.h" 56 56 #include "intel_pch_refclk.h" 57 + #include "intel_pfit.h" 57 58 58 59 /* Here's the desired hotplug mode */ 59 60 #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_ENABLE | \
+20 -19
drivers/gpu/drm/i915/display/intel_ddi.c
··· 70 70 #include "intel_lspcon.h" 71 71 #include "intel_mg_phy_regs.h" 72 72 #include "intel_modeset_lock.h" 73 + #include "intel_pfit.h" 73 74 #include "intel_pps.h" 74 75 #include "intel_psr.h" 75 76 #include "intel_quirks.h" ··· 188 187 return DDI_BUF_CTL(port); 189 188 } 190 189 191 - void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv, 192 - enum port port) 190 + void intel_wait_ddi_buf_idle(struct intel_display *display, enum port port) 193 191 { 194 - struct intel_display *display = &dev_priv->display; 195 - 196 192 /* 197 193 * Bspec's platform specific timeouts: 198 194 * MTL+ : 100 us ··· 888 890 encoder->base.base.id, encoder->base.name); 889 891 890 892 if (!mst_pipe_mask && dp128b132b_pipe_mask) { 891 - struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 893 + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); 892 894 893 895 /* 894 896 * If we don't have 8b/10b MST, but have more than one ··· 900 902 * we don't expect MST to have been enabled at that point, and 901 903 * can assume it's SST. 902 904 */ 903 - if (hweight8(dp128b132b_pipe_mask) > 1 || intel_dp->is_mst) 905 + if (hweight8(dp128b132b_pipe_mask) > 1 || 906 + intel_dp_mst_encoder_active_links(dig_port)) 904 907 mst_pipe_mask = dp128b132b_pipe_mask; 905 908 } 906 909 ··· 1193 1194 /* Set PORT_TX_DW5 */ 1194 1195 val = intel_de_read(dev_priv, ICL_PORT_TX_DW5_LN(0, phy)); 1195 1196 val &= ~(SCALING_MODE_SEL_MASK | RTERM_SELECT_MASK | 1196 - TAP2_DISABLE | TAP3_DISABLE); 1197 + COEFF_POLARITY | CURSOR_PROGRAM | 1198 + TAP2_DISABLE | TAP3_DISABLE); 1197 1199 val |= SCALING_MODE_SEL(0x2); 1198 1200 val |= RTERM_SELECT(0x6); 1199 1201 val |= TAP3_DISABLE; ··· 3095 3095 intel_de_rmw(dev_priv, DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE, 0); 3096 3096 3097 3097 if (DISPLAY_VER(display) >= 14) 3098 - intel_wait_ddi_buf_idle(dev_priv, port); 3098 + intel_wait_ddi_buf_idle(display, port); 3099 3099 3100 3100 mtl_ddi_disable_d2d(encoder); 3101 3101 ··· 3107 3107 intel_ddi_disable_fec(encoder, crtc_state); 3108 3108 3109 3109 if (DISPLAY_VER(display) < 14) 3110 - intel_wait_ddi_buf_idle(dev_priv, port); 3110 + intel_wait_ddi_buf_idle(display, port); 3111 3111 3112 3112 intel_ddi_wait_for_fec_status(encoder, crtc_state, false); 3113 3113 } ··· 4131 4131 } else if (ddi_mode == TRANS_DDI_MODE_SELECT_DP_MST) { 4132 4132 intel_ddi_read_func_ctl_dp_mst(encoder, pipe_config, ddi_func_ctl); 4133 4133 } else if (ddi_mode == TRANS_DDI_MODE_SELECT_FDI_OR_128B132B && HAS_DP20(display)) { 4134 - struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 4134 + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); 4135 4135 4136 4136 /* 4137 4137 * If this is true, we know we're being called from mst stream 4138 4138 * encoder's ->get_config(). 4139 4139 */ 4140 - if (intel_dp->is_mst) 4140 + if (intel_dp_mst_encoder_active_links(dig_port)) 4141 4141 intel_ddi_read_func_ctl_dp_mst(encoder, pipe_config, ddi_func_ctl); 4142 4142 else 4143 4143 intel_ddi_read_func_ctl_dp_sst(encoder, pipe_config, ddi_func_ctl); ··· 4583 4583 intel_display_power_flush_work(display); 4584 4584 4585 4585 drm_encoder_cleanup(encoder); 4586 - kfree(dig_port->hdcp_port_data.streams); 4586 + kfree(dig_port->hdcp.port_data.streams); 4587 4587 kfree(dig_port); 4588 4588 } 4589 4589 ··· 4661 4661 static int intel_hdmi_reset_link(struct intel_encoder *encoder, 4662 4662 struct drm_modeset_acquire_ctx *ctx) 4663 4663 { 4664 + struct intel_display *display = to_intel_display(encoder); 4664 4665 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 4665 4666 struct intel_hdmi *hdmi = enc_to_intel_hdmi(encoder); 4666 4667 struct intel_connector *connector = hdmi->attached_connector; ··· 4728 4727 * would be perfectly happy if were to just reconfigure 4729 4728 * the SCDC settings on the fly. 4730 4729 */ 4731 - return intel_modeset_commit_pipes(dev_priv, BIT(crtc->pipe), ctx); 4730 + return intel_modeset_commit_pipes(display, BIT(crtc->pipe), ctx); 4732 4731 } 4733 4732 4734 4733 static void intel_ddi_link_check(struct intel_encoder *encoder) ··· 5102 5101 return; 5103 5102 } 5104 5103 5105 - phy = intel_port_to_phy(dev_priv, port); 5104 + phy = intel_port_to_phy(display, port); 5106 5105 5107 5106 /* 5108 5107 * On platforms with HTI (aka HDPORT), if it's enabled at boot it may ··· 5139 5138 return; 5140 5139 } 5141 5140 5142 - if (intel_phy_is_snps(dev_priv, phy) && 5141 + if (intel_phy_is_snps(display, phy) && 5143 5142 dev_priv->display.snps.phy_failed_calibration & BIT(phy)) { 5144 5143 drm_dbg_kms(&dev_priv->drm, 5145 5144 "SNPS PHY %c failed to calibrate, proceeding anyway\n", ··· 5162 5161 port_name(port - PORT_D_XELPD + PORT_D), 5163 5162 phy_name(phy)); 5164 5163 } else if (DISPLAY_VER(dev_priv) >= 12) { 5165 - enum tc_port tc_port = intel_port_to_tc(dev_priv, port); 5164 + enum tc_port tc_port = intel_port_to_tc(display, port); 5166 5165 5167 5166 drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs, 5168 5167 DRM_MODE_ENCODER_TMDS, ··· 5172 5171 tc_port != TC_PORT_NONE ? "TC" : "", 5173 5172 tc_port != TC_PORT_NONE ? tc_port_name(tc_port) : phy_name(phy)); 5174 5173 } else if (DISPLAY_VER(dev_priv) >= 11) { 5175 - enum tc_port tc_port = intel_port_to_tc(dev_priv, port); 5174 + enum tc_port tc_port = intel_port_to_tc(display, port); 5176 5175 5177 5176 drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs, 5178 5177 DRM_MODE_ENCODER_TMDS, ··· 5189 5188 5190 5189 intel_encoder_link_check_init(encoder, intel_ddi_link_check); 5191 5190 5192 - mutex_init(&dig_port->hdcp_mutex); 5193 - dig_port->num_hdcp_streams = 0; 5191 + mutex_init(&dig_port->hdcp.mutex); 5192 + dig_port->hdcp.num_streams = 0; 5194 5193 5195 5194 encoder->hotplug = intel_ddi_hotplug; 5196 5195 encoder->compute_output_type = intel_ddi_compute_output_type;
+1 -3
drivers/gpu/drm/i915/display/intel_ddi.h
··· 9 9 #include "i915_reg_defs.h" 10 10 11 11 struct drm_connector_state; 12 - struct drm_i915_private; 13 12 struct intel_atomic_state; 14 13 struct intel_bios_encoder_data; 15 14 struct intel_connector; ··· 53 54 struct intel_shared_dpll *icl_ddi_combo_get_pll(struct intel_encoder *encoder); 54 55 void hsw_prepare_dp_ddi_buffers(struct intel_encoder *encoder, 55 56 const struct intel_crtc_state *crtc_state); 56 - void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv, 57 - enum port port); 57 + void intel_wait_ddi_buf_idle(struct intel_display *display, enum port port); 58 58 void intel_ddi_init(struct intel_display *display, 59 59 const struct intel_bios_encoder_data *devdata); 60 60 bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
-1
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
··· 8 8 9 9 #include <linux/types.h> 10 10 11 - struct drm_i915_private; 12 11 struct intel_encoder; 13 12 struct intel_crtc_state; 14 13
+593 -771
drivers/gpu/drm/i915/display/intel_display.c
··· 104 104 #include "intel_pch_display.h" 105 105 #include "intel_pch_refclk.h" 106 106 #include "intel_pcode.h" 107 + #include "intel_pfit.h" 107 108 #include "intel_pipe_crc.h" 108 109 #include "intel_plane_initial.h" 109 110 #include "intel_pmdemand.h" ··· 182 181 return hpll; 183 182 } 184 183 185 - void intel_update_czclk(struct drm_i915_private *dev_priv) 184 + void intel_update_czclk(struct intel_display *display) 186 185 { 187 - if (!(IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))) 186 + struct drm_i915_private *dev_priv = to_i915(display->drm); 187 + 188 + if (!display->platform.valleyview && !display->platform.cherryview) 188 189 return; 189 190 190 191 dev_priv->czclk_freq = vlv_get_cck_clock_hpll(dev_priv, "czclk", 191 192 CCK_CZ_CLOCK_CONTROL); 192 193 193 - drm_dbg(&dev_priv->drm, "CZ clock rate: %d kHz\n", 194 - dev_priv->czclk_freq); 194 + drm_dbg_kms(display->drm, "CZ clock rate: %d kHz\n", dev_priv->czclk_freq); 195 195 } 196 196 197 197 static bool is_hdr_mode(const struct intel_crtc_state *crtc_state) ··· 203 201 204 202 /* WA Display #0827: Gen9:all */ 205 203 static void 206 - skl_wa_827(struct drm_i915_private *dev_priv, enum pipe pipe, bool enable) 204 + skl_wa_827(struct intel_display *display, enum pipe pipe, bool enable) 207 205 { 208 - intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), 206 + intel_de_rmw(display, CLKGATE_DIS_PSL(pipe), 209 207 DUPS1_GATING_DIS | DUPS2_GATING_DIS, 210 208 enable ? DUPS1_GATING_DIS | DUPS2_GATING_DIS : 0); 211 209 } 212 210 213 211 /* Wa_2006604312:icl,ehl */ 214 212 static void 215 - icl_wa_scalerclkgating(struct drm_i915_private *dev_priv, enum pipe pipe, 213 + icl_wa_scalerclkgating(struct intel_display *display, enum pipe pipe, 216 214 bool enable) 217 215 { 218 - intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), 216 + intel_de_rmw(display, CLKGATE_DIS_PSL(pipe), 219 217 DPFR_GATING_DIS, 220 218 enable ? DPFR_GATING_DIS : 0); 221 219 } 222 220 223 221 /* Wa_1604331009:icl,jsl,ehl */ 224 222 static void 225 - icl_wa_cursorclkgating(struct drm_i915_private *dev_priv, enum pipe pipe, 223 + icl_wa_cursorclkgating(struct intel_display *display, enum pipe pipe, 226 224 bool enable) 227 225 { 228 - intel_de_rmw(dev_priv, CLKGATE_DIS_PSL(pipe), 226 + intel_de_rmw(display, CLKGATE_DIS_PSL(pipe), 229 227 CURSOR_GATING_DIS, 230 228 enable ? CURSOR_GATING_DIS : 0); 231 229 } ··· 405 403 static void 406 404 intel_wait_for_pipe_off(const struct intel_crtc_state *old_crtc_state) 407 405 { 406 + struct intel_display *display = to_intel_display(old_crtc_state); 408 407 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 409 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 410 408 411 - if (DISPLAY_VER(dev_priv) >= 4) { 409 + if (DISPLAY_VER(display) >= 4) { 412 410 enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder; 413 411 414 412 /* Wait for the Pipe State to go off */ 415 - if (intel_de_wait_for_clear(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), 413 + if (intel_de_wait_for_clear(display, TRANSCONF(display, cpu_transcoder), 416 414 TRANSCONF_STATE_ENABLE, 100)) 417 - drm_WARN(&dev_priv->drm, 1, "pipe_off wait timed out\n"); 415 + drm_WARN(display->drm, 1, "pipe_off wait timed out\n"); 418 416 } else { 419 417 intel_wait_for_pipe_scanline_stopped(crtc); 420 418 } ··· 468 466 469 467 static void assert_planes_disabled(struct intel_crtc *crtc) 470 468 { 471 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 469 + struct intel_display *display = to_intel_display(crtc); 472 470 struct intel_plane *plane; 473 471 474 - for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) 472 + for_each_intel_plane_on_crtc(display->drm, crtc, plane) 475 473 assert_plane_disabled(plane); 476 474 } 477 475 ··· 479 477 { 480 478 struct intel_display *display = to_intel_display(new_crtc_state); 481 479 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); 482 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 483 480 enum transcoder cpu_transcoder = new_crtc_state->cpu_transcoder; 484 481 enum pipe pipe = crtc->pipe; 485 482 u32 val; ··· 492 491 * a plane. On ILK+ the pipe PLLs are integrated, so we don't 493 492 * need the check. 494 493 */ 495 - if (HAS_GMCH(dev_priv)) { 494 + if (HAS_GMCH(display)) { 496 495 if (intel_crtc_has_type(new_crtc_state, INTEL_OUTPUT_DSI)) 497 496 assert_dsi_pll_enabled(display); 498 497 else ··· 509 508 } 510 509 511 510 /* Wa_22012358565:adl-p */ 512 - if (DISPLAY_VER(dev_priv) == 13) 511 + if (DISPLAY_VER(display) == 13) 513 512 intel_de_rmw(display, PIPE_ARB_CTL(display, pipe), 514 513 0, PIPE_ARB_USE_PROG_SLOTS); 515 514 516 - if (DISPLAY_VER(dev_priv) >= 14) { 515 + if (DISPLAY_VER(display) >= 14) { 517 516 u32 clear = DP_DSC_INSERT_SF_AT_EOL_WA; 518 517 u32 set = 0; 519 518 ··· 527 526 val = intel_de_read(display, TRANSCONF(display, cpu_transcoder)); 528 527 if (val & TRANSCONF_ENABLE) { 529 528 /* we keep both pipes enabled on 830 */ 530 - drm_WARN_ON(&dev_priv->drm, !IS_I830(dev_priv)); 529 + drm_WARN_ON(display->drm, !display->platform.i830); 531 530 return; 532 531 } 533 532 ··· 558 557 { 559 558 struct intel_display *display = to_intel_display(old_crtc_state); 560 559 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 561 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 562 560 enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder; 563 561 enum pipe pipe = crtc->pipe; 564 562 u32 val; 565 563 566 - drm_dbg_kms(&dev_priv->drm, "disabling pipe %c\n", pipe_name(pipe)); 564 + drm_dbg_kms(display->drm, "disabling pipe %c\n", pipe_name(pipe)); 567 565 568 566 /* 569 567 * Make sure planes won't keep trying to pump pixels to us, ··· 570 570 */ 571 571 assert_planes_disabled(crtc); 572 572 573 - val = intel_de_read(dev_priv, TRANSCONF(dev_priv, cpu_transcoder)); 573 + val = intel_de_read(display, TRANSCONF(display, cpu_transcoder)); 574 574 if ((val & TRANSCONF_ENABLE) == 0) 575 575 return; 576 576 ··· 582 582 val &= ~TRANSCONF_DOUBLE_WIDE; 583 583 584 584 /* Don't disable pipe or pipe PLLs if needed */ 585 - if (!IS_I830(dev_priv)) 585 + if (!display->platform.i830) 586 586 val &= ~TRANSCONF_ENABLE; 587 587 588 588 /* Wa_1409098942:adlp+ */ 589 - if (DISPLAY_VER(dev_priv) >= 13 && 589 + if (DISPLAY_VER(display) >= 13 && 590 590 old_crtc_state->dsc.compression_enable) 591 591 val &= ~TRANSCONF_PIXEL_COUNT_SCALING_MASK; 592 592 593 - intel_de_write(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), val); 593 + intel_de_write(display, TRANSCONF(display, cpu_transcoder), val); 594 594 595 - if (DISPLAY_VER(dev_priv) >= 12) 595 + if (DISPLAY_VER(display) >= 12) 596 596 intel_de_rmw(display, CHICKEN_TRANS(display, cpu_transcoder), 597 597 FECSTALL_DIS_DPTSTREAM_DPTTG, 0); 598 598 ··· 641 641 642 642 void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state) 643 643 { 644 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 644 + struct intel_display *display = to_intel_display(crtc_state); 645 645 struct drm_plane *plane; 646 646 647 647 /* ··· 652 652 crtc_state->enabled_planes = 0; 653 653 crtc_state->active_planes = 0; 654 654 655 - drm_for_each_plane_mask(plane, &dev_priv->drm, 655 + drm_for_each_plane_mask(plane, display->drm, 656 656 crtc_state->uapi.plane_mask) { 657 657 crtc_state->enabled_planes |= BIT(to_intel_plane(plane)->id); 658 658 crtc_state->active_planes |= BIT(to_intel_plane(plane)->id); ··· 669 669 struct intel_plane_state *plane_state = 670 670 to_intel_plane_state(plane->base.state); 671 671 672 - drm_dbg_kms(&dev_priv->drm, 672 + drm_dbg_kms(display->drm, 673 673 "Disabling [PLANE:%d:%s] on [CRTC:%d:%s]\n", 674 674 plane->base.base.id, plane->base.name, 675 675 crtc->base.base.id, crtc->base.name); 676 676 677 + intel_plane_set_invisible(crtc_state, plane_state); 677 678 intel_set_plane_visible(crtc_state, plane_state, false); 678 679 intel_plane_fixup_bitmasks(crtc_state); 679 - crtc_state->data_rate[plane->id] = 0; 680 - crtc_state->data_rate_y[plane->id] = 0; 681 - crtc_state->rel_data_rate[plane->id] = 0; 682 - crtc_state->rel_data_rate_y[plane->id] = 0; 683 - crtc_state->min_cdclk[plane->id] = 0; 680 + 681 + skl_wm_plane_disable_noatomic(crtc, plane); 684 682 685 683 if ((crtc_state->active_planes & ~BIT(PLANE_CURSOR)) == 0 && 686 684 hsw_ips_disable(crtc_state)) { ··· 695 697 * event which is after the vblank start event, so we need to have a 696 698 * wait-for-vblank between disabling the plane and the pipe. 697 699 */ 698 - if (HAS_GMCH(dev_priv) && 700 + if (HAS_GMCH(display) && 699 701 intel_set_memory_cxsr(dev_priv, false)) 700 702 intel_plane_initial_vblank_wait(crtc); 701 703 ··· 703 705 * Gen2 reports pipe underruns whenever all planes are disabled. 704 706 * So disable underrun reporting before all the planes get disabled. 705 707 */ 706 - if (DISPLAY_VER(dev_priv) == 2 && !crtc_state->active_planes) 708 + if (DISPLAY_VER(display) == 2 && !crtc_state->active_planes) 707 709 intel_set_cpu_fifo_underrun_reporting(display, crtc->pipe, false); 708 710 709 711 intel_plane_disable_arm(NULL, plane, crtc_state); ··· 723 725 724 726 static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state) 725 727 { 728 + struct intel_display *display = to_intel_display(crtc_state); 726 729 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 727 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 728 730 enum pipe pipe = crtc->pipe; 729 731 u32 tmp; 730 732 731 - tmp = intel_de_read(dev_priv, PIPE_CHICKEN(pipe)); 733 + tmp = intel_de_read(display, PIPE_CHICKEN(pipe)); 732 734 733 735 /* 734 736 * Display WA #1153: icl ··· 748 750 * Underrun recovery must always be disabled on display 13+. 749 751 * DG2 chicken bit meaning is inverted compared to other platforms. 750 752 */ 751 - if (IS_DG2(dev_priv)) 753 + if (display->platform.dg2) 752 754 tmp &= ~UNDERRUN_RECOVERY_ENABLE_DG2; 753 - else if ((DISPLAY_VER(dev_priv) >= 13) && (DISPLAY_VER(dev_priv) < 30)) 755 + else if ((DISPLAY_VER(display) >= 13) && (DISPLAY_VER(display) < 30)) 754 756 tmp |= UNDERRUN_RECOVERY_DISABLE_ADLP; 755 757 756 758 /* Wa_14010547955:dg2 */ 757 - if (IS_DG2(dev_priv)) 759 + if (display->platform.dg2) 758 760 tmp |= DG2_RENDER_CCSTAG_4_3_EN; 759 761 760 - intel_de_write(dev_priv, PIPE_CHICKEN(pipe), tmp); 762 + intel_de_write(display, PIPE_CHICKEN(pipe), tmp); 761 763 } 762 764 763 - bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv) 765 + bool intel_has_pending_fb_unpin(struct intel_display *display) 764 766 { 765 767 struct drm_crtc *crtc; 766 768 bool cleanup_done; 767 769 768 - drm_for_each_crtc(crtc, &dev_priv->drm) { 770 + drm_for_each_crtc(crtc, display->drm) { 769 771 struct drm_crtc_commit *commit; 770 772 spin_lock(&crtc->commit_lock); 771 773 commit = list_first_entry_or_null(&crtc->commit_list, ··· 817 819 return encoder; 818 820 } 819 821 820 - static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state) 821 - { 822 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 823 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 824 - const struct drm_rect *dst = &crtc_state->pch_pfit.dst; 825 - enum pipe pipe = crtc->pipe; 826 - int width = drm_rect_width(dst); 827 - int height = drm_rect_height(dst); 828 - int x = dst->x1; 829 - int y = dst->y1; 830 - 831 - if (!crtc_state->pch_pfit.enabled) 832 - return; 833 - 834 - /* Force use of hard-coded filter coefficients 835 - * as some pre-programmed values are broken, 836 - * e.g. x201. 837 - */ 838 - if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) 839 - intel_de_write_fw(dev_priv, PF_CTL(pipe), PF_ENABLE | 840 - PF_FILTER_MED_3x3 | PF_PIPE_SEL_IVB(pipe)); 841 - else 842 - intel_de_write_fw(dev_priv, PF_CTL(pipe), PF_ENABLE | 843 - PF_FILTER_MED_3x3); 844 - intel_de_write_fw(dev_priv, PF_WIN_POS(pipe), 845 - PF_WIN_XPOS(x) | PF_WIN_YPOS(y)); 846 - intel_de_write_fw(dev_priv, PF_WIN_SZ(pipe), 847 - PF_WIN_XSIZE(width) | PF_WIN_YSIZE(height)); 848 - } 849 - 850 822 static void intel_crtc_dpms_overlay_disable(struct intel_crtc *crtc) 851 823 { 852 824 if (crtc->overlay) ··· 829 861 830 862 static bool needs_nv12_wa(const struct intel_crtc_state *crtc_state) 831 863 { 832 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 864 + struct intel_display *display = to_intel_display(crtc_state); 833 865 834 866 if (!crtc_state->nv12_planes) 835 867 return false; 836 868 837 869 /* WA Display #0827: Gen9:all */ 838 - if (DISPLAY_VER(dev_priv) == 9) 870 + if (DISPLAY_VER(display) == 9) 839 871 return true; 840 872 841 873 return false; ··· 843 875 844 876 static bool needs_scalerclk_wa(const struct intel_crtc_state *crtc_state) 845 877 { 846 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 878 + struct intel_display *display = to_intel_display(crtc_state); 847 879 848 880 /* Wa_2006604312:icl,ehl */ 849 - if (crtc_state->scaler_state.scaler_users > 0 && DISPLAY_VER(dev_priv) == 11) 881 + if (crtc_state->scaler_state.scaler_users > 0 && DISPLAY_VER(display) == 11) 850 882 return true; 851 883 852 884 return false; ··· 854 886 855 887 static bool needs_cursorclk_wa(const struct intel_crtc_state *crtc_state) 856 888 { 857 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 889 + struct intel_display *display = to_intel_display(crtc_state); 858 890 859 891 /* Wa_1604331009:icl,jsl,ehl */ 860 892 if (is_hdr_mode(crtc_state) && 861 893 crtc_state->active_planes & BIT(PLANE_CURSOR) && 862 - DISPLAY_VER(dev_priv) == 11) 894 + DISPLAY_VER(display) == 11) 863 895 return true; 864 896 865 897 return false; 866 898 } 867 899 868 - static void intel_async_flip_vtd_wa(struct drm_i915_private *i915, 900 + static void intel_async_flip_vtd_wa(struct intel_display *display, 869 901 enum pipe pipe, bool enable) 870 902 { 871 - if (DISPLAY_VER(i915) == 9) { 903 + if (DISPLAY_VER(display) == 9) { 872 904 /* 873 905 * "Plane N stretch max must be programmed to 11b (x1) 874 906 * when Async flips are enabled on that plane." 875 907 */ 876 - intel_de_rmw(i915, CHICKEN_PIPESL_1(pipe), 908 + intel_de_rmw(display, CHICKEN_PIPESL_1(pipe), 877 909 SKL_PLANE1_STRETCH_MAX_MASK, 878 910 enable ? SKL_PLANE1_STRETCH_MAX_X1 : SKL_PLANE1_STRETCH_MAX_X8); 879 911 } else { 880 912 /* Also needed on HSW/BDW albeit undocumented */ 881 - intel_de_rmw(i915, CHICKEN_PIPESL_1(pipe), 913 + intel_de_rmw(display, CHICKEN_PIPESL_1(pipe), 882 914 HSW_PRI_STRETCH_MAX_MASK, 883 915 enable ? HSW_PRI_STRETCH_MAX_X1 : HSW_PRI_STRETCH_MAX_X8); 884 916 } ··· 886 918 887 919 static bool needs_async_flip_vtd_wa(const struct intel_crtc_state *crtc_state) 888 920 { 921 + struct intel_display *display = to_intel_display(crtc_state); 889 922 struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 890 923 891 924 return crtc_state->uapi.async_flip && i915_vtd_active(i915) && 892 - (DISPLAY_VER(i915) == 9 || IS_BROADWELL(i915) || IS_HASWELL(i915)); 925 + (DISPLAY_VER(display) == 9 || display->platform.broadwell || 926 + display->platform.haswell); 893 927 } 894 928 895 929 static void intel_encoders_audio_enable(struct intel_atomic_state *state, ··· 1040 1070 static void intel_post_plane_update(struct intel_atomic_state *state, 1041 1071 struct intel_crtc *crtc) 1042 1072 { 1073 + struct intel_display *display = to_intel_display(state); 1043 1074 struct drm_i915_private *dev_priv = to_i915(state->base.dev); 1044 1075 const struct intel_crtc_state *old_crtc_state = 1045 1076 intel_atomic_get_old_crtc_state(state, crtc); ··· 1059 1088 1060 1089 if (needs_async_flip_vtd_wa(old_crtc_state) && 1061 1090 !needs_async_flip_vtd_wa(new_crtc_state)) 1062 - intel_async_flip_vtd_wa(dev_priv, pipe, false); 1091 + intel_async_flip_vtd_wa(display, pipe, false); 1063 1092 1064 1093 if (needs_nv12_wa(old_crtc_state) && 1065 1094 !needs_nv12_wa(new_crtc_state)) 1066 - skl_wa_827(dev_priv, pipe, false); 1095 + skl_wa_827(display, pipe, false); 1067 1096 1068 1097 if (needs_scalerclk_wa(old_crtc_state) && 1069 1098 !needs_scalerclk_wa(new_crtc_state)) 1070 - icl_wa_scalerclkgating(dev_priv, pipe, false); 1099 + icl_wa_scalerclkgating(display, pipe, false); 1071 1100 1072 1101 if (needs_cursorclk_wa(old_crtc_state) && 1073 1102 !needs_cursorclk_wa(new_crtc_state)) 1074 - icl_wa_cursorclkgating(dev_priv, pipe, false); 1103 + icl_wa_cursorclkgating(display, pipe, false); 1075 1104 1076 1105 if (intel_crtc_needs_color_update(new_crtc_state)) 1077 1106 intel_color_post_update(new_crtc_state); ··· 1193 1222 1194 1223 if (!needs_async_flip_vtd_wa(old_crtc_state) && 1195 1224 needs_async_flip_vtd_wa(new_crtc_state)) 1196 - intel_async_flip_vtd_wa(dev_priv, pipe, true); 1225 + intel_async_flip_vtd_wa(display, pipe, true); 1197 1226 1198 1227 /* Display WA 827 */ 1199 1228 if (!needs_nv12_wa(old_crtc_state) && 1200 1229 needs_nv12_wa(new_crtc_state)) 1201 - skl_wa_827(dev_priv, pipe, true); 1230 + skl_wa_827(display, pipe, true); 1202 1231 1203 1232 /* Wa_2006604312:icl,ehl */ 1204 1233 if (!needs_scalerclk_wa(old_crtc_state) && 1205 1234 needs_scalerclk_wa(new_crtc_state)) 1206 - icl_wa_scalerclkgating(dev_priv, pipe, true); 1235 + icl_wa_scalerclkgating(display, pipe, true); 1207 1236 1208 1237 /* Wa_1604331009:icl,jsl,ehl */ 1209 1238 if (!needs_cursorclk_wa(old_crtc_state) && 1210 1239 needs_cursorclk_wa(new_crtc_state)) 1211 - icl_wa_cursorclkgating(dev_priv, pipe, true); 1240 + icl_wa_cursorclkgating(display, pipe, true); 1212 1241 1213 1242 /* 1214 1243 * Vblank time updates from the shadow to live plane control register ··· 1219 1248 * event which is after the vblank start event, so we need to have a 1220 1249 * wait-for-vblank between disabling the plane and the pipe. 1221 1250 */ 1222 - if (HAS_GMCH(dev_priv) && old_crtc_state->hw.active && 1251 + if (HAS_GMCH(display) && old_crtc_state->hw.active && 1223 1252 new_crtc_state->disable_cxsr && intel_set_memory_cxsr(dev_priv, false)) 1224 1253 intel_crtc_wait_for_next_vblank(crtc); 1225 1254 ··· 1230 1259 * 1231 1260 * WaCxSRDisabledForSpriteScaling:ivb 1232 1261 */ 1233 - if (!HAS_GMCH(dev_priv) && old_crtc_state->hw.active && 1262 + if (!HAS_GMCH(display) && old_crtc_state->hw.active && 1234 1263 new_crtc_state->disable_cxsr && ilk_disable_cxsr(dev_priv)) 1235 1264 intel_crtc_wait_for_next_vblank(crtc); 1236 1265 ··· 1266 1295 * chance of catching underruns with the intermediate watermarks 1267 1296 * vs. the old plane configuration. 1268 1297 */ 1269 - if (DISPLAY_VER(dev_priv) == 2 && planes_disabling(old_crtc_state, new_crtc_state)) 1298 + if (DISPLAY_VER(display) == 2 && planes_disabling(old_crtc_state, new_crtc_state)) 1270 1299 intel_set_cpu_fifo_underrun_reporting(display, pipe, false); 1271 1300 1272 1301 /* ··· 1307 1336 1308 1337 static void intel_encoders_update_prepare(struct intel_atomic_state *state) 1309 1338 { 1310 - struct drm_i915_private *i915 = to_i915(state->base.dev); 1339 + struct intel_display *display = to_intel_display(state); 1311 1340 struct intel_crtc_state *new_crtc_state, *old_crtc_state; 1312 1341 struct intel_crtc *crtc; 1313 1342 int i; ··· 1316 1345 * Make sure the DPLL state is up-to-date for fastset TypeC ports after non-blocking commits. 1317 1346 * TODO: Update the DPLL state for all cases in the encoder->update_prepare() hook. 1318 1347 */ 1319 - if (i915->display.dpll.mgr) { 1348 + if (display->dpll.mgr) { 1320 1349 for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { 1321 1350 if (intel_crtc_needs_modeset(new_crtc_state)) 1322 1351 continue; ··· 1512 1541 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1513 1542 enum pipe pipe = crtc->pipe; 1514 1543 1515 - if (drm_WARN_ON(&dev_priv->drm, crtc->active)) 1544 + if (drm_WARN_ON(display->drm, crtc->active)) 1516 1545 return; 1517 1546 1518 1547 /* ··· 1539 1568 if (new_crtc_state->has_pch_encoder) { 1540 1569 ilk_pch_pre_enable(state, crtc); 1541 1570 } else { 1542 - assert_fdi_tx_disabled(dev_priv, pipe); 1543 - assert_fdi_rx_disabled(dev_priv, pipe); 1571 + assert_fdi_tx_disabled(display, pipe); 1572 + assert_fdi_rx_disabled(display, pipe); 1544 1573 } 1545 1574 1546 1575 ilk_pfit_enable(new_crtc_state); ··· 1581 1610 /* Display WA #1180: WaDisableScalarClockGating: glk */ 1582 1611 static bool glk_need_scaler_clock_gating_wa(const struct intel_crtc_state *crtc_state) 1583 1612 { 1584 - struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 1613 + struct intel_display *display = to_intel_display(crtc_state); 1585 1614 1586 - return DISPLAY_VER(i915) == 10 && crtc_state->pch_pfit.enabled; 1615 + return DISPLAY_VER(display) == 10 && crtc_state->pch_pfit.enabled; 1587 1616 } 1588 1617 1589 1618 static void glk_pipe_scaler_clock_gating_wa(struct intel_crtc *crtc, bool enable) 1590 1619 { 1591 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 1620 + struct intel_display *display = to_intel_display(crtc); 1592 1621 u32 mask = DPF_GATING_DIS | DPF_RAM_GATING_DIS | DPFR_GATING_DIS; 1593 1622 1594 - intel_de_rmw(i915, CLKGATE_DIS_PSL(crtc->pipe), 1623 + intel_de_rmw(display, CLKGATE_DIS_PSL(crtc->pipe), 1595 1624 mask, enable ? mask : 0); 1596 1625 } 1597 1626 1598 1627 static void hsw_set_linetime_wm(const struct intel_crtc_state *crtc_state) 1599 1628 { 1629 + struct intel_display *display = to_intel_display(crtc_state); 1600 1630 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1601 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1602 1631 1603 - intel_de_write(dev_priv, WM_LINETIME(crtc->pipe), 1632 + intel_de_write(display, WM_LINETIME(crtc->pipe), 1604 1633 HSW_LINETIME(crtc_state->linetime) | 1605 1634 HSW_IPS_LINETIME(crtc_state->ips_linetime)); 1606 1635 } ··· 1616 1645 1617 1646 static void hsw_configure_cpu_transcoder(const struct intel_crtc_state *crtc_state) 1618 1647 { 1648 + struct intel_display *display = to_intel_display(crtc_state); 1619 1649 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1620 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1621 1650 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 1622 1651 1623 1652 if (crtc_state->has_pch_encoder) { ··· 1631 1660 } 1632 1661 1633 1662 intel_set_transcoder_timings(crtc_state); 1634 - if (HAS_VRR(dev_priv)) 1663 + if (HAS_VRR(display)) 1635 1664 intel_vrr_set_transcoder_timings(crtc_state); 1636 1665 1637 1666 if (cpu_transcoder != TRANSCODER_EDP) 1638 - intel_de_write(dev_priv, TRANS_MULT(dev_priv, cpu_transcoder), 1667 + intel_de_write(display, TRANS_MULT(display, cpu_transcoder), 1639 1668 crtc_state->pixel_multiplier - 1); 1640 1669 1641 1670 hsw_set_frame_start_delay(crtc_state); ··· 1649 1678 struct intel_display *display = to_intel_display(state); 1650 1679 const struct intel_crtc_state *new_crtc_state = 1651 1680 intel_atomic_get_new_crtc_state(state, crtc); 1652 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1653 1681 enum transcoder cpu_transcoder = new_crtc_state->cpu_transcoder; 1654 1682 struct intel_crtc *pipe_crtc; 1655 1683 int i; 1656 1684 1657 - if (drm_WARN_ON(&dev_priv->drm, crtc->active)) 1685 + if (drm_WARN_ON(display->drm, crtc->active)) 1658 1686 return; 1659 1687 for_each_pipe_crtc_modeset_enable(display, pipe_crtc, new_crtc_state, i) 1660 1688 intel_dmc_enable_pipe(display, pipe_crtc->pipe); ··· 1676 1706 1677 1707 intel_dsc_enable(pipe_crtc_state); 1678 1708 1679 - if (HAS_UNCOMPRESSED_JOINER(dev_priv)) 1709 + if (HAS_UNCOMPRESSED_JOINER(display)) 1680 1710 intel_uncompressed_joiner_enable(pipe_crtc_state); 1681 1711 1682 1712 intel_set_pipe_src_size(pipe_crtc_state); 1683 1713 1684 - if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv)) 1714 + if (DISPLAY_VER(display) >= 9 || display->platform.broadwell) 1685 1715 bdw_set_pipe_misc(NULL, pipe_crtc_state); 1686 1716 } 1687 1717 ··· 1697 1727 if (glk_need_scaler_clock_gating_wa(pipe_crtc_state)) 1698 1728 glk_pipe_scaler_clock_gating_wa(pipe_crtc, true); 1699 1729 1700 - if (DISPLAY_VER(dev_priv) >= 9) 1730 + if (DISPLAY_VER(display) >= 9) 1701 1731 skl_pfit_enable(pipe_crtc_state); 1702 1732 else 1703 1733 ilk_pfit_enable(pipe_crtc_state); ··· 1710 1740 1711 1741 hsw_set_linetime_wm(pipe_crtc_state); 1712 1742 1713 - if (DISPLAY_VER(dev_priv) >= 11) 1743 + if (DISPLAY_VER(display) >= 11) 1714 1744 icl_set_pipe_chicken(pipe_crtc_state); 1715 1745 1716 1746 intel_initial_watermarks(state, pipe_crtc); ··· 1733 1763 * enabling, we need to change the workaround. 1734 1764 */ 1735 1765 hsw_workaround_pipe = pipe_crtc_state->hsw_workaround_pipe; 1736 - if (IS_HASWELL(dev_priv) && hsw_workaround_pipe != INVALID_PIPE) { 1766 + if (display->platform.haswell && hsw_workaround_pipe != INVALID_PIPE) { 1737 1767 struct intel_crtc *wa_crtc = 1738 1768 intel_crtc_for_pipe(display, hsw_workaround_pipe); 1739 1769 ··· 1741 1771 intel_crtc_wait_for_next_vblank(wa_crtc); 1742 1772 } 1743 1773 } 1744 - } 1745 - 1746 - void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state) 1747 - { 1748 - struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 1749 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1750 - enum pipe pipe = crtc->pipe; 1751 - 1752 - /* To avoid upsetting the power well on haswell only disable the pfit if 1753 - * it's in use. The hw state code will make sure we get this right. */ 1754 - if (!old_crtc_state->pch_pfit.enabled) 1755 - return; 1756 - 1757 - intel_de_write_fw(dev_priv, PF_CTL(pipe), 0); 1758 - intel_de_write_fw(dev_priv, PF_WIN_POS(pipe), 0); 1759 - intel_de_write_fw(dev_priv, PF_WIN_SZ(pipe), 0); 1760 1774 } 1761 1775 1762 1776 static void ilk_crtc_disable(struct intel_atomic_state *state, ··· 1810 1856 intel_dmc_disable_pipe(display, pipe_crtc->pipe); 1811 1857 } 1812 1858 1813 - static void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state) 1814 - { 1815 - struct intel_display *display = to_intel_display(crtc_state); 1816 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1817 - 1818 - if (!crtc_state->gmch_pfit.control) 1819 - return; 1820 - 1821 - /* 1822 - * The panel fitter should only be adjusted whilst the pipe is disabled, 1823 - * according to register description and PRM. 1824 - */ 1825 - drm_WARN_ON(display->drm, 1826 - intel_de_read(display, PFIT_CONTROL(display)) & PFIT_ENABLE); 1827 - assert_transcoder_disabled(display, crtc_state->cpu_transcoder); 1828 - 1829 - intel_de_write(display, PFIT_PGM_RATIOS(display), 1830 - crtc_state->gmch_pfit.pgm_ratios); 1831 - intel_de_write(display, PFIT_CONTROL(display), 1832 - crtc_state->gmch_pfit.control); 1833 - 1834 - /* Border color in case we don't scale up to the full screen. Black by 1835 - * default, change to something else for debugging. */ 1836 - intel_de_write(display, BCLRPAT(display, crtc->pipe), 0); 1837 - } 1838 - 1839 1859 /* Prefer intel_encoder_is_combo() */ 1840 1860 bool intel_phy_is_combo(struct intel_display *display, enum phy phy) 1841 1861 { ··· 1833 1905 } 1834 1906 1835 1907 /* Prefer intel_encoder_is_tc() */ 1836 - bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy) 1908 + bool intel_phy_is_tc(struct intel_display *display, enum phy phy) 1837 1909 { 1838 1910 /* 1839 1911 * Discrete GPU phy's are not attached to FIA's to support TC 1840 1912 * subsystem Legacy or non-legacy, and only support native DP/HDMI 1841 1913 */ 1842 - if (IS_DGFX(dev_priv)) 1914 + if (display->platform.dgfx) 1843 1915 return false; 1844 1916 1845 - if (DISPLAY_VER(dev_priv) >= 13) 1917 + if (DISPLAY_VER(display) >= 13) 1846 1918 return phy >= PHY_F && phy <= PHY_I; 1847 - else if (IS_TIGERLAKE(dev_priv)) 1919 + else if (display->platform.tigerlake) 1848 1920 return phy >= PHY_D && phy <= PHY_I; 1849 - else if (IS_ICELAKE(dev_priv)) 1921 + else if (display->platform.icelake) 1850 1922 return phy >= PHY_C && phy <= PHY_F; 1851 1923 1852 1924 return false; 1853 1925 } 1854 1926 1855 1927 /* Prefer intel_encoder_is_snps() */ 1856 - bool intel_phy_is_snps(struct drm_i915_private *dev_priv, enum phy phy) 1928 + bool intel_phy_is_snps(struct intel_display *display, enum phy phy) 1857 1929 { 1858 1930 /* 1859 1931 * For DG2, and for DG2 only, all four "combo" ports and the TC1 port 1860 1932 * (PHY E) use Synopsis PHYs. See intel_phy_is_tc(). 1861 1933 */ 1862 - return IS_DG2(dev_priv) && phy > PHY_NONE && phy <= PHY_E; 1934 + return display->platform.dg2 && phy > PHY_NONE && phy <= PHY_E; 1863 1935 } 1864 1936 1865 1937 /* Prefer intel_encoder_to_phy() */ 1866 - enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port) 1938 + enum phy intel_port_to_phy(struct intel_display *display, enum port port) 1867 1939 { 1868 - if (DISPLAY_VER(i915) >= 13 && port >= PORT_D_XELPD) 1940 + if (DISPLAY_VER(display) >= 13 && port >= PORT_D_XELPD) 1869 1941 return PHY_D + port - PORT_D_XELPD; 1870 - else if (DISPLAY_VER(i915) >= 13 && port >= PORT_TC1) 1942 + else if (DISPLAY_VER(display) >= 13 && port >= PORT_TC1) 1871 1943 return PHY_F + port - PORT_TC1; 1872 - else if (IS_ALDERLAKE_S(i915) && port >= PORT_TC1) 1944 + else if (display->platform.alderlake_s && port >= PORT_TC1) 1873 1945 return PHY_B + port - PORT_TC1; 1874 - else if ((IS_DG1(i915) || IS_ROCKETLAKE(i915)) && port >= PORT_TC1) 1946 + else if ((display->platform.dg1 || display->platform.rocketlake) && port >= PORT_TC1) 1875 1947 return PHY_C + port - PORT_TC1; 1876 - else if ((IS_JASPERLAKE(i915) || IS_ELKHARTLAKE(i915)) && 1948 + else if ((display->platform.jasperlake || display->platform.elkhartlake) && 1877 1949 port == PORT_D) 1878 1950 return PHY_A; 1879 1951 ··· 1881 1953 } 1882 1954 1883 1955 /* Prefer intel_encoder_to_tc() */ 1884 - enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port) 1956 + enum tc_port intel_port_to_tc(struct intel_display *display, enum port port) 1885 1957 { 1886 - if (!intel_phy_is_tc(dev_priv, intel_port_to_phy(dev_priv, port))) 1958 + if (!intel_phy_is_tc(display, intel_port_to_phy(display, port))) 1887 1959 return TC_PORT_NONE; 1888 1960 1889 - if (DISPLAY_VER(dev_priv) >= 12) 1961 + if (DISPLAY_VER(display) >= 12) 1890 1962 return TC_PORT_1 + port - PORT_TC1; 1891 1963 else 1892 1964 return TC_PORT_1 + port - PORT_C; ··· 1894 1966 1895 1967 enum phy intel_encoder_to_phy(struct intel_encoder *encoder) 1896 1968 { 1897 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 1969 + struct intel_display *display = to_intel_display(encoder); 1898 1970 1899 - return intel_port_to_phy(i915, encoder->port); 1971 + return intel_port_to_phy(display, encoder->port); 1900 1972 } 1901 1973 1902 1974 bool intel_encoder_is_combo(struct intel_encoder *encoder) ··· 1908 1980 1909 1981 bool intel_encoder_is_snps(struct intel_encoder *encoder) 1910 1982 { 1911 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 1983 + struct intel_display *display = to_intel_display(encoder); 1912 1984 1913 - return intel_phy_is_snps(i915, intel_encoder_to_phy(encoder)); 1985 + return intel_phy_is_snps(display, intel_encoder_to_phy(encoder)); 1914 1986 } 1915 1987 1916 1988 bool intel_encoder_is_tc(struct intel_encoder *encoder) 1917 1989 { 1918 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 1990 + struct intel_display *display = to_intel_display(encoder); 1919 1991 1920 - return intel_phy_is_tc(i915, intel_encoder_to_phy(encoder)); 1992 + return intel_phy_is_tc(display, intel_encoder_to_phy(encoder)); 1921 1993 } 1922 1994 1923 1995 enum tc_port intel_encoder_to_tc(struct intel_encoder *encoder) 1924 1996 { 1925 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 1997 + struct intel_display *display = to_intel_display(encoder); 1926 1998 1927 - return intel_port_to_tc(i915, encoder->port); 1999 + return intel_port_to_tc(display, encoder->port); 1928 2000 } 1929 2001 1930 2002 enum intel_display_power_domain ··· 1941 2013 static void get_crtc_power_domains(struct intel_crtc_state *crtc_state, 1942 2014 struct intel_power_domain_mask *mask) 1943 2015 { 2016 + struct intel_display *display = to_intel_display(crtc_state); 1944 2017 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1945 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1946 2018 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 1947 2019 struct drm_encoder *encoder; 1948 2020 enum pipe pipe = crtc->pipe; ··· 1958 2030 crtc_state->pch_pfit.force_thru) 1959 2031 set_bit(POWER_DOMAIN_PIPE_PANEL_FITTER(pipe), mask->bits); 1960 2032 1961 - drm_for_each_encoder_mask(encoder, &dev_priv->drm, 2033 + drm_for_each_encoder_mask(encoder, display->drm, 1962 2034 crtc_state->uapi.encoder_mask) { 1963 2035 struct intel_encoder *intel_encoder = to_intel_encoder(encoder); 1964 2036 1965 2037 set_bit(intel_encoder->power_domain, mask->bits); 1966 2038 } 1967 2039 1968 - if (HAS_DDI(dev_priv) && crtc_state->has_audio) 2040 + if (HAS_DDI(display) && crtc_state->has_audio) 1969 2041 set_bit(POWER_DOMAIN_AUDIO_MMIO, mask->bits); 1970 2042 1971 2043 if (crtc_state->shared_dpll) ··· 2033 2105 struct intel_display *display = to_intel_display(crtc); 2034 2106 const struct intel_crtc_state *new_crtc_state = 2035 2107 intel_atomic_get_new_crtc_state(state, crtc); 2036 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2037 2108 enum pipe pipe = crtc->pipe; 2038 2109 2039 - if (drm_WARN_ON(&dev_priv->drm, crtc->active)) 2110 + if (drm_WARN_ON(display->drm, crtc->active)) 2040 2111 return; 2041 2112 2042 2113 i9xx_configure_cpu_transcoder(new_crtc_state); 2043 2114 2044 2115 intel_set_pipe_src_size(new_crtc_state); 2045 2116 2046 - intel_de_write(dev_priv, VLV_PIPE_MSA_MISC(pipe), 0); 2117 + intel_de_write(display, VLV_PIPE_MSA_MISC(display, pipe), 0); 2047 2118 2048 - if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) { 2049 - intel_de_write(dev_priv, CHV_BLEND(dev_priv, pipe), 2119 + if (display->platform.cherryview && pipe == PIPE_B) { 2120 + intel_de_write(display, CHV_BLEND(display, pipe), 2050 2121 CHV_BLEND_LEGACY); 2051 - intel_de_write(dev_priv, CHV_CANVAS(dev_priv, pipe), 0); 2122 + intel_de_write(display, CHV_CANVAS(display, pipe), 0); 2052 2123 } 2053 2124 2054 2125 crtc->active = true; ··· 2056 2129 2057 2130 intel_encoders_pre_pll_enable(state, crtc); 2058 2131 2059 - if (IS_CHERRYVIEW(dev_priv)) 2132 + if (display->platform.cherryview) 2060 2133 chv_enable_pll(new_crtc_state); 2061 2134 else 2062 2135 vlv_enable_pll(new_crtc_state); ··· 2084 2157 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2085 2158 enum pipe pipe = crtc->pipe; 2086 2159 2087 - if (drm_WARN_ON(&dev_priv->drm, crtc->active)) 2160 + if (drm_WARN_ON(display->drm, crtc->active)) 2088 2161 return; 2089 2162 2090 2163 i9xx_configure_cpu_transcoder(new_crtc_state); ··· 2093 2166 2094 2167 crtc->active = true; 2095 2168 2096 - if (DISPLAY_VER(dev_priv) != 2) 2169 + if (DISPLAY_VER(display) != 2) 2097 2170 intel_set_cpu_fifo_underrun_reporting(display, pipe, true); 2098 2171 2099 2172 intel_encoders_pre_enable(state, crtc); ··· 2113 2186 intel_encoders_enable(state, crtc); 2114 2187 2115 2188 /* prevents spurious underruns */ 2116 - if (DISPLAY_VER(dev_priv) == 2) 2189 + if (DISPLAY_VER(display) == 2) 2117 2190 intel_crtc_wait_for_next_vblank(crtc); 2118 - } 2119 - 2120 - static void i9xx_pfit_disable(const struct intel_crtc_state *old_crtc_state) 2121 - { 2122 - struct intel_display *display = to_intel_display(old_crtc_state); 2123 - 2124 - if (!old_crtc_state->gmch_pfit.control) 2125 - return; 2126 - 2127 - assert_transcoder_disabled(display, old_crtc_state->cpu_transcoder); 2128 - 2129 - drm_dbg_kms(display->drm, "disabling pfit, current: 0x%08x\n", 2130 - intel_de_read(display, PFIT_CONTROL(display))); 2131 - intel_de_write(display, PFIT_CONTROL(display), 0); 2132 2191 } 2133 2192 2134 2193 static void i9xx_crtc_disable(struct intel_atomic_state *state, ··· 2130 2217 * On gen2 planes are double buffered but the pipe isn't, so we must 2131 2218 * wait for planes to fully turn off before disabling the pipe. 2132 2219 */ 2133 - if (DISPLAY_VER(dev_priv) == 2) 2220 + if (DISPLAY_VER(display) == 2) 2134 2221 intel_crtc_wait_for_next_vblank(crtc); 2135 2222 2136 2223 intel_encoders_disable(state, crtc); ··· 2144 2231 intel_encoders_post_disable(state, crtc); 2145 2232 2146 2233 if (!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DSI)) { 2147 - if (IS_CHERRYVIEW(dev_priv)) 2234 + if (display->platform.cherryview) 2148 2235 chv_disable_pll(dev_priv, pipe); 2149 - else if (IS_VALLEYVIEW(dev_priv)) 2236 + else if (display->platform.valleyview) 2150 2237 vlv_disable_pll(dev_priv, pipe); 2151 2238 else 2152 2239 i9xx_disable_pll(old_crtc_state); ··· 2154 2241 2155 2242 intel_encoders_post_pll_disable(state, crtc); 2156 2243 2157 - if (DISPLAY_VER(dev_priv) != 2) 2244 + if (DISPLAY_VER(display) != 2) 2158 2245 intel_set_cpu_fifo_underrun_reporting(display, pipe, false); 2159 2246 2160 - if (!dev_priv->display.funcs.wm->initial_watermarks) 2247 + if (!display->funcs.wm->initial_watermarks) 2161 2248 intel_update_watermarks(dev_priv); 2162 2249 2163 2250 /* clock the pipe down to 640x480@60 to potentially save power */ 2164 - if (IS_I830(dev_priv)) 2251 + if (display->platform.i830) 2165 2252 i830_enable_pipe(display, pipe); 2166 2253 } 2167 2254 ··· 2175 2262 2176 2263 static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc) 2177 2264 { 2178 - const struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2265 + struct intel_display *display = to_intel_display(crtc); 2179 2266 2180 2267 /* GDG double wide on either pipe, otherwise pipe A only */ 2181 - return HAS_DOUBLE_WIDE(dev_priv) && 2182 - (crtc->pipe == PIPE_A || IS_I915G(dev_priv)); 2268 + return HAS_DOUBLE_WIDE(display) && 2269 + (crtc->pipe == PIPE_A || display->platform.i915g); 2183 2270 } 2184 2271 2185 2272 static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state) ··· 2226 2313 2227 2314 static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state) 2228 2315 { 2229 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 2316 + struct intel_display *display = to_intel_display(crtc_state); 2230 2317 2231 - if (HAS_GMCH(dev_priv)) 2318 + if (HAS_GMCH(display)) 2232 2319 /* FIXME calculate proper pipe pixel rate for GMCH pfit */ 2233 2320 crtc_state->pixel_rate = 2234 2321 crtc_state->hw.pipe_mode.crtc_clock; ··· 2339 2426 2340 2427 static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state) 2341 2428 { 2429 + struct intel_display *display = to_intel_display(crtc_state); 2342 2430 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2343 2431 struct drm_i915_private *i915 = to_i915(crtc->base.dev); 2344 2432 ··· 2353 2439 */ 2354 2440 if (drm_rect_width(&crtc_state->pipe_src) & 1) { 2355 2441 if (crtc_state->double_wide) { 2356 - drm_dbg_kms(&i915->drm, 2442 + drm_dbg_kms(display->drm, 2357 2443 "[CRTC:%d:%s] Odd pipe source width not supported with double wide pipe\n", 2358 2444 crtc->base.base.id, crtc->base.name); 2359 2445 return -EINVAL; ··· 2361 2447 2362 2448 if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_LVDS) && 2363 2449 intel_is_dual_link_lvds(i915)) { 2364 - drm_dbg_kms(&i915->drm, 2450 + drm_dbg_kms(display->drm, 2365 2451 "[CRTC:%d:%s] Odd pipe source width not supported with dual link LVDS\n", 2366 2452 crtc->base.base.id, crtc->base.name); 2367 2453 return -EINVAL; ··· 2373 2459 2374 2460 static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state) 2375 2461 { 2462 + struct intel_display *display = to_intel_display(crtc_state); 2376 2463 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2377 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 2378 2464 struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 2379 2465 struct drm_display_mode *pipe_mode = &crtc_state->hw.pipe_mode; 2380 - int clock_limit = i915->display.cdclk.max_dotclk_freq; 2466 + int clock_limit = display->cdclk.max_dotclk_freq; 2381 2467 2382 2468 /* 2383 2469 * Start with the adjusted_mode crtc timings, which ··· 2392 2478 intel_joiner_adjust_timings(crtc_state, pipe_mode); 2393 2479 intel_mode_from_crtc_timings(pipe_mode, pipe_mode); 2394 2480 2395 - if (DISPLAY_VER(i915) < 4) { 2396 - clock_limit = i915->display.cdclk.max_cdclk_freq * 9 / 10; 2481 + if (DISPLAY_VER(display) < 4) { 2482 + clock_limit = display->cdclk.max_cdclk_freq * 9 / 10; 2397 2483 2398 2484 /* 2399 2485 * Enable double wide mode when the dot clock ··· 2401 2487 */ 2402 2488 if (intel_crtc_supports_double_wide(crtc) && 2403 2489 pipe_mode->crtc_clock > clock_limit) { 2404 - clock_limit = i915->display.cdclk.max_dotclk_freq; 2490 + clock_limit = display->cdclk.max_dotclk_freq; 2405 2491 crtc_state->double_wide = true; 2406 2492 } 2407 2493 } 2408 2494 2409 2495 if (pipe_mode->crtc_clock > clock_limit) { 2410 - drm_dbg_kms(&i915->drm, 2496 + drm_dbg_kms(display->drm, 2411 2497 "[CRTC:%d:%s] requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n", 2412 2498 crtc->base.base.id, crtc->base.name, 2413 2499 pipe_mode->crtc_clock, clock_limit, ··· 2546 2632 0x80000); 2547 2633 } 2548 2634 2549 - void intel_panel_sanitize_ssc(struct drm_i915_private *dev_priv) 2635 + void intel_panel_sanitize_ssc(struct intel_display *display) 2550 2636 { 2637 + struct drm_i915_private *dev_priv = to_i915(display->drm); 2638 + 2551 2639 /* 2552 2640 * There may be no VBT; and if the BIOS enabled SSC we can 2553 2641 * just keep using it to avoid unnecessary flicker. Whereas if the ··· 2557 2641 * indicates as much. 2558 2642 */ 2559 2643 if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv)) { 2560 - bool bios_lvds_use_ssc = intel_de_read(dev_priv, 2644 + bool bios_lvds_use_ssc = intel_de_read(display, 2561 2645 PCH_DREF_CONTROL) & 2562 2646 DREF_SSC1_ENABLE; 2563 2647 2564 - if (dev_priv->display.vbt.lvds_use_ssc != bios_lvds_use_ssc) { 2565 - drm_dbg_kms(&dev_priv->drm, 2648 + if (display->vbt.lvds_use_ssc != bios_lvds_use_ssc) { 2649 + drm_dbg_kms(display->drm, 2566 2650 "SSC %s by BIOS, overriding VBT which says %s\n", 2567 2651 str_enabled_disabled(bios_lvds_use_ssc), 2568 - str_enabled_disabled(dev_priv->display.vbt.lvds_use_ssc)); 2569 - dev_priv->display.vbt.lvds_use_ssc = bios_lvds_use_ssc; 2652 + str_enabled_disabled(display->vbt.lvds_use_ssc)); 2653 + display->vbt.lvds_use_ssc = bios_lvds_use_ssc; 2570 2654 } 2571 2655 } 2572 2656 } ··· 2578 2662 m_n->tu = 1; 2579 2663 } 2580 2664 2581 - void intel_set_m_n(struct drm_i915_private *i915, 2665 + void intel_set_m_n(struct intel_display *display, 2582 2666 const struct intel_link_m_n *m_n, 2583 2667 i915_reg_t data_m_reg, i915_reg_t data_n_reg, 2584 2668 i915_reg_t link_m_reg, i915_reg_t link_n_reg) 2585 2669 { 2586 - intel_de_write(i915, data_m_reg, TU_SIZE(m_n->tu) | m_n->data_m); 2587 - intel_de_write(i915, data_n_reg, m_n->data_n); 2588 - intel_de_write(i915, link_m_reg, m_n->link_m); 2670 + intel_de_write(display, data_m_reg, TU_SIZE(m_n->tu) | m_n->data_m); 2671 + intel_de_write(display, data_n_reg, m_n->data_n); 2672 + intel_de_write(display, link_m_reg, m_n->link_m); 2589 2673 /* 2590 2674 * On BDW+ writing LINK_N arms the double buffered update 2591 2675 * of all the M/N registers, so it must be written last. 2592 2676 */ 2593 - intel_de_write(i915, link_n_reg, m_n->link_n); 2677 + intel_de_write(display, link_n_reg, m_n->link_n); 2594 2678 } 2595 2679 2596 - bool intel_cpu_transcoder_has_m2_n2(struct drm_i915_private *dev_priv, 2680 + bool intel_cpu_transcoder_has_m2_n2(struct intel_display *display, 2597 2681 enum transcoder transcoder) 2598 2682 { 2599 - if (IS_HASWELL(dev_priv)) 2683 + if (display->platform.haswell) 2600 2684 return transcoder == TRANSCODER_EDP; 2601 2685 2602 - return IS_DISPLAY_VER(dev_priv, 5, 7) || IS_CHERRYVIEW(dev_priv); 2686 + return IS_DISPLAY_VER(display, 5, 7) || display->platform.cherryview; 2603 2687 } 2604 2688 2605 2689 void intel_cpu_transcoder_set_m1_n1(struct intel_crtc *crtc, 2606 2690 enum transcoder transcoder, 2607 2691 const struct intel_link_m_n *m_n) 2608 2692 { 2609 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2693 + struct intel_display *display = to_intel_display(crtc); 2610 2694 enum pipe pipe = crtc->pipe; 2611 2695 2612 - if (DISPLAY_VER(dev_priv) >= 5) 2613 - intel_set_m_n(dev_priv, m_n, 2614 - PIPE_DATA_M1(dev_priv, transcoder), 2615 - PIPE_DATA_N1(dev_priv, transcoder), 2616 - PIPE_LINK_M1(dev_priv, transcoder), 2617 - PIPE_LINK_N1(dev_priv, transcoder)); 2696 + if (DISPLAY_VER(display) >= 5) 2697 + intel_set_m_n(display, m_n, 2698 + PIPE_DATA_M1(display, transcoder), 2699 + PIPE_DATA_N1(display, transcoder), 2700 + PIPE_LINK_M1(display, transcoder), 2701 + PIPE_LINK_N1(display, transcoder)); 2618 2702 else 2619 - intel_set_m_n(dev_priv, m_n, 2703 + intel_set_m_n(display, m_n, 2620 2704 PIPE_DATA_M_G4X(pipe), PIPE_DATA_N_G4X(pipe), 2621 2705 PIPE_LINK_M_G4X(pipe), PIPE_LINK_N_G4X(pipe)); 2622 2706 } ··· 2625 2709 enum transcoder transcoder, 2626 2710 const struct intel_link_m_n *m_n) 2627 2711 { 2628 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2712 + struct intel_display *display = to_intel_display(crtc); 2629 2713 2630 - if (!intel_cpu_transcoder_has_m2_n2(dev_priv, transcoder)) 2714 + if (!intel_cpu_transcoder_has_m2_n2(display, transcoder)) 2631 2715 return; 2632 2716 2633 - intel_set_m_n(dev_priv, m_n, 2634 - PIPE_DATA_M2(dev_priv, transcoder), 2635 - PIPE_DATA_N2(dev_priv, transcoder), 2636 - PIPE_LINK_M2(dev_priv, transcoder), 2637 - PIPE_LINK_N2(dev_priv, transcoder)); 2717 + intel_set_m_n(display, m_n, 2718 + PIPE_DATA_M2(display, transcoder), 2719 + PIPE_DATA_N2(display, transcoder), 2720 + PIPE_LINK_M2(display, transcoder), 2721 + PIPE_LINK_N2(display, transcoder)); 2638 2722 } 2639 2723 2640 2724 static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_state) 2641 2725 { 2726 + struct intel_display *display = to_intel_display(crtc_state); 2642 2727 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2643 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2644 2728 enum pipe pipe = crtc->pipe; 2645 2729 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 2646 2730 const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 2647 2731 u32 crtc_vdisplay, crtc_vtotal, crtc_vblank_start, crtc_vblank_end; 2648 2732 int vsyncshift = 0; 2649 2733 2650 - drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)); 2734 + drm_WARN_ON(display->drm, transcoder_is_dsi(cpu_transcoder)); 2651 2735 2652 2736 /* We need to be careful not to changed the adjusted mode, for otherwise 2653 2737 * the hw state checker will get angry at the mismatch. */ ··· 2674 2758 * VBLANK_START no longer works on ADL+, instead we must use 2675 2759 * TRANS_SET_CONTEXT_LATENCY to configure the pipe vblank start. 2676 2760 */ 2677 - if (DISPLAY_VER(dev_priv) >= 13) { 2678 - intel_de_write(dev_priv, 2679 - TRANS_SET_CONTEXT_LATENCY(dev_priv, cpu_transcoder), 2761 + if (DISPLAY_VER(display) >= 13) { 2762 + intel_de_write(display, 2763 + TRANS_SET_CONTEXT_LATENCY(display, cpu_transcoder), 2680 2764 crtc_vblank_start - crtc_vdisplay); 2681 2765 2682 2766 /* ··· 2686 2770 crtc_vblank_start = 1; 2687 2771 } 2688 2772 2689 - if (DISPLAY_VER(dev_priv) >= 4) 2690 - intel_de_write(dev_priv, 2691 - TRANS_VSYNCSHIFT(dev_priv, cpu_transcoder), 2773 + if (DISPLAY_VER(display) >= 4) 2774 + intel_de_write(display, 2775 + TRANS_VSYNCSHIFT(display, cpu_transcoder), 2692 2776 vsyncshift); 2693 2777 2694 - intel_de_write(dev_priv, TRANS_HTOTAL(dev_priv, cpu_transcoder), 2778 + intel_de_write(display, TRANS_HTOTAL(display, cpu_transcoder), 2695 2779 HACTIVE(adjusted_mode->crtc_hdisplay - 1) | 2696 2780 HTOTAL(adjusted_mode->crtc_htotal - 1)); 2697 - intel_de_write(dev_priv, TRANS_HBLANK(dev_priv, cpu_transcoder), 2781 + intel_de_write(display, TRANS_HBLANK(display, cpu_transcoder), 2698 2782 HBLANK_START(adjusted_mode->crtc_hblank_start - 1) | 2699 2783 HBLANK_END(adjusted_mode->crtc_hblank_end - 1)); 2700 - intel_de_write(dev_priv, TRANS_HSYNC(dev_priv, cpu_transcoder), 2784 + intel_de_write(display, TRANS_HSYNC(display, cpu_transcoder), 2701 2785 HSYNC_START(adjusted_mode->crtc_hsync_start - 1) | 2702 2786 HSYNC_END(adjusted_mode->crtc_hsync_end - 1)); 2703 2787 2704 - intel_de_write(dev_priv, TRANS_VTOTAL(dev_priv, cpu_transcoder), 2788 + intel_de_write(display, TRANS_VTOTAL(display, cpu_transcoder), 2705 2789 VACTIVE(crtc_vdisplay - 1) | 2706 2790 VTOTAL(crtc_vtotal - 1)); 2707 - intel_de_write(dev_priv, TRANS_VBLANK(dev_priv, cpu_transcoder), 2791 + intel_de_write(display, TRANS_VBLANK(display, cpu_transcoder), 2708 2792 VBLANK_START(crtc_vblank_start - 1) | 2709 2793 VBLANK_END(crtc_vblank_end - 1)); 2710 - intel_de_write(dev_priv, TRANS_VSYNC(dev_priv, cpu_transcoder), 2794 + intel_de_write(display, TRANS_VSYNC(display, cpu_transcoder), 2711 2795 VSYNC_START(adjusted_mode->crtc_vsync_start - 1) | 2712 2796 VSYNC_END(adjusted_mode->crtc_vsync_end - 1)); 2713 2797 ··· 2715 2799 * programmed with the VTOTAL_EDP value. Same for VTOTAL_C. This is 2716 2800 * documented on the DDI_FUNC_CTL register description, EDP Input Select 2717 2801 * bits. */ 2718 - if (IS_HASWELL(dev_priv) && cpu_transcoder == TRANSCODER_EDP && 2802 + if (display->platform.haswell && cpu_transcoder == TRANSCODER_EDP && 2719 2803 (pipe == PIPE_B || pipe == PIPE_C)) 2720 - intel_de_write(dev_priv, TRANS_VTOTAL(dev_priv, pipe), 2804 + intel_de_write(display, TRANS_VTOTAL(display, pipe), 2721 2805 VACTIVE(crtc_vdisplay - 1) | 2722 2806 VTOTAL(crtc_vtotal - 1)); 2723 2807 } 2724 2808 2725 2809 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state *crtc_state) 2726 2810 { 2727 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2728 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2811 + struct intel_display *display = to_intel_display(crtc_state); 2729 2812 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 2730 2813 const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; 2731 2814 u32 crtc_vdisplay, crtc_vtotal, crtc_vblank_start, crtc_vblank_end; 2732 2815 2733 - drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)); 2816 + drm_WARN_ON(display->drm, transcoder_is_dsi(cpu_transcoder)); 2734 2817 2735 2818 crtc_vdisplay = adjusted_mode->crtc_vdisplay; 2736 2819 crtc_vtotal = adjusted_mode->crtc_vtotal; ··· 2742 2827 crtc_vblank_end -= 1; 2743 2828 } 2744 2829 2745 - if (DISPLAY_VER(dev_priv) >= 13) { 2746 - intel_de_write(dev_priv, 2747 - TRANS_SET_CONTEXT_LATENCY(dev_priv, cpu_transcoder), 2830 + if (DISPLAY_VER(display) >= 13) { 2831 + intel_de_write(display, 2832 + TRANS_SET_CONTEXT_LATENCY(display, cpu_transcoder), 2748 2833 crtc_vblank_start - crtc_vdisplay); 2749 2834 2750 2835 /* ··· 2758 2843 * The hardware actually ignores TRANS_VBLANK.VBLANK_END in DP mode. 2759 2844 * But let's write it anyway to keep the state checker happy. 2760 2845 */ 2761 - intel_de_write(dev_priv, TRANS_VBLANK(dev_priv, cpu_transcoder), 2846 + intel_de_write(display, TRANS_VBLANK(display, cpu_transcoder), 2762 2847 VBLANK_START(crtc_vblank_start - 1) | 2763 2848 VBLANK_END(crtc_vblank_end - 1)); 2764 2849 /* 2765 2850 * The double buffer latch point for TRANS_VTOTAL 2766 2851 * is the transcoder's undelayed vblank. 2767 2852 */ 2768 - intel_de_write(dev_priv, TRANS_VTOTAL(dev_priv, cpu_transcoder), 2853 + intel_de_write(display, TRANS_VTOTAL(display, cpu_transcoder), 2769 2854 VACTIVE(crtc_vdisplay - 1) | 2770 2855 VTOTAL(crtc_vtotal - 1)); 2771 2856 } 2772 2857 2773 2858 static void intel_set_pipe_src_size(const struct intel_crtc_state *crtc_state) 2774 2859 { 2860 + struct intel_display *display = to_intel_display(crtc_state); 2775 2861 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2776 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2777 2862 int width = drm_rect_width(&crtc_state->pipe_src); 2778 2863 int height = drm_rect_height(&crtc_state->pipe_src); 2779 2864 enum pipe pipe = crtc->pipe; ··· 2781 2866 /* pipesrc controls the size that is scaled from, which should 2782 2867 * always be the user's requested size. 2783 2868 */ 2784 - intel_de_write(dev_priv, PIPESRC(dev_priv, pipe), 2869 + intel_de_write(display, PIPESRC(display, pipe), 2785 2870 PIPESRC_WIDTH(width - 1) | PIPESRC_HEIGHT(height - 1)); 2786 2871 } 2787 2872 2788 2873 static bool intel_pipe_is_interlaced(const struct intel_crtc_state *crtc_state) 2789 2874 { 2790 - struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); 2875 + struct intel_display *display = to_intel_display(crtc_state); 2791 2876 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 2792 2877 2793 - if (DISPLAY_VER(dev_priv) == 2) 2878 + if (DISPLAY_VER(display) == 2) 2794 2879 return false; 2795 2880 2796 - if (DISPLAY_VER(dev_priv) >= 9 || 2797 - IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) 2798 - return intel_de_read(dev_priv, 2799 - TRANSCONF(dev_priv, cpu_transcoder)) & TRANSCONF_INTERLACE_MASK_HSW; 2881 + if (DISPLAY_VER(display) >= 9 || 2882 + display->platform.broadwell || display->platform.haswell) 2883 + return intel_de_read(display, 2884 + TRANSCONF(display, cpu_transcoder)) & TRANSCONF_INTERLACE_MASK_HSW; 2800 2885 else 2801 - return intel_de_read(dev_priv, 2802 - TRANSCONF(dev_priv, cpu_transcoder)) & TRANSCONF_INTERLACE_MASK; 2886 + return intel_de_read(display, 2887 + TRANSCONF(display, cpu_transcoder)) & TRANSCONF_INTERLACE_MASK; 2803 2888 } 2804 2889 2805 2890 static void intel_get_transcoder_timings(struct intel_crtc *crtc, 2806 2891 struct intel_crtc_state *pipe_config) 2807 2892 { 2808 - struct drm_device *dev = crtc->base.dev; 2809 - struct drm_i915_private *dev_priv = to_i915(dev); 2893 + struct intel_display *display = to_intel_display(crtc); 2810 2894 enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; 2811 2895 struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode; 2812 2896 u32 tmp; 2813 2897 2814 - tmp = intel_de_read(dev_priv, TRANS_HTOTAL(dev_priv, cpu_transcoder)); 2898 + tmp = intel_de_read(display, TRANS_HTOTAL(display, cpu_transcoder)); 2815 2899 adjusted_mode->crtc_hdisplay = REG_FIELD_GET(HACTIVE_MASK, tmp) + 1; 2816 2900 adjusted_mode->crtc_htotal = REG_FIELD_GET(HTOTAL_MASK, tmp) + 1; 2817 2901 2818 2902 if (!transcoder_is_dsi(cpu_transcoder)) { 2819 - tmp = intel_de_read(dev_priv, 2820 - TRANS_HBLANK(dev_priv, cpu_transcoder)); 2903 + tmp = intel_de_read(display, 2904 + TRANS_HBLANK(display, cpu_transcoder)); 2821 2905 adjusted_mode->crtc_hblank_start = REG_FIELD_GET(HBLANK_START_MASK, tmp) + 1; 2822 2906 adjusted_mode->crtc_hblank_end = REG_FIELD_GET(HBLANK_END_MASK, tmp) + 1; 2823 2907 } 2824 2908 2825 - tmp = intel_de_read(dev_priv, TRANS_HSYNC(dev_priv, cpu_transcoder)); 2909 + tmp = intel_de_read(display, TRANS_HSYNC(display, cpu_transcoder)); 2826 2910 adjusted_mode->crtc_hsync_start = REG_FIELD_GET(HSYNC_START_MASK, tmp) + 1; 2827 2911 adjusted_mode->crtc_hsync_end = REG_FIELD_GET(HSYNC_END_MASK, tmp) + 1; 2828 2912 2829 - tmp = intel_de_read(dev_priv, TRANS_VTOTAL(dev_priv, cpu_transcoder)); 2913 + tmp = intel_de_read(display, TRANS_VTOTAL(display, cpu_transcoder)); 2830 2914 adjusted_mode->crtc_vdisplay = REG_FIELD_GET(VACTIVE_MASK, tmp) + 1; 2831 2915 adjusted_mode->crtc_vtotal = REG_FIELD_GET(VTOTAL_MASK, tmp) + 1; 2832 2916 2833 2917 /* FIXME TGL+ DSI transcoders have this! */ 2834 2918 if (!transcoder_is_dsi(cpu_transcoder)) { 2835 - tmp = intel_de_read(dev_priv, 2836 - TRANS_VBLANK(dev_priv, cpu_transcoder)); 2919 + tmp = intel_de_read(display, 2920 + TRANS_VBLANK(display, cpu_transcoder)); 2837 2921 adjusted_mode->crtc_vblank_start = REG_FIELD_GET(VBLANK_START_MASK, tmp) + 1; 2838 2922 adjusted_mode->crtc_vblank_end = REG_FIELD_GET(VBLANK_END_MASK, tmp) + 1; 2839 2923 } 2840 - tmp = intel_de_read(dev_priv, TRANS_VSYNC(dev_priv, cpu_transcoder)); 2924 + tmp = intel_de_read(display, TRANS_VSYNC(display, cpu_transcoder)); 2841 2925 adjusted_mode->crtc_vsync_start = REG_FIELD_GET(VSYNC_START_MASK, tmp) + 1; 2842 2926 adjusted_mode->crtc_vsync_end = REG_FIELD_GET(VSYNC_END_MASK, tmp) + 1; 2843 2927 ··· 2846 2932 adjusted_mode->crtc_vblank_end += 1; 2847 2933 } 2848 2934 2849 - if (DISPLAY_VER(dev_priv) >= 13 && !transcoder_is_dsi(cpu_transcoder)) 2935 + if (DISPLAY_VER(display) >= 13 && !transcoder_is_dsi(cpu_transcoder)) 2850 2936 adjusted_mode->crtc_vblank_start = 2851 2937 adjusted_mode->crtc_vdisplay + 2852 - intel_de_read(dev_priv, 2853 - TRANS_SET_CONTEXT_LATENCY(dev_priv, cpu_transcoder)); 2938 + intel_de_read(display, 2939 + TRANS_SET_CONTEXT_LATENCY(display, cpu_transcoder)); 2854 2940 } 2855 2941 2856 2942 static void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state) ··· 2873 2959 static void intel_get_pipe_src_size(struct intel_crtc *crtc, 2874 2960 struct intel_crtc_state *pipe_config) 2875 2961 { 2876 - struct drm_device *dev = crtc->base.dev; 2877 - struct drm_i915_private *dev_priv = to_i915(dev); 2962 + struct intel_display *display = to_intel_display(crtc); 2878 2963 u32 tmp; 2879 2964 2880 - tmp = intel_de_read(dev_priv, PIPESRC(dev_priv, crtc->pipe)); 2965 + tmp = intel_de_read(display, PIPESRC(display, crtc->pipe)); 2881 2966 2882 2967 drm_rect_init(&pipe_config->pipe_src, 0, 0, 2883 2968 REG_FIELD_GET(PIPESRC_WIDTH_MASK, tmp) + 1, ··· 2887 2974 2888 2975 void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state) 2889 2976 { 2890 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2891 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2977 + struct intel_display *display = to_intel_display(crtc_state); 2892 2978 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 2893 2979 u32 val = 0; 2894 2980 ··· 2896 2984 * - During modeset the pipe is still disabled and must remain so 2897 2985 * - During fastset the pipe is already enabled and must remain so 2898 2986 */ 2899 - if (IS_I830(dev_priv) || !intel_crtc_needs_modeset(crtc_state)) 2987 + if (display->platform.i830 || !intel_crtc_needs_modeset(crtc_state)) 2900 2988 val |= TRANSCONF_ENABLE; 2901 2989 2902 2990 if (crtc_state->double_wide) 2903 2991 val |= TRANSCONF_DOUBLE_WIDE; 2904 2992 2905 2993 /* only g4x and later have fancy bpc/dither controls */ 2906 - if (IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) || 2907 - IS_CHERRYVIEW(dev_priv)) { 2994 + if (display->platform.g4x || display->platform.valleyview || 2995 + display->platform.cherryview) { 2908 2996 /* Bspec claims that we can't use dithering for 30bpp pipes. */ 2909 2997 if (crtc_state->dither && crtc_state->pipe_bpp != 30) 2910 2998 val |= TRANSCONF_DITHER_EN | ··· 2928 3016 } 2929 3017 2930 3018 if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) { 2931 - if (DISPLAY_VER(dev_priv) < 4 || 3019 + if (DISPLAY_VER(display) < 4 || 2932 3020 intel_crtc_has_type(crtc_state, INTEL_OUTPUT_SDVO)) 2933 3021 val |= TRANSCONF_INTERLACE_W_FIELD_INDICATION; 2934 3022 else ··· 2937 3025 val |= TRANSCONF_INTERLACE_PROGRESSIVE; 2938 3026 } 2939 3027 2940 - if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && 2941 - crtc_state->limited_color_range) 3028 + if ((display->platform.valleyview || display->platform.cherryview) && 3029 + crtc_state->limited_color_range) 2942 3030 val |= TRANSCONF_COLOR_RANGE_SELECT; 2943 3031 2944 3032 val |= TRANSCONF_GAMMA_MODE(crtc_state->gamma_mode); ··· 2948 3036 2949 3037 val |= TRANSCONF_FRAME_START_DELAY(crtc_state->framestart_delay - 1); 2950 3038 2951 - intel_de_write(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), val); 2952 - intel_de_posting_read(dev_priv, TRANSCONF(dev_priv, cpu_transcoder)); 2953 - } 2954 - 2955 - static bool i9xx_has_pfit(struct drm_i915_private *dev_priv) 2956 - { 2957 - if (IS_I830(dev_priv)) 2958 - return false; 2959 - 2960 - return DISPLAY_VER(dev_priv) >= 4 || 2961 - IS_PINEVIEW(dev_priv) || IS_MOBILE(dev_priv); 2962 - } 2963 - 2964 - static void i9xx_get_pfit_config(struct intel_crtc_state *crtc_state) 2965 - { 2966 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 2967 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2968 - enum pipe pipe; 2969 - u32 tmp; 2970 - 2971 - if (!i9xx_has_pfit(dev_priv)) 2972 - return; 2973 - 2974 - tmp = intel_de_read(dev_priv, PFIT_CONTROL(dev_priv)); 2975 - if (!(tmp & PFIT_ENABLE)) 2976 - return; 2977 - 2978 - /* Check whether the pfit is attached to our pipe. */ 2979 - if (DISPLAY_VER(dev_priv) >= 4) 2980 - pipe = REG_FIELD_GET(PFIT_PIPE_MASK, tmp); 2981 - else 2982 - pipe = PIPE_B; 2983 - 2984 - if (pipe != crtc->pipe) 2985 - return; 2986 - 2987 - crtc_state->gmch_pfit.control = tmp; 2988 - crtc_state->gmch_pfit.pgm_ratios = 2989 - intel_de_read(dev_priv, PFIT_PGM_RATIOS(dev_priv)); 3039 + intel_de_write(display, TRANSCONF(display, cpu_transcoder), val); 3040 + intel_de_posting_read(display, TRANSCONF(display, cpu_transcoder)); 2990 3041 } 2991 3042 2992 3043 static enum intel_output_format 2993 3044 bdw_get_pipe_misc_output_format(struct intel_crtc *crtc) 2994 3045 { 2995 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3046 + struct intel_display *display = to_intel_display(crtc); 2996 3047 u32 tmp; 2997 3048 2998 - tmp = intel_de_read(dev_priv, PIPE_MISC(crtc->pipe)); 3049 + tmp = intel_de_read(display, PIPE_MISC(crtc->pipe)); 2999 3050 3000 3051 if (tmp & PIPE_MISC_YUV420_ENABLE) { 3001 3052 /* ··· 2966 3091 * For xe3_lpd+ this is implied in YUV420 Enable bit. 2967 3092 * Ensure the same for prior platforms in YUV420 Mode bit. 2968 3093 */ 2969 - if (DISPLAY_VER(dev_priv) < 30) 2970 - drm_WARN_ON(&dev_priv->drm, 3094 + if (DISPLAY_VER(display) < 30) 3095 + drm_WARN_ON(display->drm, 2971 3096 (tmp & PIPE_MISC_YUV420_MODE_FULL_BLEND) == 0); 2972 3097 2973 3098 return INTEL_OUTPUT_FORMAT_YCBCR420; ··· 2982 3107 struct intel_crtc_state *pipe_config) 2983 3108 { 2984 3109 struct intel_display *display = to_intel_display(crtc); 2985 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 2986 3110 enum intel_display_power_domain power_domain; 3111 + enum transcoder cpu_transcoder = (enum transcoder)crtc->pipe; 2987 3112 intel_wakeref_t wakeref; 3113 + bool ret = false; 2988 3114 u32 tmp; 2989 - bool ret; 2990 3115 2991 3116 power_domain = POWER_DOMAIN_PIPE(crtc->pipe); 2992 3117 wakeref = intel_display_power_get_if_enabled(display, power_domain); 2993 3118 if (!wakeref) 2994 3119 return false; 2995 3120 2996 - pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; 2997 - pipe_config->sink_format = pipe_config->output_format; 2998 - pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; 2999 - pipe_config->shared_dpll = NULL; 3000 - 3001 - ret = false; 3002 - 3003 - tmp = intel_de_read(dev_priv, 3004 - TRANSCONF(dev_priv, pipe_config->cpu_transcoder)); 3121 + tmp = intel_de_read(display, TRANSCONF(display, cpu_transcoder)); 3005 3122 if (!(tmp & TRANSCONF_ENABLE)) 3006 3123 goto out; 3007 3124 3008 - if (IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) || 3009 - IS_CHERRYVIEW(dev_priv)) { 3125 + pipe_config->cpu_transcoder = cpu_transcoder; 3126 + 3127 + pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; 3128 + pipe_config->sink_format = pipe_config->output_format; 3129 + 3130 + if (display->platform.g4x || display->platform.valleyview || 3131 + display->platform.cherryview) { 3010 3132 switch (tmp & TRANSCONF_BPC_MASK) { 3011 3133 case TRANSCONF_BPC_6: 3012 3134 pipe_config->pipe_bpp = 18; ··· 3020 3148 } 3021 3149 } 3022 3150 3023 - if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && 3151 + if ((display->platform.valleyview || display->platform.cherryview) && 3024 3152 (tmp & TRANSCONF_COLOR_RANGE_SELECT)) 3025 3153 pipe_config->limited_color_range = true; 3026 3154 ··· 3028 3156 3029 3157 pipe_config->framestart_delay = REG_FIELD_GET(TRANSCONF_FRAME_START_DELAY_MASK, tmp) + 1; 3030 3158 3031 - if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && 3159 + if ((display->platform.valleyview || display->platform.cherryview) && 3032 3160 (tmp & TRANSCONF_WGC_ENABLE)) 3033 3161 pipe_config->wgc_enable = true; 3034 3162 3035 3163 intel_color_get_config(pipe_config); 3036 3164 3037 - if (HAS_DOUBLE_WIDE(dev_priv)) 3165 + if (HAS_DOUBLE_WIDE(display)) 3038 3166 pipe_config->double_wide = tmp & TRANSCONF_DOUBLE_WIDE; 3039 3167 3040 3168 intel_get_transcoder_timings(crtc, pipe_config); 3041 3169 intel_get_pipe_src_size(crtc, pipe_config); 3042 3170 3043 - i9xx_get_pfit_config(pipe_config); 3171 + i9xx_pfit_get_config(pipe_config); 3044 3172 3045 3173 i9xx_dpll_get_hw_state(crtc, &pipe_config->dpll_hw_state); 3046 3174 3047 - if (DISPLAY_VER(dev_priv) >= 4) { 3175 + if (DISPLAY_VER(display) >= 4) { 3048 3176 tmp = pipe_config->dpll_hw_state.i9xx.dpll_md; 3049 3177 pipe_config->pixel_multiplier = 3050 3178 ((tmp & DPLL_MD_UDI_MULTIPLIER_MASK) 3051 3179 >> DPLL_MD_UDI_MULTIPLIER_SHIFT) + 1; 3052 - } else if (IS_I945G(dev_priv) || IS_I945GM(dev_priv) || 3053 - IS_G33(dev_priv) || IS_PINEVIEW(dev_priv)) { 3180 + } else if (display->platform.i945g || display->platform.i945gm || 3181 + display->platform.g33 || display->platform.pineview) { 3054 3182 tmp = pipe_config->dpll_hw_state.i9xx.dpll; 3055 3183 pipe_config->pixel_multiplier = 3056 3184 ((tmp & SDVO_MULTIPLIER_MASK) ··· 3062 3190 pipe_config->pixel_multiplier = 1; 3063 3191 } 3064 3192 3065 - if (IS_CHERRYVIEW(dev_priv)) 3193 + if (display->platform.cherryview) 3066 3194 chv_crtc_clock_get(pipe_config); 3067 - else if (IS_VALLEYVIEW(dev_priv)) 3195 + else if (display->platform.valleyview) 3068 3196 vlv_crtc_clock_get(pipe_config); 3069 3197 else 3070 3198 i9xx_crtc_clock_get(pipe_config); ··· 3087 3215 3088 3216 void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state) 3089 3217 { 3090 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3091 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3218 + struct intel_display *display = to_intel_display(crtc_state); 3092 3219 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 3093 3220 u32 val = 0; 3094 3221 ··· 3129 3258 * This would end up with an odd purple hue over 3130 3259 * the entire display. Make sure we don't do it. 3131 3260 */ 3132 - drm_WARN_ON(&dev_priv->drm, crtc_state->limited_color_range && 3261 + drm_WARN_ON(display->drm, crtc_state->limited_color_range && 3133 3262 crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB); 3134 3263 3135 3264 if (crtc_state->limited_color_range && ··· 3144 3273 val |= TRANSCONF_FRAME_START_DELAY(crtc_state->framestart_delay - 1); 3145 3274 val |= TRANSCONF_MSA_TIMING_DELAY(crtc_state->msa_timing_delay); 3146 3275 3147 - intel_de_write(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), val); 3148 - intel_de_posting_read(dev_priv, TRANSCONF(dev_priv, cpu_transcoder)); 3276 + intel_de_write(display, TRANSCONF(display, cpu_transcoder), val); 3277 + intel_de_posting_read(display, TRANSCONF(display, cpu_transcoder)); 3149 3278 } 3150 3279 3151 3280 static void hsw_set_transconf(const struct intel_crtc_state *crtc_state) 3152 3281 { 3153 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3154 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3282 + struct intel_display *display = to_intel_display(crtc_state); 3155 3283 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 3156 3284 u32 val = 0; 3157 3285 ··· 3161 3291 if (!intel_crtc_needs_modeset(crtc_state)) 3162 3292 val |= TRANSCONF_ENABLE; 3163 3293 3164 - if (IS_HASWELL(dev_priv) && crtc_state->dither) 3294 + if (display->platform.haswell && crtc_state->dither) 3165 3295 val |= TRANSCONF_DITHER_EN | TRANSCONF_DITHER_TYPE_SP; 3166 3296 3167 3297 if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) ··· 3169 3299 else 3170 3300 val |= TRANSCONF_INTERLACE_PF_PD_ILK; 3171 3301 3172 - if (IS_HASWELL(dev_priv) && 3302 + if (display->platform.haswell && 3173 3303 crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB) 3174 3304 val |= TRANSCONF_OUTPUT_COLORSPACE_YUV_HSW; 3175 3305 3176 - intel_de_write(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), val); 3177 - intel_de_posting_read(dev_priv, TRANSCONF(dev_priv, cpu_transcoder)); 3306 + intel_de_write(display, TRANSCONF(display, cpu_transcoder), val); 3307 + intel_de_posting_read(display, TRANSCONF(display, cpu_transcoder)); 3178 3308 } 3179 3309 3180 3310 static void bdw_set_pipe_misc(struct intel_dsb *dsb, 3181 3311 const struct intel_crtc_state *crtc_state) 3182 3312 { 3313 + struct intel_display *display = to_intel_display(crtc_state); 3183 3314 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3184 - struct intel_display *display = to_intel_display(crtc->base.dev); 3185 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3186 3315 u32 val = 0; 3187 3316 3188 3317 switch (crtc_state->pipe_bpp) { ··· 3196 3327 break; 3197 3328 case 36: 3198 3329 /* Port output 12BPC defined for ADLP+ */ 3199 - if (DISPLAY_VER(dev_priv) >= 13) 3330 + if (DISPLAY_VER(display) >= 13) 3200 3331 val |= PIPE_MISC_BPC_12_ADLP; 3201 3332 break; 3202 3333 default: ··· 3215 3346 val |= DISPLAY_VER(display) >= 30 ? PIPE_MISC_YUV420_ENABLE : 3216 3347 PIPE_MISC_YUV420_ENABLE | PIPE_MISC_YUV420_MODE_FULL_BLEND; 3217 3348 3218 - if (DISPLAY_VER(dev_priv) >= 11 && is_hdr_mode(crtc_state)) 3349 + if (DISPLAY_VER(display) >= 11 && is_hdr_mode(crtc_state)) 3219 3350 val |= PIPE_MISC_HDR_MODE_PRECISION; 3220 3351 3221 - if (DISPLAY_VER(dev_priv) >= 12) 3352 + if (DISPLAY_VER(display) >= 12) 3222 3353 val |= PIPE_MISC_PIXEL_ROUNDING_TRUNC; 3223 3354 3224 3355 /* allow PSR with sprite enabled */ 3225 - if (IS_BROADWELL(dev_priv)) 3356 + if (display->platform.broadwell) 3226 3357 val |= PIPE_MISC_PSR_MASK_SPRITE_ENABLE; 3227 3358 3228 3359 intel_de_write_dsb(display, dsb, PIPE_MISC(crtc->pipe), val); ··· 3230 3361 3231 3362 int bdw_get_pipe_misc_bpp(struct intel_crtc *crtc) 3232 3363 { 3233 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3364 + struct intel_display *display = to_intel_display(crtc); 3234 3365 u32 tmp; 3235 3366 3236 - tmp = intel_de_read(dev_priv, PIPE_MISC(crtc->pipe)); 3367 + tmp = intel_de_read(display, PIPE_MISC(crtc->pipe)); 3237 3368 3238 3369 switch (tmp & PIPE_MISC_BPC_MASK) { 3239 3370 case PIPE_MISC_BPC_6: ··· 3253 3384 * MIPI DSI HW readout. 3254 3385 */ 3255 3386 case PIPE_MISC_BPC_12_ADLP: 3256 - if (DISPLAY_VER(dev_priv) >= 13) 3387 + if (DISPLAY_VER(display) >= 13) 3257 3388 return 36; 3258 3389 fallthrough; 3259 3390 default: ··· 3273 3404 return DIV_ROUND_UP(bps, link_bw * 8); 3274 3405 } 3275 3406 3276 - void intel_get_m_n(struct drm_i915_private *i915, 3407 + void intel_get_m_n(struct intel_display *display, 3277 3408 struct intel_link_m_n *m_n, 3278 3409 i915_reg_t data_m_reg, i915_reg_t data_n_reg, 3279 3410 i915_reg_t link_m_reg, i915_reg_t link_n_reg) 3280 3411 { 3281 - m_n->link_m = intel_de_read(i915, link_m_reg) & DATA_LINK_M_N_MASK; 3282 - m_n->link_n = intel_de_read(i915, link_n_reg) & DATA_LINK_M_N_MASK; 3283 - m_n->data_m = intel_de_read(i915, data_m_reg) & DATA_LINK_M_N_MASK; 3284 - m_n->data_n = intel_de_read(i915, data_n_reg) & DATA_LINK_M_N_MASK; 3285 - m_n->tu = REG_FIELD_GET(TU_SIZE_MASK, intel_de_read(i915, data_m_reg)) + 1; 3412 + m_n->link_m = intel_de_read(display, link_m_reg) & DATA_LINK_M_N_MASK; 3413 + m_n->link_n = intel_de_read(display, link_n_reg) & DATA_LINK_M_N_MASK; 3414 + m_n->data_m = intel_de_read(display, data_m_reg) & DATA_LINK_M_N_MASK; 3415 + m_n->data_n = intel_de_read(display, data_n_reg) & DATA_LINK_M_N_MASK; 3416 + m_n->tu = REG_FIELD_GET(TU_SIZE_MASK, intel_de_read(display, data_m_reg)) + 1; 3286 3417 } 3287 3418 3288 3419 void intel_cpu_transcoder_get_m1_n1(struct intel_crtc *crtc, 3289 3420 enum transcoder transcoder, 3290 3421 struct intel_link_m_n *m_n) 3291 3422 { 3292 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3423 + struct intel_display *display = to_intel_display(crtc); 3293 3424 enum pipe pipe = crtc->pipe; 3294 3425 3295 - if (DISPLAY_VER(dev_priv) >= 5) 3296 - intel_get_m_n(dev_priv, m_n, 3297 - PIPE_DATA_M1(dev_priv, transcoder), 3298 - PIPE_DATA_N1(dev_priv, transcoder), 3299 - PIPE_LINK_M1(dev_priv, transcoder), 3300 - PIPE_LINK_N1(dev_priv, transcoder)); 3426 + if (DISPLAY_VER(display) >= 5) 3427 + intel_get_m_n(display, m_n, 3428 + PIPE_DATA_M1(display, transcoder), 3429 + PIPE_DATA_N1(display, transcoder), 3430 + PIPE_LINK_M1(display, transcoder), 3431 + PIPE_LINK_N1(display, transcoder)); 3301 3432 else 3302 - intel_get_m_n(dev_priv, m_n, 3433 + intel_get_m_n(display, m_n, 3303 3434 PIPE_DATA_M_G4X(pipe), PIPE_DATA_N_G4X(pipe), 3304 3435 PIPE_LINK_M_G4X(pipe), PIPE_LINK_N_G4X(pipe)); 3305 3436 } ··· 3308 3439 enum transcoder transcoder, 3309 3440 struct intel_link_m_n *m_n) 3310 3441 { 3311 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3442 + struct intel_display *display = to_intel_display(crtc); 3312 3443 3313 - if (!intel_cpu_transcoder_has_m2_n2(dev_priv, transcoder)) 3444 + if (!intel_cpu_transcoder_has_m2_n2(display, transcoder)) 3314 3445 return; 3315 3446 3316 - intel_get_m_n(dev_priv, m_n, 3317 - PIPE_DATA_M2(dev_priv, transcoder), 3318 - PIPE_DATA_N2(dev_priv, transcoder), 3319 - PIPE_LINK_M2(dev_priv, transcoder), 3320 - PIPE_LINK_N2(dev_priv, transcoder)); 3321 - } 3322 - 3323 - static void ilk_get_pfit_config(struct intel_crtc_state *crtc_state) 3324 - { 3325 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3326 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3327 - u32 ctl, pos, size; 3328 - enum pipe pipe; 3329 - 3330 - ctl = intel_de_read(dev_priv, PF_CTL(crtc->pipe)); 3331 - if ((ctl & PF_ENABLE) == 0) 3332 - return; 3333 - 3334 - if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) 3335 - pipe = REG_FIELD_GET(PF_PIPE_SEL_MASK_IVB, ctl); 3336 - else 3337 - pipe = crtc->pipe; 3338 - 3339 - crtc_state->pch_pfit.enabled = true; 3340 - 3341 - pos = intel_de_read(dev_priv, PF_WIN_POS(crtc->pipe)); 3342 - size = intel_de_read(dev_priv, PF_WIN_SZ(crtc->pipe)); 3343 - 3344 - drm_rect_init(&crtc_state->pch_pfit.dst, 3345 - REG_FIELD_GET(PF_WIN_XPOS_MASK, pos), 3346 - REG_FIELD_GET(PF_WIN_YPOS_MASK, pos), 3347 - REG_FIELD_GET(PF_WIN_XSIZE_MASK, size), 3348 - REG_FIELD_GET(PF_WIN_YSIZE_MASK, size)); 3349 - 3350 - /* 3351 - * We currently do not free assignments of panel fitters on 3352 - * ivb/hsw (since we don't use the higher upscaling modes which 3353 - * differentiates them) so just WARN about this case for now. 3354 - */ 3355 - drm_WARN_ON(&dev_priv->drm, pipe != crtc->pipe); 3447 + intel_get_m_n(display, m_n, 3448 + PIPE_DATA_M2(display, transcoder), 3449 + PIPE_DATA_N2(display, transcoder), 3450 + PIPE_LINK_M2(display, transcoder), 3451 + PIPE_LINK_N2(display, transcoder)); 3356 3452 } 3357 3453 3358 3454 static bool ilk_get_pipe_config(struct intel_crtc *crtc, 3359 3455 struct intel_crtc_state *pipe_config) 3360 3456 { 3361 3457 struct intel_display *display = to_intel_display(crtc); 3362 - struct drm_device *dev = crtc->base.dev; 3363 - struct drm_i915_private *dev_priv = to_i915(dev); 3364 3458 enum intel_display_power_domain power_domain; 3459 + enum transcoder cpu_transcoder = (enum transcoder)crtc->pipe; 3365 3460 intel_wakeref_t wakeref; 3461 + bool ret = false; 3366 3462 u32 tmp; 3367 - bool ret; 3368 3463 3369 3464 power_domain = POWER_DOMAIN_PIPE(crtc->pipe); 3370 3465 wakeref = intel_display_power_get_if_enabled(display, power_domain); 3371 3466 if (!wakeref) 3372 3467 return false; 3373 3468 3374 - pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; 3375 - pipe_config->shared_dpll = NULL; 3376 - 3377 - ret = false; 3378 - tmp = intel_de_read(dev_priv, 3379 - TRANSCONF(dev_priv, pipe_config->cpu_transcoder)); 3469 + tmp = intel_de_read(display, TRANSCONF(display, cpu_transcoder)); 3380 3470 if (!(tmp & TRANSCONF_ENABLE)) 3381 3471 goto out; 3472 + 3473 + pipe_config->cpu_transcoder = cpu_transcoder; 3382 3474 3383 3475 switch (tmp & TRANSCONF_BPC_MASK) { 3384 3476 case TRANSCONF_BPC_6: ··· 3388 3558 intel_get_transcoder_timings(crtc, pipe_config); 3389 3559 intel_get_pipe_src_size(crtc, pipe_config); 3390 3560 3391 - ilk_get_pfit_config(pipe_config); 3561 + ilk_pfit_get_config(pipe_config); 3392 3562 3393 3563 ret = true; 3394 3564 ··· 3398 3568 return ret; 3399 3569 } 3400 3570 3401 - static u8 joiner_pipes(struct drm_i915_private *i915) 3571 + static u8 joiner_pipes(struct intel_display *display) 3402 3572 { 3403 3573 u8 pipes; 3404 3574 3405 - if (DISPLAY_VER(i915) >= 12) 3575 + if (DISPLAY_VER(display) >= 12) 3406 3576 pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D); 3407 - else if (DISPLAY_VER(i915) >= 11) 3577 + else if (DISPLAY_VER(display) >= 11) 3408 3578 pipes = BIT(PIPE_B) | BIT(PIPE_C); 3409 3579 else 3410 3580 pipes = 0; 3411 3581 3412 - return pipes & DISPLAY_RUNTIME_INFO(i915)->pipe_mask; 3582 + return pipes & DISPLAY_RUNTIME_INFO(display)->pipe_mask; 3413 3583 } 3414 3584 3415 - static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, 3585 + static bool transcoder_ddi_func_is_enabled(struct intel_display *display, 3416 3586 enum transcoder cpu_transcoder) 3417 3587 { 3418 - struct intel_display *display = &dev_priv->display; 3419 3588 enum intel_display_power_domain power_domain; 3420 3589 intel_wakeref_t wakeref; 3421 3590 u32 tmp = 0; ··· 3422 3593 power_domain = POWER_DOMAIN_TRANSCODER(cpu_transcoder); 3423 3594 3424 3595 with_intel_display_power_if_enabled(display, power_domain, wakeref) 3425 - tmp = intel_de_read(dev_priv, 3426 - TRANS_DDI_FUNC_CTL(dev_priv, cpu_transcoder)); 3596 + tmp = intel_de_read(display, 3597 + TRANS_DDI_FUNC_CTL(display, cpu_transcoder)); 3427 3598 3428 3599 return tmp & TRANS_DDI_FUNC_ENABLE; 3429 3600 } ··· 3431 3602 static void enabled_uncompressed_joiner_pipes(struct intel_display *display, 3432 3603 u8 *primary_pipes, u8 *secondary_pipes) 3433 3604 { 3434 - struct drm_i915_private *i915 = to_i915(display->drm); 3435 3605 struct intel_crtc *crtc; 3436 3606 3437 3607 *primary_pipes = 0; ··· 3439 3611 if (!HAS_UNCOMPRESSED_JOINER(display)) 3440 3612 return; 3441 3613 3442 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, 3443 - joiner_pipes(i915)) { 3614 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, 3615 + joiner_pipes(display)) { 3444 3616 enum intel_display_power_domain power_domain; 3445 3617 enum pipe pipe = crtc->pipe; 3446 3618 intel_wakeref_t wakeref; ··· 3460 3632 static void enabled_bigjoiner_pipes(struct intel_display *display, 3461 3633 u8 *primary_pipes, u8 *secondary_pipes) 3462 3634 { 3463 - struct drm_i915_private *i915 = to_i915(display->drm); 3464 3635 struct intel_crtc *crtc; 3465 3636 3466 3637 *primary_pipes = 0; ··· 3468 3641 if (!HAS_BIGJOINER(display)) 3469 3642 return; 3470 3643 3471 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, 3472 - joiner_pipes(i915)) { 3644 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, 3645 + joiner_pipes(display)) { 3473 3646 enum intel_display_power_domain power_domain; 3474 3647 enum pipe pipe = crtc->pipe; 3475 3648 intel_wakeref_t wakeref; ··· 3527 3700 return ultrajoiner_secondary_pipes | ultrajoiner_primary_pipes << 3; 3528 3701 } 3529 3702 3530 - static void enabled_ultrajoiner_pipes(struct drm_i915_private *i915, 3703 + static void enabled_ultrajoiner_pipes(struct intel_display *display, 3531 3704 u8 *primary_pipes, u8 *secondary_pipes) 3532 3705 { 3533 - struct intel_display *display = &i915->display; 3534 3706 struct intel_crtc *crtc; 3535 3707 3536 3708 *primary_pipes = 0; ··· 3538 3712 if (!HAS_ULTRAJOINER(display)) 3539 3713 return; 3540 3714 3541 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, 3542 - joiner_pipes(i915)) { 3715 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, 3716 + joiner_pipes(display)) { 3543 3717 enum intel_display_power_domain power_domain; 3544 3718 enum pipe pipe = crtc->pipe; 3545 3719 intel_wakeref_t wakeref; 3546 3720 3547 3721 power_domain = intel_dsc_power_domain(crtc, (enum transcoder)pipe); 3548 3722 with_intel_display_power_if_enabled(display, power_domain, wakeref) { 3549 - u32 tmp = intel_de_read(i915, ICL_PIPE_DSS_CTL1(pipe)); 3723 + u32 tmp = intel_de_read(display, ICL_PIPE_DSS_CTL1(pipe)); 3550 3724 3551 3725 if (!(tmp & ULTRA_JOINER_ENABLE)) 3552 3726 continue; ··· 3559 3733 } 3560 3734 } 3561 3735 3562 - static void enabled_joiner_pipes(struct drm_i915_private *dev_priv, 3736 + static void enabled_joiner_pipes(struct intel_display *display, 3563 3737 enum pipe pipe, 3564 3738 u8 *primary_pipe, u8 *secondary_pipes) 3565 3739 { 3566 - struct intel_display *display = to_intel_display(&dev_priv->drm); 3567 3740 u8 primary_ultrajoiner_pipes; 3568 3741 u8 primary_uncompressed_joiner_pipes, primary_bigjoiner_pipes; 3569 3742 u8 secondary_ultrajoiner_pipes; ··· 3570 3745 u8 ultrajoiner_pipes; 3571 3746 u8 uncompressed_joiner_pipes, bigjoiner_pipes; 3572 3747 3573 - enabled_ultrajoiner_pipes(dev_priv, &primary_ultrajoiner_pipes, 3748 + enabled_ultrajoiner_pipes(display, &primary_ultrajoiner_pipes, 3574 3749 &secondary_ultrajoiner_pipes); 3575 3750 /* 3576 3751 * For some strange reason the last pipe in the set of four 3577 3752 * shouldn't have ultrajoiner enable bit set in hardware. 3578 3753 * Set the bit anyway to make life easier. 3579 3754 */ 3580 - drm_WARN_ON(&dev_priv->drm, 3755 + drm_WARN_ON(display->drm, 3581 3756 expected_secondary_pipes(primary_ultrajoiner_pipes, 3) != 3582 3757 secondary_ultrajoiner_pipes); 3583 3758 secondary_ultrajoiner_pipes = 3584 3759 fixup_ultrajoiner_secondary_pipes(primary_ultrajoiner_pipes, 3585 3760 secondary_ultrajoiner_pipes); 3586 3761 3587 - drm_WARN_ON(&dev_priv->drm, (primary_ultrajoiner_pipes & secondary_ultrajoiner_pipes) != 0); 3762 + drm_WARN_ON(display->drm, (primary_ultrajoiner_pipes & secondary_ultrajoiner_pipes) != 0); 3588 3763 3589 3764 enabled_uncompressed_joiner_pipes(display, &primary_uncompressed_joiner_pipes, 3590 3765 &secondary_uncompressed_joiner_pipes); ··· 3678 3853 } 3679 3854 } 3680 3855 3681 - static u8 hsw_panel_transcoders(struct drm_i915_private *i915) 3856 + static u8 hsw_panel_transcoders(struct intel_display *display) 3682 3857 { 3683 3858 u8 panel_transcoder_mask = BIT(TRANSCODER_EDP); 3684 3859 3685 - if (DISPLAY_VER(i915) >= 11) 3860 + if (DISPLAY_VER(display) >= 11) 3686 3861 panel_transcoder_mask |= BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1); 3687 3862 3688 3863 return panel_transcoder_mask; ··· 3691 3866 static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) 3692 3867 { 3693 3868 struct intel_display *display = to_intel_display(crtc); 3694 - struct drm_device *dev = crtc->base.dev; 3695 - struct drm_i915_private *dev_priv = to_i915(dev); 3696 - u8 panel_transcoder_mask = hsw_panel_transcoders(dev_priv); 3869 + u8 panel_transcoder_mask = hsw_panel_transcoders(display); 3697 3870 enum transcoder cpu_transcoder; 3698 3871 u8 primary_pipe, secondary_pipes; 3699 3872 u8 enabled_transcoders = 0; ··· 3700 3877 * XXX: Do intel_display_power_get_if_enabled before reading this (for 3701 3878 * consistency and less surprising code; it's in always on power). 3702 3879 */ 3703 - for_each_cpu_transcoder_masked(dev_priv, cpu_transcoder, 3880 + for_each_cpu_transcoder_masked(display, cpu_transcoder, 3704 3881 panel_transcoder_mask) { 3705 3882 enum intel_display_power_domain power_domain; 3706 3883 intel_wakeref_t wakeref; ··· 3709 3886 3710 3887 power_domain = POWER_DOMAIN_TRANSCODER(cpu_transcoder); 3711 3888 with_intel_display_power_if_enabled(display, power_domain, wakeref) 3712 - tmp = intel_de_read(dev_priv, 3713 - TRANS_DDI_FUNC_CTL(dev_priv, cpu_transcoder)); 3889 + tmp = intel_de_read(display, 3890 + TRANS_DDI_FUNC_CTL(display, cpu_transcoder)); 3714 3891 3715 3892 if (!(tmp & TRANS_DDI_FUNC_ENABLE)) 3716 3893 continue; 3717 3894 3718 3895 switch (tmp & TRANS_DDI_EDP_INPUT_MASK) { 3719 3896 default: 3720 - drm_WARN(dev, 1, 3897 + drm_WARN(display->drm, 1, 3721 3898 "unknown pipe linked to transcoder %s\n", 3722 3899 transcoder_name(cpu_transcoder)); 3723 3900 fallthrough; ··· 3742 3919 3743 3920 /* single pipe or joiner primary */ 3744 3921 cpu_transcoder = (enum transcoder) crtc->pipe; 3745 - if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder)) 3922 + if (transcoder_ddi_func_is_enabled(display, cpu_transcoder)) 3746 3923 enabled_transcoders |= BIT(cpu_transcoder); 3747 3924 3748 3925 /* joiner secondary -> consider the primary pipe's transcoder as well */ 3749 - enabled_joiner_pipes(dev_priv, crtc->pipe, &primary_pipe, &secondary_pipes); 3926 + enabled_joiner_pipes(display, crtc->pipe, &primary_pipe, &secondary_pipes); 3750 3927 if (secondary_pipes & BIT(crtc->pipe)) { 3751 3928 cpu_transcoder = (enum transcoder)ffs(primary_pipe) - 1; 3752 - if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder)) 3929 + if (transcoder_ddi_func_is_enabled(display, cpu_transcoder)) 3753 3930 enabled_transcoders |= BIT(cpu_transcoder); 3754 3931 } 3755 3932 ··· 3774 3951 BIT(TRANSCODER_DSI_1)); 3775 3952 } 3776 3953 3777 - static void assert_enabled_transcoders(struct drm_i915_private *i915, 3954 + static void assert_enabled_transcoders(struct intel_display *display, 3778 3955 u8 enabled_transcoders) 3779 3956 { 3780 3957 /* Only one type of transcoder please */ 3781 - drm_WARN_ON(&i915->drm, 3958 + drm_WARN_ON(display->drm, 3782 3959 has_edp_transcoders(enabled_transcoders) + 3783 3960 has_dsi_transcoders(enabled_transcoders) + 3784 3961 has_pipe_transcoders(enabled_transcoders) > 1); 3785 3962 3786 3963 /* Only DSI transcoders can be ganged */ 3787 - drm_WARN_ON(&i915->drm, 3964 + drm_WARN_ON(display->drm, 3788 3965 !has_dsi_transcoders(enabled_transcoders) && 3789 3966 !is_power_of_2(enabled_transcoders)); 3790 3967 } ··· 3794 3971 struct intel_display_power_domain_set *power_domain_set) 3795 3972 { 3796 3973 struct intel_display *display = to_intel_display(crtc); 3797 - struct drm_device *dev = crtc->base.dev; 3798 - struct drm_i915_private *dev_priv = to_i915(dev); 3799 3974 unsigned long enabled_transcoders; 3800 3975 u32 tmp; 3801 3976 ··· 3801 3980 if (!enabled_transcoders) 3802 3981 return false; 3803 3982 3804 - assert_enabled_transcoders(dev_priv, enabled_transcoders); 3983 + assert_enabled_transcoders(display, enabled_transcoders); 3805 3984 3806 3985 /* 3807 3986 * With the exception of DSI we should only ever have ··· 3814 3993 POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder))) 3815 3994 return false; 3816 3995 3817 - if (hsw_panel_transcoders(dev_priv) & BIT(pipe_config->cpu_transcoder)) { 3818 - tmp = intel_de_read(dev_priv, 3819 - TRANS_DDI_FUNC_CTL(dev_priv, pipe_config->cpu_transcoder)); 3996 + if (hsw_panel_transcoders(display) & BIT(pipe_config->cpu_transcoder)) { 3997 + tmp = intel_de_read(display, 3998 + TRANS_DDI_FUNC_CTL(display, pipe_config->cpu_transcoder)); 3820 3999 3821 4000 if ((tmp & TRANS_DDI_EDP_INPUT_MASK) == TRANS_DDI_EDP_INPUT_A_ONOFF) 3822 4001 pipe_config->pch_pfit.force_thru = true; 3823 4002 } 3824 4003 3825 - tmp = intel_de_read(dev_priv, 3826 - TRANSCONF(dev_priv, pipe_config->cpu_transcoder)); 4004 + tmp = intel_de_read(display, 4005 + TRANSCONF(display, pipe_config->cpu_transcoder)); 3827 4006 3828 4007 return tmp & TRANSCONF_ENABLE; 3829 4008 } ··· 3876 4055 3877 4056 static void intel_joiner_get_config(struct intel_crtc_state *crtc_state) 3878 4057 { 4058 + struct intel_display *display = to_intel_display(crtc_state); 3879 4059 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3880 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 3881 4060 u8 primary_pipe, secondary_pipes; 3882 4061 enum pipe pipe = crtc->pipe; 3883 4062 3884 - enabled_joiner_pipes(i915, pipe, &primary_pipe, &secondary_pipes); 4063 + enabled_joiner_pipes(display, pipe, &primary_pipe, &secondary_pipes); 3885 4064 3886 4065 if (((primary_pipe | secondary_pipes) & BIT(pipe)) == 0) 3887 4066 return; ··· 3893 4072 struct intel_crtc_state *pipe_config) 3894 4073 { 3895 4074 struct intel_display *display = to_intel_display(crtc); 3896 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 3897 4075 bool active; 3898 4076 u32 tmp; 3899 4077 ··· 3900 4080 POWER_DOMAIN_PIPE(crtc->pipe))) 3901 4081 return false; 3902 4082 3903 - pipe_config->shared_dpll = NULL; 3904 - 3905 4083 active = hsw_get_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains); 3906 4084 3907 - if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) && 4085 + if ((display->platform.geminilake || display->platform.broxton) && 3908 4086 bxt_get_dsi_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains)) { 3909 - drm_WARN_ON(&dev_priv->drm, active); 4087 + drm_WARN_ON(display->drm, active); 3910 4088 active = true; 3911 4089 } 3912 4090 ··· 3915 4097 intel_dsc_get_config(pipe_config); 3916 4098 3917 4099 if (!transcoder_is_dsi(pipe_config->cpu_transcoder) || 3918 - DISPLAY_VER(dev_priv) >= 11) 4100 + DISPLAY_VER(display) >= 11) 3919 4101 intel_get_transcoder_timings(crtc, pipe_config); 3920 4102 3921 - if (HAS_VRR(dev_priv) && !transcoder_is_dsi(pipe_config->cpu_transcoder)) 4103 + if (HAS_VRR(display) && !transcoder_is_dsi(pipe_config->cpu_transcoder)) 3922 4104 intel_vrr_get_config(pipe_config); 3923 4105 3924 4106 intel_get_pipe_src_size(crtc, pipe_config); 3925 4107 3926 - if (IS_HASWELL(dev_priv)) { 3927 - u32 tmp = intel_de_read(dev_priv, 3928 - TRANSCONF(dev_priv, pipe_config->cpu_transcoder)); 4108 + if (display->platform.haswell) { 4109 + u32 tmp = intel_de_read(display, 4110 + TRANSCONF(display, pipe_config->cpu_transcoder)); 3929 4111 3930 4112 if (tmp & TRANSCONF_OUTPUT_COLORSPACE_YUV_HSW) 3931 4113 pipe_config->output_format = INTEL_OUTPUT_FORMAT_YCBCR444; ··· 3940 4122 3941 4123 intel_color_get_config(pipe_config); 3942 4124 3943 - tmp = intel_de_read(dev_priv, WM_LINETIME(crtc->pipe)); 4125 + tmp = intel_de_read(display, WM_LINETIME(crtc->pipe)); 3944 4126 pipe_config->linetime = REG_FIELD_GET(HSW_LINETIME_MASK, tmp); 3945 - if (IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) 4127 + if (display->platform.broadwell || display->platform.haswell) 3946 4128 pipe_config->ips_linetime = 3947 4129 REG_FIELD_GET(HSW_IPS_LINETIME_MASK, tmp); 3948 4130 3949 4131 if (intel_display_power_get_in_set_if_enabled(display, &crtc->hw_readout_power_domains, 3950 4132 POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe))) { 3951 - if (DISPLAY_VER(dev_priv) >= 9) 4133 + if (DISPLAY_VER(display) >= 9) 3952 4134 skl_scaler_get_config(pipe_config); 3953 4135 else 3954 - ilk_get_pfit_config(pipe_config); 4136 + ilk_pfit_get_config(pipe_config); 3955 4137 } 3956 4138 3957 4139 hsw_ips_get_config(pipe_config); ··· 3959 4141 if (pipe_config->cpu_transcoder != TRANSCODER_EDP && 3960 4142 !transcoder_is_dsi(pipe_config->cpu_transcoder)) { 3961 4143 pipe_config->pixel_multiplier = 3962 - intel_de_read(dev_priv, 3963 - TRANS_MULT(dev_priv, pipe_config->cpu_transcoder)) + 1; 4144 + intel_de_read(display, 4145 + TRANS_MULT(display, pipe_config->cpu_transcoder)) + 1; 3964 4146 } else { 3965 4147 pipe_config->pixel_multiplier = 1; 3966 4148 } ··· 3982 4164 3983 4165 bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state) 3984 4166 { 4167 + struct intel_display *display = to_intel_display(crtc_state); 3985 4168 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 3986 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 3987 4169 3988 - if (!i915->display.funcs.display->get_pipe_config(crtc, crtc_state)) 4170 + if (!display->funcs.display->get_pipe_config(crtc, crtc_state)) 3989 4171 return false; 3990 4172 3991 4173 crtc_state->hw.active = true; ··· 4144 4326 4145 4327 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state) 4146 4328 { 4329 + struct intel_display *display = to_intel_display(crtc_state); 4147 4330 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 4148 4331 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 4149 4332 const struct drm_display_mode *pipe_mode = ··· 4158 4339 crtc_state->pixel_rate); 4159 4340 4160 4341 /* Display WA #1135: BXT:ALL GLK:ALL */ 4161 - if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) && 4342 + if ((display->platform.geminilake || display->platform.broxton) && 4162 4343 skl_watermark_ipc_enabled(dev_priv)) 4163 4344 linetime_wm /= 2; 4164 4345 ··· 4168 4349 static int hsw_compute_linetime_wm(struct intel_atomic_state *state, 4169 4350 struct intel_crtc *crtc) 4170 4351 { 4171 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 4352 + struct intel_display *display = to_intel_display(state); 4172 4353 struct intel_crtc_state *crtc_state = 4173 4354 intel_atomic_get_new_crtc_state(state, crtc); 4174 4355 const struct intel_cdclk_state *cdclk_state; 4175 4356 4176 - if (DISPLAY_VER(dev_priv) >= 9) 4357 + if (DISPLAY_VER(display) >= 9) 4177 4358 crtc_state->linetime = skl_linetime_wm(crtc_state); 4178 4359 else 4179 4360 crtc_state->linetime = hsw_linetime_wm(crtc_state); ··· 4195 4376 struct intel_crtc *crtc) 4196 4377 { 4197 4378 struct intel_display *display = to_intel_display(crtc); 4198 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 4199 4379 struct intel_crtc_state *crtc_state = 4200 4380 intel_atomic_get_new_crtc_state(state, crtc); 4201 4381 int ret; 4202 4382 4203 - if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv) && 4383 + if (DISPLAY_VER(display) < 5 && !display->platform.g4x && 4204 4384 intel_crtc_needs_modeset(crtc_state) && 4205 4385 !crtc_state->hw.active) 4206 4386 crtc_state->update_wm_post = true; ··· 4216 4398 4217 4399 ret = intel_wm_compute(state, crtc); 4218 4400 if (ret) { 4219 - drm_dbg_kms(&dev_priv->drm, 4401 + drm_dbg_kms(display->drm, 4220 4402 "[CRTC:%d:%s] watermarks are invalid\n", 4221 4403 crtc->base.base.id, crtc->base.name); 4222 4404 return ret; 4223 4405 } 4224 4406 4225 - if (DISPLAY_VER(dev_priv) >= 9) { 4407 + if (DISPLAY_VER(display) >= 9) { 4226 4408 if (intel_crtc_needs_modeset(crtc_state) || 4227 4409 intel_crtc_needs_fastset(crtc_state)) { 4228 4410 ret = skl_update_scaler_crtc(crtc_state); ··· 4241 4423 return ret; 4242 4424 } 4243 4425 4244 - if (DISPLAY_VER(dev_priv) >= 9 || 4245 - IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) { 4426 + if (DISPLAY_VER(display) >= 9 || 4427 + display->platform.broadwell || display->platform.haswell) { 4246 4428 ret = hsw_compute_linetime_wm(state, crtc); 4247 4429 if (ret) 4248 4430 return ret; ··· 4260 4442 compute_sink_pipe_bpp(const struct drm_connector_state *conn_state, 4261 4443 struct intel_crtc_state *crtc_state) 4262 4444 { 4445 + struct intel_display *display = to_intel_display(crtc_state); 4263 4446 struct drm_connector *connector = conn_state->connector; 4264 - struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 4265 4447 const struct drm_display_info *info = &connector->display_info; 4266 4448 int bpp; 4267 4449 ··· 4284 4466 } 4285 4467 4286 4468 if (bpp < crtc_state->pipe_bpp) { 4287 - drm_dbg_kms(&i915->drm, 4469 + drm_dbg_kms(display->drm, 4288 4470 "[CONNECTOR:%d:%s] Limiting display bpp to %d " 4289 4471 "(EDID bpp %d, max requested bpp %d, max platform bpp %d)\n", 4290 4472 connector->base.id, connector->name, ··· 4302 4484 compute_baseline_pipe_bpp(struct intel_atomic_state *state, 4303 4485 struct intel_crtc *crtc) 4304 4486 { 4305 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 4487 + struct intel_display *display = to_intel_display(crtc); 4306 4488 struct intel_crtc_state *crtc_state = 4307 4489 intel_atomic_get_new_crtc_state(state, crtc); 4308 4490 struct drm_connector *connector; 4309 4491 struct drm_connector_state *connector_state; 4310 4492 int bpp, i; 4311 4493 4312 - if ((IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) || 4313 - IS_CHERRYVIEW(dev_priv))) 4494 + if (display->platform.g4x || display->platform.valleyview || 4495 + display->platform.cherryview) 4314 4496 bpp = 10*3; 4315 - else if (DISPLAY_VER(dev_priv) >= 5) 4497 + else if (DISPLAY_VER(display) >= 5) 4316 4498 bpp = 12*3; 4317 4499 else 4318 4500 bpp = 8*3; ··· 4336 4518 4337 4519 static bool check_digital_port_conflicts(struct intel_atomic_state *state) 4338 4520 { 4339 - struct drm_device *dev = state->base.dev; 4521 + struct intel_display *display = to_intel_display(state); 4340 4522 struct drm_connector *connector; 4341 4523 struct drm_connector_list_iter conn_iter; 4342 4524 unsigned int used_ports = 0; ··· 4347 4529 * We're going to peek into connector->state, 4348 4530 * hence connection_mutex must be held. 4349 4531 */ 4350 - drm_modeset_lock_assert_held(&dev->mode_config.connection_mutex); 4532 + drm_modeset_lock_assert_held(&display->drm->mode_config.connection_mutex); 4351 4533 4352 4534 /* 4353 4535 * Walk the connector list instead of the encoder 4354 4536 * list to detect the problem on ddi platforms 4355 4537 * where there's just one encoder per digital port. 4356 4538 */ 4357 - drm_connector_list_iter_begin(dev, &conn_iter); 4539 + drm_connector_list_iter_begin(display->drm, &conn_iter); 4358 4540 drm_for_each_connector_iter(connector, &conn_iter) { 4359 4541 struct drm_connector_state *connector_state; 4360 4542 struct intel_encoder *encoder; ··· 4370 4552 4371 4553 encoder = to_intel_encoder(connector_state->best_encoder); 4372 4554 4373 - drm_WARN_ON(dev, !connector_state->crtc); 4555 + drm_WARN_ON(display->drm, !connector_state->crtc); 4374 4556 4375 4557 switch (encoder->type) { 4376 4558 case INTEL_OUTPUT_DDI: 4377 - if (drm_WARN_ON(dev, !HAS_DDI(to_i915(dev)))) 4559 + if (drm_WARN_ON(display->drm, !HAS_DDI(display))) 4378 4560 break; 4379 4561 fallthrough; 4380 4562 case INTEL_OUTPUT_DP: ··· 4522 4704 intel_crtc_prepare_cleared_state(struct intel_atomic_state *state, 4523 4705 struct intel_crtc *crtc) 4524 4706 { 4707 + struct intel_display *display = to_intel_display(state); 4525 4708 struct intel_crtc_state *crtc_state = 4526 4709 intel_atomic_get_new_crtc_state(state, crtc); 4527 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 4528 4710 struct intel_crtc_state *saved_state; 4529 4711 4530 4712 saved_state = intel_crtc_state_alloc(crtc); ··· 4549 4731 memcpy(saved_state->icl_port_dplls, crtc_state->icl_port_dplls, 4550 4732 sizeof(saved_state->icl_port_dplls)); 4551 4733 saved_state->crc_enabled = crtc_state->crc_enabled; 4552 - if (IS_G4X(dev_priv) || 4553 - IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) 4734 + if (display->platform.g4x || 4735 + display->platform.valleyview || display->platform.cherryview) 4554 4736 saved_state->wm = crtc_state->wm; 4555 4737 4556 4738 memcpy(crtc_state, saved_state, sizeof(*crtc_state)); ··· 4566 4748 struct intel_crtc *crtc, 4567 4749 const struct intel_link_bw_limits *limits) 4568 4750 { 4569 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 4751 + struct intel_display *display = to_intel_display(crtc); 4570 4752 struct intel_crtc_state *crtc_state = 4571 4753 intel_atomic_get_new_crtc_state(state, crtc); 4572 4754 struct drm_connector *connector; ··· 4599 4781 crtc_state->max_link_bpp_x16 = limits->max_bpp_x16[crtc->pipe]; 4600 4782 4601 4783 if (crtc_state->pipe_bpp > fxp_q4_to_int(crtc_state->max_link_bpp_x16)) { 4602 - drm_dbg_kms(&i915->drm, 4784 + drm_dbg_kms(display->drm, 4603 4785 "[CRTC:%d:%s] Link bpp limited to " FXP_Q4_FMT "\n", 4604 4786 crtc->base.base.id, crtc->base.name, 4605 4787 FXP_Q4_ARGS(crtc_state->max_link_bpp_x16)); ··· 4629 4811 continue; 4630 4812 4631 4813 if (!check_single_encoder_cloning(state, crtc, encoder)) { 4632 - drm_dbg_kms(&i915->drm, 4814 + drm_dbg_kms(display->drm, 4633 4815 "[ENCODER:%d:%s] rejecting invalid cloning configuration\n", 4634 4816 encoder->base.base.id, encoder->base.name); 4635 4817 return -EINVAL; ··· 4671 4853 if (ret == -EDEADLK) 4672 4854 return ret; 4673 4855 if (ret < 0) { 4674 - drm_dbg_kms(&i915->drm, "[ENCODER:%d:%s] config failure: %d\n", 4856 + drm_dbg_kms(display->drm, "[ENCODER:%d:%s] config failure: %d\n", 4675 4857 encoder->base.base.id, encoder->base.name, ret); 4676 4858 return ret; 4677 4859 } ··· 4687 4869 if (ret == -EDEADLK) 4688 4870 return ret; 4689 4871 if (ret < 0) { 4690 - drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] config failure: %d\n", 4872 + drm_dbg_kms(display->drm, "[CRTC:%d:%s] config failure: %d\n", 4691 4873 crtc->base.base.id, crtc->base.name, ret); 4692 4874 return ret; 4693 4875 } ··· 4698 4880 */ 4699 4881 crtc_state->dither = (crtc_state->pipe_bpp == 6*3) && 4700 4882 !crtc_state->dither_force_disable; 4701 - drm_dbg_kms(&i915->drm, 4883 + drm_dbg_kms(display->drm, 4702 4884 "[CRTC:%d:%s] hw max bpp: %i, pipe bpp: %i, dithering: %i\n", 4703 4885 crtc->base.base.id, crtc->base.name, 4704 4886 base_bpp, crtc_state->pipe_bpp, crtc_state->dither); ··· 4830 5012 const union hdmi_infoframe *a, 4831 5013 const union hdmi_infoframe *b) 4832 5014 { 4833 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 5015 + struct intel_display *display = to_intel_display(crtc); 4834 5016 const char *loglevel; 4835 5017 4836 5018 if (fastset) { ··· 4845 5027 pipe_config_mismatch(p, fastset, crtc, name, "infoframe"); 4846 5028 4847 5029 drm_printf(p, "expected:\n"); 4848 - hdmi_infoframe_log(loglevel, i915->drm.dev, a); 5030 + hdmi_infoframe_log(loglevel, display->drm->dev, a); 4849 5031 drm_printf(p, "found:\n"); 4850 - hdmi_infoframe_log(loglevel, i915->drm.dev, b); 5032 + hdmi_infoframe_log(loglevel, display->drm->dev, b); 4851 5033 } 4852 5034 4853 5035 static void ··· 4963 5145 bool fastset) 4964 5146 { 4965 5147 struct intel_display *display = to_intel_display(current_config); 4966 - struct drm_i915_private *dev_priv = to_i915(current_config->uapi.crtc->dev); 4967 5148 struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); 4968 5149 struct drm_printer p; 4969 5150 u32 exclude_infoframes = 0; 4970 5151 bool ret = true; 4971 5152 4972 5153 if (fastset) 4973 - p = drm_dbg_printer(&dev_priv->drm, DRM_UT_KMS, NULL); 5154 + p = drm_dbg_printer(display->drm, DRM_UT_KMS, NULL); 4974 5155 else 4975 - p = drm_err_printer(&dev_priv->drm, NULL); 5156 + p = drm_err_printer(display->drm, NULL); 4976 5157 4977 5158 #define PIPE_CONF_CHECK_X(name) do { \ 4978 5159 if (current_config->name != pipe_config->name) { \ ··· 5238 5421 5239 5422 PIPE_CONF_CHECK_I(output_format); 5240 5423 PIPE_CONF_CHECK_BOOL(has_hdmi_sink); 5241 - if ((DISPLAY_VER(dev_priv) < 8 && !IS_HASWELL(dev_priv)) || 5242 - IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) 5424 + if ((DISPLAY_VER(display) < 8 && !display->platform.haswell) || 5425 + display->platform.valleyview || display->platform.cherryview) 5243 5426 PIPE_CONF_CHECK_BOOL(limited_color_range); 5244 5427 5245 5428 PIPE_CONF_CHECK_BOOL(hdmi_scrambling); ··· 5255 5438 5256 5439 PIPE_CONF_CHECK_X(gmch_pfit.control); 5257 5440 /* pfit ratios are autocomputed by the hw on gen4+ */ 5258 - if (DISPLAY_VER(dev_priv) < 4) 5441 + if (DISPLAY_VER(display) < 4) 5259 5442 PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios); 5260 5443 PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits); 5261 5444 ··· 5275 5458 PIPE_CONF_CHECK_I(pixel_rate); 5276 5459 5277 5460 PIPE_CONF_CHECK_X(gamma_mode); 5278 - if (IS_CHERRYVIEW(dev_priv)) 5461 + if (display->platform.cherryview) 5279 5462 PIPE_CONF_CHECK_X(cgm_mode); 5280 5463 else 5281 5464 PIPE_CONF_CHECK_X(csc_mode); ··· 5295 5478 5296 5479 PIPE_CONF_CHECK_BOOL(double_wide); 5297 5480 5298 - if (dev_priv->display.dpll.mgr) 5481 + if (display->dpll.mgr) 5299 5482 PIPE_CONF_CHECK_P(shared_dpll); 5300 5483 5301 5484 /* FIXME convert everything over the dpll_mgr */ 5302 - if (dev_priv->display.dpll.mgr || HAS_GMCH(dev_priv)) 5485 + if (display->dpll.mgr || HAS_GMCH(display)) 5303 5486 PIPE_CONF_CHECK_PLL(dpll_hw_state); 5304 5487 5305 5488 /* FIXME convert MTL+ platforms over to dpll_mgr */ 5306 - if (DISPLAY_VER(dev_priv) >= 14) 5489 + if (DISPLAY_VER(display) >= 14) 5307 5490 PIPE_CONF_CHECK_PLL_CX0(dpll_hw_state.cx0pll); 5308 5491 5309 5492 PIPE_CONF_CHECK_X(dsi_pll.ctrl); 5310 5493 PIPE_CONF_CHECK_X(dsi_pll.div); 5311 5494 5312 - if (IS_G4X(dev_priv) || DISPLAY_VER(dev_priv) >= 5) 5495 + if (display->platform.g4x || DISPLAY_VER(display) >= 5) 5313 5496 PIPE_CONF_CHECK_I(pipe_bpp); 5314 5497 5315 5498 if (!fastset || !pipe_config->update_m_n) { ··· 5425 5608 struct intel_crtc_state *crtc_state, 5426 5609 const char *reason) 5427 5610 { 5428 - struct drm_i915_private *i915 = to_i915(state->base.dev); 5611 + struct intel_display *display = to_intel_display(state); 5429 5612 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 5430 5613 int ret; 5431 5614 5432 - drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] Full modeset due to %s\n", 5615 + drm_dbg_kms(display->drm, "[CRTC:%d:%s] Full modeset due to %s\n", 5433 5616 crtc->base.base.id, crtc->base.name, reason); 5434 5617 5435 5618 ret = drm_atomic_add_affected_connectors(&state->base, ··· 5469 5652 int intel_modeset_pipes_in_mask_early(struct intel_atomic_state *state, 5470 5653 const char *reason, u8 mask) 5471 5654 { 5472 - struct drm_i915_private *i915 = to_i915(state->base.dev); 5655 + struct intel_display *display = to_intel_display(state); 5473 5656 struct intel_crtc *crtc; 5474 5657 5475 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, mask) { 5658 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, mask) { 5476 5659 struct intel_crtc_state *crtc_state; 5477 5660 int ret; 5478 5661 ··· 5516 5699 int intel_modeset_all_pipes_late(struct intel_atomic_state *state, 5517 5700 const char *reason) 5518 5701 { 5519 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 5702 + struct intel_display *display = to_intel_display(state); 5520 5703 struct intel_crtc *crtc; 5521 5704 5522 - for_each_intel_crtc(&dev_priv->drm, crtc) { 5705 + for_each_intel_crtc(display->drm, crtc) { 5523 5706 struct intel_crtc_state *crtc_state; 5524 5707 int ret; 5525 5708 ··· 5545 5728 return 0; 5546 5729 } 5547 5730 5548 - int intel_modeset_commit_pipes(struct drm_i915_private *i915, 5731 + int intel_modeset_commit_pipes(struct intel_display *display, 5549 5732 u8 pipe_mask, 5550 5733 struct drm_modeset_acquire_ctx *ctx) 5551 5734 { ··· 5553 5736 struct intel_crtc *crtc; 5554 5737 int ret; 5555 5738 5556 - state = drm_atomic_state_alloc(&i915->drm); 5739 + state = drm_atomic_state_alloc(display->drm); 5557 5740 if (!state) 5558 5741 return -ENOMEM; 5559 5742 5560 5743 state->acquire_ctx = ctx; 5561 5744 to_intel_atomic_state(state)->internal = true; 5562 5745 5563 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, pipe_mask) { 5746 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, pipe_mask) { 5564 5747 struct intel_crtc_state *crtc_state = 5565 5748 intel_atomic_get_crtc_state(state, crtc); 5566 5749 ··· 5659 5842 5660 5843 static int intel_modeset_checks(struct intel_atomic_state *state) 5661 5844 { 5662 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 5845 + struct intel_display *display = to_intel_display(state); 5663 5846 5664 5847 state->modeset = true; 5665 5848 5666 - if (IS_HASWELL(dev_priv)) 5849 + if (display->platform.haswell) 5667 5850 return hsw_mode_set_planes_workaround(state); 5668 5851 5669 5852 return 0; ··· 5680 5863 static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_state, 5681 5864 struct intel_crtc_state *new_crtc_state) 5682 5865 { 5866 + struct intel_display *display = to_intel_display(new_crtc_state); 5683 5867 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); 5684 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 5685 5868 5686 5869 /* only allow LRR when the timings stay within the VRR range */ 5687 5870 if (old_crtc_state->vrr.in_range != new_crtc_state->vrr.in_range) 5688 5871 new_crtc_state->update_lrr = false; 5689 5872 5690 5873 if (!intel_pipe_config_compare(old_crtc_state, new_crtc_state, true)) { 5691 - drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] fastset requirement not met, forcing full modeset\n", 5874 + drm_dbg_kms(display->drm, "[CRTC:%d:%s] fastset requirement not met, forcing full modeset\n", 5692 5875 crtc->base.base.id, crtc->base.name); 5693 5876 } else { 5694 5877 if (allow_vblank_delay_fastset(old_crtc_state)) ··· 5712 5895 5713 5896 static int intel_atomic_check_crtcs(struct intel_atomic_state *state) 5714 5897 { 5898 + struct intel_display *display = to_intel_display(state); 5715 5899 struct intel_crtc_state __maybe_unused *crtc_state; 5716 5900 struct intel_crtc *crtc; 5717 5901 int i; 5718 5902 5719 5903 for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { 5720 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 5721 5904 int ret; 5722 5905 5723 5906 ret = intel_crtc_atomic_check(state, crtc); 5724 5907 if (ret) { 5725 - drm_dbg_atomic(&i915->drm, 5908 + drm_dbg_atomic(display->drm, 5726 5909 "[CRTC:%d:%s] atomic driver check failed\n", 5727 5910 crtc->base.base.id, crtc->base.name); 5728 5911 return ret; ··· 5769 5952 static int intel_atomic_check_joiner(struct intel_atomic_state *state, 5770 5953 struct intel_crtc *primary_crtc) 5771 5954 { 5772 - struct drm_i915_private *i915 = to_i915(state->base.dev); 5955 + struct intel_display *display = to_intel_display(state); 5773 5956 struct intel_crtc_state *primary_crtc_state = 5774 5957 intel_atomic_get_new_crtc_state(state, primary_crtc); 5775 5958 struct intel_crtc *secondary_crtc; ··· 5778 5961 return 0; 5779 5962 5780 5963 /* sanity check */ 5781 - if (drm_WARN_ON(&i915->drm, 5964 + if (drm_WARN_ON(display->drm, 5782 5965 primary_crtc->pipe != joiner_primary_pipe(primary_crtc_state))) 5783 5966 return -EINVAL; 5784 5967 5785 - if (primary_crtc_state->joiner_pipes & ~joiner_pipes(i915)) { 5786 - drm_dbg_kms(&i915->drm, 5968 + if (primary_crtc_state->joiner_pipes & ~joiner_pipes(display)) { 5969 + drm_dbg_kms(display->drm, 5787 5970 "[CRTC:%d:%s] Cannot act as joiner primary " 5788 5971 "(need 0x%x as pipes, only 0x%x possible)\n", 5789 5972 primary_crtc->base.base.id, primary_crtc->base.name, 5790 - primary_crtc_state->joiner_pipes, joiner_pipes(i915)); 5973 + primary_crtc_state->joiner_pipes, joiner_pipes(display)); 5791 5974 return -EINVAL; 5792 5975 } 5793 5976 5794 - for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, 5977 + for_each_intel_crtc_in_pipe_mask(display->drm, secondary_crtc, 5795 5978 intel_crtc_joiner_secondary_pipes(primary_crtc_state)) { 5796 5979 struct intel_crtc_state *secondary_crtc_state; 5797 5980 int ret; ··· 5802 5985 5803 5986 /* primary being enabled, secondary was already configured? */ 5804 5987 if (secondary_crtc_state->uapi.enable) { 5805 - drm_dbg_kms(&i915->drm, 5988 + drm_dbg_kms(display->drm, 5806 5989 "[CRTC:%d:%s] secondary is enabled as normal CRTC, but " 5807 5990 "[CRTC:%d:%s] claiming this CRTC for joiner.\n", 5808 5991 secondary_crtc->base.base.id, secondary_crtc->base.name, ··· 5821 6004 drm_crtc_index(&secondary_crtc->base))) 5822 6005 return -EINVAL; 5823 6006 5824 - drm_dbg_kms(&i915->drm, 6007 + drm_dbg_kms(display->drm, 5825 6008 "[CRTC:%d:%s] Used as secondary for joiner primary [CRTC:%d:%s]\n", 5826 6009 secondary_crtc->base.base.id, secondary_crtc->base.name, 5827 6010 primary_crtc->base.base.id, primary_crtc->base.name); ··· 5840 6023 static void kill_joiner_secondaries(struct intel_atomic_state *state, 5841 6024 struct intel_crtc *primary_crtc) 5842 6025 { 5843 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6026 + struct intel_display *display = to_intel_display(state); 5844 6027 struct intel_crtc_state *primary_crtc_state = 5845 6028 intel_atomic_get_new_crtc_state(state, primary_crtc); 5846 6029 struct intel_crtc *secondary_crtc; 5847 6030 5848 - for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, 6031 + for_each_intel_crtc_in_pipe_mask(display->drm, secondary_crtc, 5849 6032 intel_crtc_joiner_secondary_pipes(primary_crtc_state)) { 5850 6033 struct intel_crtc_state *secondary_crtc_state = 5851 6034 intel_atomic_get_new_crtc_state(state, secondary_crtc); ··· 5879 6062 static int intel_async_flip_check_uapi(struct intel_atomic_state *state, 5880 6063 struct intel_crtc *crtc) 5881 6064 { 5882 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6065 + struct intel_display *display = to_intel_display(state); 5883 6066 const struct intel_crtc_state *new_crtc_state = 5884 6067 intel_atomic_get_new_crtc_state(state, crtc); 5885 6068 const struct intel_plane_state *old_plane_state; ··· 5891 6074 return 0; 5892 6075 5893 6076 if (!new_crtc_state->uapi.active) { 5894 - drm_dbg_kms(&i915->drm, 6077 + drm_dbg_kms(display->drm, 5895 6078 "[CRTC:%d:%s] not active\n", 5896 6079 crtc->base.base.id, crtc->base.name); 5897 6080 return -EINVAL; 5898 6081 } 5899 6082 5900 6083 if (intel_crtc_needs_modeset(new_crtc_state)) { 5901 - drm_dbg_kms(&i915->drm, 6084 + drm_dbg_kms(display->drm, 5902 6085 "[CRTC:%d:%s] modeset required\n", 5903 6086 crtc->base.base.id, crtc->base.name); 5904 6087 return -EINVAL; ··· 5909 6092 * Remove this check once the issues are fixed. 5910 6093 */ 5911 6094 if (new_crtc_state->joiner_pipes) { 5912 - drm_dbg_kms(&i915->drm, 6095 + drm_dbg_kms(display->drm, 5913 6096 "[CRTC:%d:%s] async flip disallowed with joiner\n", 5914 6097 crtc->base.base.id, crtc->base.name); 5915 6098 return -EINVAL; ··· 5928 6111 * enabled in the atomic IOCTL path. 5929 6112 */ 5930 6113 if (!plane->async_flip) { 5931 - drm_dbg_kms(&i915->drm, 6114 + drm_dbg_kms(display->drm, 5932 6115 "[PLANE:%d:%s] async flip not supported\n", 5933 6116 plane->base.base.id, plane->base.name); 5934 6117 return -EINVAL; 5935 6118 } 5936 6119 5937 6120 if (!old_plane_state->uapi.fb || !new_plane_state->uapi.fb) { 5938 - drm_dbg_kms(&i915->drm, 6121 + drm_dbg_kms(display->drm, 5939 6122 "[PLANE:%d:%s] no old or new framebuffer\n", 5940 6123 plane->base.base.id, plane->base.name); 5941 6124 return -EINVAL; ··· 5947 6130 5948 6131 static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct intel_crtc *crtc) 5949 6132 { 5950 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6133 + struct intel_display *display = to_intel_display(state); 5951 6134 const struct intel_crtc_state *old_crtc_state, *new_crtc_state; 5952 6135 const struct intel_plane_state *new_plane_state, *old_plane_state; 5953 6136 struct intel_plane *plane; ··· 5960 6143 return 0; 5961 6144 5962 6145 if (!new_crtc_state->hw.active) { 5963 - drm_dbg_kms(&i915->drm, 6146 + drm_dbg_kms(display->drm, 5964 6147 "[CRTC:%d:%s] not active\n", 5965 6148 crtc->base.base.id, crtc->base.name); 5966 6149 return -EINVAL; 5967 6150 } 5968 6151 5969 6152 if (intel_crtc_needs_modeset(new_crtc_state)) { 5970 - drm_dbg_kms(&i915->drm, 6153 + drm_dbg_kms(display->drm, 5971 6154 "[CRTC:%d:%s] modeset required\n", 5972 6155 crtc->base.base.id, crtc->base.name); 5973 6156 return -EINVAL; 5974 6157 } 5975 6158 5976 6159 if (old_crtc_state->active_planes != new_crtc_state->active_planes) { 5977 - drm_dbg_kms(&i915->drm, 6160 + drm_dbg_kms(display->drm, 5978 6161 "[CRTC:%d:%s] Active planes cannot be in async flip\n", 5979 6162 crtc->base.base.id, crtc->base.name); 5980 6163 return -EINVAL; ··· 5990 6173 * if we're really about to ask the hardware to perform 5991 6174 * an async flip. We should never get this far otherwise. 5992 6175 */ 5993 - if (drm_WARN_ON(&i915->drm, 6176 + if (drm_WARN_ON(display->drm, 5994 6177 new_crtc_state->do_async_flip && !plane->async_flip)) 5995 6178 return -EINVAL; 5996 6179 ··· 6006 6189 continue; 6007 6190 6008 6191 if (!intel_plane_can_async_flip(plane, new_plane_state->hw.fb->modifier)) { 6009 - drm_dbg_kms(&i915->drm, 6192 + drm_dbg_kms(display->drm, 6010 6193 "[PLANE:%d:%s] Modifier 0x%llx does not support async flip\n", 6011 6194 plane->base.base.id, plane->base.name, 6012 6195 new_plane_state->hw.fb->modifier); ··· 6015 6198 6016 6199 if (intel_format_info_is_yuv_semiplanar(new_plane_state->hw.fb->format, 6017 6200 new_plane_state->hw.fb->modifier)) { 6018 - drm_dbg_kms(&i915->drm, 6201 + drm_dbg_kms(display->drm, 6019 6202 "[PLANE:%d:%s] Planar formats do not support async flips\n", 6020 6203 plane->base.base.id, plane->base.name); 6021 6204 return -EINVAL; ··· 6030 6213 6031 6214 if (old_plane_state->view.color_plane[0].mapping_stride != 6032 6215 new_plane_state->view.color_plane[0].mapping_stride) { 6033 - drm_dbg_kms(&i915->drm, 6216 + drm_dbg_kms(display->drm, 6034 6217 "[PLANE:%d:%s] Stride cannot be changed in async flip\n", 6035 6218 plane->base.base.id, plane->base.name); 6036 6219 return -EINVAL; ··· 6038 6221 6039 6222 if (old_plane_state->hw.fb->modifier != 6040 6223 new_plane_state->hw.fb->modifier) { 6041 - drm_dbg_kms(&i915->drm, 6224 + drm_dbg_kms(display->drm, 6042 6225 "[PLANE:%d:%s] Modifier cannot be changed in async flip\n", 6043 6226 plane->base.base.id, plane->base.name); 6044 6227 return -EINVAL; ··· 6046 6229 6047 6230 if (old_plane_state->hw.fb->format != 6048 6231 new_plane_state->hw.fb->format) { 6049 - drm_dbg_kms(&i915->drm, 6232 + drm_dbg_kms(display->drm, 6050 6233 "[PLANE:%d:%s] Pixel format cannot be changed in async flip\n", 6051 6234 plane->base.base.id, plane->base.name); 6052 6235 return -EINVAL; ··· 6054 6237 6055 6238 if (old_plane_state->hw.rotation != 6056 6239 new_plane_state->hw.rotation) { 6057 - drm_dbg_kms(&i915->drm, 6240 + drm_dbg_kms(display->drm, 6058 6241 "[PLANE:%d:%s] Rotation cannot be changed in async flip\n", 6059 6242 plane->base.base.id, plane->base.name); 6060 6243 return -EINVAL; ··· 6062 6245 6063 6246 if (skl_plane_aux_dist(old_plane_state, 0) != 6064 6247 skl_plane_aux_dist(new_plane_state, 0)) { 6065 - drm_dbg_kms(&i915->drm, 6248 + drm_dbg_kms(display->drm, 6066 6249 "[PLANE:%d:%s] AUX_DIST cannot be changed in async flip\n", 6067 6250 plane->base.base.id, plane->base.name); 6068 6251 return -EINVAL; ··· 6070 6253 6071 6254 if (!drm_rect_equals(&old_plane_state->uapi.src, &new_plane_state->uapi.src) || 6072 6255 !drm_rect_equals(&old_plane_state->uapi.dst, &new_plane_state->uapi.dst)) { 6073 - drm_dbg_kms(&i915->drm, 6256 + drm_dbg_kms(display->drm, 6074 6257 "[PLANE:%d:%s] Size/co-ordinates cannot be changed in async flip\n", 6075 6258 plane->base.base.id, plane->base.name); 6076 6259 return -EINVAL; 6077 6260 } 6078 6261 6079 6262 if (old_plane_state->hw.alpha != new_plane_state->hw.alpha) { 6080 - drm_dbg_kms(&i915->drm, 6263 + drm_dbg_kms(display->drm, 6081 6264 "[PLANES:%d:%s] Alpha value cannot be changed in async flip\n", 6082 6265 plane->base.base.id, plane->base.name); 6083 6266 return -EINVAL; ··· 6085 6268 6086 6269 if (old_plane_state->hw.pixel_blend_mode != 6087 6270 new_plane_state->hw.pixel_blend_mode) { 6088 - drm_dbg_kms(&i915->drm, 6271 + drm_dbg_kms(display->drm, 6089 6272 "[PLANE:%d:%s] Pixel blend mode cannot be changed in async flip\n", 6090 6273 plane->base.base.id, plane->base.name); 6091 6274 return -EINVAL; 6092 6275 } 6093 6276 6094 6277 if (old_plane_state->hw.color_encoding != new_plane_state->hw.color_encoding) { 6095 - drm_dbg_kms(&i915->drm, 6278 + drm_dbg_kms(display->drm, 6096 6279 "[PLANE:%d:%s] Color encoding cannot be changed in async flip\n", 6097 6280 plane->base.base.id, plane->base.name); 6098 6281 return -EINVAL; 6099 6282 } 6100 6283 6101 6284 if (old_plane_state->hw.color_range != new_plane_state->hw.color_range) { 6102 - drm_dbg_kms(&i915->drm, 6285 + drm_dbg_kms(display->drm, 6103 6286 "[PLANE:%d:%s] Color range cannot be changed in async flip\n", 6104 6287 plane->base.base.id, plane->base.name); 6105 6288 return -EINVAL; ··· 6107 6290 6108 6291 /* plane decryption is allow to change only in synchronous flips */ 6109 6292 if (old_plane_state->decrypt != new_plane_state->decrypt) { 6110 - drm_dbg_kms(&i915->drm, 6293 + drm_dbg_kms(display->drm, 6111 6294 "[PLANE:%d:%s] Decryption cannot be changed in async flip\n", 6112 6295 plane->base.base.id, plane->base.name); 6113 6296 return -EINVAL; ··· 6119 6302 6120 6303 static int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state) 6121 6304 { 6122 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6305 + struct intel_display *display = to_intel_display(state); 6123 6306 const struct intel_plane_state *plane_state; 6124 6307 struct intel_crtc_state *crtc_state; 6125 6308 struct intel_plane *plane; ··· 6150 6333 modeset_pipes |= crtc_state->joiner_pipes; 6151 6334 } 6152 6335 6153 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, affected_pipes) { 6336 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, affected_pipes) { 6154 6337 crtc_state = intel_atomic_get_crtc_state(&state->base, crtc); 6155 6338 if (IS_ERR(crtc_state)) 6156 6339 return PTR_ERR(crtc_state); 6157 6340 } 6158 6341 6159 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, modeset_pipes) { 6342 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, modeset_pipes) { 6160 6343 int ret; 6161 6344 6162 6345 crtc_state = intel_atomic_get_new_crtc_state(state, crtc); ··· 6186 6369 struct intel_link_bw_limits *limits, 6187 6370 enum pipe *failed_pipe) 6188 6371 { 6189 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6372 + struct intel_display *display = to_intel_display(state); 6190 6373 struct intel_crtc_state *new_crtc_state; 6191 6374 struct intel_crtc *crtc; 6192 6375 int ret; ··· 6211 6394 continue; 6212 6395 } 6213 6396 6214 - if (drm_WARN_ON(&i915->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) 6397 + if (drm_WARN_ON(display->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) 6215 6398 continue; 6216 6399 6217 6400 ret = intel_crtc_prepare_cleared_state(state, crtc); ··· 6230 6413 if (!intel_crtc_needs_modeset(new_crtc_state)) 6231 6414 continue; 6232 6415 6233 - if (drm_WARN_ON(&i915->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) 6416 + if (drm_WARN_ON(display->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) 6234 6417 continue; 6235 6418 6236 6419 if (!new_crtc_state->hw.enable) ··· 6295 6478 struct drm_atomic_state *_state) 6296 6479 { 6297 6480 struct intel_display *display = to_intel_display(dev); 6298 - struct drm_i915_private *dev_priv = to_i915(dev); 6299 6481 struct intel_atomic_state *state = to_intel_atomic_state(_state); 6300 6482 struct intel_crtc_state *old_crtc_state, *new_crtc_state; 6301 6483 struct intel_crtc *crtc; ··· 6342 6526 continue; 6343 6527 6344 6528 if (intel_crtc_is_joiner_secondary(new_crtc_state)) { 6345 - drm_WARN_ON(&dev_priv->drm, new_crtc_state->uapi.enable); 6529 + drm_WARN_ON(display->drm, new_crtc_state->uapi.enable); 6346 6530 continue; 6347 6531 } 6348 6532 ··· 6413 6597 } 6414 6598 6415 6599 if (any_ms && !check_digital_port_conflicts(state)) { 6416 - drm_dbg_kms(&dev_priv->drm, 6600 + drm_dbg_kms(display->drm, 6417 6601 "rejecting conflicting digital port configuration\n"); 6418 6602 ret = -EINVAL; 6419 6603 goto fail; ··· 6469 6653 goto fail; 6470 6654 6471 6655 /* Either full modeset or fastset (or neither), never both */ 6472 - drm_WARN_ON(&dev_priv->drm, 6656 + drm_WARN_ON(display->drm, 6473 6657 intel_crtc_needs_modeset(new_crtc_state) && 6474 6658 intel_crtc_needs_fastset(new_crtc_state)); 6475 6659 ··· 6529 6713 static void intel_pipe_fastset(const struct intel_crtc_state *old_crtc_state, 6530 6714 const struct intel_crtc_state *new_crtc_state) 6531 6715 { 6716 + struct intel_display *display = to_intel_display(new_crtc_state); 6532 6717 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); 6533 6718 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 6534 6719 ··· 6544 6727 intel_set_pipe_src_size(new_crtc_state); 6545 6728 6546 6729 /* on skylake this is done by detaching scalers */ 6547 - if (DISPLAY_VER(dev_priv) >= 9) { 6730 + if (DISPLAY_VER(display) >= 9) { 6548 6731 if (new_crtc_state->pch_pfit.enabled) 6549 6732 skl_pfit_enable(new_crtc_state); 6550 6733 } else if (HAS_PCH_SPLIT(dev_priv)) { ··· 6562 6745 * HSW/BDW only really need this here for fastboot, after 6563 6746 * that the value should not change without a full modeset. 6564 6747 */ 6565 - if (DISPLAY_VER(dev_priv) >= 9 || 6566 - IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) 6748 + if (DISPLAY_VER(display) >= 9 || 6749 + display->platform.broadwell || display->platform.haswell) 6567 6750 hsw_set_linetime_wm(new_crtc_state); 6568 6751 6569 6752 if (new_crtc_state->update_m_n) ··· 6577 6760 static void commit_pipe_pre_planes(struct intel_atomic_state *state, 6578 6761 struct intel_crtc *crtc) 6579 6762 { 6580 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 6763 + struct intel_display *display = to_intel_display(state); 6581 6764 const struct intel_crtc_state *old_crtc_state = 6582 6765 intel_atomic_get_old_crtc_state(state, crtc); 6583 6766 const struct intel_crtc_state *new_crtc_state = 6584 6767 intel_atomic_get_new_crtc_state(state, crtc); 6585 6768 bool modeset = intel_crtc_needs_modeset(new_crtc_state); 6586 6769 6587 - drm_WARN_ON(&dev_priv->drm, new_crtc_state->use_dsb); 6770 + drm_WARN_ON(display->drm, new_crtc_state->use_dsb); 6588 6771 6589 6772 /* 6590 6773 * During modesets pipe configuration was programmed as the ··· 6594 6777 if (intel_crtc_needs_color_update(new_crtc_state)) 6595 6778 intel_color_commit_arm(NULL, new_crtc_state); 6596 6779 6597 - if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv)) 6780 + if (DISPLAY_VER(display) >= 9 || display->platform.broadwell) 6598 6781 bdw_set_pipe_misc(NULL, new_crtc_state); 6599 6782 6600 6783 if (intel_crtc_needs_fastset(new_crtc_state)) ··· 6609 6792 static void commit_pipe_post_planes(struct intel_atomic_state *state, 6610 6793 struct intel_crtc *crtc) 6611 6794 { 6612 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 6795 + struct intel_display *display = to_intel_display(state); 6613 6796 const struct intel_crtc_state *new_crtc_state = 6614 6797 intel_atomic_get_new_crtc_state(state, crtc); 6615 6798 6616 - drm_WARN_ON(&dev_priv->drm, new_crtc_state->use_dsb); 6799 + drm_WARN_ON(display->drm, new_crtc_state->use_dsb); 6617 6800 6618 6801 /* 6619 6802 * Disable the scaler(s) after the plane(s) so that we don't 6620 6803 * get a catastrophic underrun even if the two operations 6621 6804 * end up happening in two different frames. 6622 6805 */ 6623 - if (DISPLAY_VER(dev_priv) >= 9 && 6806 + if (DISPLAY_VER(display) >= 9 && 6624 6807 !intel_crtc_needs_modeset(new_crtc_state)) 6625 - skl_detach_scalers(new_crtc_state); 6808 + skl_detach_scalers(NULL, new_crtc_state); 6626 6809 6627 6810 if (intel_crtc_vrr_enabling(state, crtc)) 6628 6811 intel_vrr_enable(new_crtc_state); ··· 6631 6814 static void intel_enable_crtc(struct intel_atomic_state *state, 6632 6815 struct intel_crtc *crtc) 6633 6816 { 6634 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 6817 + struct intel_display *display = to_intel_display(state); 6635 6818 const struct intel_crtc_state *new_crtc_state = 6636 6819 intel_atomic_get_new_crtc_state(state, crtc); 6637 6820 struct intel_crtc *pipe_crtc; ··· 6639 6822 if (!intel_crtc_needs_modeset(new_crtc_state)) 6640 6823 return; 6641 6824 6642 - for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, 6825 + for_each_intel_crtc_in_pipe_mask_reverse(display->drm, pipe_crtc, 6643 6826 intel_crtc_joined_pipe_mask(new_crtc_state)) { 6644 6827 const struct intel_crtc_state *pipe_crtc_state = 6645 6828 intel_atomic_get_new_crtc_state(state, pipe_crtc); ··· 6648 6831 intel_crtc_update_active_timings(pipe_crtc_state, false); 6649 6832 } 6650 6833 6651 - dev_priv->display.funcs.display->crtc_enable(state, crtc); 6834 + display->funcs.display->crtc_enable(state, crtc); 6652 6835 6653 6836 /* vblanks work again, re-enable pipe CRC. */ 6654 6837 intel_crtc_enable_pipe_crc(crtc); ··· 6658 6841 struct intel_crtc *crtc) 6659 6842 { 6660 6843 struct intel_display *display = to_intel_display(state); 6661 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6662 6844 const struct intel_crtc_state *old_crtc_state = 6663 6845 intel_atomic_get_old_crtc_state(state, crtc); 6664 6846 struct intel_crtc_state *new_crtc_state = ··· 6666 6850 6667 6851 if (old_crtc_state->inherited || 6668 6852 intel_crtc_needs_modeset(new_crtc_state)) { 6669 - if (HAS_DPT(i915)) 6853 + if (HAS_DPT(display)) 6670 6854 intel_dpt_configure(crtc); 6671 6855 } 6672 6856 ··· 6680 6864 if (intel_crtc_needs_fastset(new_crtc_state)) 6681 6865 intel_encoders_update_pipe(state, crtc); 6682 6866 6683 - if (DISPLAY_VER(i915) >= 11 && 6867 + if (DISPLAY_VER(display) >= 11 && 6684 6868 intel_crtc_needs_fastset(new_crtc_state)) 6685 6869 icl_set_pipe_chicken(new_crtc_state); 6686 6870 ··· 6754 6938 static void intel_old_crtc_state_disables(struct intel_atomic_state *state, 6755 6939 struct intel_crtc *crtc) 6756 6940 { 6757 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 6941 + struct intel_display *display = to_intel_display(state); 6758 6942 const struct intel_crtc_state *old_crtc_state = 6759 6943 intel_atomic_get_old_crtc_state(state, crtc); 6760 6944 struct intel_crtc *pipe_crtc; ··· 6763 6947 * We need to disable pipe CRC before disabling the pipe, 6764 6948 * or we race against vblank off. 6765 6949 */ 6766 - for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, 6950 + for_each_intel_crtc_in_pipe_mask(display->drm, pipe_crtc, 6767 6951 intel_crtc_joined_pipe_mask(old_crtc_state)) 6768 6952 intel_crtc_disable_pipe_crc(pipe_crtc); 6769 6953 6770 - dev_priv->display.funcs.display->crtc_disable(state, crtc); 6954 + display->funcs.display->crtc_disable(state, crtc); 6771 6955 6772 - for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, 6956 + for_each_intel_crtc_in_pipe_mask(display->drm, pipe_crtc, 6773 6957 intel_crtc_joined_pipe_mask(old_crtc_state)) { 6774 6958 const struct intel_crtc_state *new_pipe_crtc_state = 6775 6959 intel_atomic_get_new_crtc_state(state, pipe_crtc); ··· 6784 6968 6785 6969 static void intel_commit_modeset_disables(struct intel_atomic_state *state) 6786 6970 { 6787 - struct drm_i915_private *i915 = to_i915(state->base.dev); 6971 + struct intel_display *display = to_intel_display(state); 6788 6972 const struct intel_crtc_state *new_crtc_state, *old_crtc_state; 6789 6973 struct intel_crtc *crtc; 6790 6974 u8 disable_pipes = 0; ··· 6851 7035 disable_pipes &= ~intel_crtc_joined_pipe_mask(old_crtc_state); 6852 7036 } 6853 7037 6854 - drm_WARN_ON(&i915->drm, disable_pipes); 7038 + drm_WARN_ON(display->drm, disable_pipes); 6855 7039 } 6856 7040 6857 7041 static void intel_commit_modeset_enables(struct intel_atomic_state *state) ··· 6878 7062 6879 7063 static void skl_commit_modeset_enables(struct intel_atomic_state *state) 6880 7064 { 6881 - struct drm_i915_private *dev_priv = to_i915(state->base.dev); 7065 + struct intel_display *display = to_intel_display(state); 6882 7066 struct intel_crtc *crtc; 6883 7067 struct intel_crtc_state *old_crtc_state, *new_crtc_state; 6884 7068 struct skl_ddb_entry entries[I915_MAX_PIPES] = {}; ··· 7020 7204 if ((update_pipes & BIT(pipe)) == 0) 7021 7205 continue; 7022 7206 7023 - drm_WARN_ON(&dev_priv->drm, skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb, 7024 - entries, I915_MAX_PIPES, pipe)); 7207 + drm_WARN_ON(display->drm, 7208 + skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb, 7209 + entries, I915_MAX_PIPES, pipe)); 7025 7210 7026 7211 entries[pipe] = new_crtc_state->wm.skl.ddb; 7027 7212 update_pipes &= ~BIT(pipe); ··· 7030 7213 intel_update_crtc(state, crtc); 7031 7214 } 7032 7215 7033 - drm_WARN_ON(&dev_priv->drm, modeset_pipes); 7034 - drm_WARN_ON(&dev_priv->drm, update_pipes); 7216 + drm_WARN_ON(display->drm, modeset_pipes); 7217 + drm_WARN_ON(display->drm, update_pipes); 7035 7218 } 7036 7219 7037 7220 static void intel_atomic_commit_fence_wait(struct intel_atomic_state *intel_state) ··· 7076 7259 { 7077 7260 struct intel_atomic_state *state = 7078 7261 container_of(work, struct intel_atomic_state, cleanup_work); 7079 - struct drm_i915_private *i915 = to_i915(state->base.dev); 7262 + struct intel_display *display = to_intel_display(state); 7080 7263 struct intel_crtc_state *old_crtc_state; 7081 7264 struct intel_crtc *crtc; 7082 7265 int i; ··· 7084 7267 for_each_old_intel_crtc_in_state(state, crtc, old_crtc_state, i) 7085 7268 intel_atomic_dsb_cleanup(old_crtc_state); 7086 7269 7087 - drm_atomic_helper_cleanup_planes(&i915->drm, &state->base); 7270 + drm_atomic_helper_cleanup_planes(display->drm, &state->base); 7088 7271 drm_atomic_helper_commit_cleanup_done(&state->base); 7089 7272 drm_atomic_state_put(&state->base); 7090 7273 } 7091 7274 7092 7275 static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *state) 7093 7276 { 7094 - struct drm_i915_private *i915 = to_i915(state->base.dev); 7277 + struct intel_display *display = to_intel_display(state); 7095 7278 struct intel_plane *plane; 7096 7279 struct intel_plane_state *plane_state; 7097 7280 int i; ··· 7128 7311 &plane_state->ccval, 7129 7312 sizeof(plane_state->ccval)); 7130 7313 /* The above could only fail if the FB obj has an unexpected backing store type. */ 7131 - drm_WARN_ON(&i915->drm, ret); 7314 + drm_WARN_ON(display->drm, ret); 7132 7315 } 7133 7316 } 7134 7317 ··· 7136 7319 struct intel_crtc *crtc) 7137 7320 { 7138 7321 struct intel_display *display = to_intel_display(state); 7139 - const struct intel_crtc_state *old_crtc_state = 7140 - intel_atomic_get_old_crtc_state(state, crtc); 7141 7322 struct intel_crtc_state *new_crtc_state = 7142 7323 intel_atomic_get_new_crtc_state(state, crtc); 7143 7324 ··· 7147 7332 7148 7333 /* FIXME deal with everything */ 7149 7334 new_crtc_state->use_dsb = 7150 - new_crtc_state->update_planes && 7151 7335 !new_crtc_state->do_async_flip && 7152 7336 (DISPLAY_VER(display) >= 20 || !new_crtc_state->has_psr) && 7153 - !new_crtc_state->scaler_state.scaler_users && 7154 - !old_crtc_state->scaler_state.scaler_users && 7155 7337 !intel_crtc_needs_modeset(new_crtc_state) && 7156 7338 !intel_crtc_needs_fastset(new_crtc_state); 7157 7339 ··· 7158 7346 static void intel_atomic_dsb_finish(struct intel_atomic_state *state, 7159 7347 struct intel_crtc *crtc) 7160 7348 { 7349 + struct intel_display *display = to_intel_display(state); 7161 7350 struct intel_crtc_state *new_crtc_state = 7162 7351 intel_atomic_get_new_crtc_state(state, crtc); 7163 7352 ··· 7205 7392 intel_crtc_planes_update_arm(new_crtc_state->dsb_commit, 7206 7393 state, crtc); 7207 7394 7395 + if (DISPLAY_VER(display) >= 9) 7396 + skl_detach_scalers(new_crtc_state->dsb_commit, 7397 + new_crtc_state); 7398 + 7208 7399 if (!new_crtc_state->dsb_color_vblank) { 7209 7400 intel_dsb_wait_vblanks(new_crtc_state->dsb_commit, 1); 7210 7401 ··· 7229 7412 static void intel_atomic_commit_tail(struct intel_atomic_state *state) 7230 7413 { 7231 7414 struct intel_display *display = to_intel_display(state); 7232 - struct drm_device *dev = state->base.dev; 7233 - struct drm_i915_private *dev_priv = to_i915(dev); 7415 + struct drm_i915_private *dev_priv = to_i915(display->drm); 7234 7416 struct intel_crtc_state *new_crtc_state, *old_crtc_state; 7235 7417 struct intel_crtc *crtc; 7236 7418 struct intel_power_domain_mask put_domains[I915_MAX_PIPES] = {}; ··· 7241 7425 7242 7426 intel_atomic_commit_fence_wait(state); 7243 7427 7244 - intel_td_flush(dev_priv); 7428 + intel_td_flush(display); 7245 7429 7246 7430 intel_atomic_prepare_plane_clear_colors(state); 7431 + 7432 + for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) 7433 + intel_fbc_prepare_dirty_rect(state, crtc); 7247 7434 7248 7435 for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) 7249 7436 intel_atomic_dsb_finish(state, crtc); ··· 7308 7489 intel_pmdemand_pre_plane_update(state); 7309 7490 7310 7491 if (state->modeset) { 7311 - drm_atomic_helper_update_legacy_modeset_state(dev, &state->base); 7492 + drm_atomic_helper_update_legacy_modeset_state(display->drm, &state->base); 7312 7493 7313 7494 intel_set_cdclk_pre_plane_update(state); 7314 7495 ··· 7323 7504 7324 7505 /* Complete events for now disable pipes here. */ 7325 7506 if (modeset && !new_crtc_state->hw.active && new_crtc_state->uapi.event) { 7326 - spin_lock_irq(&dev->event_lock); 7507 + spin_lock_irq(&display->drm->event_lock); 7327 7508 drm_crtc_send_vblank_event(&crtc->base, 7328 7509 new_crtc_state->uapi.event); 7329 - spin_unlock_irq(&dev->event_lock); 7510 + spin_unlock_irq(&display->drm->event_lock); 7330 7511 7331 7512 new_crtc_state->uapi.event = NULL; 7332 7513 } ··· 7342 7523 } 7343 7524 7344 7525 /* Now enable the clocks, plane, pipe, and connectors that we set up. */ 7345 - dev_priv->display.funcs.display->commit_modeset_enables(state); 7526 + display->funcs.display->commit_modeset_enables(state); 7346 7527 7347 7528 intel_program_dpkgc_latency(state); 7348 - 7349 - if (state->modeset) 7350 - intel_set_cdclk_post_plane_update(state); 7351 7529 7352 7530 intel_wait_for_vblank_workers(state); 7353 7531 ··· 7357 7541 * - switch over to the vblank wait helper in the core after that since 7358 7542 * we don't need out special handling any more. 7359 7543 */ 7360 - drm_atomic_helper_wait_for_flip_done(dev, &state->base); 7544 + drm_atomic_helper_wait_for_flip_done(display->drm, &state->base); 7361 7545 7362 7546 for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { 7363 7547 if (new_crtc_state->do_async_flip) ··· 7386 7570 * chance of catching underruns with the intermediate watermarks 7387 7571 * vs. the new plane configuration. 7388 7572 */ 7389 - if (DISPLAY_VER(dev_priv) == 2 && planes_enabling(old_crtc_state, new_crtc_state)) 7573 + if (DISPLAY_VER(display) == 2 && planes_enabling(old_crtc_state, new_crtc_state)) 7390 7574 intel_set_cpu_fifo_underrun_reporting(display, crtc->pipe, true); 7391 7575 7392 7576 intel_optimize_watermarks(state, crtc); ··· 7422 7606 intel_verify_planes(state); 7423 7607 7424 7608 intel_sagv_post_plane_update(state); 7609 + if (state->modeset) 7610 + intel_set_cdclk_post_plane_update(state); 7425 7611 intel_pmdemand_post_plane_update(state); 7426 7612 7427 7613 drm_atomic_helper_commit_hw_done(&state->base); ··· 7454 7636 * down. 7455 7637 */ 7456 7638 INIT_WORK(&state->cleanup_work, intel_atomic_cleanup_work); 7457 - queue_work(dev_priv->display.wq.cleanup, &state->cleanup_work); 7639 + queue_work(display->wq.cleanup, &state->cleanup_work); 7458 7640 } 7459 7641 7460 7642 static void intel_atomic_commit_work(struct work_struct *work) ··· 7513 7695 int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, 7514 7696 bool nonblock) 7515 7697 { 7698 + struct intel_display *display = to_intel_display(dev); 7516 7699 struct intel_atomic_state *state = to_intel_atomic_state(_state); 7517 7700 struct drm_i915_private *dev_priv = to_i915(dev); 7518 7701 int ret = 0; ··· 7537 7718 * FIXME doing watermarks and fb cleanup from a vblank worker 7538 7719 * (assuming we had any) would solve these problems. 7539 7720 */ 7540 - if (DISPLAY_VER(dev_priv) < 9 && state->base.legacy_cursor_update) { 7721 + if (DISPLAY_VER(display) < 9 && state->base.legacy_cursor_update) { 7541 7722 struct intel_crtc_state *new_crtc_state; 7542 7723 struct intel_crtc *crtc; 7543 7724 int i; ··· 7550 7731 7551 7732 ret = intel_atomic_prepare_commit(state); 7552 7733 if (ret) { 7553 - drm_dbg_atomic(&dev_priv->drm, 7734 + drm_dbg_atomic(display->drm, 7554 7735 "Preparing state failed with %i\n", ret); 7555 7736 intel_runtime_pm_put(&dev_priv->runtime_pm, state->wakeref); 7556 7737 return ret; ··· 7570 7751 INIT_WORK(&state->base.commit_work, intel_atomic_commit_work); 7571 7752 7572 7753 if (nonblock && state->modeset) { 7573 - queue_work(dev_priv->display.wq.modeset, &state->base.commit_work); 7754 + queue_work(display->wq.modeset, &state->base.commit_work); 7574 7755 } else if (nonblock) { 7575 - queue_work(dev_priv->display.wq.flip, &state->base.commit_work); 7756 + queue_work(display->wq.flip, &state->base.commit_work); 7576 7757 } else { 7577 7758 if (state->modeset) 7578 - flush_workqueue(dev_priv->display.wq.modeset); 7759 + flush_workqueue(display->wq.modeset); 7579 7760 intel_atomic_commit_tail(state); 7580 7761 } 7581 7762 ··· 7584 7765 7585 7766 static u32 intel_encoder_possible_clones(struct intel_encoder *encoder) 7586 7767 { 7587 - struct drm_device *dev = encoder->base.dev; 7768 + struct intel_display *display = to_intel_display(encoder); 7588 7769 struct intel_encoder *source_encoder; 7589 7770 u32 possible_clones = 0; 7590 7771 7591 - for_each_intel_encoder(dev, source_encoder) { 7772 + for_each_intel_encoder(display->drm, source_encoder) { 7592 7773 if (encoders_cloneable(encoder, source_encoder)) 7593 7774 possible_clones |= drm_encoder_mask(&source_encoder->base); 7594 7775 } ··· 7598 7779 7599 7780 static u32 intel_encoder_possible_crtcs(struct intel_encoder *encoder) 7600 7781 { 7601 - struct drm_device *dev = encoder->base.dev; 7782 + struct intel_display *display = to_intel_display(encoder); 7602 7783 struct intel_crtc *crtc; 7603 7784 u32 possible_crtcs = 0; 7604 7785 7605 - for_each_intel_crtc_in_pipe_mask(dev, crtc, encoder->pipe_mask) 7786 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, encoder->pipe_mask) 7606 7787 possible_crtcs |= drm_crtc_mask(&crtc->base); 7607 7788 7608 7789 return possible_crtcs; 7609 7790 } 7610 7791 7611 - static bool ilk_has_edp_a(struct drm_i915_private *dev_priv) 7792 + static bool ilk_has_edp_a(struct intel_display *display) 7612 7793 { 7613 - if (!IS_MOBILE(dev_priv)) 7794 + if (!display->platform.mobile) 7614 7795 return false; 7615 7796 7616 - if ((intel_de_read(dev_priv, DP_A) & DP_DETECTED) == 0) 7797 + if ((intel_de_read(display, DP_A) & DP_DETECTED) == 0) 7617 7798 return false; 7618 7799 7619 - if (IS_IRONLAKE(dev_priv) && (intel_de_read(dev_priv, FUSE_STRAP) & ILK_eDP_A_DISABLE)) 7800 + if (display->platform.ironlake && (intel_de_read(display, FUSE_STRAP) & ILK_eDP_A_DISABLE)) 7620 7801 return false; 7621 7802 7622 7803 return true; 7623 7804 } 7624 7805 7625 - static bool intel_ddi_crt_present(struct drm_i915_private *dev_priv) 7806 + static bool intel_ddi_crt_present(struct intel_display *display) 7626 7807 { 7627 - if (DISPLAY_VER(dev_priv) >= 9) 7808 + struct drm_i915_private *dev_priv = to_i915(display->drm); 7809 + 7810 + if (DISPLAY_VER(display) >= 9) 7628 7811 return false; 7629 7812 7630 - if (IS_HASWELL_ULT(dev_priv) || IS_BROADWELL_ULT(dev_priv)) 7813 + if (display->platform.haswell_ult || display->platform.broadwell_ult) 7631 7814 return false; 7632 7815 7633 7816 if (HAS_PCH_LPT_H(dev_priv) && 7634 - intel_de_read(dev_priv, SFUSE_STRAP) & SFUSE_STRAP_CRT_DISABLED) 7817 + intel_de_read(display, SFUSE_STRAP) & SFUSE_STRAP_CRT_DISABLED) 7635 7818 return false; 7636 7819 7637 7820 /* DDI E can't be used if DDI A requires 4 lanes */ 7638 - if (intel_de_read(dev_priv, DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) 7821 + if (intel_de_read(display, DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) 7639 7822 return false; 7640 7823 7641 - if (!dev_priv->display.vbt.int_crt_support) 7824 + if (!display->vbt.int_crt_support) 7642 7825 return false; 7643 7826 7644 7827 return true; ··· 7652 7831 "Platform does not support port %c\n", port_name(port)); 7653 7832 } 7654 7833 7655 - void intel_setup_outputs(struct drm_i915_private *dev_priv) 7834 + void intel_setup_outputs(struct intel_display *display) 7656 7835 { 7657 - struct intel_display *display = &dev_priv->display; 7836 + struct drm_i915_private *dev_priv = to_i915(display->drm); 7658 7837 struct intel_encoder *encoder; 7659 7838 bool dpd_is_edp = false; 7660 7839 7661 7840 intel_pps_unlock_regs_wa(display); 7662 7841 7663 - if (!HAS_DISPLAY(dev_priv)) 7842 + if (!HAS_DISPLAY(display)) 7664 7843 return; 7665 7844 7666 - if (HAS_DDI(dev_priv)) { 7667 - if (intel_ddi_crt_present(dev_priv)) 7845 + if (HAS_DDI(display)) { 7846 + if (intel_ddi_crt_present(display)) 7668 7847 intel_crt_init(display); 7669 7848 7670 7849 intel_bios_for_each_encoder(display, intel_ddi_init); 7671 7850 7672 - if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) 7851 + if (display->platform.geminilake || display->platform.broxton) 7673 7852 vlv_dsi_init(dev_priv); 7674 7853 } else if (HAS_PCH_SPLIT(dev_priv)) { 7675 7854 int found; ··· 7684 7863 7685 7864 dpd_is_edp = intel_dp_is_port_edp(display, PORT_D); 7686 7865 7687 - if (ilk_has_edp_a(dev_priv)) 7866 + if (ilk_has_edp_a(display)) 7688 7867 g4x_dp_init(display, DP_A, PORT_A); 7689 7868 7690 - if (intel_de_read(dev_priv, PCH_HDMIB) & SDVO_DETECTED) { 7869 + if (intel_de_read(display, PCH_HDMIB) & SDVO_DETECTED) { 7691 7870 /* PCH SDVOB multiplex with HDMIB */ 7692 7871 found = intel_sdvo_init(display, PCH_SDVOB, PORT_B); 7693 7872 if (!found) 7694 7873 g4x_hdmi_init(display, PCH_HDMIB, PORT_B); 7695 - if (!found && (intel_de_read(dev_priv, PCH_DP_B) & DP_DETECTED)) 7874 + if (!found && (intel_de_read(display, PCH_DP_B) & DP_DETECTED)) 7696 7875 g4x_dp_init(display, PCH_DP_B, PORT_B); 7697 7876 } 7698 7877 7699 - if (intel_de_read(dev_priv, PCH_HDMIC) & SDVO_DETECTED) 7878 + if (intel_de_read(display, PCH_HDMIC) & SDVO_DETECTED) 7700 7879 g4x_hdmi_init(display, PCH_HDMIC, PORT_C); 7701 7880 7702 - if (!dpd_is_edp && intel_de_read(dev_priv, PCH_HDMID) & SDVO_DETECTED) 7881 + if (!dpd_is_edp && intel_de_read(display, PCH_HDMID) & SDVO_DETECTED) 7703 7882 g4x_hdmi_init(display, PCH_HDMID, PORT_D); 7704 7883 7705 - if (intel_de_read(dev_priv, PCH_DP_C) & DP_DETECTED) 7884 + if (intel_de_read(display, PCH_DP_C) & DP_DETECTED) 7706 7885 g4x_dp_init(display, PCH_DP_C, PORT_C); 7707 7886 7708 - if (intel_de_read(dev_priv, PCH_DP_D) & DP_DETECTED) 7887 + if (intel_de_read(display, PCH_DP_D) & DP_DETECTED) 7709 7888 g4x_dp_init(display, PCH_DP_D, PORT_D); 7710 - } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { 7889 + } else if (display->platform.valleyview || display->platform.cherryview) { 7711 7890 bool has_edp, has_port; 7712 7891 7713 - if (IS_VALLEYVIEW(dev_priv) && dev_priv->display.vbt.int_crt_support) 7892 + if (display->platform.valleyview && display->vbt.int_crt_support) 7714 7893 intel_crt_init(display); 7715 7894 7716 7895 /* ··· 7730 7909 */ 7731 7910 has_edp = intel_dp_is_port_edp(display, PORT_B); 7732 7911 has_port = intel_bios_is_port_present(display, PORT_B); 7733 - if (intel_de_read(dev_priv, VLV_DP_B) & DP_DETECTED || has_port) 7912 + if (intel_de_read(display, VLV_DP_B) & DP_DETECTED || has_port) 7734 7913 has_edp &= g4x_dp_init(display, VLV_DP_B, PORT_B); 7735 - if ((intel_de_read(dev_priv, VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp) 7914 + if ((intel_de_read(display, VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp) 7736 7915 g4x_hdmi_init(display, VLV_HDMIB, PORT_B); 7737 7916 7738 7917 has_edp = intel_dp_is_port_edp(display, PORT_C); 7739 7918 has_port = intel_bios_is_port_present(display, PORT_C); 7740 - if (intel_de_read(dev_priv, VLV_DP_C) & DP_DETECTED || has_port) 7919 + if (intel_de_read(display, VLV_DP_C) & DP_DETECTED || has_port) 7741 7920 has_edp &= g4x_dp_init(display, VLV_DP_C, PORT_C); 7742 - if ((intel_de_read(dev_priv, VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp) 7921 + if ((intel_de_read(display, VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp) 7743 7922 g4x_hdmi_init(display, VLV_HDMIC, PORT_C); 7744 7923 7745 - if (IS_CHERRYVIEW(dev_priv)) { 7924 + if (display->platform.cherryview) { 7746 7925 /* 7747 7926 * eDP not supported on port D, 7748 7927 * so no need to worry about it 7749 7928 */ 7750 7929 has_port = intel_bios_is_port_present(display, PORT_D); 7751 - if (intel_de_read(dev_priv, CHV_DP_D) & DP_DETECTED || has_port) 7930 + if (intel_de_read(display, CHV_DP_D) & DP_DETECTED || has_port) 7752 7931 g4x_dp_init(display, CHV_DP_D, PORT_D); 7753 - if (intel_de_read(dev_priv, CHV_HDMID) & SDVO_DETECTED || has_port) 7932 + if (intel_de_read(display, CHV_HDMID) & SDVO_DETECTED || has_port) 7754 7933 g4x_hdmi_init(display, CHV_HDMID, PORT_D); 7755 7934 } 7756 7935 7757 7936 vlv_dsi_init(dev_priv); 7758 - } else if (IS_PINEVIEW(dev_priv)) { 7937 + } else if (display->platform.pineview) { 7759 7938 intel_lvds_init(dev_priv); 7760 7939 intel_crt_init(display); 7761 - } else if (IS_DISPLAY_VER(dev_priv, 3, 4)) { 7940 + } else if (IS_DISPLAY_VER(display, 3, 4)) { 7762 7941 bool found = false; 7763 7942 7764 - if (IS_MOBILE(dev_priv)) 7943 + if (display->platform.mobile) 7765 7944 intel_lvds_init(dev_priv); 7766 7945 7767 7946 intel_crt_init(display); 7768 7947 7769 - if (intel_de_read(dev_priv, GEN3_SDVOB) & SDVO_DETECTED) { 7770 - drm_dbg_kms(&dev_priv->drm, "probing SDVOB\n"); 7948 + if (intel_de_read(display, GEN3_SDVOB) & SDVO_DETECTED) { 7949 + drm_dbg_kms(display->drm, "probing SDVOB\n"); 7771 7950 found = intel_sdvo_init(display, GEN3_SDVOB, PORT_B); 7772 - if (!found && IS_G4X(dev_priv)) { 7773 - drm_dbg_kms(&dev_priv->drm, 7951 + if (!found && display->platform.g4x) { 7952 + drm_dbg_kms(display->drm, 7774 7953 "probing HDMI on SDVOB\n"); 7775 7954 g4x_hdmi_init(display, GEN4_HDMIB, PORT_B); 7776 7955 } 7777 7956 7778 - if (!found && IS_G4X(dev_priv)) 7957 + if (!found && display->platform.g4x) 7779 7958 g4x_dp_init(display, DP_B, PORT_B); 7780 7959 } 7781 7960 7782 7961 /* Before G4X SDVOC doesn't have its own detect register */ 7783 7962 7784 - if (intel_de_read(dev_priv, GEN3_SDVOB) & SDVO_DETECTED) { 7785 - drm_dbg_kms(&dev_priv->drm, "probing SDVOC\n"); 7963 + if (intel_de_read(display, GEN3_SDVOB) & SDVO_DETECTED) { 7964 + drm_dbg_kms(display->drm, "probing SDVOC\n"); 7786 7965 found = intel_sdvo_init(display, GEN3_SDVOC, PORT_C); 7787 7966 } 7788 7967 7789 - if (!found && (intel_de_read(dev_priv, GEN3_SDVOC) & SDVO_DETECTED)) { 7968 + if (!found && (intel_de_read(display, GEN3_SDVOC) & SDVO_DETECTED)) { 7790 7969 7791 - if (IS_G4X(dev_priv)) { 7792 - drm_dbg_kms(&dev_priv->drm, 7970 + if (display->platform.g4x) { 7971 + drm_dbg_kms(display->drm, 7793 7972 "probing HDMI on SDVOC\n"); 7794 7973 g4x_hdmi_init(display, GEN4_HDMIC, PORT_C); 7795 7974 } 7796 - if (IS_G4X(dev_priv)) 7975 + if (display->platform.g4x) 7797 7976 g4x_dp_init(display, DP_C, PORT_C); 7798 7977 } 7799 7978 7800 - if (IS_G4X(dev_priv) && (intel_de_read(dev_priv, DP_D) & DP_DETECTED)) 7979 + if (display->platform.g4x && (intel_de_read(display, DP_D) & DP_DETECTED)) 7801 7980 g4x_dp_init(display, DP_D, PORT_D); 7802 7981 7803 - if (SUPPORTS_TV(dev_priv)) 7982 + if (SUPPORTS_TV(display)) 7804 7983 intel_tv_init(display); 7805 - } else if (DISPLAY_VER(dev_priv) == 2) { 7806 - if (IS_I85X(dev_priv)) 7984 + } else if (DISPLAY_VER(display) == 2) { 7985 + if (display->platform.i85x) 7807 7986 intel_lvds_init(dev_priv); 7808 7987 7809 7988 intel_crt_init(display); 7810 7989 intel_dvo_init(dev_priv); 7811 7990 } 7812 7991 7813 - for_each_intel_encoder(&dev_priv->drm, encoder) { 7992 + for_each_intel_encoder(display->drm, encoder) { 7814 7993 encoder->base.possible_crtcs = 7815 7994 intel_encoder_possible_crtcs(encoder); 7816 7995 encoder->base.possible_clones = ··· 7819 7998 7820 7999 intel_init_pch_refclk(dev_priv); 7821 8000 7822 - drm_helper_move_panel_connectors_to_head(&dev_priv->drm); 8001 + drm_helper_move_panel_connectors_to_head(display->drm); 7823 8002 } 7824 8003 7825 - static int max_dotclock(struct drm_i915_private *i915) 8004 + static int max_dotclock(struct intel_display *display) 7826 8005 { 7827 - struct intel_display *display = &i915->display; 7828 8006 int max_dotclock = display->cdclk.max_dotclk_freq; 7829 8007 7830 8008 if (HAS_ULTRAJOINER(display)) ··· 7837 8017 enum drm_mode_status intel_mode_valid(struct drm_device *dev, 7838 8018 const struct drm_display_mode *mode) 7839 8019 { 7840 - struct drm_i915_private *dev_priv = to_i915(dev); 8020 + struct intel_display *display = to_intel_display(dev); 7841 8021 int hdisplay_max, htotal_max; 7842 8022 int vdisplay_max, vtotal_max; 7843 8023 ··· 7874 8054 * Reject clearly excessive dotclocks early to 7875 8055 * avoid having to worry about huge integers later. 7876 8056 */ 7877 - if (mode->clock > max_dotclock(dev_priv)) 8057 + if (mode->clock > max_dotclock(display)) 7878 8058 return MODE_CLOCK_HIGH; 7879 8059 7880 8060 /* Transcoder timing limits */ 7881 - if (DISPLAY_VER(dev_priv) >= 11) { 8061 + if (DISPLAY_VER(display) >= 11) { 7882 8062 hdisplay_max = 16384; 7883 8063 vdisplay_max = 8192; 7884 8064 htotal_max = 16384; 7885 8065 vtotal_max = 8192; 7886 - } else if (DISPLAY_VER(dev_priv) >= 9 || 7887 - IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) { 8066 + } else if (DISPLAY_VER(display) >= 9 || 8067 + display->platform.broadwell || display->platform.haswell) { 7888 8068 hdisplay_max = 8192; /* FDI max 4096 handled elsewhere */ 7889 8069 vdisplay_max = 4096; 7890 8070 htotal_max = 8192; 7891 8071 vtotal_max = 8192; 7892 - } else if (DISPLAY_VER(dev_priv) >= 3) { 8072 + } else if (DISPLAY_VER(display) >= 3) { 7893 8073 hdisplay_max = 4096; 7894 8074 vdisplay_max = 4096; 7895 8075 htotal_max = 8192; ··· 8035 8215 8036 8216 /** 8037 8217 * intel_init_display_hooks - initialize the display modesetting hooks 8038 - * @dev_priv: device private 8218 + * @display: display device private 8039 8219 */ 8040 - void intel_init_display_hooks(struct drm_i915_private *dev_priv) 8220 + void intel_init_display_hooks(struct intel_display *display) 8041 8221 { 8042 - if (DISPLAY_VER(dev_priv) >= 9) { 8043 - dev_priv->display.funcs.display = &skl_display_funcs; 8044 - } else if (HAS_DDI(dev_priv)) { 8045 - dev_priv->display.funcs.display = &ddi_display_funcs; 8222 + struct drm_i915_private *dev_priv = to_i915(display->drm); 8223 + 8224 + if (DISPLAY_VER(display) >= 9) { 8225 + display->funcs.display = &skl_display_funcs; 8226 + } else if (HAS_DDI(display)) { 8227 + display->funcs.display = &ddi_display_funcs; 8046 8228 } else if (HAS_PCH_SPLIT(dev_priv)) { 8047 - dev_priv->display.funcs.display = &pch_split_display_funcs; 8048 - } else if (IS_CHERRYVIEW(dev_priv) || 8049 - IS_VALLEYVIEW(dev_priv)) { 8050 - dev_priv->display.funcs.display = &vlv_display_funcs; 8229 + display->funcs.display = &pch_split_display_funcs; 8230 + } else if (display->platform.cherryview || 8231 + display->platform.valleyview) { 8232 + display->funcs.display = &vlv_display_funcs; 8051 8233 } else { 8052 - dev_priv->display.funcs.display = &i9xx_display_funcs; 8234 + display->funcs.display = &i9xx_display_funcs; 8053 8235 } 8054 8236 } 8055 8237 8056 - int intel_initial_commit(struct drm_device *dev) 8238 + int intel_initial_commit(struct intel_display *display) 8057 8239 { 8058 8240 struct drm_atomic_state *state = NULL; 8059 8241 struct drm_modeset_acquire_ctx ctx; 8060 8242 struct intel_crtc *crtc; 8061 8243 int ret = 0; 8062 8244 8063 - state = drm_atomic_state_alloc(dev); 8245 + state = drm_atomic_state_alloc(display->drm); 8064 8246 if (!state) 8065 8247 return -ENOMEM; 8066 8248 ··· 8072 8250 to_intel_atomic_state(state)->internal = true; 8073 8251 8074 8252 retry: 8075 - for_each_intel_crtc(dev, crtc) { 8253 + for_each_intel_crtc(display->drm, crtc) { 8076 8254 struct intel_crtc_state *crtc_state = 8077 8255 intel_atomic_get_crtc_state(state, crtc); 8078 8256 ··· 8096 8274 */ 8097 8275 crtc_state->uapi.color_mgmt_changed = true; 8098 8276 8099 - for_each_intel_encoder_mask(dev, encoder, 8277 + for_each_intel_encoder_mask(display->drm, encoder, 8100 8278 crtc_state->uapi.encoder_mask) { 8101 8279 if (encoder->initial_fastset_check && 8102 8280 !encoder->initial_fastset_check(encoder, crtc_state)) {
+14 -20
drivers/gpu/drm/i915/display/intel_display.h
··· 426 426 enum drm_mode_status 427 427 intel_cpu_transcoder_mode_valid(struct intel_display *display, 428 428 const struct drm_display_mode *mode); 429 - enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); 429 + enum phy intel_port_to_phy(struct intel_display *display, enum port port); 430 430 bool is_trans_port_sync_mode(const struct intel_crtc_state *state); 431 431 bool is_trans_port_sync_master(const struct intel_crtc_state *state); 432 432 u8 intel_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); ··· 457 457 const char *name, u32 reg, int ref_freq); 458 458 int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv, 459 459 const char *name, u32 reg); 460 - void intel_init_display_hooks(struct drm_i915_private *dev_priv); 461 - bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv); 460 + bool intel_has_pending_fb_unpin(struct intel_display *display); 462 461 void intel_encoder_destroy(struct drm_encoder *encoder); 463 462 struct drm_display_mode * 464 463 intel_encoder_current_mode(struct intel_encoder *encoder); 465 464 void intel_encoder_get_config(struct intel_encoder *encoder, 466 465 struct intel_crtc_state *crtc_state); 467 466 bool intel_phy_is_combo(struct intel_display *display, enum phy phy); 468 - bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy); 469 - bool intel_phy_is_snps(struct drm_i915_private *dev_priv, enum phy phy); 470 - enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, 471 - enum port port); 467 + bool intel_phy_is_tc(struct intel_display *display, enum phy phy); 468 + bool intel_phy_is_snps(struct intel_display *display, enum phy phy); 469 + enum tc_port intel_port_to_tc(struct intel_display *display, enum port port); 472 470 473 471 enum phy intel_encoder_to_phy(struct intel_encoder *encoder); 474 472 bool intel_encoder_is_combo(struct intel_encoder *encoder); ··· 479 481 bool intel_fuzzy_clock_check(int clock1, int clock2); 480 482 481 483 void intel_zero_m_n(struct intel_link_m_n *m_n); 482 - void intel_set_m_n(struct drm_i915_private *i915, 484 + void intel_set_m_n(struct intel_display *display, 483 485 const struct intel_link_m_n *m_n, 484 486 i915_reg_t data_m_reg, i915_reg_t data_n_reg, 485 487 i915_reg_t link_m_reg, i915_reg_t link_n_reg); 486 - void intel_get_m_n(struct drm_i915_private *i915, 488 + void intel_get_m_n(struct intel_display *display, 487 489 struct intel_link_m_n *m_n, 488 490 i915_reg_t data_m_reg, i915_reg_t data_n_reg, 489 491 i915_reg_t link_m_reg, i915_reg_t link_n_reg); 490 - bool intel_cpu_transcoder_has_m2_n2(struct drm_i915_private *dev_priv, 492 + bool intel_cpu_transcoder_has_m2_n2(struct intel_display *display, 491 493 enum transcoder transcoder); 492 494 void intel_cpu_transcoder_set_m1_n1(struct intel_crtc *crtc, 493 495 enum transcoder cpu_transcoder, ··· 508 510 intel_aux_power_domain(struct intel_digital_port *dig_port); 509 511 void intel_crtc_arm_fifo_underrun(struct intel_crtc *crtc, 510 512 struct intel_crtc_state *crtc_state); 511 - void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state); 512 - 513 513 int bdw_get_pipe_misc_bpp(struct intel_crtc *crtc); 514 514 unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state); 515 515 ··· 521 525 bool visible); 522 526 void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state); 523 527 524 - void intel_update_watermarks(struct drm_i915_private *i915); 525 - 526 528 bool intel_crtc_vrr_disabling(struct intel_atomic_state *state, 527 529 struct intel_crtc *crtc); 528 530 ··· 529 535 const char *reason, u8 pipe_mask); 530 536 int intel_modeset_all_pipes_late(struct intel_atomic_state *state, 531 537 const char *reason); 532 - int intel_modeset_commit_pipes(struct drm_i915_private *i915, 538 + int intel_modeset_commit_pipes(struct intel_display *display, 533 539 u8 pipe_mask, 534 540 struct drm_modeset_acquire_ctx *ctx); 535 541 void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state, ··· 538 544 struct intel_power_domain_mask *domains); 539 545 540 546 /* interface for intel_display_driver.c */ 541 - void intel_setup_outputs(struct drm_i915_private *i915); 542 - int intel_initial_commit(struct drm_device *dev); 543 - void intel_panel_sanitize_ssc(struct drm_i915_private *i915); 544 - void intel_update_czclk(struct drm_i915_private *i915); 545 - void intel_atomic_helper_free_state_worker(struct work_struct *work); 547 + void intel_init_display_hooks(struct intel_display *display); 548 + void intel_setup_outputs(struct intel_display *display); 549 + int intel_initial_commit(struct intel_display *display); 550 + void intel_panel_sanitize_ssc(struct intel_display *display); 551 + void intel_update_czclk(struct intel_display *display); 546 552 enum drm_mode_status intel_mode_valid(struct drm_device *dev, 547 553 const struct drm_display_mode *mode); 548 554 int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state,
+3 -1
drivers/gpu/drm/i915/display/intel_display_core.h
··· 91 91 struct intel_crtc *crtc); 92 92 int (*compute_global_watermarks)(struct intel_atomic_state *state); 93 93 void (*get_hw_state)(struct drm_i915_private *i915); 94 + void (*sanitize)(struct drm_i915_private *i915); 94 95 }; 95 96 96 97 struct intel_audio_state { ··· 387 386 struct { 388 387 /* list of fbdev register on this device */ 389 388 struct intel_fbdev *fbdev; 390 - struct work_struct suspend_work; 391 389 } fbdev; 392 390 393 391 struct { ··· 512 512 /* restore state for suspend/resume and display reset */ 513 513 struct drm_atomic_state *modeset_state; 514 514 struct drm_modeset_acquire_ctx reset_ctx; 515 + /* modeset stuck tracking for reset */ 516 + atomic_t pending_fb_pin; 515 517 u32 saveDSPARB; 516 518 u32 saveSWF0[16]; 517 519 u32 saveSWF1[16];
+12 -22
drivers/gpu/drm/i915/display/intel_display_debugfs.c
··· 49 49 return to_intel_display(node->minor->dev); 50 50 } 51 51 52 - static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node) 53 - { 54 - return to_i915(node->minor->dev); 55 - } 56 - 57 52 static int intel_display_caps(struct seq_file *m, void *data) 58 53 { 59 54 struct intel_display *display = node_to_intel_display(m->private); ··· 80 85 81 86 static int i915_sr_status(struct seq_file *m, void *unused) 82 87 { 83 - struct drm_i915_private *dev_priv = node_to_i915(m->private); 84 88 struct intel_display *display = node_to_intel_display(m->private); 89 + struct drm_i915_private *dev_priv = to_i915(display->drm); 85 90 intel_wakeref_t wakeref; 86 91 bool sr_enabled = false; 87 92 ··· 97 102 else if (display->platform.i915gm) 98 103 sr_enabled = intel_de_read(display, INSTPM) & INSTPM_SELF_EN; 99 104 else if (display->platform.pineview) 100 - sr_enabled = intel_de_read(display, DSPFW3(dev_priv)) & PINEVIEW_SELF_REFRESH_EN; 105 + sr_enabled = intel_de_read(display, DSPFW3(display)) & PINEVIEW_SELF_REFRESH_EN; 101 106 else if (display->platform.valleyview || display->platform.cherryview) 102 107 sr_enabled = intel_de_read(display, FW_BLC_SELF_VLV) & FW_CSPWRDWNEN; 103 108 ··· 114 119 struct intel_framebuffer *fbdev_fb = NULL; 115 120 struct drm_framebuffer *drm_fb; 116 121 117 - #ifdef CONFIG_DRM_FBDEV_EMULATION 118 122 fbdev_fb = intel_fbdev_framebuffer(display->fbdev.fbdev); 119 123 if (fbdev_fb) { 120 124 seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ", ··· 126 132 intel_bo_describe(m, intel_fb_bo(&fbdev_fb->base)); 127 133 seq_putc(m, '\n'); 128 134 } 129 - #endif 130 135 131 136 mutex_lock(&display->drm->mode_config.fb_lock); 132 137 drm_for_each_fb(drm_fb, display->drm) { ··· 150 157 151 158 static int i915_power_domain_info(struct seq_file *m, void *unused) 152 159 { 153 - struct drm_i915_private *i915 = node_to_i915(m->private); 154 - struct intel_display *display = &i915->display; 160 + struct intel_display *display = node_to_intel_display(m->private); 155 161 156 162 intel_display_power_debug(display, m); 157 163 ··· 259 267 switch (connector->connector_type) { 260 268 case DRM_MODE_CONNECTOR_DisplayPort: 261 269 case DRM_MODE_CONNECTOR_eDP: 262 - if (intel_connector->mst_port) 270 + if (intel_connector->mst.dp) 263 271 intel_dp_mst_info(m, intel_connector); 264 272 else 265 273 intel_dp_info(m, intel_connector); ··· 580 588 static int i915_display_info(struct seq_file *m, void *unused) 581 589 { 582 590 struct intel_display *display = node_to_intel_display(m->private); 583 - struct drm_i915_private *dev_priv = node_to_i915(m->private); 591 + struct drm_i915_private *dev_priv = to_i915(display->drm); 584 592 struct intel_crtc *crtc; 585 593 struct drm_connector *connector; 586 594 struct drm_connector_list_iter conn_iter; ··· 705 713 static int i915_lpsp_status(struct seq_file *m, void *unused) 706 714 { 707 715 struct intel_display *display = node_to_intel_display(m->private); 708 - struct drm_i915_private *i915 = node_to_i915(m->private); 709 716 bool lpsp_enabled = false; 710 717 711 718 if (DISPLAY_VER(display) >= 13 || IS_DISPLAY_VER(display, 9, 10)) { 712 719 lpsp_enabled = !intel_lpsp_power_well_enabled(display, SKL_DISP_PW_2); 713 720 } else if (IS_DISPLAY_VER(display, 11, 12)) { 714 721 lpsp_enabled = !intel_lpsp_power_well_enabled(display, ICL_DISP_PW_3); 715 - } else if (IS_HASWELL(i915) || IS_BROADWELL(i915)) { 722 + } else if (display->platform.haswell || display->platform.broadwell) { 716 723 lpsp_enabled = !intel_lpsp_power_well_enabled(display, HSW_DISP_PW_GLOBAL); 717 724 } else { 718 725 seq_puts(m, "LPSP: not supported\n"); ··· 747 756 seq_printf(m, "MST Source Port [ENCODER:%d:%s]\n", 748 757 dig_port->base.base.base.id, 749 758 dig_port->base.base.name); 750 - drm_dp_mst_dump_topology(m, &dig_port->dp.mst_mgr); 759 + drm_dp_mst_dump_topology(m, &dig_port->dp.mst.mgr); 751 760 } 752 761 drm_connector_list_iter_end(&conn_iter); 753 762 ··· 827 836 {"i915_lpsp_status", i915_lpsp_status, 0}, 828 837 }; 829 838 830 - void intel_display_debugfs_register(struct drm_i915_private *i915) 839 + void intel_display_debugfs_register(struct intel_display *display) 831 840 { 832 - struct intel_display *display = &i915->display; 833 - struct drm_minor *minor = i915->drm.primary; 841 + struct drm_i915_private *i915 = to_i915(display->drm); 842 + struct drm_minor *minor = display->drm->primary; 834 843 835 844 debugfs_create_file("i915_fifo_underrun_reset", 0644, minor->debugfs_root, 836 845 display, &i915_fifo_underrun_reset_ops); ··· 856 865 struct intel_connector *connector = m->private; 857 866 struct intel_display *display = to_intel_display(connector); 858 867 struct intel_encoder *encoder = intel_attached_encoder(connector); 859 - struct drm_i915_private *i915 = to_i915(connector->base.dev); 860 868 int connector_type = connector->base.connector_type; 861 869 bool lpsp_capable = false; 862 870 ··· 882 892 (connector_type == DRM_MODE_CONNECTOR_DSI || 883 893 connector_type == DRM_MODE_CONNECTOR_eDP || 884 894 connector_type == DRM_MODE_CONNECTOR_DisplayPort)); 885 - else if (IS_HASWELL(i915) || IS_BROADWELL(i915)) 895 + else if (display->platform.haswell || display->platform.broadwell) 886 896 lpsp_capable = connector_type == DRM_MODE_CONNECTOR_eDP; 887 897 888 898 seq_printf(m, "LPSP: %s\n", lpsp_capable ? "capable" : "incapable"); ··· 1339 1349 intel_dp_link_training_debugfs_add(connector); 1340 1350 1341 1351 if (DISPLAY_VER(display) >= 11 && 1342 - ((connector_type == DRM_MODE_CONNECTOR_DisplayPort && !connector->mst_port) || 1352 + ((connector_type == DRM_MODE_CONNECTOR_DisplayPort && !connector->mst.dp) || 1343 1353 connector_type == DRM_MODE_CONNECTOR_eDP)) { 1344 1354 debugfs_create_file("i915_dsc_fec_support", 0644, root, 1345 1355 connector, &i915_dsc_fec_support_fops);
+3 -3
drivers/gpu/drm/i915/display/intel_display_debugfs.h
··· 6 6 #ifndef __INTEL_DISPLAY_DEBUGFS_H__ 7 7 #define __INTEL_DISPLAY_DEBUGFS_H__ 8 8 9 - struct drm_i915_private; 10 9 struct intel_connector; 11 10 struct intel_crtc; 11 + struct intel_display; 12 12 13 13 #ifdef CONFIG_DEBUG_FS 14 - void intel_display_debugfs_register(struct drm_i915_private *i915); 14 + void intel_display_debugfs_register(struct intel_display *display); 15 15 void intel_connector_debugfs_add(struct intel_connector *connector); 16 16 void intel_crtc_debugfs_add(struct intel_crtc *crtc); 17 17 #else 18 - static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {} 18 + static inline void intel_display_debugfs_register(struct intel_display *display) {} 19 19 static inline void intel_connector_debugfs_add(struct intel_connector *connector) {} 20 20 static inline void intel_crtc_debugfs_add(struct intel_crtc *crtc) {} 21 21 #endif
+1
drivers/gpu/drm/i915/display/intel_display_device.h
··· 163 163 #define HAS_DSC(__display) (DISPLAY_RUNTIME_INFO(__display)->has_dsc) 164 164 #define HAS_DSC_MST(__display) (DISPLAY_VER(__display) >= 12 && HAS_DSC(__display)) 165 165 #define HAS_FBC(__display) (DISPLAY_RUNTIME_INFO(__display)->fbc_mask != 0) 166 + #define HAS_FBC_DIRTY_RECT(__display) (DISPLAY_VER(__display) >= 30) 166 167 #define HAS_FPGA_DBG_UNCLAIMED(__display) (DISPLAY_INFO(__display)->has_fpga_dbg) 167 168 #define HAS_FW_BLC(__display) (DISPLAY_VER(__display) >= 3) 168 169 #define HAS_GMBUS_IRQ(__display) (DISPLAY_VER(__display) >= 4)
+9 -9
drivers/gpu/drm/i915/display/intel_display_driver.c
··· 194 194 mutex_init(&display->hdcp.hdcp_mutex); 195 195 196 196 intel_display_irq_init(i915); 197 - intel_dkl_phy_init(i915); 197 + intel_dkl_phy_init(display); 198 198 intel_color_init_hooks(display); 199 199 intel_init_cdclk_hooks(display); 200 200 intel_audio_hooks_init(display); 201 201 intel_dpll_init_clock_hook(i915); 202 - intel_init_display_hooks(i915); 203 - intel_fdi_init_hook(i915); 202 + intel_init_display_hooks(display); 203 + intel_fdi_init_hook(display); 204 204 intel_dmc_wl_init(display); 205 205 } 206 206 ··· 431 431 432 432 intel_wm_init(i915); 433 433 434 - intel_panel_sanitize_ssc(i915); 434 + intel_panel_sanitize_ssc(display); 435 435 436 436 intel_pps_setup(display); 437 437 ··· 449 449 450 450 intel_plane_possible_crtcs_init(display); 451 451 intel_shared_dpll_init(display); 452 - intel_fdi_pll_freq_update(i915); 452 + intel_fdi_pll_freq_update(display); 453 453 454 - intel_update_czclk(i915); 454 + intel_update_czclk(display); 455 455 intel_display_driver_init_hw(display); 456 456 intel_dpll_update_ref_clks(display); 457 457 ··· 462 462 463 463 /* Just disable it once at startup */ 464 464 intel_vga_disable(display); 465 - intel_setup_outputs(i915); 465 + intel_setup_outputs(display); 466 466 467 467 ret = intel_dp_tunnel_mgr_init(display); 468 468 if (ret) ··· 517 517 * are already calculated and there is no assert_plane warnings 518 518 * during bootup. 519 519 */ 520 - ret = intel_initial_commit(display->drm); 520 + ret = intel_initial_commit(display); 521 521 if (ret) 522 522 drm_dbg_kms(display->drm, "Initial modeset failed, %d\n", ret); 523 523 ··· 550 550 551 551 intel_audio_register(display); 552 552 553 - intel_display_debugfs_register(i915); 553 + intel_display_debugfs_register(display); 554 554 555 555 /* 556 556 * We need to coordinate the hotplugs with the asynchronous
+3 -3
drivers/gpu/drm/i915/display/intel_display_irq.c
··· 1101 1101 "[CRTC:%d:%s] PLANE ATS fault\n", 1102 1102 crtc->base.base.id, crtc->base.name); 1103 1103 1104 - return false; 1104 + return true; 1105 1105 } 1106 1106 1107 1107 static bool handle_pipedmc_ats_fault(struct intel_crtc *crtc, enum plane_id plane_id) ··· 1112 1112 "[CRTC:%d:%s] PIPEDMC ATS fault\n", 1113 1113 crtc->base.base.id, crtc->base.name); 1114 1114 1115 - return false; 1115 + return true; 1116 1116 } 1117 1117 1118 1118 static bool handle_pipedmc_fault(struct intel_crtc *crtc, enum plane_id plane_id) ··· 1123 1123 "[CRTC:%d:%s] PIPEDMC fault\n", 1124 1124 crtc->base.base.id, crtc->base.name); 1125 1125 1126 - return false; 1126 + return true; 1127 1127 } 1128 1128 1129 1129 static const struct pipe_fault_handler mtl_pipe_fault_handlers[] = {
+4 -1
drivers/gpu/drm/i915/display/intel_display_power.c
··· 1684 1684 1685 1685 /* 8. Ensure PHYs have completed calibration and adaptation */ 1686 1686 if (display->platform.dg2) 1687 - intel_snps_phy_wait_for_calibration(dev_priv); 1687 + intel_snps_phy_wait_for_calibration(display); 1688 1688 1689 1689 /* 9. XE2_HPD: Program CHICKEN_MISC_2 before any cursor or planes are enabled */ 1690 1690 if (DISPLAY_VERx100(display) == 1401) ··· 2316 2316 int i; 2317 2317 2318 2318 mutex_lock(&power_domains->lock); 2319 + 2320 + seq_printf(m, "Runtime power status: %s\n", 2321 + str_enabled_disabled(!power_domains->init_wakeref)); 2319 2322 2320 2323 seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count"); 2321 2324 for (i = 0; i < power_domains->power_well_count; i++) {
+4 -3
drivers/gpu/drm/i915/display/intel_display_power.h
··· 117 117 POWER_DOMAIN_INVALID = POWER_DOMAIN_NUM, 118 118 }; 119 119 120 - #define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A) 120 + #define POWER_DOMAIN_PIPE(pipe) \ 121 + ((enum intel_display_power_domain)((pipe) - PIPE_A + POWER_DOMAIN_PIPE_A)) 121 122 #define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \ 122 - ((pipe) + POWER_DOMAIN_PIPE_PANEL_FITTER_A) 123 + ((enum intel_display_power_domain)((pipe) - PIPE_A + POWER_DOMAIN_PIPE_PANEL_FITTER_A)) 123 124 #define POWER_DOMAIN_TRANSCODER(tran) \ 124 125 ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \ 125 - (tran) + POWER_DOMAIN_TRANSCODER_A) 126 + (enum intel_display_power_domain)((tran) - TRANSCODER_A + POWER_DOMAIN_TRANSCODER_A)) 126 127 127 128 struct intel_power_domain_mask { 128 129 DECLARE_BITMAP(bits, POWER_DOMAIN_NUM);
+2
drivers/gpu/drm/i915/display/intel_display_power_map.c
··· 3 3 * Copyright © 2022 Intel Corporation 4 4 */ 5 5 6 + #include <drm/drm_print.h> 7 + 6 8 #include "i915_reg.h" 7 9 #include "intel_display_core.h" 8 10 #include "intel_display_power_map.h"
+3 -6
drivers/gpu/drm/i915/display/intel_display_power_well.c
··· 549 549 icl_aux_power_well_enable(struct intel_display *display, 550 550 struct i915_power_well *power_well) 551 551 { 552 - struct drm_i915_private *dev_priv = to_i915(display->drm); 553 552 enum phy phy = icl_aux_pw_to_phy(display, power_well); 554 553 555 - if (intel_phy_is_tc(dev_priv, phy)) 554 + if (intel_phy_is_tc(display, phy)) 556 555 return icl_tc_phy_aux_power_well_enable(display, power_well); 557 556 else if (display->platform.icelake) 558 557 return icl_combo_phy_aux_power_well_enable(display, ··· 564 565 icl_aux_power_well_disable(struct intel_display *display, 565 566 struct i915_power_well *power_well) 566 567 { 567 - struct drm_i915_private *dev_priv = to_i915(display->drm); 568 568 enum phy phy = icl_aux_pw_to_phy(display, power_well); 569 569 570 - if (intel_phy_is_tc(dev_priv, phy)) 570 + if (intel_phy_is_tc(display, phy)) 571 571 return hsw_power_well_disable(display, power_well); 572 572 else if (display->platform.icelake) 573 573 return icl_combo_phy_aux_power_well_disable(display, ··· 1827 1829 static void xelpdp_aux_power_well_enable(struct intel_display *display, 1828 1830 struct i915_power_well *power_well) 1829 1831 { 1830 - struct drm_i915_private *dev_priv = to_i915(display->drm); 1831 1832 enum aux_ch aux_ch = i915_power_well_instance(power_well)->xelpdp.aux_ch; 1832 1833 enum phy phy = icl_aux_pw_to_phy(display, power_well); 1833 1834 1834 - if (intel_phy_is_tc(dev_priv, phy)) 1835 + if (intel_phy_is_tc(display, phy)) 1835 1836 icl_tc_port_assert_ref_held(display, power_well, 1836 1837 aux_ch_to_digital_port(display, aux_ch)); 1837 1838
+30 -43
drivers/gpu/drm/i915/display/intel_display_reset.c
··· 14 14 #include "intel_hotplug.h" 15 15 #include "intel_pps.h" 16 16 17 - static bool gpu_reset_clobbers_display(struct drm_i915_private *dev_priv) 17 + bool intel_display_reset_test(struct intel_display *display) 18 18 { 19 - return (INTEL_INFO(dev_priv)->gpu_reset_clobbers_display && 20 - intel_has_gpu_reset(to_gt(dev_priv))); 19 + return display->params.force_reset_modeset_test; 21 20 } 22 21 23 - void intel_display_reset_prepare(struct drm_i915_private *dev_priv) 22 + /* returns true if intel_display_reset_finish() needs to be called */ 23 + bool intel_display_reset_prepare(struct intel_display *display, 24 + modeset_stuck_fn modeset_stuck, void *context) 24 25 { 25 - struct drm_modeset_acquire_ctx *ctx = &dev_priv->display.restore.reset_ctx; 26 + struct drm_modeset_acquire_ctx *ctx = &display->restore.reset_ctx; 26 27 struct drm_atomic_state *state; 27 28 int ret; 28 29 29 - if (!HAS_DISPLAY(dev_priv)) 30 - return; 30 + if (!HAS_DISPLAY(display)) 31 + return false; 31 32 32 - /* reset doesn't touch the display */ 33 - if (!dev_priv->display.params.force_reset_modeset_test && 34 - !gpu_reset_clobbers_display(dev_priv)) 35 - return; 36 - 37 - /* We have a modeset vs reset deadlock, defensively unbreak it. */ 38 - set_bit(I915_RESET_MODESET, &to_gt(dev_priv)->reset.flags); 39 - smp_mb__after_atomic(); 40 - wake_up_bit(&to_gt(dev_priv)->reset.flags, I915_RESET_MODESET); 41 - 42 - if (atomic_read(&dev_priv->gpu_error.pending_fb_pin)) { 43 - drm_dbg_kms(&dev_priv->drm, 33 + if (atomic_read(&display->restore.pending_fb_pin)) { 34 + drm_dbg_kms(display->drm, 44 35 "Modeset potentially stuck, unbreaking through wedging\n"); 45 - intel_gt_set_wedged(to_gt(dev_priv)); 36 + modeset_stuck(context); 46 37 } 47 38 48 39 /* 49 40 * Need mode_config.mutex so that we don't 50 41 * trample ongoing ->detect() and whatnot. 51 42 */ 52 - mutex_lock(&dev_priv->drm.mode_config.mutex); 43 + mutex_lock(&display->drm->mode_config.mutex); 53 44 drm_modeset_acquire_init(ctx, 0); 54 45 while (1) { 55 - ret = drm_modeset_lock_all_ctx(&dev_priv->drm, ctx); 46 + ret = drm_modeset_lock_all_ctx(display->drm, ctx); 56 47 if (ret != -EDEADLK) 57 48 break; 58 49 ··· 53 62 * Disabling the crtcs gracefully seems nicer. Also the 54 63 * g33 docs say we should at least disable all the planes. 55 64 */ 56 - state = drm_atomic_helper_duplicate_state(&dev_priv->drm, ctx); 65 + state = drm_atomic_helper_duplicate_state(display->drm, ctx); 57 66 if (IS_ERR(state)) { 58 67 ret = PTR_ERR(state); 59 - drm_err(&dev_priv->drm, "Duplicating state failed with %i\n", 68 + drm_err(display->drm, "Duplicating state failed with %i\n", 60 69 ret); 61 - return; 70 + return true; 62 71 } 63 72 64 - ret = drm_atomic_helper_disable_all(&dev_priv->drm, ctx); 73 + ret = drm_atomic_helper_disable_all(display->drm, ctx); 65 74 if (ret) { 66 - drm_err(&dev_priv->drm, "Suspending crtc's failed with %i\n", 75 + drm_err(display->drm, "Suspending crtc's failed with %i\n", 67 76 ret); 68 77 drm_atomic_state_put(state); 69 - return; 78 + return true; 70 79 } 71 80 72 - dev_priv->display.restore.modeset_state = state; 81 + display->restore.modeset_state = state; 73 82 state->acquire_ctx = ctx; 83 + 84 + return true; 74 85 } 75 86 76 - void intel_display_reset_finish(struct drm_i915_private *i915) 87 + void intel_display_reset_finish(struct intel_display *display, bool test_only) 77 88 { 78 - struct intel_display *display = &i915->display; 89 + struct drm_i915_private *i915 = to_i915(display->drm); 79 90 struct drm_modeset_acquire_ctx *ctx = &display->restore.reset_ctx; 80 91 struct drm_atomic_state *state; 81 92 int ret; 82 93 83 - if (!HAS_DISPLAY(i915)) 84 - return; 85 - 86 - /* reset doesn't touch the display */ 87 - if (!test_bit(I915_RESET_MODESET, &to_gt(i915)->reset.flags)) 94 + if (!HAS_DISPLAY(display)) 88 95 return; 89 96 90 97 state = fetch_and_zero(&display->restore.modeset_state); ··· 90 101 goto unlock; 91 102 92 103 /* reset doesn't touch the display */ 93 - if (!gpu_reset_clobbers_display(i915)) { 104 + if (test_only) { 94 105 /* for testing only restore the display */ 95 106 ret = drm_atomic_helper_commit_duplicated_state(state, ctx); 96 107 if (ret) { 97 - drm_WARN_ON(&i915->drm, ret == -EDEADLK); 98 - drm_err(&i915->drm, 108 + drm_WARN_ON(display->drm, ret == -EDEADLK); 109 + drm_err(display->drm, 99 110 "Restoring old state failed with %i\n", ret); 100 111 } 101 112 } else { ··· 111 122 112 123 ret = __intel_display_driver_resume(display, state, ctx); 113 124 if (ret) 114 - drm_err(&i915->drm, 125 + drm_err(display->drm, 115 126 "Restoring old state failed with %i\n", ret); 116 127 117 128 intel_hpd_poll_disable(i915); ··· 121 132 unlock: 122 133 drm_modeset_drop_locks(ctx); 123 134 drm_modeset_acquire_fini(ctx); 124 - mutex_unlock(&i915->drm.mode_config.mutex); 125 - 126 - clear_bit_unlock(I915_RESET_MODESET, &to_gt(i915)->reset.flags); 135 + mutex_unlock(&display->drm->mode_config.mutex); 127 136 }
+9 -3
drivers/gpu/drm/i915/display/intel_display_reset.h
··· 6 6 #ifndef __INTEL_RESET_H__ 7 7 #define __INTEL_RESET_H__ 8 8 9 - struct drm_i915_private; 9 + #include <linux/types.h> 10 10 11 - void intel_display_reset_prepare(struct drm_i915_private *i915); 12 - void intel_display_reset_finish(struct drm_i915_private *i915); 11 + struct intel_display; 12 + 13 + typedef void modeset_stuck_fn(void *context); 14 + 15 + bool intel_display_reset_test(struct intel_display *display); 16 + bool intel_display_reset_prepare(struct intel_display *display, 17 + modeset_stuck_fn modeset_stuck, void *context); 18 + void intel_display_reset_finish(struct intel_display *display, bool test_only); 13 19 14 20 #endif /* __INTEL_RESET_H__ */
+3 -1
drivers/gpu/drm/i915/display/intel_display_rps.c
··· 69 69 add_wait_queue(drm_crtc_vblank_waitqueue(crtc), &wait->wait); 70 70 } 71 71 72 - void intel_display_rps_mark_interactive(struct drm_i915_private *i915, 72 + void intel_display_rps_mark_interactive(struct intel_display *display, 73 73 struct intel_atomic_state *state, 74 74 bool interactive) 75 75 { 76 + struct drm_i915_private *i915 = to_i915(display->drm); 77 + 76 78 if (state->rps_interactive == interactive) 77 79 return; 78 80
+2 -2
drivers/gpu/drm/i915/display/intel_display_rps.h
··· 10 10 11 11 struct dma_fence; 12 12 struct drm_crtc; 13 - struct drm_i915_private; 14 13 struct intel_atomic_state; 14 + struct intel_display; 15 15 16 16 void intel_display_rps_boost_after_vblank(struct drm_crtc *crtc, 17 17 struct dma_fence *fence); 18 - void intel_display_rps_mark_interactive(struct drm_i915_private *i915, 18 + void intel_display_rps_mark_interactive(struct intel_display *display, 19 19 struct intel_atomic_state *state, 20 20 bool interactive); 21 21
+28 -27
drivers/gpu/drm/i915/display/intel_display_types.h
··· 40 40 #include <drm/drm_rect.h> 41 41 #include <drm/drm_vblank_work.h> 42 42 #include <drm/intel/i915_hdcp_interface.h> 43 + #include <uapi/drm/i915_drm.h> 43 44 44 - #include "i915_vma.h" 45 - #include "i915_vma_types.h" 45 + #include "i915_gtt_view_types.h" 46 46 #include "intel_bios.h" 47 47 #include "intel_display.h" 48 48 #include "intel_display_conversion.h" ··· 534 534 state of connector->polled in case hotplug storm detection changes it */ 535 535 u8 polled; 536 536 537 - struct drm_dp_mst_port *port; 538 - 539 - struct intel_dp *mst_port; 540 - 541 537 int force_joined_pipes; 542 538 543 539 struct { ··· 544 548 u8 dsc_hblank_expansion_quirk:1; 545 549 u8 dsc_decompression_enabled:1; 546 550 } dp; 551 + 552 + struct { 553 + struct drm_dp_mst_port *port; 554 + struct intel_dp *dp; 555 + } mst; 547 556 548 557 /* Work struct to schedule a uevent on link train failure */ 549 558 struct work_struct modeset_retry_work; ··· 693 692 u64 ccval; 694 693 695 694 const char *no_fbc_reason; 695 + 696 + struct drm_rect damage; 696 697 }; 697 698 698 699 struct intel_initial_plane_config { ··· 1727 1724 struct intel_pps pps; 1728 1725 1729 1726 bool is_mst; 1730 - int active_mst_links; 1731 1727 enum drm_dp_mst_mode mst_detect; 1732 1728 1733 1729 /* connector directly attached - won't be use for modeset in mst world */ ··· 1736 1734 struct drm_dp_tunnel *tunnel; 1737 1735 bool tunnel_suspended:1; 1738 1736 1739 - /* mst connector list */ 1740 - struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES]; 1741 - struct drm_dp_mst_topology_mgr mst_mgr; 1737 + struct { 1738 + struct intel_dp_mst_encoder *stream_encoders[I915_MAX_PIPES]; 1739 + struct drm_dp_mst_topology_mgr mgr; 1740 + int active_links; 1741 + } mst; 1742 1742 1743 1743 u32 (*get_aux_clock_divider)(struct intel_dp *dp, int index); 1744 1744 /* ··· 1851 1847 1852 1848 struct intel_tc_port *tc; 1853 1849 1854 - /* protects num_hdcp_streams reference count, hdcp_port_data and hdcp_auth_status */ 1855 - struct mutex hdcp_mutex; 1856 - /* the number of pipes using HDCP signalling out of this port */ 1857 - unsigned int num_hdcp_streams; 1858 - /* port HDCP auth status */ 1859 - bool hdcp_auth_status; 1860 - /* HDCP port data need to pass to security f/w */ 1861 - struct hdcp_port_data hdcp_port_data; 1862 - /* Whether the MST topology supports HDCP Type 1 Content */ 1863 - bool hdcp_mst_type1_capable; 1850 + struct { 1851 + /* protects num_streams reference count, port_data and auth_status */ 1852 + struct mutex mutex; 1853 + /* the number of pipes using HDCP signalling out of this port */ 1854 + unsigned int num_streams; 1855 + /* port HDCP auth status */ 1856 + bool auth_status; 1857 + /* HDCP port data need to pass to security f/w */ 1858 + struct hdcp_port_data port_data; 1859 + /* Whether the MST topology supports HDCP Type 1 Content */ 1860 + bool mst_type1_capable; 1861 + } hdcp; 1864 1862 1865 1863 void (*write_infoframe)(struct intel_encoder *encoder, 1866 1864 const struct intel_crtc_state *crtc_state, ··· 1961 1955 1962 1956 static inline struct intel_dp *intel_attached_dp(struct intel_connector *connector) 1963 1957 { 1964 - if (connector->mst_port) 1965 - return connector->mst_port; 1958 + if (connector->mst.dp) 1959 + return connector->mst.dp; 1966 1960 else 1967 1961 return enc_to_intel_dp(intel_attached_encoder(connector)); 1968 1962 } ··· 2104 2098 return crtc_state->uapi.color_mgmt_changed || 2105 2099 intel_crtc_needs_fastset(crtc_state) || 2106 2100 intel_crtc_needs_modeset(crtc_state); 2107 - } 2108 - 2109 - static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_state) 2110 - { 2111 - return i915_ggtt_offset(plane_state->ggtt_vma); 2112 2101 } 2113 2102 2114 2103 static inline struct intel_frontbuffer *
+4 -4
drivers/gpu/drm/i915/display/intel_dkl_phy.c
··· 3 3 * Copyright © 2022 Intel Corporation 4 4 */ 5 5 6 - #include "i915_drv.h" 6 + #include <drm/drm_device.h> 7 7 8 8 #include "intel_de.h" 9 9 #include "intel_display.h" ··· 12 12 13 13 /** 14 14 * intel_dkl_phy_init - initialize Dekel PHY 15 - * @i915: i915 device instance 15 + * @display: display device instance 16 16 */ 17 - void intel_dkl_phy_init(struct drm_i915_private *i915) 17 + void intel_dkl_phy_init(struct intel_display *display) 18 18 { 19 - spin_lock_init(&i915->display.dkl.phy_lock); 19 + spin_lock_init(&display->dkl.phy_lock); 20 20 } 21 21 22 22 static void
+1 -2
drivers/gpu/drm/i915/display/intel_dkl_phy.h
··· 10 10 11 11 #include "intel_dkl_phy_regs.h" 12 12 13 - struct drm_i915_private; 14 13 struct intel_display; 15 14 16 - void intel_dkl_phy_init(struct drm_i915_private *i915); 15 + void intel_dkl_phy_init(struct intel_display *display); 17 16 u32 18 17 intel_dkl_phy_read(struct intel_display *display, struct intel_dkl_phy_reg reg); 19 18 void
+23 -27
drivers/gpu/drm/i915/display/intel_dp.c
··· 1376 1376 if (!HAS_DSC(display)) 1377 1377 return false; 1378 1378 1379 - if (connector->mst_port && !HAS_DSC_MST(display)) 1379 + if (connector->mst.dp && !HAS_DSC_MST(display)) 1380 1380 return false; 1381 1381 1382 1382 if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP && ··· 2912 2912 const struct intel_crtc_state *pipe_config, 2913 2913 const struct drm_display_mode *downclock_mode) 2914 2914 { 2915 - struct drm_i915_private *i915 = to_i915(connector->base.dev); 2915 + struct intel_display *display = to_intel_display(connector); 2916 2916 2917 2917 if (pipe_config->vrr.enable) 2918 2918 return false; ··· 2930 2930 if (pipe_config->has_pch_encoder) 2931 2931 return false; 2932 2932 2933 - if (!intel_cpu_transcoder_has_drrs(i915, pipe_config->cpu_transcoder)) 2933 + if (!intel_cpu_transcoder_has_drrs(display, pipe_config->cpu_transcoder)) 2934 2934 return false; 2935 2935 2936 2936 return downclock_mode && ··· 2943 2943 int link_bpp_x16) 2944 2944 { 2945 2945 struct intel_display *display = to_intel_display(connector); 2946 - struct drm_i915_private *i915 = to_i915(connector->base.dev); 2947 2946 const struct drm_display_mode *downclock_mode = 2948 2947 intel_panel_downclock_mode(connector, &pipe_config->hw.adjusted_mode); 2949 2948 int pixel_clock; ··· 2955 2956 pipe_config->update_m_n = true; 2956 2957 2957 2958 if (!can_enable_drrs(connector, pipe_config, downclock_mode)) { 2958 - if (intel_cpu_transcoder_has_m2_n2(i915, pipe_config->cpu_transcoder)) 2959 + if (intel_cpu_transcoder_has_m2_n2(display, pipe_config->cpu_transcoder)) 2959 2960 intel_zero_m_n(&pipe_config->dp_m2_n2); 2960 2961 return; 2961 2962 } ··· 3080 3081 if (!conn_state->base.crtc) 3081 3082 continue; 3082 3083 3083 - if (connector->mst_port == intel_dp) 3084 + if (connector->mst.dp == intel_dp) 3084 3085 intel_connector_queue_modeset_retry_work(connector); 3085 3086 } 3086 3087 } ··· 3130 3131 3131 3132 if ((intel_dp_is_edp(intel_dp) && fixed_mode) || 3132 3133 pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { 3133 - ret = intel_panel_fitting(pipe_config, conn_state); 3134 + ret = intel_pfit_compute_config(pipe_config, conn_state); 3134 3135 if (ret) 3135 3136 return ret; 3136 3137 } ··· 3302 3303 bool enable) 3303 3304 { 3304 3305 struct intel_display *display = to_intel_display(connector); 3305 - struct drm_dp_aux *aux = connector->port ? 3306 - connector->port->passthrough_aux : NULL; 3306 + struct drm_dp_aux *aux = connector->mst.port ? 3307 + connector->mst.port->passthrough_aux : NULL; 3307 3308 3308 3309 if (!aux) 3309 3310 return; ··· 3330 3331 * On SST the decompression AUX device won't be shared, each connector 3331 3332 * uses for this its own AUX targeting the sink device. 3332 3333 */ 3333 - if (!connector->mst_port) 3334 + if (!connector->mst.dp) 3334 3335 return connector->dp.dsc_decompression_enabled ? 1 : 0; 3335 3336 3336 3337 for_each_oldnew_connector_in_state(&state->base, _connector_iter, ··· 3338 3339 const struct intel_connector * 3339 3340 connector_iter = to_intel_connector(_connector_iter); 3340 3341 3341 - if (connector_iter->mst_port != connector->mst_port) 3342 + if (connector_iter->mst.dp != connector->mst.dp) 3342 3343 continue; 3343 3344 3344 3345 if (!connector_iter->dp.dsc_decompression_enabled) ··· 4396 4397 if (intel_dp->is_mst) 4397 4398 intel_dp_mst_prepare_probe(intel_dp); 4398 4399 4399 - drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); 4400 + drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst.mgr, intel_dp->is_mst); 4400 4401 4401 4402 /* Avoid stale info on the next detect cycle. */ 4402 4403 intel_dp->mst_detect = DRM_DP_SST; ··· 4412 4413 4413 4414 drm_dbg_kms(display->drm, 4414 4415 "MST device may have disappeared %d vs %d\n", 4415 - intel_dp->is_mst, intel_dp->mst_mgr.mst_state); 4416 + intel_dp->is_mst, intel_dp->mst.mgr.mst_state); 4416 4417 intel_dp->is_mst = false; 4417 - drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); 4418 + drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst.mgr, intel_dp->is_mst); 4418 4419 } 4419 4420 4420 4421 static bool ··· 4920 4921 { 4921 4922 bool handled = false; 4922 4923 4923 - drm_dp_mst_hpd_irq_handle_event(&intel_dp->mst_mgr, esi, ack, &handled); 4924 + drm_dp_mst_hpd_irq_handle_event(&intel_dp->mst.mgr, esi, ack, &handled); 4924 4925 4925 4926 if (esi[1] & DP_CP_IRQ) { 4926 4927 intel_hdcp_handle_cp_irq(intel_dp->attached_connector); ··· 4969 4970 bool link_ok = true; 4970 4971 bool reprobe_needed = false; 4971 4972 4972 - drm_WARN_ON_ONCE(display->drm, intel_dp->active_mst_links < 0); 4973 + drm_WARN_ON_ONCE(display->drm, intel_dp->mst.active_links < 0); 4973 4974 4974 4975 for (;;) { 4975 4976 u8 esi[4] = {}; ··· 4985 4986 4986 4987 drm_dbg_kms(display->drm, "DPRX ESI: %4ph\n", esi); 4987 4988 4988 - if (intel_dp->active_mst_links > 0 && link_ok && 4989 + if (intel_dp->mst.active_links > 0 && link_ok && 4989 4990 esi[3] & LINK_STATUS_CHANGED) { 4990 4991 if (!intel_dp_mst_link_status(intel_dp)) 4991 4992 link_ok = false; ··· 5008 5009 drm_dbg_kms(display->drm, "Failed to ack ESI\n"); 5009 5010 5010 5011 if (ack[1] & (DP_DOWN_REP_MSG_RDY | DP_UP_REQ_MSG_RDY)) 5011 - drm_dp_mst_hpd_irq_send_new_request(&intel_dp->mst_mgr); 5012 + drm_dp_mst_hpd_irq_send_new_request(&intel_dp->mst.mgr); 5012 5013 } 5013 5014 5014 5015 if (!link_ok || intel_dp->link.force_retrain) ··· 5107 5108 5108 5109 /* MST */ 5109 5110 for_each_pipe(display, pipe) { 5110 - encoder = &intel_dp->mst_encoders[pipe]->base; 5111 + encoder = &intel_dp->mst.stream_encoders[pipe]->base; 5111 5112 if (conn_state->best_encoder == &encoder->base) 5112 5113 return true; 5113 5114 } ··· 5193 5194 struct drm_modeset_acquire_ctx *ctx) 5194 5195 { 5195 5196 struct intel_display *display = to_intel_display(encoder); 5196 - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 5197 5197 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 5198 5198 u8 pipe_mask; 5199 5199 int ret; ··· 5223 5225 encoder->base.base.id, encoder->base.name, 5224 5226 str_yes_no(intel_dp->link.force_retrain)); 5225 5227 5226 - ret = intel_modeset_commit_pipes(dev_priv, pipe_mask, ctx); 5228 + ret = intel_modeset_commit_pipes(display, pipe_mask, ctx); 5227 5229 if (ret == -EDEADLK) 5228 5230 return ret; 5229 5231 ··· 6065 6067 return ret; 6066 6068 6067 6069 if (intel_dp_mst_source_support(intel_dp)) { 6068 - ret = drm_dp_mst_root_conn_atomic_check(conn_state, &intel_dp->mst_mgr); 6070 + ret = drm_dp_mst_root_conn_atomic_check(conn_state, &intel_dp->mst.mgr); 6069 6071 if (ret) 6070 6072 return ret; 6071 6073 } ··· 6603 6605 continue; 6604 6606 6605 6607 if (intel_dp->is_mst) 6606 - drm_dp_mst_topology_mgr_suspend(&intel_dp->mst_mgr); 6608 + drm_dp_mst_topology_mgr_suspend(&intel_dp->mst.mgr); 6607 6609 } 6608 6610 } 6609 6611 ··· 6626 6628 if (!intel_dp_mst_source_support(intel_dp)) 6627 6629 continue; 6628 6630 6629 - ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst_mgr, 6630 - true); 6631 + ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst.mgr, true); 6631 6632 if (ret) { 6632 6633 intel_dp->is_mst = false; 6633 - drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, 6634 - false); 6634 + drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst.mgr, false); 6635 6635 } 6636 6636 } 6637 6637 }
+2
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
··· 34 34 * for some reason. 35 35 */ 36 36 37 + #include <drm/drm_print.h> 38 + 37 39 #include "i915_utils.h" 38 40 #include "intel_backlight.h" 39 41 #include "intel_display_core.h"
+4 -4
drivers/gpu/drm/i915/display/intel_dp_hdcp.c
··· 705 705 706 706 *hdcp_capable = false; 707 707 *hdcp2_capable = false; 708 - if (!connector->mst_port) 708 + if (!connector->mst.dp) 709 709 return -EINVAL; 710 710 711 - aux = &connector->port->aux; 711 + aux = &connector->mst.port->aux; 712 712 ret = _intel_dp_hdcp2_get_capability(aux, hdcp2_capable); 713 713 if (ret) 714 714 drm_dbg_kms(display->drm, ··· 799 799 { 800 800 struct intel_display *display = to_intel_display(connector); 801 801 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 802 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 802 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 803 803 struct intel_hdcp *hdcp = &connector->hdcp; 804 804 enum transcoder cpu_transcoder = hdcp->stream_transcoder; 805 805 enum pipe pipe = (enum pipe)cpu_transcoder; ··· 883 883 if (!is_hdcp_supported(display, port)) 884 884 return 0; 885 885 886 - if (intel_connector->mst_port) 886 + if (intel_connector->mst.dp) 887 887 return intel_hdcp_init(intel_connector, dig_port, 888 888 &intel_dp_mst_hdcp_shim); 889 889 else if (!intel_dp_is_edp(intel_dp))
+80 -78
drivers/gpu/drm/i915/display/intel_dp_mst.c
··· 49 49 #include "intel_hdcp.h" 50 50 #include "intel_hotplug.h" 51 51 #include "intel_link_bw.h" 52 + #include "intel_pfit.h" 52 53 #include "intel_psr.h" 53 54 #include "intel_vdsc.h" 54 55 #include "skl_scaler.h" ··· 253 252 fxp_q4_to_frac(bpp_step_x16))); 254 253 255 254 if (is_mst) { 256 - mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst_mgr); 255 + mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst.mgr); 257 256 if (IS_ERR(mst_state)) 258 257 return PTR_ERR(mst_state); 259 258 ··· 355 354 drm_WARN_ON(display->drm, remote_tu < crtc_state->dp_m_n.tu); 356 355 crtc_state->dp_m_n.tu = remote_tu; 357 356 358 - slots = drm_dp_atomic_find_time_slots(state, &intel_dp->mst_mgr, 359 - connector->port, 357 + slots = drm_dp_atomic_find_time_slots(state, &intel_dp->mst.mgr, 358 + connector->mst.port, 360 359 dfixed_trunc(pbn)); 361 360 } else { 362 361 /* Same as above for remote_tu */ ··· 479 478 struct drm_connector_state *conn_state) 480 479 { 481 480 struct intel_display *display = to_intel_display(intel_dp); 482 - struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; 481 + struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst.mgr; 483 482 struct drm_dp_mst_topology_state *topology_state; 484 483 u8 link_coding_cap = intel_dp_is_uhbr(crtc_state) ? 485 484 DP_CAP_ANSI_128B132B : DP_CAP_ANSI_8B10B; ··· 509 508 { 510 509 const struct drm_display_mode *adjusted_mode = 511 510 &crtc_state->hw.adjusted_mode; 512 - bool is_uhbr_sink = connector->mst_port && 513 - drm_dp_128b132b_supported(connector->mst_port->dpcd); 511 + bool is_uhbr_sink = connector->mst.dp && 512 + drm_dp_128b132b_supported(connector->mst.dp->dpcd); 514 513 int hblank_limit = is_uhbr_sink ? 500 : 300; 515 514 516 515 if (!connector->dp.dsc_hblank_expansion_quirk) ··· 741 740 const struct intel_crtc_state *crtc_state; 742 741 struct intel_crtc *crtc; 743 742 744 - if (connector->mst_port != mst_port || !conn_state->base.crtc) 743 + if (connector->mst.dp != mst_port || !conn_state->base.crtc) 745 744 continue; 746 745 747 746 crtc = to_intel_crtc(conn_state->base.crtc); ··· 769 768 if (!conn_state->base.crtc) 770 769 continue; 771 770 772 - if (&connector->mst_port->mst_mgr != mst_mgr) 771 + if (&connector->mst.dp->mst.mgr != mst_mgr) 773 772 continue; 774 773 775 - if (connector->port != parent_port && 774 + if (connector->mst.port != parent_port && 776 775 !drm_dp_mst_port_downstream_of_parent(mst_mgr, 777 - connector->port, 776 + connector->mst.port, 778 777 parent_port)) 779 778 continue; 780 779 ··· 925 924 struct intel_crtc_state *crtc_state; 926 925 struct intel_crtc *crtc; 927 926 928 - if (connector_iter->mst_port != connector->mst_port || 927 + if (connector_iter->mst.dp != connector->mst.dp || 929 928 connector_iter == connector) 930 929 continue; 931 930 ··· 974 973 975 974 if (intel_connector_needs_modeset(state, &connector->base)) { 976 975 ret = intel_dp_tunnel_atomic_check_state(state, 977 - connector->mst_port, 976 + connector->mst.dp, 978 977 connector); 979 978 if (ret) 980 979 return ret; 981 980 } 982 981 983 982 return drm_dp_atomic_release_time_slots(&state->base, 984 - &connector->mst_port->mst_mgr, 985 - connector->port); 983 + &connector->mst.dp->mst.mgr, 984 + connector->mst.port); 986 985 } 987 986 988 987 static void mst_stream_disable(struct intel_atomic_state *state, ··· 998 997 enum transcoder trans = old_crtc_state->cpu_transcoder; 999 998 1000 999 drm_dbg_kms(display->drm, "active links %d\n", 1001 - intel_dp->active_mst_links); 1000 + intel_dp->mst.active_links); 1002 1001 1003 - if (intel_dp->active_mst_links == 1) 1002 + if (intel_dp->mst.active_links == 1) 1004 1003 intel_dp->link_trained = false; 1005 1004 1006 1005 intel_hdcp_disable(intel_mst->connector); ··· 1023 1022 struct intel_connector *connector = 1024 1023 to_intel_connector(old_conn_state->connector); 1025 1024 struct drm_dp_mst_topology_state *old_mst_state = 1026 - drm_atomic_get_old_mst_topology_state(&state->base, &intel_dp->mst_mgr); 1025 + drm_atomic_get_old_mst_topology_state(&state->base, &intel_dp->mst.mgr); 1027 1026 struct drm_dp_mst_topology_state *new_mst_state = 1028 - drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst_mgr); 1027 + drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst.mgr); 1029 1028 const struct drm_dp_mst_atomic_payload *old_payload = 1030 - drm_atomic_get_mst_payload_state(old_mst_state, connector->port); 1029 + drm_atomic_get_mst_payload_state(old_mst_state, connector->mst.port); 1031 1030 struct drm_dp_mst_atomic_payload *new_payload = 1032 - drm_atomic_get_mst_payload_state(new_mst_state, connector->port); 1031 + drm_atomic_get_mst_payload_state(new_mst_state, connector->mst.port); 1033 1032 struct intel_crtc *pipe_crtc; 1034 1033 bool last_mst_stream; 1035 1034 int i; 1036 1035 1037 - intel_dp->active_mst_links--; 1038 - last_mst_stream = intel_dp->active_mst_links == 0; 1036 + intel_dp->mst.active_links--; 1037 + last_mst_stream = intel_dp->mst.active_links == 0; 1039 1038 drm_WARN_ON(display->drm, DISPLAY_VER(display) >= 12 && last_mst_stream && 1040 1039 !intel_dp_mst_is_master_trans(old_crtc_state)); 1041 1040 ··· 1048 1047 1049 1048 intel_disable_transcoder(old_crtc_state); 1050 1049 1051 - drm_dp_remove_payload_part1(&intel_dp->mst_mgr, new_mst_state, new_payload); 1050 + drm_dp_remove_payload_part1(&intel_dp->mst.mgr, new_mst_state, new_payload); 1052 1051 1053 1052 intel_ddi_clear_act_sent(encoder, old_crtc_state); 1054 1053 ··· 1057 1056 TRANS_DDI_DP_VC_PAYLOAD_ALLOC, 0); 1058 1057 1059 1058 intel_ddi_wait_for_act_sent(encoder, old_crtc_state); 1060 - drm_dp_check_act_status(&intel_dp->mst_mgr); 1059 + drm_dp_check_act_status(&intel_dp->mst.mgr); 1061 1060 1062 - drm_dp_remove_payload_part2(&intel_dp->mst_mgr, new_mst_state, 1061 + drm_dp_remove_payload_part2(&intel_dp->mst.mgr, new_mst_state, 1063 1062 old_payload, new_payload); 1064 1063 1065 1064 intel_ddi_disable_transcoder_func(old_crtc_state); ··· 1080 1079 * Power down mst path before disabling the port, otherwise we end 1081 1080 * up getting interrupts from the sink upon detecting link loss. 1082 1081 */ 1083 - drm_dp_send_power_updown_phy(&intel_dp->mst_mgr, connector->port, 1082 + drm_dp_send_power_updown_phy(&intel_dp->mst.mgr, connector->mst.port, 1084 1083 false); 1085 1084 1086 1085 /* ··· 1105 1104 old_crtc_state, NULL); 1106 1105 1107 1106 drm_dbg_kms(display->drm, "active links %d\n", 1108 - intel_dp->active_mst_links); 1107 + intel_dp->mst.active_links); 1109 1108 } 1110 1109 1111 1110 static void mst_stream_post_pll_disable(struct intel_atomic_state *state, ··· 1116 1115 struct intel_encoder *primary_encoder = to_primary_encoder(encoder); 1117 1116 struct intel_dp *intel_dp = to_primary_dp(encoder); 1118 1117 1119 - if (intel_dp->active_mst_links == 0 && 1118 + if (intel_dp->mst.active_links == 0 && 1120 1119 primary_encoder->post_pll_disable) 1121 1120 primary_encoder->post_pll_disable(state, primary_encoder, old_crtc_state, old_conn_state); 1122 1121 } ··· 1129 1128 struct intel_encoder *primary_encoder = to_primary_encoder(encoder); 1130 1129 struct intel_dp *intel_dp = to_primary_dp(encoder); 1131 1130 1132 - if (intel_dp->active_mst_links == 0) 1131 + if (intel_dp->mst.active_links == 0) 1133 1132 primary_encoder->pre_pll_enable(state, primary_encoder, 1134 1133 pipe_config, NULL); 1135 1134 else ··· 1162 1161 crtc_state->port_clock, crtc_state->lane_count)) 1163 1162 return; 1164 1163 1165 - drm_dp_mst_topology_queue_probe(&intel_dp->mst_mgr); 1164 + drm_dp_mst_topology_queue_probe(&intel_dp->mst.mgr); 1166 1165 1167 1166 intel_mst_set_probed_link_params(intel_dp, 1168 1167 crtc_state->port_clock, crtc_state->lane_count); ··· 1180 1179 struct intel_connector *connector = 1181 1180 to_intel_connector(conn_state->connector); 1182 1181 struct drm_dp_mst_topology_state *mst_state = 1183 - drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst_mgr); 1182 + drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst.mgr); 1184 1183 int ret; 1185 1184 bool first_mst_stream; 1186 1185 ··· 1189 1188 */ 1190 1189 connector->encoder = encoder; 1191 1190 intel_mst->connector = connector; 1192 - first_mst_stream = intel_dp->active_mst_links == 0; 1191 + first_mst_stream = intel_dp->mst.active_links == 0; 1193 1192 drm_WARN_ON(display->drm, DISPLAY_VER(display) >= 12 && first_mst_stream && 1194 1193 !intel_dp_mst_is_master_trans(pipe_config)); 1195 1194 1196 1195 drm_dbg_kms(display->drm, "active links %d\n", 1197 - intel_dp->active_mst_links); 1196 + intel_dp->mst.active_links); 1198 1197 1199 1198 if (first_mst_stream) 1200 1199 intel_dp_set_power(intel_dp, DP_SET_POWER_D0); 1201 1200 1202 - drm_dp_send_power_updown_phy(&intel_dp->mst_mgr, connector->port, true); 1201 + drm_dp_send_power_updown_phy(&intel_dp->mst.mgr, connector->mst.port, true); 1203 1202 1204 1203 intel_dp_sink_enable_decompression(state, connector, pipe_config); 1205 1204 ··· 1210 1209 intel_mst_reprobe_topology(intel_dp, pipe_config); 1211 1210 } 1212 1211 1213 - intel_dp->active_mst_links++; 1212 + intel_dp->mst.active_links++; 1214 1213 1215 - ret = drm_dp_add_payload_part1(&intel_dp->mst_mgr, mst_state, 1216 - drm_atomic_get_mst_payload_state(mst_state, connector->port)); 1214 + ret = drm_dp_add_payload_part1(&intel_dp->mst.mgr, mst_state, 1215 + drm_atomic_get_mst_payload_state(mst_state, connector->mst.port)); 1217 1216 if (ret < 0) 1218 1217 intel_dp_queue_modeset_retry_for_link(state, primary_encoder, pipe_config); 1219 1218 ··· 1277 1276 struct intel_dp *intel_dp = to_primary_dp(encoder); 1278 1277 struct intel_connector *connector = to_intel_connector(conn_state->connector); 1279 1278 struct drm_dp_mst_topology_state *mst_state = 1280 - drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst_mgr); 1279 + drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst.mgr); 1281 1280 enum transcoder trans = pipe_config->cpu_transcoder; 1282 - bool first_mst_stream = intel_dp->active_mst_links == 1; 1281 + bool first_mst_stream = intel_dp->mst.active_links == 1; 1283 1282 struct intel_crtc *pipe_crtc; 1284 1283 int ret, i, min_hblank; 1285 1284 ··· 1329 1328 TRANS_DDI_DP_VC_PAYLOAD_ALLOC); 1330 1329 1331 1330 drm_dbg_kms(display->drm, "active links %d\n", 1332 - intel_dp->active_mst_links); 1331 + intel_dp->mst.active_links); 1333 1332 1334 1333 intel_ddi_wait_for_act_sent(encoder, pipe_config); 1335 - drm_dp_check_act_status(&intel_dp->mst_mgr); 1334 + drm_dp_check_act_status(&intel_dp->mst.mgr); 1336 1335 1337 1336 if (first_mst_stream) 1338 1337 intel_ddi_wait_for_fec_status(encoder, pipe_config, true); 1339 1338 1340 - ret = drm_dp_add_payload_part2(&intel_dp->mst_mgr, 1339 + ret = drm_dp_add_payload_part2(&intel_dp->mst.mgr, 1341 1340 drm_atomic_get_mst_payload_state(mst_state, 1342 - connector->port)); 1341 + connector->mst.port)); 1343 1342 if (ret < 0) 1344 1343 intel_dp_queue_modeset_retry_for_link(state, primary_encoder, pipe_config); 1345 1344 ··· 1392 1391 { 1393 1392 struct intel_connector *connector = to_intel_connector(_connector); 1394 1393 struct intel_display *display = to_intel_display(connector); 1395 - struct intel_dp *intel_dp = connector->mst_port; 1394 + struct intel_dp *intel_dp = connector->mst.dp; 1396 1395 const struct drm_edid *drm_edid; 1397 1396 int ret; 1398 1397 ··· 1402 1401 if (!intel_display_driver_check_access(display)) 1403 1402 return drm_edid_connector_add_modes(&connector->base); 1404 1403 1405 - drm_edid = drm_dp_mst_edid_read(&connector->base, &intel_dp->mst_mgr, connector->port); 1404 + drm_edid = drm_dp_mst_edid_read(&connector->base, &intel_dp->mst.mgr, connector->mst.port); 1406 1405 1407 1406 ret = intel_connector_update_modes(&connector->base, drm_edid); 1408 1407 ··· 1417 1416 struct intel_connector *connector = to_intel_connector(_connector); 1418 1417 int ret; 1419 1418 1420 - ret = drm_dp_mst_connector_late_register(&connector->base, connector->port); 1419 + ret = drm_dp_mst_connector_late_register(&connector->base, connector->mst.port); 1421 1420 if (ret < 0) 1422 1421 return ret; 1423 1422 1424 1423 ret = intel_connector_register(&connector->base); 1425 1424 if (ret < 0) 1426 - drm_dp_mst_connector_early_unregister(&connector->base, connector->port); 1425 + drm_dp_mst_connector_early_unregister(&connector->base, connector->mst.port); 1427 1426 1428 1427 return ret; 1429 1428 } ··· 1434 1433 struct intel_connector *connector = to_intel_connector(_connector); 1435 1434 1436 1435 intel_connector_unregister(&connector->base); 1437 - drm_dp_mst_connector_early_unregister(&connector->base, connector->port); 1436 + drm_dp_mst_connector_early_unregister(&connector->base, connector->mst.port); 1438 1437 } 1439 1438 1440 1439 static const struct drm_connector_funcs mst_connector_funcs = { ··· 1463 1462 { 1464 1463 struct intel_connector *connector = to_intel_connector(_connector); 1465 1464 struct intel_display *display = to_intel_display(connector); 1466 - struct intel_dp *intel_dp = connector->mst_port; 1467 - struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr; 1468 - struct drm_dp_mst_port *port = connector->port; 1465 + struct intel_dp *intel_dp = connector->mst.dp; 1466 + struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst.mgr; 1467 + struct drm_dp_mst_port *port = connector->mst.port; 1469 1468 const int min_bpp = 18; 1470 1469 int max_dotclk = display->cdclk.max_dotclk_freq; 1471 1470 int max_rate, mode_rate, max_lanes, max_link_clock; ··· 1576 1575 struct intel_connector *connector = to_intel_connector(_connector); 1577 1576 struct drm_connector_state *connector_state = 1578 1577 drm_atomic_get_new_connector_state(state, &connector->base); 1579 - struct intel_dp *intel_dp = connector->mst_port; 1578 + struct intel_dp *intel_dp = connector->mst.dp; 1580 1579 struct intel_crtc *crtc = to_intel_crtc(connector_state->crtc); 1581 1580 1582 - return &intel_dp->mst_encoders[crtc->pipe]->base.base; 1581 + return &intel_dp->mst.stream_encoders[crtc->pipe]->base.base; 1583 1582 } 1584 1583 1585 1584 static int ··· 1588 1587 { 1589 1588 struct intel_connector *connector = to_intel_connector(_connector); 1590 1589 struct intel_display *display = to_intel_display(connector); 1591 - struct intel_dp *intel_dp = connector->mst_port; 1590 + struct intel_dp *intel_dp = connector->mst.dp; 1592 1591 1593 1592 if (!intel_display_device_enabled(display)) 1594 1593 return connector_status_disconnected; ··· 1601 1600 1602 1601 intel_dp_flush_connector_commits(connector); 1603 1602 1604 - return drm_dp_mst_detect_port(&connector->base, ctx, &intel_dp->mst_mgr, 1605 - connector->port); 1603 + return drm_dp_mst_detect_port(&connector->base, ctx, &intel_dp->mst.mgr, 1604 + connector->mst.port); 1606 1605 } 1607 1606 1608 1607 static const struct drm_connector_helper_funcs mst_connector_helper_funcs = { ··· 1693 1692 * A logical port's OUI (at least for affected sinks) is all 0, so 1694 1693 * instead of that the parent port's OUI is used for identification. 1695 1694 */ 1696 - if (drm_dp_mst_port_is_logical(connector->port)) { 1697 - aux = drm_dp_mst_aux_for_parent(connector->port); 1695 + if (drm_dp_mst_port_is_logical(connector->mst.port)) { 1696 + aux = drm_dp_mst_aux_for_parent(connector->mst.port); 1698 1697 if (!aux) 1699 - aux = &connector->mst_port->aux; 1698 + aux = &connector->mst.dp->aux; 1700 1699 } 1701 1700 1702 1701 if (drm_dp_read_dpcd_caps(aux, dpcd) < 0) ··· 1731 1730 struct drm_dp_mst_port *port, 1732 1731 const char *pathprop) 1733 1732 { 1734 - struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); 1733 + struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst.mgr); 1735 1734 struct intel_display *display = to_intel_display(intel_dp); 1736 1735 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 1737 1736 struct intel_connector *connector; ··· 1744 1743 1745 1744 connector->get_hw_state = mst_connector_get_hw_state; 1746 1745 connector->sync_state = intel_dp_connector_sync_state; 1747 - connector->mst_port = intel_dp; 1748 - connector->port = port; 1746 + connector->mst.dp = intel_dp; 1747 + connector->mst.port = port; 1749 1748 drm_dp_mst_get_port_malloc(port); 1750 1749 1751 1750 ret = drm_connector_dynamic_init(display->drm, &connector->base, &mst_connector_funcs, ··· 1762 1761 1763 1762 for_each_pipe(display, pipe) { 1764 1763 struct drm_encoder *enc = 1765 - &intel_dp->mst_encoders[pipe]->base.base; 1764 + &intel_dp->mst.stream_encoders[pipe]->base.base; 1766 1765 1767 1766 ret = drm_connector_attach_encoder(&connector->base, enc); 1768 1767 if (ret) ··· 1792 1791 static void 1793 1792 mst_topology_poll_hpd_irq(struct drm_dp_mst_topology_mgr *mgr) 1794 1793 { 1795 - struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); 1794 + struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst.mgr); 1796 1795 1797 1796 intel_hpd_trigger_irq(dp_to_dig_port(intel_dp)); 1798 1797 } ··· 1865 1864 enum pipe pipe; 1866 1865 1867 1866 for_each_pipe(display, pipe) 1868 - intel_dp->mst_encoders[pipe] = mst_stream_encoder_create(dig_port, pipe); 1867 + intel_dp->mst.stream_encoders[pipe] = mst_stream_encoder_create(dig_port, pipe); 1869 1868 return true; 1870 1869 } 1871 1870 1872 1871 int 1873 1872 intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port) 1874 1873 { 1875 - return dig_port->dp.active_mst_links; 1874 + return dig_port->dp.mst.active_links; 1876 1875 } 1877 1876 1878 1877 int ··· 1892 1891 if (DISPLAY_VER(display) < 11 && port == PORT_E) 1893 1892 return 0; 1894 1893 1895 - intel_dp->mst_mgr.cbs = &mst_topology_cbs; 1894 + intel_dp->mst.mgr.cbs = &mst_topology_cbs; 1896 1895 1897 1896 /* create encoders */ 1898 1897 mst_stream_encoders_create(dig_port); 1899 - ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, display->drm, 1900 - &intel_dp->aux, 16, 3, conn_base_id); 1898 + ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst.mgr, display->drm, 1899 + &intel_dp->aux, 16, 1900 + INTEL_NUM_PIPES(display), conn_base_id); 1901 1901 if (ret) { 1902 - intel_dp->mst_mgr.cbs = NULL; 1902 + intel_dp->mst.mgr.cbs = NULL; 1903 1903 return ret; 1904 1904 } 1905 1905 ··· 1909 1907 1910 1908 bool intel_dp_mst_source_support(struct intel_dp *intel_dp) 1911 1909 { 1912 - return intel_dp->mst_mgr.cbs; 1910 + return intel_dp->mst.mgr.cbs; 1913 1911 } 1914 1912 1915 1913 void ··· 1920 1918 if (!intel_dp_mst_source_support(intel_dp)) 1921 1919 return; 1922 1920 1923 - drm_dp_mst_topology_mgr_destroy(&intel_dp->mst_mgr); 1921 + drm_dp_mst_topology_mgr_destroy(&intel_dp->mst.mgr); 1924 1922 /* encoders will get killed by normal cleanup */ 1925 1923 1926 - intel_dp->mst_mgr.cbs = NULL; 1924 + intel_dp->mst.mgr.cbs = NULL; 1927 1925 } 1928 1926 1929 1927 bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state) ··· 1954 1952 { 1955 1953 struct drm_dp_mst_topology_state *mst_state; 1956 1954 1957 - if (!connector->mst_port) 1955 + if (!connector->mst.dp) 1958 1956 return 0; 1959 1957 1960 1958 mst_state = drm_atomic_get_mst_topology_state(&state->base, 1961 - &connector->mst_port->mst_mgr); 1959 + &connector->mst.dp->mst.mgr); 1962 1960 if (IS_ERR(mst_state)) 1963 1961 return PTR_ERR(mst_state); 1964 1962 ··· 2056 2054 const struct intel_crtc_state *old_crtc_state; 2057 2055 struct intel_crtc *crtc_iter; 2058 2056 2059 - if (connector->mst_port != crtc_connector->mst_port || 2057 + if (connector->mst.dp != crtc_connector->mst.dp || 2060 2058 !conn_state->crtc) 2061 2059 continue; 2062 2060 ··· 2079 2077 * case. 2080 2078 */ 2081 2079 if (connector->dp.dsc_decompression_aux == 2082 - &connector->mst_port->aux) 2080 + &connector->mst.dp->aux) 2083 2081 return true; 2084 2082 } 2085 2083 ··· 2140 2138 if (!intel_dp->is_mst) 2141 2139 return true; 2142 2140 2143 - ret = drm_dp_dpcd_readb(intel_dp->mst_mgr.aux, DP_MSTM_CTRL, &val); 2141 + ret = drm_dp_dpcd_readb(intel_dp->mst.mgr.aux, DP_MSTM_CTRL, &val); 2144 2142 2145 2143 /* Adjust the expected register value for SST + SideBand. */ 2146 2144 if (ret < 0 || val != (DP_MST_EN | DP_UP_REQ_EN | DP_UPSTREAM_IS_SRC)) {
+2
drivers/gpu/drm/i915/display/intel_dp_test.c
··· 6 6 #include <drm/display/drm_dp.h> 7 7 #include <drm/display/drm_dp_helper.h> 8 8 #include <drm/drm_edid.h> 9 + #include <drm/drm_file.h> 10 + #include <drm/drm_print.h> 9 11 #include <drm/drm_probe_helper.h> 10 12 11 13 #include "i915_reg.h"
+1
drivers/gpu/drm/i915/display/intel_dp_tunnel.c
··· 4 4 */ 5 5 6 6 #include <drm/display/drm_dp_tunnel.h> 7 + #include <drm/drm_print.h> 7 8 8 9 #include "intel_atomic.h" 9 10 #include "intel_display_core.h"
+15 -14
drivers/gpu/drm/i915/display/intel_dpt.c
··· 125 125 unsigned int alignment) 126 126 { 127 127 struct drm_i915_private *i915 = vm->i915; 128 + struct intel_display *display = &i915->display; 128 129 struct i915_dpt *dpt = i915_vm_to_dpt(vm); 129 130 intel_wakeref_t wakeref; 130 131 struct i915_vma *vma; ··· 138 137 pin_flags |= PIN_MAPPABLE; 139 138 140 139 wakeref = intel_runtime_pm_get(&i915->runtime_pm); 141 - atomic_inc(&i915->gpu_error.pending_fb_pin); 140 + atomic_inc(&display->restore.pending_fb_pin); 142 141 143 142 for_i915_gem_ww(&ww, err, true) { 144 143 err = i915_gem_object_lock(dpt->obj, &ww); ··· 168 167 169 168 dpt->obj->mm.dirty = true; 170 169 171 - atomic_dec(&i915->gpu_error.pending_fb_pin); 170 + atomic_dec(&display->restore.pending_fb_pin); 172 171 intel_runtime_pm_put(&i915->runtime_pm, wakeref); 173 172 174 173 return err ? ERR_PTR(err) : vma; ··· 184 183 185 184 /** 186 185 * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume 187 - * @i915: device instance 186 + * @display: display device instance 188 187 * 189 188 * Restore the memory mapping during system resume for all framebuffers which 190 189 * are mapped to HW via a GGTT->DPT page table. The content of these page ··· 194 193 * This function must be called after the mappings in GGTT have been restored calling 195 194 * i915_ggtt_resume(). 196 195 */ 197 - void intel_dpt_resume(struct drm_i915_private *i915) 196 + void intel_dpt_resume(struct intel_display *display) 198 197 { 199 198 struct drm_framebuffer *drm_fb; 200 199 201 - if (!HAS_DISPLAY(i915)) 200 + if (!HAS_DISPLAY(display)) 202 201 return; 203 202 204 - mutex_lock(&i915->drm.mode_config.fb_lock); 205 - drm_for_each_fb(drm_fb, &i915->drm) { 203 + mutex_lock(&display->drm->mode_config.fb_lock); 204 + drm_for_each_fb(drm_fb, display->drm) { 206 205 struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 207 206 208 207 if (fb->dpt_vm) 209 208 i915_ggtt_resume_vm(fb->dpt_vm, true); 210 209 } 211 - mutex_unlock(&i915->drm.mode_config.fb_lock); 210 + mutex_unlock(&display->drm->mode_config.fb_lock); 212 211 } 213 212 214 213 /** 215 214 * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend 216 - * @i915: device instance 215 + * @display: display device instance 217 216 * 218 217 * Suspend the memory mapping during system suspend for all framebuffers which 219 218 * are mapped to HW via a GGTT->DPT page table. ··· 221 220 * This function must be called before the mappings in GGTT are suspended calling 222 221 * i915_ggtt_suspend(). 223 222 */ 224 - void intel_dpt_suspend(struct drm_i915_private *i915) 223 + void intel_dpt_suspend(struct intel_display *display) 225 224 { 226 225 struct drm_framebuffer *drm_fb; 227 226 228 - if (!HAS_DISPLAY(i915)) 227 + if (!HAS_DISPLAY(display)) 229 228 return; 230 229 231 - mutex_lock(&i915->drm.mode_config.fb_lock); 230 + mutex_lock(&display->drm->mode_config.fb_lock); 232 231 233 - drm_for_each_fb(drm_fb, &i915->drm) { 232 + drm_for_each_fb(drm_fb, display->drm) { 234 233 struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 235 234 236 235 if (fb->dpt_vm) 237 236 i915_ggtt_suspend_vm(fb->dpt_vm, true); 238 237 } 239 238 240 - mutex_unlock(&i915->drm.mode_config.fb_lock); 239 + mutex_unlock(&display->drm->mode_config.fb_lock); 241 240 } 242 241 243 242 struct i915_address_space *
+3 -4
drivers/gpu/drm/i915/display/intel_dpt.h
··· 8 8 9 9 #include <linux/types.h> 10 10 11 - struct drm_i915_private; 12 - 13 11 struct i915_address_space; 14 12 struct i915_vma; 13 + struct intel_display; 15 14 struct intel_framebuffer; 16 15 17 16 void intel_dpt_destroy(struct i915_address_space *vm); 18 17 struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm, 19 18 unsigned int alignment); 20 19 void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm); 21 - void intel_dpt_suspend(struct drm_i915_private *i915); 22 - void intel_dpt_resume(struct drm_i915_private *i915); 20 + void intel_dpt_suspend(struct intel_display *display); 21 + void intel_dpt_resume(struct intel_display *display); 23 22 struct i915_address_space * 24 23 intel_dpt_create(struct intel_framebuffer *fb); 25 24 u64 intel_dpt_offset(struct i915_vma *dpt_vma);
+21 -24
drivers/gpu/drm/i915/display/intel_drrs.c
··· 65 65 return str[drrs_type]; 66 66 } 67 67 68 - bool intel_cpu_transcoder_has_drrs(struct drm_i915_private *i915, 68 + bool intel_cpu_transcoder_has_drrs(struct intel_display *display, 69 69 enum transcoder cpu_transcoder) 70 70 { 71 - struct intel_display *display = &i915->display; 72 - 73 71 if (HAS_DOUBLE_BUFFERED_M_N(display)) 74 72 return true; 75 73 76 - return intel_cpu_transcoder_has_m2_n2(i915, cpu_transcoder); 74 + return intel_cpu_transcoder_has_m2_n2(display, cpu_transcoder); 77 75 } 78 76 79 77 static void 80 78 intel_drrs_set_refresh_rate_pipeconf(struct intel_crtc *crtc, 81 79 enum drrs_refresh_rate refresh_rate) 82 80 { 83 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 81 + struct intel_display *display = to_intel_display(crtc); 84 82 enum transcoder cpu_transcoder = crtc->drrs.cpu_transcoder; 85 83 u32 bit; 86 84 87 - if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) 85 + if (display->platform.valleyview || display->platform.cherryview) 88 86 bit = TRANSCONF_REFRESH_RATE_ALT_VLV; 89 87 else 90 88 bit = TRANSCONF_REFRESH_RATE_ALT_ILK; 91 89 92 - intel_de_rmw(dev_priv, TRANSCONF(dev_priv, cpu_transcoder), 90 + intel_de_rmw(display, TRANSCONF(display, cpu_transcoder), 93 91 bit, refresh_rate == DRRS_REFRESH_RATE_LOW ? bit : 0); 94 92 } 95 93 ··· 108 110 static void intel_drrs_set_state(struct intel_crtc *crtc, 109 111 enum drrs_refresh_rate refresh_rate) 110 112 { 111 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 113 + struct intel_display *display = to_intel_display(crtc); 112 114 113 115 if (refresh_rate == crtc->drrs.refresh_rate) 114 116 return; 115 117 116 - if (intel_cpu_transcoder_has_m2_n2(dev_priv, crtc->drrs.cpu_transcoder)) 118 + if (intel_cpu_transcoder_has_m2_n2(display, crtc->drrs.cpu_transcoder)) 117 119 intel_drrs_set_refresh_rate_pipeconf(crtc, refresh_rate); 118 120 else 119 121 intel_drrs_set_refresh_rate_m_n(crtc, refresh_rate); ··· 130 132 131 133 static unsigned int intel_drrs_frontbuffer_bits(const struct intel_crtc_state *crtc_state) 132 134 { 135 + struct intel_display *display = to_intel_display(crtc_state); 133 136 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 134 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 135 137 unsigned int frontbuffer_bits; 136 138 137 139 frontbuffer_bits = INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe); 138 140 139 - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, 141 + for_each_intel_crtc_in_pipe_mask(display->drm, crtc, 140 142 crtc_state->joiner_pipes) 141 143 frontbuffer_bits |= INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe); 142 144 ··· 220 222 mutex_unlock(&crtc->drrs.mutex); 221 223 } 222 224 223 - static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv, 225 + static void intel_drrs_frontbuffer_update(struct intel_display *display, 224 226 unsigned int all_frontbuffer_bits, 225 227 bool invalidate) 226 228 { 227 229 struct intel_crtc *crtc; 228 230 229 - for_each_intel_crtc(&dev_priv->drm, crtc) { 231 + for_each_intel_crtc(display->drm, crtc) { 230 232 unsigned int frontbuffer_bits; 231 233 232 234 mutex_lock(&crtc->drrs.mutex); ··· 260 262 261 263 /** 262 264 * intel_drrs_invalidate - Disable Idleness DRRS 263 - * @dev_priv: i915 device 265 + * @display: display device 264 266 * @frontbuffer_bits: frontbuffer plane tracking bits 265 267 * 266 268 * This function gets called everytime rendering on the given planes start. ··· 268 270 * 269 271 * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits. 270 272 */ 271 - void intel_drrs_invalidate(struct drm_i915_private *dev_priv, 273 + void intel_drrs_invalidate(struct intel_display *display, 272 274 unsigned int frontbuffer_bits) 273 275 { 274 - intel_drrs_frontbuffer_update(dev_priv, frontbuffer_bits, true); 276 + intel_drrs_frontbuffer_update(display, frontbuffer_bits, true); 275 277 } 276 278 277 279 /** 278 280 * intel_drrs_flush - Restart Idleness DRRS 279 - * @dev_priv: i915 device 281 + * @display: display device 280 282 * @frontbuffer_bits: frontbuffer plane tracking bits 281 283 * 282 284 * This function gets called every time rendering on the given planes has ··· 286 288 * 287 289 * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits. 288 290 */ 289 - void intel_drrs_flush(struct drm_i915_private *dev_priv, 291 + void intel_drrs_flush(struct intel_display *display, 290 292 unsigned int frontbuffer_bits) 291 293 { 292 - intel_drrs_frontbuffer_update(dev_priv, frontbuffer_bits, false); 294 + intel_drrs_frontbuffer_update(display, frontbuffer_bits, false); 293 295 } 294 296 295 297 /** ··· 310 312 static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused) 311 313 { 312 314 struct intel_crtc *crtc = m->private; 313 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 315 + struct intel_display *display = to_intel_display(crtc); 314 316 const struct intel_crtc_state *crtc_state; 315 317 int ret; 316 318 ··· 323 325 mutex_lock(&crtc->drrs.mutex); 324 326 325 327 seq_printf(m, "DRRS capable: %s\n", 326 - str_yes_no(intel_cpu_transcoder_has_drrs(i915, 328 + str_yes_no(intel_cpu_transcoder_has_drrs(display, 327 329 crtc_state->cpu_transcoder))); 328 330 329 331 seq_printf(m, "DRRS enabled: %s\n", ··· 351 353 static int intel_drrs_debugfs_ctl_set(void *data, u64 val) 352 354 { 353 355 struct intel_crtc *crtc = data; 354 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 356 + struct intel_display *display = to_intel_display(crtc); 355 357 struct intel_crtc_state *crtc_state; 356 358 struct drm_crtc_commit *commit; 357 359 int ret; ··· 373 375 goto out; 374 376 } 375 377 376 - drm_dbg(&i915->drm, 377 - "Manually %sactivating DRRS\n", val ? "" : "de"); 378 + drm_dbg_kms(display->drm, "Manually %sactivating DRRS\n", val ? "" : "de"); 378 379 379 380 if (val) 380 381 intel_drrs_activate(crtc_state);
+5 -5
drivers/gpu/drm/i915/display/intel_drrs.h
··· 10 10 11 11 enum drrs_type; 12 12 enum transcoder; 13 - struct drm_i915_private; 14 13 struct intel_atomic_state; 14 + struct intel_connector; 15 15 struct intel_crtc; 16 16 struct intel_crtc_state; 17 - struct intel_connector; 17 + struct intel_display; 18 18 19 - bool intel_cpu_transcoder_has_drrs(struct drm_i915_private *i915, 19 + bool intel_cpu_transcoder_has_drrs(struct intel_display *display, 20 20 enum transcoder cpu_transcoder); 21 21 const char *intel_drrs_type_str(enum drrs_type drrs_type); 22 22 bool intel_drrs_is_active(struct intel_crtc *crtc); 23 23 void intel_drrs_activate(const struct intel_crtc_state *crtc_state); 24 24 void intel_drrs_deactivate(const struct intel_crtc_state *crtc_state); 25 - void intel_drrs_invalidate(struct drm_i915_private *dev_priv, 25 + void intel_drrs_invalidate(struct intel_display *display, 26 26 unsigned int frontbuffer_bits); 27 - void intel_drrs_flush(struct drm_i915_private *dev_priv, 27 + void intel_drrs_flush(struct intel_display *display, 28 28 unsigned int frontbuffer_bits); 29 29 void intel_drrs_crtc_init(struct intel_crtc *crtc); 30 30 void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc);
+6 -4
drivers/gpu/drm/i915/display/intel_fb_pin.c
··· 25 25 struct i915_address_space *vm) 26 26 { 27 27 struct drm_device *dev = fb->dev; 28 + struct intel_display *display = to_intel_display(dev); 28 29 struct drm_i915_private *dev_priv = to_i915(dev); 29 30 struct drm_gem_object *_obj = intel_fb_bo(fb); 30 31 struct drm_i915_gem_object *obj = to_intel_bo(_obj); ··· 43 42 if (WARN_ON(!i915_gem_object_is_framebuffer(obj))) 44 43 return ERR_PTR(-EINVAL); 45 44 46 - atomic_inc(&dev_priv->gpu_error.pending_fb_pin); 45 + atomic_inc(&display->restore.pending_fb_pin); 47 46 48 47 for_i915_gem_ww(&ww, ret, true) { 49 48 ret = i915_gem_object_lock(obj, &ww); ··· 98 97 99 98 i915_vma_get(vma); 100 99 err: 101 - atomic_dec(&dev_priv->gpu_error.pending_fb_pin); 100 + atomic_dec(&display->restore.pending_fb_pin); 102 101 103 102 return vma; 104 103 } ··· 113 112 unsigned long *out_flags) 114 113 { 115 114 struct drm_device *dev = fb->dev; 115 + struct intel_display *display = to_intel_display(dev); 116 116 struct drm_i915_private *dev_priv = to_i915(dev); 117 117 struct drm_gem_object *_obj = intel_fb_bo(fb); 118 118 struct drm_i915_gem_object *obj = to_intel_bo(_obj); ··· 138 136 */ 139 137 wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); 140 138 141 - atomic_inc(&dev_priv->gpu_error.pending_fb_pin); 139 + atomic_inc(&display->restore.pending_fb_pin); 142 140 143 141 /* 144 142 * Valleyview is definitely limited to scanning out the first ··· 214 212 if (ret) 215 213 vma = ERR_PTR(ret); 216 214 217 - atomic_dec(&dev_priv->gpu_error.pending_fb_pin); 215 + atomic_dec(&display->restore.pending_fb_pin); 218 216 intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); 219 217 return vma; 220 218 }
+201 -69
drivers/gpu/drm/i915/display/intel_fbc.c
··· 88 88 u16 override_cfb_stride; 89 89 u16 interval; 90 90 s8 fence_id; 91 + struct drm_rect dirty_rect; 91 92 }; 92 93 93 94 struct intel_fbc { ··· 216 215 */ 217 216 static unsigned int intel_fbc_max_cfb_height(struct intel_display *display) 218 217 { 219 - struct drm_i915_private *i915 = to_i915(display->drm); 220 - 221 218 if (DISPLAY_VER(display) >= 8) 222 219 return 2560; 223 - else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) 220 + else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 224 221 return 2048; 225 222 else 226 223 return 1536; ··· 268 269 269 270 static u32 i8xx_fbc_ctl(struct intel_fbc *fbc) 270 271 { 271 - const struct intel_fbc_state *fbc_state = &fbc->state; 272 272 struct intel_display *display = fbc->display; 273 - struct drm_i915_private *i915 = to_i915(display->drm); 273 + const struct intel_fbc_state *fbc_state = &fbc->state; 274 274 unsigned int cfb_stride; 275 275 u32 fbc_ctl; 276 276 ··· 285 287 FBC_CTL_INTERVAL(fbc_state->interval) | 286 288 FBC_CTL_STRIDE(cfb_stride); 287 289 288 - if (IS_I945GM(i915)) 290 + if (display->platform.i945gm) 289 291 fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ 290 292 291 293 if (fbc_state->fence_id >= 0) ··· 331 333 332 334 static void i8xx_fbc_activate(struct intel_fbc *fbc) 333 335 { 334 - const struct intel_fbc_state *fbc_state = &fbc->state; 335 336 struct intel_display *display = fbc->display; 337 + const struct intel_fbc_state *fbc_state = &fbc->state; 336 338 int i; 337 339 338 340 /* Clear old tags */ ··· 363 365 364 366 static void i8xx_fbc_nuke(struct intel_fbc *fbc) 365 367 { 368 + struct intel_display *display = fbc->display; 366 369 struct intel_fbc_state *fbc_state = &fbc->state; 367 370 enum i9xx_plane_id i9xx_plane = fbc_state->plane->i9xx_plane; 368 - struct drm_i915_private *dev_priv = to_i915(fbc->display->drm); 369 371 370 - intel_de_write_fw(dev_priv, DSPADDR(dev_priv, i9xx_plane), 371 - intel_de_read_fw(dev_priv, DSPADDR(dev_priv, i9xx_plane))); 372 + intel_de_write_fw(display, DSPADDR(display, i9xx_plane), 373 + intel_de_read_fw(display, DSPADDR(display, i9xx_plane))); 372 374 } 373 375 374 376 static void i8xx_fbc_program_cfb(struct intel_fbc *fbc) ··· 384 386 range_overflows_end_t(u64, i915_gem_stolen_area_address(i915), 385 387 i915_gem_stolen_node_offset(&fbc->compressed_llb), 386 388 U32_MAX)); 387 - intel_de_write(i915, FBC_CFB_BASE, 389 + intel_de_write(display, FBC_CFB_BASE, 388 390 i915_gem_stolen_node_address(i915, &fbc->compressed_fb)); 389 - intel_de_write(i915, FBC_LL_BASE, 391 + intel_de_write(display, FBC_LL_BASE, 390 392 i915_gem_stolen_node_address(i915, &fbc->compressed_llb)); 391 393 } 392 394 ··· 401 403 402 404 static void i965_fbc_nuke(struct intel_fbc *fbc) 403 405 { 406 + struct intel_display *display = fbc->display; 404 407 struct intel_fbc_state *fbc_state = &fbc->state; 405 408 enum i9xx_plane_id i9xx_plane = fbc_state->plane->i9xx_plane; 406 - struct drm_i915_private *dev_priv = to_i915(fbc->display->drm); 407 409 408 - intel_de_write_fw(dev_priv, DSPSURF(dev_priv, i9xx_plane), 409 - intel_de_read_fw(dev_priv, DSPSURF(dev_priv, i9xx_plane))); 410 + intel_de_write_fw(display, DSPSURF(display, i9xx_plane), 411 + intel_de_read_fw(display, DSPSURF(display, i9xx_plane))); 410 412 } 411 413 412 414 static const struct intel_fbc_funcs i965_fbc_funcs = { ··· 435 437 436 438 static u32 g4x_dpfc_ctl(struct intel_fbc *fbc) 437 439 { 438 - const struct intel_fbc_state *fbc_state = &fbc->state; 439 440 struct intel_display *display = fbc->display; 440 - struct drm_i915_private *i915 = to_i915(display->drm); 441 + const struct intel_fbc_state *fbc_state = &fbc->state; 441 442 u32 dpfc_ctl; 442 443 443 444 dpfc_ctl = g4x_dpfc_ctl_limit(fbc) | 444 445 DPFC_CTL_PLANE_G4X(fbc_state->plane->i9xx_plane); 445 446 446 - if (IS_G4X(i915)) 447 + if (display->platform.g4x) 447 448 dpfc_ctl |= DPFC_CTL_SR_EN; 448 449 449 450 if (fbc_state->fence_id >= 0) { ··· 457 460 458 461 static void g4x_fbc_activate(struct intel_fbc *fbc) 459 462 { 460 - const struct intel_fbc_state *fbc_state = &fbc->state; 461 463 struct intel_display *display = fbc->display; 464 + const struct intel_fbc_state *fbc_state = &fbc->state; 462 465 463 466 intel_de_write(display, DPFC_FENCE_YOFF, 464 467 fbc_state->fence_y_offset); ··· 509 512 510 513 static void ilk_fbc_activate(struct intel_fbc *fbc) 511 514 { 512 - struct intel_fbc_state *fbc_state = &fbc->state; 513 515 struct intel_display *display = fbc->display; 516 + struct intel_fbc_state *fbc_state = &fbc->state; 514 517 515 518 intel_de_write(display, ILK_DPFC_FENCE_YOFF(fbc->id), 516 519 fbc_state->fence_y_offset); ··· 523 526 { 524 527 struct intel_display *display = fbc->display; 525 528 u32 dpfc_ctl; 529 + 530 + if (HAS_FBC_DIRTY_RECT(display)) 531 + intel_de_write(display, XE3_FBC_DIRTY_CTL(fbc->id), 0); 526 532 527 533 /* Disable compression */ 528 534 dpfc_ctl = intel_de_read(display, ILK_DPFC_CONTROL(fbc->id)); ··· 564 564 565 565 static void snb_fbc_program_fence(struct intel_fbc *fbc) 566 566 { 567 - const struct intel_fbc_state *fbc_state = &fbc->state; 568 567 struct intel_display *display = fbc->display; 568 + const struct intel_fbc_state *fbc_state = &fbc->state; 569 569 u32 ctl = 0; 570 570 571 571 if (fbc_state->fence_id >= 0) ··· 601 601 602 602 static void glk_fbc_program_cfb_stride(struct intel_fbc *fbc) 603 603 { 604 - const struct intel_fbc_state *fbc_state = &fbc->state; 605 604 struct intel_display *display = fbc->display; 605 + const struct intel_fbc_state *fbc_state = &fbc->state; 606 606 u32 val = 0; 607 607 608 608 if (fbc_state->override_cfb_stride) ··· 614 614 615 615 static void skl_fbc_program_cfb_stride(struct intel_fbc *fbc) 616 616 { 617 - const struct intel_fbc_state *fbc_state = &fbc->state; 618 617 struct intel_display *display = fbc->display; 618 + const struct intel_fbc_state *fbc_state = &fbc->state; 619 619 u32 val = 0; 620 620 621 621 /* Display WA #0529: skl, kbl, bxt. */ ··· 630 630 631 631 static u32 ivb_dpfc_ctl(struct intel_fbc *fbc) 632 632 { 633 - const struct intel_fbc_state *fbc_state = &fbc->state; 634 633 struct intel_display *display = fbc->display; 635 - struct drm_i915_private *i915 = to_i915(display->drm); 634 + const struct intel_fbc_state *fbc_state = &fbc->state; 636 635 u32 dpfc_ctl; 637 636 638 637 dpfc_ctl = g4x_dpfc_ctl_limit(fbc); 639 638 640 - if (IS_IVYBRIDGE(i915)) 639 + if (display->platform.ivybridge) 641 640 dpfc_ctl |= DPFC_CTL_PLANE_IVB(fbc_state->plane->i9xx_plane); 642 641 643 642 if (DISPLAY_VER(display) >= 20) ··· 668 669 dpfc_ctl = ivb_dpfc_ctl(fbc); 669 670 if (DISPLAY_VER(display) >= 20) 670 671 intel_de_write(display, ILK_DPFC_CONTROL(fbc->id), dpfc_ctl); 672 + 673 + if (HAS_FBC_DIRTY_RECT(display)) 674 + intel_de_write(display, XE3_FBC_DIRTY_CTL(fbc->id), 675 + FBC_DIRTY_RECT_EN); 671 676 672 677 intel_de_write(display, ILK_DPFC_CONTROL(fbc->id), 673 678 DPFC_CTL_EN | dpfc_ctl); ··· 742 739 743 740 static void intel_fbc_activate(struct intel_fbc *fbc) 744 741 { 742 + struct intel_display *display = fbc->display; 743 + 745 744 lockdep_assert_held(&fbc->lock); 745 + 746 + /* only the fence can change for a flip nuke */ 747 + if (fbc->active && !intel_fbc_has_fences(display)) 748 + return; 749 + /* 750 + * In case of FBC dirt rect, any updates to the FBC registers will 751 + * trigger the nuke. 752 + */ 753 + drm_WARN_ON(display->drm, fbc->active && HAS_FBC_DIRTY_RECT(display)); 746 754 747 755 intel_fbc_hw_activate(fbc); 748 756 intel_fbc_nuke(fbc); ··· 773 759 774 760 static u64 intel_fbc_cfb_base_max(struct intel_display *display) 775 761 { 776 - struct drm_i915_private *i915 = to_i915(display->drm); 777 - 778 - if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) 762 + if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 779 763 return BIT_ULL(28); 780 764 else 781 765 return BIT_ULL(32); ··· 788 776 * reserved range size, so it always assumes the maximum (8mb) is used. 789 777 * If we enable FBC using a CFB on that memory range we'll get FIFO 790 778 * underruns, even if that range is not reserved by the BIOS. */ 791 - if (IS_BROADWELL(i915) || 792 - (DISPLAY_VER(display) == 9 && !IS_BROXTON(i915))) 779 + if (display->platform.broadwell || 780 + (DISPLAY_VER(display) == 9 && !display->platform.broxton)) 793 781 end = i915_gem_stolen_area_size(i915) - 8 * 1024 * 1024; 794 782 else 795 783 end = U64_MAX; ··· 804 792 805 793 static int intel_fbc_max_limit(struct intel_display *display) 806 794 { 807 - struct drm_i915_private *i915 = to_i915(display->drm); 808 - 809 795 /* WaFbcOnly1to1Ratio:ctg */ 810 - if (IS_G4X(i915)) 796 + if (display->platform.g4x) 811 797 return 1; 812 798 813 799 /* ··· 853 843 drm_WARN_ON(display->drm, 854 844 i915_gem_stolen_node_allocated(&fbc->compressed_llb)); 855 845 856 - if (DISPLAY_VER(display) < 5 && !IS_G4X(i915)) { 846 + if (DISPLAY_VER(display) < 5 && !display->platform.g4x) { 857 847 ret = i915_gem_stolen_insert_node(i915, &fbc->compressed_llb, 858 848 4096, 4096); 859 849 if (ret) ··· 892 882 static void intel_fbc_program_workarounds(struct intel_fbc *fbc) 893 883 { 894 884 struct intel_display *display = fbc->display; 895 - struct drm_i915_private *i915 = to_i915(display->drm); 896 885 897 - if (IS_SKYLAKE(i915) || IS_BROXTON(i915)) { 886 + if (display->platform.skylake || display->platform.broxton) { 898 887 /* 899 888 * WaFbcHighMemBwCorruptionAvoidance:skl,bxt 900 889 * Display WA #0883: skl,bxt ··· 902 893 0, DPFC_DISABLE_DUMMY0); 903 894 } 904 895 905 - if (IS_SKYLAKE(i915) || IS_KABYLAKE(i915) || 906 - IS_COFFEELAKE(i915) || IS_COMETLAKE(i915)) { 896 + if (display->platform.skylake || display->platform.kabylake || 897 + display->platform.coffeelake || display->platform.cometlake) { 907 898 /* 908 899 * WaFbcNukeOnHostModify:skl,kbl,cfl 909 900 * Display WA #0873: skl,kbl,cfl ··· 918 909 0, DPFC_CHICKEN_COMP_DUMMY_PIXEL); 919 910 920 911 /* Wa_22014263786:icl,jsl,tgl,dg1,rkl,adls,adlp,mtl */ 921 - if (DISPLAY_VER(display) >= 11 && !IS_DG2(i915)) 912 + if (DISPLAY_VER(display) >= 11 && !display->platform.dg2) 922 913 intel_de_rmw(display, ILK_DPFC_CHICKEN(fbc->id), 923 914 0, DPFC_CHICKEN_FORCE_SLB_INVALIDATION); 924 915 } ··· 995 986 static bool stride_is_valid(const struct intel_plane_state *plane_state) 996 987 { 997 988 struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); 998 - struct drm_i915_private *i915 = to_i915(display->drm); 999 989 1000 990 if (DISPLAY_VER(display) >= 11) 1001 991 return icl_fbc_stride_is_valid(plane_state); 1002 992 else if (DISPLAY_VER(display) >= 9) 1003 993 return skl_fbc_stride_is_valid(plane_state); 1004 - else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) 994 + else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 1005 995 return g4x_fbc_stride_is_valid(plane_state); 1006 996 else if (DISPLAY_VER(display) == 4) 1007 997 return i965_fbc_stride_is_valid(plane_state); ··· 1031 1023 static bool g4x_fbc_pixel_format_is_valid(const struct intel_plane_state *plane_state) 1032 1024 { 1033 1025 struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); 1034 - struct drm_i915_private *i915 = to_i915(display->drm); 1035 1026 const struct drm_framebuffer *fb = plane_state->hw.fb; 1036 1027 1037 1028 switch (fb->format->format) { ··· 1039 1032 return true; 1040 1033 case DRM_FORMAT_RGB565: 1041 1034 /* WaFbcOnly1to1Ratio:ctg */ 1042 - if (IS_G4X(i915)) 1035 + if (display->platform.g4x) 1043 1036 return false; 1044 1037 return true; 1045 1038 default: ··· 1066 1059 static bool pixel_format_is_valid(const struct intel_plane_state *plane_state) 1067 1060 { 1068 1061 struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); 1069 - struct drm_i915_private *i915 = to_i915(display->drm); 1070 1062 1071 1063 if (DISPLAY_VER(display) >= 20) 1072 1064 return lnl_fbc_pixel_format_is_valid(plane_state); 1073 - else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) 1065 + else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 1074 1066 return g4x_fbc_pixel_format_is_valid(plane_state); 1075 1067 else 1076 1068 return i8xx_fbc_pixel_format_is_valid(plane_state); ··· 1100 1094 static bool rotation_is_valid(const struct intel_plane_state *plane_state) 1101 1095 { 1102 1096 struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); 1103 - struct drm_i915_private *i915 = to_i915(display->drm); 1104 1097 1105 1098 if (DISPLAY_VER(display) >= 9) 1106 1099 return skl_fbc_rotation_is_valid(plane_state); 1107 - else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) 1100 + else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 1108 1101 return g4x_fbc_rotation_is_valid(plane_state); 1109 1102 else 1110 1103 return i8xx_fbc_rotation_is_valid(plane_state); ··· 1112 1107 static void intel_fbc_max_surface_size(struct intel_display *display, 1113 1108 unsigned int *w, unsigned int *h) 1114 1109 { 1115 - struct drm_i915_private *i915 = to_i915(display->drm); 1116 - 1117 1110 if (DISPLAY_VER(display) >= 11) { 1118 1111 *w = 8192; 1119 1112 *h = 4096; ··· 1121 1118 } else if (DISPLAY_VER(display) >= 7) { 1122 1119 *w = 4096; 1123 1120 *h = 4096; 1124 - } else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) { 1121 + } else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) { 1125 1122 *w = 4096; 1126 1123 *h = 2048; 1127 1124 } else { ··· 1154 1151 static void intel_fbc_max_plane_size(struct intel_display *display, 1155 1152 unsigned int *w, unsigned int *h) 1156 1153 { 1157 - struct drm_i915_private *i915 = to_i915(display->drm); 1158 - 1159 1154 if (DISPLAY_VER(display) >= 10) { 1160 1155 *w = 5120; 1161 1156 *h = 4096; 1162 - } else if (DISPLAY_VER(display) >= 8 || IS_HASWELL(i915)) { 1157 + } else if (DISPLAY_VER(display) >= 8 || display->platform.haswell) { 1163 1158 *w = 4096; 1164 1159 *h = 4096; 1165 - } else if (DISPLAY_VER(display) >= 5 || IS_G4X(i915)) { 1160 + } else if (DISPLAY_VER(display) >= 5 || display->platform.g4x) { 1166 1161 *w = 4096; 1167 1162 *h = 2048; 1168 1163 } else { ··· 1202 1201 return skl_fbc_tiling_valid(plane_state); 1203 1202 else 1204 1203 return i8xx_fbc_tiling_valid(plane_state); 1204 + } 1205 + 1206 + static void 1207 + intel_fbc_invalidate_dirty_rect(struct intel_fbc *fbc) 1208 + { 1209 + lockdep_assert_held(&fbc->lock); 1210 + 1211 + fbc->state.dirty_rect = DRM_RECT_INIT(0, 0, 0, 0); 1212 + } 1213 + 1214 + static void 1215 + intel_fbc_program_dirty_rect(struct intel_dsb *dsb, struct intel_fbc *fbc, 1216 + const struct drm_rect *fbc_dirty_rect) 1217 + { 1218 + struct intel_display *display = fbc->display; 1219 + 1220 + drm_WARN_ON(display->drm, fbc_dirty_rect->y2 == 0); 1221 + 1222 + intel_de_write_dsb(display, dsb, XE3_FBC_DIRTY_RECT(fbc->id), 1223 + FBC_DIRTY_RECT_START_LINE(fbc_dirty_rect->y1) | 1224 + FBC_DIRTY_RECT_END_LINE(fbc_dirty_rect->y2 - 1)); 1225 + } 1226 + 1227 + static void 1228 + intel_fbc_dirty_rect_update(struct intel_dsb *dsb, struct intel_fbc *fbc) 1229 + { 1230 + const struct drm_rect *fbc_dirty_rect = &fbc->state.dirty_rect; 1231 + 1232 + lockdep_assert_held(&fbc->lock); 1233 + 1234 + if (!drm_rect_visible(fbc_dirty_rect)) 1235 + return; 1236 + 1237 + intel_fbc_program_dirty_rect(dsb, fbc, fbc_dirty_rect); 1238 + } 1239 + 1240 + void 1241 + intel_fbc_dirty_rect_update_noarm(struct intel_dsb *dsb, 1242 + struct intel_plane *plane) 1243 + { 1244 + struct intel_display *display = to_intel_display(plane); 1245 + struct intel_fbc *fbc = plane->fbc; 1246 + 1247 + if (!HAS_FBC_DIRTY_RECT(display)) 1248 + return; 1249 + 1250 + mutex_lock(&fbc->lock); 1251 + 1252 + if (fbc->state.plane == plane) 1253 + intel_fbc_dirty_rect_update(dsb, fbc); 1254 + 1255 + mutex_unlock(&fbc->lock); 1256 + } 1257 + 1258 + static void 1259 + intel_fbc_hw_intialize_dirty_rect(struct intel_fbc *fbc, 1260 + const struct intel_plane_state *plane_state) 1261 + { 1262 + struct drm_rect src; 1263 + 1264 + /* 1265 + * Initializing the FBC HW with the whole plane area as the dirty rect. 1266 + * This is to ensure that we have valid coords be written to the 1267 + * HW as dirty rect. 1268 + */ 1269 + drm_rect_fp_to_int(&src, &plane_state->uapi.src); 1270 + 1271 + intel_fbc_program_dirty_rect(NULL, fbc, &src); 1205 1272 } 1206 1273 1207 1274 static void intel_fbc_update_state(struct intel_atomic_state *state, ··· 1345 1276 intel_fbc_is_cfb_ok(plane_state); 1346 1277 } 1347 1278 1279 + static void 1280 + __intel_fbc_prepare_dirty_rect(const struct intel_plane_state *plane_state, 1281 + const struct intel_crtc_state *crtc_state) 1282 + { 1283 + struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); 1284 + struct intel_fbc *fbc = plane->fbc; 1285 + struct drm_rect *fbc_dirty_rect = &fbc->state.dirty_rect; 1286 + int width = drm_rect_width(&plane_state->uapi.src) >> 16; 1287 + const struct drm_rect *damage = &plane_state->damage; 1288 + int y_offset = plane_state->view.color_plane[0].y; 1289 + 1290 + lockdep_assert_held(&fbc->lock); 1291 + 1292 + if (intel_crtc_needs_modeset(crtc_state) || 1293 + !intel_fbc_is_ok(plane_state)) { 1294 + intel_fbc_invalidate_dirty_rect(fbc); 1295 + return; 1296 + } 1297 + 1298 + if (drm_rect_visible(damage)) 1299 + *fbc_dirty_rect = *damage; 1300 + else 1301 + /* dirty rect must cover at least one line */ 1302 + *fbc_dirty_rect = DRM_RECT_INIT(0, y_offset, width, 1); 1303 + } 1304 + 1305 + void 1306 + intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state, 1307 + struct intel_crtc *crtc) 1308 + { 1309 + struct intel_display *display = to_intel_display(state); 1310 + const struct intel_crtc_state *crtc_state = 1311 + intel_atomic_get_new_crtc_state(state, crtc); 1312 + struct intel_plane_state *plane_state; 1313 + struct intel_plane *plane; 1314 + int i; 1315 + 1316 + if (!HAS_FBC_DIRTY_RECT(display)) 1317 + return; 1318 + 1319 + for_each_new_intel_plane_in_state(state, plane, plane_state, i) { 1320 + struct intel_fbc *fbc = plane->fbc; 1321 + 1322 + if (!fbc || plane->pipe != crtc->pipe) 1323 + continue; 1324 + 1325 + mutex_lock(&fbc->lock); 1326 + 1327 + if (fbc->state.plane == plane) 1328 + __intel_fbc_prepare_dirty_rect(plane_state, 1329 + crtc_state); 1330 + 1331 + mutex_unlock(&fbc->lock); 1332 + } 1333 + } 1334 + 1348 1335 static int intel_fbc_check_plane(struct intel_atomic_state *state, 1349 1336 struct intel_plane *plane) 1350 1337 { ··· 1442 1317 } 1443 1318 1444 1319 /* WaFbcTurnOffFbcWhenHyperVisorIsUsed:skl,bxt */ 1445 - if (i915_vtd_active(i915) && (IS_SKYLAKE(i915) || IS_BROXTON(i915))) { 1320 + if (i915_vtd_active(i915) && (display->platform.skylake || display->platform.broxton)) { 1446 1321 plane_state->no_fbc_reason = "VT-d enabled"; 1447 1322 return 0; 1448 1323 } ··· 1463 1338 * Display 12+ is not supporting FBC with PSR2. 1464 1339 * Recommendation is to keep this combination disabled 1465 1340 * Bspec: 50422 HSD: 14010260002 1341 + * 1342 + * In Xe3, PSR2 selective fetch and FBC dirty rect feature cannot 1343 + * coexist. So if PSR2 selective fetch is supported then mark that 1344 + * FBC is not supported. 1345 + * TODO: Need a logic to decide between PSR2 and FBC Dirty rect 1466 1346 */ 1467 - if (IS_DISPLAY_VER(display, 12, 14) && crtc_state->has_sel_update && 1468 - !crtc_state->has_panel_replay) { 1347 + if ((IS_DISPLAY_VER(display, 12, 14) || HAS_FBC_DIRTY_RECT(display)) && 1348 + crtc_state->has_sel_update && !crtc_state->has_panel_replay) { 1469 1349 plane_state->no_fbc_reason = "PSR2 enabled"; 1470 1350 return 0; 1471 1351 } 1472 1352 1473 1353 /* Wa_14016291713 */ 1474 1354 if ((IS_DISPLAY_VER(display, 12, 13) || 1475 - IS_DISPLAY_VERx100_STEP(i915, 1400, STEP_A0, STEP_C0)) && 1355 + IS_DISPLAY_VERx100_STEP(display, 1400, STEP_A0, STEP_C0)) && 1476 1356 crtc_state->has_psr && !crtc_state->has_panel_replay) { 1477 1357 plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)"; 1478 1358 return 0; ··· 1540 1410 } 1541 1411 1542 1412 /* WaFbcExceedCdClockThreshold:hsw,bdw */ 1543 - if (IS_HASWELL(i915) || IS_BROADWELL(i915)) { 1413 + if (display->platform.haswell || display->platform.broadwell) { 1544 1414 const struct intel_cdclk_state *cdclk_state; 1545 1415 1546 1416 cdclk_state = intel_atomic_get_cdclk_state(state); ··· 1677 1547 drm_dbg_kms(display->drm, "Disabling FBC on [PLANE:%d:%s]\n", 1678 1548 plane->base.base.id, plane->base.name); 1679 1549 1550 + intel_fbc_invalidate_dirty_rect(fbc); 1551 + 1680 1552 __intel_fbc_cleanup_cfb(fbc); 1681 1553 1682 1554 fbc->state.plane = NULL; ··· 1746 1614 mutex_unlock(&fbc->lock); 1747 1615 } 1748 1616 1749 - void intel_fbc_invalidate(struct drm_i915_private *i915, 1617 + void intel_fbc_invalidate(struct intel_display *display, 1750 1618 unsigned int frontbuffer_bits, 1751 1619 enum fb_op_origin origin) 1752 1620 { 1753 1621 struct intel_fbc *fbc; 1754 1622 enum intel_fbc_id fbc_id; 1755 1623 1756 - for_each_intel_fbc(&i915->display, fbc, fbc_id) 1624 + for_each_intel_fbc(display, fbc, fbc_id) 1757 1625 __intel_fbc_invalidate(fbc, frontbuffer_bits, origin); 1758 1626 1759 1627 } ··· 1785 1653 mutex_unlock(&fbc->lock); 1786 1654 } 1787 1655 1788 - void intel_fbc_flush(struct drm_i915_private *i915, 1656 + void intel_fbc_flush(struct intel_display *display, 1789 1657 unsigned int frontbuffer_bits, 1790 1658 enum fb_op_origin origin) 1791 1659 { 1792 1660 struct intel_fbc *fbc; 1793 1661 enum intel_fbc_id fbc_id; 1794 1662 1795 - for_each_intel_fbc(&i915->display, fbc, fbc_id) 1663 + for_each_intel_fbc(display, fbc, fbc_id) 1796 1664 __intel_fbc_flush(fbc, frontbuffer_bits, origin); 1797 1665 } 1798 1666 ··· 1863 1731 fbc->no_fbc_reason = "FBC enabled but not active yet\n"; 1864 1732 1865 1733 intel_fbc_update_state(state, crtc, plane); 1734 + 1735 + if (HAS_FBC_DIRTY_RECT(display)) 1736 + intel_fbc_hw_intialize_dirty_rect(fbc, plane_state); 1866 1737 1867 1738 intel_fbc_program_workarounds(fbc); 1868 1739 intel_fbc_program_cfb(fbc); ··· 2032 1897 */ 2033 1898 static int intel_sanitize_fbc_option(struct intel_display *display) 2034 1899 { 2035 - struct drm_i915_private *i915 = to_i915(display->drm); 2036 - 2037 1900 if (display->params.enable_fbc >= 0) 2038 1901 return !!display->params.enable_fbc; 2039 1902 2040 1903 if (!HAS_FBC(display)) 2041 1904 return 0; 2042 1905 2043 - if (IS_BROADWELL(i915) || DISPLAY_VER(display) >= 9) 1906 + if (display->platform.broadwell || DISPLAY_VER(display) >= 9) 2044 1907 return 1; 2045 1908 2046 1909 return 0; ··· 2052 1919 static struct intel_fbc *intel_fbc_create(struct intel_display *display, 2053 1920 enum intel_fbc_id fbc_id) 2054 1921 { 2055 - struct drm_i915_private *i915 = to_i915(display->drm); 2056 1922 struct intel_fbc *fbc; 2057 1923 2058 1924 fbc = kzalloc(sizeof(*fbc), GFP_KERNEL); ··· 2069 1937 fbc->funcs = &snb_fbc_funcs; 2070 1938 else if (DISPLAY_VER(display) == 5) 2071 1939 fbc->funcs = &ilk_fbc_funcs; 2072 - else if (IS_G4X(i915)) 1940 + else if (display->platform.g4x) 2073 1941 fbc->funcs = &g4x_fbc_funcs; 2074 1942 else if (DISPLAY_VER(display) == 4) 2075 1943 fbc->funcs = &i965_fbc_funcs;
+7 -3
drivers/gpu/drm/i915/display/intel_fbc.h
··· 9 9 #include <linux/types.h> 10 10 11 11 enum fb_op_origin; 12 - struct drm_i915_private; 13 12 struct intel_atomic_state; 14 13 struct intel_crtc; 15 14 struct intel_crtc_state; 16 15 struct intel_display; 16 + struct intel_dsb; 17 17 struct intel_fbc; 18 18 struct intel_plane; 19 19 struct intel_plane_state; ··· 38 38 void intel_fbc_update(struct intel_atomic_state *state, 39 39 struct intel_crtc *crtc); 40 40 void intel_fbc_disable(struct intel_crtc *crtc); 41 - void intel_fbc_invalidate(struct drm_i915_private *dev_priv, 41 + void intel_fbc_invalidate(struct intel_display *display, 42 42 unsigned int frontbuffer_bits, 43 43 enum fb_op_origin origin); 44 - void intel_fbc_flush(struct drm_i915_private *dev_priv, 44 + void intel_fbc_flush(struct intel_display *display, 45 45 unsigned int frontbuffer_bits, enum fb_op_origin origin); 46 46 void intel_fbc_add_plane(struct intel_fbc *fbc, struct intel_plane *plane); 47 47 void intel_fbc_handle_fifo_underrun_irq(struct intel_display *display); 48 48 void intel_fbc_reset_underrun(struct intel_display *display); 49 49 void intel_fbc_crtc_debugfs_add(struct intel_crtc *crtc); 50 50 void intel_fbc_debugfs_register(struct intel_display *display); 51 + void intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state, 52 + struct intel_crtc *crtc); 53 + void intel_fbc_dirty_rect_update_noarm(struct intel_dsb *dsb, 54 + struct intel_plane *plane); 51 55 52 56 #endif /* __INTEL_FBC_H__ */
+9
drivers/gpu/drm/i915/display/intel_fbc_regs.h
··· 100 100 #define FBC_STRIDE_MASK REG_GENMASK(14, 0) 101 101 #define FBC_STRIDE(x) REG_FIELD_PREP(FBC_STRIDE_MASK, (x)) 102 102 103 + #define XE3_FBC_DIRTY_RECT(fbc_id) _MMIO_PIPE((fbc_id), 0x43230, 0x43270) 104 + #define FBC_DIRTY_RECT_END_LINE_MASK REG_GENMASK(31, 16) 105 + #define FBC_DIRTY_RECT_END_LINE(val) REG_FIELD_PREP(FBC_DIRTY_RECT_END_LINE_MASK, (val)) 106 + #define FBC_DIRTY_RECT_START_LINE_MASK REG_GENMASK(15, 0) 107 + #define FBC_DIRTY_RECT_START_LINE(val) REG_FIELD_PREP(FBC_DIRTY_RECT_START_LINE_MASK, (val)) 108 + 109 + #define XE3_FBC_DIRTY_CTL(fbc_id) _MMIO_PIPE((fbc_id), 0x43234, 0x43274) 110 + #define FBC_DIRTY_RECT_EN REG_BIT(31) 111 + 103 112 #define ILK_FBC_RT_BASE _MMIO(0x2128) 104 113 #define ILK_FBC_RT_VALID REG_BIT(0) 105 114 #define SNB_FBC_FRONT_BUFFER REG_BIT(1)
+77 -263
drivers/gpu/drm/i915/display/intel_fbdev.c
··· 37 37 #include <linux/tty.h> 38 38 #include <linux/vga_switcheroo.h> 39 39 40 + #include <drm/clients/drm_client_setup.h> 40 41 #include <drm/drm_crtc.h> 41 42 #include <drm/drm_crtc_helper.h> 42 43 #include <drm/drm_fb_helper.h> 43 44 #include <drm/drm_fourcc.h> 44 45 #include <drm/drm_gem.h> 45 46 #include <drm/drm_gem_framebuffer_helper.h> 47 + #include <drm/drm_managed.h> 48 + #include <drm/drm_print.h> 46 49 47 50 #include "i915_drv.h" 51 + #include "i915_vma.h" 48 52 #include "intel_bo.h" 49 53 #include "intel_display_types.h" 50 54 #include "intel_fb.h" ··· 58 54 #include "intel_frontbuffer.h" 59 55 60 56 struct intel_fbdev { 61 - struct drm_fb_helper helper; 62 57 struct intel_framebuffer *fb; 63 58 struct i915_vma *vma; 64 59 unsigned long vma_flags; 65 - int preferred_bpp; 66 - 67 - /* Whether or not fbdev hpd processing is temporarily suspended */ 68 - bool hpd_suspended: 1; 69 - /* Set when a hotplug was received while HPD processing was suspended */ 70 - bool hpd_waiting: 1; 71 - 72 - /* Protects hpd_suspended */ 73 - struct mutex hpd_lock; 74 60 }; 75 61 76 62 static struct intel_fbdev *to_intel_fbdev(struct drm_fb_helper *fb_helper) 77 63 { 78 - return container_of(fb_helper, struct intel_fbdev, helper); 64 + struct drm_i915_private *i915 = to_i915(fb_helper->client.dev); 65 + 66 + return i915->display.fbdev.fbdev; 79 67 } 80 68 81 69 static struct intel_frontbuffer *to_frontbuffer(struct intel_fbdev *ifbdev) ··· 123 127 124 128 static int intel_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) 125 129 { 126 - struct intel_fbdev *fbdev = to_intel_fbdev(info->par); 127 - struct drm_gem_object *obj = drm_gem_fb_get_obj(&fbdev->fb->base, 0); 130 + struct drm_fb_helper *fb_helper = info->par; 131 + struct drm_gem_object *obj = drm_gem_fb_get_obj(fb_helper->fb, 0); 128 132 129 133 return intel_bo_fb_mmap(obj, vma); 130 134 } ··· 132 136 static void intel_fbdev_fb_destroy(struct fb_info *info) 133 137 { 134 138 struct drm_fb_helper *fb_helper = info->par; 135 - struct intel_fbdev *ifbdev = container_of(fb_helper, struct intel_fbdev, helper); 139 + struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper); 136 140 137 - drm_fb_helper_fini(&ifbdev->helper); 141 + drm_fb_helper_fini(fb_helper); 138 142 139 143 /* 140 144 * We rely on the object-free to release the VMA pinning for ··· 142 146 * trying to rectify all the possible error paths leading here. 143 147 */ 144 148 intel_fb_unpin_vma(ifbdev->vma, ifbdev->vma_flags); 145 - drm_framebuffer_remove(&ifbdev->fb->base); 149 + drm_framebuffer_remove(fb_helper->fb); 146 150 147 151 drm_client_release(&fb_helper->client); 148 - drm_fb_helper_unprepare(&ifbdev->helper); 149 - kfree(ifbdev); 152 + drm_fb_helper_unprepare(fb_helper); 153 + kfree(fb_helper); 150 154 } 151 155 152 156 __diag_push(); ··· 166 170 167 171 __diag_pop(); 168 172 169 - static int intelfb_create(struct drm_fb_helper *helper, 170 - struct drm_fb_helper_surface_size *sizes) 173 + static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip) 174 + { 175 + if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) 176 + return 0; 177 + 178 + if (helper->fb->funcs->dirty) 179 + return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); 180 + 181 + return 0; 182 + } 183 + 184 + static void intelfb_restore(struct drm_fb_helper *fb_helper) 185 + { 186 + struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper); 187 + 188 + intel_fbdev_invalidate(ifbdev); 189 + } 190 + 191 + static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend) 192 + { 193 + struct fb_info *info = fb_helper->info; 194 + 195 + /* 196 + * When resuming from hibernation, Linux restores the object's 197 + * content from swap if the buffer is backed by shmemfs. If the 198 + * object is stolen however, it will be full of whatever garbage 199 + * was left in there. Clear it to zero in this case. 200 + */ 201 + if (!suspend && !intel_bo_is_shmem(intel_fb_bo(fb_helper->fb))) 202 + memset_io(info->screen_base, 0, info->screen_size); 203 + 204 + fb_set_suspend(info, suspend); 205 + } 206 + 207 + static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { 208 + .fb_dirty = intelfb_dirty, 209 + .fb_restore = intelfb_restore, 210 + .fb_set_suspend = intelfb_set_suspend, 211 + }; 212 + 213 + int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, 214 + struct drm_fb_helper_surface_size *sizes) 171 215 { 172 216 struct intel_fbdev *ifbdev = to_intel_fbdev(helper); 173 217 struct intel_framebuffer *fb = ifbdev->fb; ··· 220 184 bool prealloc = false; 221 185 struct drm_gem_object *obj; 222 186 int ret; 223 - 224 - mutex_lock(&ifbdev->hpd_lock); 225 - ret = ifbdev->hpd_suspended ? -EAGAIN : 0; 226 - mutex_unlock(&ifbdev->hpd_lock); 227 - if (ret) 228 - return ret; 229 187 230 188 ifbdev->fb = NULL; 231 189 ··· 270 240 goto out_unpin; 271 241 } 272 242 273 - ifbdev->helper.fb = &fb->base; 243 + helper->funcs = &intel_fb_helper_funcs; 244 + helper->fb = &fb->base; 274 245 275 246 info->fbops = &intelfb_ops; 276 247 ··· 281 250 if (ret) 282 251 goto out_unpin; 283 252 284 - drm_fb_helper_fill_info(info, &ifbdev->helper, sizes); 253 + drm_fb_helper_fill_info(info, dev->fb_helper, sizes); 285 254 286 255 /* If the object is shmemfs backed, it will have given us zeroed pages. 287 256 * If the object is stolen however, it will be full of whatever ··· 309 278 intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); 310 279 return ret; 311 280 } 312 - 313 - static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip) 314 - { 315 - if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) 316 - return 0; 317 - 318 - if (helper->fb->funcs->dirty) 319 - return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); 320 - 321 - return 0; 322 - } 323 - 324 - static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { 325 - .fb_probe = intelfb_create, 326 - .fb_dirty = intelfb_dirty, 327 - }; 328 281 329 282 /* 330 283 * Build an intel_fbdev struct using a BIOS allocated framebuffer, if possible. ··· 432 417 goto out; 433 418 } 434 419 435 - ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8; 436 420 ifbdev->fb = fb; 437 421 438 422 drm_framebuffer_get(&ifbdev->fb->base); ··· 462 448 return false; 463 449 } 464 450 465 - static void intel_fbdev_suspend_worker(struct work_struct *work) 451 + static unsigned int intel_fbdev_color_mode(const struct drm_format_info *info) 466 452 { 467 - intel_fbdev_set_suspend(&container_of(work, 468 - struct drm_i915_private, 469 - display.fbdev.suspend_work)->drm, 470 - FBINFO_STATE_RUNNING, 471 - true); 472 - } 453 + unsigned int bpp; 473 454 474 - /* Suspends/resumes fbdev processing of incoming HPD events. When resuming HPD 475 - * processing, fbdev will perform a full connector reprobe if a hotplug event 476 - * was received while HPD was suspended. 477 - */ 478 - static void intel_fbdev_hpd_set_suspend(struct drm_i915_private *i915, int state) 479 - { 480 - struct intel_fbdev *ifbdev = i915->display.fbdev.fbdev; 481 - bool send_hpd = false; 455 + if (!info->depth || info->num_planes != 1 || info->has_alpha || info->is_yuv) 456 + return 0; 482 457 483 - mutex_lock(&ifbdev->hpd_lock); 484 - ifbdev->hpd_suspended = state == FBINFO_STATE_SUSPENDED; 485 - send_hpd = !ifbdev->hpd_suspended && ifbdev->hpd_waiting; 486 - ifbdev->hpd_waiting = false; 487 - mutex_unlock(&ifbdev->hpd_lock); 458 + bpp = drm_format_info_bpp(info, 0); 488 459 489 - if (send_hpd) { 490 - drm_dbg_kms(&i915->drm, "Handling delayed fbcon HPD event\n"); 491 - drm_fb_helper_hotplug_event(&ifbdev->helper); 460 + switch (bpp) { 461 + case 16: 462 + return info->depth; // 15 or 16 463 + default: 464 + return bpp; 492 465 } 493 466 } 494 - 495 - void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) 496 - { 497 - struct drm_i915_private *dev_priv = to_i915(dev); 498 - struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev; 499 - struct fb_info *info; 500 - 501 - if (!ifbdev) 502 - return; 503 - 504 - if (drm_WARN_ON(&dev_priv->drm, !HAS_DISPLAY(dev_priv))) 505 - return; 506 - 507 - if (!ifbdev->vma) 508 - goto set_suspend; 509 - 510 - info = ifbdev->helper.info; 511 - 512 - if (synchronous) { 513 - /* Flush any pending work to turn the console on, and then 514 - * wait to turn it off. It must be synchronous as we are 515 - * about to suspend or unload the driver. 516 - * 517 - * Note that from within the work-handler, we cannot flush 518 - * ourselves, so only flush outstanding work upon suspend! 519 - */ 520 - if (state != FBINFO_STATE_RUNNING) 521 - flush_work(&dev_priv->display.fbdev.suspend_work); 522 - 523 - console_lock(); 524 - } else { 525 - /* 526 - * The console lock can be pretty contented on resume due 527 - * to all the printk activity. Try to keep it out of the hot 528 - * path of resume if possible. 529 - */ 530 - drm_WARN_ON(dev, state != FBINFO_STATE_RUNNING); 531 - if (!console_trylock()) { 532 - /* Don't block our own workqueue as this can 533 - * be run in parallel with other i915.ko tasks. 534 - */ 535 - queue_work(dev_priv->unordered_wq, 536 - &dev_priv->display.fbdev.suspend_work); 537 - return; 538 - } 539 - } 540 - 541 - /* On resume from hibernation: If the object is shmemfs backed, it has 542 - * been restored from swap. If the object is stolen however, it will be 543 - * full of whatever garbage was left in there. 544 - */ 545 - if (state == FBINFO_STATE_RUNNING && 546 - !intel_bo_is_shmem(intel_fb_bo(&ifbdev->fb->base))) 547 - memset_io(info->screen_base, 0, info->screen_size); 548 - 549 - drm_fb_helper_set_suspend(&ifbdev->helper, state); 550 - console_unlock(); 551 - 552 - set_suspend: 553 - intel_fbdev_hpd_set_suspend(dev_priv, state); 554 - } 555 - 556 - static int intel_fbdev_output_poll_changed(struct drm_device *dev) 557 - { 558 - struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev; 559 - bool send_hpd; 560 - 561 - if (!ifbdev) 562 - return -EINVAL; 563 - 564 - mutex_lock(&ifbdev->hpd_lock); 565 - send_hpd = !ifbdev->hpd_suspended; 566 - ifbdev->hpd_waiting = true; 567 - mutex_unlock(&ifbdev->hpd_lock); 568 - 569 - if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup)) 570 - drm_fb_helper_hotplug_event(&ifbdev->helper); 571 - 572 - return 0; 573 - } 574 - 575 - static int intel_fbdev_restore_mode(struct drm_i915_private *dev_priv) 576 - { 577 - struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev; 578 - int ret; 579 - 580 - if (!ifbdev) 581 - return -EINVAL; 582 - 583 - if (!ifbdev->vma) 584 - return -ENOMEM; 585 - 586 - ret = drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper); 587 - if (ret) 588 - return ret; 589 - 590 - intel_fbdev_invalidate(ifbdev); 591 - 592 - return 0; 593 - } 594 - 595 - /* 596 - * Fbdev client and struct drm_client_funcs 597 - */ 598 - 599 - static void intel_fbdev_client_unregister(struct drm_client_dev *client) 600 - { 601 - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); 602 - struct drm_device *dev = fb_helper->dev; 603 - struct pci_dev *pdev = to_pci_dev(dev->dev); 604 - 605 - if (fb_helper->info) { 606 - vga_switcheroo_client_fb_set(pdev, NULL); 607 - drm_fb_helper_unregister_info(fb_helper); 608 - } else { 609 - drm_fb_helper_unprepare(fb_helper); 610 - drm_client_release(&fb_helper->client); 611 - kfree(fb_helper); 612 - } 613 - } 614 - 615 - static int intel_fbdev_client_restore(struct drm_client_dev *client) 616 - { 617 - struct drm_i915_private *dev_priv = to_i915(client->dev); 618 - int ret; 619 - 620 - ret = intel_fbdev_restore_mode(dev_priv); 621 - if (ret) 622 - return ret; 623 - 624 - vga_switcheroo_process_delayed_switch(); 625 - 626 - return 0; 627 - } 628 - 629 - static int intel_fbdev_client_hotplug(struct drm_client_dev *client) 630 - { 631 - struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); 632 - struct drm_device *dev = client->dev; 633 - struct pci_dev *pdev = to_pci_dev(dev->dev); 634 - int ret; 635 - 636 - if (dev->fb_helper) 637 - return intel_fbdev_output_poll_changed(dev); 638 - 639 - ret = drm_fb_helper_init(dev, fb_helper); 640 - if (ret) 641 - goto err_drm_err; 642 - 643 - ret = drm_fb_helper_initial_config(fb_helper); 644 - if (ret) 645 - goto err_drm_fb_helper_fini; 646 - 647 - vga_switcheroo_client_fb_set(pdev, fb_helper->info); 648 - 649 - return 0; 650 - 651 - err_drm_fb_helper_fini: 652 - drm_fb_helper_fini(fb_helper); 653 - err_drm_err: 654 - drm_err(dev, "Failed to setup i915 fbdev emulation (ret=%d)\n", ret); 655 - return ret; 656 - } 657 - 658 - static const struct drm_client_funcs intel_fbdev_client_funcs = { 659 - .owner = THIS_MODULE, 660 - .unregister = intel_fbdev_client_unregister, 661 - .restore = intel_fbdev_client_restore, 662 - .hotplug = intel_fbdev_client_hotplug, 663 - }; 664 467 665 468 void intel_fbdev_setup(struct drm_i915_private *i915) 666 469 { 667 470 struct drm_device *dev = &i915->drm; 668 471 struct intel_fbdev *ifbdev; 669 - int ret; 472 + unsigned int preferred_bpp = 0; 670 473 671 474 if (!HAS_DISPLAY(i915)) 672 475 return; 673 476 674 - ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL); 477 + ifbdev = drmm_kzalloc(dev, sizeof(*ifbdev), GFP_KERNEL); 675 478 if (!ifbdev) 676 479 return; 677 - drm_fb_helper_prepare(dev, &ifbdev->helper, 32, &intel_fb_helper_funcs); 678 480 679 481 i915->display.fbdev.fbdev = ifbdev; 680 - INIT_WORK(&i915->display.fbdev.suspend_work, intel_fbdev_suspend_worker); 681 - mutex_init(&ifbdev->hpd_lock); 682 482 if (intel_fbdev_init_bios(dev, ifbdev)) 683 - ifbdev->helper.preferred_bpp = ifbdev->preferred_bpp; 684 - else 685 - ifbdev->preferred_bpp = ifbdev->helper.preferred_bpp; 483 + preferred_bpp = intel_fbdev_color_mode(ifbdev->fb->base.format); 484 + if (!preferred_bpp) 485 + preferred_bpp = 32; 686 486 687 - ret = drm_client_init(dev, &ifbdev->helper.client, "intel-fbdev", 688 - &intel_fbdev_client_funcs); 689 - if (ret) { 690 - drm_err(dev, "Failed to register client: %d\n", ret); 691 - goto err_drm_fb_helper_unprepare; 692 - } 693 - 694 - drm_client_register(&ifbdev->helper.client); 695 - 696 - return; 697 - 698 - err_drm_fb_helper_unprepare: 699 - drm_fb_helper_unprepare(&ifbdev->helper); 700 - mutex_destroy(&ifbdev->hpd_lock); 701 - kfree(ifbdev); 487 + drm_client_setup_with_color_mode(dev, preferred_bpp); 702 488 } 703 489 704 490 struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev) 705 491 { 706 - if (!fbdev || !fbdev->helper.fb) 492 + if (!fbdev) 707 493 return NULL; 708 494 709 - return to_intel_framebuffer(fbdev->helper.fb); 495 + return fbdev->fb; 710 496 } 711 497 712 498 struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev)
+8 -9
drivers/gpu/drm/i915/display/intel_fbdev.h
··· 6 6 #ifndef __INTEL_FBDEV_H__ 7 7 #define __INTEL_FBDEV_H__ 8 8 9 - #include <linux/types.h> 10 - 11 - struct drm_device; 9 + struct drm_fb_helper; 10 + struct drm_fb_helper_surface_size; 12 11 struct drm_i915_private; 13 12 struct intel_fbdev; 14 13 struct intel_framebuffer; 15 14 16 15 #ifdef CONFIG_DRM_FBDEV_EMULATION 16 + int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, 17 + struct drm_fb_helper_surface_size *sizes); 18 + #define INTEL_FBDEV_DRIVER_OPS \ 19 + .fbdev_probe = intel_fbdev_driver_fbdev_probe 17 20 void intel_fbdev_setup(struct drm_i915_private *dev_priv); 18 - void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous); 19 21 struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev); 20 22 struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev); 21 23 22 24 #else 25 + #define INTEL_FBDEV_DRIVER_OPS \ 26 + .fbdev_probe = NULL 23 27 static inline void intel_fbdev_setup(struct drm_i915_private *dev_priv) 24 28 { 25 29 } 26 - 27 - static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) 28 - { 29 - } 30 - 31 30 static inline struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev) 32 31 { 33 32 return NULL;
+227 -237
drivers/gpu/drm/i915/display/intel_fdi.c
··· 24 24 const struct intel_crtc_state *crtc_state); 25 25 }; 26 26 27 - static void assert_fdi_tx(struct drm_i915_private *dev_priv, 27 + static void assert_fdi_tx(struct intel_display *display, 28 28 enum pipe pipe, bool state) 29 29 { 30 - struct intel_display *display = &dev_priv->display; 31 30 bool cur_state; 32 31 33 32 if (HAS_DDI(display)) { ··· 47 48 str_on_off(state), str_on_off(cur_state)); 48 49 } 49 50 50 - void assert_fdi_tx_enabled(struct drm_i915_private *i915, enum pipe pipe) 51 + void assert_fdi_tx_enabled(struct intel_display *display, enum pipe pipe) 51 52 { 52 - assert_fdi_tx(i915, pipe, true); 53 + assert_fdi_tx(display, pipe, true); 53 54 } 54 55 55 - void assert_fdi_tx_disabled(struct drm_i915_private *i915, enum pipe pipe) 56 + void assert_fdi_tx_disabled(struct intel_display *display, enum pipe pipe) 56 57 { 57 - assert_fdi_tx(i915, pipe, false); 58 + assert_fdi_tx(display, pipe, false); 58 59 } 59 60 60 - static void assert_fdi_rx(struct drm_i915_private *dev_priv, 61 + static void assert_fdi_rx(struct intel_display *display, 61 62 enum pipe pipe, bool state) 62 63 { 63 - struct intel_display *display = &dev_priv->display; 64 64 bool cur_state; 65 65 66 66 cur_state = intel_de_read(display, FDI_RX_CTL(pipe)) & FDI_RX_ENABLE; ··· 68 70 str_on_off(state), str_on_off(cur_state)); 69 71 } 70 72 71 - void assert_fdi_rx_enabled(struct drm_i915_private *i915, enum pipe pipe) 73 + void assert_fdi_rx_enabled(struct intel_display *display, enum pipe pipe) 72 74 { 73 - assert_fdi_rx(i915, pipe, true); 75 + assert_fdi_rx(display, pipe, true); 74 76 } 75 77 76 - void assert_fdi_rx_disabled(struct drm_i915_private *i915, enum pipe pipe) 78 + void assert_fdi_rx_disabled(struct intel_display *display, enum pipe pipe) 77 79 { 78 - assert_fdi_rx(i915, pipe, false); 80 + assert_fdi_rx(display, pipe, false); 79 81 } 80 82 81 - void assert_fdi_tx_pll_enabled(struct intel_display *display, 82 - enum pipe pipe) 83 + void assert_fdi_tx_pll_enabled(struct intel_display *display, enum pipe pipe) 83 84 { 84 85 bool cur_state; 85 86 ··· 119 122 void intel_fdi_link_train(struct intel_crtc *crtc, 120 123 const struct intel_crtc_state *crtc_state) 121 124 { 122 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 125 + struct intel_display *display = to_intel_display(crtc); 123 126 124 - dev_priv->display.funcs.fdi->fdi_link_train(crtc, crtc_state); 127 + display->funcs.fdi->fdi_link_train(crtc, crtc_state); 125 128 } 126 129 127 130 /** ··· 138 141 int intel_fdi_add_affected_crtcs(struct intel_atomic_state *state) 139 142 { 140 143 struct intel_display *display = to_intel_display(state); 141 - struct drm_i915_private *i915 = to_i915(state->base.dev); 142 144 const struct intel_crtc_state *old_crtc_state; 143 145 const struct intel_crtc_state *new_crtc_state; 144 146 struct intel_crtc *crtc; 145 147 146 - if (!IS_IVYBRIDGE(i915) || INTEL_NUM_PIPES(i915) != 3) 148 + if (!display->platform.ivybridge || INTEL_NUM_PIPES(display) != 3) 147 149 return 0; 148 150 149 151 crtc = intel_crtc_for_pipe(display, PIPE_C); ··· 180 184 return 0; 181 185 } 182 186 183 - static int ilk_check_fdi_lanes(struct drm_device *dev, enum pipe pipe, 187 + static int ilk_check_fdi_lanes(struct intel_display *display, enum pipe pipe, 184 188 struct intel_crtc_state *pipe_config, 185 189 enum pipe *pipe_to_reduce) 186 190 { 187 - struct intel_display *display = to_intel_display(dev); 188 - struct drm_i915_private *dev_priv = to_i915(dev); 189 191 struct drm_atomic_state *state = pipe_config->uapi.state; 190 192 struct intel_crtc *other_crtc; 191 193 struct intel_crtc_state *other_crtc_state; 192 194 193 195 *pipe_to_reduce = pipe; 194 196 195 - drm_dbg_kms(&dev_priv->drm, 197 + drm_dbg_kms(display->drm, 196 198 "checking fdi config on pipe %c, lanes %i\n", 197 199 pipe_name(pipe), pipe_config->fdi_lanes); 198 200 if (pipe_config->fdi_lanes > 4) { 199 - drm_dbg_kms(&dev_priv->drm, 201 + drm_dbg_kms(display->drm, 200 202 "invalid fdi lane config on pipe %c: %i lanes\n", 201 203 pipe_name(pipe), pipe_config->fdi_lanes); 202 204 return -EINVAL; 203 205 } 204 206 205 - if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { 207 + if (display->platform.haswell || display->platform.broadwell) { 206 208 if (pipe_config->fdi_lanes > 2) { 207 - drm_dbg_kms(&dev_priv->drm, 209 + drm_dbg_kms(display->drm, 208 210 "only 2 lanes on haswell, required: %i lanes\n", 209 211 pipe_config->fdi_lanes); 210 212 return -EINVAL; ··· 211 217 } 212 218 } 213 219 214 - if (INTEL_NUM_PIPES(dev_priv) == 2) 220 + if (INTEL_NUM_PIPES(display) == 2) 215 221 return 0; 216 222 217 223 /* Ivybridge 3 pipe is really complicated */ ··· 229 235 return PTR_ERR(other_crtc_state); 230 236 231 237 if (pipe_required_fdi_lanes(other_crtc_state) > 0) { 232 - drm_dbg_kms(&dev_priv->drm, 238 + drm_dbg_kms(display->drm, 233 239 "invalid shared fdi lane config on pipe %c: %i lanes\n", 234 240 pipe_name(pipe), pipe_config->fdi_lanes); 235 241 return -EINVAL; ··· 237 243 return 0; 238 244 case PIPE_C: 239 245 if (pipe_config->fdi_lanes > 2) { 240 - drm_dbg_kms(&dev_priv->drm, 246 + drm_dbg_kms(display->drm, 241 247 "only 2 lanes on pipe %c: required %i lanes\n", 242 248 pipe_name(pipe), pipe_config->fdi_lanes); 243 249 return -EINVAL; ··· 250 256 return PTR_ERR(other_crtc_state); 251 257 252 258 if (pipe_required_fdi_lanes(other_crtc_state) > 2) { 253 - drm_dbg_kms(&dev_priv->drm, 259 + drm_dbg_kms(display->drm, 254 260 "fdi link B uses too many lanes to enable link C\n"); 255 261 256 262 *pipe_to_reduce = PIPE_B; ··· 264 270 } 265 271 } 266 272 267 - void intel_fdi_pll_freq_update(struct drm_i915_private *i915) 273 + void intel_fdi_pll_freq_update(struct intel_display *display) 268 274 { 269 - if (IS_IRONLAKE(i915)) { 270 - u32 fdi_pll_clk = 271 - intel_de_read(i915, FDI_PLL_BIOS_0) & FDI_PLL_FB_CLOCK_MASK; 275 + if (display->platform.ironlake) { 276 + u32 fdi_pll_clk; 272 277 273 - i915->display.fdi.pll_freq = (fdi_pll_clk + 2) * 10000; 274 - } else if (IS_SANDYBRIDGE(i915) || IS_IVYBRIDGE(i915)) { 275 - i915->display.fdi.pll_freq = 270000; 278 + fdi_pll_clk = intel_de_read(display, FDI_PLL_BIOS_0) & FDI_PLL_FB_CLOCK_MASK; 279 + 280 + display->fdi.pll_freq = (fdi_pll_clk + 2) * 10000; 281 + } else if (display->platform.sandybridge || display->platform.ivybridge) { 282 + display->fdi.pll_freq = 270000; 276 283 } else { 277 284 return; 278 285 } 279 286 280 - drm_dbg(&i915->drm, "FDI PLL freq=%d\n", i915->display.fdi.pll_freq); 287 + drm_dbg(display->drm, "FDI PLL freq=%d\n", display->fdi.pll_freq); 281 288 } 282 289 283 - int intel_fdi_link_freq(struct drm_i915_private *i915, 290 + int intel_fdi_link_freq(struct intel_display *display, 284 291 const struct intel_crtc_state *pipe_config) 285 292 { 286 - if (HAS_DDI(i915)) 293 + if (HAS_DDI(display)) 287 294 return pipe_config->port_clock; /* SPLL */ 288 295 else 289 - return i915->display.fdi.pll_freq; 296 + return display->fdi.pll_freq; 290 297 } 291 298 292 299 /** ··· 321 326 int ilk_fdi_compute_config(struct intel_crtc *crtc, 322 327 struct intel_crtc_state *pipe_config) 323 328 { 324 - struct drm_device *dev = crtc->base.dev; 325 - struct drm_i915_private *i915 = to_i915(dev); 329 + struct intel_display *display = to_intel_display(crtc); 326 330 const struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode; 327 331 int lane, link_bw, fdi_dotclock; 328 332 ··· 332 338 * Hence the bw of each lane in terms of the mode signal 333 339 * is: 334 340 */ 335 - link_bw = intel_fdi_link_freq(i915, pipe_config); 341 + link_bw = intel_fdi_link_freq(display, pipe_config); 336 342 337 343 fdi_dotclock = adjusted_mode->crtc_clock; 338 344 ··· 355 361 struct intel_crtc_state *pipe_config, 356 362 struct intel_link_bw_limits *limits) 357 363 { 358 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 364 + struct intel_display *display = to_intel_display(crtc); 359 365 enum pipe pipe_to_reduce; 360 366 int ret; 361 367 362 - ret = ilk_check_fdi_lanes(&i915->drm, crtc->pipe, pipe_config, 368 + ret = ilk_check_fdi_lanes(display, crtc->pipe, pipe_config, 363 369 &pipe_to_reduce); 364 370 if (ret != -EINVAL) 365 371 return ret; ··· 412 418 return 0; 413 419 } 414 420 415 - static void cpt_set_fdi_bc_bifurcation(struct drm_i915_private *dev_priv, bool enable) 421 + static void cpt_set_fdi_bc_bifurcation(struct intel_display *display, bool enable) 416 422 { 417 423 u32 temp; 418 424 419 - temp = intel_de_read(dev_priv, SOUTH_CHICKEN1); 425 + temp = intel_de_read(display, SOUTH_CHICKEN1); 420 426 if (!!(temp & FDI_BC_BIFURCATION_SELECT) == enable) 421 427 return; 422 428 423 - drm_WARN_ON(&dev_priv->drm, 424 - intel_de_read(dev_priv, FDI_RX_CTL(PIPE_B)) & 429 + drm_WARN_ON(display->drm, 430 + intel_de_read(display, FDI_RX_CTL(PIPE_B)) & 425 431 FDI_RX_ENABLE); 426 - drm_WARN_ON(&dev_priv->drm, 427 - intel_de_read(dev_priv, FDI_RX_CTL(PIPE_C)) & 432 + drm_WARN_ON(display->drm, 433 + intel_de_read(display, FDI_RX_CTL(PIPE_C)) & 428 434 FDI_RX_ENABLE); 429 435 430 436 temp &= ~FDI_BC_BIFURCATION_SELECT; 431 437 if (enable) 432 438 temp |= FDI_BC_BIFURCATION_SELECT; 433 439 434 - drm_dbg_kms(&dev_priv->drm, "%sabling fdi C rx\n", 440 + drm_dbg_kms(display->drm, "%sabling fdi C rx\n", 435 441 enable ? "en" : "dis"); 436 - intel_de_write(dev_priv, SOUTH_CHICKEN1, temp); 437 - intel_de_posting_read(dev_priv, SOUTH_CHICKEN1); 442 + intel_de_write(display, SOUTH_CHICKEN1, temp); 443 + intel_de_posting_read(display, SOUTH_CHICKEN1); 438 444 } 439 445 440 446 static void ivb_update_fdi_bc_bifurcation(const struct intel_crtc_state *crtc_state) 441 447 { 448 + struct intel_display *display = to_intel_display(crtc_state); 442 449 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 443 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 444 450 445 451 switch (crtc->pipe) { 446 452 case PIPE_A: 447 453 break; 448 454 case PIPE_B: 449 455 if (crtc_state->fdi_lanes > 2) 450 - cpt_set_fdi_bc_bifurcation(dev_priv, false); 456 + cpt_set_fdi_bc_bifurcation(display, false); 451 457 else 452 - cpt_set_fdi_bc_bifurcation(dev_priv, true); 458 + cpt_set_fdi_bc_bifurcation(display, true); 453 459 454 460 break; 455 461 case PIPE_C: 456 - cpt_set_fdi_bc_bifurcation(dev_priv, true); 462 + cpt_set_fdi_bc_bifurcation(display, true); 457 463 458 464 break; 459 465 default: ··· 463 469 464 470 void intel_fdi_normal_train(struct intel_crtc *crtc) 465 471 { 466 - struct drm_device *dev = crtc->base.dev; 467 - struct drm_i915_private *dev_priv = to_i915(dev); 472 + struct intel_display *display = to_intel_display(crtc); 473 + struct drm_i915_private *dev_priv = to_i915(display->drm); 468 474 enum pipe pipe = crtc->pipe; 469 475 i915_reg_t reg; 470 476 u32 temp; 471 477 472 478 /* enable normal train */ 473 479 reg = FDI_TX_CTL(pipe); 474 - temp = intel_de_read(dev_priv, reg); 475 - if (IS_IVYBRIDGE(dev_priv)) { 480 + temp = intel_de_read(display, reg); 481 + if (display->platform.ivybridge) { 476 482 temp &= ~FDI_LINK_TRAIN_NONE_IVB; 477 483 temp |= FDI_LINK_TRAIN_NONE_IVB | FDI_TX_ENHANCE_FRAME_ENABLE; 478 484 } else { 479 485 temp &= ~FDI_LINK_TRAIN_NONE; 480 486 temp |= FDI_LINK_TRAIN_NONE | FDI_TX_ENHANCE_FRAME_ENABLE; 481 487 } 482 - intel_de_write(dev_priv, reg, temp); 488 + intel_de_write(display, reg, temp); 483 489 484 490 reg = FDI_RX_CTL(pipe); 485 - temp = intel_de_read(dev_priv, reg); 491 + temp = intel_de_read(display, reg); 486 492 if (HAS_PCH_CPT(dev_priv)) { 487 493 temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 488 494 temp |= FDI_LINK_TRAIN_NORMAL_CPT; ··· 490 496 temp &= ~FDI_LINK_TRAIN_NONE; 491 497 temp |= FDI_LINK_TRAIN_NONE; 492 498 } 493 - intel_de_write(dev_priv, reg, temp | FDI_RX_ENHANCE_FRAME_ENABLE); 499 + intel_de_write(display, reg, temp | FDI_RX_ENHANCE_FRAME_ENABLE); 494 500 495 501 /* wait one idle pattern time */ 496 - intel_de_posting_read(dev_priv, reg); 502 + intel_de_posting_read(display, reg); 497 503 udelay(1000); 498 504 499 505 /* IVB wants error correction enabled */ 500 - if (IS_IVYBRIDGE(dev_priv)) 501 - intel_de_rmw(dev_priv, reg, 0, FDI_FS_ERRC_ENABLE | FDI_FE_ERRC_ENABLE); 506 + if (display->platform.ivybridge) 507 + intel_de_rmw(display, reg, 0, FDI_FS_ERRC_ENABLE | FDI_FE_ERRC_ENABLE); 502 508 } 503 509 504 510 /* The FDI link training functions for ILK/Ibexpeak. */ ··· 506 512 const struct intel_crtc_state *crtc_state) 507 513 { 508 514 struct intel_display *display = to_intel_display(crtc); 509 - struct drm_device *dev = crtc->base.dev; 510 - struct drm_i915_private *dev_priv = to_i915(dev); 511 515 enum pipe pipe = crtc->pipe; 512 516 i915_reg_t reg; 513 517 u32 temp, tries; ··· 514 522 * Write the TU size bits before fdi link training, so that error 515 523 * detection works. 516 524 */ 517 - intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe), 518 - intel_de_read(dev_priv, PIPE_DATA_M1(dev_priv, pipe)) & TU_SIZE_MASK); 525 + intel_de_write(display, FDI_RX_TUSIZE1(pipe), 526 + intel_de_read(display, PIPE_DATA_M1(display, pipe)) & TU_SIZE_MASK); 519 527 520 528 /* FDI needs bits from pipe first */ 521 529 assert_transcoder_enabled(display, crtc_state->cpu_transcoder); ··· 523 531 /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit 524 532 for train result */ 525 533 reg = FDI_RX_IMR(pipe); 526 - temp = intel_de_read(dev_priv, reg); 534 + temp = intel_de_read(display, reg); 527 535 temp &= ~FDI_RX_SYMBOL_LOCK; 528 536 temp &= ~FDI_RX_BIT_LOCK; 529 - intel_de_write(dev_priv, reg, temp); 530 - intel_de_read(dev_priv, reg); 537 + intel_de_write(display, reg, temp); 538 + intel_de_read(display, reg); 531 539 udelay(150); 532 540 533 541 /* enable CPU FDI TX and PCH FDI RX */ 534 542 reg = FDI_TX_CTL(pipe); 535 - temp = intel_de_read(dev_priv, reg); 543 + temp = intel_de_read(display, reg); 536 544 temp &= ~FDI_DP_PORT_WIDTH_MASK; 537 545 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); 538 546 temp &= ~FDI_LINK_TRAIN_NONE; 539 547 temp |= FDI_LINK_TRAIN_PATTERN_1; 540 - intel_de_write(dev_priv, reg, temp | FDI_TX_ENABLE); 548 + intel_de_write(display, reg, temp | FDI_TX_ENABLE); 541 549 542 550 reg = FDI_RX_CTL(pipe); 543 - temp = intel_de_read(dev_priv, reg); 551 + temp = intel_de_read(display, reg); 544 552 temp &= ~FDI_LINK_TRAIN_NONE; 545 553 temp |= FDI_LINK_TRAIN_PATTERN_1; 546 - intel_de_write(dev_priv, reg, temp | FDI_RX_ENABLE); 554 + intel_de_write(display, reg, temp | FDI_RX_ENABLE); 547 555 548 - intel_de_posting_read(dev_priv, reg); 556 + intel_de_posting_read(display, reg); 549 557 udelay(150); 550 558 551 559 /* Ironlake workaround, enable clock pointer after FDI enable*/ 552 - intel_de_write(dev_priv, FDI_RX_CHICKEN(pipe), 560 + intel_de_write(display, FDI_RX_CHICKEN(pipe), 553 561 FDI_RX_PHASE_SYNC_POINTER_OVR); 554 - intel_de_write(dev_priv, FDI_RX_CHICKEN(pipe), 562 + intel_de_write(display, FDI_RX_CHICKEN(pipe), 555 563 FDI_RX_PHASE_SYNC_POINTER_OVR | FDI_RX_PHASE_SYNC_POINTER_EN); 556 564 557 565 reg = FDI_RX_IIR(pipe); 558 566 for (tries = 0; tries < 5; tries++) { 559 - temp = intel_de_read(dev_priv, reg); 560 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 567 + temp = intel_de_read(display, reg); 568 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 561 569 562 570 if ((temp & FDI_RX_BIT_LOCK)) { 563 - drm_dbg_kms(&dev_priv->drm, "FDI train 1 done.\n"); 564 - intel_de_write(dev_priv, reg, temp | FDI_RX_BIT_LOCK); 571 + drm_dbg_kms(display->drm, "FDI train 1 done.\n"); 572 + intel_de_write(display, reg, temp | FDI_RX_BIT_LOCK); 565 573 break; 566 574 } 567 575 } 568 576 if (tries == 5) 569 - drm_err(&dev_priv->drm, "FDI train 1 fail!\n"); 577 + drm_err(display->drm, "FDI train 1 fail!\n"); 570 578 571 579 /* Train 2 */ 572 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), 580 + intel_de_rmw(display, FDI_TX_CTL(pipe), 573 581 FDI_LINK_TRAIN_NONE, FDI_LINK_TRAIN_PATTERN_2); 574 - intel_de_rmw(dev_priv, FDI_RX_CTL(pipe), 582 + intel_de_rmw(display, FDI_RX_CTL(pipe), 575 583 FDI_LINK_TRAIN_NONE, FDI_LINK_TRAIN_PATTERN_2); 576 - intel_de_posting_read(dev_priv, FDI_RX_CTL(pipe)); 584 + intel_de_posting_read(display, FDI_RX_CTL(pipe)); 577 585 udelay(150); 578 586 579 587 reg = FDI_RX_IIR(pipe); 580 588 for (tries = 0; tries < 5; tries++) { 581 - temp = intel_de_read(dev_priv, reg); 582 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 589 + temp = intel_de_read(display, reg); 590 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 583 591 584 592 if (temp & FDI_RX_SYMBOL_LOCK) { 585 - intel_de_write(dev_priv, reg, 593 + intel_de_write(display, reg, 586 594 temp | FDI_RX_SYMBOL_LOCK); 587 - drm_dbg_kms(&dev_priv->drm, "FDI train 2 done.\n"); 595 + drm_dbg_kms(display->drm, "FDI train 2 done.\n"); 588 596 break; 589 597 } 590 598 } 591 599 if (tries == 5) 592 - drm_err(&dev_priv->drm, "FDI train 2 fail!\n"); 600 + drm_err(display->drm, "FDI train 2 fail!\n"); 593 601 594 - drm_dbg_kms(&dev_priv->drm, "FDI train done\n"); 602 + drm_dbg_kms(display->drm, "FDI train done\n"); 595 603 596 604 } 597 605 ··· 606 614 static void gen6_fdi_link_train(struct intel_crtc *crtc, 607 615 const struct intel_crtc_state *crtc_state) 608 616 { 609 - struct drm_device *dev = crtc->base.dev; 610 - struct drm_i915_private *dev_priv = to_i915(dev); 617 + struct intel_display *display = to_intel_display(crtc); 618 + struct drm_i915_private *dev_priv = to_i915(display->drm); 611 619 enum pipe pipe = crtc->pipe; 612 620 i915_reg_t reg; 613 621 u32 temp, i, retry; ··· 616 624 * Write the TU size bits before fdi link training, so that error 617 625 * detection works. 618 626 */ 619 - intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe), 620 - intel_de_read(dev_priv, PIPE_DATA_M1(dev_priv, pipe)) & TU_SIZE_MASK); 627 + intel_de_write(display, FDI_RX_TUSIZE1(pipe), 628 + intel_de_read(display, PIPE_DATA_M1(display, pipe)) & TU_SIZE_MASK); 621 629 622 630 /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit 623 631 for train result */ 624 632 reg = FDI_RX_IMR(pipe); 625 - temp = intel_de_read(dev_priv, reg); 633 + temp = intel_de_read(display, reg); 626 634 temp &= ~FDI_RX_SYMBOL_LOCK; 627 635 temp &= ~FDI_RX_BIT_LOCK; 628 - intel_de_write(dev_priv, reg, temp); 636 + intel_de_write(display, reg, temp); 629 637 630 - intel_de_posting_read(dev_priv, reg); 638 + intel_de_posting_read(display, reg); 631 639 udelay(150); 632 640 633 641 /* enable CPU FDI TX and PCH FDI RX */ 634 642 reg = FDI_TX_CTL(pipe); 635 - temp = intel_de_read(dev_priv, reg); 643 + temp = intel_de_read(display, reg); 636 644 temp &= ~FDI_DP_PORT_WIDTH_MASK; 637 645 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); 638 646 temp &= ~FDI_LINK_TRAIN_NONE; ··· 640 648 temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; 641 649 /* SNB-B */ 642 650 temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B; 643 - intel_de_write(dev_priv, reg, temp | FDI_TX_ENABLE); 651 + intel_de_write(display, reg, temp | FDI_TX_ENABLE); 644 652 645 - intel_de_write(dev_priv, FDI_RX_MISC(pipe), 653 + intel_de_write(display, FDI_RX_MISC(pipe), 646 654 FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90); 647 655 648 656 reg = FDI_RX_CTL(pipe); 649 - temp = intel_de_read(dev_priv, reg); 657 + temp = intel_de_read(display, reg); 650 658 if (HAS_PCH_CPT(dev_priv)) { 651 659 temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 652 660 temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; ··· 654 662 temp &= ~FDI_LINK_TRAIN_NONE; 655 663 temp |= FDI_LINK_TRAIN_PATTERN_1; 656 664 } 657 - intel_de_write(dev_priv, reg, temp | FDI_RX_ENABLE); 665 + intel_de_write(display, reg, temp | FDI_RX_ENABLE); 658 666 659 - intel_de_posting_read(dev_priv, reg); 667 + intel_de_posting_read(display, reg); 660 668 udelay(150); 661 669 662 670 for (i = 0; i < 4; i++) { 663 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), 671 + intel_de_rmw(display, FDI_TX_CTL(pipe), 664 672 FDI_LINK_TRAIN_VOL_EMP_MASK, snb_b_fdi_train_param[i]); 665 - intel_de_posting_read(dev_priv, FDI_TX_CTL(pipe)); 673 + intel_de_posting_read(display, FDI_TX_CTL(pipe)); 666 674 udelay(500); 667 675 668 676 for (retry = 0; retry < 5; retry++) { 669 677 reg = FDI_RX_IIR(pipe); 670 - temp = intel_de_read(dev_priv, reg); 671 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 678 + temp = intel_de_read(display, reg); 679 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 672 680 if (temp & FDI_RX_BIT_LOCK) { 673 - intel_de_write(dev_priv, reg, 681 + intel_de_write(display, reg, 674 682 temp | FDI_RX_BIT_LOCK); 675 - drm_dbg_kms(&dev_priv->drm, 683 + drm_dbg_kms(display->drm, 676 684 "FDI train 1 done.\n"); 677 685 break; 678 686 } ··· 682 690 break; 683 691 } 684 692 if (i == 4) 685 - drm_err(&dev_priv->drm, "FDI train 1 fail!\n"); 693 + drm_err(display->drm, "FDI train 1 fail!\n"); 686 694 687 695 /* Train 2 */ 688 696 reg = FDI_TX_CTL(pipe); 689 - temp = intel_de_read(dev_priv, reg); 697 + temp = intel_de_read(display, reg); 690 698 temp &= ~FDI_LINK_TRAIN_NONE; 691 699 temp |= FDI_LINK_TRAIN_PATTERN_2; 692 - if (IS_SANDYBRIDGE(dev_priv)) { 700 + if (display->platform.sandybridge) { 693 701 temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; 694 702 /* SNB-B */ 695 703 temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B; 696 704 } 697 - intel_de_write(dev_priv, reg, temp); 705 + intel_de_write(display, reg, temp); 698 706 699 707 reg = FDI_RX_CTL(pipe); 700 - temp = intel_de_read(dev_priv, reg); 708 + temp = intel_de_read(display, reg); 701 709 if (HAS_PCH_CPT(dev_priv)) { 702 710 temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 703 711 temp |= FDI_LINK_TRAIN_PATTERN_2_CPT; ··· 705 713 temp &= ~FDI_LINK_TRAIN_NONE; 706 714 temp |= FDI_LINK_TRAIN_PATTERN_2; 707 715 } 708 - intel_de_write(dev_priv, reg, temp); 716 + intel_de_write(display, reg, temp); 709 717 710 - intel_de_posting_read(dev_priv, reg); 718 + intel_de_posting_read(display, reg); 711 719 udelay(150); 712 720 713 721 for (i = 0; i < 4; i++) { 714 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), 722 + intel_de_rmw(display, FDI_TX_CTL(pipe), 715 723 FDI_LINK_TRAIN_VOL_EMP_MASK, snb_b_fdi_train_param[i]); 716 - intel_de_posting_read(dev_priv, FDI_TX_CTL(pipe)); 724 + intel_de_posting_read(display, FDI_TX_CTL(pipe)); 717 725 udelay(500); 718 726 719 727 for (retry = 0; retry < 5; retry++) { 720 728 reg = FDI_RX_IIR(pipe); 721 - temp = intel_de_read(dev_priv, reg); 722 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 729 + temp = intel_de_read(display, reg); 730 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 723 731 if (temp & FDI_RX_SYMBOL_LOCK) { 724 - intel_de_write(dev_priv, reg, 732 + intel_de_write(display, reg, 725 733 temp | FDI_RX_SYMBOL_LOCK); 726 - drm_dbg_kms(&dev_priv->drm, 734 + drm_dbg_kms(display->drm, 727 735 "FDI train 2 done.\n"); 728 736 break; 729 737 } ··· 733 741 break; 734 742 } 735 743 if (i == 4) 736 - drm_err(&dev_priv->drm, "FDI train 2 fail!\n"); 744 + drm_err(display->drm, "FDI train 2 fail!\n"); 737 745 738 - drm_dbg_kms(&dev_priv->drm, "FDI train done.\n"); 746 + drm_dbg_kms(display->drm, "FDI train done.\n"); 739 747 } 740 748 741 749 /* Manual link training for Ivy Bridge A0 parts */ 742 750 static void ivb_manual_fdi_link_train(struct intel_crtc *crtc, 743 751 const struct intel_crtc_state *crtc_state) 744 752 { 745 - struct drm_device *dev = crtc->base.dev; 746 - struct drm_i915_private *dev_priv = to_i915(dev); 753 + struct intel_display *display = to_intel_display(crtc); 747 754 enum pipe pipe = crtc->pipe; 748 755 i915_reg_t reg; 749 756 u32 temp, i, j; ··· 753 762 * Write the TU size bits before fdi link training, so that error 754 763 * detection works. 755 764 */ 756 - intel_de_write(dev_priv, FDI_RX_TUSIZE1(pipe), 757 - intel_de_read(dev_priv, PIPE_DATA_M1(dev_priv, pipe)) & TU_SIZE_MASK); 765 + intel_de_write(display, FDI_RX_TUSIZE1(pipe), 766 + intel_de_read(display, PIPE_DATA_M1(display, pipe)) & TU_SIZE_MASK); 758 767 759 768 /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit 760 769 for train result */ 761 770 reg = FDI_RX_IMR(pipe); 762 - temp = intel_de_read(dev_priv, reg); 771 + temp = intel_de_read(display, reg); 763 772 temp &= ~FDI_RX_SYMBOL_LOCK; 764 773 temp &= ~FDI_RX_BIT_LOCK; 765 - intel_de_write(dev_priv, reg, temp); 774 + intel_de_write(display, reg, temp); 766 775 767 - intel_de_posting_read(dev_priv, reg); 776 + intel_de_posting_read(display, reg); 768 777 udelay(150); 769 778 770 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR before link train 0x%x\n", 771 - intel_de_read(dev_priv, FDI_RX_IIR(pipe))); 779 + drm_dbg_kms(display->drm, "FDI_RX_IIR before link train 0x%x\n", 780 + intel_de_read(display, FDI_RX_IIR(pipe))); 772 781 773 782 /* Try each vswing and preemphasis setting twice before moving on */ 774 783 for (j = 0; j < ARRAY_SIZE(snb_b_fdi_train_param) * 2; j++) { 775 784 /* disable first in case we need to retry */ 776 785 reg = FDI_TX_CTL(pipe); 777 - temp = intel_de_read(dev_priv, reg); 786 + temp = intel_de_read(display, reg); 778 787 temp &= ~(FDI_LINK_TRAIN_AUTO | FDI_LINK_TRAIN_NONE_IVB); 779 788 temp &= ~FDI_TX_ENABLE; 780 - intel_de_write(dev_priv, reg, temp); 789 + intel_de_write(display, reg, temp); 781 790 782 791 reg = FDI_RX_CTL(pipe); 783 - temp = intel_de_read(dev_priv, reg); 792 + temp = intel_de_read(display, reg); 784 793 temp &= ~FDI_LINK_TRAIN_AUTO; 785 794 temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 786 795 temp &= ~FDI_RX_ENABLE; 787 - intel_de_write(dev_priv, reg, temp); 796 + intel_de_write(display, reg, temp); 788 797 789 798 /* enable CPU FDI TX and PCH FDI RX */ 790 799 reg = FDI_TX_CTL(pipe); 791 - temp = intel_de_read(dev_priv, reg); 800 + temp = intel_de_read(display, reg); 792 801 temp &= ~FDI_DP_PORT_WIDTH_MASK; 793 802 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); 794 803 temp |= FDI_LINK_TRAIN_PATTERN_1_IVB; 795 804 temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; 796 805 temp |= snb_b_fdi_train_param[j/2]; 797 806 temp |= FDI_COMPOSITE_SYNC; 798 - intel_de_write(dev_priv, reg, temp | FDI_TX_ENABLE); 807 + intel_de_write(display, reg, temp | FDI_TX_ENABLE); 799 808 800 - intel_de_write(dev_priv, FDI_RX_MISC(pipe), 809 + intel_de_write(display, FDI_RX_MISC(pipe), 801 810 FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90); 802 811 803 812 reg = FDI_RX_CTL(pipe); 804 - temp = intel_de_read(dev_priv, reg); 813 + temp = intel_de_read(display, reg); 805 814 temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; 806 815 temp |= FDI_COMPOSITE_SYNC; 807 - intel_de_write(dev_priv, reg, temp | FDI_RX_ENABLE); 816 + intel_de_write(display, reg, temp | FDI_RX_ENABLE); 808 817 809 - intel_de_posting_read(dev_priv, reg); 818 + intel_de_posting_read(display, reg); 810 819 udelay(1); /* should be 0.5us */ 811 820 812 821 for (i = 0; i < 4; i++) { 813 822 reg = FDI_RX_IIR(pipe); 814 - temp = intel_de_read(dev_priv, reg); 815 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 823 + temp = intel_de_read(display, reg); 824 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 816 825 817 826 if (temp & FDI_RX_BIT_LOCK || 818 - (intel_de_read(dev_priv, reg) & FDI_RX_BIT_LOCK)) { 819 - intel_de_write(dev_priv, reg, 827 + (intel_de_read(display, reg) & FDI_RX_BIT_LOCK)) { 828 + intel_de_write(display, reg, 820 829 temp | FDI_RX_BIT_LOCK); 821 - drm_dbg_kms(&dev_priv->drm, 830 + drm_dbg_kms(display->drm, 822 831 "FDI train 1 done, level %i.\n", 823 832 i); 824 833 break; ··· 826 835 udelay(1); /* should be 0.5us */ 827 836 } 828 837 if (i == 4) { 829 - drm_dbg_kms(&dev_priv->drm, 838 + drm_dbg_kms(display->drm, 830 839 "FDI train 1 fail on vswing %d\n", j / 2); 831 840 continue; 832 841 } 833 842 834 843 /* Train 2 */ 835 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), 844 + intel_de_rmw(display, FDI_TX_CTL(pipe), 836 845 FDI_LINK_TRAIN_NONE_IVB, 837 846 FDI_LINK_TRAIN_PATTERN_2_IVB); 838 - intel_de_rmw(dev_priv, FDI_RX_CTL(pipe), 847 + intel_de_rmw(display, FDI_RX_CTL(pipe), 839 848 FDI_LINK_TRAIN_PATTERN_MASK_CPT, 840 849 FDI_LINK_TRAIN_PATTERN_2_CPT); 841 - intel_de_posting_read(dev_priv, FDI_RX_CTL(pipe)); 850 + intel_de_posting_read(display, FDI_RX_CTL(pipe)); 842 851 udelay(2); /* should be 1.5us */ 843 852 844 853 for (i = 0; i < 4; i++) { 845 854 reg = FDI_RX_IIR(pipe); 846 - temp = intel_de_read(dev_priv, reg); 847 - drm_dbg_kms(&dev_priv->drm, "FDI_RX_IIR 0x%x\n", temp); 855 + temp = intel_de_read(display, reg); 856 + drm_dbg_kms(display->drm, "FDI_RX_IIR 0x%x\n", temp); 848 857 849 858 if (temp & FDI_RX_SYMBOL_LOCK || 850 - (intel_de_read(dev_priv, reg) & FDI_RX_SYMBOL_LOCK)) { 851 - intel_de_write(dev_priv, reg, 859 + (intel_de_read(display, reg) & FDI_RX_SYMBOL_LOCK)) { 860 + intel_de_write(display, reg, 852 861 temp | FDI_RX_SYMBOL_LOCK); 853 - drm_dbg_kms(&dev_priv->drm, 862 + drm_dbg_kms(display->drm, 854 863 "FDI train 2 done, level %i.\n", 855 864 i); 856 865 goto train_done; ··· 858 867 udelay(2); /* should be 1.5us */ 859 868 } 860 869 if (i == 4) 861 - drm_dbg_kms(&dev_priv->drm, 870 + drm_dbg_kms(display->drm, 862 871 "FDI train 2 fail on vswing %d\n", j / 2); 863 872 } 864 873 865 874 train_done: 866 - drm_dbg_kms(&dev_priv->drm, "FDI train done.\n"); 875 + drm_dbg_kms(display->drm, "FDI train done.\n"); 867 876 } 868 877 869 878 /* Starting with Haswell, different DDI ports can work in FDI mode for ··· 877 886 void hsw_fdi_link_train(struct intel_encoder *encoder, 878 887 const struct intel_crtc_state *crtc_state) 879 888 { 880 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 881 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 889 + struct intel_display *display = to_intel_display(crtc_state); 882 890 u32 temp, i, rx_ctl_val; 883 891 int n_entries; 884 892 ··· 892 902 * 893 903 * WaFDIAutoLinkSetTimingOverrride:hsw 894 904 */ 895 - intel_de_write(dev_priv, FDI_RX_MISC(PIPE_A), 905 + intel_de_write(display, FDI_RX_MISC(PIPE_A), 896 906 FDI_RX_PWRDN_LANE1_VAL(2) | 897 907 FDI_RX_PWRDN_LANE0_VAL(2) | 898 908 FDI_RX_TP1_TO_TP2_48 | 899 909 FDI_RX_FDI_DELAY_90); 900 910 901 911 /* Enable the PCH Receiver FDI PLL */ 902 - rx_ctl_val = dev_priv->display.fdi.rx_config | FDI_RX_ENHANCE_FRAME_ENABLE | 912 + rx_ctl_val = display->fdi.rx_config | FDI_RX_ENHANCE_FRAME_ENABLE | 903 913 FDI_RX_PLL_ENABLE | 904 914 FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); 905 - intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), rx_ctl_val); 906 - intel_de_posting_read(dev_priv, FDI_RX_CTL(PIPE_A)); 915 + intel_de_write(display, FDI_RX_CTL(PIPE_A), rx_ctl_val); 916 + intel_de_posting_read(display, FDI_RX_CTL(PIPE_A)); 907 917 udelay(220); 908 918 909 919 /* Switch from Rawclk to PCDclk */ 910 920 rx_ctl_val |= FDI_PCDCLK; 911 - intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), rx_ctl_val); 921 + intel_de_write(display, FDI_RX_CTL(PIPE_A), rx_ctl_val); 912 922 913 923 /* Configure Port Clock Select */ 914 - drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll->info->id != DPLL_ID_SPLL); 924 + drm_WARN_ON(display->drm, crtc_state->shared_dpll->info->id != DPLL_ID_SPLL); 915 925 intel_ddi_enable_clock(encoder, crtc_state); 916 926 917 927 /* Start the training iterating through available voltages and emphasis, 918 928 * testing each value twice. */ 919 929 for (i = 0; i < n_entries * 2; i++) { 920 930 /* Configure DP_TP_CTL with auto-training */ 921 - intel_de_write(dev_priv, DP_TP_CTL(PORT_E), 931 + intel_de_write(display, DP_TP_CTL(PORT_E), 922 932 DP_TP_CTL_FDI_AUTOTRAIN | 923 933 DP_TP_CTL_ENHANCED_FRAME_ENABLE | 924 934 DP_TP_CTL_LINK_TRAIN_PAT1 | ··· 928 938 * DDI E does not support port reversal, the functionality is 929 939 * achieved on the PCH side in FDI_RX_CTL, so no need to set the 930 940 * port reversal bit */ 931 - intel_de_write(dev_priv, DDI_BUF_CTL(PORT_E), 941 + intel_de_write(display, DDI_BUF_CTL(PORT_E), 932 942 DDI_BUF_CTL_ENABLE | 933 943 ((crtc_state->fdi_lanes - 1) << 1) | 934 944 DDI_BUF_TRANS_SELECT(i / 2)); 935 - intel_de_posting_read(dev_priv, DDI_BUF_CTL(PORT_E)); 945 + intel_de_posting_read(display, DDI_BUF_CTL(PORT_E)); 936 946 937 947 udelay(600); 938 948 939 949 /* Program PCH FDI Receiver TU */ 940 - intel_de_write(dev_priv, FDI_RX_TUSIZE1(PIPE_A), TU_SIZE(64)); 950 + intel_de_write(display, FDI_RX_TUSIZE1(PIPE_A), TU_SIZE(64)); 941 951 942 952 /* Enable PCH FDI Receiver with auto-training */ 943 953 rx_ctl_val |= FDI_RX_ENABLE | FDI_LINK_TRAIN_AUTO; 944 - intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), rx_ctl_val); 945 - intel_de_posting_read(dev_priv, FDI_RX_CTL(PIPE_A)); 954 + intel_de_write(display, FDI_RX_CTL(PIPE_A), rx_ctl_val); 955 + intel_de_posting_read(display, FDI_RX_CTL(PIPE_A)); 946 956 947 957 /* Wait for FDI receiver lane calibration */ 948 958 udelay(30); 949 959 950 960 /* Unset FDI_RX_MISC pwrdn lanes */ 951 - intel_de_rmw(dev_priv, FDI_RX_MISC(PIPE_A), 961 + intel_de_rmw(display, FDI_RX_MISC(PIPE_A), 952 962 FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK, 0); 953 - intel_de_posting_read(dev_priv, FDI_RX_MISC(PIPE_A)); 963 + intel_de_posting_read(display, FDI_RX_MISC(PIPE_A)); 954 964 955 965 /* Wait for FDI auto training time */ 956 966 udelay(5); 957 967 958 - temp = intel_de_read(dev_priv, DP_TP_STATUS(PORT_E)); 968 + temp = intel_de_read(display, DP_TP_STATUS(PORT_E)); 959 969 if (temp & DP_TP_STATUS_AUTOTRAIN_DONE) { 960 - drm_dbg_kms(&dev_priv->drm, 970 + drm_dbg_kms(display->drm, 961 971 "FDI link training done on step %d\n", i); 962 972 break; 963 973 } ··· 967 977 * Results in less fireworks from the state checker. 968 978 */ 969 979 if (i == n_entries * 2 - 1) { 970 - drm_err(&dev_priv->drm, "FDI link training failed!\n"); 980 + drm_err(display->drm, "FDI link training failed!\n"); 971 981 break; 972 982 } 973 983 974 984 rx_ctl_val &= ~FDI_RX_ENABLE; 975 - intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), rx_ctl_val); 976 - intel_de_posting_read(dev_priv, FDI_RX_CTL(PIPE_A)); 985 + intel_de_write(display, FDI_RX_CTL(PIPE_A), rx_ctl_val); 986 + intel_de_posting_read(display, FDI_RX_CTL(PIPE_A)); 977 987 978 - intel_de_rmw(dev_priv, DDI_BUF_CTL(PORT_E), DDI_BUF_CTL_ENABLE, 0); 979 - intel_de_posting_read(dev_priv, DDI_BUF_CTL(PORT_E)); 988 + intel_de_rmw(display, DDI_BUF_CTL(PORT_E), DDI_BUF_CTL_ENABLE, 0); 989 + intel_de_posting_read(display, DDI_BUF_CTL(PORT_E)); 980 990 981 991 /* Disable DP_TP_CTL and FDI_RX_CTL and retry */ 982 - intel_de_rmw(dev_priv, DP_TP_CTL(PORT_E), DP_TP_CTL_ENABLE, 0); 983 - intel_de_posting_read(dev_priv, DP_TP_CTL(PORT_E)); 992 + intel_de_rmw(display, DP_TP_CTL(PORT_E), DP_TP_CTL_ENABLE, 0); 993 + intel_de_posting_read(display, DP_TP_CTL(PORT_E)); 984 994 985 - intel_wait_ddi_buf_idle(dev_priv, PORT_E); 995 + intel_wait_ddi_buf_idle(display, PORT_E); 986 996 987 997 /* Reset FDI_RX_MISC pwrdn lanes */ 988 - intel_de_rmw(dev_priv, FDI_RX_MISC(PIPE_A), 998 + intel_de_rmw(display, FDI_RX_MISC(PIPE_A), 989 999 FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK, 990 1000 FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2)); 991 - intel_de_posting_read(dev_priv, FDI_RX_MISC(PIPE_A)); 1001 + intel_de_posting_read(display, FDI_RX_MISC(PIPE_A)); 992 1002 } 993 1003 994 1004 /* Enable normal pixel sending for FDI */ 995 - intel_de_write(dev_priv, DP_TP_CTL(PORT_E), 1005 + intel_de_write(display, DP_TP_CTL(PORT_E), 996 1006 DP_TP_CTL_FDI_AUTOTRAIN | 997 1007 DP_TP_CTL_LINK_TRAIN_NORMAL | 998 1008 DP_TP_CTL_ENHANCED_FRAME_ENABLE | ··· 1001 1011 1002 1012 void hsw_fdi_disable(struct intel_encoder *encoder) 1003 1013 { 1004 - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 1014 + struct intel_display *display = to_intel_display(encoder); 1005 1015 1006 1016 /* 1007 1017 * Bspec lists this as both step 13 (before DDI_BUF_CTL disable) ··· 1009 1019 * step 13 is the correct place for it. Step 18 is where it was 1010 1020 * originally before the BUN. 1011 1021 */ 1012 - intel_de_rmw(dev_priv, FDI_RX_CTL(PIPE_A), FDI_RX_ENABLE, 0); 1013 - intel_de_rmw(dev_priv, DDI_BUF_CTL(PORT_E), DDI_BUF_CTL_ENABLE, 0); 1014 - intel_wait_ddi_buf_idle(dev_priv, PORT_E); 1022 + intel_de_rmw(display, FDI_RX_CTL(PIPE_A), FDI_RX_ENABLE, 0); 1023 + intel_de_rmw(display, DDI_BUF_CTL(PORT_E), DDI_BUF_CTL_ENABLE, 0); 1024 + intel_wait_ddi_buf_idle(display, PORT_E); 1015 1025 intel_ddi_disable_clock(encoder); 1016 - intel_de_rmw(dev_priv, FDI_RX_MISC(PIPE_A), 1026 + intel_de_rmw(display, FDI_RX_MISC(PIPE_A), 1017 1027 FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK, 1018 1028 FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2)); 1019 - intel_de_rmw(dev_priv, FDI_RX_CTL(PIPE_A), FDI_PCDCLK, 0); 1020 - intel_de_rmw(dev_priv, FDI_RX_CTL(PIPE_A), FDI_RX_PLL_ENABLE, 0); 1029 + intel_de_rmw(display, FDI_RX_CTL(PIPE_A), FDI_PCDCLK, 0); 1030 + intel_de_rmw(display, FDI_RX_CTL(PIPE_A), FDI_RX_PLL_ENABLE, 0); 1021 1031 } 1022 1032 1023 1033 void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state) 1024 1034 { 1035 + struct intel_display *display = to_intel_display(crtc_state); 1025 1036 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1026 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1027 1037 enum pipe pipe = crtc->pipe; 1028 1038 i915_reg_t reg; 1029 1039 u32 temp; 1030 1040 1031 1041 /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ 1032 1042 reg = FDI_RX_CTL(pipe); 1033 - temp = intel_de_read(dev_priv, reg); 1043 + temp = intel_de_read(display, reg); 1034 1044 temp &= ~(FDI_DP_PORT_WIDTH_MASK | (0x7 << 16)); 1035 1045 temp |= FDI_DP_PORT_WIDTH(crtc_state->fdi_lanes); 1036 - temp |= (intel_de_read(dev_priv, TRANSCONF(dev_priv, pipe)) & TRANSCONF_BPC_MASK) << 11; 1037 - intel_de_write(dev_priv, reg, temp | FDI_RX_PLL_ENABLE); 1046 + temp |= (intel_de_read(display, TRANSCONF(display, pipe)) & TRANSCONF_BPC_MASK) << 11; 1047 + intel_de_write(display, reg, temp | FDI_RX_PLL_ENABLE); 1038 1048 1039 - intel_de_posting_read(dev_priv, reg); 1049 + intel_de_posting_read(display, reg); 1040 1050 udelay(200); 1041 1051 1042 1052 /* Switch from Rawclk to PCDclk */ 1043 - intel_de_rmw(dev_priv, reg, 0, FDI_PCDCLK); 1044 - intel_de_posting_read(dev_priv, reg); 1053 + intel_de_rmw(display, reg, 0, FDI_PCDCLK); 1054 + intel_de_posting_read(display, reg); 1045 1055 udelay(200); 1046 1056 1047 1057 /* Enable CPU FDI TX PLL, always on for Ironlake */ 1048 1058 reg = FDI_TX_CTL(pipe); 1049 - temp = intel_de_read(dev_priv, reg); 1059 + temp = intel_de_read(display, reg); 1050 1060 if ((temp & FDI_TX_PLL_ENABLE) == 0) { 1051 - intel_de_write(dev_priv, reg, temp | FDI_TX_PLL_ENABLE); 1061 + intel_de_write(display, reg, temp | FDI_TX_PLL_ENABLE); 1052 1062 1053 - intel_de_posting_read(dev_priv, reg); 1063 + intel_de_posting_read(display, reg); 1054 1064 udelay(100); 1055 1065 } 1056 1066 } 1057 1067 1058 1068 void ilk_fdi_pll_disable(struct intel_crtc *crtc) 1059 1069 { 1060 - struct drm_device *dev = crtc->base.dev; 1061 - struct drm_i915_private *dev_priv = to_i915(dev); 1070 + struct intel_display *display = to_intel_display(crtc); 1062 1071 enum pipe pipe = crtc->pipe; 1063 1072 1064 1073 /* Switch from PCDclk to Rawclk */ 1065 - intel_de_rmw(dev_priv, FDI_RX_CTL(pipe), FDI_PCDCLK, 0); 1074 + intel_de_rmw(display, FDI_RX_CTL(pipe), FDI_PCDCLK, 0); 1066 1075 1067 1076 /* Disable CPU FDI TX PLL */ 1068 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), FDI_TX_PLL_ENABLE, 0); 1069 - intel_de_posting_read(dev_priv, FDI_TX_CTL(pipe)); 1077 + intel_de_rmw(display, FDI_TX_CTL(pipe), FDI_TX_PLL_ENABLE, 0); 1078 + intel_de_posting_read(display, FDI_TX_CTL(pipe)); 1070 1079 udelay(100); 1071 1080 1072 1081 /* Wait for the clocks to turn off. */ 1073 - intel_de_rmw(dev_priv, FDI_RX_CTL(pipe), FDI_RX_PLL_ENABLE, 0); 1074 - intel_de_posting_read(dev_priv, FDI_RX_CTL(pipe)); 1082 + intel_de_rmw(display, FDI_RX_CTL(pipe), FDI_RX_PLL_ENABLE, 0); 1083 + intel_de_posting_read(display, FDI_RX_CTL(pipe)); 1075 1084 udelay(100); 1076 1085 } 1077 1086 1078 1087 void ilk_fdi_disable(struct intel_crtc *crtc) 1079 1088 { 1089 + struct intel_display *display = to_intel_display(crtc); 1080 1090 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1081 1091 enum pipe pipe = crtc->pipe; 1082 1092 i915_reg_t reg; 1083 1093 u32 temp; 1084 1094 1085 1095 /* disable CPU FDI tx and PCH FDI rx */ 1086 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), FDI_TX_ENABLE, 0); 1087 - intel_de_posting_read(dev_priv, FDI_TX_CTL(pipe)); 1096 + intel_de_rmw(display, FDI_TX_CTL(pipe), FDI_TX_ENABLE, 0); 1097 + intel_de_posting_read(display, FDI_TX_CTL(pipe)); 1088 1098 1089 1099 reg = FDI_RX_CTL(pipe); 1090 - temp = intel_de_read(dev_priv, reg); 1100 + temp = intel_de_read(display, reg); 1091 1101 temp &= ~(0x7 << 16); 1092 - temp |= (intel_de_read(dev_priv, TRANSCONF(dev_priv, pipe)) & TRANSCONF_BPC_MASK) << 11; 1093 - intel_de_write(dev_priv, reg, temp & ~FDI_RX_ENABLE); 1102 + temp |= (intel_de_read(display, TRANSCONF(display, pipe)) & TRANSCONF_BPC_MASK) << 11; 1103 + intel_de_write(display, reg, temp & ~FDI_RX_ENABLE); 1094 1104 1095 - intel_de_posting_read(dev_priv, reg); 1105 + intel_de_posting_read(display, reg); 1096 1106 udelay(100); 1097 1107 1098 1108 /* Ironlake workaround, disable clock pointer after downing FDI */ 1099 1109 if (HAS_PCH_IBX(dev_priv)) 1100 - intel_de_write(dev_priv, FDI_RX_CHICKEN(pipe), 1110 + intel_de_write(display, FDI_RX_CHICKEN(pipe), 1101 1111 FDI_RX_PHASE_SYNC_POINTER_OVR); 1102 1112 1103 1113 /* still set train pattern 1 */ 1104 - intel_de_rmw(dev_priv, FDI_TX_CTL(pipe), 1114 + intel_de_rmw(display, FDI_TX_CTL(pipe), 1105 1115 FDI_LINK_TRAIN_NONE, FDI_LINK_TRAIN_PATTERN_1); 1106 1116 1107 1117 reg = FDI_RX_CTL(pipe); 1108 - temp = intel_de_read(dev_priv, reg); 1118 + temp = intel_de_read(display, reg); 1109 1119 if (HAS_PCH_CPT(dev_priv)) { 1110 1120 temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; 1111 1121 temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; ··· 1115 1125 } 1116 1126 /* BPC in FDI rx is consistent with that in TRANSCONF */ 1117 1127 temp &= ~(0x07 << 16); 1118 - temp |= (intel_de_read(dev_priv, TRANSCONF(dev_priv, pipe)) & TRANSCONF_BPC_MASK) << 11; 1119 - intel_de_write(dev_priv, reg, temp); 1128 + temp |= (intel_de_read(display, TRANSCONF(display, pipe)) & TRANSCONF_BPC_MASK) << 11; 1129 + intel_de_write(display, reg, temp); 1120 1130 1121 - intel_de_posting_read(dev_priv, reg); 1131 + intel_de_posting_read(display, reg); 1122 1132 udelay(100); 1123 1133 } 1124 1134 ··· 1135 1145 }; 1136 1146 1137 1147 void 1138 - intel_fdi_init_hook(struct drm_i915_private *dev_priv) 1148 + intel_fdi_init_hook(struct intel_display *display) 1139 1149 { 1140 - if (IS_IRONLAKE(dev_priv)) { 1141 - dev_priv->display.funcs.fdi = &ilk_funcs; 1142 - } else if (IS_SANDYBRIDGE(dev_priv)) { 1143 - dev_priv->display.funcs.fdi = &gen6_funcs; 1144 - } else if (IS_IVYBRIDGE(dev_priv)) { 1150 + if (display->platform.ironlake) { 1151 + display->funcs.fdi = &ilk_funcs; 1152 + } else if (display->platform.sandybridge) { 1153 + display->funcs.fdi = &gen6_funcs; 1154 + } else if (display->platform.ivybridge) { 1145 1155 /* FIXME: detect B0+ stepping and use auto training */ 1146 - dev_priv->display.funcs.fdi = &ivb_funcs; 1156 + display->funcs.fdi = &ivb_funcs; 1147 1157 } 1148 1158 }
+8 -8
drivers/gpu/drm/i915/display/intel_fdi.h
··· 9 9 #include <linux/types.h> 10 10 11 11 enum pipe; 12 - struct drm_i915_private; 13 12 struct intel_atomic_state; 14 13 struct intel_crtc; 15 14 struct intel_crtc_state; 15 + struct intel_display; 16 16 struct intel_display; 17 17 struct intel_encoder; 18 18 struct intel_link_bw_limits; 19 19 20 20 int intel_fdi_add_affected_crtcs(struct intel_atomic_state *state); 21 - int intel_fdi_link_freq(struct drm_i915_private *i915, 21 + int intel_fdi_link_freq(struct intel_display *display, 22 22 const struct intel_crtc_state *pipe_config); 23 23 bool intel_fdi_compute_pipe_bpp(struct intel_crtc_state *crtc_state); 24 24 int ilk_fdi_compute_config(struct intel_crtc *intel_crtc, ··· 29 29 void ilk_fdi_disable(struct intel_crtc *crtc); 30 30 void ilk_fdi_pll_disable(struct intel_crtc *intel_crtc); 31 31 void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state); 32 - void intel_fdi_init_hook(struct drm_i915_private *dev_priv); 32 + void intel_fdi_init_hook(struct intel_display *display); 33 33 void hsw_fdi_link_train(struct intel_encoder *encoder, 34 34 const struct intel_crtc_state *crtc_state); 35 35 void hsw_fdi_disable(struct intel_encoder *encoder); 36 - void intel_fdi_pll_freq_update(struct drm_i915_private *i915); 36 + void intel_fdi_pll_freq_update(struct intel_display *display); 37 37 38 38 void intel_fdi_link_train(struct intel_crtc *crtc, 39 39 const struct intel_crtc_state *crtc_state); 40 40 41 - void assert_fdi_tx_enabled(struct drm_i915_private *i915, enum pipe pipe); 42 - void assert_fdi_tx_disabled(struct drm_i915_private *i915, enum pipe pipe); 43 - void assert_fdi_rx_enabled(struct drm_i915_private *i915, enum pipe pipe); 44 - void assert_fdi_rx_disabled(struct drm_i915_private *i915, enum pipe pipe); 41 + void assert_fdi_tx_enabled(struct intel_display *display, enum pipe pipe); 42 + void assert_fdi_tx_disabled(struct intel_display *display, enum pipe pipe); 43 + void assert_fdi_rx_enabled(struct intel_display *display, enum pipe pipe); 44 + void assert_fdi_rx_disabled(struct intel_display *display, enum pipe pipe); 45 45 void assert_fdi_tx_pll_enabled(struct intel_display *display, enum pipe pipe); 46 46 void assert_fdi_rx_pll_enabled(struct intel_display *display, enum pipe pipe); 47 47 void assert_fdi_rx_pll_disabled(struct intel_display *display, enum pipe pipe);
+6 -6
drivers/gpu/drm/i915/display/intel_frontbuffer.c
··· 59 59 60 60 #include "i915_active.h" 61 61 #include "i915_drv.h" 62 + #include "i915_vma.h" 62 63 #include "intel_bo.h" 63 64 #include "intel_display_trace.h" 64 65 #include "intel_display_types.h" ··· 99 98 trace_intel_frontbuffer_flush(display, frontbuffer_bits, origin); 100 99 101 100 might_sleep(); 102 - intel_td_flush(i915); 103 - intel_drrs_flush(i915, frontbuffer_bits); 101 + intel_td_flush(display); 102 + intel_drrs_flush(display, frontbuffer_bits); 104 103 intel_psr_flush(display, frontbuffer_bits, origin); 105 - intel_fbc_flush(i915, frontbuffer_bits, origin); 104 + intel_fbc_flush(display, frontbuffer_bits, origin); 106 105 } 107 106 108 107 /** ··· 177 176 unsigned int frontbuffer_bits) 178 177 { 179 178 struct intel_display *display = to_intel_display(front->obj->dev); 180 - struct drm_i915_private *i915 = to_i915(display->drm); 181 179 182 180 if (origin == ORIGIN_CS) { 183 181 spin_lock(&display->fb_tracking.lock); ··· 189 189 190 190 might_sleep(); 191 191 intel_psr_invalidate(display, frontbuffer_bits, origin); 192 - intel_drrs_invalidate(i915, frontbuffer_bits); 193 - intel_fbc_invalidate(i915, frontbuffer_bits, origin); 192 + intel_drrs_invalidate(display, frontbuffer_bits); 193 + intel_fbc_invalidate(display, frontbuffer_bits, origin); 194 194 } 195 195 196 196 void __intel_fb_flush(struct intel_frontbuffer *front,
+47 -47
drivers/gpu/drm/i915/display/intel_hdcp.c
··· 70 70 int vcpi = 0; 71 71 72 72 /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */ 73 - if (!connector->port) 73 + if (!connector->mst.port) 74 74 return 0; 75 - mgr = connector->port->mgr; 75 + mgr = connector->mst.port->mgr; 76 76 77 77 drm_modeset_lock(&mgr->base.lock, state->base.acquire_ctx); 78 78 mst_state = to_drm_dp_mst_topology_state(mgr->base.state); 79 - payload = drm_atomic_get_mst_payload_state(mst_state, connector->port); 79 + payload = drm_atomic_get_mst_payload_state(mst_state, connector->mst.port); 80 80 if (drm_WARN_ON(mgr->dev, !payload)) 81 81 goto out; 82 82 ··· 107 107 struct drm_connector_list_iter conn_iter; 108 108 struct intel_digital_port *conn_dig_port; 109 109 struct intel_connector *connector; 110 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 110 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 111 111 bool enforce_type0 = false; 112 112 int k; 113 113 114 - if (dig_port->hdcp_auth_status) 114 + if (dig_port->hdcp.auth_status) 115 115 return 0; 116 116 117 117 data->k = 0; 118 118 119 - if (!dig_port->hdcp_mst_type1_capable) 119 + if (!dig_port->hdcp.mst_type1_capable) 120 120 enforce_type0 = true; 121 121 122 122 drm_connector_list_iter_begin(display->drm, &conn_iter); ··· 136 136 data->k++; 137 137 138 138 /* if there is only one active stream */ 139 - if (dig_port->dp.active_mst_links <= 1) 139 + if (dig_port->dp.mst.active_links <= 1) 140 140 break; 141 141 } 142 142 drm_connector_list_iter_end(&conn_iter); ··· 159 159 struct intel_connector *connector) 160 160 { 161 161 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 162 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 162 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 163 163 struct intel_hdcp *hdcp = &connector->hdcp; 164 164 165 165 if (intel_encoder_is_mst(intel_attached_encoder(connector))) ··· 1001 1001 * don't disable it until it disabled HDCP encryption for 1002 1002 * all connectors in MST topology. 1003 1003 */ 1004 - if (dig_port->num_hdcp_streams > 0) 1004 + if (dig_port->hdcp.num_streams > 0) 1005 1005 return 0; 1006 1006 } 1007 1007 ··· 1094 1094 if (hdcp->value == value) 1095 1095 return; 1096 1096 1097 - drm_WARN_ON(display->drm, !mutex_is_locked(&dig_port->hdcp_mutex)); 1097 + drm_WARN_ON(display->drm, !mutex_is_locked(&dig_port->hdcp.mutex)); 1098 1098 1099 1099 if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED) { 1100 - if (!drm_WARN_ON(display->drm, dig_port->num_hdcp_streams == 0)) 1101 - dig_port->num_hdcp_streams--; 1100 + if (!drm_WARN_ON(display->drm, dig_port->hdcp.num_streams == 0)) 1101 + dig_port->hdcp.num_streams--; 1102 1102 } else if (value == DRM_MODE_CONTENT_PROTECTION_ENABLED) { 1103 - dig_port->num_hdcp_streams++; 1103 + dig_port->hdcp.num_streams++; 1104 1104 } 1105 1105 1106 1106 hdcp->value = value; ··· 1122 1122 int ret = 0; 1123 1123 1124 1124 mutex_lock(&hdcp->mutex); 1125 - mutex_lock(&dig_port->hdcp_mutex); 1125 + mutex_lock(&dig_port->hdcp.mutex); 1126 1126 1127 1127 cpu_transcoder = hdcp->cpu_transcoder; 1128 1128 ··· 1177 1177 } 1178 1178 1179 1179 out: 1180 - mutex_unlock(&dig_port->hdcp_mutex); 1180 + mutex_unlock(&dig_port->hdcp.mutex); 1181 1181 mutex_unlock(&hdcp->mutex); 1182 1182 return ret; 1183 1183 } ··· 1219 1219 { 1220 1220 struct intel_display *display = to_intel_display(connector); 1221 1221 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1222 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1222 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1223 1223 struct i915_hdcp_arbiter *arbiter; 1224 1224 int ret; 1225 1225 ··· 1249 1249 { 1250 1250 struct intel_display *display = to_intel_display(connector); 1251 1251 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1252 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1252 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1253 1253 struct i915_hdcp_arbiter *arbiter; 1254 1254 int ret; 1255 1255 ··· 1277 1277 { 1278 1278 struct intel_display *display = to_intel_display(connector); 1279 1279 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1280 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1280 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1281 1281 struct i915_hdcp_arbiter *arbiter; 1282 1282 int ret; 1283 1283 ··· 1303 1303 { 1304 1304 struct intel_display *display = to_intel_display(connector); 1305 1305 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1306 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1306 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1307 1307 struct i915_hdcp_arbiter *arbiter; 1308 1308 int ret; 1309 1309 ··· 1330 1330 { 1331 1331 struct intel_display *display = to_intel_display(connector); 1332 1332 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1333 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1333 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1334 1334 struct i915_hdcp_arbiter *arbiter; 1335 1335 int ret; 1336 1336 ··· 1357 1357 { 1358 1358 struct intel_display *display = to_intel_display(connector); 1359 1359 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1360 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1360 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1361 1361 struct i915_hdcp_arbiter *arbiter; 1362 1362 int ret; 1363 1363 ··· 1383 1383 { 1384 1384 struct intel_display *display = to_intel_display(connector); 1385 1385 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1386 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1386 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1387 1387 struct i915_hdcp_arbiter *arbiter; 1388 1388 int ret; 1389 1389 ··· 1412 1412 { 1413 1413 struct intel_display *display = to_intel_display(connector); 1414 1414 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1415 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1415 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1416 1416 struct i915_hdcp_arbiter *arbiter; 1417 1417 int ret; 1418 1418 ··· 1442 1442 { 1443 1443 struct intel_display *display = to_intel_display(connector); 1444 1444 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1445 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1445 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1446 1446 struct i915_hdcp_arbiter *arbiter; 1447 1447 int ret; 1448 1448 ··· 1466 1466 { 1467 1467 struct intel_display *display = to_intel_display(connector); 1468 1468 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1469 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1469 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1470 1470 struct i915_hdcp_arbiter *arbiter; 1471 1471 int ret; 1472 1472 ··· 1503 1503 } 1504 1504 1505 1505 ret = arbiter->ops->close_hdcp_session(arbiter->hdcp_dev, 1506 - &dig_port->hdcp_port_data); 1506 + &dig_port->hdcp.port_data); 1507 1507 mutex_unlock(&display->hdcp.hdcp_mutex); 1508 1508 1509 1509 return ret; ··· 1691 1691 int _hdcp2_propagate_stream_management_info(struct intel_connector *connector) 1692 1692 { 1693 1693 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1694 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1694 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1695 1695 struct intel_hdcp *hdcp = &connector->hdcp; 1696 1696 union { 1697 1697 struct hdcp2_rep_stream_manage stream_manage; ··· 1769 1769 * MST topology is not Type 1 capable if it contains a downstream 1770 1770 * device that is only HDCP 1.x or Legacy HDCP 2.0/2.1 compliant. 1771 1771 */ 1772 - dig_port->hdcp_mst_type1_capable = 1772 + dig_port->hdcp.mst_type1_capable = 1773 1773 !HDCP_2_2_HDCP1_DEVICE_CONNECTED(rx_info[1]) && 1774 1774 !HDCP_2_2_HDCP_2_0_REP_CONNECTED(rx_info[1]); 1775 1775 1776 - if (!dig_port->hdcp_mst_type1_capable && hdcp->content_type) { 1776 + if (!dig_port->hdcp.mst_type1_capable && hdcp->content_type) { 1777 1777 drm_dbg_kms(display->drm, 1778 1778 "HDCP1.x or 2.0 Legacy Device Downstream\n"); 1779 1779 return -EINVAL; ··· 1869 1869 { 1870 1870 struct intel_display *display = to_intel_display(connector); 1871 1871 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 1872 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 1872 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 1873 1873 struct intel_hdcp *hdcp = &connector->hdcp; 1874 1874 enum transcoder cpu_transcoder = hdcp->cpu_transcoder; 1875 1875 enum port port = dig_port->base.port; ··· 1900 1900 if (hdcp2_deauthenticate_port(connector) < 0) 1901 1901 drm_dbg_kms(display->drm, "Port deauth failed.\n"); 1902 1902 1903 - dig_port->hdcp_auth_status = false; 1903 + dig_port->hdcp.auth_status = false; 1904 1904 data->k = 0; 1905 1905 1906 1906 return ret; ··· 1940 1940 port), 1941 1941 LINK_ENCRYPTION_STATUS, 1942 1942 HDCP_ENCRYPT_STATUS_CHANGE_TIMEOUT_MS); 1943 - dig_port->hdcp_auth_status = true; 1943 + dig_port->hdcp.auth_status = true; 1944 1944 1945 1945 return ret; 1946 1946 } ··· 2019 2019 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 2020 2020 int ret = 0, i, tries = 3; 2021 2021 2022 - for (i = 0; i < tries && !dig_port->hdcp_auth_status; i++) { 2022 + for (i = 0; i < tries && !dig_port->hdcp.auth_status; i++) { 2023 2023 ret = hdcp2_authenticate_sink(connector); 2024 2024 if (!ret) { 2025 2025 ret = intel_hdcp_prepare_streams(state, connector); ··· 2052 2052 drm_dbg_kms(display->drm, "Port deauth failed.\n"); 2053 2053 } 2054 2054 2055 - if (!ret && !dig_port->hdcp_auth_status) { 2055 + if (!ret && !dig_port->hdcp.auth_status) { 2056 2056 /* 2057 2057 * Ensuring the required 200mSec min time interval between 2058 2058 * Session Key Exchange and encryption. ··· 2106 2106 { 2107 2107 struct intel_display *display = to_intel_display(connector); 2108 2108 struct intel_digital_port *dig_port = intel_attached_dig_port(connector); 2109 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 2109 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 2110 2110 struct intel_hdcp *hdcp = &connector->hdcp; 2111 2111 int ret; 2112 2112 ··· 2123 2123 drm_dbg_kms(display->drm, "HDCP 2.2 transcoder: %s stream encryption disabled\n", 2124 2124 transcoder_name(hdcp->stream_transcoder)); 2125 2125 2126 - if (dig_port->num_hdcp_streams > 0 && !hdcp2_link_recovery) 2126 + if (dig_port->hdcp.num_streams > 0 && !hdcp2_link_recovery) 2127 2127 return 0; 2128 2128 } 2129 2129 ··· 2133 2133 drm_dbg_kms(display->drm, "Port deauth failed.\n"); 2134 2134 2135 2135 connector->hdcp.hdcp2_encrypted = false; 2136 - dig_port->hdcp_auth_status = false; 2136 + dig_port->hdcp.auth_status = false; 2137 2137 data->k = 0; 2138 2138 2139 2139 return ret; ··· 2150 2150 int ret = 0; 2151 2151 2152 2152 mutex_lock(&hdcp->mutex); 2153 - mutex_lock(&dig_port->hdcp_mutex); 2153 + mutex_lock(&dig_port->hdcp.mutex); 2154 2154 cpu_transcoder = hdcp->cpu_transcoder; 2155 2155 2156 2156 /* hdcp2_check_link is expected only when HDCP2.2 is Enabled */ ··· 2221 2221 intel_hdcp_update_value(connector, 2222 2222 DRM_MODE_CONTENT_PROTECTION_DESIRED, true); 2223 2223 out: 2224 - mutex_unlock(&dig_port->hdcp_mutex); 2224 + mutex_unlock(&dig_port->hdcp.mutex); 2225 2225 mutex_unlock(&hdcp->mutex); 2226 2226 return ret; 2227 2227 } ··· 2303 2303 const struct intel_hdcp_shim *shim) 2304 2304 { 2305 2305 struct intel_display *display = to_intel_display(connector); 2306 - struct hdcp_port_data *data = &dig_port->hdcp_port_data; 2306 + struct hdcp_port_data *data = &dig_port->hdcp.port_data; 2307 2307 enum port port = dig_port->base.port; 2308 2308 2309 2309 if (DISPLAY_VER(display) < 12) ··· 2414 2414 hdcp->hdcp2_supported); 2415 2415 if (ret) { 2416 2416 hdcp->hdcp2_supported = false; 2417 - kfree(dig_port->hdcp_port_data.streams); 2417 + kfree(dig_port->hdcp.port_data.streams); 2418 2418 return ret; 2419 2419 } 2420 2420 ··· 2451 2451 } 2452 2452 2453 2453 mutex_lock(&hdcp->mutex); 2454 - mutex_lock(&dig_port->hdcp_mutex); 2454 + mutex_lock(&dig_port->hdcp.mutex); 2455 2455 drm_WARN_ON(display->drm, 2456 2456 hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); 2457 2457 hdcp->content_type = (u8)conn_state->hdcp_content_type; ··· 2465 2465 } 2466 2466 2467 2467 if (DISPLAY_VER(display) >= 12) 2468 - dig_port->hdcp_port_data.hdcp_transcoder = 2468 + dig_port->hdcp.port_data.hdcp_transcoder = 2469 2469 intel_get_hdcp_transcoder(hdcp->cpu_transcoder); 2470 2470 2471 2471 /* ··· 2499 2499 true); 2500 2500 } 2501 2501 2502 - mutex_unlock(&dig_port->hdcp_mutex); 2502 + mutex_unlock(&dig_port->hdcp.mutex); 2503 2503 mutex_unlock(&hdcp->mutex); 2504 2504 return ret; 2505 2505 } ··· 2535 2535 return -ENOENT; 2536 2536 2537 2537 mutex_lock(&hdcp->mutex); 2538 - mutex_lock(&dig_port->hdcp_mutex); 2538 + mutex_lock(&dig_port->hdcp.mutex); 2539 2539 2540 2540 if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) 2541 2541 goto out; ··· 2548 2548 ret = _intel_hdcp_disable(connector); 2549 2549 2550 2550 out: 2551 - mutex_unlock(&dig_port->hdcp_mutex); 2551 + mutex_unlock(&dig_port->hdcp.mutex); 2552 2552 mutex_unlock(&hdcp->mutex); 2553 2553 cancel_delayed_work_sync(&hdcp->check_work); 2554 2554 return ret; ··· 2775 2775 void intel_hdcp_info(struct seq_file *m, struct intel_connector *connector) 2776 2776 { 2777 2777 seq_puts(m, "\tHDCP version: "); 2778 - if (connector->mst_port) { 2778 + if (connector->mst.dp) { 2779 2779 __intel_hdcp_info(m, connector, true); 2780 2780 seq_puts(m, "\tMST Hub HDCP version: "); 2781 2781 }
+1 -1
drivers/gpu/drm/i915/display/intel_hdmi.c
··· 2360 2360 } 2361 2361 2362 2362 if (intel_hdmi_is_ycbcr420(pipe_config)) { 2363 - ret = intel_panel_fitting(pipe_config, conn_state); 2363 + ret = intel_pfit_compute_config(pipe_config, conn_state); 2364 2364 if (ret) 2365 2365 return ret; 2366 2366 }
-1
drivers/gpu/drm/i915/display/intel_hdmi.h
··· 14 14 struct drm_connector; 15 15 struct drm_connector_state; 16 16 struct drm_encoder; 17 - struct drm_i915_private; 18 17 struct intel_connector; 19 18 struct intel_crtc_state; 20 19 struct intel_digital_port;
+2 -1
drivers/gpu/drm/i915/display/intel_lvds.c
··· 53 53 #include "intel_lvds_regs.h" 54 54 #include "intel_panel.h" 55 55 #include "intel_pfit.h" 56 + #include "intel_pfit_regs.h" 56 57 #include "intel_pps_regs.h" 57 58 58 59 /* Private structure for the integrated LVDS support */ ··· 469 468 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) 470 469 return -EINVAL; 471 470 472 - ret = intel_panel_fitting(crtc_state, conn_state); 471 + ret = intel_pfit_compute_config(crtc_state, conn_state); 473 472 if (ret) 474 473 return ret; 475 474
+14 -41
drivers/gpu/drm/i915/display/intel_modeset_setup.c
··· 156 156 { 157 157 struct intel_display *display = to_intel_display(crtc); 158 158 struct drm_i915_private *i915 = to_i915(crtc->base.dev); 159 - struct intel_bw_state *bw_state = 160 - to_intel_bw_state(i915->display.bw.obj.state); 161 - struct intel_cdclk_state *cdclk_state = 162 - to_intel_cdclk_state(i915->display.cdclk.obj.state); 163 - struct intel_dbuf_state *dbuf_state = 164 - to_intel_dbuf_state(i915->display.dbuf.obj.state); 165 159 struct intel_pmdemand_state *pmdemand_state = 166 160 to_intel_pmdemand_state(i915->display.pmdemand.obj.state); 167 161 struct intel_crtc_state *crtc_state = ··· 173 179 174 180 intel_display_power_put_all_in_set(display, &crtc->enabled_power_domains); 175 181 176 - cdclk_state->min_cdclk[pipe] = 0; 177 - cdclk_state->min_voltage_level[pipe] = 0; 178 - cdclk_state->active_pipes &= ~BIT(pipe); 179 - 180 - dbuf_state->active_pipes &= ~BIT(pipe); 181 - 182 - bw_state->data_rate[pipe] = 0; 183 - bw_state->num_active_planes[pipe] = 0; 182 + intel_cdclk_crtc_disable_noatomic(crtc); 183 + skl_wm_crtc_disable_noatomic(crtc); 184 + intel_bw_crtc_disable_noatomic(crtc); 184 185 185 186 intel_pmdemand_update_port_clock(display, pmdemand_state, pipe, 0); 186 187 } ··· 693 704 static void intel_modeset_readout_hw_state(struct drm_i915_private *i915) 694 705 { 695 706 struct intel_display *display = &i915->display; 696 - struct intel_cdclk_state *cdclk_state = 697 - to_intel_cdclk_state(i915->display.cdclk.obj.state); 698 - struct intel_dbuf_state *dbuf_state = 699 - to_intel_dbuf_state(i915->display.dbuf.obj.state); 700 707 struct intel_pmdemand_state *pmdemand_state = 701 708 to_intel_pmdemand_state(i915->display.pmdemand.obj.state); 702 709 enum pipe pipe; ··· 700 715 struct intel_encoder *encoder; 701 716 struct intel_connector *connector; 702 717 struct drm_connector_list_iter conn_iter; 703 - u8 active_pipes = 0; 704 718 705 719 for_each_intel_crtc(&i915->drm, crtc) { 706 720 struct intel_crtc_state *crtc_state = ··· 716 732 crtc->base.enabled = crtc_state->hw.enable; 717 733 crtc->active = crtc_state->hw.active; 718 734 719 - if (crtc_state->hw.active) 720 - active_pipes |= BIT(crtc->pipe); 721 - 722 735 drm_dbg_kms(&i915->drm, 723 736 "[CRTC:%d:%s] hw state readout: %s\n", 724 737 crtc->base.base.id, crtc->base.name, 725 738 str_enabled_disabled(crtc_state->hw.active)); 726 739 } 727 - 728 - cdclk_state->active_pipes = active_pipes; 729 - dbuf_state->active_pipes = active_pipes; 730 740 731 741 readout_plane_state(i915); 732 742 ··· 817 839 drm_connector_list_iter_end(&conn_iter); 818 840 819 841 for_each_intel_crtc(&i915->drm, crtc) { 820 - struct intel_bw_state *bw_state = 821 - to_intel_bw_state(i915->display.bw.obj.state); 822 842 struct intel_crtc_state *crtc_state = 823 843 to_intel_crtc_state(crtc->base.state); 824 844 struct intel_plane *plane; 825 - int min_cdclk = 0; 826 845 827 846 if (crtc_state->hw.active) { 828 847 /* ··· 868 893 crtc_state->min_cdclk[plane->id]); 869 894 } 870 895 871 - if (crtc_state->hw.active) { 872 - min_cdclk = intel_crtc_compute_min_cdclk(crtc_state); 873 - if (drm_WARN_ON(&i915->drm, min_cdclk < 0)) 874 - min_cdclk = 0; 875 - } 876 - 877 - cdclk_state->min_cdclk[crtc->pipe] = min_cdclk; 878 - cdclk_state->min_voltage_level[crtc->pipe] = 879 - crtc_state->min_voltage_level; 880 - 881 896 intel_pmdemand_update_port_clock(display, pmdemand_state, pipe, 882 897 crtc_state->port_clock); 883 - 884 - intel_bw_crtc_update(bw_state, crtc_state); 885 898 } 899 + 900 + /* TODO move here (or even earlier?) on all platforms */ 901 + if (DISPLAY_VER(display) >= 9) 902 + intel_wm_get_hw_state(i915); 903 + 904 + intel_bw_update_hw_state(display); 905 + intel_cdclk_update_hw_state(display); 886 906 887 907 intel_pmdemand_init_pmdemand_params(display, pmdemand_state); 888 908 } ··· 986 1016 987 1017 intel_dpll_sanitize_state(display); 988 1018 989 - intel_wm_get_hw_state(i915); 1019 + /* TODO move earlier on all platforms */ 1020 + if (DISPLAY_VER(display) < 9) 1021 + intel_wm_get_hw_state(i915); 1022 + intel_wm_sanitize(i915); 990 1023 991 1024 for_each_intel_crtc(&i915->drm, crtc) { 992 1025 struct intel_crtc_state *crtc_state =
+2 -1
drivers/gpu/drm/i915/display/intel_modeset_verify.c
··· 90 90 91 91 static void intel_pipe_config_sanity_check(const struct intel_crtc_state *crtc_state) 92 92 { 93 + struct intel_display *display = to_intel_display(crtc_state); 93 94 struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 94 95 95 96 if (crtc_state->has_pch_encoder) { 96 - int fdi_dotclock = intel_dotclock_calculate(intel_fdi_link_freq(i915, crtc_state), 97 + int fdi_dotclock = intel_dotclock_calculate(intel_fdi_link_freq(display, crtc_state), 97 98 &crtc_state->fdi_m_n); 98 99 int dotclock = crtc_state->hw.adjusted_mode.crtc_clock; 99 100
+3 -3
drivers/gpu/drm/i915/display/intel_overlay.c
··· 42 42 #include "intel_frontbuffer.h" 43 43 #include "intel_overlay.h" 44 44 #include "intel_pci_config.h" 45 + #include "intel_pfit_regs.h" 45 46 46 47 /* Limits for overlay size. According to intel doc, the real limits are: 47 48 * Y width: 4095, UV width (planar): 2047, Y height: 2047, ··· 800 799 struct drm_intel_overlay_put_image *params) 801 800 { 802 801 struct intel_display *display = overlay->display; 803 - struct drm_i915_private *dev_priv = to_i915(display->drm); 804 802 struct overlay_registers __iomem *regs = overlay->regs; 805 803 u32 swidth, swidthsw, sheight, ostride; 806 804 enum pipe pipe = overlay->crtc->pipe; ··· 814 814 if (ret != 0) 815 815 return ret; 816 816 817 - atomic_inc(&dev_priv->gpu_error.pending_fb_pin); 817 + atomic_inc(&display->restore.pending_fb_pin); 818 818 819 819 vma = intel_overlay_pin_fb(new_bo); 820 820 if (IS_ERR(vma)) { ··· 902 902 out_unpin: 903 903 i915_vma_unpin(vma); 904 904 out_pin_section: 905 - atomic_dec(&dev_priv->gpu_error.pending_fb_pin); 905 + atomic_dec(&display->restore.pending_fb_pin); 906 906 907 907 return ret; 908 908 }
-1
drivers/gpu/drm/i915/display/intel_overlay.h
··· 10 10 11 11 struct drm_device; 12 12 struct drm_file; 13 - struct drm_i915_private; 14 13 struct drm_printer; 15 14 struct intel_display; 16 15 struct intel_overlay;
+1
drivers/gpu/drm/i915/display/intel_panel.c
··· 32 32 #include <linux/pwm.h> 33 33 34 34 #include <drm/drm_edid.h> 35 + #include <drm/drm_print.h> 35 36 36 37 #include "intel_backlight.h" 37 38 #include "intel_connector.h"
+18 -17
drivers/gpu/drm/i915/display/intel_pch_display.c
··· 181 181 static void intel_pch_transcoder_set_m1_n1(struct intel_crtc *crtc, 182 182 const struct intel_link_m_n *m_n) 183 183 { 184 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 184 + struct intel_display *display = to_intel_display(crtc); 185 185 enum pipe pipe = crtc->pipe; 186 186 187 - intel_set_m_n(dev_priv, m_n, 187 + intel_set_m_n(display, m_n, 188 188 PCH_TRANS_DATA_M1(pipe), PCH_TRANS_DATA_N1(pipe), 189 189 PCH_TRANS_LINK_M1(pipe), PCH_TRANS_LINK_N1(pipe)); 190 190 } ··· 192 192 static void intel_pch_transcoder_set_m2_n2(struct intel_crtc *crtc, 193 193 const struct intel_link_m_n *m_n) 194 194 { 195 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 195 + struct intel_display *display = to_intel_display(crtc); 196 196 enum pipe pipe = crtc->pipe; 197 197 198 - intel_set_m_n(dev_priv, m_n, 198 + intel_set_m_n(display, m_n, 199 199 PCH_TRANS_DATA_M2(pipe), PCH_TRANS_DATA_N2(pipe), 200 200 PCH_TRANS_LINK_M2(pipe), PCH_TRANS_LINK_N2(pipe)); 201 201 } ··· 203 203 void intel_pch_transcoder_get_m1_n1(struct intel_crtc *crtc, 204 204 struct intel_link_m_n *m_n) 205 205 { 206 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 206 + struct intel_display *display = to_intel_display(crtc); 207 207 enum pipe pipe = crtc->pipe; 208 208 209 - intel_get_m_n(dev_priv, m_n, 209 + intel_get_m_n(display, m_n, 210 210 PCH_TRANS_DATA_M1(pipe), PCH_TRANS_DATA_N1(pipe), 211 211 PCH_TRANS_LINK_M1(pipe), PCH_TRANS_LINK_N1(pipe)); 212 212 } ··· 214 214 void intel_pch_transcoder_get_m2_n2(struct intel_crtc *crtc, 215 215 struct intel_link_m_n *m_n) 216 216 { 217 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 217 + struct intel_display *display = to_intel_display(crtc); 218 218 enum pipe pipe = crtc->pipe; 219 219 220 - intel_get_m_n(dev_priv, m_n, 220 + intel_get_m_n(display, m_n, 221 221 PCH_TRANS_DATA_M2(pipe), PCH_TRANS_DATA_N2(pipe), 222 222 PCH_TRANS_LINK_M2(pipe), PCH_TRANS_LINK_N2(pipe)); 223 223 } ··· 259 259 assert_shared_dpll_enabled(display, crtc_state->shared_dpll); 260 260 261 261 /* FDI must be feeding us bits for PCH ports */ 262 - assert_fdi_tx_enabled(dev_priv, pipe); 263 - assert_fdi_rx_enabled(dev_priv, pipe); 262 + assert_fdi_tx_enabled(display, pipe); 263 + assert_fdi_rx_enabled(display, pipe); 264 264 265 265 if (HAS_PCH_CPT(dev_priv)) { 266 266 reg = TRANS_CHICKEN2(pipe); ··· 316 316 317 317 static void ilk_disable_pch_transcoder(struct intel_crtc *crtc) 318 318 { 319 + struct intel_display *display = to_intel_display(crtc); 319 320 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 320 321 enum pipe pipe = crtc->pipe; 321 322 i915_reg_t reg; 322 323 323 324 /* FDI relies on the transcoder */ 324 - assert_fdi_tx_disabled(dev_priv, pipe); 325 - assert_fdi_rx_disabled(dev_priv, pipe); 325 + assert_fdi_tx_disabled(display, pipe); 326 + assert_fdi_rx_disabled(display, pipe); 326 327 327 328 /* Ports must be off as well */ 328 329 assert_pch_ports_disabled(dev_priv, pipe); ··· 480 479 481 480 static void ilk_pch_clock_get(struct intel_crtc_state *crtc_state) 482 481 { 483 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 484 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 482 + struct intel_display *display = to_intel_display(crtc_state); 485 483 486 484 /* read out port_clock from the DPLL */ 487 485 i9xx_crtc_clock_get(crtc_state); ··· 491 491 * Calculate one based on the FDI configuration. 492 492 */ 493 493 crtc_state->hw.adjusted_mode.crtc_clock = 494 - intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, crtc_state), 494 + intel_dotclock_calculate(intel_fdi_link_freq(display, crtc_state), 495 495 &crtc_state->fdi_m_n); 496 496 } 497 497 ··· 549 549 550 550 static void lpt_enable_pch_transcoder(const struct intel_crtc_state *crtc_state) 551 551 { 552 + struct intel_display *display = to_intel_display(crtc_state); 552 553 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 553 554 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 554 555 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 555 556 u32 val, pipeconf_val; 556 557 557 558 /* FDI must be feeding us bits for PCH ports */ 558 - assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder); 559 - assert_fdi_rx_enabled(dev_priv, PIPE_A); 559 + assert_fdi_tx_enabled(display, (enum pipe)cpu_transcoder); 560 + assert_fdi_rx_enabled(display, PIPE_A); 560 561 561 562 val = intel_de_read(dev_priv, TRANS_CHICKEN2(PIPE_A)); 562 563 /* Workaround: set timing override bit. */
+168 -2
drivers/gpu/drm/i915/display/intel_pfit.c
··· 3 3 * Copyright © 2024 Intel Corporation 4 4 */ 5 5 6 + #include <drm/drm_print.h> 7 + 6 8 #include "i915_reg.h" 7 9 #include "i915_utils.h" 10 + #include "intel_de.h" 8 11 #include "intel_display_core.h" 9 12 #include "intel_display_driver.h" 10 13 #include "intel_display_types.h" 11 14 #include "intel_lvds_regs.h" 12 15 #include "intel_pfit.h" 16 + #include "intel_pfit_regs.h" 13 17 14 18 static int intel_pch_pfit_check_dst_window(const struct intel_crtc_state *crtc_state) 15 19 { ··· 546 542 return intel_gmch_pfit_check_timings(crtc_state); 547 543 } 548 544 549 - int intel_panel_fitting(struct intel_crtc_state *crtc_state, 550 - const struct drm_connector_state *conn_state) 545 + int intel_pfit_compute_config(struct intel_crtc_state *crtc_state, 546 + const struct drm_connector_state *conn_state) 551 547 { 552 548 struct intel_display *display = to_intel_display(crtc_state); 553 549 ··· 555 551 return gmch_panel_fitting(crtc_state, conn_state); 556 552 else 557 553 return pch_panel_fitting(crtc_state, conn_state); 554 + } 555 + 556 + void ilk_pfit_enable(const struct intel_crtc_state *crtc_state) 557 + { 558 + struct intel_display *display = to_intel_display(crtc_state); 559 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 560 + const struct drm_rect *dst = &crtc_state->pch_pfit.dst; 561 + enum pipe pipe = crtc->pipe; 562 + int width = drm_rect_width(dst); 563 + int height = drm_rect_height(dst); 564 + int x = dst->x1; 565 + int y = dst->y1; 566 + 567 + if (!crtc_state->pch_pfit.enabled) 568 + return; 569 + 570 + /* 571 + * Force use of hard-coded filter coefficients as some pre-programmed 572 + * values are broken, e.g. x201. 573 + */ 574 + if (display->platform.ivybridge || display->platform.haswell) 575 + intel_de_write_fw(display, PF_CTL(pipe), PF_ENABLE | 576 + PF_FILTER_MED_3x3 | PF_PIPE_SEL_IVB(pipe)); 577 + else 578 + intel_de_write_fw(display, PF_CTL(pipe), PF_ENABLE | 579 + PF_FILTER_MED_3x3); 580 + intel_de_write_fw(display, PF_WIN_POS(pipe), 581 + PF_WIN_XPOS(x) | PF_WIN_YPOS(y)); 582 + intel_de_write_fw(display, PF_WIN_SZ(pipe), 583 + PF_WIN_XSIZE(width) | PF_WIN_YSIZE(height)); 584 + } 585 + 586 + void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state) 587 + { 588 + struct intel_display *display = to_intel_display(old_crtc_state); 589 + struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 590 + enum pipe pipe = crtc->pipe; 591 + 592 + /* 593 + * To avoid upsetting the power well on haswell only disable the pfit if 594 + * it's in use. The hw state code will make sure we get this right. 595 + */ 596 + if (!old_crtc_state->pch_pfit.enabled) 597 + return; 598 + 599 + intel_de_write_fw(display, PF_CTL(pipe), 0); 600 + intel_de_write_fw(display, PF_WIN_POS(pipe), 0); 601 + intel_de_write_fw(display, PF_WIN_SZ(pipe), 0); 602 + } 603 + 604 + void ilk_pfit_get_config(struct intel_crtc_state *crtc_state) 605 + { 606 + struct intel_display *display = to_intel_display(crtc_state); 607 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 608 + u32 ctl, pos, size; 609 + enum pipe pipe; 610 + 611 + ctl = intel_de_read(display, PF_CTL(crtc->pipe)); 612 + if ((ctl & PF_ENABLE) == 0) 613 + return; 614 + 615 + if (display->platform.ivybridge || display->platform.haswell) 616 + pipe = REG_FIELD_GET(PF_PIPE_SEL_MASK_IVB, ctl); 617 + else 618 + pipe = crtc->pipe; 619 + 620 + crtc_state->pch_pfit.enabled = true; 621 + 622 + pos = intel_de_read(display, PF_WIN_POS(crtc->pipe)); 623 + size = intel_de_read(display, PF_WIN_SZ(crtc->pipe)); 624 + 625 + drm_rect_init(&crtc_state->pch_pfit.dst, 626 + REG_FIELD_GET(PF_WIN_XPOS_MASK, pos), 627 + REG_FIELD_GET(PF_WIN_YPOS_MASK, pos), 628 + REG_FIELD_GET(PF_WIN_XSIZE_MASK, size), 629 + REG_FIELD_GET(PF_WIN_YSIZE_MASK, size)); 630 + 631 + /* 632 + * We currently do not free assignments of panel fitters on 633 + * ivb/hsw (since we don't use the higher upscaling modes which 634 + * differentiates them) so just WARN about this case for now. 635 + */ 636 + drm_WARN_ON(display->drm, pipe != crtc->pipe); 637 + } 638 + 639 + void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state) 640 + { 641 + struct intel_display *display = to_intel_display(crtc_state); 642 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 643 + 644 + if (!crtc_state->gmch_pfit.control) 645 + return; 646 + 647 + /* 648 + * The panel fitter should only be adjusted whilst the pipe is disabled, 649 + * according to register description and PRM. 650 + */ 651 + drm_WARN_ON(display->drm, 652 + intel_de_read(display, PFIT_CONTROL(display)) & PFIT_ENABLE); 653 + assert_transcoder_disabled(display, crtc_state->cpu_transcoder); 654 + 655 + intel_de_write(display, PFIT_PGM_RATIOS(display), 656 + crtc_state->gmch_pfit.pgm_ratios); 657 + intel_de_write(display, PFIT_CONTROL(display), 658 + crtc_state->gmch_pfit.control); 659 + 660 + /* 661 + * Border color in case we don't scale up to the full screen. Black by 662 + * default, change to something else for debugging. 663 + */ 664 + intel_de_write(display, BCLRPAT(display, crtc->pipe), 0); 665 + } 666 + 667 + void i9xx_pfit_disable(const struct intel_crtc_state *old_crtc_state) 668 + { 669 + struct intel_display *display = to_intel_display(old_crtc_state); 670 + 671 + if (!old_crtc_state->gmch_pfit.control) 672 + return; 673 + 674 + assert_transcoder_disabled(display, old_crtc_state->cpu_transcoder); 675 + 676 + drm_dbg_kms(display->drm, "disabling pfit, current: 0x%08x\n", 677 + intel_de_read(display, PFIT_CONTROL(display))); 678 + intel_de_write(display, PFIT_CONTROL(display), 0); 679 + } 680 + 681 + static bool i9xx_has_pfit(struct intel_display *display) 682 + { 683 + if (display->platform.i830) 684 + return false; 685 + 686 + return DISPLAY_VER(display) >= 4 || 687 + display->platform.pineview || display->platform.mobile; 688 + } 689 + 690 + void i9xx_pfit_get_config(struct intel_crtc_state *crtc_state) 691 + { 692 + struct intel_display *display = to_intel_display(crtc_state); 693 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 694 + enum pipe pipe; 695 + u32 tmp; 696 + 697 + if (!i9xx_has_pfit(display)) 698 + return; 699 + 700 + tmp = intel_de_read(display, PFIT_CONTROL(display)); 701 + if (!(tmp & PFIT_ENABLE)) 702 + return; 703 + 704 + /* Check whether the pfit is attached to our pipe. */ 705 + if (DISPLAY_VER(display) >= 4) 706 + pipe = REG_FIELD_GET(PFIT_PIPE_MASK, tmp); 707 + else 708 + pipe = PIPE_B; 709 + 710 + if (pipe != crtc->pipe) 711 + return; 712 + 713 + crtc_state->gmch_pfit.control = tmp; 714 + crtc_state->gmch_pfit.pgm_ratios = 715 + intel_de_read(display, PFIT_PGM_RATIOS(display)); 558 716 }
+8 -2
drivers/gpu/drm/i915/display/intel_pfit.h
··· 9 9 struct drm_connector_state; 10 10 struct intel_crtc_state; 11 11 12 - int intel_panel_fitting(struct intel_crtc_state *crtc_state, 13 - const struct drm_connector_state *conn_state); 12 + int intel_pfit_compute_config(struct intel_crtc_state *crtc_state, 13 + const struct drm_connector_state *conn_state); 14 + void ilk_pfit_enable(const struct intel_crtc_state *crtc_state); 15 + void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state); 16 + void ilk_pfit_get_config(struct intel_crtc_state *crtc_state); 17 + void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state); 18 + void i9xx_pfit_disable(const struct intel_crtc_state *old_crtc_state); 19 + void i9xx_pfit_get_config(struct intel_crtc_state *crtc_state); 14 20 15 21 #endif /* __INTEL_PFIT_H__ */
+79
drivers/gpu/drm/i915/display/intel_pfit_regs.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #ifndef __INTEL_PFIT_REGS_H__ 5 + #define __INTEL_PFIT_REGS_H__ 6 + 7 + #include "intel_display_reg_defs.h" 8 + 9 + /* Panel fitting */ 10 + #define PFIT_CONTROL(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61230) 11 + #define PFIT_ENABLE REG_BIT(31) 12 + #define PFIT_PIPE_MASK REG_GENMASK(30, 29) /* 965+ */ 13 + #define PFIT_PIPE(pipe) REG_FIELD_PREP(PFIT_PIPE_MASK, (pipe)) 14 + #define PFIT_SCALING_MASK REG_GENMASK(28, 26) /* 965+ */ 15 + #define PFIT_SCALING_AUTO REG_FIELD_PREP(PFIT_SCALING_MASK, 0) 16 + #define PFIT_SCALING_PROGRAMMED REG_FIELD_PREP(PFIT_SCALING_MASK, 1) 17 + #define PFIT_SCALING_PILLAR REG_FIELD_PREP(PFIT_SCALING_MASK, 2) 18 + #define PFIT_SCALING_LETTER REG_FIELD_PREP(PFIT_SCALING_MASK, 3) 19 + #define PFIT_FILTER_MASK REG_GENMASK(25, 24) /* 965+ */ 20 + #define PFIT_FILTER_FUZZY REG_FIELD_PREP(PFIT_FILTER_MASK, 0) 21 + #define PFIT_FILTER_CRISP REG_FIELD_PREP(PFIT_FILTER_MASK, 1) 22 + #define PFIT_FILTER_MEDIAN REG_FIELD_PREP(PFIT_FILTER_MASK, 2) 23 + #define PFIT_VERT_INTERP_MASK REG_GENMASK(11, 10) /* pre-965 */ 24 + #define PFIT_VERT_INTERP_BILINEAR REG_FIELD_PREP(PFIT_VERT_INTERP_MASK, 1) 25 + #define PFIT_VERT_AUTO_SCALE REG_BIT(9) /* pre-965 */ 26 + #define PFIT_HORIZ_INTERP_MASK REG_GENMASK(7, 6) /* pre-965 */ 27 + #define PFIT_HORIZ_INTERP_BILINEAR REG_FIELD_PREP(PFIT_HORIZ_INTERP_MASK, 1) 28 + #define PFIT_HORIZ_AUTO_SCALE REG_BIT(5) /* pre-965 */ 29 + #define PFIT_PANEL_8TO6_DITHER_ENABLE REG_BIT(3) /* pre-965 */ 30 + 31 + #define PFIT_PGM_RATIOS(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61234) 32 + #define PFIT_VERT_SCALE_MASK REG_GENMASK(31, 20) /* pre-965 */ 33 + #define PFIT_VERT_SCALE(x) REG_FIELD_PREP(PFIT_VERT_SCALE_MASK, (x)) 34 + #define PFIT_HORIZ_SCALE_MASK REG_GENMASK(15, 4) /* pre-965 */ 35 + #define PFIT_HORIZ_SCALE(x) REG_FIELD_PREP(PFIT_HORIZ_SCALE_MASK, (x)) 36 + #define PFIT_VERT_SCALE_MASK_965 REG_GENMASK(28, 16) /* 965+ */ 37 + #define PFIT_HORIZ_SCALE_MASK_965 REG_GENMASK(12, 0) /* 965+ */ 38 + 39 + #define PFIT_AUTO_RATIOS(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61238) 40 + 41 + /* CPU panel fitter */ 42 + /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */ 43 + #define _PFA_CTL_1 0x68080 44 + #define _PFB_CTL_1 0x68880 45 + #define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1) 46 + #define PF_ENABLE REG_BIT(31) 47 + #define PF_PIPE_SEL_MASK_IVB REG_GENMASK(30, 29) /* ivb/hsw */ 48 + #define PF_PIPE_SEL_IVB(pipe) REG_FIELD_PREP(PF_PIPE_SEL_MASK_IVB, (pipe)) 49 + #define PF_FILTER_MASK REG_GENMASK(24, 23) 50 + #define PF_FILTER_PROGRAMMED REG_FIELD_PREP(PF_FILTER_MASK, 0) 51 + #define PF_FILTER_MED_3x3 REG_FIELD_PREP(PF_FILTER_MASK, 1) 52 + #define PF_FILTER_EDGE_ENHANCE REG_FIELD_PREP(PF_FILTER_EDGE_MASK, 2) 53 + #define PF_FILTER_EDGE_SOFTEN REG_FIELD_PREP(PF_FILTER_EDGE_MASK, 3) 54 + 55 + #define _PFA_WIN_SZ 0x68074 56 + #define _PFB_WIN_SZ 0x68874 57 + #define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ) 58 + #define PF_WIN_XSIZE_MASK REG_GENMASK(31, 16) 59 + #define PF_WIN_XSIZE(w) REG_FIELD_PREP(PF_WIN_XSIZE_MASK, (w)) 60 + #define PF_WIN_YSIZE_MASK REG_GENMASK(15, 0) 61 + #define PF_WIN_YSIZE(h) REG_FIELD_PREP(PF_WIN_YSIZE_MASK, (h)) 62 + 63 + #define _PFA_WIN_POS 0x68070 64 + #define _PFB_WIN_POS 0x68870 65 + #define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS) 66 + #define PF_WIN_XPOS_MASK REG_GENMASK(31, 16) 67 + #define PF_WIN_XPOS(x) REG_FIELD_PREP(PF_WIN_XPOS_MASK, (x)) 68 + #define PF_WIN_YPOS_MASK REG_GENMASK(15, 0) 69 + #define PF_WIN_YPOS(y) REG_FIELD_PREP(PF_WIN_YPOS_MASK, (y)) 70 + 71 + #define _PFA_VSCALE 0x68084 72 + #define _PFB_VSCALE 0x68884 73 + #define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE) 74 + 75 + #define _PFA_HSCALE 0x68090 76 + #define _PFB_HSCALE 0x68890 77 + #define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE) 78 + 79 + #endif /* __INTEL_PFIT_REGS_H__ */
-1
drivers/gpu/drm/i915/display/intel_pipe_crc.h
··· 9 9 #include <linux/types.h> 10 10 11 11 struct drm_crtc; 12 - struct drm_i915_private; 13 12 struct intel_crtc; 14 13 15 14 #ifdef CONFIG_DEBUG_FS
+2
drivers/gpu/drm/i915/display/intel_quirks.c
··· 5 5 6 6 #include <linux/dmi.h> 7 7 8 + #include <drm/drm_print.h> 9 + 8 10 #include "intel_display_core.h" 9 11 #include "intel_display_types.h" 10 12 #include "intel_quirks.h"
+37 -38
drivers/gpu/drm/i915/display/intel_snps_phy.c
··· 5 5 6 6 #include <linux/math.h> 7 7 8 - #include "i915_drv.h" 9 8 #include "i915_reg.h" 9 + #include "i915_utils.h" 10 10 #include "intel_ddi.h" 11 11 #include "intel_ddi_buf_trans.h" 12 12 #include "intel_de.h" ··· 27 27 * since it is not handled by the shared DPLL framework as on other platforms. 28 28 */ 29 29 30 - void intel_snps_phy_wait_for_calibration(struct drm_i915_private *i915) 30 + void intel_snps_phy_wait_for_calibration(struct intel_display *display) 31 31 { 32 32 enum phy phy; 33 33 34 34 for_each_phy_masked(phy, ~0) { 35 - if (!intel_phy_is_snps(i915, phy)) 35 + if (!intel_phy_is_snps(display, phy)) 36 36 continue; 37 37 38 38 /* ··· 40 40 * which phy was affected and skip setup of the corresponding 41 41 * output later. 42 42 */ 43 - if (intel_de_wait_for_clear(i915, DG2_PHY_MISC(phy), 43 + if (intel_de_wait_for_clear(display, DG2_PHY_MISC(phy), 44 44 DG2_PHY_DP_TX_ACK_MASK, 25)) 45 - i915->display.snps.phy_failed_calibration |= BIT(phy); 45 + display->snps.phy_failed_calibration |= BIT(phy); 46 46 } 47 47 } 48 48 49 49 void intel_snps_phy_update_psr_power_state(struct intel_encoder *encoder, 50 50 bool enable) 51 51 { 52 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 52 + struct intel_display *display = to_intel_display(encoder); 53 53 enum phy phy = intel_encoder_to_phy(encoder); 54 54 u32 val; 55 55 ··· 58 58 59 59 val = REG_FIELD_PREP(SNPS_PHY_TX_REQ_LN_DIS_PWR_STATE_PSR, 60 60 enable ? 2 : 3); 61 - intel_de_rmw(i915, SNPS_PHY_TX_REQ(phy), 61 + intel_de_rmw(display, SNPS_PHY_TX_REQ(phy), 62 62 SNPS_PHY_TX_REQ_LN_DIS_PWR_STATE_PSR, val); 63 63 } 64 64 65 65 void intel_snps_phy_set_signal_levels(struct intel_encoder *encoder, 66 66 const struct intel_crtc_state *crtc_state) 67 67 { 68 - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 68 + struct intel_display *display = to_intel_display(encoder); 69 69 const struct intel_ddi_buf_trans *trans; 70 70 enum phy phy = intel_encoder_to_phy(encoder); 71 71 int n_entries, ln; 72 72 73 73 trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries); 74 - if (drm_WARN_ON_ONCE(&dev_priv->drm, !trans)) 74 + if (drm_WARN_ON_ONCE(display->drm, !trans)) 75 75 return; 76 76 77 77 for (ln = 0; ln < 4; ln++) { ··· 82 82 val |= REG_FIELD_PREP(SNPS_PHY_TX_EQ_PRE, trans->entries[level].snps.pre_cursor); 83 83 val |= REG_FIELD_PREP(SNPS_PHY_TX_EQ_POST, trans->entries[level].snps.post_cursor); 84 84 85 - intel_de_write(dev_priv, SNPS_PHY_TX_EQ(ln, phy), val); 85 + intel_de_write(display, SNPS_PHY_TX_EQ(ln, phy), val); 86 86 } 87 87 } 88 88 ··· 1817 1817 void intel_mpllb_enable(struct intel_encoder *encoder, 1818 1818 const struct intel_crtc_state *crtc_state) 1819 1819 { 1820 - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 1820 + struct intel_display *display = to_intel_display(encoder); 1821 1821 const struct intel_mpllb_state *pll_state = &crtc_state->dpll_hw_state.mpllb; 1822 1822 enum phy phy = intel_encoder_to_phy(encoder); 1823 1823 i915_reg_t enable_reg = (phy <= PHY_D ? ··· 1827 1827 * 3. Software programs the following PLL registers for the desired 1828 1828 * frequency. 1829 1829 */ 1830 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_CP(phy), pll_state->mpllb_cp); 1831 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_DIV(phy), pll_state->mpllb_div); 1832 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_DIV2(phy), pll_state->mpllb_div2); 1833 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_SSCEN(phy), pll_state->mpllb_sscen); 1834 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_SSCSTEP(phy), pll_state->mpllb_sscstep); 1835 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_FRACN1(phy), pll_state->mpllb_fracn1); 1836 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_FRACN2(phy), pll_state->mpllb_fracn2); 1830 + intel_de_write(display, SNPS_PHY_MPLLB_CP(phy), pll_state->mpllb_cp); 1831 + intel_de_write(display, SNPS_PHY_MPLLB_DIV(phy), pll_state->mpllb_div); 1832 + intel_de_write(display, SNPS_PHY_MPLLB_DIV2(phy), pll_state->mpllb_div2); 1833 + intel_de_write(display, SNPS_PHY_MPLLB_SSCEN(phy), pll_state->mpllb_sscen); 1834 + intel_de_write(display, SNPS_PHY_MPLLB_SSCSTEP(phy), pll_state->mpllb_sscstep); 1835 + intel_de_write(display, SNPS_PHY_MPLLB_FRACN1(phy), pll_state->mpllb_fracn1); 1836 + intel_de_write(display, SNPS_PHY_MPLLB_FRACN2(phy), pll_state->mpllb_fracn2); 1837 1837 1838 1838 /* 1839 1839 * 4. If the frequency will result in a change to the voltage ··· 1844 1844 */ 1845 1845 1846 1846 /* 5. Software sets DPLL_ENABLE [PLL Enable] to "1". */ 1847 - intel_de_rmw(dev_priv, enable_reg, 0, PLL_ENABLE); 1847 + intel_de_rmw(display, enable_reg, 0, PLL_ENABLE); 1848 1848 1849 1849 /* 1850 1850 * 9. Software sets SNPS_PHY_MPLLB_DIV dp_mpllb_force_en to "1". This ··· 1853 1853 * PLL because that will start the PLL before it has sampled the 1854 1854 * divider values. 1855 1855 */ 1856 - intel_de_write(dev_priv, SNPS_PHY_MPLLB_DIV(phy), 1856 + intel_de_write(display, SNPS_PHY_MPLLB_DIV(phy), 1857 1857 pll_state->mpllb_div | SNPS_PHY_MPLLB_FORCE_EN); 1858 1858 1859 1859 /* ··· 1861 1861 * is locked at new settings. This register bit is sampling PHY 1862 1862 * dp_mpllb_state interface signal. 1863 1863 */ 1864 - if (intel_de_wait_for_set(dev_priv, enable_reg, PLL_LOCK, 5)) 1865 - drm_dbg_kms(&dev_priv->drm, "Port %c PLL not locked\n", phy_name(phy)); 1864 + if (intel_de_wait_for_set(display, enable_reg, PLL_LOCK, 5)) 1865 + drm_dbg_kms(display->drm, "Port %c PLL not locked\n", phy_name(phy)); 1866 1866 1867 1867 /* 1868 1868 * 11. If the frequency will result in a change to the voltage ··· 1875 1875 1876 1876 void intel_mpllb_disable(struct intel_encoder *encoder) 1877 1877 { 1878 - struct drm_i915_private *i915 = to_i915(encoder->base.dev); 1878 + struct intel_display *display = to_intel_display(encoder); 1879 1879 enum phy phy = intel_encoder_to_phy(encoder); 1880 1880 i915_reg_t enable_reg = (phy <= PHY_D ? 1881 1881 DG2_PLL_ENABLE(phy) : MG_PLL_ENABLE(0)); ··· 1889 1889 */ 1890 1890 1891 1891 /* 2. Software programs DPLL_ENABLE [PLL Enable] to "0" */ 1892 - intel_de_rmw(i915, enable_reg, PLL_ENABLE, 0); 1892 + intel_de_rmw(display, enable_reg, PLL_ENABLE, 0); 1893 1893 1894 1894 /* 1895 1895 * 4. Software programs SNPS_PHY_MPLLB_DIV dp_mpllb_force_en to "0". 1896 1896 * This will allow the PLL to stop running. 1897 1897 */ 1898 - intel_de_rmw(i915, SNPS_PHY_MPLLB_DIV(phy), SNPS_PHY_MPLLB_FORCE_EN, 0); 1898 + intel_de_rmw(display, SNPS_PHY_MPLLB_DIV(phy), SNPS_PHY_MPLLB_FORCE_EN, 0); 1899 1899 1900 1900 /* 1901 1901 * 5. Software polls DPLL_ENABLE [PLL Lock] for PHY acknowledgment 1902 1902 * (dp_txX_ack) that the new transmitter setting request is completed. 1903 1903 */ 1904 - if (intel_de_wait_for_clear(i915, enable_reg, PLL_LOCK, 5)) 1905 - drm_err(&i915->drm, "Port %c PLL not locked\n", phy_name(phy)); 1904 + if (intel_de_wait_for_clear(display, enable_reg, PLL_LOCK, 5)) 1905 + drm_err(display->drm, "Port %c PLL not locked\n", phy_name(phy)); 1906 1906 1907 1907 /* 1908 1908 * 6. If the frequency will result in a change to the voltage ··· 1947 1947 void intel_mpllb_readout_hw_state(struct intel_encoder *encoder, 1948 1948 struct intel_mpllb_state *pll_state) 1949 1949 { 1950 - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 1950 + struct intel_display *display = to_intel_display(encoder); 1951 1951 enum phy phy = intel_encoder_to_phy(encoder); 1952 1952 1953 - pll_state->mpllb_cp = intel_de_read(dev_priv, SNPS_PHY_MPLLB_CP(phy)); 1954 - pll_state->mpllb_div = intel_de_read(dev_priv, SNPS_PHY_MPLLB_DIV(phy)); 1955 - pll_state->mpllb_div2 = intel_de_read(dev_priv, SNPS_PHY_MPLLB_DIV2(phy)); 1956 - pll_state->mpllb_sscen = intel_de_read(dev_priv, SNPS_PHY_MPLLB_SSCEN(phy)); 1957 - pll_state->mpllb_sscstep = intel_de_read(dev_priv, SNPS_PHY_MPLLB_SSCSTEP(phy)); 1958 - pll_state->mpllb_fracn1 = intel_de_read(dev_priv, SNPS_PHY_MPLLB_FRACN1(phy)); 1959 - pll_state->mpllb_fracn2 = intel_de_read(dev_priv, SNPS_PHY_MPLLB_FRACN2(phy)); 1953 + pll_state->mpllb_cp = intel_de_read(display, SNPS_PHY_MPLLB_CP(phy)); 1954 + pll_state->mpllb_div = intel_de_read(display, SNPS_PHY_MPLLB_DIV(phy)); 1955 + pll_state->mpllb_div2 = intel_de_read(display, SNPS_PHY_MPLLB_DIV2(phy)); 1956 + pll_state->mpllb_sscen = intel_de_read(display, SNPS_PHY_MPLLB_SSCEN(phy)); 1957 + pll_state->mpllb_sscstep = intel_de_read(display, SNPS_PHY_MPLLB_SSCSTEP(phy)); 1958 + pll_state->mpllb_fracn1 = intel_de_read(display, SNPS_PHY_MPLLB_FRACN1(phy)); 1959 + pll_state->mpllb_fracn2 = intel_de_read(display, SNPS_PHY_MPLLB_FRACN2(phy)); 1960 1960 1961 1961 /* 1962 1962 * REF_CONTROL is under firmware control and never programmed by the ··· 1964 1964 * only tells us the expected value for one field in this register, 1965 1965 * so we'll only read out those specific bits here. 1966 1966 */ 1967 - pll_state->ref_control = intel_de_read(dev_priv, SNPS_PHY_REF_CONTROL(phy)) & 1967 + pll_state->ref_control = intel_de_read(display, SNPS_PHY_REF_CONTROL(phy)) & 1968 1968 SNPS_PHY_REF_CONTROL_REF_RANGE; 1969 1969 1970 1970 /* ··· 1980 1980 struct intel_crtc *crtc) 1981 1981 { 1982 1982 struct intel_display *display = to_intel_display(state); 1983 - struct drm_i915_private *i915 = to_i915(state->base.dev); 1984 1983 const struct intel_crtc_state *new_crtc_state = 1985 1984 intel_atomic_get_new_crtc_state(state, crtc); 1986 1985 struct intel_mpllb_state mpllb_hw_state = {}; 1987 1986 const struct intel_mpllb_state *mpllb_sw_state = &new_crtc_state->dpll_hw_state.mpllb; 1988 1987 struct intel_encoder *encoder; 1989 1988 1990 - if (!IS_DG2(i915)) 1989 + if (!display->platform.dg2) 1991 1990 return; 1992 1991 1993 1992 if (!new_crtc_state->hw.active)
+3 -3
drivers/gpu/drm/i915/display/intel_snps_phy.h
··· 8 8 9 9 #include <linux/types.h> 10 10 11 - struct drm_i915_private; 11 + enum phy; 12 12 struct intel_atomic_state; 13 13 struct intel_crtc; 14 14 struct intel_crtc_state; 15 + struct intel_display; 15 16 struct intel_encoder; 16 17 struct intel_mpllb_state; 17 - enum phy; 18 18 19 - void intel_snps_phy_wait_for_calibration(struct drm_i915_private *dev_priv); 19 + void intel_snps_phy_wait_for_calibration(struct intel_display *display); 20 20 void intel_snps_phy_update_psr_power_state(struct intel_encoder *encoder, 21 21 bool enable); 22 22
+3 -3
drivers/gpu/drm/i915/display/intel_tdf.h
··· 14 14 * the display flip, since display engine is never coherent with CPU/GPU caches. 15 15 */ 16 16 17 - struct drm_i915_private; 17 + struct intel_display; 18 18 19 19 #ifdef I915 20 - static inline void intel_td_flush(struct drm_i915_private *i915) {} 20 + static inline void intel_td_flush(struct intel_display *display) {} 21 21 #else 22 - void intel_td_flush(struct drm_i915_private *i915); 22 + void intel_td_flush(struct intel_display *display); 23 23 #endif 24 24 25 25 #endif
+88 -94
drivers/gpu/drm/i915/display/intel_vdsc.c
··· 10 10 #include <drm/display/drm_dsc_helper.h> 11 11 #include <drm/drm_fixed.h> 12 12 13 - #include "i915_drv.h" 13 + #include "i915_utils.h" 14 14 #include "intel_crtc.h" 15 15 #include "intel_de.h" 16 16 #include "intel_display_types.h" ··· 22 22 23 23 bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state) 24 24 { 25 - const struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 26 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 25 + struct intel_display *display = to_intel_display(crtc_state); 27 26 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 28 27 29 - if (!HAS_DSC(i915)) 28 + if (!HAS_DSC(display)) 30 29 return false; 31 30 32 - if (DISPLAY_VER(i915) == 11 && cpu_transcoder == TRANSCODER_A) 31 + if (DISPLAY_VER(display) == 11 && cpu_transcoder == TRANSCODER_A) 33 32 return false; 34 33 35 34 return true; ··· 36 37 37 38 static bool is_pipe_dsc(struct intel_crtc *crtc, enum transcoder cpu_transcoder) 38 39 { 39 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 40 + struct intel_display *display = to_intel_display(crtc); 40 41 41 - if (DISPLAY_VER(i915) >= 12) 42 + if (DISPLAY_VER(display) >= 12) 42 43 return true; 43 44 44 45 if (cpu_transcoder == TRANSCODER_EDP || ··· 47 48 return false; 48 49 49 50 /* There's no pipe A DSC engine on ICL */ 50 - drm_WARN_ON(&i915->drm, crtc->pipe == PIPE_A); 51 + drm_WARN_ON(display->drm, crtc->pipe == PIPE_A); 51 52 52 53 return true; 53 54 } ··· 261 262 262 263 int intel_dsc_compute_params(struct intel_crtc_state *pipe_config) 263 264 { 264 - struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); 265 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 265 + struct intel_display *display = to_intel_display(pipe_config); 266 266 struct drm_dsc_config *vdsc_cfg = &pipe_config->dsc.config; 267 267 u16 compressed_bpp = fxp_q4_to_int(pipe_config->dsc.compressed_bpp_x16); 268 268 int err; ··· 274 276 err = intel_dsc_slice_dimensions_valid(pipe_config, vdsc_cfg); 275 277 276 278 if (err) { 277 - drm_dbg_kms(&dev_priv->drm, "Slice dimension requirements not met\n"); 279 + drm_dbg_kms(display->drm, "Slice dimension requirements not met\n"); 278 280 return err; 279 281 } 280 282 ··· 285 287 vdsc_cfg->convert_rgb = pipe_config->output_format != INTEL_OUTPUT_FORMAT_YCBCR420 && 286 288 pipe_config->output_format != INTEL_OUTPUT_FORMAT_YCBCR444; 287 289 288 - if (DISPLAY_VER(dev_priv) >= 14 && 290 + if (DISPLAY_VER(display) >= 14 && 289 291 pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) 290 292 vdsc_cfg->native_420 = true; 291 293 /* We do not support YcBCr422 as of now */ ··· 306 308 vdsc_cfg->bits_per_component = pipe_config->pipe_bpp / 3; 307 309 308 310 if (vdsc_cfg->bits_per_component < 8) { 309 - drm_dbg_kms(&dev_priv->drm, "DSC bpc requirements not met bpc: %d\n", 311 + drm_dbg_kms(display->drm, "DSC bpc requirements not met bpc: %d\n", 310 312 vdsc_cfg->bits_per_component); 311 313 return -EINVAL; 312 314 } ··· 318 320 * upto uncompressed bpp-1, hence add calculations for all the rc 319 321 * parameters 320 322 */ 321 - if (DISPLAY_VER(dev_priv) >= 13) { 323 + if (DISPLAY_VER(display) >= 13) { 322 324 calculate_rc_params(vdsc_cfg); 323 325 } else { 324 326 if ((compressed_bpp == 8 || ··· 354 356 enum intel_display_power_domain 355 357 intel_dsc_power_domain(struct intel_crtc *crtc, enum transcoder cpu_transcoder) 356 358 { 357 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 359 + struct intel_display *display = to_intel_display(crtc); 358 360 enum pipe pipe = crtc->pipe; 359 361 360 362 /* ··· 368 370 * the pipe in use. Hence another reference on the pipe power domain 369 371 * will suffice. (Except no VDSC/joining on ICL pipe A.) 370 372 */ 371 - if (DISPLAY_VER(i915) == 12 && !IS_ROCKETLAKE(i915) && pipe == PIPE_A) 373 + if (DISPLAY_VER(display) == 12 && !display->platform.rocketlake && 374 + pipe == PIPE_A) 372 375 return POWER_DOMAIN_TRANSCODER_VDSC_PW2; 373 376 else if (is_pipe_dsc(crtc, cpu_transcoder)) 374 377 return POWER_DOMAIN_PIPE(pipe); ··· 415 416 static void intel_dsc_pps_write(const struct intel_crtc_state *crtc_state, 416 417 int pps, u32 pps_val) 417 418 { 418 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 419 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 419 + struct intel_display *display = to_intel_display(crtc_state); 420 420 i915_reg_t dsc_reg[3]; 421 421 int i, vdsc_per_pipe, dsc_reg_num; 422 422 423 423 vdsc_per_pipe = intel_dsc_get_vdsc_per_pipe(crtc_state); 424 424 dsc_reg_num = min_t(int, ARRAY_SIZE(dsc_reg), vdsc_per_pipe); 425 425 426 - drm_WARN_ON_ONCE(&i915->drm, dsc_reg_num < vdsc_per_pipe); 426 + drm_WARN_ON_ONCE(display->drm, dsc_reg_num < vdsc_per_pipe); 427 427 428 428 intel_dsc_get_pps_reg(crtc_state, pps, dsc_reg, dsc_reg_num); 429 429 430 430 for (i = 0; i < dsc_reg_num; i++) 431 - intel_de_write(i915, dsc_reg[i], pps_val); 431 + intel_de_write(display, dsc_reg[i], pps_val); 432 432 } 433 433 434 434 static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) 435 435 { 436 + struct intel_display *display = to_intel_display(crtc_state); 436 437 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 437 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 438 438 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; 439 439 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 440 440 enum pipe pipe = crtc->pipe; ··· 527 529 vdsc_cfg->slice_height); 528 530 intel_dsc_pps_write(crtc_state, 16, pps_val); 529 531 530 - if (DISPLAY_VER(dev_priv) >= 14) { 532 + if (DISPLAY_VER(display) >= 14) { 531 533 /* PPS 17 */ 532 534 pps_val = DSC_PPS17_SL_BPG_OFFSET(vdsc_cfg->second_line_bpg_offset); 533 535 intel_dsc_pps_write(crtc_state, 17, pps_val); ··· 545 547 (u32)(vdsc_cfg->rc_buf_thresh[i] << 546 548 BITS_PER_BYTE * (i % 4)); 547 549 if (!is_pipe_dsc(crtc, cpu_transcoder)) { 548 - intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_0, 550 + intel_de_write(display, DSCA_RC_BUF_THRESH_0, 549 551 rc_buf_thresh_dword[0]); 550 - intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_0_UDW, 552 + intel_de_write(display, DSCA_RC_BUF_THRESH_0_UDW, 551 553 rc_buf_thresh_dword[1]); 552 - intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_1, 554 + intel_de_write(display, DSCA_RC_BUF_THRESH_1, 553 555 rc_buf_thresh_dword[2]); 554 - intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_1_UDW, 556 + intel_de_write(display, DSCA_RC_BUF_THRESH_1_UDW, 555 557 rc_buf_thresh_dword[3]); 556 558 if (vdsc_instances_per_pipe > 1) { 557 - intel_de_write(dev_priv, DSCC_RC_BUF_THRESH_0, 559 + intel_de_write(display, DSCC_RC_BUF_THRESH_0, 558 560 rc_buf_thresh_dword[0]); 559 - intel_de_write(dev_priv, DSCC_RC_BUF_THRESH_0_UDW, 561 + intel_de_write(display, DSCC_RC_BUF_THRESH_0_UDW, 560 562 rc_buf_thresh_dword[1]); 561 - intel_de_write(dev_priv, DSCC_RC_BUF_THRESH_1, 563 + intel_de_write(display, DSCC_RC_BUF_THRESH_1, 562 564 rc_buf_thresh_dword[2]); 563 - intel_de_write(dev_priv, DSCC_RC_BUF_THRESH_1_UDW, 565 + intel_de_write(display, DSCC_RC_BUF_THRESH_1_UDW, 564 566 rc_buf_thresh_dword[3]); 565 567 } 566 568 } else { 567 - intel_de_write(dev_priv, ICL_DSC0_RC_BUF_THRESH_0(pipe), 569 + intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_0(pipe), 568 570 rc_buf_thresh_dword[0]); 569 - intel_de_write(dev_priv, ICL_DSC0_RC_BUF_THRESH_0_UDW(pipe), 571 + intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_0_UDW(pipe), 570 572 rc_buf_thresh_dword[1]); 571 - intel_de_write(dev_priv, ICL_DSC0_RC_BUF_THRESH_1(pipe), 573 + intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_1(pipe), 572 574 rc_buf_thresh_dword[2]); 573 - intel_de_write(dev_priv, ICL_DSC0_RC_BUF_THRESH_1_UDW(pipe), 575 + intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_1_UDW(pipe), 574 576 rc_buf_thresh_dword[3]); 575 577 if (vdsc_instances_per_pipe > 1) { 576 - intel_de_write(dev_priv, 578 + intel_de_write(display, 577 579 ICL_DSC1_RC_BUF_THRESH_0(pipe), 578 580 rc_buf_thresh_dword[0]); 579 - intel_de_write(dev_priv, 581 + intel_de_write(display, 580 582 ICL_DSC1_RC_BUF_THRESH_0_UDW(pipe), 581 583 rc_buf_thresh_dword[1]); 582 - intel_de_write(dev_priv, 584 + intel_de_write(display, 583 585 ICL_DSC1_RC_BUF_THRESH_1(pipe), 584 586 rc_buf_thresh_dword[2]); 585 - intel_de_write(dev_priv, 587 + intel_de_write(display, 586 588 ICL_DSC1_RC_BUF_THRESH_1_UDW(pipe), 587 589 rc_buf_thresh_dword[3]); 588 590 } ··· 599 601 (vdsc_cfg->rc_range_params[i].range_min_qp << 600 602 RC_MIN_QP_SHIFT)) << 16 * (i % 2)); 601 603 if (!is_pipe_dsc(crtc, cpu_transcoder)) { 602 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_0, 604 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_0, 603 605 rc_range_params_dword[0]); 604 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_0_UDW, 606 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_0_UDW, 605 607 rc_range_params_dword[1]); 606 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_1, 608 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_1, 607 609 rc_range_params_dword[2]); 608 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_1_UDW, 610 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_1_UDW, 609 611 rc_range_params_dword[3]); 610 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_2, 612 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_2, 611 613 rc_range_params_dword[4]); 612 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_2_UDW, 614 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_2_UDW, 613 615 rc_range_params_dword[5]); 614 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_3, 616 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_3, 615 617 rc_range_params_dword[6]); 616 - intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_3_UDW, 618 + intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_3_UDW, 617 619 rc_range_params_dword[7]); 618 620 if (vdsc_instances_per_pipe > 1) { 619 - intel_de_write(dev_priv, DSCC_RC_RANGE_PARAMETERS_0, 621 + intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_0, 620 622 rc_range_params_dword[0]); 621 - intel_de_write(dev_priv, 623 + intel_de_write(display, 622 624 DSCC_RC_RANGE_PARAMETERS_0_UDW, 623 625 rc_range_params_dword[1]); 624 - intel_de_write(dev_priv, DSCC_RC_RANGE_PARAMETERS_1, 626 + intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_1, 625 627 rc_range_params_dword[2]); 626 - intel_de_write(dev_priv, 628 + intel_de_write(display, 627 629 DSCC_RC_RANGE_PARAMETERS_1_UDW, 628 630 rc_range_params_dword[3]); 629 - intel_de_write(dev_priv, DSCC_RC_RANGE_PARAMETERS_2, 631 + intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_2, 630 632 rc_range_params_dword[4]); 631 - intel_de_write(dev_priv, 633 + intel_de_write(display, 632 634 DSCC_RC_RANGE_PARAMETERS_2_UDW, 633 635 rc_range_params_dword[5]); 634 - intel_de_write(dev_priv, DSCC_RC_RANGE_PARAMETERS_3, 636 + intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_3, 635 637 rc_range_params_dword[6]); 636 - intel_de_write(dev_priv, 638 + intel_de_write(display, 637 639 DSCC_RC_RANGE_PARAMETERS_3_UDW, 638 640 rc_range_params_dword[7]); 639 641 } 640 642 } else { 641 - intel_de_write(dev_priv, ICL_DSC0_RC_RANGE_PARAMETERS_0(pipe), 643 + intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_0(pipe), 642 644 rc_range_params_dword[0]); 643 - intel_de_write(dev_priv, 645 + intel_de_write(display, 644 646 ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW(pipe), 645 647 rc_range_params_dword[1]); 646 - intel_de_write(dev_priv, ICL_DSC0_RC_RANGE_PARAMETERS_1(pipe), 648 + intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_1(pipe), 647 649 rc_range_params_dword[2]); 648 - intel_de_write(dev_priv, 650 + intel_de_write(display, 649 651 ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW(pipe), 650 652 rc_range_params_dword[3]); 651 - intel_de_write(dev_priv, ICL_DSC0_RC_RANGE_PARAMETERS_2(pipe), 653 + intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_2(pipe), 652 654 rc_range_params_dword[4]); 653 - intel_de_write(dev_priv, 655 + intel_de_write(display, 654 656 ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW(pipe), 655 657 rc_range_params_dword[5]); 656 - intel_de_write(dev_priv, ICL_DSC0_RC_RANGE_PARAMETERS_3(pipe), 658 + intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_3(pipe), 657 659 rc_range_params_dword[6]); 658 - intel_de_write(dev_priv, 660 + intel_de_write(display, 659 661 ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW(pipe), 660 662 rc_range_params_dword[7]); 661 663 if (vdsc_instances_per_pipe > 1) { 662 - intel_de_write(dev_priv, 664 + intel_de_write(display, 663 665 ICL_DSC1_RC_RANGE_PARAMETERS_0(pipe), 664 666 rc_range_params_dword[0]); 665 - intel_de_write(dev_priv, 667 + intel_de_write(display, 666 668 ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW(pipe), 667 669 rc_range_params_dword[1]); 668 - intel_de_write(dev_priv, 670 + intel_de_write(display, 669 671 ICL_DSC1_RC_RANGE_PARAMETERS_1(pipe), 670 672 rc_range_params_dword[2]); 671 - intel_de_write(dev_priv, 673 + intel_de_write(display, 672 674 ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW(pipe), 673 675 rc_range_params_dword[3]); 674 - intel_de_write(dev_priv, 676 + intel_de_write(display, 675 677 ICL_DSC1_RC_RANGE_PARAMETERS_2(pipe), 676 678 rc_range_params_dword[4]); 677 - intel_de_write(dev_priv, 679 + intel_de_write(display, 678 680 ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW(pipe), 679 681 rc_range_params_dword[5]); 680 - intel_de_write(dev_priv, 682 + intel_de_write(display, 681 683 ICL_DSC1_RC_RANGE_PARAMETERS_3(pipe), 682 684 rc_range_params_dword[6]); 683 - intel_de_write(dev_priv, 685 + intel_de_write(display, 684 686 ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW(pipe), 685 687 rc_range_params_dword[7]); 686 688 } ··· 744 746 745 747 void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state) 746 748 { 749 + struct intel_display *display = to_intel_display(crtc_state); 747 750 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 748 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 749 751 u32 dss_ctl1_val = 0; 750 752 751 753 if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { ··· 754 756 else 755 757 dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY; 756 758 757 - intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); 759 + intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), 760 + dss_ctl1_val); 758 761 } 759 762 } 760 763 761 764 void intel_dsc_enable(const struct intel_crtc_state *crtc_state) 762 765 { 766 + struct intel_display *display = to_intel_display(crtc_state); 763 767 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 764 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 765 768 u32 dss_ctl1_val = 0; 766 769 u32 dss_ctl2_val = 0; 767 770 int vdsc_instances_per_pipe = intel_dsc_get_vdsc_per_pipe(crtc_state); ··· 795 796 if (intel_crtc_is_bigjoiner_primary(crtc_state)) 796 797 dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE; 797 798 } 798 - intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); 799 - intel_de_write(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); 799 + intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); 800 + intel_de_write(display, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); 800 801 } 801 802 802 803 void intel_dsc_disable(const struct intel_crtc_state *old_crtc_state) 803 804 { 805 + struct intel_display *display = to_intel_display(old_crtc_state); 804 806 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); 805 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 806 807 807 808 /* Disable only if either of them is enabled */ 808 809 if (old_crtc_state->dsc.compression_enable || 809 810 old_crtc_state->joiner_pipes) { 810 - intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); 811 - intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); 811 + intel_de_write(display, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); 812 + intel_de_write(display, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); 812 813 } 813 814 } 814 815 815 816 static u32 intel_dsc_pps_read(struct intel_crtc_state *crtc_state, int pps, 816 817 bool *all_equal) 817 818 { 818 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 819 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 819 + struct intel_display *display = to_intel_display(crtc_state); 820 820 i915_reg_t dsc_reg[3]; 821 821 int i, vdsc_per_pipe, dsc_reg_num; 822 822 u32 val; ··· 823 825 vdsc_per_pipe = intel_dsc_get_vdsc_per_pipe(crtc_state); 824 826 dsc_reg_num = min_t(int, ARRAY_SIZE(dsc_reg), vdsc_per_pipe); 825 827 826 - drm_WARN_ON_ONCE(&i915->drm, dsc_reg_num < vdsc_per_pipe); 828 + drm_WARN_ON_ONCE(display->drm, dsc_reg_num < vdsc_per_pipe); 827 829 828 830 intel_dsc_get_pps_reg(crtc_state, pps, dsc_reg, dsc_reg_num); 829 831 830 832 *all_equal = true; 831 833 832 - val = intel_de_read(i915, dsc_reg[0]); 834 + val = intel_de_read(display, dsc_reg[0]); 833 835 834 836 for (i = 1; i < dsc_reg_num; i++) { 835 - if (intel_de_read(i915, dsc_reg[i]) != val) { 837 + if (intel_de_read(display, dsc_reg[i]) != val) { 836 838 *all_equal = false; 837 839 break; 838 840 } ··· 843 845 844 846 static u32 intel_dsc_pps_read_and_verify(struct intel_crtc_state *crtc_state, int pps) 845 847 { 846 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 847 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 848 + struct intel_display *display = to_intel_display(crtc_state); 848 849 u32 val; 849 850 bool all_equal; 850 851 851 852 val = intel_dsc_pps_read(crtc_state, pps, &all_equal); 852 - drm_WARN_ON(&i915->drm, !all_equal); 853 + drm_WARN_ON(display->drm, !all_equal); 853 854 854 855 return val; 855 856 } 856 857 857 858 static void intel_dsc_get_pps_config(struct intel_crtc_state *crtc_state) 858 859 { 860 + struct intel_display *display = to_intel_display(crtc_state); 859 861 struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; 860 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 861 - struct drm_i915_private *i915 = to_i915(crtc->base.dev); 862 862 int num_vdsc_instances = intel_dsc_get_num_vdsc_instances(crtc_state); 863 863 u32 pps_temp; 864 864 ··· 942 946 943 947 vdsc_cfg->slice_chunk_size = REG_FIELD_GET(DSC_PPS16_SLICE_CHUNK_SIZE_MASK, pps_temp); 944 948 945 - if (DISPLAY_VER(i915) >= 14) { 949 + if (DISPLAY_VER(display) >= 14) { 946 950 /* PPS 17 */ 947 951 pps_temp = intel_dsc_pps_read_and_verify(crtc_state, 17); 948 952 ··· 960 964 { 961 965 struct intel_display *display = to_intel_display(crtc_state); 962 966 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 963 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 964 967 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; 965 968 enum intel_display_power_domain power_domain; 966 969 intel_wakeref_t wakeref; ··· 974 979 if (!wakeref) 975 980 return; 976 981 977 - dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc, cpu_transcoder)); 978 - dss_ctl2 = intel_de_read(dev_priv, dss_ctl2_reg(crtc, cpu_transcoder)); 982 + dss_ctl1 = intel_de_read(display, dss_ctl1_reg(crtc, cpu_transcoder)); 983 + dss_ctl2 = intel_de_read(display, dss_ctl2_reg(crtc, cpu_transcoder)); 979 984 980 985 crtc_state->dsc.compression_enable = dss_ctl2 & VDSC0_ENABLE; 981 986 if (!crtc_state->dsc.compression_enable) ··· 1015 1020 1016 1021 int intel_vdsc_min_cdclk(const struct intel_crtc_state *crtc_state) 1017 1022 { 1018 - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1019 - struct intel_display *display = to_intel_display(crtc); 1023 + struct intel_display *display = to_intel_display(crtc_state); 1020 1024 int num_vdsc_instances = intel_dsc_get_num_vdsc_instances(crtc_state); 1021 1025 int min_cdclk; 1022 1026
+6
drivers/gpu/drm/i915/display/intel_wm.c
··· 108 108 return i915->display.funcs.wm->get_hw_state(i915); 109 109 } 110 110 111 + void intel_wm_sanitize(struct drm_i915_private *i915) 112 + { 113 + if (i915->display.funcs.wm->sanitize) 114 + return i915->display.funcs.wm->sanitize(i915); 115 + } 116 + 111 117 bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state, 112 118 const struct intel_plane_state *plane_state) 113 119 {
+1
drivers/gpu/drm/i915/display/intel_wm.h
··· 25 25 struct intel_crtc *crtc); 26 26 int intel_compute_global_watermarks(struct intel_atomic_state *state); 27 27 void intel_wm_get_hw_state(struct drm_i915_private *i915); 28 + void intel_wm_sanitize(struct drm_i915_private *i915); 28 29 bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state, 29 30 const struct intel_plane_state *plane_state); 30 31 void intel_print_wm_latency(struct drm_i915_private *i915,
+34 -26
drivers/gpu/drm/i915/display/skl_scaler.c
··· 666 666 */ 667 667 668 668 static void glk_program_nearest_filter_coefs(struct intel_display *display, 669 + struct intel_dsb *dsb, 669 670 enum pipe pipe, int id, int set) 670 671 { 671 672 int i; 672 673 673 - intel_de_write_fw(display, GLK_PS_COEF_INDEX_SET(pipe, id, set), 674 - PS_COEF_INDEX_AUTO_INC); 674 + intel_de_write_dsb(display, dsb, 675 + GLK_PS_COEF_INDEX_SET(pipe, id, set), 676 + PS_COEF_INDEX_AUTO_INC); 675 677 676 678 for (i = 0; i < 17 * 7; i += 2) { 677 679 u32 tmp; ··· 685 683 t = glk_coef_tap(i + 1); 686 684 tmp |= glk_nearest_filter_coef(t) << 16; 687 685 688 - intel_de_write_fw(display, GLK_PS_COEF_DATA_SET(pipe, id, set), 689 - tmp); 686 + intel_de_write_dsb(display, dsb, 687 + GLK_PS_COEF_DATA_SET(pipe, id, set), tmp); 690 688 } 691 689 692 - intel_de_write_fw(display, GLK_PS_COEF_INDEX_SET(pipe, id, set), 0); 690 + intel_de_write_dsb(display, dsb, 691 + GLK_PS_COEF_INDEX_SET(pipe, id, set), 0); 693 692 } 694 693 695 694 static u32 skl_scaler_get_filter_select(enum drm_scaling_filter filter, int set) ··· 706 703 return PS_FILTER_MEDIUM; 707 704 } 708 705 709 - static void skl_scaler_setup_filter(struct intel_display *display, enum pipe pipe, 706 + static void skl_scaler_setup_filter(struct intel_display *display, 707 + struct intel_dsb *dsb, enum pipe pipe, 710 708 int id, int set, enum drm_scaling_filter filter) 711 709 { 712 710 switch (filter) { 713 711 case DRM_SCALING_FILTER_DEFAULT: 714 712 break; 715 713 case DRM_SCALING_FILTER_NEAREST_NEIGHBOR: 716 - glk_program_nearest_filter_coefs(display, pipe, id, set); 714 + glk_program_nearest_filter_coefs(display, dsb, pipe, id, set); 717 715 break; 718 716 default: 719 717 MISSING_CASE(filter); ··· 763 759 764 760 trace_intel_pipe_scaler_update_arm(crtc, id, x, y, width, height); 765 761 766 - skl_scaler_setup_filter(display, pipe, id, 0, 762 + skl_scaler_setup_filter(display, NULL, pipe, id, 0, 767 763 crtc_state->hw.scaling_filter); 768 764 769 765 intel_de_write_fw(display, SKL_PS_CTRL(pipe, id), ps_ctrl); ··· 779 775 } 780 776 781 777 void 782 - skl_program_plane_scaler(struct intel_plane *plane, 778 + skl_program_plane_scaler(struct intel_dsb *dsb, 779 + struct intel_plane *plane, 783 780 const struct intel_crtc_state *crtc_state, 784 781 const struct intel_plane_state *plane_state) 785 782 { ··· 830 825 trace_intel_plane_scaler_update_arm(plane, scaler_id, 831 826 crtc_x, crtc_y, crtc_w, crtc_h); 832 827 833 - skl_scaler_setup_filter(display, pipe, scaler_id, 0, 828 + skl_scaler_setup_filter(display, dsb, pipe, scaler_id, 0, 834 829 plane_state->hw.scaling_filter); 835 830 836 - intel_de_write_fw(display, SKL_PS_CTRL(pipe, scaler_id), ps_ctrl); 837 - intel_de_write_fw(display, SKL_PS_VPHASE(pipe, scaler_id), 838 - PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase)); 839 - intel_de_write_fw(display, SKL_PS_HPHASE(pipe, scaler_id), 840 - PS_Y_PHASE(y_hphase) | PS_UV_RGB_PHASE(uv_rgb_hphase)); 841 - intel_de_write_fw(display, SKL_PS_WIN_POS(pipe, scaler_id), 842 - PS_WIN_XPOS(crtc_x) | PS_WIN_YPOS(crtc_y)); 843 - intel_de_write_fw(display, SKL_PS_WIN_SZ(pipe, scaler_id), 844 - PS_WIN_XSIZE(crtc_w) | PS_WIN_YSIZE(crtc_h)); 831 + intel_de_write_dsb(display, dsb, SKL_PS_CTRL(pipe, scaler_id), 832 + ps_ctrl); 833 + intel_de_write_dsb(display, dsb, SKL_PS_VPHASE(pipe, scaler_id), 834 + PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase)); 835 + intel_de_write_dsb(display, dsb, SKL_PS_HPHASE(pipe, scaler_id), 836 + PS_Y_PHASE(y_hphase) | PS_UV_RGB_PHASE(uv_rgb_hphase)); 837 + intel_de_write_dsb(display, dsb, SKL_PS_WIN_POS(pipe, scaler_id), 838 + PS_WIN_XPOS(crtc_x) | PS_WIN_YPOS(crtc_y)); 839 + intel_de_write_dsb(display, dsb, SKL_PS_WIN_SZ(pipe, scaler_id), 840 + PS_WIN_XSIZE(crtc_w) | PS_WIN_YSIZE(crtc_h)); 845 841 } 846 842 847 - static void skl_detach_scaler(struct intel_crtc *crtc, int id) 843 + static void skl_detach_scaler(struct intel_dsb *dsb, 844 + struct intel_crtc *crtc, int id) 848 845 { 849 846 struct intel_display *display = to_intel_display(crtc); 850 847 851 848 trace_intel_scaler_disable_arm(crtc, id); 852 849 853 - intel_de_write_fw(display, SKL_PS_CTRL(crtc->pipe, id), 0); 854 - intel_de_write_fw(display, SKL_PS_WIN_POS(crtc->pipe, id), 0); 855 - intel_de_write_fw(display, SKL_PS_WIN_SZ(crtc->pipe, id), 0); 850 + intel_de_write_dsb(display, dsb, SKL_PS_CTRL(crtc->pipe, id), 0); 851 + intel_de_write_dsb(display, dsb, SKL_PS_WIN_POS(crtc->pipe, id), 0); 852 + intel_de_write_dsb(display, dsb, SKL_PS_WIN_SZ(crtc->pipe, id), 0); 856 853 } 857 854 858 855 /* 859 856 * This function detaches (aka. unbinds) unused scalers in hardware 860 857 */ 861 - void skl_detach_scalers(const struct intel_crtc_state *crtc_state) 858 + void skl_detach_scalers(struct intel_dsb *dsb, 859 + const struct intel_crtc_state *crtc_state) 862 860 { 863 861 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 864 862 const struct intel_crtc_scaler_state *scaler_state = ··· 871 863 /* loop through and disable scalers that aren't in use */ 872 864 for (i = 0; i < crtc->num_scalers; i++) { 873 865 if (!scaler_state->scalers[i].in_use) 874 - skl_detach_scaler(crtc, i); 866 + skl_detach_scaler(dsb, crtc, i); 875 867 } 876 868 } 877 869 ··· 881 873 int i; 882 874 883 875 for (i = 0; i < crtc->num_scalers; i++) 884 - skl_detach_scaler(crtc, i); 876 + skl_detach_scaler(NULL, crtc, i); 885 877 } 886 878 887 879 void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
+5 -2
drivers/gpu/drm/i915/display/skl_scaler.h
··· 8 8 struct intel_atomic_state; 9 9 struct intel_crtc; 10 10 struct intel_crtc_state; 11 + struct intel_dsb; 11 12 struct intel_plane; 12 13 struct intel_plane_state; 13 14 ··· 22 21 23 22 void skl_pfit_enable(const struct intel_crtc_state *crtc_state); 24 23 25 - void skl_program_plane_scaler(struct intel_plane *plane, 24 + void skl_program_plane_scaler(struct intel_dsb *dsb, 25 + struct intel_plane *plane, 26 26 const struct intel_crtc_state *crtc_state, 27 27 const struct intel_plane_state *plane_state); 28 - void skl_detach_scalers(const struct intel_crtc_state *crtc_state); 28 + void skl_detach_scalers(struct intel_dsb *dsb, 29 + const struct intel_crtc_state *crtc_state); 29 30 void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state); 30 31 31 32 void skl_scaler_get_config(struct intel_crtc_state *crtc_state);
+48 -5
drivers/gpu/drm/i915/display/skl_universal_plane.c
··· 1466 1466 * TODO: split into noarm+arm pair 1467 1467 */ 1468 1468 if (plane_state->scaler_id >= 0) 1469 - skl_program_plane_scaler(plane, crtc_state, plane_state); 1469 + skl_program_plane_scaler(dsb, plane, crtc_state, plane_state); 1470 1470 1471 1471 /* 1472 1472 * The control register self-arms if the plane was previously ··· 1646 1646 * TODO: split into noarm+arm pair 1647 1647 */ 1648 1648 if (plane_state->scaler_id >= 0) 1649 - skl_program_plane_scaler(plane, crtc_state, plane_state); 1649 + skl_program_plane_scaler(dsb, plane, crtc_state, plane_state); 1650 1650 1651 1651 icl_plane_update_sel_fetch_arm(dsb, plane, crtc_state, plane_state); 1652 1652 ··· 2258 2258 static void check_protection(struct intel_plane_state *plane_state) 2259 2259 { 2260 2260 struct intel_display *display = to_intel_display(plane_state); 2261 - struct drm_i915_private *i915 = to_i915(display->drm); 2262 2261 const struct drm_framebuffer *fb = plane_state->hw.fb; 2263 2262 struct drm_gem_object *obj = intel_fb_bo(fb); 2264 2263 2265 2264 if (DISPLAY_VER(display) < 11) 2266 2265 return; 2267 2266 2268 - plane_state->decrypt = intel_pxp_key_check(i915->pxp, obj, false) == 0; 2267 + plane_state->decrypt = intel_pxp_key_check(obj, false) == 0; 2269 2268 plane_state->force_black = intel_bo_is_protected(obj) && 2270 2269 !plane_state->decrypt; 2270 + } 2271 + 2272 + static void 2273 + make_damage_viewport_relative(struct intel_plane_state *plane_state) 2274 + { 2275 + const struct drm_framebuffer *fb = plane_state->hw.fb; 2276 + const struct drm_rect *src = &plane_state->uapi.src; 2277 + unsigned int rotation = plane_state->hw.rotation; 2278 + struct drm_rect *damage = &plane_state->damage; 2279 + 2280 + if (!drm_rect_visible(damage)) 2281 + return; 2282 + 2283 + if (!fb || !plane_state->uapi.visible) { 2284 + plane_state->damage = DRM_RECT_INIT(0, 0, 0, 0); 2285 + return; 2286 + } 2287 + 2288 + if (drm_rotation_90_or_270(rotation)) { 2289 + drm_rect_rotate(damage, fb->width, fb->height, 2290 + DRM_MODE_ROTATE_270); 2291 + drm_rect_translate(damage, -(src->y1 >> 16), -(src->x1 >> 16)); 2292 + } else { 2293 + drm_rect_translate(damage, -(src->x1 >> 16), -(src->y1 >> 16)); 2294 + } 2295 + } 2296 + 2297 + static void clip_damage(struct intel_plane_state *plane_state) 2298 + { 2299 + struct drm_rect *damage = &plane_state->damage; 2300 + struct drm_rect src; 2301 + 2302 + if (!drm_rect_visible(damage)) 2303 + return; 2304 + 2305 + drm_rect_fp_to_int(&src, &plane_state->uapi.src); 2306 + drm_rect_translate(damage, src.x1, src.y1); 2307 + drm_rect_intersect(damage, &src); 2271 2308 } 2272 2309 2273 2310 static int skl_plane_check(struct intel_crtc_state *crtc_state, ··· 2332 2295 if (ret) 2333 2296 return ret; 2334 2297 2298 + make_damage_viewport_relative(plane_state); 2299 + 2335 2300 ret = skl_check_plane_surface(plane_state); 2336 2301 if (ret) 2337 2302 return ret; ··· 2349 2310 if (ret) 2350 2311 return ret; 2351 2312 2313 + clip_damage(plane_state); 2314 + 2352 2315 ret = skl_plane_check_nv12_rotation(plane_state); 2353 2316 if (ret) 2354 2317 return ret; ··· 2358 2317 check_protection(plane_state); 2359 2318 2360 2319 /* HW only has 8 bits pixel precision, disable plane if invisible */ 2361 - if (!(plane_state->hw.alpha >> 8)) 2320 + if (!(plane_state->hw.alpha >> 8)) { 2362 2321 plane_state->uapi.visible = false; 2322 + plane_state->damage = DRM_RECT_INIT(0, 0, 0, 0); 2323 + } 2363 2324 2364 2325 plane_state->ctl = skl_plane_ctl(crtc_state, plane_state); 2365 2326
+51 -5
drivers/gpu/drm/i915/display/skl_watermark.c
··· 3157 3157 dbuf_state->joined_mbus = intel_de_read(display, MBUS_CTL) & MBUS_JOIN; 3158 3158 3159 3159 dbuf_state->mdclk_cdclk_ratio = intel_mdclk_cdclk_ratio(display, &display->cdclk.hw); 3160 + dbuf_state->active_pipes = 0; 3160 3161 3161 3162 for_each_intel_crtc(display->drm, crtc) { 3162 3163 struct intel_crtc_state *crtc_state = ··· 3169 3168 3170 3169 memset(&crtc_state->wm.skl.optimal, 0, 3171 3170 sizeof(crtc_state->wm.skl.optimal)); 3172 - if (crtc_state->hw.active) 3171 + if (crtc_state->hw.active) { 3173 3172 skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); 3173 + dbuf_state->active_pipes |= BIT(pipe); 3174 + } 3174 3175 crtc_state->wm.skl.raw = crtc_state->wm.skl.optimal; 3175 3176 3176 3177 memset(&dbuf_state->ddb[pipe], 0, sizeof(dbuf_state->ddb[pipe])); ··· 3840 3837 } 3841 3838 } 3842 3839 3843 - static void skl_wm_get_hw_state_and_sanitize(struct drm_i915_private *i915) 3840 + static void skl_wm_sanitize(struct drm_i915_private *i915) 3844 3841 { 3845 - skl_wm_get_hw_state(i915); 3846 - 3847 3842 skl_mbus_sanitize(i915); 3848 3843 skl_dbuf_sanitize(i915); 3844 + } 3845 + 3846 + void skl_wm_crtc_disable_noatomic(struct intel_crtc *crtc) 3847 + { 3848 + struct intel_display *display = to_intel_display(crtc); 3849 + struct intel_crtc_state *crtc_state = 3850 + to_intel_crtc_state(crtc->base.state); 3851 + struct intel_dbuf_state *dbuf_state = 3852 + to_intel_dbuf_state(display->dbuf.obj.state); 3853 + enum pipe pipe = crtc->pipe; 3854 + 3855 + if (DISPLAY_VER(display) < 9) 3856 + return; 3857 + 3858 + dbuf_state->active_pipes &= ~BIT(pipe); 3859 + 3860 + dbuf_state->weight[pipe] = 0; 3861 + dbuf_state->slices[pipe] = 0; 3862 + 3863 + memset(&dbuf_state->ddb[pipe], 0, sizeof(dbuf_state->ddb[pipe])); 3864 + 3865 + memset(&crtc_state->wm.skl.ddb, 0, sizeof(crtc_state->wm.skl.ddb)); 3866 + } 3867 + 3868 + void skl_wm_plane_disable_noatomic(struct intel_crtc *crtc, 3869 + struct intel_plane *plane) 3870 + { 3871 + struct intel_display *display = to_intel_display(crtc); 3872 + struct intel_crtc_state *crtc_state = 3873 + to_intel_crtc_state(crtc->base.state); 3874 + 3875 + if (DISPLAY_VER(display) < 9) 3876 + return; 3877 + 3878 + skl_ddb_entry_init(&crtc_state->wm.skl.plane_ddb[plane->id], 0, 0); 3879 + skl_ddb_entry_init(&crtc_state->wm.skl.plane_ddb[plane->id], 0, 0); 3880 + 3881 + crtc_state->wm.skl.plane_min_ddb[plane->id] = 0; 3882 + crtc_state->wm.skl.plane_interim_ddb[plane->id] = 0; 3883 + 3884 + memset(&crtc_state->wm.skl.raw.planes[plane->id], 0, 3885 + sizeof(crtc_state->wm.skl.raw.planes[plane->id])); 3886 + memset(&crtc_state->wm.skl.optimal.planes[plane->id], 0, 3887 + sizeof(crtc_state->wm.skl.optimal.planes[plane->id])); 3849 3888 } 3850 3889 3851 3890 void intel_wm_state_verify(struct intel_atomic_state *state, ··· 4017 3972 4018 3973 static const struct intel_wm_funcs skl_wm_funcs = { 4019 3974 .compute_global_watermarks = skl_compute_wm, 4020 - .get_hw_state = skl_wm_get_hw_state_and_sanitize, 3975 + .get_hw_state = skl_wm_get_hw_state, 3976 + .sanitize = skl_wm_sanitize, 4021 3977 }; 4022 3978 4023 3979 void skl_wm_init(struct drm_i915_private *i915)
+4
drivers/gpu/drm/i915/display/skl_watermark.h
··· 41 41 void intel_wm_state_verify(struct intel_atomic_state *state, 42 42 struct intel_crtc *crtc); 43 43 44 + void skl_wm_crtc_disable_noatomic(struct intel_crtc *crtc); 45 + void skl_wm_plane_disable_noatomic(struct intel_crtc *crtc, 46 + struct intel_plane *plane); 47 + 44 48 void skl_watermark_ipc_init(struct drm_i915_private *i915); 45 49 void skl_watermark_ipc_update(struct drm_i915_private *i915); 46 50 bool skl_watermark_ipc_enabled(struct drm_i915_private *i915);
+1 -1
drivers/gpu/drm/i915/display/vlv_dsi.c
··· 283 283 if (ret) 284 284 return ret; 285 285 286 - ret = intel_panel_fitting(pipe_config, conn_state); 286 + ret = intel_pfit_compute_config(pipe_config, conn_state); 287 287 if (ret) 288 288 return ret; 289 289
+5 -1
drivers/gpu/drm/i915/display/vlv_dsi_pll.h
··· 23 23 struct intel_crtc_state *config); 24 24 void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port); 25 25 26 - bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv); 27 26 int bxt_dsi_pll_compute(struct intel_encoder *encoder, 28 27 struct intel_crtc_state *config); 29 28 void bxt_dsi_pll_enable(struct intel_encoder *encoder, ··· 33 34 void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port); 34 35 35 36 #ifdef I915 37 + bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv); 36 38 void assert_dsi_pll_enabled(struct intel_display *display); 37 39 void assert_dsi_pll_disabled(struct intel_display *display); 38 40 #else 41 + static inline bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv) 42 + { 43 + return false; 44 + } 39 45 static inline void assert_dsi_pll_enabled(struct intel_display *display) 40 46 { 41 47 }
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 915 915 */ 916 916 if (i915_gem_context_uses_protected_content(eb->gem_context) && 917 917 i915_gem_object_is_protected(obj)) { 918 - err = intel_pxp_key_check(eb->i915->pxp, intel_bo_to_drm_bo(obj), true); 918 + err = intel_pxp_key_check(intel_bo_to_drm_bo(obj), true); 919 919 if (err) { 920 920 i915_gem_object_put(obj); 921 921 return ERR_PTR(err);
+1 -1
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 677 677 * in case we aborted before completely initialising the engines. 678 678 */ 679 679 GEM_BUG_ON(intel_gt_pm_is_awake(gt)); 680 - if (!INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 680 + if (!intel_gt_gpu_reset_clobbers_display(gt)) 681 681 intel_gt_reset_all_engines(gt); 682 682 683 683 /* Decouple the backend; but keep the layout for late GPU resets */
+2 -1
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
··· 328 328 329 329 static struct i915_fence_reg *fence_find(struct i915_ggtt *ggtt) 330 330 { 331 + struct intel_display *display = &ggtt->vm.i915->display; 331 332 struct i915_fence_reg *active = NULL; 332 333 struct i915_fence_reg *fence, *fn; 333 334 ··· 354 353 } 355 354 356 355 /* Wait for completion of pending flips which consume fences */ 357 - if (intel_has_pending_fb_unpin(ggtt->vm.i915)) 356 + if (intel_has_pending_fb_unpin(display)) 358 357 return ERR_PTR(-EAGAIN); 359 358 360 359 return ERR_PTR(-ENOBUFS);
+1 -1
drivers/gpu/drm/i915/gt/intel_gt_pm.c
··· 158 158 159 159 static bool reset_engines(struct intel_gt *gt) 160 160 { 161 - if (INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 161 + if (intel_gt_gpu_reset_clobbers_display(gt)) 162 162 return false; 163 163 164 164 return intel_gt_reset_all_engines(gt) == 0;
+34 -7
drivers/gpu/drm/i915/gt/intel_reset.c
··· 986 986 awake = reset_prepare(gt); 987 987 988 988 /* Even if the GPU reset fails, it should still stop the engines */ 989 - if (!INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 989 + if (!intel_gt_gpu_reset_clobbers_display(gt)) 990 990 intel_gt_reset_all_engines(gt); 991 991 992 992 for_each_engine(engine, gt, id) ··· 1106 1106 1107 1107 /* We must reset pending GPU events before restoring our submission */ 1108 1108 ok = !HAS_EXECLISTS(gt->i915); /* XXX better agnosticism desired */ 1109 - if (!INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 1109 + if (!intel_gt_gpu_reset_clobbers_display(gt)) 1110 1110 ok = intel_gt_reset_all_engines(gt) == 0; 1111 1111 if (!ok) { 1112 1112 /* ··· 1178 1178 return 0; 1179 1179 } 1180 1180 1181 + bool intel_gt_gpu_reset_clobbers_display(struct intel_gt *gt) 1182 + { 1183 + struct drm_i915_private *i915 = gt->i915; 1184 + 1185 + return INTEL_INFO(i915)->gpu_reset_clobbers_display; 1186 + } 1187 + 1181 1188 /** 1182 1189 * intel_gt_reset - reset chip after a hang 1183 1190 * @gt: #intel_gt to reset ··· 1241 1234 goto error; 1242 1235 } 1243 1236 1244 - if (INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 1237 + if (intel_gt_gpu_reset_clobbers_display(gt)) 1245 1238 intel_irq_suspend(gt->i915); 1246 1239 1247 1240 if (do_reset(gt, stalled_mask)) { ··· 1249 1242 goto taint; 1250 1243 } 1251 1244 1252 - if (INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) 1245 + if (intel_gt_gpu_reset_clobbers_display(gt)) 1253 1246 intel_irq_resume(gt->i915); 1254 1247 1255 1248 intel_overlay_reset(display); ··· 1403 1396 return err; 1404 1397 } 1405 1398 1399 + static void display_reset_modeset_stuck(void *gt) 1400 + { 1401 + intel_gt_set_wedged(gt); 1402 + } 1403 + 1406 1404 static void intel_gt_reset_global(struct intel_gt *gt, 1407 1405 u32 engine_mask, 1408 1406 const char *reason) ··· 1425 1413 1426 1414 /* Use a watchdog to ensure that our reset completes */ 1427 1415 intel_wedge_on_timeout(&w, gt, 60 * HZ) { 1428 - intel_display_reset_prepare(gt->i915); 1416 + struct drm_i915_private *i915 = gt->i915; 1417 + struct intel_display *display = &i915->display; 1418 + bool need_display_reset; 1419 + bool reset_display; 1420 + 1421 + need_display_reset = intel_gt_gpu_reset_clobbers_display(gt) && 1422 + intel_has_gpu_reset(gt); 1423 + 1424 + reset_display = intel_display_reset_test(display) || 1425 + need_display_reset; 1426 + 1427 + if (reset_display) 1428 + reset_display = intel_display_reset_prepare(display, 1429 + display_reset_modeset_stuck, 1430 + gt); 1429 1431 1430 1432 intel_gt_reset(gt, engine_mask, reason); 1431 1433 1432 - intel_display_reset_finish(gt->i915); 1434 + if (reset_display) 1435 + intel_display_reset_finish(display, !need_display_reset); 1433 1436 } 1434 1437 1435 1438 if (!test_bit(I915_WEDGED, &gt->reset.flags)) ··· 1512 1485 intel_has_reset_engine(gt) && !intel_gt_is_wedged(gt)) { 1513 1486 local_bh_disable(); 1514 1487 for_each_engine_masked(engine, gt, engine_mask, tmp) { 1515 - BUILD_BUG_ON(I915_RESET_MODESET >= I915_RESET_ENGINE); 1488 + BUILD_BUG_ON(I915_RESET_BACKOFF >= I915_RESET_ENGINE); 1516 1489 if (test_and_set_bit(I915_RESET_ENGINE + engine->id, 1517 1490 &gt->reset.flags)) 1518 1491 continue;
+2
drivers/gpu/drm/i915/gt/intel_reset.h
··· 28 28 const char *fmt, ...); 29 29 #define I915_ERROR_CAPTURE BIT(0) 30 30 31 + bool intel_gt_gpu_reset_clobbers_display(struct intel_gt *gt); 32 + 31 33 void intel_gt_reset(struct intel_gt *gt, 32 34 intel_engine_mask_t stalled_mask, 33 35 const char *reason);
+1 -2
drivers/gpu/drm/i915/gt/intel_reset_types.h
··· 41 41 */ 42 42 unsigned long flags; 43 43 #define I915_RESET_BACKOFF 0 44 - #define I915_RESET_MODESET 1 45 - #define I915_RESET_ENGINE 2 44 + #define I915_RESET_ENGINE 1 46 45 #define I915_WEDGED_ON_INIT (BITS_PER_LONG - 3) 47 46 #define I915_WEDGED_ON_FINI (BITS_PER_LONG - 2) 48 47 #define I915_WEDGED (BITS_PER_LONG - 1)
-3
drivers/gpu/drm/i915/i915_debugfs.c
··· 411 411 if (!HAS_RUNTIME_PM(dev_priv)) 412 412 seq_puts(m, "Runtime power management not supported\n"); 413 413 414 - seq_printf(m, "Runtime power status: %s\n", 415 - str_enabled_disabled(!dev_priv->display.power.domains.init_wakeref)); 416 - 417 414 seq_printf(m, "GPU idle: %s\n", str_yes_no(!to_gt(dev_priv)->awake)); 418 415 seq_printf(m, "IRQs disabled: %s\n", 419 416 str_yes_no(!intel_irqs_enabled(dev_priv)));
+10 -6
drivers/gpu/drm/i915/i915_driver.c
··· 41 41 #include <linux/vt.h> 42 42 43 43 #include <drm/drm_atomic_helper.h> 44 + #include <drm/drm_client.h> 45 + #include <drm/drm_client_event.h> 44 46 #include <drm/drm_ioctl.h> 45 47 #include <drm/drm_managed.h> 46 48 #include <drm/drm_probe_helper.h> ··· 202 200 203 201 static void sanitize_gpu(struct drm_i915_private *i915) 204 202 { 205 - if (!INTEL_INFO(i915)->gpu_reset_clobbers_display) { 203 + if (!intel_gt_gpu_reset_clobbers_display(to_gt(i915))) { 206 204 struct intel_gt *gt; 207 205 unsigned int i; 208 206 ··· 970 968 intel_runtime_pm_disable(&i915->runtime_pm); 971 969 intel_power_domains_disable(display); 972 970 973 - intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true); 971 + drm_client_dev_suspend(&i915->drm, false); 974 972 if (HAS_DISPLAY(i915)) { 975 973 drm_kms_helper_poll_disable(&i915->drm); 976 974 intel_display_driver_disable_user_access(display); ··· 1053 1051 /* We do a lot of poking in a lot of registers, make sure they work 1054 1052 * properly. */ 1055 1053 intel_power_domains_disable(display); 1056 - intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true); 1054 + drm_client_dev_suspend(dev, false); 1057 1055 if (HAS_DISPLAY(dev_priv)) { 1058 1056 drm_kms_helper_poll_disable(dev); 1059 1057 intel_display_driver_disable_user_access(display); ··· 1072 1070 intel_encoder_suspend_all(&dev_priv->display); 1073 1071 1074 1072 /* Must be called before GGTT is suspended. */ 1075 - intel_dpt_suspend(dev_priv); 1073 + intel_dpt_suspend(display); 1076 1074 i915_ggtt_suspend(to_gt(dev_priv)->ggtt); 1077 1075 1078 1076 i9xx_display_sr_save(display); ··· 1189 1187 setup_private_pat(gt); 1190 1188 1191 1189 /* Must be called after GGTT is resumed. */ 1192 - intel_dpt_resume(dev_priv); 1190 + intel_dpt_resume(display); 1193 1191 1194 1192 intel_dmc_resume(display); 1195 1193 ··· 1239 1237 1240 1238 intel_opregion_resume(display); 1241 1239 1242 - intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false); 1240 + drm_client_dev_resume(dev, false); 1243 1241 1244 1242 intel_power_domains_enable(display); 1245 1243 ··· 1808 1806 1809 1807 .dumb_create = i915_gem_dumb_create, 1810 1808 .dumb_map_offset = i915_gem_dumb_mmap_offset, 1809 + 1810 + INTEL_FBDEV_DRIVER_OPS, 1811 1811 1812 1812 .ioctls = i915_ioctls, 1813 1813 .num_ioctls = ARRAY_SIZE(i915_ioctls),
-2
drivers/gpu/drm/i915/i915_gpu_error.h
··· 224 224 /* Protected by the above dev->gpu_error.lock. */ 225 225 struct i915_gpu_coredump *first_error; 226 226 227 - atomic_t pending_fb_pin; 228 - 229 227 /** Number of times the device has been reset (global) */ 230 228 atomic_t reset_count; 231 229
+59
drivers/gpu/drm/i915/i915_gtt_view_types.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #ifndef __I915_GTT_VIEW_TYPES_H__ 5 + #define __I915_GTT_VIEW_TYPES_H__ 6 + 7 + #include <linux/types.h> 8 + 9 + struct intel_remapped_plane_info { 10 + /* in gtt pages */ 11 + u32 offset:31; 12 + u32 linear:1; 13 + union { 14 + /* in gtt pages for !linear */ 15 + struct { 16 + u16 width; 17 + u16 height; 18 + u16 src_stride; 19 + u16 dst_stride; 20 + }; 21 + 22 + /* in gtt pages for linear */ 23 + u32 size; 24 + }; 25 + } __packed; 26 + 27 + struct intel_rotation_info { 28 + struct intel_remapped_plane_info plane[2]; 29 + } __packed; 30 + 31 + struct intel_partial_info { 32 + u64 offset; 33 + unsigned int size; 34 + } __packed; 35 + 36 + struct intel_remapped_info { 37 + struct intel_remapped_plane_info plane[4]; 38 + /* in gtt pages */ 39 + u32 plane_alignment; 40 + } __packed; 41 + 42 + enum i915_gtt_view_type { 43 + I915_GTT_VIEW_NORMAL = 0, 44 + I915_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info), 45 + I915_GTT_VIEW_PARTIAL = sizeof(struct intel_partial_info), 46 + I915_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info), 47 + }; 48 + 49 + struct i915_gtt_view { 50 + enum i915_gtt_view_type type; 51 + union { 52 + /* Members need to contain no holes/padding */ 53 + struct intel_partial_info partial; 54 + struct intel_rotation_info rotated; 55 + struct intel_remapped_info remapped; 56 + }; 57 + }; 58 + 59 + #endif /* __I915_GTT_VIEW_TYPES_H__ */
+2 -72
drivers/gpu/drm/i915/i915_reg.h
··· 1385 1385 /* ADL and later: */ 1386 1386 #define VIDEO_DIP_ENABLE_AS_ADL REG_BIT(23) 1387 1387 1388 - /* Panel fitting */ 1389 - #define PFIT_CONTROL(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61230) 1390 - #define PFIT_ENABLE REG_BIT(31) 1391 - #define PFIT_PIPE_MASK REG_GENMASK(30, 29) /* 965+ */ 1392 - #define PFIT_PIPE(pipe) REG_FIELD_PREP(PFIT_PIPE_MASK, (pipe)) 1393 - #define PFIT_SCALING_MASK REG_GENMASK(28, 26) /* 965+ */ 1394 - #define PFIT_SCALING_AUTO REG_FIELD_PREP(PFIT_SCALING_MASK, 0) 1395 - #define PFIT_SCALING_PROGRAMMED REG_FIELD_PREP(PFIT_SCALING_MASK, 1) 1396 - #define PFIT_SCALING_PILLAR REG_FIELD_PREP(PFIT_SCALING_MASK, 2) 1397 - #define PFIT_SCALING_LETTER REG_FIELD_PREP(PFIT_SCALING_MASK, 3) 1398 - #define PFIT_FILTER_MASK REG_GENMASK(25, 24) /* 965+ */ 1399 - #define PFIT_FILTER_FUZZY REG_FIELD_PREP(PFIT_FILTER_MASK, 0) 1400 - #define PFIT_FILTER_CRISP REG_FIELD_PREP(PFIT_FILTER_MASK, 1) 1401 - #define PFIT_FILTER_MEDIAN REG_FIELD_PREP(PFIT_FILTER_MASK, 2) 1402 - #define PFIT_VERT_INTERP_MASK REG_GENMASK(11, 10) /* pre-965 */ 1403 - #define PFIT_VERT_INTERP_BILINEAR REG_FIELD_PREP(PFIT_VERT_INTERP_MASK, 1) 1404 - #define PFIT_VERT_AUTO_SCALE REG_BIT(9) /* pre-965 */ 1405 - #define PFIT_HORIZ_INTERP_MASK REG_GENMASK(7, 6) /* pre-965 */ 1406 - #define PFIT_HORIZ_INTERP_BILINEAR REG_FIELD_PREP(PFIT_HORIZ_INTERP_MASK, 1) 1407 - #define PFIT_HORIZ_AUTO_SCALE REG_BIT(5) /* pre-965 */ 1408 - #define PFIT_PANEL_8TO6_DITHER_ENABLE REG_BIT(3) /* pre-965 */ 1409 - 1410 - #define PFIT_PGM_RATIOS(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61234) 1411 - #define PFIT_VERT_SCALE_MASK REG_GENMASK(31, 20) /* pre-965 */ 1412 - #define PFIT_VERT_SCALE(x) REG_FIELD_PREP(PFIT_VERT_SCALE_MASK, (x)) 1413 - #define PFIT_HORIZ_SCALE_MASK REG_GENMASK(15, 4) /* pre-965 */ 1414 - #define PFIT_HORIZ_SCALE(x) REG_FIELD_PREP(PFIT_HORIZ_SCALE_MASK, (x)) 1415 - #define PFIT_VERT_SCALE_MASK_965 REG_GENMASK(28, 16) /* 965+ */ 1416 - #define PFIT_HORIZ_SCALE_MASK_965 REG_GENMASK(12, 0) /* 965+ */ 1417 - 1418 - #define PFIT_AUTO_RATIOS(dev_priv) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61238) 1419 - 1420 1388 #define PCH_GTC_CTL _MMIO(0xe7000) 1421 1389 #define PCH_GTC_ENABLE (1 << 31) 1422 1390 ··· 1878 1910 #define _PIPEA_LINK_N2 0x6004c 1879 1911 #define _PIPEB_LINK_N2 0x6104c 1880 1912 #define PIPE_LINK_N2(dev_priv, tran) _MMIO_TRANS2(dev_priv, tran, _PIPEA_LINK_N2) 1881 - 1882 - /* CPU panel fitter */ 1883 - /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */ 1884 - #define _PFA_CTL_1 0x68080 1885 - #define _PFB_CTL_1 0x68880 1886 - #define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1) 1887 - #define PF_ENABLE REG_BIT(31) 1888 - #define PF_PIPE_SEL_MASK_IVB REG_GENMASK(30, 29) /* ivb/hsw */ 1889 - #define PF_PIPE_SEL_IVB(pipe) REG_FIELD_PREP(PF_PIPE_SEL_MASK_IVB, (pipe)) 1890 - #define PF_FILTER_MASK REG_GENMASK(24, 23) 1891 - #define PF_FILTER_PROGRAMMED REG_FIELD_PREP(PF_FILTER_MASK, 0) 1892 - #define PF_FILTER_MED_3x3 REG_FIELD_PREP(PF_FILTER_MASK, 1) 1893 - #define PF_FILTER_EDGE_ENHANCE REG_FIELD_PREP(PF_FILTER_EDGE_MASK, 2) 1894 - #define PF_FILTER_EDGE_SOFTEN REG_FIELD_PREP(PF_FILTER_EDGE_MASK, 3) 1895 - 1896 - #define _PFA_WIN_SZ 0x68074 1897 - #define _PFB_WIN_SZ 0x68874 1898 - #define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ) 1899 - #define PF_WIN_XSIZE_MASK REG_GENMASK(31, 16) 1900 - #define PF_WIN_XSIZE(w) REG_FIELD_PREP(PF_WIN_XSIZE_MASK, (w)) 1901 - #define PF_WIN_YSIZE_MASK REG_GENMASK(15, 0) 1902 - #define PF_WIN_YSIZE(h) REG_FIELD_PREP(PF_WIN_YSIZE_MASK, (h)) 1903 - 1904 - #define _PFA_WIN_POS 0x68070 1905 - #define _PFB_WIN_POS 0x68870 1906 - #define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS) 1907 - #define PF_WIN_XPOS_MASK REG_GENMASK(31, 16) 1908 - #define PF_WIN_XPOS(x) REG_FIELD_PREP(PF_WIN_XPOS_MASK, (x)) 1909 - #define PF_WIN_YPOS_MASK REG_GENMASK(15, 0) 1910 - #define PF_WIN_YPOS(y) REG_FIELD_PREP(PF_WIN_YPOS_MASK, (y)) 1911 - 1912 - #define _PFA_VSCALE 0x68084 1913 - #define _PFB_VSCALE 0x68884 1914 - #define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE) 1915 - 1916 - #define _PFA_HSCALE 0x68090 1917 - #define _PFB_HSCALE 0x68890 1918 - #define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE) 1919 1913 1920 1914 /* 1921 1915 * Skylake scalers ··· 4165 4235 _MMIO_PIPE(pipe, _PIPE_FLIPDONETMSTMP_A, _PIPE_FLIPDONETMSTMP_B) 4166 4236 4167 4237 #define _VLV_PIPE_MSA_MISC_A 0x70048 4168 - #define VLV_PIPE_MSA_MISC(pipe) \ 4169 - _MMIO_PIPE2(dev_priv, pipe, _VLV_PIPE_MSA_MISC_A) 4238 + #define VLV_PIPE_MSA_MISC(__display, pipe) \ 4239 + _MMIO_PIPE2(__display, pipe, _VLV_PIPE_MSA_MISC_A) 4170 4240 #define VLV_MSA_MISC1_HW_ENABLE REG_BIT(31) 4171 4241 #define VLV_MSA_MISC1_SW_S3D_MASK REG_GENMASK(2, 0) /* MSA MISC1 3:1 */ 4172 4242
+2 -50
drivers/gpu/drm/i915/i915_vma_types.h
··· 32 32 33 33 #include "gem/i915_gem_object_types.h" 34 34 35 + #include "i915_gtt_view_types.h" 36 + 35 37 /** 36 38 * DOC: Global GTT views 37 39 * ··· 97 95 98 96 struct i915_vma_resource; 99 97 100 - struct intel_remapped_plane_info { 101 - /* in gtt pages */ 102 - u32 offset:31; 103 - u32 linear:1; 104 - union { 105 - /* in gtt pages for !linear */ 106 - struct { 107 - u16 width; 108 - u16 height; 109 - u16 src_stride; 110 - u16 dst_stride; 111 - }; 112 - 113 - /* in gtt pages for linear */ 114 - u32 size; 115 - }; 116 - } __packed; 117 - 118 - struct intel_remapped_info { 119 - struct intel_remapped_plane_info plane[4]; 120 - /* in gtt pages */ 121 - u32 plane_alignment; 122 - } __packed; 123 - 124 - struct intel_rotation_info { 125 - struct intel_remapped_plane_info plane[2]; 126 - } __packed; 127 - 128 - struct intel_partial_info { 129 - u64 offset; 130 - unsigned int size; 131 - } __packed; 132 - 133 - enum i915_gtt_view_type { 134 - I915_GTT_VIEW_NORMAL = 0, 135 - I915_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info), 136 - I915_GTT_VIEW_PARTIAL = sizeof(struct intel_partial_info), 137 - I915_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info), 138 - }; 139 - 140 98 static inline void assert_i915_gem_gtt_types(void) 141 99 { 142 100 BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 2 * sizeof(u32) + 8 * sizeof(u16)); ··· 121 159 break; 122 160 } 123 161 } 124 - 125 - struct i915_gtt_view { 126 - enum i915_gtt_view_type type; 127 - union { 128 - /* Members need to contain no holes/padding */ 129 - struct intel_partial_info partial; 130 - struct intel_rotation_info rotated; 131 - struct intel_remapped_info remapped; 132 - }; 133 - }; 134 162 135 163 /** 136 164 * DOC: Virtual Memory Address
+1
drivers/gpu/drm/i915/intel_gvt_mmio_table.c
··· 18 18 #include "display/intel_fbc_regs.h" 19 19 #include "display/intel_fdi_regs.h" 20 20 #include "display/intel_lvds_regs.h" 21 + #include "display/intel_pfit_regs.h" 21 22 #include "display/intel_psr_regs.h" 22 23 #include "display/intel_sprite_regs.h" 23 24 #include "display/skl_universal_plane_regs.h"
+3 -3
drivers/gpu/drm/i915/pxp/intel_pxp.c
··· 460 460 intel_pxp_irq_disable(pxp); 461 461 } 462 462 463 - int intel_pxp_key_check(struct intel_pxp *pxp, 464 - struct drm_gem_object *_obj, 465 - bool assign) 463 + int intel_pxp_key_check(struct drm_gem_object *_obj, bool assign) 466 464 { 467 465 struct drm_i915_gem_object *obj = to_intel_bo(_obj); 466 + struct drm_i915_private *i915 = to_i915(_obj->dev); 467 + struct intel_pxp *pxp = i915->pxp; 468 468 469 469 if (!intel_pxp_is_active(pxp)) 470 470 return -ENODEV;
+1 -3
drivers/gpu/drm/i915/pxp/intel_pxp.h
··· 31 31 int intel_pxp_start(struct intel_pxp *pxp); 32 32 void intel_pxp_end(struct intel_pxp *pxp); 33 33 34 - int intel_pxp_key_check(struct intel_pxp *pxp, 35 - struct drm_gem_object *obj, 36 - bool assign); 34 + int intel_pxp_key_check(struct drm_gem_object *obj, bool assign); 37 35 38 36 void intel_pxp_invalidate(struct intel_pxp *pxp); 39 37
+15
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #ifndef __I915_GEM_OBJECT_H__ 5 + #define __I915_GEM_OBJECT_H__ 6 + 7 + struct dma_fence; 8 + struct i915_sched_attr; 9 + 10 + static inline void i915_gem_fence_wait_priority(struct dma_fence *fence, 11 + const struct i915_sched_attr *attr) 12 + { 13 + } 14 + 15 + #endif
-8
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
··· 95 95 96 96 #define HAS_128_BYTE_Y_TILING(xe) (xe || 1) 97 97 98 - #define I915_PRIORITY_DISPLAY 0 99 - struct i915_sched_attr { 100 - int priority; 101 - }; 102 - #define i915_gem_fence_wait_priority(fence, attr) do { (void) attr; } while (0) 103 - 104 - #define FORCEWAKE_ALL XE_FORCEWAKE_ALL 105 - 106 98 #ifdef CONFIG_ARM64 107 99 /* 108 100 * arm64 indirectly includes linux/rtc.h,
+7
drivers/gpu/drm/xe/compat-i915-headers/i915_gtt_view_types.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #include "../../i915/i915_gtt_view_types.h" 5 + 6 + /* Partial view not supported in xe, fail build if used. */ 7 + #define I915_GTT_VIEW_PARTIAL
+13
drivers/gpu/drm/xe/compat-i915-headers/i915_scheduler_types.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright © 2025 Intel Corporation */ 3 + 4 + #ifndef __I915_SCHEDULER_TYPES_H__ 5 + #define __I915_SCHEDULER_TYPES_H__ 6 + 7 + #define I915_PRIORITY_DISPLAY 0 8 + 9 + struct i915_sched_attr { 10 + int priority; 11 + }; 12 + 13 + #endif
-74
drivers/gpu/drm/xe/compat-i915-headers/i915_vma_types.h
··· 1 - /* SPDX-License-Identifier: MIT */ 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #include <linux/types.h> 7 - #include <linux/build_bug.h> 8 - 9 - /* XX: Figure out how to handle this vma mapping in xe */ 10 - struct intel_remapped_plane_info { 11 - /* in gtt pages */ 12 - u32 offset:31; 13 - u32 linear:1; 14 - union { 15 - /* in gtt pages for !linear */ 16 - struct { 17 - u16 width; 18 - u16 height; 19 - u16 src_stride; 20 - u16 dst_stride; 21 - }; 22 - 23 - /* in gtt pages for linear */ 24 - u32 size; 25 - }; 26 - } __packed; 27 - 28 - struct intel_remapped_info { 29 - struct intel_remapped_plane_info plane[4]; 30 - /* in gtt pages */ 31 - u32 plane_alignment; 32 - } __packed; 33 - 34 - struct intel_rotation_info { 35 - struct intel_remapped_plane_info plane[2]; 36 - } __packed; 37 - 38 - enum i915_gtt_view_type { 39 - I915_GTT_VIEW_NORMAL = 0, 40 - I915_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info), 41 - I915_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info), 42 - }; 43 - 44 - static inline void assert_i915_gem_gtt_types(void) 45 - { 46 - BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 2 * sizeof(u32) + 8 * sizeof(u16)); 47 - BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 5 * sizeof(u32) + 16 * sizeof(u16)); 48 - 49 - /* Check that rotation/remapped shares offsets for simplicity */ 50 - BUILD_BUG_ON(offsetof(struct intel_remapped_info, plane[0]) != 51 - offsetof(struct intel_rotation_info, plane[0])); 52 - BUILD_BUG_ON(offsetofend(struct intel_remapped_info, plane[1]) != 53 - offsetofend(struct intel_rotation_info, plane[1])); 54 - 55 - /* As we encode the size of each branch inside the union into its type, 56 - * we have to be careful that each branch has a unique size. 57 - */ 58 - switch ((enum i915_gtt_view_type)0) { 59 - case I915_GTT_VIEW_NORMAL: 60 - case I915_GTT_VIEW_ROTATED: 61 - case I915_GTT_VIEW_REMAPPED: 62 - /* gcc complains if these are identical cases */ 63 - break; 64 - } 65 - } 66 - 67 - struct i915_gtt_view { 68 - enum i915_gtt_view_type type; 69 - union { 70 - /* Members need to contain no holes/padding */ 71 - struct intel_rotation_info rotated; 72 - struct intel_remapped_info remapped; 73 - }; 74 - };
+2
drivers/gpu/drm/xe/compat-i915-headers/intel_uncore.h
··· 10 10 #include "xe_device_types.h" 11 11 #include "xe_mmio.h" 12 12 13 + #define FORCEWAKE_ALL XE_FORCEWAKE_ALL 14 + 13 15 static inline struct intel_uncore *to_intel_uncore(struct drm_device *drm) 14 16 { 15 17 return &to_xe_device(drm)->uncore;
+2 -5
drivers/gpu/drm/xe/compat-i915-headers/pxp/intel_pxp.h
··· 12 12 #include "xe_pxp.h" 13 13 14 14 struct drm_gem_object; 15 - struct xe_pxp; 16 15 17 - static inline int intel_pxp_key_check(struct xe_pxp *pxp, 18 - struct drm_gem_object *obj, 19 - bool assign) 16 + static inline int intel_pxp_key_check(struct drm_gem_object *obj, bool assign) 20 17 { 21 18 /* 22 19 * The assign variable is used in i915 to assign the key to the BO at ··· 23 26 if (assign) 24 27 return -EINVAL; 25 28 26 - return xe_pxp_obj_key_check(pxp, obj); 29 + return xe_pxp_obj_key_check(obj); 27 30 } 28 31 29 32 #endif
+2 -2
drivers/gpu/drm/xe/display/intel_fbdev_fb.c
··· 45 45 NULL, size, 46 46 ttm_bo_type_kernel, XE_BO_FLAG_SCANOUT | 47 47 XE_BO_FLAG_STOLEN | 48 - XE_BO_FLAG_PINNED); 48 + XE_BO_FLAG_GGTT | XE_BO_FLAG_PINNED); 49 49 if (!IS_ERR(obj)) 50 50 drm_info(&xe->drm, "Allocated fbdev into stolen\n"); 51 51 else ··· 56 56 obj = xe_bo_create_pin_map(xe, xe_device_get_root_tile(xe), NULL, size, 57 57 ttm_bo_type_kernel, XE_BO_FLAG_SCANOUT | 58 58 XE_BO_FLAG_VRAM_IF_DGFX(xe_device_get_root_tile(xe)) | 59 - XE_BO_FLAG_PINNED); 59 + XE_BO_FLAG_GGTT | XE_BO_FLAG_PINNED); 60 60 } 61 61 62 62 if (IS_ERR(obj)) {
+10 -3
drivers/gpu/drm/xe/display/xe_display.c
··· 8 8 9 9 #include <linux/fb.h> 10 10 11 + #include <drm/drm_client.h> 12 + #include <drm/drm_client_event.h> 11 13 #include <drm/drm_drv.h> 12 14 #include <drm/drm_managed.h> 13 15 #include <drm/drm_probe_helper.h> ··· 68 66 { 69 67 if (!xe_modparam.probe_display) 70 68 return; 69 + 70 + #ifdef CONFIG_DRM_FBDEV_EMULATION 71 + driver->fbdev_probe = intel_fbdev_driver_fbdev_probe; 72 + #endif 71 73 72 74 driver->driver_features |= DRIVER_MODESET | DRIVER_ATOMIC; 73 75 } ··· 345 339 * properly. 346 340 */ 347 341 intel_power_domains_disable(display); 348 - intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true); 342 + drm_client_dev_suspend(&xe->drm, false); 349 343 350 344 if (has_display(xe)) { 351 345 drm_kms_helper_poll_disable(&xe->drm); ··· 375 369 return; 376 370 377 371 intel_power_domains_disable(display); 378 - intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true); 372 + drm_client_dev_suspend(&xe->drm, false); 373 + 379 374 if (has_display(xe)) { 380 375 drm_kms_helper_poll_disable(&xe->drm); 381 376 intel_display_driver_disable_user_access(display); ··· 495 488 496 489 intel_opregion_resume(display); 497 490 498 - intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false); 491 + drm_client_dev_resume(&xe->drm, false); 499 492 500 493 intel_power_domains_enable(display); 501 494 }
+1 -1
drivers/gpu/drm/xe/display/xe_display_rps.c
··· 10 10 { 11 11 } 12 12 13 - void intel_display_rps_mark_interactive(struct drm_i915_private *i915, 13 + void intel_display_rps_mark_interactive(struct intel_display *display, 14 14 struct intel_atomic_state *state, 15 15 bool interactive) 16 16 {
+1
drivers/gpu/drm/xe/display/xe_fb_pin.c
··· 5 5 6 6 #include <drm/ttm/ttm_bo.h> 7 7 8 + #include "i915_vma.h" 8 9 #include "intel_display_types.h" 9 10 #include "intel_dpt.h" 10 11 #include "intel_fb.h"
+4 -2
drivers/gpu/drm/xe/display/xe_tdf.c
··· 7 7 #include "intel_display_types.h" 8 8 #include "intel_tdf.h" 9 9 10 - void intel_td_flush(struct drm_i915_private *i915) 10 + void intel_td_flush(struct intel_display *display) 11 11 { 12 - xe_device_td_flush(i915); 12 + struct xe_device *xe = to_xe_device(display->drm); 13 + 14 + xe_device_td_flush(xe); 13 15 }
+6 -3
drivers/gpu/drm/xe/xe_pxp.c
··· 796 796 797 797 /** 798 798 * xe_pxp_obj_key_check - check if the key used by a drm_gem_obj is valid 799 - * @pxp: the xe->pxp pointer (it will be NULL if PXP is disabled) 800 799 * @obj: the drm_gem_obj we want to check 801 800 * 802 801 * Checks whether a drm_gem_obj was encrypted with the current key or an ··· 804 805 * Returns: 0 if the key is valid, -ENODEV if PXP is disabled, -EINVAL if the 805 806 * obj is not using PXP, -ENOEXEC if the key is not valid. 806 807 */ 807 - int xe_pxp_obj_key_check(struct xe_pxp *pxp, struct drm_gem_object *obj) 808 + int xe_pxp_obj_key_check(struct drm_gem_object *obj) 808 809 { 809 - return xe_pxp_bo_key_check(pxp, gem_to_xe_bo(obj)); 810 + struct xe_bo *bo = gem_to_xe_bo(obj); 811 + struct xe_device *xe = xe_bo_device(bo); 812 + struct xe_pxp *pxp = xe->pxp; 813 + 814 + return xe_pxp_bo_key_check(pxp, bo); 810 815 } 811 816 812 817 /**
+1 -1
drivers/gpu/drm/xe/xe_pxp.h
··· 30 30 31 31 int xe_pxp_key_assign(struct xe_pxp *pxp, struct xe_bo *bo); 32 32 int xe_pxp_bo_key_check(struct xe_pxp *pxp, struct xe_bo *bo); 33 - int xe_pxp_obj_key_check(struct xe_pxp *pxp, struct drm_gem_object *obj); 33 + int xe_pxp_obj_key_check(struct drm_gem_object *obj); 34 34 35 35 #endif /* __XE_PXP_H__ */
+8
include/drm/drm_client.h
··· 143 143 bool suspended; 144 144 145 145 /** 146 + * @hotplug_pending: 147 + * 148 + * A hotplug event has been received while the client was suspended. 149 + * Try again on resume. 150 + */ 151 + bool hotplug_pending; 152 + 153 + /** 146 154 * @hotplug_failed: 147 155 * 148 156 * Set by client hotplug helpers if the hotplugging failed
+1 -1
include/drm/drm_damage_helper.h
··· 78 78 drm_atomic_helper_damage_iter_next(struct drm_atomic_helper_damage_iter *iter, 79 79 struct drm_rect *rect); 80 80 bool drm_atomic_helper_damage_merged(const struct drm_plane_state *old_state, 81 - struct drm_plane_state *state, 81 + const struct drm_plane_state *state, 82 82 struct drm_rect *rect); 83 83 84 84 #endif
+27 -17
include/drm/drm_fb_helper.h
··· 70 70 */ 71 71 struct drm_fb_helper_funcs { 72 72 /** 73 - * @fb_probe: 74 - * 75 - * Driver callback to allocate and initialize the fbdev info structure. 76 - * Furthermore it also needs to allocate the DRM framebuffer used to 77 - * back the fbdev. 78 - * 79 - * This callback is mandatory. 80 - * 81 - * RETURNS: 82 - * 83 - * The driver should return 0 on success and a negative error code on 84 - * failure. 85 - */ 86 - int (*fb_probe)(struct drm_fb_helper *helper, 87 - struct drm_fb_helper_surface_size *sizes); 88 - 89 - /** 90 73 * @fb_dirty: 91 74 * 92 75 * Driver callback to update the framebuffer memory. If set, fbdev ··· 82 99 * 0 on success, or an error code otherwise. 83 100 */ 84 101 int (*fb_dirty)(struct drm_fb_helper *helper, struct drm_clip_rect *clip); 102 + 103 + /** 104 + * @fb_restore: 105 + * 106 + * Driver callback to restore internal fbdev state. If set, fbdev 107 + * emulation will invoke this callback after restoring the display 108 + * mode. 109 + * 110 + * Only for i915. Do not use in new code. 111 + * 112 + * TODO: Fix i915 to not require this callback. 113 + */ 114 + void (*fb_restore)(struct drm_fb_helper *helper); 115 + 116 + /** 117 + * @fb_set_suspend: 118 + * 119 + * Driver callback to suspend or resume, if set, fbdev emulation will 120 + * invoke this callback during suspend and resume. Driver should call 121 + * fb_set_suspend() from their implementation. If not set, fbdev 122 + * emulation will invoke fb_set_suspend() directly. 123 + * 124 + * Only for i915. Do not use in new code. 125 + * 126 + * TODO: Fix i915 to not require this callback. 127 + */ 128 + void (*fb_set_suspend)(struct drm_fb_helper *helper, bool suspend); 85 129 }; 86 130 87 131 /**