History

Merge tag 'drm-intel-next-2021-11-30' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

drm/i915 feature pull for v5.17: Features and functionality: - Implement per-lane DP drive settings for ICL+ (Ville) - Enable runtime pm autosuspend by default (Tilak Tangudu) - ADL-P DSI support (Vandita) - Add support for pipe C and D DMC firmware (Anusha) - Implement (near)atomic gamma LUT updates via vblank workers (Ville) - Split plane updates to noarm+arm phases (Ville) - Remove the CCS FB stride restrictions on ADL-P (Imre) - Add PSR selective fetch support for biplanar formats (Jouni) - Add support for display audio codec keepalive (Kai) - VRR platform support for display 11 (Manasi) Refactoring and cleanups: - FBC refactoring and cleanups preparing for multiple FBC instances (Ville) - PCH modeset refactoring, move to its own file (Ville) - Refactor and simplify handling of modifiers (Imre) - PXP cleanups (Ville) - Display header and include refactoring (Jani) - Some register macro cleanups (Ville) - Refactor DP HDMI DFP limit code (Ville) Fixes: - Disable DSB usage for now due to incorrect gamma LUT updates (Ville) - Check async flip state of every crtc and plane only once (José) - Fix DPT FB suspend/resume (Imre) - Fix black screen on reboot due to disabled DP++ TMDS output buffers (Ville) - Don't request GMBUS to generate irqs when called while irqs are off (Ville) - Fix type1 DVI DP dual mode adapter heuristics for modern platforms (Ville) - Fix fix integer overflow in 128b/132b data rate calculation (Jani) - Fix bigjoiner state readout (Ville) - Build fix for non-x86 (Siva) - PSR fixes (José, Jouni, Ville) - Disable ADL-P underrun recovery (José) - Fix DP link parameter usage before valid DPCD (Imre) - VRR vblank and frame counter fixes (Ville) - Fix fastsets on TypeC ports following a non-blocking modeset (Imre) - Compiler warning fixes (Nathan Chancellor) - Fix DSI HS mode commands (William Tseng) - Error return fixes (Dan Carpenter) - Update memory bandwidth calculations (Radhakrishna) - Implement WM0 cursor WA for DG2 (Stan) - Fix DSI Double pixelclock on read-back for dual-link panels (Hans de Goede) - HDMI 2.1 PCON FRL configuration fixes (Ankit) Merges: - DP link training delay helpers, via topic branch (Jani) - Backmerge drm-next (Jani)

Dave Airlie committed 4 years ago

Commit c305ae92 parents c18c889 74ba89c91 files · +5395 −3890Browse files

Unified · Split

91 files
  1. drivers/char/agp/intel-gtt.c +1 −0
  2. drivers/gpu/drm/i915/Kconfig +1 −1
  3. drivers/gpu/drm/i915/Makefile +3 −1
  4. drivers/gpu/drm/i915/display/i9xx_plane.c +80 −54
  5. drivers/gpu/drm/i915/display/icl_dsi.c +8 −2
  6. drivers/gpu/drm/i915/display/icl_dsi.h +15 −0
  7. drivers/gpu/drm/i915/display/intel_atomic_plane.c +69 −20
  8. drivers/gpu/drm/i915/display/intel_atomic_plane.h +14 −9
  9. drivers/gpu/drm/i915/display/intel_audio.c +93 −47
  10. drivers/gpu/drm/i915/display/intel_audio.h +3 −1
  11. drivers/gpu/drm/i915/display/intel_bw.c +180 −33
  12. drivers/gpu/drm/i915/display/intel_cdclk.c +5 −0
  13. drivers/gpu/drm/i915/display/intel_color.c +65 −65
  14. drivers/gpu/drm/i915/display/intel_combo_phy.c +1 −1
  15. drivers/gpu/drm/i915/display/intel_crt.c +6 −7
  16. drivers/gpu/drm/i915/display/intel_crtc.c +98 −9
  17. drivers/gpu/drm/i915/display/intel_crtc.h +7 −0
  18. drivers/gpu/drm/i915/display/intel_cursor.c +38 −31
  19. drivers/gpu/drm/i915/display/intel_ddi.c +143 −205
  20. drivers/gpu/drm/i915/display/intel_ddi.h +4 −1
  21. drivers/gpu/drm/i915/display/intel_display.c +366 −1554
  22. drivers/gpu/drm/i915/display/intel_display.h +4 −13
  23. drivers/gpu/drm/i915/display/intel_display_debugfs.c +9 −60
  24. drivers/gpu/drm/i915/display/intel_display_power.c +128 −4
  25. drivers/gpu/drm/i915/display/intel_display_power.h +6 −96
  26. drivers/gpu/drm/i915/display/intel_display_types.h +24 −27
  27. drivers/gpu/drm/i915/display/intel_dmc.h +2 −0
  28. drivers/gpu/drm/i915/display/intel_dp.c +125 −36
  29. drivers/gpu/drm/i915/display/intel_dp_link_training.c +17 −26
  30. drivers/gpu/drm/i915/display/intel_dp_mst.c +11 −21
  31. drivers/gpu/drm/i915/display/intel_dpll_mgr.c +4 −3
  32. drivers/gpu/drm/i915/display/intel_dpll_mgr.h +1 −1
  33. drivers/gpu/drm/i915/display/intel_dpt.c +58 −0
  34. drivers/gpu/drm/i915/display/intel_dpt.h +4 −0
  35. drivers/gpu/drm/i915/display/intel_dsb.c +2 −2
  36. drivers/gpu/drm/i915/display/intel_dsi.h +0 −42
  37. drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c +4 −0
  38. drivers/gpu/drm/i915/display/intel_dsi_vbt.c +2 −0
  39. drivers/gpu/drm/i915/display/intel_dsi_vbt.h +22 −0
  40. drivers/gpu/drm/i915/display/intel_fb.c +593 −113
  41. drivers/gpu/drm/i915/display/intel_fb.h +27 −4
  42. drivers/gpu/drm/i915/display/intel_fb_pin.c +5 −7
  43. drivers/gpu/drm/i915/display/intel_fbc.c +576 −424
  44. drivers/gpu/drm/i915/display/intel_fbc.h +7 −4
  45. drivers/gpu/drm/i915/display/intel_fdi.c +37 −99
  46. drivers/gpu/drm/i915/display/intel_fdi.h +1 −1
  47. drivers/gpu/drm/i915/display/intel_fifo_underrun.c +1 −1
  48. drivers/gpu/drm/i915/display/intel_gmbus.c +11 −2
  49. drivers/gpu/drm/i915/display/intel_hdmi.c +72 −45
  50. drivers/gpu/drm/i915/display/intel_lpe_audio.c +21 −21
  51. drivers/gpu/drm/i915/display/intel_pch_display.c +501 −0
  52. drivers/gpu/drm/i915/display/intel_pch_display.h +27 −0
  53. drivers/gpu/drm/i915/display/intel_pch_refclk.c +648 −0
  54. drivers/gpu/drm/i915/display/intel_pch_refclk.h +21 −0
  55. drivers/gpu/drm/i915/display/intel_psr.c +78 −47
  56. drivers/gpu/drm/i915/display/intel_psr.h +2 −1
  57. drivers/gpu/drm/i915/display/intel_snps_phy.c +1 −1
  58. drivers/gpu/drm/i915/display/intel_sprite.c +142 −115
  59. drivers/gpu/drm/i915/display/intel_sprite.h +0 −4
  60. drivers/gpu/drm/i915/display/intel_vdsc.c +31 −34
  61. drivers/gpu/drm/i915/display/intel_vdsc.h +6 −4
  62. drivers/gpu/drm/i915/display/intel_vrr.c +15 −3
  63. drivers/gpu/drm/i915/display/intel_vrr.h +1 −0
  64. drivers/gpu/drm/i915/display/skl_scaler.c +1 −0
  65. drivers/gpu/drm/i915/display/skl_universal_plane.c +224 −238
  66. drivers/gpu/drm/i915/display/vlv_dsi.c +8 −0
  67. drivers/gpu/drm/i915/display/vlv_dsi.h +19 −0
  68. drivers/gpu/drm/i915/display/vlv_dsi_pll.c +1 −0
  69. drivers/gpu/drm/i915/display/vlv_dsi_pll.h +38 −0
  70. drivers/gpu/drm/i915/gem/i915_gem_context.c +1 −1
  71. drivers/gpu/drm/i915/gt/intel_ggtt.c +180 −86
  72. drivers/gpu/drm/i915/gt/intel_gt.c +2 −0
  73. drivers/gpu/drm/i915/gt/intel_gtt.h +2 −0
  74. drivers/gpu/drm/i915/i915_driver.c +35 −8
  75. drivers/gpu/drm/i915/i915_driver.h +24 −0
  76. drivers/gpu/drm/i915/i915_drv.h +31 −44
  77. drivers/gpu/drm/i915/i915_iosf_mbi.h +42 −0
  78. drivers/gpu/drm/i915/i915_irq.c +1 −1
  79. drivers/gpu/drm/i915/i915_module.c +2 −2
  80. drivers/gpu/drm/i915/i915_pci.c +18 −4
  81. drivers/gpu/drm/i915/i915_reg.h +188 −170
  82. drivers/gpu/drm/i915/i915_switcheroo.c +3 −2
  83. drivers/gpu/drm/i915/i915_trace.h +73 −2
  84. drivers/gpu/drm/i915/i915_vma_types.h +14 −5
  85. drivers/gpu/drm/i915/intel_pm.c +25 −16
  86. drivers/gpu/drm/i915/intel_runtime_pm.c +3 −0
  87. drivers/gpu/drm/i915/intel_uncore.c +1 −1
  88. drivers/gpu/drm/i915/pxp/intel_pxp_session.c +2 −1
  89. drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +4 −2
  90. drivers/gpu/drm/i915/vlv_sideband.c +1 −2
  91. include/drm/intel-gtt.h +5 −3
drivers/char/agp/intel-gtt.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/kernel.h>
2121 #include <linux/pagemap.h>
2222 #include <linux/agp_backend.h>
23+#include <linux/intel-iommu.h>
2324 #include <linux/delay.h>
2425 #include <asm/smp.h>
2526 #include "agp.h"
drivers/gpu/drm/i915/Kconfig+1−1
@@ -21,7 +21,7 @@ config DRM_I915 · 20 unmodified lines
2121 select ACPI_VIDEO if ACPI
2222 select ACPI_BUTTON if ACPI
2323 select SYNC_FILE
24− select IOSF_MBI
24+ select IOSF_MBI if X86
2525 select CRC32
2626 select SND_HDA_I915 if SND_HDA_CORE
2727 select CEC_CORE if CEC_NOTIFIER
drivers/gpu/drm/i915/Makefile+3−1
@@ -30,7 +30,7 @@ subdir-ccflags-y += -I$(srctree)/$(src) · 29 unmodified lines
3030 # Please keep these build lists sorted!
3131
3232 # core driver code
33−i915-y += i915_drv.o \
33+i915-y += i915_driver.o \
3434 i915_config.o \
3535 i915_irq.o \
3636 i915_getparam.o \
@@ -226,6 +226,8 @@ i915-y += \ · 189 unmodified lines
226226 display/intel_hotplug.o \
227227 display/intel_lpe_audio.o \
228228 display/intel_overlay.o \
229+ display/intel_pch_display.o \
230+ display/intel_pch_refclk.o \
229231 display/intel_plane_initial.o \
230232 display/intel_psr.o \
231233 display/intel_quirks.o \
drivers/gpu/drm/i915/display/i9xx_plane.c+80−54
@@ -60,22 +60,11 @@ static const u32 vlv_primary_formats[] = { · 59 unmodified lines
6060 DRM_FORMAT_XBGR16161616F,
6161 };
6262
63−static const u64 i9xx_format_modifiers[] = {
64− I915_FORMAT_MOD_X_TILED,
65− DRM_FORMAT_MOD_LINEAR,
66− DRM_FORMAT_MOD_INVALID
67−};
68−
6963 static bool i8xx_plane_format_mod_supported(struct drm_plane *_plane,
7064 u32 format, u64 modifier)
7165 {
72− switch (modifier) {
73− case DRM_FORMAT_MOD_LINEAR:
74− case I915_FORMAT_MOD_X_TILED:
75− break;
76− default:
66+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
7767 return false;
78− }
7968
8069 switch (format) {
8170 case DRM_FORMAT_C8:
@@ -92,13 +81,8 @@ static bool i8xx_plane_format_mod_supported(struct drm_plane *_plane, · 10 unmodified lines
9281 static bool i965_plane_format_mod_supported(struct drm_plane *_plane,
9382 u32 format, u64 modifier)
9483 {
95− switch (modifier) {
96− case DRM_FORMAT_MOD_LINEAR:
97− case I915_FORMAT_MOD_X_TILED:
98− break;
99− default:
84+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
10085 return false;
101− }
10286
10387 switch (format) {
10488 case DRM_FORMAT_C8:
@@ -272,7 +256,7 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) · 167 unmodified lines
272256 u32 alignment = intel_surf_alignment(fb, 0);
273257 int cpp = fb->format->cpp[0];
274258
275− while ((src_x + src_w) * cpp > plane_state->view.color_plane[0].stride) {
259+ while ((src_x + src_w) * cpp > plane_state->view.color_plane[0].mapping_stride) {
276260 if (offset == 0) {
277261 drm_dbg_kms(&dev_priv->drm,
278262 "Unable to find suitable display surface offset due to X-tiling\n");
@@ -418,38 +402,25 @@ static int i9xx_plane_min_cdclk(const struct intel_crtc_state *crtc_state, · 139 unmodified lines
418402 return DIV_ROUND_UP(pixel_rate * num, den);
419403 }
420404
421−static void i9xx_update_plane(struct intel_plane *plane,
422− const struct intel_crtc_state *crtc_state,
423− const struct intel_plane_state *plane_state)
405+static void i9xx_plane_update_noarm(struct intel_plane *plane,
406+ const struct intel_crtc_state *crtc_state,
407+ const struct intel_plane_state *plane_state)
424408 {
425409 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
426410 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
427− u32 linear_offset;
428− int x = plane_state->view.color_plane[0].x;
429− int y = plane_state->view.color_plane[0].y;
430− int crtc_x = plane_state->uapi.dst.x1;
431− int crtc_y = plane_state->uapi.dst.y1;
432− int crtc_w = drm_rect_width(&plane_state->uapi.dst);
433− int crtc_h = drm_rect_height(&plane_state->uapi.dst);
434411 unsigned long irqflags;
435− u32 dspaddr_offset;
436− u32 dspcntr;
437−
438− dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state);
439−
440− linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
441−
442− if (DISPLAY_VER(dev_priv) >= 4)
443− dspaddr_offset = plane_state->view.color_plane[0].offset;
444− else
445− dspaddr_offset = linear_offset;
446412
447413 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
448414
449415 intel_de_write_fw(dev_priv, DSPSTRIDE(i9xx_plane),
450− plane_state->view.color_plane[0].stride);
416+ plane_state->view.color_plane[0].mapping_stride);
451417
452418 if (DISPLAY_VER(dev_priv) < 4) {
419+ int crtc_x = plane_state->uapi.dst.x1;
420+ int crtc_y = plane_state->uapi.dst.y1;
421+ int crtc_w = drm_rect_width(&plane_state->uapi.dst);
422+ int crtc_h = drm_rect_height(&plane_state->uapi.dst);
423+
453424 /*
454425 * PLANE_A doesn't actually have a full window
455426 * generator but let's assume we still need to
@@ -459,7 +430,39 @@ static void i9xx_update_plane(struct intel_plane *plane, · 3 unmodified lines
459430 (crtc_y << 16) | crtc_x);
460431 intel_de_write_fw(dev_priv, DSPSIZE(i9xx_plane),
461432 ((crtc_h - 1) << 16) | (crtc_w - 1));
462− } else if (IS_CHERRYVIEW(dev_priv) && i9xx_plane == PLANE_B) {
433+ }
434+
435+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
436+}
437+
438+static void i9xx_plane_update_arm(struct intel_plane *plane,
439+ const struct intel_crtc_state *crtc_state,
440+ const struct intel_plane_state *plane_state)
441+{
442+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
443+ enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
444+ int x = plane_state->view.color_plane[0].x;
445+ int y = plane_state->view.color_plane[0].y;
446+ u32 dspcntr, dspaddr_offset, linear_offset;
447+ unsigned long irqflags;
448+
449+ dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state);
450+
451+ linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
452+
453+ if (DISPLAY_VER(dev_priv) >= 4)
454+ dspaddr_offset = plane_state->view.color_plane[0].offset;
455+ else
456+ dspaddr_offset = linear_offset;
457+
458+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
459+
460+ if (IS_CHERRYVIEW(dev_priv) && i9xx_plane == PLANE_B) {
461+ int crtc_x = plane_state->uapi.dst.x1;
462+ int crtc_y = plane_state->uapi.dst.y1;
463+ int crtc_w = drm_rect_width(&plane_state->uapi.dst);
464+ int crtc_h = drm_rect_height(&plane_state->uapi.dst);
465+
463466 intel_de_write_fw(dev_priv, PRIMPOS(i9xx_plane),
464467 (crtc_y << 16) | crtc_x);
465468 intel_de_write_fw(dev_priv, PRIMSIZE(i9xx_plane),
@@ -493,8 +496,22 @@ static void i9xx_update_plane(struct intel_plane *plane, · 27 unmodified lines
493496 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
494497 }
495498
496−static void i9xx_disable_plane(struct intel_plane *plane,
497− const struct intel_crtc_state *crtc_state)
499+static void i830_plane_update_arm(struct intel_plane *plane,
500+ const struct intel_crtc_state *crtc_state,
501+ const struct intel_plane_state *plane_state)
502+{
503+ /*
504+ * On i830/i845 all registers are self-arming [ALM040].
505+ *
506+ * Additional breakage on i830 causes register reads to return
507+ * the last latched value instead of the last written value [ALM026].
508+ */
509+ i9xx_plane_update_noarm(plane, crtc_state, plane_state);
510+ i9xx_plane_update_arm(plane, crtc_state, plane_state);
511+}
512+
513+static void i9xx_plane_disable_arm(struct intel_plane *plane,
514+ const struct intel_crtc_state *crtc_state)
498515 {
499516 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
500517 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
@@ -768,6 +785,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 267 unmodified lines
768785 struct intel_plane *plane;
769786 const struct drm_plane_funcs *plane_funcs;
770787 unsigned int supported_rotations;
788+ const u64 *modifiers;
771789 const u32 *formats;
772790 int num_formats;
773791 int ret, zpos;
@@ -789,12 +807,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 15 unmodified lines
789807 plane->id = PLANE_PRIMARY;
790808 plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id);
791809
792− plane->has_fbc = i9xx_plane_has_fbc(dev_priv, plane->i9xx_plane);
793− if (plane->has_fbc) {
794− struct intel_fbc *fbc = &dev_priv->fbc;
795−
796− fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
797− }
810+ if (i9xx_plane_has_fbc(dev_priv, plane->i9xx_plane))
811+ plane->fbc = &dev_priv->fbc;
812+ if (plane->fbc)
813+ plane->fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
798814
799815 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
800816 formats = vlv_primary_formats;
@@ -851,8 +867,13 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 50 unmodified lines
851867 plane->max_stride = ilk_primary_max_stride;
852868 }
853869
854− plane->update_plane = i9xx_update_plane;
855− plane->disable_plane = i9xx_disable_plane;
870+ if (IS_I830(dev_priv) || IS_I845G(dev_priv)) {
871+ plane->update_arm = i830_plane_update_arm;
872+ } else {
873+ plane->update_noarm = i9xx_plane_update_noarm;
874+ plane->update_arm = i9xx_plane_update_arm;
875+ }
876+ plane->disable_arm = i9xx_plane_disable_arm;
856877 plane->get_hw_state = i9xx_plane_get_hw_state;
857878 plane->check_plane = i9xx_plane_check;
858879
@@ -875,21 +896,26 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 16 unmodified lines
875896 plane->disable_flip_done = ilk_primary_disable_flip_done;
876897 }
877898
899+ modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_TILING_X);
900+
878901 if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
879902 ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
880903 0, plane_funcs,
881904 formats, num_formats,
882− i9xx_format_modifiers,
905+ modifiers,
883906 DRM_PLANE_TYPE_PRIMARY,
884907 "primary %c", pipe_name(pipe));
885908 else
886909 ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
887910 0, plane_funcs,
888911 formats, num_formats,
889− i9xx_format_modifiers,
912+ modifiers,
890913 DRM_PLANE_TYPE_PRIMARY,
891914 "plane %c",
892915 plane_name(plane->i9xx_plane));
916+
917+ kfree(modifiers);
918+
893919 if (ret)
894920 goto fail;
895921
drivers/gpu/drm/i915/display/icl_dsi.c+8−2
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <drm/drm_atomic_helper.h>
2929 #include <drm/drm_mipi_dsi.h>
3030
31+#include "icl_dsi.h"
3132 #include "intel_atomic.h"
3233 #include "intel_backlight.h"
3334 #include "intel_combo_phy.h"
@@ -36,6 +37,7 @@ · 2 unmodified lines
3637 #include "intel_ddi.h"
3738 #include "intel_de.h"
3839 #include "intel_dsi.h"
40+#include "intel_dsi_vbt.h"
3941 #include "intel_panel.h"
4042 #include "intel_vdsc.h"
4143 #include "skl_scaler.h"
@@ -183,6 +185,8 @@ static int dsi_send_pkt_hdr(struct intel_dsi_host *host, · 141 unmodified lines
183185
184186 if (enable_lpdt)
185187 tmp |= LP_DATA_TRANSFER;
188+ else
189+ tmp &= ~LP_DATA_TRANSFER;
186190
187191 tmp &= ~(PARAM_WC_MASK | VC_MASK | DT_MASK);
188192 tmp |= ((packet->header[0] & VC_MASK) << VC_SHIFT);
@@ -1226,7 +1230,9 @@ static void gen11_dsi_pre_enable(struct intel_atomic_state *state, · 1037 unmodified lines
12261230 /* step5: program and powerup panel */
12271231 gen11_dsi_powerup_panel(encoder);
12281232
1229− intel_dsc_enable(encoder, pipe_config);
1233+ intel_dsc_dsi_pps_write(encoder, pipe_config);
1234+
1235+ intel_dsc_enable(pipe_config);
12301236
12311237 /* step6c: configure transcoder timings */
12321238 gen11_dsi_set_transcoder_timings(encoder, pipe_config);
@@ -1623,7 +1629,7 @@ static int gen11_dsi_dsc_compute_config(struct intel_encoder *encoder, · 390 unmodified lines
16231629 /* FIXME: initialize from VBT */
16241630 vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST;
16251631
1626− ret = intel_dsc_compute_params(encoder, crtc_state);
1632+ ret = intel_dsc_compute_params(crtc_state);
16271633 if (ret)
16281634 return ret;
16291635
drivers/gpu/drm/i915/display/icl_dsi.h+15−0
@@ -0,0 +1,15 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef __ICL_DSI_H__
7+#define __ICL_DSI_H__
8+
9+struct drm_i915_private;
10+struct intel_crtc_state;
11+
12+void icl_dsi_init(struct drm_i915_private *i915);
13+void icl_dsi_frame_update(struct intel_crtc_state *crtc_state);
14+
15+#endif /* __ICL_DSI_H__ */
drivers/gpu/drm/i915/display/intel_atomic_plane.c+69−20
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 #include "intel_atomic_plane.h"
4040 #include "intel_cdclk.h"
4141 #include "intel_display_types.h"
42+#include "intel_fb.h"
4243 #include "intel_fb_pin.h"
4344 #include "intel_pm.h"
4445 #include "intel_sprite.h"
@@ -469,31 +470,72 @@ skl_next_plane_to_commit(struct intel_atomic_state *state, · 424 unmodified lines
469470 return NULL;
470471 }
471472
472−void intel_update_plane(struct intel_plane *plane,
473− const struct intel_crtc_state *crtc_state,
474− const struct intel_plane_state *plane_state)
473+void intel_plane_update_noarm(struct intel_plane *plane,
474+ const struct intel_crtc_state *crtc_state,
475+ const struct intel_plane_state *plane_state)
475476 {
476477 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
477478
478− trace_intel_update_plane(&plane->base, crtc);
479+ trace_intel_plane_update_noarm(&plane->base, crtc);
480+
481+ if (plane->update_noarm)
482+ plane->update_noarm(plane, crtc_state, plane_state);
483+}
484+
485+void intel_plane_update_arm(struct intel_plane *plane,
486+ const struct intel_crtc_state *crtc_state,
487+ const struct intel_plane_state *plane_state)
488+{
489+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
490+
491+ trace_intel_plane_update_arm(&plane->base, crtc);
479492
480493 if (crtc_state->uapi.async_flip && plane->async_flip)
481494 plane->async_flip(plane, crtc_state, plane_state, true);
482495 else
483− plane->update_plane(plane, crtc_state, plane_state);
496+ plane->update_arm(plane, crtc_state, plane_state);
484497 }
485498
486−void intel_disable_plane(struct intel_plane *plane,
487− const struct intel_crtc_state *crtc_state)
499+void intel_plane_disable_arm(struct intel_plane *plane,
500+ const struct intel_crtc_state *crtc_state)
488501 {
489502 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
490503
491− trace_intel_disable_plane(&plane->base, crtc);
492− plane->disable_plane(plane, crtc_state);
504+ trace_intel_plane_disable_arm(&plane->base, crtc);
505+ plane->disable_arm(plane, crtc_state);
493506 }
494507
495−void skl_update_planes_on_crtc(struct intel_atomic_state *state,
496− struct intel_crtc *crtc)
508+void intel_update_planes_on_crtc(struct intel_atomic_state *state,
509+ struct intel_crtc *crtc)
510+{
511+ struct intel_crtc_state *new_crtc_state =
512+ intel_atomic_get_new_crtc_state(state, crtc);
513+ u32 update_mask = new_crtc_state->update_planes;
514+ struct intel_plane_state *new_plane_state;
515+ struct intel_plane *plane;
516+ int i;
517+
518+ if (new_crtc_state->uapi.async_flip)
519+ return;
520+
521+ /*
522+ * Since we only write non-arming registers here,
523+ * the order does not matter even for skl+.
524+ */
525+ for_each_new_intel_plane_in_state(state, plane, new_plane_state, i) {
526+ if (crtc->pipe != plane->pipe ||
527+ !(update_mask & BIT(plane->id)))
528+ continue;
529+
530+ /* TODO: for mailbox updates this should be skipped */
531+ if (new_plane_state->uapi.visible ||
532+ new_plane_state->planar_slave)
533+ intel_plane_update_noarm(plane, new_crtc_state, new_plane_state);
534+ }
535+}
536+
537+void skl_arm_planes_on_crtc(struct intel_atomic_state *state,
538+ struct intel_crtc *crtc)
497539 {
498540 struct intel_crtc_state *old_crtc_state =
499541 intel_atomic_get_old_crtc_state(state, crtc);
@@ -515,17 +557,20 @@ void skl_update_planes_on_crtc(struct intel_atomic_state *state, · 15 unmodified lines
515557 struct intel_plane_state *new_plane_state =
516558 intel_atomic_get_new_plane_state(state, plane);
517559
560+ /*
561+ * TODO: for mailbox updates intel_plane_update_noarm()
562+ * would have to be called here as well.
563+ */
518564 if (new_plane_state->uapi.visible ||
519− new_plane_state->planar_slave) {
520− intel_update_plane(plane, new_crtc_state, new_plane_state);
521− } else {
522− intel_disable_plane(plane, new_crtc_state);
523− }
565+ new_plane_state->planar_slave)
566+ intel_plane_update_arm(plane, new_crtc_state, new_plane_state);
567+ else
568+ intel_plane_disable_arm(plane, new_crtc_state);
524569 }
525570 }
526571
527−void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
528− struct intel_crtc *crtc)
572+void i9xx_arm_planes_on_crtc(struct intel_atomic_state *state,
573+ struct intel_crtc *crtc)
529574 {
530575 struct intel_crtc_state *new_crtc_state =
531576 intel_atomic_get_new_crtc_state(state, crtc);
@@ -539,10 +584,14 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state, · 7 unmodified lines
539584 !(update_mask & BIT(plane->id)))
540585 continue;
541586
587+ /*
588+ * TODO: for mailbox updates intel_plane_update_noarm()
589+ * would have to be called here as well.
590+ */
542591 if (new_plane_state->uapi.visible)
543− intel_update_plane(plane, new_crtc_state, new_plane_state);
592+ intel_plane_update_arm(plane, new_crtc_state, new_plane_state);
544593 else
545− intel_disable_plane(plane, new_crtc_state);
594+ intel_plane_disable_arm(plane, new_crtc_state);
546595 }
547596 }
548597
drivers/gpu/drm/i915/display/intel_atomic_plane.h+14−9
@@ -30,20 +30,25 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, · 29 unmodified lines
3030 struct intel_crtc *crtc);
3131 void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
3232 const struct intel_plane_state *from_plane_state);
33−void intel_update_plane(struct intel_plane *plane,
34− const struct intel_crtc_state *crtc_state,
35− const struct intel_plane_state *plane_state);
36−void intel_disable_plane(struct intel_plane *plane,
37− const struct intel_crtc_state *crtc_state);
33+void intel_plane_update_noarm(struct intel_plane *plane,
34+ const struct intel_crtc_state *crtc_state,
35+ const struct intel_plane_state *plane_state);
36+void intel_plane_update_arm(struct intel_plane *plane,
37+ const struct intel_crtc_state *crtc_state,
38+ const struct intel_plane_state *plane_state);
39+void intel_plane_disable_arm(struct intel_plane *plane,
40+ const struct intel_crtc_state *crtc_state);
3841 struct intel_plane *intel_plane_alloc(void);
3942 void intel_plane_free(struct intel_plane *plane);
4043 struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
4144 void intel_plane_destroy_state(struct drm_plane *plane,
4245 struct drm_plane_state *state);
43−void skl_update_planes_on_crtc(struct intel_atomic_state *state,
44− struct intel_crtc *crtc);
45−void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
46− struct intel_crtc *crtc);
46+void intel_update_planes_on_crtc(struct intel_atomic_state *state,
47+ struct intel_crtc *crtc);
48+void skl_arm_planes_on_crtc(struct intel_atomic_state *state,
49+ struct intel_crtc *crtc);
50+void i9xx_arm_planes_on_crtc(struct intel_atomic_state *state,
51+ struct intel_crtc *crtc);
4752 int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
4853 struct intel_crtc_state *crtc_state,
4954 const struct intel_plane_state *old_plane_state,
drivers/gpu/drm/i915/display/intel_audio.c+93−47
@@ -62,6 +62,15 @@ · 61 unmodified lines
6262 * struct &i915_audio_component_audio_ops @audio_ops is called from i915 driver.
6363 */
6464
65+struct intel_audio_funcs {
66+ void (*audio_codec_enable)(struct intel_encoder *encoder,
67+ const struct intel_crtc_state *crtc_state,
68+ const struct drm_connector_state *conn_state);
69+ void (*audio_codec_disable)(struct intel_encoder *encoder,
70+ const struct intel_crtc_state *old_crtc_state,
71+ const struct drm_connector_state *old_conn_state);
72+};
73+
6574 /* DP N/M table */
6675 #define LC_810M 810000
6776 #define LC_540M 540000
@@ -388,7 +397,7 @@ hsw_dp_audio_config_update(struct intel_encoder *encoder, · 320 unmodified lines
388397 const struct intel_crtc_state *crtc_state)
389398 {
390399 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
391− struct i915_audio_component *acomp = dev_priv->audio_component;
400+ struct i915_audio_component *acomp = dev_priv->audio.component;
392401 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
393402 enum port port = encoder->port;
394403 const struct dp_aud_n_m *nm;
@@ -436,7 +445,7 @@ hsw_hdmi_audio_config_update(struct intel_encoder *encoder, · 41 unmodified lines
436445 const struct intel_crtc_state *crtc_state)
437446 {
438447 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
439− struct i915_audio_component *acomp = dev_priv->audio_component;
448+ struct i915_audio_component *acomp = dev_priv->audio.component;
440449 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
441450 enum port port = encoder->port;
442451 int n, rate;
@@ -494,7 +503,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder, · 51 unmodified lines
494503 drm_dbg_kms(&dev_priv->drm, "Disable audio codec on transcoder %s\n",
495504 transcoder_name(cpu_transcoder));
496505
497− mutex_lock(&dev_priv->av_mutex);
506+ mutex_lock(&dev_priv->audio.mutex);
498507
499508 /* Disable timestamps */
500509 tmp = intel_de_read(dev_priv, HSW_AUD_CFG(cpu_transcoder));
@@ -512,7 +521,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder, · 11 unmodified lines
512521 tmp &= ~AUDIO_OUTPUT_ENABLE(cpu_transcoder);
513522 intel_de_write(dev_priv, HSW_AUD_PIN_ELD_CP_VLD, tmp);
514523
515− mutex_unlock(&dev_priv->av_mutex);
524+ mutex_unlock(&dev_priv->audio.mutex);
516525 }
517526
518527 static unsigned int calc_hblank_early_prog(struct intel_encoder *encoder,
@@ -641,7 +650,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder, · 122 unmodified lines
641650 "Enable audio codec on transcoder %s, %u bytes ELD\n",
642651 transcoder_name(cpu_transcoder), drm_eld_size(eld));
643652
644− mutex_lock(&dev_priv->av_mutex);
653+ mutex_lock(&dev_priv->audio.mutex);
645654
646655 /* Enable Audio WA for 4k DSC usecases */
647656 if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP))
@@ -679,7 +688,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder, · 31 unmodified lines
679688 /* Enable timestamps */
680689 hsw_audio_config_update(encoder, crtc_state);
681690
682− mutex_unlock(&dev_priv->av_mutex);
691+ mutex_unlock(&dev_priv->audio.mutex);
683692 }
684693
685694 static void ilk_audio_codec_disable(struct intel_encoder *encoder,
@@ -826,7 +835,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, · 140 unmodified lines
826835 const struct drm_connector_state *conn_state)
827836 {
828837 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
829− struct i915_audio_component *acomp = dev_priv->audio_component;
838+ struct i915_audio_component *acomp = dev_priv->audio.component;
830839 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
831840 struct drm_connector *connector = conn_state->connector;
832841 const struct drm_display_mode *adjusted_mode =
@@ -848,17 +857,17 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, · 15 unmodified lines
848857
849858 connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
850859
851− if (dev_priv->audio_funcs)
852− dev_priv->audio_funcs->audio_codec_enable(encoder,
860+ if (dev_priv->audio.funcs)
861+ dev_priv->audio.funcs->audio_codec_enable(encoder,
853862 crtc_state,
854863 conn_state);
855864
856− mutex_lock(&dev_priv->av_mutex);
865+ mutex_lock(&dev_priv->audio.mutex);
857866 encoder->audio_connector = connector;
858867
859868 /* referred in audio callbacks */
860− dev_priv->av_enc_map[pipe] = encoder;
861− mutex_unlock(&dev_priv->av_mutex);
869+ dev_priv->audio.encoder_map[pipe] = encoder;
870+ mutex_unlock(&dev_priv->audio.mutex);
862871
863872 if (acomp && acomp->base.audio_ops &&
864873 acomp->base.audio_ops->pin_eld_notify) {
@@ -888,20 +897,20 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, · 23 unmodified lines
888897 const struct drm_connector_state *old_conn_state)
889898 {
890899 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
891− struct i915_audio_component *acomp = dev_priv->audio_component;
900+ struct i915_audio_component *acomp = dev_priv->audio.component;
892901 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
893902 enum port port = encoder->port;
894903 enum pipe pipe = crtc->pipe;
895904
896− if (dev_priv->audio_funcs)
897− dev_priv->audio_funcs->audio_codec_disable(encoder,
905+ if (dev_priv->audio.funcs)
906+ dev_priv->audio.funcs->audio_codec_disable(encoder,
898907 old_crtc_state,
899908 old_conn_state);
900909
901− mutex_lock(&dev_priv->av_mutex);
910+ mutex_lock(&dev_priv->audio.mutex);
902911 encoder->audio_connector = NULL;
903− dev_priv->av_enc_map[pipe] = NULL;
904− mutex_unlock(&dev_priv->av_mutex);
912+ dev_priv->audio.encoder_map[pipe] = NULL;
913+ mutex_unlock(&dev_priv->audio.mutex);
905914
906915 if (acomp && acomp->base.audio_ops &&
907916 acomp->base.audio_ops->pin_eld_notify) {
@@ -931,19 +940,53 @@ static const struct intel_audio_funcs hsw_audio_funcs = { · 23 unmodified lines
931940 };
932941
933942 /**
934− * intel_init_audio_hooks - Set up chip specific audio hooks
943+ * intel_audio_hooks_init - Set up chip specific audio hooks
935944 * @dev_priv: device private
936945 */
937−void intel_init_audio_hooks(struct drm_i915_private *dev_priv)
946+void intel_audio_hooks_init(struct drm_i915_private *dev_priv)
938947 {
939948 if (IS_G4X(dev_priv)) {
940− dev_priv->audio_funcs = &g4x_audio_funcs;
949+ dev_priv->audio.funcs = &g4x_audio_funcs;
941950 } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
942− dev_priv->audio_funcs = &ilk_audio_funcs;
951+ dev_priv->audio.funcs = &ilk_audio_funcs;
943952 } else if (IS_HASWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 8) {
944− dev_priv->audio_funcs = &hsw_audio_funcs;
953+ dev_priv->audio.funcs = &hsw_audio_funcs;
945954 } else if (HAS_PCH_SPLIT(dev_priv)) {
946− dev_priv->audio_funcs = &ilk_audio_funcs;
955+ dev_priv->audio.funcs = &ilk_audio_funcs;
956+ }
957+}
958+
959+struct aud_ts_cdclk_m_n {
960+ u8 m;
961+ u16 n;
962+};
963+
964+void intel_audio_cdclk_change_pre(struct drm_i915_private *i915)
965+{
966+ if (DISPLAY_VER(i915) >= 13)
967+ intel_de_rmw(i915, AUD_TS_CDCLK_M, AUD_TS_CDCLK_M_EN, 0);
968+}
969+
970+static void get_aud_ts_cdclk_m_n(int refclk, int cdclk, struct aud_ts_cdclk_m_n *aud_ts)
971+{
972+ if (refclk == 24000)
973+ aud_ts->m = 12;
974+ else
975+ aud_ts->m = 15;
976+
977+ aud_ts->n = cdclk * aud_ts->m / 24000;
978+}
979+
980+void intel_audio_cdclk_change_post(struct drm_i915_private *i915)
981+{
982+ struct aud_ts_cdclk_m_n aud_ts;
983+
984+ if (DISPLAY_VER(i915) >= 13) {
985+ get_aud_ts_cdclk_m_n(i915->cdclk.hw.ref, i915->cdclk.hw.cdclk, &aud_ts);
986+
987+ intel_de_write(i915, AUD_TS_CDCLK_N, aud_ts.n);
988+ intel_de_write(i915, AUD_TS_CDCLK_M, aud_ts.m | AUD_TS_CDCLK_M_EN);
989+ drm_dbg_kms(&i915->drm, "aud_ts_cdclk set to M=%u, N=%u\n", aud_ts.m, aud_ts.n);
947990 }
948991 }
949992
@@ -1014,13 +1057,13 @@ static unsigned long i915_audio_component_get_power(struct device *kdev) · 64 unmodified lines
10141057
10151058 ret = intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO_PLAYBACK);
10161059
1017− if (dev_priv->audio_power_refcount++ == 0) {
1060+ if (dev_priv->audio.power_refcount++ == 0) {
10181061 if (DISPLAY_VER(dev_priv) >= 9) {
10191062 intel_de_write(dev_priv, AUD_FREQ_CNTRL,
1020− dev_priv->audio_freq_cntrl);
1063+ dev_priv->audio.freq_cntrl);
10211064 drm_dbg_kms(&dev_priv->drm,
10221065 "restored AUD_FREQ_CNTRL to 0x%x\n",
1023− dev_priv->audio_freq_cntrl);
1066+ dev_priv->audio.freq_cntrl);
10241067 }
10251068
10261069 /* Force CDCLK to 2*BCLK as long as we need audio powered. */
@@ -1041,7 +1084,7 @@ static void i915_audio_component_put_power(struct device *kdev, · 14 unmodified lines
10411084 struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
10421085
10431086 /* Stop forcing CDCLK to 2*BCLK if no need for audio to be powered. */
1044− if (--dev_priv->audio_power_refcount == 0)
1087+ if (--dev_priv->audio.power_refcount == 0)
10451088 if (IS_GEMINILAKE(dev_priv))
10461089 glk_force_audio_cdclk(dev_priv, false);
10471090
@@ -1093,7 +1136,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) · 45 unmodified lines
10931136 /*
10941137 * get the intel_encoder according to the parameter port and pipe
10951138 * intel_encoder is saved by the index of pipe
1096− * MST & (pipe >= 0): return the av_enc_map[pipe],
1139+ * MST & (pipe >= 0): return the audio.encoder_map[pipe],
10971140 * when port is matched
10981141 * MST & (pipe < 0): this is invalid
10991142 * Non-MST & (pipe >= 0): only pipe = 0 (the first device entry)
@@ -1108,10 +1151,10 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv, · 8 unmodified lines
11081151 /* MST */
11091152 if (pipe >= 0) {
11101153 if (drm_WARN_ON(&dev_priv->drm,
1111− pipe >= ARRAY_SIZE(dev_priv->av_enc_map)))
1154+ pipe >= ARRAY_SIZE(dev_priv->audio.encoder_map)))
11121155 return NULL;
11131156
1114− encoder = dev_priv->av_enc_map[pipe];
1157+ encoder = dev_priv->audio.encoder_map[pipe];
11151158 /*
11161159 * when bootup, audio driver may not know it is
11171160 * MST or not. So it will poll all the port & pipe
@@ -1127,7 +1170,7 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv, · 9 unmodified lines
11271170 return NULL;
11281171
11291172 for_each_pipe(dev_priv, pipe) {
1130− encoder = dev_priv->av_enc_map[pipe];
1173+ encoder = dev_priv->audio.encoder_map[pipe];
11311174 if (encoder == NULL)
11321175 continue;
11331176
@@ -1145,7 +1188,7 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, · 11 unmodified lines
11451188 int pipe, int rate)
11461189 {
11471190 struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
1148− struct i915_audio_component *acomp = dev_priv->audio_component;
1191+ struct i915_audio_component *acomp = dev_priv->audio.component;
11491192 struct intel_encoder *encoder;
11501193 struct intel_crtc *crtc;
11511194 unsigned long cookie;
@@ -1155,7 +1198,7 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, · 3 unmodified lines
11551198 return 0;
11561199
11571200 cookie = i915_audio_component_get_power(kdev);
1158− mutex_lock(&dev_priv->av_mutex);
1201+ mutex_lock(&dev_priv->audio.mutex);
11591202
11601203 /* 1. get the pipe */
11611204 encoder = get_saved_enc(dev_priv, port, pipe);
@@ -1174,7 +1217,7 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, · 12 unmodified lines
11741217 hsw_audio_config_update(encoder, crtc->config);
11751218
11761219 unlock:
1177− mutex_unlock(&dev_priv->av_mutex);
1220+ mutex_unlock(&dev_priv->audio.mutex);
11781221 i915_audio_component_put_power(kdev, cookie);
11791222 return err;
11801223 }
@@ -1188,13 +1231,13 @@ static int i915_audio_component_get_eld(struct device *kdev, int port, · 7 unmodified lines
11881231 const u8 *eld;
11891232 int ret = -EINVAL;
11901233
1191− mutex_lock(&dev_priv->av_mutex);
1234+ mutex_lock(&dev_priv->audio.mutex);
11921235
11931236 intel_encoder = get_saved_enc(dev_priv, port, pipe);
11941237 if (!intel_encoder) {
11951238 drm_dbg_kms(&dev_priv->drm, "Not valid for port %c\n",
11961239 port_name(port));
1197− mutex_unlock(&dev_priv->av_mutex);
1240+ mutex_unlock(&dev_priv->audio.mutex);
11981241 return ret;
11991242 }
12001243
@@ -1206,7 +1249,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port, · 5 unmodified lines
12061249 memcpy(buf, eld, min(max_bytes, ret));
12071250 }
12081251
1209− mutex_unlock(&dev_priv->av_mutex);
1252+ mutex_unlock(&dev_priv->audio.mutex);
12101253 return ret;
12111254 }
12121255
@@ -1241,7 +1284,7 @@ static int i915_audio_component_bind(struct device *i915_kdev, · 28 unmodified lines
12411284 BUILD_BUG_ON(MAX_PORTS != I915_MAX_PORTS);
12421285 for (i = 0; i < ARRAY_SIZE(acomp->aud_sample_rate); i++)
12431286 acomp->aud_sample_rate[i] = 0;
1244− dev_priv->audio_component = acomp;
1287+ dev_priv->audio.component = acomp;
12451288 drm_modeset_unlock_all(&dev_priv->drm);
12461289
12471290 return 0;
@@ -1256,14 +1299,14 @@ static void i915_audio_component_unbind(struct device *i915_kdev, · 8 unmodified lines
12561299 drm_modeset_lock_all(&dev_priv->drm);
12571300 acomp->base.ops = NULL;
12581301 acomp->base.dev = NULL;
1259− dev_priv->audio_component = NULL;
1302+ dev_priv->audio.component = NULL;
12601303 drm_modeset_unlock_all(&dev_priv->drm);
12611304
12621305 device_link_remove(hda_kdev, i915_kdev);
12631306
1264− if (dev_priv->audio_power_refcount)
1307+ if (dev_priv->audio.power_refcount)
12651308 drm_err(&dev_priv->drm, "audio power refcount %d after unbind\n",
1266− dev_priv->audio_power_refcount);
1309+ dev_priv->audio.power_refcount);
12671310 }
12681311
12691312 static const struct component_ops i915_audio_component_bind_ops = {
@@ -1327,10 +1370,13 @@ static void i915_audio_component_init(struct drm_i915_private *dev_priv) · 57 unmodified lines
13271370 drm_dbg_kms(&dev_priv->drm, "use AUD_FREQ_CNTRL of 0x%x (init value 0x%x)\n",
13281371 aud_freq, aud_freq_init);
13291372
1330− dev_priv->audio_freq_cntrl = aud_freq;
1373+ dev_priv->audio.freq_cntrl = aud_freq;
13311374 }
13321375
1333− dev_priv->audio_component_registered = true;
1376+ /* init with current cdclk */
1377+ intel_audio_cdclk_change_post(dev_priv);
1378+
1379+ dev_priv->audio.component_registered = true;
13341380 }
13351381
13361382 /**
@@ -1342,11 +1388,11 @@ static void i915_audio_component_init(struct drm_i915_private *dev_priv) · 5 unmodified lines
13421388 */
13431389 static void i915_audio_component_cleanup(struct drm_i915_private *dev_priv)
13441390 {
1345− if (!dev_priv->audio_component_registered)
1391+ if (!dev_priv->audio.component_registered)
13461392 return;
13471393
13481394 component_del(dev_priv->drm.dev, &i915_audio_component_bind_ops);
1349− dev_priv->audio_component_registered = false;
1395+ dev_priv->audio.component_registered = false;
13501396 }
13511397
13521398 /**
@@ -1368,7 +1414,7 @@ void intel_audio_init(struct drm_i915_private *dev_priv) · 15 unmodified lines
13681414 */
13691415 void intel_audio_deinit(struct drm_i915_private *dev_priv)
13701416 {
1371− if ((dev_priv)->lpe_audio.platdev != NULL)
1417+ if ((dev_priv)->audio.lpe.platdev != NULL)
13721418 intel_lpe_audio_teardown(dev_priv);
13731419 else
13741420 i915_audio_component_cleanup(dev_priv);
drivers/gpu/drm/i915/display/intel_audio.h+3−1
@@ -11,13 +11,15 @@ struct drm_i915_private; · 10 unmodified lines
1111 struct intel_crtc_state;
1212 struct intel_encoder;
1313
14−void intel_init_audio_hooks(struct drm_i915_private *dev_priv);
14+void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
1515 void intel_audio_codec_enable(struct intel_encoder *encoder,
1616 const struct intel_crtc_state *crtc_state,
1717 const struct drm_connector_state *conn_state);
1818 void intel_audio_codec_disable(struct intel_encoder *encoder,
1919 const struct intel_crtc_state *old_crtc_state,
2020 const struct drm_connector_state *old_conn_state);
21+void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv);
22+void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv);
2123 void intel_audio_init(struct drm_i915_private *dev_priv);
2224 void intel_audio_deinit(struct drm_i915_private *dev_priv);
2325
drivers/gpu/drm/i915/display/intel_bw.c+180−33
@@ -27,6 +27,9 @@ struct intel_qgv_info { · 26 unmodified lines
2727 u8 num_points;
2828 u8 num_psf_points;
2929 u8 t_bl;
30+ u8 max_numchannels;
31+ u8 channel_width;
32+ u8 deinterleave;
3033 };
3134
3235 static int dg1_mchbar_read_qgv_point_info(struct drm_i915_private *dev_priv,
@@ -42,7 +45,7 @@ static int dg1_mchbar_read_qgv_point_info(struct drm_i915_private *dev_priv, · 9 unmodified lines
4245 dclk_reference = 6; /* 6 * 16.666 MHz = 100 MHz */
4346 else
4447 dclk_reference = 8; /* 8 * 16.666 MHz = 133 MHz */
45− sp->dclk = dclk_ratio * dclk_reference;
48+ sp->dclk = DIV_ROUND_UP((16667 * dclk_ratio * dclk_reference) + 500, 1000);
4649
4750 val = intel_uncore_read(&dev_priv->uncore, SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
4851 if (val & DG1_GEAR_TYPE)
@@ -69,6 +72,7 @@ static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv, · 20 unmodified lines
6972 int point)
7073 {
7174 u32 val = 0, val2 = 0;
75+ u16 dclk;
7276 int ret;
7377
7478 ret = sandybridge_pcode_read(dev_priv,
@@ -78,7 +82,8 @@ static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv, · 3 unmodified lines
7882 if (ret)
7983 return ret;
8084
81− sp->dclk = val & 0xffff;
85+ dclk = val & 0xffff;
86+ sp->dclk = DIV_ROUND_UP((16667 * dclk) + (DISPLAY_VER(dev_priv) > 11 ? 500 : 0), 1000);
8287 sp->t_rp = (val & 0xff0000) >> 16;
8388 sp->t_rcd = (val & 0xff000000) >> 24;
8489
@@ -133,7 +138,8 @@ int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv, · 48 unmodified lines
133138 }
134139
135140 static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
136− struct intel_qgv_info *qi)
141+ struct intel_qgv_info *qi,
142+ bool is_y_tile)
137143 {
138144 const struct dram_info *dram_info = &dev_priv->dram_info;
139145 int i, ret;
@@ -141,20 +147,44 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv, · 1 unmodified line
141147 qi->num_points = dram_info->num_qgv_points;
142148 qi->num_psf_points = dram_info->num_psf_gv_points;
143149
144− if (DISPLAY_VER(dev_priv) == 12)
150+ if (DISPLAY_VER(dev_priv) >= 12)
145151 switch (dram_info->type) {
146152 case INTEL_DRAM_DDR4:
147− qi->t_bl = 4;
153+ qi->t_bl = is_y_tile ? 8 : 4;
154+ qi->max_numchannels = 2;
155+ qi->channel_width = 64;
156+ qi->deinterleave = is_y_tile ? 1 : 2;
148157 break;
149158 case INTEL_DRAM_DDR5:
150− qi->t_bl = 8;
159+ qi->t_bl = is_y_tile ? 16 : 8;
160+ qi->max_numchannels = 4;
161+ qi->channel_width = 32;
162+ qi->deinterleave = is_y_tile ? 1 : 2;
163+ break;
164+ case INTEL_DRAM_LPDDR4:
165+ if (IS_ROCKETLAKE(dev_priv)) {
166+ qi->t_bl = 8;
167+ qi->max_numchannels = 4;
168+ qi->channel_width = 32;
169+ qi->deinterleave = 2;
170+ break;
171+ }
172+ fallthrough;
173+ case INTEL_DRAM_LPDDR5:
174+ qi->t_bl = 16;
175+ qi->max_numchannels = 8;
176+ qi->channel_width = 16;
177+ qi->deinterleave = is_y_tile ? 2 : 4;
151178 break;
152179 default:
153180 qi->t_bl = 16;
181+ qi->max_numchannels = 1;
154182 break;
155183 }
156− else if (DISPLAY_VER(dev_priv) == 11)
184+ else if (DISPLAY_VER(dev_priv) == 11) {
157185 qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8;
186+ qi->max_numchannels = 1;
187+ }
158188
159189 if (drm_WARN_ON(&dev_priv->drm,
160190 qi->num_points > ARRAY_SIZE(qi->points)))
@@ -193,12 +223,6 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv, · 32 unmodified lines
193223 return 0;
194224 }
195225
196−static int icl_calc_bw(int dclk, int num, int den)
197−{
198− /* multiples of 16.666MHz (100/6) */
199− return DIV_ROUND_CLOSEST(num * dclk * 100, den * 6);
200−}
201−
202226 static int adl_calc_psf_bw(int clk)
203227 {
204228 /*
@@ -240,7 +264,7 @@ static const struct intel_sa_info tgl_sa_info = { · 35 unmodified lines
240264 };
241265
242266 static const struct intel_sa_info rkl_sa_info = {
243− .deburst = 16,
267+ .deburst = 8,
244268 .deprogbwlimit = 20, /* GB/s */
245269 .displayrtids = 128,
246270 .derating = 10,
@@ -265,35 +289,130 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel · 18 unmodified lines
265289 struct intel_qgv_info qi = {};
266290 bool is_y_tile = true; /* assume y tile may be used */
267291 int num_channels = max_t(u8, 1, dev_priv->dram_info.num_channels);
268− int deinterleave;
269− int ipqdepth, ipqdepthpch;
292+ int ipqdepth, ipqdepthpch = 16;
270293 int dclk_max;
271294 int maxdebw;
295+ int num_groups = ARRAY_SIZE(dev_priv->max_bw);
272296 int i, ret;
273297
274− ret = icl_get_qgv_points(dev_priv, &qi);
298+ ret = icl_get_qgv_points(dev_priv, &qi, is_y_tile);
275299 if (ret) {
276300 drm_dbg_kms(&dev_priv->drm,
277301 "Failed to get memory subsystem information, ignoring bandwidth limits");
278302 return ret;
279303 }
280304
281− deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2);
282305 dclk_max = icl_sagv_max_dclk(&qi);
306+ maxdebw = min(sa->deprogbwlimit * 1000, dclk_max * 16 * 6 / 10);
307+ ipqdepth = min(ipqdepthpch, sa->displayrtids / num_channels);
308+ qi.deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2);
309+
310+ for (i = 0; i < num_groups; i++) {
311+ struct intel_bw_info *bi = &dev_priv->max_bw[i];
312+ int clpchgroup;
313+ int j;
314+
315+ clpchgroup = (sa->deburst * qi.deinterleave / num_channels) << i;
316+ bi->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1;
317+
318+ bi->num_qgv_points = qi.num_points;
319+ bi->num_psf_gv_points = qi.num_psf_points;
320+
321+ for (j = 0; j < qi.num_points; j++) {
322+ const struct intel_qgv_point *sp = &qi.points[j];
323+ int ct, bw;
324+
325+ /*
326+ * Max row cycle time
327+ *
328+ * FIXME what is the logic behind the
329+ * assumed burst length?
330+ */
331+ ct = max_t(int, sp->t_rc, sp->t_rp + sp->t_rcd +
332+ (clpchgroup - 1) * qi.t_bl + sp->t_rdpre);
333+ bw = DIV_ROUND_UP(sp->dclk * clpchgroup * 32 * num_channels, ct);
283334
284− ipqdepthpch = 16;
335+ bi->deratedbw[j] = min(maxdebw,
336+ bw * (100 - sa->derating) / 100);
337+
338+ drm_dbg_kms(&dev_priv->drm,
339+ "BW%d / QGV %d: num_planes=%d deratedbw=%u\n",
340+ i, j, bi->num_planes, bi->deratedbw[j]);
341+ }
342+ }
343+ /*
344+ * In case if SAGV is disabled in BIOS, we always get 1
345+ * SAGV point, but we can't send PCode commands to restrict it
346+ * as it will fail and pointless anyway.
347+ */
348+ if (qi.num_points == 1)
349+ dev_priv->sagv_status = I915_SAGV_NOT_CONTROLLED;
350+ else
351+ dev_priv->sagv_status = I915_SAGV_ENABLED;
352+
353+ return 0;
354+}
355+
356+static int tgl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel_sa_info *sa)
357+{
358+ struct intel_qgv_info qi = {};
359+ const struct dram_info *dram_info = &dev_priv->dram_info;
360+ bool is_y_tile = true; /* assume y tile may be used */
361+ int num_channels = max_t(u8, 1, dev_priv->dram_info.num_channels);
362+ int ipqdepth, ipqdepthpch = 16;
363+ int dclk_max;
364+ int maxdebw, peakbw;
365+ int clperchgroup;
366+ int num_groups = ARRAY_SIZE(dev_priv->max_bw);
367+ int i, ret;
368+
369+ ret = icl_get_qgv_points(dev_priv, &qi, is_y_tile);
370+ if (ret) {
371+ drm_dbg_kms(&dev_priv->drm,
372+ "Failed to get memory subsystem information, ignoring bandwidth limits");
373+ return ret;
374+ }
375+
376+ if (dram_info->type == INTEL_DRAM_LPDDR4 || dram_info->type == INTEL_DRAM_LPDDR5)
377+ num_channels *= 2;
378+
379+ qi.deinterleave = qi.deinterleave ? : DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2);
380+
381+ if (num_channels < qi.max_numchannels && DISPLAY_VER(dev_priv) >= 12)
382+ qi.deinterleave = max(DIV_ROUND_UP(qi.deinterleave, 2), 1);
383+
384+ if (DISPLAY_VER(dev_priv) > 11 && num_channels > qi.max_numchannels)
385+ drm_warn(&dev_priv->drm, "Number of channels exceeds max number of channels.");
386+ if (qi.max_numchannels != 0)
387+ num_channels = min_t(u8, num_channels, qi.max_numchannels);
388+
389+ dclk_max = icl_sagv_max_dclk(&qi);
390+
391+ peakbw = num_channels * DIV_ROUND_UP(qi.channel_width, 8) * dclk_max;
392+ maxdebw = min(sa->deprogbwlimit * 1000, peakbw * 6 / 10); /* 60% */
285393
286− maxdebw = min(sa->deprogbwlimit * 1000,
287− icl_calc_bw(dclk_max, 16, 1) * 6 / 10); /* 60% */
288394 ipqdepth = min(ipqdepthpch, sa->displayrtids / num_channels);
395+ /*
396+ * clperchgroup = 4kpagespermempage * clperchperblock,
397+ * clperchperblock = 8 / num_channels * interleave
398+ */
399+ clperchgroup = 4 * DIV_ROUND_UP(8, num_channels) * qi.deinterleave;
289400
290− for (i = 0; i < ARRAY_SIZE(dev_priv->max_bw); i++) {
401+ for (i = 0; i < num_groups; i++) {
291402 struct intel_bw_info *bi = &dev_priv->max_bw[i];
403+ struct intel_bw_info *bi_next;
292404 int clpchgroup;
293405 int j;
294406
295− clpchgroup = (sa->deburst * deinterleave / num_channels) << i;
296− bi->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1;
407+ if (i < num_groups - 1)
408+ bi_next = &dev_priv->max_bw[i + 1];
409+
410+ clpchgroup = (sa->deburst * qi.deinterleave / num_channels) << i;
411+
412+ if (i < num_groups - 1 && clpchgroup < clperchgroup)
413+ bi_next->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1;
414+ else
415+ bi_next->num_planes = 0;
297416
298417 bi->num_qgv_points = qi.num_points;
299418 bi->num_psf_gv_points = qi.num_psf_points;
@@ -310,7 +429,7 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel · 10 unmodified lines
310429 */
311430 ct = max_t(int, sp->t_rc, sp->t_rp + sp->t_rcd +
312431 (clpchgroup - 1) * qi.t_bl + sp->t_rdpre);
313− bw = icl_calc_bw(sp->dclk, clpchgroup * 32 * num_channels, ct);
432+ bw = DIV_ROUND_UP(sp->dclk * clpchgroup * 32 * num_channels, ct);
314433
315434 bi->deratedbw[j] = min(maxdebw,
316435 bw * (100 - sa->derating) / 100);
@@ -329,9 +448,6 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel · 12 unmodified lines
329448 "BW%d / PSF GV %d: num_planes=%d bw=%u\n",
330449 i, j, bi->num_planes, bi->psf_bw[j]);
331450 }
332−
333− if (bi->num_planes == 1)
334− break;
335451 }
336452
337453 /*
@@ -395,6 +511,34 @@ static unsigned int icl_max_bw(struct drm_i915_private *dev_priv, · 57 unmodified lines
395511 return 0;
396512 }
397513
514+static unsigned int tgl_max_bw(struct drm_i915_private *dev_priv,
515+ int num_planes, int qgv_point)
516+{
517+ int i;
518+
519+ /*
520+ * Let's return max bw for 0 planes
521+ */
522+ num_planes = max(1, num_planes);
523+
524+ for (i = ARRAY_SIZE(dev_priv->max_bw) - 1; i >= 0; i--) {
525+ const struct intel_bw_info *bi =
526+ &dev_priv->max_bw[i];
527+
528+ /*
529+ * Pcode will not expose all QGV points when
530+ * SAGV is forced to off/min/med/max.
531+ */
532+ if (qgv_point >= bi->num_qgv_points)
533+ return UINT_MAX;
534+
535+ if (num_planes <= bi->num_planes)
536+ return bi->deratedbw[qgv_point];
537+ }
538+
539+ return dev_priv->max_bw[0].deratedbw[qgv_point];
540+}
541+
398542 static unsigned int adl_psf_bw(struct drm_i915_private *dev_priv,
399543 int psf_gv_point)
400544 {
@@ -412,13 +556,13 @@ void intel_bw_init_hw(struct drm_i915_private *dev_priv) · 11 unmodified lines
412556 if (IS_DG2(dev_priv))
413557 dg2_get_bw_info(dev_priv);
414558 else if (IS_ALDERLAKE_P(dev_priv))
415− icl_get_bw_info(dev_priv, &adlp_sa_info);
559+ tgl_get_bw_info(dev_priv, &adlp_sa_info);
416560 else if (IS_ALDERLAKE_S(dev_priv))
417− icl_get_bw_info(dev_priv, &adls_sa_info);
561+ tgl_get_bw_info(dev_priv, &adls_sa_info);
418562 else if (IS_ROCKETLAKE(dev_priv))
419− icl_get_bw_info(dev_priv, &rkl_sa_info);
563+ tgl_get_bw_info(dev_priv, &rkl_sa_info);
420564 else if (DISPLAY_VER(dev_priv) == 12)
421− icl_get_bw_info(dev_priv, &tgl_sa_info);
565+ tgl_get_bw_info(dev_priv, &tgl_sa_info);
422566 else if (DISPLAY_VER(dev_priv) == 11)
423567 icl_get_bw_info(dev_priv, &icl_sa_info);
424568 }
@@ -746,7 +890,10 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 321 unmodified lines
746890 for (i = 0; i < num_qgv_points; i++) {
747891 unsigned int max_data_rate;
748892
749− max_data_rate = icl_max_bw(dev_priv, num_active_planes, i);
893+ if (DISPLAY_VER(dev_priv) > 11)
894+ max_data_rate = tgl_max_bw(dev_priv, num_active_planes, i);
895+ else
896+ max_data_rate = icl_max_bw(dev_priv, num_active_planes, i);
750897 /*
751898 * We need to know which qgv point gives us
752899 * maximum bandwidth in order to disable SAGV
drivers/gpu/drm/i915/display/intel_cdclk.c+5−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/time.h>
2525
2626 #include "intel_atomic.h"
27+#include "intel_audio.h"
2728 #include "intel_bw.h"
2829 #include "intel_cdclk.h"
2930 #include "intel_de.h"
@@ -1975,6 +1976,8 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, · 1945 unmodified lines
19751976 intel_psr_pause(intel_dp);
19761977 }
19771978
1979+ intel_audio_cdclk_change_pre(dev_priv);
1980+
19781981 /*
19791982 * Lock aux/gmbus while we change cdclk in case those
19801983 * functions use cdclk. Not all platforms/ports do,
@@ -2003,6 +2006,8 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, · 22 unmodified lines
20032006 intel_psr_resume(intel_dp);
20042007 }
20052008
2009+ intel_audio_cdclk_change_post(dev_priv);
2010+
20062011 if (drm_WARN(&dev_priv->drm,
20072012 intel_cdclk_changed(&dev_priv->cdclk.hw, cdclk_config),
20082013 "cdclk state doesn't match!\n")) {
drivers/gpu/drm/i915/display/intel_color.c+65−65
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include "intel_de.h"
2727 #include "intel_display_types.h"
2828 #include "intel_dpll.h"
29−#include "intel_dsi.h"
29+#include "vlv_dsi_pll.h"
3030
3131 #define CTM_COEFF_SIGN (1ULL << 63)
3232
@@ -552,8 +552,8 @@ static void i9xx_load_lut_8(struct intel_crtc *crtc, · 519 unmodified lines
552552 lut = blob->data;
553553
554554 for (i = 0; i < 256; i++)
555− intel_de_write(dev_priv, PALETTE(pipe, i),
556− i9xx_lut_8(&lut[i]));
555+ intel_de_write_fw(dev_priv, PALETTE(pipe, i),
556+ i9xx_lut_8(&lut[i]));
557557 }
558558
559559 static void i9xx_load_luts(const struct intel_crtc_state *crtc_state)
@@ -576,15 +576,15 @@ static void i965_load_lut_10p6(struct intel_crtc *crtc, · 16 unmodified lines
576576 enum pipe pipe = crtc->pipe;
577577
578578 for (i = 0; i < lut_size - 1; i++) {
579− intel_de_write(dev_priv, PALETTE(pipe, 2 * i + 0),
580− i965_lut_10p6_ldw(&lut[i]));
581− intel_de_write(dev_priv, PALETTE(pipe, 2 * i + 1),
582− i965_lut_10p6_udw(&lut[i]));
579+ intel_de_write_fw(dev_priv, PALETTE(pipe, 2 * i + 0),
580+ i965_lut_10p6_ldw(&lut[i]));
581+ intel_de_write_fw(dev_priv, PALETTE(pipe, 2 * i + 1),
582+ i965_lut_10p6_udw(&lut[i]));
583583 }
584584
585− intel_de_write(dev_priv, PIPEGCMAX(pipe, 0), lut[i].red);
586− intel_de_write(dev_priv, PIPEGCMAX(pipe, 1), lut[i].green);
587− intel_de_write(dev_priv, PIPEGCMAX(pipe, 2), lut[i].blue);
585+ intel_de_write_fw(dev_priv, PIPEGCMAX(pipe, 0), lut[i].red);
586+ intel_de_write_fw(dev_priv, PIPEGCMAX(pipe, 1), lut[i].green);
587+ intel_de_write_fw(dev_priv, PIPEGCMAX(pipe, 2), lut[i].blue);
588588 }
589589
590590 static void i965_load_luts(const struct intel_crtc_state *crtc_state)
@@ -618,8 +618,8 @@ static void ilk_load_lut_8(struct intel_crtc *crtc, · 27 unmodified lines
618618 lut = blob->data;
619619
620620 for (i = 0; i < 256; i++)
621− intel_de_write(dev_priv, LGC_PALETTE(pipe, i),
622− i9xx_lut_8(&lut[i]));
621+ intel_de_write_fw(dev_priv, LGC_PALETTE(pipe, i),
622+ i9xx_lut_8(&lut[i]));
623623 }
624624
625625 static void ilk_load_lut_10(struct intel_crtc *crtc,
@@ -631,8 +631,8 @@ static void ilk_load_lut_10(struct intel_crtc *crtc, · 5 unmodified lines
631631 enum pipe pipe = crtc->pipe;
632632
633633 for (i = 0; i < lut_size; i++)
634− intel_de_write(dev_priv, PREC_PALETTE(pipe, i),
635− ilk_lut_10(&lut[i]));
634+ intel_de_write_fw(dev_priv, PREC_PALETTE(pipe, i),
635+ ilk_lut_10(&lut[i]));
636636 }
637637
638638 static void ilk_load_luts(const struct intel_crtc_state *crtc_state)
@@ -681,16 +681,16 @@ static void ivb_load_lut_10(struct intel_crtc *crtc, · 42 unmodified lines
681681 const struct drm_color_lut *entry =
682682 &lut[i * (lut_size - 1) / (hw_lut_size - 1)];
683683
684− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), prec_index++);
685− intel_de_write(dev_priv, PREC_PAL_DATA(pipe),
686− ilk_lut_10(entry));
684+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), prec_index++);
685+ intel_de_write_fw(dev_priv, PREC_PAL_DATA(pipe),
686+ ilk_lut_10(entry));
687687 }
688688
689689 /*
690690 * Reset the index, otherwise it prevents the legacy palette to be
691691 * written properly.
692692 */
693− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0);
693+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0);
694694 }
695695
696696 /* On BDW+ the index auto increment mode actually works */
@@ -704,23 +704,23 @@ static void bdw_load_lut_10(struct intel_crtc *crtc, · 7 unmodified lines
704704 int i, lut_size = drm_color_lut_size(blob);
705705 enum pipe pipe = crtc->pipe;
706706
707− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe),
708− prec_index | PAL_PREC_AUTO_INCREMENT);
707+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe),
708+ prec_index | PAL_PREC_AUTO_INCREMENT);
709709
710710 for (i = 0; i < hw_lut_size; i++) {
711711 /* We discard half the user entries in split gamma mode */
712712 const struct drm_color_lut *entry =
713713 &lut[i * (lut_size - 1) / (hw_lut_size - 1)];
714714
715− intel_de_write(dev_priv, PREC_PAL_DATA(pipe),
716− ilk_lut_10(entry));
715+ intel_de_write_fw(dev_priv, PREC_PAL_DATA(pipe),
716+ ilk_lut_10(entry));
717717 }
718718
719719 /*
720720 * Reset the index, otherwise it prevents the legacy palette to be
721721 * written properly.
722722 */
723− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0);
723+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0);
724724 }
725725
726726 static void ivb_load_lut_ext_max(const struct intel_crtc_state *crtc_state)
@@ -821,9 +821,9 @@ static void glk_load_degamma_lut(const struct intel_crtc_state *crtc_state) · 94 unmodified lines
821821 * ignore the index bits, so we need to reset it to index 0
822822 * separately.
823823 */
824− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
825− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe),
826− PRE_CSC_GAMC_AUTO_INCREMENT);
824+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
825+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe),
826+ PRE_CSC_GAMC_AUTO_INCREMENT);
827827
828828 for (i = 0; i < lut_size; i++) {
829829 /*
@@ -839,15 +839,15 @@ static void glk_load_degamma_lut(const struct intel_crtc_state *crtc_state) · 9 unmodified lines
839839 * ToDo: Extend to max 7.0. Enable 32 bit input value
840840 * as compared to just 16 to achieve this.
841841 */
842− intel_de_write(dev_priv, PRE_CSC_GAMC_DATA(pipe),
843− lut[i].green);
842+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe),
843+ lut[i].green);
844844 }
845845
846846 /* Clamp values > 1.0. */
847847 while (i++ < 35)
848− intel_de_write(dev_priv, PRE_CSC_GAMC_DATA(pipe), 1 << 16);
848+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe), 1 << 16);
849849
850− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
850+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
851851 }
852852
853853 static void glk_load_degamma_lut_linear(const struct intel_crtc_state *crtc_state)
@@ -862,21 +862,21 @@ static void glk_load_degamma_lut_linear(const struct intel_crtc_state *crtc_stat · 8 unmodified lines
862862 * ignore the index bits, so we need to reset it to index 0
863863 * separately.
864864 */
865− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
866− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe),
867− PRE_CSC_GAMC_AUTO_INCREMENT);
865+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
866+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe),
867+ PRE_CSC_GAMC_AUTO_INCREMENT);
868868
869869 for (i = 0; i < lut_size; i++) {
870870 u32 v = (i << 16) / (lut_size - 1);
871871
872− intel_de_write(dev_priv, PRE_CSC_GAMC_DATA(pipe), v);
872+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe), v);
873873 }
874874
875875 /* Clamp values > 1.0. */
876876 while (i++ < 35)
877− intel_de_write(dev_priv, PRE_CSC_GAMC_DATA(pipe), 1 << 16);
877+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_DATA(pipe), 1 << 16);
878878
879− intel_de_write(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
879+ intel_de_write_fw(dev_priv, PRE_CSC_GAMC_INDEX(pipe), 0);
880880 }
881881
882882 static void glk_load_luts(const struct intel_crtc_state *crtc_state)
@@ -1071,10 +1071,10 @@ static void chv_load_cgm_degamma(struct intel_crtc *crtc, · 188 unmodified lines
10711071 enum pipe pipe = crtc->pipe;
10721072
10731073 for (i = 0; i < lut_size; i++) {
1074− intel_de_write(dev_priv, CGM_PIPE_DEGAMMA(pipe, i, 0),
1075− chv_cgm_degamma_ldw(&lut[i]));
1076− intel_de_write(dev_priv, CGM_PIPE_DEGAMMA(pipe, i, 1),
1077− chv_cgm_degamma_udw(&lut[i]));
1074+ intel_de_write_fw(dev_priv, CGM_PIPE_DEGAMMA(pipe, i, 0),
1075+ chv_cgm_degamma_ldw(&lut[i]));
1076+ intel_de_write_fw(dev_priv, CGM_PIPE_DEGAMMA(pipe, i, 1),
1077+ chv_cgm_degamma_udw(&lut[i]));
10781078 }
10791079 }
10801080
@@ -1105,10 +1105,10 @@ static void chv_load_cgm_gamma(struct intel_crtc *crtc, · 24 unmodified lines
11051105 enum pipe pipe = crtc->pipe;
11061106
11071107 for (i = 0; i < lut_size; i++) {
1108− intel_de_write(dev_priv, CGM_PIPE_GAMMA(pipe, i, 0),
1109− chv_cgm_gamma_ldw(&lut[i]));
1110− intel_de_write(dev_priv, CGM_PIPE_GAMMA(pipe, i, 1),
1111− chv_cgm_gamma_udw(&lut[i]));
1108+ intel_de_write_fw(dev_priv, CGM_PIPE_GAMMA(pipe, i, 0),
1109+ chv_cgm_gamma_ldw(&lut[i]));
1110+ intel_de_write_fw(dev_priv, CGM_PIPE_GAMMA(pipe, i, 1),
1111+ chv_cgm_gamma_udw(&lut[i]));
11121112 }
11131113 }
11141114
@@ -1131,8 +1131,8 @@ static void chv_load_luts(const struct intel_crtc_state *crtc_state) · 16 unmodified lines
11311131 else
11321132 i965_load_luts(crtc_state);
11331133
1134− intel_de_write(dev_priv, CGM_PIPE_MODE(crtc->pipe),
1135− crtc_state->cgm_mode);
1134+ intel_de_write_fw(dev_priv, CGM_PIPE_MODE(crtc->pipe),
1135+ crtc_state->cgm_mode);
11361136 }
11371137
11381138 void intel_color_load_luts(const struct intel_crtc_state *crtc_state)
@@ -1808,7 +1808,7 @@ static struct drm_property_blob *i9xx_read_lut_8(struct intel_crtc *crtc) · 669 unmodified lines
18081808 lut = blob->data;
18091809
18101810 for (i = 0; i < LEGACY_LUT_LENGTH; i++) {
1811− u32 val = intel_de_read(dev_priv, PALETTE(pipe, i));
1811+ u32 val = intel_de_read_fw(dev_priv, PALETTE(pipe, i));
18121812
18131813 i9xx_lut_8_pack(&lut[i], val);
18141814 }
@@ -1843,15 +1843,15 @@ static struct drm_property_blob *i965_read_lut_10p6(struct intel_crtc *crtc) · 28 unmodified lines
18431843 lut = blob->data;
18441844
18451845 for (i = 0; i < lut_size - 1; i++) {
1846− u32 ldw = intel_de_read(dev_priv, PALETTE(pipe, 2 * i + 0));
1847− u32 udw = intel_de_read(dev_priv, PALETTE(pipe, 2 * i + 1));
1846+ u32 ldw = intel_de_read_fw(dev_priv, PALETTE(pipe, 2 * i + 0));
1847+ u32 udw = intel_de_read_fw(dev_priv, PALETTE(pipe, 2 * i + 1));
18481848
18491849 i965_lut_10p6_pack(&lut[i], ldw, udw);
18501850 }
18511851
1852− lut[i].red = i965_lut_11p6_max_pack(intel_de_read(dev_priv, PIPEGCMAX(pipe, 0)));
1853− lut[i].green = i965_lut_11p6_max_pack(intel_de_read(dev_priv, PIPEGCMAX(pipe, 1)));
1854− lut[i].blue = i965_lut_11p6_max_pack(intel_de_read(dev_priv, PIPEGCMAX(pipe, 2)));
1852+ lut[i].red = i965_lut_11p6_max_pack(intel_de_read_fw(dev_priv, PIPEGCMAX(pipe, 0)));
1853+ lut[i].green = i965_lut_11p6_max_pack(intel_de_read_fw(dev_priv, PIPEGCMAX(pipe, 1)));
1854+ lut[i].blue = i965_lut_11p6_max_pack(intel_de_read_fw(dev_priv, PIPEGCMAX(pipe, 2)));
18551855
18561856 return blob;
18571857 }
@@ -1886,8 +1886,8 @@ static struct drm_property_blob *chv_read_cgm_gamma(struct intel_crtc *crtc) · 28 unmodified lines
18861886 lut = blob->data;
18871887
18881888 for (i = 0; i < lut_size; i++) {
1889− u32 ldw = intel_de_read(dev_priv, CGM_PIPE_GAMMA(pipe, i, 0));
1890− u32 udw = intel_de_read(dev_priv, CGM_PIPE_GAMMA(pipe, i, 1));
1889+ u32 ldw = intel_de_read_fw(dev_priv, CGM_PIPE_GAMMA(pipe, i, 0));
1890+ u32 udw = intel_de_read_fw(dev_priv, CGM_PIPE_GAMMA(pipe, i, 1));
18911891
18921892 chv_cgm_gamma_pack(&lut[i], ldw, udw);
18931893 }
@@ -1922,7 +1922,7 @@ static struct drm_property_blob *ilk_read_lut_8(struct intel_crtc *crtc) · 28 unmodified lines
19221922 lut = blob->data;
19231923
19241924 for (i = 0; i < LEGACY_LUT_LENGTH; i++) {
1925− u32 val = intel_de_read(dev_priv, LGC_PALETTE(pipe, i));
1925+ u32 val = intel_de_read_fw(dev_priv, LGC_PALETTE(pipe, i));
19261926
19271927 i9xx_lut_8_pack(&lut[i], val);
19281928 }
@@ -1947,7 +1947,7 @@ static struct drm_property_blob *ilk_read_lut_10(struct intel_crtc *crtc) · 18 unmodified lines
19471947 lut = blob->data;
19481948
19491949 for (i = 0; i < lut_size; i++) {
1950− u32 val = intel_de_read(dev_priv, PREC_PALETTE(pipe, i));
1950+ u32 val = intel_de_read_fw(dev_priv, PREC_PALETTE(pipe, i));
19511951
19521952 ilk_lut_10_pack(&lut[i], val);
19531953 }
@@ -1999,16 +1999,16 @@ static struct drm_property_blob *bdw_read_lut_10(struct intel_crtc *crtc, · 45 unmodified lines
19991999
20002000 lut = blob->data;
20012001
2002− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe),
2003− prec_index | PAL_PREC_AUTO_INCREMENT);
2002+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe),
2003+ prec_index | PAL_PREC_AUTO_INCREMENT);
20042004
20052005 for (i = 0; i < lut_size; i++) {
2006− u32 val = intel_de_read(dev_priv, PREC_PAL_DATA(pipe));
2006+ u32 val = intel_de_read_fw(dev_priv, PREC_PAL_DATA(pipe));
20072007
20082008 ilk_lut_10_pack(&lut[i], val);
20092009 }
20102010
2011− intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0);
2011+ intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0);
20122012
20132013 return blob;
20142014 }
@@ -2050,17 +2050,17 @@ icl_read_lut_multi_segment(struct intel_crtc *crtc) · 35 unmodified lines
20502050
20512051 lut = blob->data;
20522052
2053− intel_de_write(dev_priv, PREC_PAL_MULTI_SEG_INDEX(pipe),
2054− PAL_PREC_AUTO_INCREMENT);
2053+ intel_de_write_fw(dev_priv, PREC_PAL_MULTI_SEG_INDEX(pipe),
2054+ PAL_PREC_AUTO_INCREMENT);
20552055
20562056 for (i = 0; i < 9; i++) {
2057− u32 ldw = intel_de_read(dev_priv, PREC_PAL_MULTI_SEG_DATA(pipe));
2058− u32 udw = intel_de_read(dev_priv, PREC_PAL_MULTI_SEG_DATA(pipe));
2057+ u32 ldw = intel_de_read_fw(dev_priv, PREC_PAL_MULTI_SEG_DATA(pipe));
2058+ u32 udw = intel_de_read_fw(dev_priv, PREC_PAL_MULTI_SEG_DATA(pipe));
20592059
20602060 icl_lut_multi_seg_pack(&lut[i], ldw, udw);
20612061 }
20622062
2063− intel_de_write(dev_priv, PREC_PAL_MULTI_SEG_INDEX(pipe), 0);
2063+ intel_de_write_fw(dev_priv, PREC_PAL_MULTI_SEG_INDEX(pipe), 0);
20642064
20652065 /*
20662066 * FIXME readouts from PAL_PREC_DATA register aren't giving
drivers/gpu/drm/i915/display/intel_combo_phy.c+1−1
@@ -301,7 +301,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv, · 300 unmodified lines
301301
302302 val = intel_de_read(dev_priv, ICL_PORT_CL_DW10(phy));
303303 val &= ~PWR_DOWN_LN_MASK;
304− val |= lane_mask << PWR_DOWN_LN_SHIFT;
304+ val |= lane_mask;
305305 intel_de_write(dev_priv, ICL_PORT_CL_DW10(phy), val);
306306 }
307307
drivers/gpu/drm/i915/display/intel_crt.c+6−7
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include "intel_fifo_underrun.h"
4646 #include "intel_gmbus.h"
4747 #include "intel_hotplug.h"
48+#include "intel_pch_display.h"
4849
4950 /* Here's the desired hotplug mode */
5051 #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \
@@ -143,7 +144,7 @@ static void intel_crt_get_config(struct intel_encoder *encoder, · 92 unmodified lines
143144 static void hsw_crt_get_config(struct intel_encoder *encoder,
144145 struct intel_crtc_state *pipe_config)
145146 {
146− struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
147+ lpt_pch_get_config(pipe_config);
147148
148149 hsw_ddi_get_config(encoder, pipe_config);
149150
@@ -152,8 +153,6 @@ static void hsw_crt_get_config(struct intel_encoder *encoder, · 2 unmodified lines
152153 DRM_MODE_FLAG_PVSYNC |
153154 DRM_MODE_FLAG_NVSYNC);
154155 pipe_config->hw.adjusted_mode.flags |= intel_crt_get_flags(encoder);
155−
156− pipe_config->hw.adjusted_mode.crtc_clock = lpt_get_iclkip(dev_priv);
157156 }
158157
159158 /* Note: The caller is required to filter out dpms modes not supported by the
@@ -247,6 +246,7 @@ static void hsw_post_disable_crt(struct intel_atomic_state *state, · 87 unmodified lines
247246 const struct intel_crtc_state *old_crtc_state,
248247 const struct drm_connector_state *old_conn_state)
249248 {
249+ struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
250250 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
251251
252252 intel_crtc_vblank_off(old_crtc_state);
@@ -261,10 +261,9 @@ static void hsw_post_disable_crt(struct intel_atomic_state *state, · 8 unmodified lines
261261
262262 pch_post_disable_crt(state, encoder, old_crtc_state, old_conn_state);
263263
264− lpt_disable_pch_transcoder(dev_priv);
265− lpt_disable_iclkip(dev_priv);
264+ lpt_pch_disable(state, crtc);
266265
267− intel_ddi_fdi_post_disable(state, encoder, old_crtc_state, old_conn_state);
266+ hsw_fdi_disable(encoder);
268267
269268 drm_WARN_ON(&dev_priv->drm, !old_crtc_state->has_pch_encoder);
270269
@@ -316,7 +315,7 @@ static void hsw_enable_crt(struct intel_atomic_state *state, · 45 unmodified lines
316315
317316 intel_enable_transcoder(crtc_state);
318317
319− lpt_pch_enable(crtc_state);
318+ lpt_pch_enable(state, crtc);
320319
321320 intel_crtc_vblank_on(crtc_state);
322321
drivers/gpu/drm/i915/display/intel_crtc.c+98−9
@@ -3,16 +3,18 @@ · 2 unmodified lines
33 * Copyright © 2020 Intel Corporation
44 */
55 #include <linux/kernel.h>
6+#include <linux/pm_qos.h>
67 #include <linux/slab.h>
78
89 #include <drm/drm_atomic_helper.h>
910 #include <drm/drm_fourcc.h>
1011 #include <drm/drm_plane.h>
1112 #include <drm/drm_plane_helper.h>
13+#include <drm/drm_vblank_work.h>
1214
1315 #include "i915_trace.h"
1416 #include "i915_vgpu.h"
15−
17+#include "icl_dsi.h"
1618 #include "intel_atomic.h"
1719 #include "intel_atomic_plane.h"
1820 #include "intel_color.h"
@@ -167,6 +169,8 @@ static void intel_crtc_destroy(struct drm_crtc *_crtc) · 148 unmodified lines
167169 {
168170 struct intel_crtc *crtc = to_intel_crtc(_crtc);
169171
172+ cpu_latency_qos_remove_request(&crtc->vblank_pm_qos);
173+
170174 drm_crtc_cleanup(&crtc->base);
171175 kfree(crtc);
172176 }
@@ -344,6 +348,8 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe) · 171 unmodified lines
344348
345349 intel_crtc_crc_init(crtc);
346350
351+ cpu_latency_qos_add_request(&crtc->vblank_pm_qos, PM_QOS_DEFAULT_VALUE);
352+
347353 drm_WARN_ON(&dev_priv->drm, drm_crtc_index(&crtc->base) != crtc->pipe);
348354
349355 return 0;
@@ -354,6 +360,65 @@ fail: · 4 unmodified lines
354360 return ret;
355361 }
356362
363+static bool intel_crtc_needs_vblank_work(const struct intel_crtc_state *crtc_state)
364+{
365+ return crtc_state->hw.active &&
366+ !intel_crtc_needs_modeset(crtc_state) &&
367+ !crtc_state->preload_luts &&
368+ (crtc_state->uapi.color_mgmt_changed ||
369+ crtc_state->update_pipe);
370+}
371+
372+static void intel_crtc_vblank_work(struct kthread_work *base)
373+{
374+ struct drm_vblank_work *work = to_drm_vblank_work(base);
375+ struct intel_crtc_state *crtc_state =
376+ container_of(work, typeof(*crtc_state), vblank_work);
377+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
378+
379+ trace_intel_crtc_vblank_work_start(crtc);
380+
381+ intel_color_load_luts(crtc_state);
382+
383+ if (crtc_state->uapi.event) {
384+ spin_lock_irq(&crtc->base.dev->event_lock);
385+ drm_crtc_send_vblank_event(&crtc->base, crtc_state->uapi.event);
386+ crtc_state->uapi.event = NULL;
387+ spin_unlock_irq(&crtc->base.dev->event_lock);
388+ }
389+
390+ trace_intel_crtc_vblank_work_end(crtc);
391+}
392+
393+static void intel_crtc_vblank_work_init(struct intel_crtc_state *crtc_state)
394+{
395+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
396+
397+ drm_vblank_work_init(&crtc_state->vblank_work, &crtc->base,
398+ intel_crtc_vblank_work);
399+ /*
400+ * Interrupt latency is critical for getting the vblank
401+ * work executed as early as possible during the vblank.
402+ */
403+ cpu_latency_qos_update_request(&crtc->vblank_pm_qos, 0);
404+}
405+
406+void intel_wait_for_vblank_workers(struct intel_atomic_state *state)
407+{
408+ struct intel_crtc_state *crtc_state;
409+ struct intel_crtc *crtc;
410+ int i;
411+
412+ for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
413+ if (!intel_crtc_needs_vblank_work(crtc_state))
414+ continue;
415+
416+ drm_vblank_work_flush(&crtc_state->vblank_work);
417+ cpu_latency_qos_update_request(&crtc->vblank_pm_qos,
418+ PM_QOS_DEFAULT_VALUE);
419+ }
420+}
421+
357422 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
358423 int usecs)
359424 {
@@ -387,7 +452,7 @@ static int intel_mode_vblank_start(const struct drm_display_mode *mode) · 27 unmodified lines
387452 * until a subsequent call to intel_pipe_update_end(). That is done to
388453 * avoid random delays.
389454 */
390−void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
455+void intel_pipe_update_start(struct intel_crtc_state *new_crtc_state)
391456 {
392457 struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
393458 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -402,10 +467,17 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) · 8 unmodified lines
402467 if (new_crtc_state->uapi.async_flip)
403468 return;
404469
405− if (new_crtc_state->vrr.enable)
406− vblank_start = intel_vrr_vmax_vblank_start(new_crtc_state);
407− else
470+ if (intel_crtc_needs_vblank_work(new_crtc_state))
471+ intel_crtc_vblank_work_init(new_crtc_state);
472+
473+ if (new_crtc_state->vrr.enable) {
474+ if (intel_vrr_is_push_sent(new_crtc_state))
475+ vblank_start = intel_vrr_vmin_vblank_start(new_crtc_state);
476+ else
477+ vblank_start = intel_vrr_vmax_vblank_start(new_crtc_state);
478+ } else {
408479 vblank_start = intel_mode_vblank_start(adjusted_mode);
480+ }
409481
410482 /* FIXME needs to be calibrated sensibly */
411483 min = vblank_start - intel_usecs_to_scanlines(adjusted_mode,
@@ -554,7 +626,11 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) · 142 unmodified lines
554626 * Would be slightly nice to just grab the vblank count and arm the
555627 * event outside of the critical section - the spinlock might spin for a
556628 * while ... */
557− if (new_crtc_state->uapi.event) {
629+ if (intel_crtc_needs_vblank_work(new_crtc_state)) {
630+ drm_vblank_work_schedule(&new_crtc_state->vblank_work,
631+ drm_crtc_accurate_vblank_count(&crtc->base) + 1,
632+ false);
633+ } else if (new_crtc_state->uapi.event) {
558634 drm_WARN_ON(&dev_priv->drm,
559635 drm_crtc_vblank_get(&crtc->base) != 0);
560636
@@ -566,11 +642,24 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) · 5 unmodified lines
566642 new_crtc_state->uapi.event = NULL;
567643 }
568644
569− local_irq_enable();
570−
571− /* Send VRR Push to terminate Vblank */
645+ /*
646+ * Send VRR Push to terminate Vblank. If we are already in vblank
647+ * this has to be done _after_ sampling the frame counter, as
648+ * otherwise the push would immediately terminate the vblank and
649+ * the sampled frame counter would correspond to the next frame
650+ * instead of the current frame.
651+ *
652+ * There is a tiny race here (iff vblank evasion failed us) where
653+ * we might sample the frame counter just before vmax vblank start
654+ * but the push would be sent just after it. That would cause the
655+ * push to affect the next frame instead of the current frame,
656+ * which would cause the next frame to terminate already at vmin
657+ * vblank start instead of vmax vblank start.
658+ */
572659 intel_vrr_send_push(new_crtc_state);
573660
661+ local_irq_enable();
662+
574663 if (intel_vgpu_active(dev_priv))
575664 return;
576665
drivers/gpu/drm/i915/display/intel_crtc.h+7−0
@@ -9,10 +9,14 @@ · 8 unmodified lines
99 #include <linux/types.h>
1010
1111 enum pipe;
12+struct drm_display_mode;
1213 struct drm_i915_private;
14+struct intel_atomic_state;
1315 struct intel_crtc;
1416 struct intel_crtc_state;
1517
18+int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
19+ int usecs);
1620 u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state);
1721 int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe);
1822 struct intel_crtc_state *intel_crtc_state_alloc(struct intel_crtc *crtc);
@@ -21,5 +25,8 @@ void intel_crtc_state_reset(struct intel_crtc_state *crtc_state, · 2 unmodified lines
2125 u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);
2226 void intel_crtc_vblank_on(const struct intel_crtc_state *crtc_state);
2327 void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state);
28+void intel_pipe_update_start(struct intel_crtc_state *new_crtc_state);
29+void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state);
30+void intel_wait_for_vblank_workers(struct intel_atomic_state *state);
2431
2532 #endif
drivers/gpu/drm/i915/display/intel_cursor.c+38−31
@@ -28,11 +28,6 @@ static const u32 intel_cursor_formats[] = { · 27 unmodified lines
2828 DRM_FORMAT_ARGB8888,
2929 };
3030
31−static const u64 cursor_format_modifiers[] = {
32− DRM_FORMAT_MOD_LINEAR,
33− DRM_FORMAT_MOD_INVALID
34−};
35−
3631 static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
3732 {
3833 struct drm_i915_private *dev_priv =
@@ -195,7 +190,7 @@ static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state, · 156 unmodified lines
195190 {
196191 return CURSOR_ENABLE |
197192 CURSOR_FORMAT_ARGB |
198− CURSOR_STRIDE(plane_state->view.color_plane[0].stride);
193+ CURSOR_STRIDE(plane_state->view.color_plane[0].mapping_stride);
199194 }
200195
201196 static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state)
@@ -234,7 +229,7 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state, · 32 unmodified lines
234229 }
235230
236231 drm_WARN_ON(&i915->drm, plane_state->uapi.visible &&
237− plane_state->view.color_plane[0].stride != fb->pitches[0]);
232+ plane_state->view.color_plane[0].mapping_stride != fb->pitches[0]);
238233
239234 switch (fb->pitches[0]) {
240235 case 256:
@@ -253,9 +248,10 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state, · 12 unmodified lines
253248 return 0;
254249 }
255250
256−static void i845_update_cursor(struct intel_plane *plane,
257− const struct intel_crtc_state *crtc_state,
258− const struct intel_plane_state *plane_state)
251+/* TODO: split into noarm+arm pair */
252+static void i845_cursor_update_arm(struct intel_plane *plane,
253+ const struct intel_crtc_state *crtc_state,
254+ const struct intel_plane_state *plane_state)
259255 {
260256 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
261257 u32 cntl = 0, base = 0, pos = 0, size = 0;
@@ -298,10 +294,10 @@ static void i845_update_cursor(struct intel_plane *plane, · 36 unmodified lines
298294 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
299295 }
300296
301−static void i845_disable_cursor(struct intel_plane *plane,
302− const struct intel_crtc_state *crtc_state)
297+static void i845_cursor_disable_arm(struct intel_plane *plane,
298+ const struct intel_crtc_state *crtc_state)
303299 {
304− i845_update_cursor(plane, crtc_state, NULL);
300+ i845_cursor_update_arm(plane, crtc_state, NULL);
305301 }
306302
307303 static bool i845_cursor_get_hw_state(struct intel_plane *plane,
@@ -455,7 +451,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, · 147 unmodified lines
455451 }
456452
457453 drm_WARN_ON(&dev_priv->drm, plane_state->uapi.visible &&
458− plane_state->view.color_plane[0].stride != fb->pitches[0]);
454+ plane_state->view.color_plane[0].mapping_stride != fb->pitches[0]);
459455
460456 if (fb->pitches[0] !=
461457 drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
@@ -488,9 +484,10 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, · 26 unmodified lines
488484 return 0;
489485 }
490486
491−static void i9xx_update_cursor(struct intel_plane *plane,
492− const struct intel_crtc_state *crtc_state,
493− const struct intel_plane_state *plane_state)
487+/* TODO: split into noarm+arm pair */
488+static void i9xx_cursor_update_arm(struct intel_plane *plane,
489+ const struct intel_crtc_state *crtc_state,
490+ const struct intel_plane_state *plane_state)
494491 {
495492 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
496493 enum pipe pipe = plane->pipe;
@@ -562,10 +559,10 @@ static void i9xx_update_cursor(struct intel_plane *plane, · 65 unmodified lines
562559 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
563560 }
564561
565−static void i9xx_disable_cursor(struct intel_plane *plane,
566− const struct intel_crtc_state *crtc_state)
562+static void i9xx_cursor_disable_arm(struct intel_plane *plane,
563+ const struct intel_crtc_state *crtc_state)
567564 {
568− i9xx_update_cursor(plane, crtc_state, NULL);
565+ i9xx_cursor_update_arm(plane, crtc_state, NULL);
569566 }
570567
571568 static bool i9xx_cursor_get_hw_state(struct intel_plane *plane,
@@ -605,8 +602,10 @@ static bool i9xx_cursor_get_hw_state(struct intel_plane *plane, · 33 unmodified lines
605602 static bool intel_cursor_format_mod_supported(struct drm_plane *_plane,
606603 u32 format, u64 modifier)
607604 {
608− return modifier == DRM_FORMAT_MOD_LINEAR &&
609− format == DRM_FORMAT_ARGB8888;
605+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
606+ return false;
607+
608+ return format == DRM_FORMAT_ARGB8888;
610609 }
611610
612611 static int
@@ -717,10 +716,12 @@ intel_legacy_cursor_update(struct drm_plane *_plane, · 104 unmodified lines
717716 */
718717 crtc_state->active_planes = new_crtc_state->active_planes;
719718
720− if (new_plane_state->uapi.visible)
721− intel_update_plane(plane, crtc_state, new_plane_state);
722− else
723− intel_disable_plane(plane, crtc_state);
719+ if (new_plane_state->uapi.visible) {
720+ intel_plane_update_noarm(plane, crtc_state, new_plane_state);
721+ intel_plane_update_arm(plane, crtc_state, new_plane_state);
722+ } else {
723+ intel_plane_disable_arm(plane, crtc_state);
724+ }
724725
725726 intel_plane_unpin_fb(old_plane_state);
726727
@@ -754,6 +755,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 27 unmodified lines
754755 {
755756 struct intel_plane *cursor;
756757 int ret, zpos;
758+ u64 *modifiers;
757759
758760 cursor = intel_plane_alloc();
759761 if (IS_ERR(cursor))
@@ -766,14 +768,14 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 6 unmodified lines
766768
767769 if (IS_I845G(dev_priv) || IS_I865G(dev_priv)) {
768770 cursor->max_stride = i845_cursor_max_stride;
769− cursor->update_plane = i845_update_cursor;
770− cursor->disable_plane = i845_disable_cursor;
771+ cursor->update_arm = i845_cursor_update_arm;
772+ cursor->disable_arm = i845_cursor_disable_arm;
771773 cursor->get_hw_state = i845_cursor_get_hw_state;
772774 cursor->check_plane = i845_check_cursor;
773775 } else {
774776 cursor->max_stride = i9xx_cursor_max_stride;
775− cursor->update_plane = i9xx_update_cursor;
776− cursor->disable_plane = i9xx_disable_cursor;
777+ cursor->update_arm = i9xx_cursor_update_arm;
778+ cursor->disable_arm = i9xx_cursor_disable_arm;
777779 cursor->get_hw_state = i9xx_cursor_get_hw_state;
778780 cursor->check_plane = i9xx_check_cursor;
779781 }
@@ -784,13 +786,18 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 4 unmodified lines
784786 if (IS_I845G(dev_priv) || IS_I865G(dev_priv) || HAS_CUR_FBC(dev_priv))
785787 cursor->cursor.size = ~0;
786788
789+ modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_NONE);
790+
787791 ret = drm_universal_plane_init(&dev_priv->drm, &cursor->base,
788792 0, &intel_cursor_plane_funcs,
789793 intel_cursor_formats,
790794 ARRAY_SIZE(intel_cursor_formats),
791− cursor_format_modifiers,
795+ modifiers,
792796 DRM_PLANE_TYPE_CURSOR,
793797 "cursor %c", pipe_name(pipe));
798+
799+ kfree(modifiers);
800+
794801 if (ret)
795802 goto fail;
796803
drivers/gpu/drm/i915/display/intel_ddi.c+143−205
@@ -321,10 +321,11 @@ static void ddi_dotclock_get(struct intel_crtc_state *pipe_config) · 320 unmodified lines
321321 {
322322 int dotclock;
323323
324+ /* CRT dotclock is determined via other means */
324325 if (pipe_config->has_pch_encoder)
325− dotclock = intel_dotclock_calculate(pipe_config->port_clock,
326− &pipe_config->fdi_m_n);
327− else if (intel_crtc_has_dp_encoder(pipe_config))
326+ return;
327+
328+ if (intel_crtc_has_dp_encoder(pipe_config))
328329 dotclock = intel_dotclock_calculate(pipe_config->port_clock,
329330 &pipe_config->dp_m_n);
330331 else if (pipe_config->has_hdmi_sink && pipe_config->pipe_bpp > 24)
@@ -1039,7 +1040,6 @@ static void icl_ddi_combo_vswing_program(struct intel_encoder *encoder, · 708 unmodified lines
10391040 const struct intel_crtc_state *crtc_state)
10401041 {
10411042 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
1042− int level = intel_ddi_level(encoder, crtc_state, 0);
10431043 const struct intel_ddi_buf_trans *trans;
10441044 enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
10451045 int n_entries, ln;
@@ -1068,32 +1068,36 @@ static void icl_ddi_combo_vswing_program(struct intel_encoder *encoder, · 22 unmodified lines
10681068 intel_de_write(dev_priv, ICL_PORT_TX_DW5_GRP(phy), val);
10691069
10701070 /* Program PORT_TX_DW2 */
1071− val = intel_de_read(dev_priv, ICL_PORT_TX_DW2_LN(0, phy));
1072− val &= ~(SWING_SEL_LOWER_MASK | SWING_SEL_UPPER_MASK |
1073− RCOMP_SCALAR_MASK);
1074− val |= SWING_SEL_UPPER(trans->entries[level].icl.dw2_swing_sel);
1075− val |= SWING_SEL_LOWER(trans->entries[level].icl.dw2_swing_sel);
1076− /* Program Rcomp scalar for every table entry */
1077− val |= RCOMP_SCALAR(0x98);
1078− intel_de_write(dev_priv, ICL_PORT_TX_DW2_GRP(phy), val);
1071+ for (ln = 0; ln < 4; ln++) {
1072+ int level = intel_ddi_level(encoder, crtc_state, ln);
1073+
1074+ intel_de_rmw(dev_priv, ICL_PORT_TX_DW2_LN(ln, phy),
1075+ SWING_SEL_UPPER_MASK | SWING_SEL_LOWER_MASK | RCOMP_SCALAR_MASK,
1076+ SWING_SEL_UPPER(trans->entries[level].icl.dw2_swing_sel) |
1077+ SWING_SEL_LOWER(trans->entries[level].icl.dw2_swing_sel) |
1078+ RCOMP_SCALAR(0x98));
1079+ }
10791080
10801081 /* Program PORT_TX_DW4 */
10811082 /* We cannot write to GRP. It would overwrite individual loadgen. */
10821083 for (ln = 0; ln < 4; ln++) {
1083− val = intel_de_read(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy));
1084− val &= ~(POST_CURSOR_1_MASK | POST_CURSOR_2_MASK |
1085− CURSOR_COEFF_MASK);
1086− val |= POST_CURSOR_1(trans->entries[level].icl.dw4_post_cursor_1);
1087− val |= POST_CURSOR_2(trans->entries[level].icl.dw4_post_cursor_2);
1088− val |= CURSOR_COEFF(trans->entries[level].icl.dw4_cursor_coeff);
1089− intel_de_write(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy), val);
1084+ int level = intel_ddi_level(encoder, crtc_state, ln);
1085+
1086+ intel_de_rmw(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy),
1087+ POST_CURSOR_1_MASK | POST_CURSOR_2_MASK | CURSOR_COEFF_MASK,
1088+ POST_CURSOR_1(trans->entries[level].icl.dw4_post_cursor_1) |
1089+ POST_CURSOR_2(trans->entries[level].icl.dw4_post_cursor_2) |
1090+ CURSOR_COEFF(trans->entries[level].icl.dw4_cursor_coeff));
10901091 }
10911092
10921093 /* Program PORT_TX_DW7 */
1093− val = intel_de_read(dev_priv, ICL_PORT_TX_DW7_LN(0, phy));
1094− val &= ~N_SCALAR_MASK;
1095− val |= N_SCALAR(trans->entries[level].icl.dw7_n_scalar);
1096− intel_de_write(dev_priv, ICL_PORT_TX_DW7_GRP(phy), val);
1094+ for (ln = 0; ln < 4; ln++) {
1095+ int level = intel_ddi_level(encoder, crtc_state, ln);
1096+
1097+ intel_de_rmw(dev_priv, ICL_PORT_TX_DW7_LN(ln, phy),
1098+ N_SCALAR_MASK,
1099+ N_SCALAR(trans->entries[level].icl.dw7_n_scalar));
1100+ }
10971101 }
10981102
10991103 static void icl_combo_phy_set_signal_levels(struct intel_encoder *encoder,
@@ -1124,16 +1128,14 @@ static void icl_combo_phy_set_signal_levels(struct intel_encoder *encoder, · 24 unmodified lines
11241128 * > 6 GHz (LN0=0, LN1=0, LN2=0, LN3=0)
11251129 */
11261130 for (ln = 0; ln < 4; ln++) {
1127− val = intel_de_read(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy));
1128− val &= ~LOADGEN_SELECT;
1129− val |= icl_combo_phy_loadgen_select(crtc_state, ln);
1130− intel_de_write(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy), val);
1131+ intel_de_rmw(dev_priv, ICL_PORT_TX_DW4_LN(ln, phy),
1132+ LOADGEN_SELECT,
1133+ icl_combo_phy_loadgen_select(crtc_state, ln));
11311134 }
11321135
11331136 /* 3. Set PORT_CL_DW5 SUS Clock Config to 11b */
1134− val = intel_de_read(dev_priv, ICL_PORT_CL_DW5(phy));
1135− val |= SUS_CLOCK_CONFIG;
1136− intel_de_write(dev_priv, ICL_PORT_CL_DW5(phy), val);
1137+ intel_de_rmw(dev_priv, ICL_PORT_CL_DW5(phy),
1138+ 0, SUS_CLOCK_CONFIG);
11371139
11381140 /* 4. Clear training enable to change swing values */
11391141 val = intel_de_read(dev_priv, ICL_PORT_TX_DW5_LN(0, phy));
@@ -1154,10 +1156,8 @@ static void icl_mg_phy_set_signal_levels(struct intel_encoder *encoder, · 14 unmodified lines
11541156 {
11551157 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
11561158 enum tc_port tc_port = intel_port_to_tc(dev_priv, encoder->port);
1157− int level = intel_ddi_level(encoder, crtc_state, 0);
11581159 const struct intel_ddi_buf_trans *trans;
11591160 int n_entries, ln;
1160− u32 val;
11611161
11621162 if (intel_tc_port_in_tbt_alt_mode(enc_to_dig_port(encoder)))
11631163 return;
@@ -1166,53 +1166,51 @@ static void icl_mg_phy_set_signal_levels(struct intel_encoder *encoder, · 2 unmodified lines
11661166 if (drm_WARN_ON_ONCE(&dev_priv->drm, !trans))
11671167 return;
11681168
1169− /* Set MG_TX_LINK_PARAMS cri_use_fs32 to 0. */
11701169 for (ln = 0; ln < 2; ln++) {
1171− val = intel_de_read(dev_priv, MG_TX1_LINK_PARAMS(ln, tc_port));
1172− val &= ~CRI_USE_FS32;
1173− intel_de_write(dev_priv, MG_TX1_LINK_PARAMS(ln, tc_port), val);
1174−
1175− val = intel_de_read(dev_priv, MG_TX2_LINK_PARAMS(ln, tc_port));
1176− val &= ~CRI_USE_FS32;
1177− intel_de_write(dev_priv, MG_TX2_LINK_PARAMS(ln, tc_port), val);
1170+ intel_de_rmw(dev_priv, MG_TX1_LINK_PARAMS(ln, tc_port),
1171+ CRI_USE_FS32, 0);
1172+ intel_de_rmw(dev_priv, MG_TX2_LINK_PARAMS(ln, tc_port),
1173+ CRI_USE_FS32, 0);
11781174 }
11791175
11801176 /* Program MG_TX_SWINGCTRL with values from vswing table */
11811177 for (ln = 0; ln < 2; ln++) {
1182− val = intel_de_read(dev_priv, MG_TX1_SWINGCTRL(ln, tc_port));
1183− val &= ~CRI_TXDEEMPH_OVERRIDE_17_12_MASK;
1184− val |= CRI_TXDEEMPH_OVERRIDE_17_12(
1185− trans->entries[level].mg.cri_txdeemph_override_17_12);
1186− intel_de_write(dev_priv, MG_TX1_SWINGCTRL(ln, tc_port), val);
1187−
1188− val = intel_de_read(dev_priv, MG_TX2_SWINGCTRL(ln, tc_port));
1189− val &= ~CRI_TXDEEMPH_OVERRIDE_17_12_MASK;
1190− val |= CRI_TXDEEMPH_OVERRIDE_17_12(
1191− trans->entries[level].mg.cri_txdeemph_override_17_12);
1192− intel_de_write(dev_priv, MG_TX2_SWINGCTRL(ln, tc_port), val);
1178+ int level;
1179+
1180+ level = intel_ddi_level(encoder, crtc_state, 2*ln+0);
1181+
1182+ intel_de_rmw(dev_priv, MG_TX1_SWINGCTRL(ln, tc_port),
1183+ CRI_TXDEEMPH_OVERRIDE_17_12_MASK,
1184+ CRI_TXDEEMPH_OVERRIDE_17_12(trans->entries[level].mg.cri_txdeemph_override_17_12));
1185+
1186+ level = intel_ddi_level(encoder, crtc_state, 2*ln+1);
1187+
1188+ intel_de_rmw(dev_priv, MG_TX2_SWINGCTRL(ln, tc_port),
1189+ CRI_TXDEEMPH_OVERRIDE_17_12_MASK,
1190+ CRI_TXDEEMPH_OVERRIDE_17_12(trans->entries[level].mg.cri_txdeemph_override_17_12));
11931191 }
11941192
11951193 /* Program MG_TX_DRVCTRL with values from vswing table */
11961194 for (ln = 0; ln < 2; ln++) {
1197− val = intel_de_read(dev_priv, MG_TX1_DRVCTRL(ln, tc_port));
1198− val &= ~(CRI_TXDEEMPH_OVERRIDE_11_6_MASK |
1199− CRI_TXDEEMPH_OVERRIDE_5_0_MASK);
1200− val |= CRI_TXDEEMPH_OVERRIDE_5_0(
1201− trans->entries[level].mg.cri_txdeemph_override_5_0) |
1202− CRI_TXDEEMPH_OVERRIDE_11_6(
1203− trans->entries[level].mg.cri_txdeemph_override_11_6) |
1204− CRI_TXDEEMPH_OVERRIDE_EN;
1205− intel_de_write(dev_priv, MG_TX1_DRVCTRL(ln, tc_port), val);
1206−
1207− val = intel_de_read(dev_priv, MG_TX2_DRVCTRL(ln, tc_port));
1208− val &= ~(CRI_TXDEEMPH_OVERRIDE_11_6_MASK |
1209− CRI_TXDEEMPH_OVERRIDE_5_0_MASK);
1210− val |= CRI_TXDEEMPH_OVERRIDE_5_0(
1211− trans->entries[level].mg.cri_txdeemph_override_5_0) |
1212− CRI_TXDEEMPH_OVERRIDE_11_6(
1213− trans->entries[level].mg.cri_txdeemph_override_11_6) |
1214− CRI_TXDEEMPH_OVERRIDE_EN;
1215− intel_de_write(dev_priv, MG_TX2_DRVCTRL(ln, tc_port), val);
1195+ int level;
1196+
1197+ level = intel_ddi_level(encoder, crtc_state, 2*ln+0);
1198+
1199+ intel_de_rmw(dev_priv, MG_TX1_DRVCTRL(ln, tc_port),
1200+ CRI_TXDEEMPH_OVERRIDE_11_6_MASK |
1201+ CRI_TXDEEMPH_OVERRIDE_5_0_MASK,
1202+ CRI_TXDEEMPH_OVERRIDE_11_6(trans->entries[level].mg.cri_txdeemph_override_11_6) |
1203+ CRI_TXDEEMPH_OVERRIDE_5_0(trans->entries[level].mg.cri_txdeemph_override_5_0) |
1204+ CRI_TXDEEMPH_OVERRIDE_EN);
1205+
1206+ level = intel_ddi_level(encoder, crtc_state, 2*ln+1);
1207+
1208+ intel_de_rmw(dev_priv, MG_TX2_DRVCTRL(ln, tc_port),
1209+ CRI_TXDEEMPH_OVERRIDE_11_6_MASK |
1210+ CRI_TXDEEMPH_OVERRIDE_5_0_MASK,
1211+ CRI_TXDEEMPH_OVERRIDE_11_6(trans->entries[level].mg.cri_txdeemph_override_11_6) |
1212+ CRI_TXDEEMPH_OVERRIDE_5_0(trans->entries[level].mg.cri_txdeemph_override_5_0) |
1213+ CRI_TXDEEMPH_OVERRIDE_EN);
12161214
12171215 /* FIXME: Program CRI_LOADGEN_SEL after the spec is updated */
12181216 }
@@ -1223,50 +1221,34 @@ static void icl_mg_phy_set_signal_levels(struct intel_encoder *encoder, · 4 unmodified lines
12231221 * values from table for which TX1 and TX2 enabled.
12241222 */
12251223 for (ln = 0; ln < 2; ln++) {
1226− val = intel_de_read(dev_priv, MG_CLKHUB(ln, tc_port));
1227− if (crtc_state->port_clock < 300000)
1228− val |= CFG_LOW_RATE_LKREN_EN;
1229− else
1230− val &= ~CFG_LOW_RATE_LKREN_EN;
1231− intel_de_write(dev_priv, MG_CLKHUB(ln, tc_port), val);
1224+ intel_de_rmw(dev_priv, MG_CLKHUB(ln, tc_port),
1225+ CFG_LOW_RATE_LKREN_EN,
1226+ crtc_state->port_clock < 300000 ? CFG_LOW_RATE_LKREN_EN : 0);
12321227 }
12331228
12341229 /* Program the MG_TX_DCC<LN, port being used> based on the link frequency */
12351230 for (ln = 0; ln < 2; ln++) {
1236− val = intel_de_read(dev_priv, MG_TX1_DCC(ln, tc_port));
1237− val &= ~CFG_AMI_CK_DIV_OVERRIDE_VAL_MASK;
1238− if (crtc_state->port_clock <= 500000) {
1239− val &= ~CFG_AMI_CK_DIV_OVERRIDE_EN;
1240− } else {
1241− val |= CFG_AMI_CK_DIV_OVERRIDE_EN |
1242− CFG_AMI_CK_DIV_OVERRIDE_VAL(1);
1243− }
1244− intel_de_write(dev_priv, MG_TX1_DCC(ln, tc_port), val);
1245−
1246− val = intel_de_read(dev_priv, MG_TX2_DCC(ln, tc_port));
1247− val &= ~CFG_AMI_CK_DIV_OVERRIDE_VAL_MASK;
1248− if (crtc_state->port_clock <= 500000) {
1249− val &= ~CFG_AMI_CK_DIV_OVERRIDE_EN;
1250− } else {
1251− val |= CFG_AMI_CK_DIV_OVERRIDE_EN |
1252− CFG_AMI_CK_DIV_OVERRIDE_VAL(1);
1253− }
1254− intel_de_write(dev_priv, MG_TX2_DCC(ln, tc_port), val);
1231+ intel_de_rmw(dev_priv, MG_TX1_DCC(ln, tc_port),
1232+ CFG_AMI_CK_DIV_OVERRIDE_VAL_MASK |
1233+ CFG_AMI_CK_DIV_OVERRIDE_EN,
1234+ crtc_state->port_clock > 500000 ?
1235+ CFG_AMI_CK_DIV_OVERRIDE_VAL(1) |
1236+ CFG_AMI_CK_DIV_OVERRIDE_EN : 0);
1237+
1238+ intel_de_rmw(dev_priv, MG_TX2_DCC(ln, tc_port),
1239+ CFG_AMI_CK_DIV_OVERRIDE_VAL_MASK |
1240+ CFG_AMI_CK_DIV_OVERRIDE_EN,
1241+ crtc_state->port_clock > 500000 ?
1242+ CFG_AMI_CK_DIV_OVERRIDE_VAL(1) |
1243+ CFG_AMI_CK_DIV_OVERRIDE_EN : 0);
12551244 }
12561245
12571246 /* Program MG_TX_PISO_READLOAD with values from vswing table */
12581247 for (ln = 0; ln < 2; ln++) {
1259− val = intel_de_read(dev_priv,
1260− MG_TX1_PISO_READLOAD(ln, tc_port));
1261− val |= CRI_CALCINIT;
1262− intel_de_write(dev_priv, MG_TX1_PISO_READLOAD(ln, tc_port),
1263− val);
1264−
1265− val = intel_de_read(dev_priv,
1266− MG_TX2_PISO_READLOAD(ln, tc_port));
1267− val |= CRI_CALCINIT;
1268− intel_de_write(dev_priv, MG_TX2_PISO_READLOAD(ln, tc_port),
1269− val);
1248+ intel_de_rmw(dev_priv, MG_TX1_PISO_READLOAD(ln, tc_port),
1249+ 0, CRI_CALCINIT);
1250+ intel_de_rmw(dev_priv, MG_TX2_PISO_READLOAD(ln, tc_port),
1251+ 0, CRI_CALCINIT);
12701252 }
12711253 }
12721254
@@ -1275,9 +1257,7 @@ static void tgl_dkl_phy_set_signal_levels(struct intel_encoder *encoder, · 2 unmodified lines
12751257 {
12761258 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
12771259 enum tc_port tc_port = intel_port_to_tc(dev_priv, encoder->port);
1278− int level = intel_ddi_level(encoder, crtc_state, 0);
12791260 const struct intel_ddi_buf_trans *trans;
1280− u32 val, dpcnt_mask, dpcnt_val;
12811261 int n_entries, ln;
12821262
12831263 if (intel_tc_port_in_tbt_alt_mode(enc_to_dig_port(encoder)))
@@ -1287,33 +1267,36 @@ static void tgl_dkl_phy_set_signal_levels(struct intel_encoder *encoder, · 3 unmodified lines
12871267 if (drm_WARN_ON_ONCE(&dev_priv->drm, !trans))
12881268 return;
12891269
1290− dpcnt_mask = (DKL_TX_PRESHOOT_COEFF_MASK |
1291− DKL_TX_DE_EMPAHSIS_COEFF_MASK |
1292− DKL_TX_VSWING_CONTROL_MASK);
1293− dpcnt_val = DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing);
1294− dpcnt_val |= DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis);
1295− dpcnt_val |= DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot);
1296−
12971270 for (ln = 0; ln < 2; ln++) {
1271+ int level;
1272+
12981273 intel_de_write(dev_priv, HIP_INDEX_REG(tc_port),
12991274 HIP_INDEX_VAL(tc_port, ln));
13001275
13011276 intel_de_write(dev_priv, DKL_TX_PMD_LANE_SUS(tc_port), 0);
13021277
1303− /* All the registers are RMW */
1304− val = intel_de_read(dev_priv, DKL_TX_DPCNTL0(tc_port));
1305− val &= ~dpcnt_mask;
1306− val |= dpcnt_val;
1307− intel_de_write(dev_priv, DKL_TX_DPCNTL0(tc_port), val);
1278+ level = intel_ddi_level(encoder, crtc_state, 2*ln+0);
1279+
1280+ intel_de_rmw(dev_priv, DKL_TX_DPCNTL0(tc_port),
1281+ DKL_TX_PRESHOOT_COEFF_MASK |
1282+ DKL_TX_DE_EMPAHSIS_COEFF_MASK |
1283+ DKL_TX_VSWING_CONTROL_MASK,
1284+ DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) |
1285+ DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) |
1286+ DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing));
1287+
1288+ level = intel_ddi_level(encoder, crtc_state, 2*ln+1);
13081289
1309− val = intel_de_read(dev_priv, DKL_TX_DPCNTL1(tc_port));
1310− val &= ~dpcnt_mask;
1311− val |= dpcnt_val;
1312− intel_de_write(dev_priv, DKL_TX_DPCNTL1(tc_port), val);
1290+ intel_de_rmw(dev_priv, DKL_TX_DPCNTL1(tc_port),
1291+ DKL_TX_PRESHOOT_COEFF_MASK |
1292+ DKL_TX_DE_EMPAHSIS_COEFF_MASK |
1293+ DKL_TX_VSWING_CONTROL_MASK,
1294+ DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) |
1295+ DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) |
1296+ DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing));
13131297
1314− val = intel_de_read(dev_priv, DKL_TX_DPCNTL2(tc_port));
1315− val &= ~DKL_TX_DP20BITMODE;
1316− intel_de_write(dev_priv, DKL_TX_DPCNTL2(tc_port), val);
1298+ intel_de_rmw(dev_priv, DKL_TX_DPCNTL2(tc_port),
1299+ DKL_TX_DP20BITMODE, 0);
13171300 }
13181301 }
13191302
@@ -1938,7 +1921,7 @@ void intel_ddi_enable_clock(struct intel_encoder *encoder, · 618 unmodified lines
19381921 encoder->enable_clock(encoder, crtc_state);
19391922 }
19401923
1941−static void intel_ddi_disable_clock(struct intel_encoder *encoder)
1924+void intel_ddi_disable_clock(struct intel_encoder *encoder)
19421925 {
19431926 if (encoder->disable_clock)
19441927 encoder->disable_clock(encoder);
@@ -2385,7 +2368,10 @@ static void dg2_ddi_pre_enable_dp(struct intel_atomic_state *state, · 440 unmodified lines
23852368
23862369 /* 5.k Configure and enable FEC if needed */
23872370 intel_ddi_enable_fec(encoder, crtc_state);
2388− intel_dsc_enable(encoder, crtc_state);
2371+
2372+ intel_dsc_dp_pps_write(encoder, crtc_state);
2373+
2374+ intel_dsc_enable(crtc_state);
23892375 }
23902376
23912377 static void tgl_ddi_pre_enable_dp(struct intel_atomic_state *state,
@@ -2519,8 +2505,11 @@ static void tgl_ddi_pre_enable_dp(struct intel_atomic_state *state, · 127 unmodified lines
25192505
25202506 /* 7.l Configure and enable FEC if needed */
25212507 intel_ddi_enable_fec(encoder, crtc_state);
2508+
2509+ intel_dsc_dp_pps_write(encoder, crtc_state);
2510+
25222511 if (!crtc_state->bigjoiner)
2523− intel_dsc_enable(encoder, crtc_state);
2512+ intel_dsc_enable(crtc_state);
25242513 }
25252514
25262515 static void hsw_ddi_pre_enable_dp(struct intel_atomic_state *state,
@@ -2585,8 +2574,10 @@ static void hsw_ddi_pre_enable_dp(struct intel_atomic_state *state, · 58 unmodified lines
25852574 if (!is_mst)
25862575 intel_ddi_enable_pipe_clock(encoder, crtc_state);
25872576
2577+ intel_dsc_dp_pps_write(encoder, crtc_state);
2578+
25882579 if (!crtc_state->bigjoiner)
2589− intel_dsc_enable(encoder, crtc_state);
2580+ intel_dsc_enable(crtc_state);
25902581 }
25912582
25922583 static void intel_ddi_pre_enable_dp(struct intel_atomic_state *state,
@@ -2824,12 +2815,10 @@ static void intel_ddi_post_disable(struct intel_atomic_state *state, · 231 unmodified lines
28242815 }
28252816
28262817 if (old_crtc_state->bigjoiner_linked_crtc) {
2827− struct intel_atomic_state *state =
2828− to_intel_atomic_state(old_crtc_state->uapi.state);
2829− struct intel_crtc *slave =
2818+ struct intel_crtc *slave_crtc =
28302819 old_crtc_state->bigjoiner_linked_crtc;
28312820 const struct intel_crtc_state *old_slave_crtc_state =
2832− intel_atomic_get_old_crtc_state(state, slave);
2821+ intel_atomic_get_old_crtc_state(state, slave_crtc);
28332822
28342823 intel_crtc_vblank_off(old_slave_crtc_state);
28352824
@@ -2866,41 +2855,6 @@ static void intel_ddi_post_disable(struct intel_atomic_state *state, · 30 unmodified lines
28662855 intel_tc_port_put_link(dig_port);
28672856 }
28682857
2869−void intel_ddi_fdi_post_disable(struct intel_atomic_state *state,
2870− struct intel_encoder *encoder,
2871− const struct intel_crtc_state *old_crtc_state,
2872− const struct drm_connector_state *old_conn_state)
2873−{
2874− struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
2875− u32 val;
2876−
2877− /*
2878− * Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
2879− * and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
2880− * step 13 is the correct place for it. Step 18 is where it was
2881− * originally before the BUN.
2882− */
2883− val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
2884− val &= ~FDI_RX_ENABLE;
2885− intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
2886−
2887− intel_disable_ddi_buf(encoder, old_crtc_state);
2888− intel_ddi_disable_clock(encoder);
2889−
2890− val = intel_de_read(dev_priv, FDI_RX_MISC(PIPE_A));
2891− val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
2892− val |= FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2);
2893− intel_de_write(dev_priv, FDI_RX_MISC(PIPE_A), val);
2894−
2895− val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
2896− val &= ~FDI_PCDCLK;
2897− intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
2898−
2899− val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
2900− val &= ~FDI_RX_PLL_ENABLE;
2901− intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
2902−}
2903−
29042858 static void trans_port_sync_stop_link_train(struct intel_atomic_state *state,
29052859 struct intel_encoder *encoder,
29062860 const struct intel_crtc_state *crtc_state)
@@ -3095,6 +3049,12 @@ static void intel_disable_ddi_dp(struct intel_atomic_state *state, · 188 unmodified lines
30953049
30963050 intel_dp->link_trained = false;
30973051
3052+ if (old_crtc_state->has_audio)
3053+ intel_audio_codec_disable(encoder,
3054+ old_crtc_state, old_conn_state);
3055+
3056+ intel_drrs_disable(intel_dp, old_crtc_state);
3057+ intel_psr_disable(intel_dp, old_crtc_state);
30983058 intel_edp_backlight_off(old_conn_state);
30993059 /* Disable the decompression in DP Sink */
31003060 intel_dp_sink_set_decompression_state(intel_dp, old_crtc_state,
@@ -3112,6 +3072,10 @@ static void intel_disable_ddi_hdmi(struct intel_atomic_state *state, · 11 unmodified lines
31123072 struct drm_i915_private *i915 = to_i915(encoder->base.dev);
31133073 struct drm_connector *connector = old_conn_state->connector;
31143074
3075+ if (old_crtc_state->has_audio)
3076+ intel_audio_codec_disable(encoder,
3077+ old_crtc_state, old_conn_state);
3078+
31153079 if (!intel_hdmi_handle_sink_scrambling(encoder, connector,
31163080 false, false))
31173081 drm_dbg_kms(&i915->drm,
@@ -3119,25 +3083,6 @@ static void intel_disable_ddi_hdmi(struct intel_atomic_state *state, · 1 unmodified line
31193083 connector->base.id, connector->name);
31203084 }
31213085
3122−static void intel_pre_disable_ddi(struct intel_atomic_state *state,
3123− struct intel_encoder *encoder,
3124− const struct intel_crtc_state *old_crtc_state,
3125− const struct drm_connector_state *old_conn_state)
3126−{
3127− struct intel_dp *intel_dp;
3128−
3129− if (old_crtc_state->has_audio)
3130− intel_audio_codec_disable(encoder, old_crtc_state,
3131− old_conn_state);
3132−
3133− if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
3134− return;
3135−
3136− intel_dp = enc_to_intel_dp(encoder);
3137− intel_drrs_disable(intel_dp, old_crtc_state);
3138− intel_psr_disable(intel_dp, old_crtc_state);
3139−}
3140−
31413086 static void intel_disable_ddi(struct intel_atomic_state *state,
31423087 struct intel_encoder *encoder,
31433088 const struct intel_crtc_state *old_crtc_state,
@@ -3195,8 +3140,14 @@ intel_ddi_update_prepare(struct intel_atomic_state *state, · 51 unmodified lines
31953140
31963141 intel_tc_port_get_link(enc_to_dig_port(encoder),
31973142 required_lanes);
3198− if (crtc_state && crtc_state->hw.active)
3143+ if (crtc_state && crtc_state->hw.active) {
3144+ struct intel_crtc *slave_crtc = crtc_state->bigjoiner_linked_crtc;
3145+
31993146 intel_update_active_dpll(state, crtc, encoder);
3147+
3148+ if (slave_crtc)
3149+ intel_update_active_dpll(state, slave_crtc, encoder);
3150+ }
32003151 }
32013152
32023153 static void
@@ -3552,18 +3503,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, · 349 unmodified lines
35523503 if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)))
35533504 return;
35543505
3555− if (pipe_config->bigjoiner_slave) {
3556− /* read out pipe settings from master */
3557− enum transcoder save = pipe_config->cpu_transcoder;
3558−
3559− /* Our own transcoder needs to be disabled when reading it in intel_ddi_read_func_ctl() */
3560− WARN_ON(pipe_config->output_types);
3561− pipe_config->cpu_transcoder = (enum transcoder)pipe_config->bigjoiner_linked_crtc->pipe;
3562− intel_ddi_read_func_ctl(encoder, pipe_config);
3563− pipe_config->cpu_transcoder = save;
3564− } else {
3565− intel_ddi_read_func_ctl(encoder, pipe_config);
3566− }
3506+ intel_ddi_read_func_ctl(encoder, pipe_config);
35673507
35683508 intel_ddi_mso_get_config(encoder, pipe_config);
35693509
@@ -3591,8 +3531,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, · 21 unmodified lines
35913531 dev_priv->vbt.edp.bpp = pipe_config->pipe_bpp;
35923532 }
35933533
3594− if (!pipe_config->bigjoiner_slave)
3595− ddi_dotclock_get(pipe_config);
3534+ ddi_dotclock_get(pipe_config);
35963535
35973536 if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
35983537 pipe_config->lane_lat_optim_mask =
@@ -4472,7 +4411,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) · 873 unmodified lines
44724411 encoder->enable = intel_enable_ddi;
44734412 encoder->pre_pll_enable = intel_ddi_pre_pll_enable;
44744413 encoder->pre_enable = intel_ddi_pre_enable;
4475− encoder->pre_disable = intel_pre_disable_ddi;
44764414 encoder->disable = intel_disable_ddi;
44774415 encoder->post_disable = intel_ddi_post_disable;
44784416 encoder->update_pipe = intel_ddi_update_pipe;
drivers/gpu/drm/i915/display/intel_ddi.h+4−1
@@ -6,11 +6,11 @@ · 5 unmodified lines
66 #ifndef __INTEL_DDI_H__
77 #define __INTEL_DDI_H__
88
9−#include "intel_display.h"
109 #include "i915_reg.h"
1110
1211 struct drm_connector_state;
1312 struct drm_i915_private;
13+struct intel_atomic_state;
1414 struct intel_connector;
1515 struct intel_crtc;
1616 struct intel_crtc_state;
@@ -18,6 +18,8 @@ struct intel_dp; · 1 unmodified line
1818 struct intel_dpll_hw_state;
1919 struct intel_encoder;
2020 struct intel_shared_dpll;
21+enum pipe;
22+enum port;
2123 enum transcoder;
2224
2325 i915_reg_t dp_tp_ctl_reg(struct intel_encoder *encoder,
@@ -30,6 +32,7 @@ void intel_ddi_fdi_post_disable(struct intel_atomic_state *state, · 6 unmodified lines
3032 const struct drm_connector_state *old_conn_state);
3133 void intel_ddi_enable_clock(struct intel_encoder *encoder,
3234 const struct intel_crtc_state *crtc_state);
35+void intel_ddi_disable_clock(struct intel_encoder *encoder);
3336 void intel_ddi_get_clock(struct intel_encoder *encoder,
3437 struct intel_crtc_state *crtc_state,
3538 struct intel_shared_dpll *pll);
drivers/gpu/drm/i915/display/intel_display.c+366−1554
@@ -70,11 +70,10 @@ · 69 unmodified lines
7070
7171 #include "gt/gen8_ppgtt.h"
7272
73−#include "pxp/intel_pxp.h"
74−
7573 #include "g4x_dp.h"
7674 #include "g4x_hdmi.h"
7775 #include "i915_drv.h"
76+#include "icl_dsi.h"
7877 #include "intel_acpi.h"
7978 #include "intel_atomic.h"
8079 #include "intel_atomic_plane.h"
@@ -96,6 +95,8 @@ · 15 unmodified lines
9695 #include "intel_hotplug.h"
9796 #include "intel_overlay.h"
9897 #include "intel_panel.h"
98+#include "intel_pch_display.h"
99+#include "intel_pch_refclk.h"
99100 #include "intel_pcode.h"
100101 #include "intel_pipe_crc.h"
101102 #include "intel_plane_initial.h"
@@ -103,19 +104,15 @@ · 1 unmodified line
103104 #include "intel_pps.h"
104105 #include "intel_psr.h"
105106 #include "intel_quirks.h"
106−#include "intel_sbi.h"
107107 #include "intel_sprite.h"
108108 #include "intel_tc.h"
109109 #include "intel_vga.h"
110110 #include "i9xx_plane.h"
111111 #include "skl_scaler.h"
112112 #include "skl_universal_plane.h"
113+#include "vlv_dsi_pll.h"
113114 #include "vlv_sideband.h"
114−
115−static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
116− struct intel_crtc_state *pipe_config);
117−static void ilk_pch_clock_get(struct intel_crtc *crtc,
118− struct intel_crtc_state *pipe_config);
115+#include "vlv_dsi.h"
119116
120117 static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_state);
121118 static void intel_set_pipe_src_size(const struct intel_crtc_state *crtc_state);
@@ -341,6 +338,14 @@ is_trans_port_sync_mode(const struct intel_crtc_state *crtc_state) · 219 unmodified lines
341338 is_trans_port_sync_slave(crtc_state);
342339 }
343340
341+static struct intel_crtc *intel_master_crtc(const struct intel_crtc_state *crtc_state)
342+{
343+ if (crtc_state->bigjoiner_slave)
344+ return crtc_state->bigjoiner_linked_crtc;
345+ else
346+ return to_intel_crtc(crtc_state->uapi.crtc);
347+}
348+
344349 static bool pipe_scanline_is_moving(struct drm_i915_private *dev_priv,
345350 enum pipe pipe)
346351 {
@@ -454,80 +459,6 @@ static void assert_planes_disabled(struct intel_crtc *crtc) · 107 unmodified lines
454459 assert_plane_disabled(plane);
455460 }
456461
457−void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
458− enum pipe pipe)
459−{
460− u32 val;
461− bool enabled;
462−
463− val = intel_de_read(dev_priv, PCH_TRANSCONF(pipe));
464− enabled = !!(val & TRANS_ENABLE);
465− I915_STATE_WARN(enabled,
466− "transcoder assertion failed, should be off on pipe %c but is still active\n",
467− pipe_name(pipe));
468−}
469−
470−static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
471− enum pipe pipe, enum port port,
472− i915_reg_t dp_reg)
473−{
474− enum pipe port_pipe;
475− bool state;
476−
477− state = g4x_dp_port_enabled(dev_priv, dp_reg, port, &port_pipe);
478−
479− I915_STATE_WARN(state && port_pipe == pipe,
480− "PCH DP %c enabled on transcoder %c, should be disabled\n",
481− port_name(port), pipe_name(pipe));
482−
483− I915_STATE_WARN(HAS_PCH_IBX(dev_priv) && !state && port_pipe == PIPE_B,
484− "IBX PCH DP %c still using transcoder B\n",
485− port_name(port));
486−}
487−
488−static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
489− enum pipe pipe, enum port port,
490− i915_reg_t hdmi_reg)
491−{
492− enum pipe port_pipe;
493− bool state;
494−
495− state = intel_sdvo_port_enabled(dev_priv, hdmi_reg, &port_pipe);
496−
497− I915_STATE_WARN(state && port_pipe == pipe,
498− "PCH HDMI %c enabled on transcoder %c, should be disabled\n",
499− port_name(port), pipe_name(pipe));
500−
501− I915_STATE_WARN(HAS_PCH_IBX(dev_priv) && !state && port_pipe == PIPE_B,
502− "IBX PCH HDMI %c still using transcoder B\n",
503− port_name(port));
504−}
505−
506−static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv,
507− enum pipe pipe)
508−{
509− enum pipe port_pipe;
510−
511− assert_pch_dp_disabled(dev_priv, pipe, PORT_B, PCH_DP_B);
512− assert_pch_dp_disabled(dev_priv, pipe, PORT_C, PCH_DP_C);
513− assert_pch_dp_disabled(dev_priv, pipe, PORT_D, PCH_DP_D);
514−
515− I915_STATE_WARN(intel_crt_port_enabled(dev_priv, PCH_ADPA, &port_pipe) &&
516− port_pipe == pipe,
517− "PCH VGA enabled on transcoder %c, should be disabled\n",
518− pipe_name(pipe));
519−
520− I915_STATE_WARN(intel_lvds_port_enabled(dev_priv, PCH_LVDS, &port_pipe) &&
521− port_pipe == pipe,
522− "PCH LVDS enabled on transcoder %c, should be disabled\n",
523− pipe_name(pipe));
524−
525− /* PCH SDVOB multiplex with HDMIB */
526− assert_pch_hdmi_disabled(dev_priv, pipe, PORT_B, PCH_HDMIB);
527− assert_pch_hdmi_disabled(dev_priv, pipe, PORT_C, PCH_HDMIC);
528− assert_pch_hdmi_disabled(dev_priv, pipe, PORT_D, PCH_HDMID);
529−}
530−
531462 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
532463 struct intel_digital_port *dig_port,
533464 unsigned int expected_mask)
@@ -562,154 +493,6 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, · 28 unmodified lines
562493 expected_mask);
563494 }
564495
565−static void ilk_enable_pch_transcoder(const struct intel_crtc_state *crtc_state)
566−{
567− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
568− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
569− enum pipe pipe = crtc->pipe;
570− i915_reg_t reg;
571− u32 val, pipeconf_val;
572−
573− /* Make sure PCH DPLL is enabled */
574− assert_shared_dpll_enabled(dev_priv, crtc_state->shared_dpll);
575−
576− /* FDI must be feeding us bits for PCH ports */
577− assert_fdi_tx_enabled(dev_priv, pipe);
578− assert_fdi_rx_enabled(dev_priv, pipe);
579−
580− if (HAS_PCH_CPT(dev_priv)) {
581− reg = TRANS_CHICKEN2(pipe);
582− val = intel_de_read(dev_priv, reg);
583− /*
584− * Workaround: Set the timing override bit
585− * before enabling the pch transcoder.
586− */
587− val |= TRANS_CHICKEN2_TIMING_OVERRIDE;
588− /* Configure frame start delay to match the CPU */
589− val &= ~TRANS_CHICKEN2_FRAME_START_DELAY_MASK;
590− val |= TRANS_CHICKEN2_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
591− intel_de_write(dev_priv, reg, val);
592− }
593−
594− reg = PCH_TRANSCONF(pipe);
595− val = intel_de_read(dev_priv, reg);
596− pipeconf_val = intel_de_read(dev_priv, PIPECONF(pipe));
597−
598− if (HAS_PCH_IBX(dev_priv)) {
599− /* Configure frame start delay to match the CPU */
600− val &= ~TRANS_FRAME_START_DELAY_MASK;
601− val |= TRANS_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
602−
603− /*
604− * Make the BPC in transcoder be consistent with
605− * that in pipeconf reg. For HDMI we must use 8bpc
606− * here for both 8bpc and 12bpc.
607− */
608− val &= ~PIPECONF_BPC_MASK;
609− if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
610− val |= PIPECONF_8BPC;
611− else
612− val |= pipeconf_val & PIPECONF_BPC_MASK;
613− }
614−
615− val &= ~TRANS_INTERLACE_MASK;
616− if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK) {
617− if (HAS_PCH_IBX(dev_priv) &&
618− intel_crtc_has_type(crtc_state, INTEL_OUTPUT_SDVO))
619− val |= TRANS_LEGACY_INTERLACED_ILK;
620− else
621− val |= TRANS_INTERLACED;
622− } else {
623− val |= TRANS_PROGRESSIVE;
624− }
625−
626− intel_de_write(dev_priv, reg, val | TRANS_ENABLE);
627− if (intel_de_wait_for_set(dev_priv, reg, TRANS_STATE_ENABLE, 100))
628− drm_err(&dev_priv->drm, "failed to enable transcoder %c\n",
629− pipe_name(pipe));
630−}
631−
632−static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,
633− enum transcoder cpu_transcoder)
634−{
635− u32 val, pipeconf_val;
636−
637− /* FDI must be feeding us bits for PCH ports */
638− assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder);
639− assert_fdi_rx_enabled(dev_priv, PIPE_A);
640−
641− val = intel_de_read(dev_priv, TRANS_CHICKEN2(PIPE_A));
642− /* Workaround: set timing override bit. */
643− val |= TRANS_CHICKEN2_TIMING_OVERRIDE;
644− /* Configure frame start delay to match the CPU */
645− val &= ~TRANS_CHICKEN2_FRAME_START_DELAY_MASK;
646− val |= TRANS_CHICKEN2_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
647− intel_de_write(dev_priv, TRANS_CHICKEN2(PIPE_A), val);
648−
649− val = TRANS_ENABLE;
650− pipeconf_val = intel_de_read(dev_priv, PIPECONF(cpu_transcoder));
651−
652− if ((pipeconf_val & PIPECONF_INTERLACE_MASK_HSW) ==
653− PIPECONF_INTERLACED_ILK)
654− val |= TRANS_INTERLACED;
655− else
656− val |= TRANS_PROGRESSIVE;
657−
658− intel_de_write(dev_priv, LPT_TRANSCONF, val);
659− if (intel_de_wait_for_set(dev_priv, LPT_TRANSCONF,
660− TRANS_STATE_ENABLE, 100))
661− drm_err(&dev_priv->drm, "Failed to enable PCH transcoder\n");
662−}
663−
664−static void ilk_disable_pch_transcoder(struct drm_i915_private *dev_priv,
665− enum pipe pipe)
666−{
667− i915_reg_t reg;
668− u32 val;
669−
670− /* FDI relies on the transcoder */
671− assert_fdi_tx_disabled(dev_priv, pipe);
672− assert_fdi_rx_disabled(dev_priv, pipe);
673−
674− /* Ports must be off as well */
675− assert_pch_ports_disabled(dev_priv, pipe);
676−
677− reg = PCH_TRANSCONF(pipe);
678− val = intel_de_read(dev_priv, reg);
679− val &= ~TRANS_ENABLE;
680− intel_de_write(dev_priv, reg, val);
681− /* wait for PCH transcoder off, transcoder state */
682− if (intel_de_wait_for_clear(dev_priv, reg, TRANS_STATE_ENABLE, 50))
683− drm_err(&dev_priv->drm, "failed to disable transcoder %c\n",
684− pipe_name(pipe));
685−
686− if (HAS_PCH_CPT(dev_priv)) {
687− /* Workaround: Clear the timing override chicken bit again. */
688− reg = TRANS_CHICKEN2(pipe);
689− val = intel_de_read(dev_priv, reg);
690− val &= ~TRANS_CHICKEN2_TIMING_OVERRIDE;
691− intel_de_write(dev_priv, reg, val);
692− }
693−}
694−
695−void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv)
696−{
697− u32 val;
698−
699− val = intel_de_read(dev_priv, LPT_TRANSCONF);
700− val &= ~TRANS_ENABLE;
701− intel_de_write(dev_priv, LPT_TRANSCONF, val);
702− /* wait for PCH transcoder off, transcoder state */
703− if (intel_de_wait_for_clear(dev_priv, LPT_TRANSCONF,
704− TRANS_STATE_ENABLE, 50))
705− drm_err(&dev_priv->drm, "Failed to disable PCH transcoder\n");
706−
707− /* Workaround: clear timing override bit. */
708− val = intel_de_read(dev_priv, TRANS_CHICKEN2(PIPE_A));
709− val &= ~TRANS_CHICKEN2_TIMING_OVERRIDE;
710− intel_de_write(dev_priv, TRANS_CHICKEN2(PIPE_A), val);
711−}
712−
713496 enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc)
714497 {
715498 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -823,14 +606,6 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state) · 107 unmodified lines
823606 intel_wait_for_pipe_off(old_crtc_state);
824607 }
825608
826−bool
827−intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
828− u64 modifier)
829−{
830− return info->is_yuv &&
831− info->num_planes == (is_ccs_modifier(modifier) ? 4 : 2);
832−}
833−
834609 unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info)
835610 {
836611 unsigned int size = 0;
@@ -850,7 +625,11 @@ unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info · 13 unmodified lines
850625 for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) {
851626 unsigned int plane_size;
852627
853− plane_size = rem_info->plane[i].dst_stride * rem_info->plane[i].height;
628+ if (rem_info->plane[i].linear)
629+ plane_size = rem_info->plane[i].size;
630+ else
631+ plane_size = rem_info->plane[i].dst_stride * rem_info->plane[i].height;
632+
854633 if (plane_size == 0)
855634 continue;
856635
@@ -869,7 +648,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state) · 12 unmodified lines
869648 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
870649
871650 return DISPLAY_VER(dev_priv) < 4 ||
872− (plane->has_fbc &&
651+ (plane->fbc &&
873652 plane_state->view.gtt.type == I915_GGTT_VIEW_NORMAL);
874653 }
875654
@@ -885,7 +664,7 @@ u32 intel_fb_xy_to_linear(int x, int y, · 9 unmodified lines
885664 {
886665 const struct drm_framebuffer *fb = state->hw.fb;
887666 unsigned int cpp = fb->format->cpp[color_plane];
888− unsigned int pitch = state->view.color_plane[color_plane].stride;
667+ unsigned int pitch = state->view.color_plane[color_plane].mapping_stride;
889668
890669 return y * pitch + x * cpp;
891670 }
@@ -904,136 +683,6 @@ void intel_add_fb_offsets(int *x, int *y, · 12 unmodified lines
904683 *y += state->view.color_plane[color_plane].y;
905684 }
906685
907−/*
908− * From the Sky Lake PRM:
909− * "The Color Control Surface (CCS) contains the compression status of
910− * the cache-line pairs. The compression state of the cache-line pair
911− * is specified by 2 bits in the CCS. Each CCS cache-line represents
912− * an area on the main surface of 16 x16 sets of 128 byte Y-tiled
913− * cache-line-pairs. CCS is always Y tiled."
914− *
915− * Since cache line pairs refers to horizontally adjacent cache lines,
916− * each cache line in the CCS corresponds to an area of 32x16 cache
917− * lines on the main surface. Since each pixel is 4 bytes, this gives
918− * us a ratio of one byte in the CCS for each 8x16 pixels in the
919− * main surface.
920− */
921−static const struct drm_format_info skl_ccs_formats[] = {
922− { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 2,
923− .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, },
924− { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 2,
925− .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, },
926− { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 2,
927− .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, .has_alpha = true, },
928− { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2,
929− .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, .has_alpha = true, },
930−};
931−
932−/*
933− * Gen-12 compression uses 4 bits of CCS data for each cache line pair in the
934− * main surface. And each 64B CCS cache line represents an area of 4x1 Y-tiles
935− * in the main surface. With 4 byte pixels and each Y-tile having dimensions of
936− * 32x32 pixels, the ratio turns out to 1B in the CCS for every 2x32 pixels in
937− * the main surface.
938− */
939−static const struct drm_format_info gen12_ccs_formats[] = {
940− { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 2,
941− .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
942− .hsub = 1, .vsub = 1, },
943− { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 2,
944− .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
945− .hsub = 1, .vsub = 1, },
946− { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 2,
947− .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
948− .hsub = 1, .vsub = 1, .has_alpha = true },
949− { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2,
950− .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
951− .hsub = 1, .vsub = 1, .has_alpha = true },
952− { .format = DRM_FORMAT_YUYV, .num_planes = 2,
953− .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
954− .hsub = 2, .vsub = 1, .is_yuv = true },
955− { .format = DRM_FORMAT_YVYU, .num_planes = 2,
956− .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
957− .hsub = 2, .vsub = 1, .is_yuv = true },
958− { .format = DRM_FORMAT_UYVY, .num_planes = 2,
959− .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
960− .hsub = 2, .vsub = 1, .is_yuv = true },
961− { .format = DRM_FORMAT_VYUY, .num_planes = 2,
962− .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
963− .hsub = 2, .vsub = 1, .is_yuv = true },
964− { .format = DRM_FORMAT_XYUV8888, .num_planes = 2,
965− .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
966− .hsub = 1, .vsub = 1, .is_yuv = true },
967− { .format = DRM_FORMAT_NV12, .num_planes = 4,
968− .char_per_block = { 1, 2, 1, 1 }, .block_w = { 1, 1, 4, 4 }, .block_h = { 1, 1, 1, 1 },
969− .hsub = 2, .vsub = 2, .is_yuv = true },
970− { .format = DRM_FORMAT_P010, .num_planes = 4,
971− .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
972− .hsub = 2, .vsub = 2, .is_yuv = true },
973− { .format = DRM_FORMAT_P012, .num_planes = 4,
974− .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
975− .hsub = 2, .vsub = 2, .is_yuv = true },
976− { .format = DRM_FORMAT_P016, .num_planes = 4,
977− .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
978− .hsub = 2, .vsub = 2, .is_yuv = true },
979−};
980−
981−/*
982− * Same as gen12_ccs_formats[] above, but with additional surface used
983− * to pass Clear Color information in plane 2 with 64 bits of data.
984− */
985−static const struct drm_format_info gen12_ccs_cc_formats[] = {
986− { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 3,
987− .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
988− .hsub = 1, .vsub = 1, },
989− { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 3,
990− .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
991− .hsub = 1, .vsub = 1, },
992− { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 3,
993− .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
994− .hsub = 1, .vsub = 1, .has_alpha = true },
995− { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 3,
996− .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
997− .hsub = 1, .vsub = 1, .has_alpha = true },
998−};
999−
1000−static const struct drm_format_info *
1001−lookup_format_info(const struct drm_format_info formats[],
1002− int num_formats, u32 format)
1003−{
1004− int i;
1005−
1006− for (i = 0; i < num_formats; i++) {
1007− if (formats[i].format == format)
1008− return &formats[i];
1009− }
1010−
1011− return NULL;
1012−}
1013−
1014−static const struct drm_format_info *
1015−intel_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
1016−{
1017− switch (cmd->modifier[0]) {
1018− case I915_FORMAT_MOD_Y_TILED_CCS:
1019− case I915_FORMAT_MOD_Yf_TILED_CCS:
1020− return lookup_format_info(skl_ccs_formats,
1021− ARRAY_SIZE(skl_ccs_formats),
1022− cmd->pixel_format);
1023− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
1024− case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
1025− return lookup_format_info(gen12_ccs_formats,
1026− ARRAY_SIZE(gen12_ccs_formats),
1027− cmd->pixel_format);
1028− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
1029− return lookup_format_info(gen12_ccs_cc_formats,
1030− ARRAY_SIZE(gen12_ccs_cc_formats),
1031− cmd->pixel_format);
1032− default:
1033− return NULL;
1034− }
1035−}
1036−
1037686 u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
1038687 u32 pixel_format, u64 modifier)
1039688 {
@@ -1135,7 +784,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc, · 95 unmodified lines
1135784 if (DISPLAY_VER(dev_priv) == 2 && !crtc_state->active_planes)
1136785 intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false);
1137786
1138− intel_disable_plane(plane, crtc_state);
787+ intel_plane_disable_arm(plane, crtc_state);
1139788 intel_wait_for_vblank(dev_priv, crtc->pipe);
1140789 }
1141790
@@ -1310,26 +959,6 @@ unlock: · 168 unmodified lines
1310959 clear_bit_unlock(I915_RESET_MODESET, &dev_priv->gt.reset.flags);
1311960 }
1312961
1313−static bool underrun_recovery_supported(const struct intel_crtc_state *crtc_state)
1314−{
1315− if (crtc_state->pch_pfit.enabled &&
1316− (crtc_state->pipe_src_w > drm_rect_width(&crtc_state->pch_pfit.dst) ||
1317− crtc_state->pipe_src_h > drm_rect_height(&crtc_state->pch_pfit.dst) ||
1318− crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420))
1319− return false;
1320−
1321− if (crtc_state->dsc.compression_enable)
1322− return false;
1323−
1324− if (crtc_state->has_psr2)
1325− return false;
1326−
1327− if (crtc_state->splitter.enable)
1328− return false;
1329−
1330− return true;
1331−}
1332−
1333962 static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state)
1334963 {
1335964 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1353,19 +982,14 @@ static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state) · 17 unmodified lines
1353982 */
1354983 tmp |= PIXEL_ROUNDING_TRUNC_FB_PASSTHRU;
1355984
1356− if (IS_DG2(dev_priv)) {
1357− /*
1358− * Underrun recovery must always be disabled on DG2. However
1359− * the chicken bit meaning is inverted compared to other
1360− * platforms.
1361− */
985+ /*
986+ * Underrun recovery must always be disabled on display 13+.
987+ * DG2 chicken bit meaning is inverted compared to other platforms.
988+ */
989+ if (IS_DG2(dev_priv))
1362990 tmp &= ~UNDERRUN_RECOVERY_ENABLE_DG2;
1363− } else if (DISPLAY_VER(dev_priv) >= 13) {
1364− if (underrun_recovery_supported(crtc_state))
1365− tmp &= ~UNDERRUN_RECOVERY_DISABLE_ADLP;
1366− else
1367− tmp |= UNDERRUN_RECOVERY_DISABLE_ADLP;
1368− }
991+ else if (DISPLAY_VER(dev_priv) >= 13)
992+ tmp |= UNDERRUN_RECOVERY_DISABLE_ADLP;
1369993
1370994 intel_de_write(dev_priv, PIPE_CHICKEN(pipe), tmp);
1371995 }
@@ -1395,158 +1019,6 @@ bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv) · 23 unmodified lines
13951019 return false;
13961020 }
13971021
1398−void lpt_disable_iclkip(struct drm_i915_private *dev_priv)
1399−{
1400− u32 temp;
1401−
1402− intel_de_write(dev_priv, PIXCLK_GATE, PIXCLK_GATE_GATE);
1403−
1404− mutex_lock(&dev_priv->sb_lock);
1405−
1406− temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
1407− temp |= SBI_SSCCTL_DISABLE;
1408− intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
1409−
1410− mutex_unlock(&dev_priv->sb_lock);
1411−}
1412−
1413−/* Program iCLKIP clock to the desired frequency */
1414−static void lpt_program_iclkip(const struct intel_crtc_state *crtc_state)
1415−{
1416− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1417− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1418− int clock = crtc_state->hw.adjusted_mode.crtc_clock;
1419− u32 divsel, phaseinc, auxdiv, phasedir = 0;
1420− u32 temp;
1421−
1422− lpt_disable_iclkip(dev_priv);
1423−
1424− /* The iCLK virtual clock root frequency is in MHz,
1425− * but the adjusted_mode->crtc_clock in in KHz. To get the
1426− * divisors, it is necessary to divide one by another, so we
1427− * convert the virtual clock precision to KHz here for higher
1428− * precision.
1429− */
1430− for (auxdiv = 0; auxdiv < 2; auxdiv++) {
1431− u32 iclk_virtual_root_freq = 172800 * 1000;
1432− u32 iclk_pi_range = 64;
1433− u32 desired_divisor;
1434−
1435− desired_divisor = DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
1436− clock << auxdiv);
1437− divsel = (desired_divisor / iclk_pi_range) - 2;
1438− phaseinc = desired_divisor % iclk_pi_range;
1439−
1440− /*
1441− * Near 20MHz is a corner case which is
1442− * out of range for the 7-bit divisor
1443− */
1444− if (divsel <= 0x7f)
1445− break;
1446− }
1447−
1448− /* This should not happen with any sane values */
1449− drm_WARN_ON(&dev_priv->drm, SBI_SSCDIVINTPHASE_DIVSEL(divsel) &
1450− ~SBI_SSCDIVINTPHASE_DIVSEL_MASK);
1451− drm_WARN_ON(&dev_priv->drm, SBI_SSCDIVINTPHASE_DIR(phasedir) &
1452− ~SBI_SSCDIVINTPHASE_INCVAL_MASK);
1453−
1454− drm_dbg_kms(&dev_priv->drm,
1455− "iCLKIP clock: found settings for %dKHz refresh rate: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n",
1456− clock, auxdiv, divsel, phasedir, phaseinc);
1457−
1458− mutex_lock(&dev_priv->sb_lock);
1459−
1460− /* Program SSCDIVINTPHASE6 */
1461− temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6, SBI_ICLK);
1462− temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
1463− temp |= SBI_SSCDIVINTPHASE_DIVSEL(divsel);
1464− temp &= ~SBI_SSCDIVINTPHASE_INCVAL_MASK;
1465− temp |= SBI_SSCDIVINTPHASE_INCVAL(phaseinc);
1466− temp |= SBI_SSCDIVINTPHASE_DIR(phasedir);
1467− temp |= SBI_SSCDIVINTPHASE_PROPAGATE;
1468− intel_sbi_write(dev_priv, SBI_SSCDIVINTPHASE6, temp, SBI_ICLK);
1469−
1470− /* Program SSCAUXDIV */
1471− temp = intel_sbi_read(dev_priv, SBI_SSCAUXDIV6, SBI_ICLK);
1472− temp &= ~SBI_SSCAUXDIV_FINALDIV2SEL(1);
1473− temp |= SBI_SSCAUXDIV_FINALDIV2SEL(auxdiv);
1474− intel_sbi_write(dev_priv, SBI_SSCAUXDIV6, temp, SBI_ICLK);
1475−
1476− /* Enable modulator and associated divider */
1477− temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
1478− temp &= ~SBI_SSCCTL_DISABLE;
1479− intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
1480−
1481− mutex_unlock(&dev_priv->sb_lock);
1482−
1483− /* Wait for initialization time */
1484− udelay(24);
1485−
1486− intel_de_write(dev_priv, PIXCLK_GATE, PIXCLK_GATE_UNGATE);
1487−}
1488−
1489−int lpt_get_iclkip(struct drm_i915_private *dev_priv)
1490−{
1491− u32 divsel, phaseinc, auxdiv;
1492− u32 iclk_virtual_root_freq = 172800 * 1000;
1493− u32 iclk_pi_range = 64;
1494− u32 desired_divisor;
1495− u32 temp;
1496−
1497− if ((intel_de_read(dev_priv, PIXCLK_GATE) & PIXCLK_GATE_UNGATE) == 0)
1498− return 0;
1499−
1500− mutex_lock(&dev_priv->sb_lock);
1501−
1502− temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
1503− if (temp & SBI_SSCCTL_DISABLE) {
1504− mutex_unlock(&dev_priv->sb_lock);
1505− return 0;
1506− }
1507−
1508− temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6, SBI_ICLK);
1509− divsel = (temp & SBI_SSCDIVINTPHASE_DIVSEL_MASK) >>
1510− SBI_SSCDIVINTPHASE_DIVSEL_SHIFT;
1511− phaseinc = (temp & SBI_SSCDIVINTPHASE_INCVAL_MASK) >>
1512− SBI_SSCDIVINTPHASE_INCVAL_SHIFT;
1513−
1514− temp = intel_sbi_read(dev_priv, SBI_SSCAUXDIV6, SBI_ICLK);
1515− auxdiv = (temp & SBI_SSCAUXDIV_FINALDIV2SEL_MASK) >>
1516− SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT;
1517−
1518− mutex_unlock(&dev_priv->sb_lock);
1519−
1520− desired_divisor = (divsel + 2) * iclk_pi_range + phaseinc;
1521−
1522− return DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
1523− desired_divisor << auxdiv);
1524−}
1525−
1526−static void ilk_pch_transcoder_set_timings(const struct intel_crtc_state *crtc_state,
1527− enum pipe pch_transcoder)
1528−{
1529− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1530− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1531− enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
1532−
1533− intel_de_write(dev_priv, PCH_TRANS_HTOTAL(pch_transcoder),
1534− intel_de_read(dev_priv, HTOTAL(cpu_transcoder)));
1535− intel_de_write(dev_priv, PCH_TRANS_HBLANK(pch_transcoder),
1536− intel_de_read(dev_priv, HBLANK(cpu_transcoder)));
1537− intel_de_write(dev_priv, PCH_TRANS_HSYNC(pch_transcoder),
1538− intel_de_read(dev_priv, HSYNC(cpu_transcoder)));
1539−
1540− intel_de_write(dev_priv, PCH_TRANS_VTOTAL(pch_transcoder),
1541− intel_de_read(dev_priv, VTOTAL(cpu_transcoder)));
1542− intel_de_write(dev_priv, PCH_TRANS_VBLANK(pch_transcoder),
1543− intel_de_read(dev_priv, VBLANK(cpu_transcoder)));
1544− intel_de_write(dev_priv, PCH_TRANS_VSYNC(pch_transcoder),
1545− intel_de_read(dev_priv, VSYNC(cpu_transcoder)));
1546− intel_de_write(dev_priv, PCH_TRANS_VSYNCSHIFT(pch_transcoder),
1547− intel_de_read(dev_priv, VSYNCSHIFT(cpu_transcoder)));
1548−}
1549−
15501022 /*
15511023 * Finds the encoder associated with the given CRTC. This can only be
15521024 * used when we know that the CRTC isn't feeding multiple encoders!
@@ -1555,15 +1027,17 @@ struct intel_encoder * · 2 unmodified lines
15551027 intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
15561028 const struct intel_crtc_state *crtc_state)
15571029 {
1558− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
15591030 const struct drm_connector_state *connector_state;
15601031 const struct drm_connector *connector;
15611032 struct intel_encoder *encoder = NULL;
1033+ struct intel_crtc *master_crtc;
15621034 int num_encoders = 0;
15631035 int i;
15641036
1037+ master_crtc = intel_master_crtc(crtc_state);
1038+
15651039 for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
1566− if (connector_state->crtc != &crtc->base)
1040+ if (connector_state->crtc != &master_crtc->base)
15671041 continue;
15681042
15691043 encoder = to_intel_encoder(connector_state->best_encoder);
@@ -1572,111 +1046,11 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state, · 2 unmodified lines
15721046
15731047 drm_WARN(encoder->base.dev, num_encoders != 1,
15741048 "%d encoders for pipe %c\n",
1575− num_encoders, pipe_name(crtc->pipe));
1049+ num_encoders, pipe_name(master_crtc->pipe));
15761050
15771051 return encoder;
15781052 }
15791053
1580−/*
1581− * Enable PCH resources required for PCH ports:
1582− * - PCH PLLs
1583− * - FDI training & RX/TX
1584− * - update transcoder timings
1585− * - DP transcoding bits
1586− * - transcoder
1587− */
1588−static void ilk_pch_enable(const struct intel_atomic_state *state,
1589− const struct intel_crtc_state *crtc_state)
1590−{
1591− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1592− struct drm_device *dev = crtc->base.dev;
1593− struct drm_i915_private *dev_priv = to_i915(dev);
1594− enum pipe pipe = crtc->pipe;
1595− u32 temp;
1596−
1597− assert_pch_transcoder_disabled(dev_priv, pipe);
1598−
1599− /* For PCH output, training FDI link */
1600− intel_fdi_link_train(crtc, crtc_state);
1601−
1602− /* We need to program the right clock selection before writing the pixel
1603− * mutliplier into the DPLL. */
1604− if (HAS_PCH_CPT(dev_priv)) {
1605− u32 sel;
1606−
1607− temp = intel_de_read(dev_priv, PCH_DPLL_SEL);
1608− temp |= TRANS_DPLL_ENABLE(pipe);
1609− sel = TRANS_DPLLB_SEL(pipe);
1610− if (crtc_state->shared_dpll ==
1611− intel_get_shared_dpll_by_id(dev_priv, DPLL_ID_PCH_PLL_B))
1612− temp |= sel;
1613− else
1614− temp &= ~sel;
1615− intel_de_write(dev_priv, PCH_DPLL_SEL, temp);
1616− }
1617−
1618− /* XXX: pch pll's can be enabled any time before we enable the PCH
1619− * transcoder, and we actually should do this to not upset any PCH
1620− * transcoder that already use the clock when we share it.
1621− *
1622− * Note that enable_shared_dpll tries to do the right thing, but
1623− * get_shared_dpll unconditionally resets the pll - we need that to have
1624− * the right LVDS enable sequence. */
1625− intel_enable_shared_dpll(crtc_state);
1626−
1627− /* set transcoder timing, panel must allow it */
1628− assert_pps_unlocked(dev_priv, pipe);
1629− ilk_pch_transcoder_set_timings(crtc_state, pipe);
1630−
1631− intel_fdi_normal_train(crtc);
1632−
1633− /* For PCH DP, enable TRANS_DP_CTL */
1634− if (HAS_PCH_CPT(dev_priv) &&
1635− intel_crtc_has_dp_encoder(crtc_state)) {
1636− const struct drm_display_mode *adjusted_mode =
1637− &crtc_state->hw.adjusted_mode;
1638− u32 bpc = (intel_de_read(dev_priv, PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
1639− i915_reg_t reg = TRANS_DP_CTL(pipe);
1640− enum port port;
1641−
1642− temp = intel_de_read(dev_priv, reg);
1643− temp &= ~(TRANS_DP_PORT_SEL_MASK |
1644− TRANS_DP_SYNC_MASK |
1645− TRANS_DP_BPC_MASK);
1646− temp |= TRANS_DP_OUTPUT_ENABLE;
1647− temp |= bpc << 9; /* same format but at 11:9 */
1648−
1649− if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
1650− temp |= TRANS_DP_HSYNC_ACTIVE_HIGH;
1651− if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
1652− temp |= TRANS_DP_VSYNC_ACTIVE_HIGH;
1653−
1654− port = intel_get_crtc_new_encoder(state, crtc_state)->port;
1655− drm_WARN_ON(dev, port < PORT_B || port > PORT_D);
1656− temp |= TRANS_DP_PORT_SEL(port);
1657−
1658− intel_de_write(dev_priv, reg, temp);
1659− }
1660−
1661− ilk_enable_pch_transcoder(crtc_state);
1662−}
1663−
1664−void lpt_pch_enable(const struct intel_crtc_state *crtc_state)
1665−{
1666− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1667− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1668− enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
1669−
1670− assert_pch_transcoder_disabled(dev_priv, PIPE_A);
1671−
1672− lpt_program_iclkip(crtc_state);
1673−
1674− /* Set transcoder timing. */
1675− ilk_pch_transcoder_set_timings(crtc_state, PIPE_A);
1676−
1677− lpt_enable_pch_transcoder(dev_priv, cpu_transcoder);
1678−}
1679−
16801054 static void cpt_verify_modeset(struct drm_i915_private *dev_priv,
16811055 enum pipe pipe)
16821056 {
@@ -2054,6 +1428,8 @@ static void intel_pre_plane_update(struct intel_atomic_state *state, · 371 unmodified lines
20541428 intel_atomic_get_new_crtc_state(state, crtc);
20551429 enum pipe pipe = crtc->pipe;
20561430
1431+ intel_psr_pre_plane_update(state, crtc);
1432+
20571433 if (hsw_pre_update_disable_ips(old_crtc_state, new_crtc_state))
20581434 hsw_disable_ips(old_crtc_state);
20591435
@@ -2165,7 +1541,7 @@ static void intel_crtc_disable_planes(struct intel_atomic_state *state, · 105 unmodified lines
21651541 !(update_mask & BIT(plane->id)))
21661542 continue;
21671543
2168− intel_disable_plane(plane, new_crtc_state);
1544+ intel_plane_disable_arm(plane, new_crtc_state);
21691545
21701546 if (old_plane_state->uapi.visible)
21711547 fb_bits |= plane->frontbuffer_bit;
@@ -2199,10 +1575,30 @@ intel_connector_primary_encoder(struct intel_connector *connector) · 27 unmodified lines
21991575
22001576 static void intel_encoders_update_prepare(struct intel_atomic_state *state)
22011577 {
1578+ struct drm_i915_private *i915 = to_i915(state->base.dev);
1579+ struct intel_crtc_state *new_crtc_state, *old_crtc_state;
1580+ struct intel_crtc *crtc;
22021581 struct drm_connector_state *new_conn_state;
22031582 struct drm_connector *connector;
22041583 int i;
22051584
1585+ /*
1586+ * Make sure the DPLL state is up-to-date for fastset TypeC ports after non-blocking commits.
1587+ * TODO: Update the DPLL state for all cases in the encoder->update_prepare() hook.
1588+ */
1589+ if (i915->dpll.mgr) {
1590+ for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
1591+ if (intel_crtc_needs_modeset(new_crtc_state))
1592+ continue;
1593+
1594+ new_crtc_state->shared_dpll = old_crtc_state->shared_dpll;
1595+ new_crtc_state->dpll_hw_state = old_crtc_state->dpll_hw_state;
1596+ }
1597+ }
1598+
1599+ if (!state->modeset)
1600+ return;
1601+
22061602 for_each_new_connector_in_state(&state->base, connector, new_conn_state,
22071603 i) {
22081604 struct intel_connector *intel_connector;
@@ -2229,6 +1625,9 @@ static void intel_encoders_update_complete(struct intel_atomic_state *state) · 20 unmodified lines
22291625 struct drm_connector *connector;
22301626 int i;
22311627
1628+ if (!state->modeset)
1629+ return;
1630+
22321631 for_each_new_connector_in_state(&state->base, connector, new_conn_state,
22331632 i) {
22341633 struct intel_connector *intel_connector;
@@ -2316,28 +1715,6 @@ static void intel_encoders_enable(struct intel_atomic_state *state, · 81 unmodified lines
23161715 }
23171716 }
23181717
2319−static void intel_encoders_pre_disable(struct intel_atomic_state *state,
2320− struct intel_crtc *crtc)
2321−{
2322− const struct intel_crtc_state *old_crtc_state =
2323− intel_atomic_get_old_crtc_state(state, crtc);
2324− const struct drm_connector_state *old_conn_state;
2325− struct drm_connector *conn;
2326− int i;
2327−
2328− for_each_old_connector_in_state(&state->base, conn, old_conn_state, i) {
2329− struct intel_encoder *encoder =
2330− to_intel_encoder(old_conn_state->best_encoder);
2331−
2332− if (old_conn_state->crtc != &crtc->base)
2333− continue;
2334−
2335− if (encoder->pre_disable)
2336− encoder->pre_disable(state, encoder, old_crtc_state,
2337− old_conn_state);
2338− }
2339−}
2340−
23411718 static void intel_encoders_disable(struct intel_atomic_state *state,
23421719 struct intel_crtc *crtc)
23431720 {
@@ -2432,7 +1809,7 @@ static void intel_disable_primary_plane(const struct intel_crtc_state *crtc_stat · 88 unmodified lines
24321809 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
24331810 struct intel_plane *plane = to_intel_plane(crtc->base.primary);
24341811
2435− plane->disable_plane(plane, crtc_state);
1812+ plane->disable_arm(plane, crtc_state);
24361813 }
24371814
24381815 static void ilk_crtc_enable(struct intel_atomic_state *state,
@@ -2500,7 +1877,7 @@ static void ilk_crtc_enable(struct intel_atomic_state *state, · 61 unmodified lines
25001877 intel_enable_transcoder(new_crtc_state);
25011878
25021879 if (new_crtc_state->has_pch_encoder)
2503− ilk_pch_enable(state, new_crtc_state);
1880+ ilk_pch_enable(state, crtc);
25041881
25051882 intel_crtc_vblank_on(new_crtc_state);
25061883
@@ -2592,42 +1969,39 @@ static void hsw_set_frame_start_delay(const struct intel_crtc_state *crtc_state) · 85 unmodified lines
25921969 static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
25931970 const struct intel_crtc_state *crtc_state)
25941971 {
2595− struct intel_crtc *master = to_intel_crtc(crtc_state->uapi.crtc);
2596− struct drm_i915_private *dev_priv = to_i915(master->base.dev);
1972+ struct drm_i915_private *dev_priv = to_i915(state->base.dev);
25971973 struct intel_crtc_state *master_crtc_state;
1974+ struct intel_crtc *master_crtc;
25981975 struct drm_connector_state *conn_state;
25991976 struct drm_connector *conn;
26001977 struct intel_encoder *encoder = NULL;
26011978 int i;
26021979
2603− if (crtc_state->bigjoiner_slave)
2604− master = crtc_state->bigjoiner_linked_crtc;
2605−
2606− master_crtc_state = intel_atomic_get_new_crtc_state(state, master);
1980+ master_crtc = intel_master_crtc(crtc_state);
1981+ master_crtc_state = intel_atomic_get_new_crtc_state(state, master_crtc);
26071982
26081983 for_each_new_connector_in_state(&state->base, conn, conn_state, i) {
2609− if (conn_state->crtc != &master->base)
1984+ if (conn_state->crtc != &master_crtc->base)
26101985 continue;
26111986
26121987 encoder = to_intel_encoder(conn_state->best_encoder);
26131988 break;
26141989 }
26151990
2616− if (!crtc_state->bigjoiner_slave) {
2617− /* need to enable VDSC, which we skipped in pre-enable */
2618− intel_dsc_enable(encoder, crtc_state);
2619− } else {
2620− /*
2621− * Enable sequence steps 1-7 on bigjoiner master
2622− */
2623− intel_encoders_pre_pll_enable(state, master);
2624− if (master_crtc_state->shared_dpll)
2625− intel_enable_shared_dpll(master_crtc_state);
2626− intel_encoders_pre_enable(state, master);
1991+ /*
1992+ * Enable sequence steps 1-7 on bigjoiner master
1993+ */
1994+ if (crtc_state->bigjoiner_slave)
1995+ intel_encoders_pre_pll_enable(state, master_crtc);
26271996
2628− /* and DSC on slave */
2629− intel_dsc_enable(NULL, crtc_state);
2630− }
1997+ if (crtc_state->shared_dpll)
1998+ intel_enable_shared_dpll(crtc_state);
1999+
2000+ if (crtc_state->bigjoiner_slave)
2001+ intel_encoders_pre_enable(state, master_crtc);
2002+
2003+ /* need to enable VDSC, which we skipped in pre-enable */
2004+ intel_dsc_enable(crtc_state);
26312005
26322006 if (DISPLAY_VER(dev_priv) >= 13)
26332007 intel_uncompressed_joiner_enable(crtc_state);
@@ -2774,33 +2148,12 @@ static void ilk_crtc_disable(struct intel_atomic_state *state, · 140 unmodified lines
27742148 ilk_pfit_disable(old_crtc_state);
27752149
27762150 if (old_crtc_state->has_pch_encoder)
2777− ilk_fdi_disable(crtc);
2151+ ilk_pch_disable(state, crtc);
27782152
27792153 intel_encoders_post_disable(state, crtc);
27802154
2781− if (old_crtc_state->has_pch_encoder) {
2782− ilk_disable_pch_transcoder(dev_priv, pipe);
2783−
2784− if (HAS_PCH_CPT(dev_priv)) {
2785− i915_reg_t reg;
2786− u32 temp;
2787−
2788− /* disable TRANS_DP_CTL */
2789− reg = TRANS_DP_CTL(pipe);
2790− temp = intel_de_read(dev_priv, reg);
2791− temp &= ~(TRANS_DP_OUTPUT_ENABLE |
2792− TRANS_DP_PORT_SEL_MASK);
2793− temp |= TRANS_DP_PORT_SEL_NONE;
2794− intel_de_write(dev_priv, reg, temp);
2795−
2796− /* disable DPLL_SEL */
2797− temp = intel_de_read(dev_priv, PCH_DPLL_SEL);
2798− temp &= ~(TRANS_DPLL_ENABLE(pipe) | TRANS_DPLLB_SEL(pipe));
2799− intel_de_write(dev_priv, PCH_DPLL_SEL, temp);
2800− }
2801−
2802− ilk_fdi_pll_disable(crtc);
2803− }
2155+ if (old_crtc_state->has_pch_encoder)
2156+ ilk_pch_post_disable(state, crtc);
28042157
28052158 intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
28062159 intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
@@ -2809,12 +2162,17 @@ static void ilk_crtc_disable(struct intel_atomic_state *state, · 2 unmodified lines
28092162 static void hsw_crtc_disable(struct intel_atomic_state *state,
28102163 struct intel_crtc *crtc)
28112164 {
2165+ const struct intel_crtc_state *old_crtc_state =
2166+ intel_atomic_get_old_crtc_state(state, crtc);
2167+
28122168 /*
28132169 * FIXME collapse everything to one hook.
28142170 * Need care with mst->ddi interactions.
28152171 */
2816− intel_encoders_disable(state, crtc);
2817− intel_encoders_post_disable(state, crtc);
2172+ if (!old_crtc_state->bigjoiner_slave) {
2173+ intel_encoders_disable(state, crtc);
2174+ intel_encoders_post_disable(state, crtc);
2175+ }
28182176 }
28192177
28202178 static void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state)
@@ -4242,476 +3600,68 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, · 1421 unmodified lines
42423600 if (DISPLAY_VER(dev_priv) < 4)
42433601 pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE;
42443602
4245− intel_get_transcoder_timings(crtc, pipe_config);
4246− intel_get_pipe_src_size(crtc, pipe_config);
4247−
4248− i9xx_get_pfit_config(pipe_config);
4249−
4250− if (DISPLAY_VER(dev_priv) >= 4) {
4251− /* No way to read it out on pipes B and C */
4252− if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A)
4253− tmp = dev_priv->chv_dpll_md[crtc->pipe];
4254− else
4255− tmp = intel_de_read(dev_priv, DPLL_MD(crtc->pipe));
4256− pipe_config->pixel_multiplier =
4257− ((tmp & DPLL_MD_UDI_MULTIPLIER_MASK)
4258− >> DPLL_MD_UDI_MULTIPLIER_SHIFT) + 1;
4259− pipe_config->dpll_hw_state.dpll_md = tmp;
4260− } else if (IS_I945G(dev_priv) || IS_I945GM(dev_priv) ||
4261− IS_G33(dev_priv) || IS_PINEVIEW(dev_priv)) {
4262− tmp = intel_de_read(dev_priv, DPLL(crtc->pipe));
4263− pipe_config->pixel_multiplier =
4264− ((tmp & SDVO_MULTIPLIER_MASK)
4265− >> SDVO_MULTIPLIER_SHIFT_HIRES) + 1;
4266− } else {
4267− /* Note that on i915G/GM the pixel multiplier is in the sdvo
4268− * port and will be fixed up in the encoder->get_config
4269− * function. */
4270− pipe_config->pixel_multiplier = 1;
4271− }
4272− pipe_config->dpll_hw_state.dpll = intel_de_read(dev_priv,
4273− DPLL(crtc->pipe));
4274− if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
4275− pipe_config->dpll_hw_state.fp0 = intel_de_read(dev_priv,
4276− FP0(crtc->pipe));
4277− pipe_config->dpll_hw_state.fp1 = intel_de_read(dev_priv,
4278− FP1(crtc->pipe));
4279− } else {
4280− /* Mask out read-only status bits. */
4281− pipe_config->dpll_hw_state.dpll &= ~(DPLL_LOCK_VLV |
4282− DPLL_PORTC_READY_MASK |
4283− DPLL_PORTB_READY_MASK);
4284− }
4285−
4286− if (IS_CHERRYVIEW(dev_priv))
4287− chv_crtc_clock_get(crtc, pipe_config);
4288− else if (IS_VALLEYVIEW(dev_priv))
4289− vlv_crtc_clock_get(crtc, pipe_config);
4290− else
4291− i9xx_crtc_clock_get(crtc, pipe_config);
4292−
4293− /*
4294− * Normally the dotclock is filled in by the encoder .get_config()
4295− * but in case the pipe is enabled w/o any ports we need a sane
4296− * default.
4297− */
4298− pipe_config->hw.adjusted_mode.crtc_clock =
4299− pipe_config->port_clock / pipe_config->pixel_multiplier;
4300−
4301− ret = true;
4302−
4303−out:
4304− intel_display_power_put(dev_priv, power_domain, wakeref);
4305−
4306− return ret;
4307−}
4308−
4309−static void ilk_init_pch_refclk(struct drm_i915_private *dev_priv)
4310−{
4311− struct intel_encoder *encoder;
4312− int i;
4313− u32 val, final;
4314− bool has_lvds = false;
4315− bool has_cpu_edp = false;
4316− bool has_panel = false;
4317− bool has_ck505 = false;
4318− bool can_ssc = false;
4319− bool using_ssc_source = false;
4320−
4321− /* We need to take the global config into account */
4322− for_each_intel_encoder(&dev_priv->drm, encoder) {
4323− switch (encoder->type) {
4324− case INTEL_OUTPUT_LVDS:
4325− has_panel = true;
4326− has_lvds = true;
4327− break;
4328− case INTEL_OUTPUT_EDP:
4329− has_panel = true;
4330− if (encoder->port == PORT_A)
4331− has_cpu_edp = true;
4332− break;
4333− default:
4334− break;
4335− }
4336− }
4337−
4338− if (HAS_PCH_IBX(dev_priv)) {
4339− has_ck505 = dev_priv->vbt.display_clock_mode;
4340− can_ssc = has_ck505;
4341− } else {
4342− has_ck505 = false;
4343− can_ssc = true;
4344− }
4345−
4346− /* Check if any DPLLs are using the SSC source */
4347− for (i = 0; i < dev_priv->dpll.num_shared_dpll; i++) {
4348− u32 temp = intel_de_read(dev_priv, PCH_DPLL(i));
4349−
4350− if (!(temp & DPLL_VCO_ENABLE))
4351− continue;
4352−
4353− if ((temp & PLL_REF_INPUT_MASK) ==
4354− PLLB_REF_INPUT_SPREADSPECTRUMIN) {
4355− using_ssc_source = true;
4356− break;
4357− }
4358− }
4359−
4360− drm_dbg_kms(&dev_priv->drm,
4361− "has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n",
4362− has_panel, has_lvds, has_ck505, using_ssc_source);
4363−
4364− /* Ironlake: try to setup display ref clock before DPLL
4365− * enabling. This is only under driver's control after
4366− * PCH B stepping, previous chipset stepping should be
4367− * ignoring this setting.
4368− */
4369− val = intel_de_read(dev_priv, PCH_DREF_CONTROL);
4370−
4371− /* As we must carefully and slowly disable/enable each source in turn,
4372− * compute the final state we want first and check if we need to
4373− * make any changes at all.
4374− */
4375− final = val;
4376− final &= ~DREF_NONSPREAD_SOURCE_MASK;
4377− if (has_ck505)
4378− final |= DREF_NONSPREAD_CK505_ENABLE;
4379− else
4380− final |= DREF_NONSPREAD_SOURCE_ENABLE;
4381−
4382− final &= ~DREF_SSC_SOURCE_MASK;
4383− final &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
4384− final &= ~DREF_SSC1_ENABLE;
4385−
4386− if (has_panel) {
4387− final |= DREF_SSC_SOURCE_ENABLE;
4388−
4389− if (intel_panel_use_ssc(dev_priv) && can_ssc)
4390− final |= DREF_SSC1_ENABLE;
4391−
4392− if (has_cpu_edp) {
4393− if (intel_panel_use_ssc(dev_priv) && can_ssc)
4394− final |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD;
4395− else
4396− final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
4397− } else
4398− final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
4399− } else if (using_ssc_source) {
4400− final |= DREF_SSC_SOURCE_ENABLE;
4401− final |= DREF_SSC1_ENABLE;
4402− }
4403−
4404− if (final == val)
4405− return;
4406−
4407− /* Always enable nonspread source */
4408− val &= ~DREF_NONSPREAD_SOURCE_MASK;
4409−
4410− if (has_ck505)
4411− val |= DREF_NONSPREAD_CK505_ENABLE;
4412− else
4413− val |= DREF_NONSPREAD_SOURCE_ENABLE;
4414−
4415− if (has_panel) {
4416− val &= ~DREF_SSC_SOURCE_MASK;
4417− val |= DREF_SSC_SOURCE_ENABLE;
4418−
4419− /* SSC must be turned on before enabling the CPU output */
4420− if (intel_panel_use_ssc(dev_priv) && can_ssc) {
4421− drm_dbg_kms(&dev_priv->drm, "Using SSC on panel\n");
4422− val |= DREF_SSC1_ENABLE;
4423− } else
4424− val &= ~DREF_SSC1_ENABLE;
4425−
4426− /* Get SSC going before enabling the outputs */
4427− intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
4428− intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
4429− udelay(200);
4430−
4431− val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
4432−
4433− /* Enable CPU source on CPU attached eDP */
4434− if (has_cpu_edp) {
4435− if (intel_panel_use_ssc(dev_priv) && can_ssc) {
4436− drm_dbg_kms(&dev_priv->drm,
4437− "Using SSC on eDP\n");
4438− val |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD;
4439− } else
4440− val |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
4441− } else
4442− val |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
4443−
4444− intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
4445− intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
4446− udelay(200);
4447− } else {
4448− drm_dbg_kms(&dev_priv->drm, "Disabling CPU source output\n");
4449−
4450− val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
4451−
4452− /* Turn off CPU output */
4453− val |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
4454−
4455− intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
4456− intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
4457− udelay(200);
4458−
4459− if (!using_ssc_source) {
4460− drm_dbg_kms(&dev_priv->drm, "Disabling SSC source\n");
4461−
4462− /* Turn off the SSC source */
4463− val &= ~DREF_SSC_SOURCE_MASK;
4464− val |= DREF_SSC_SOURCE_DISABLE;
4465−
4466− /* Turn off SSC1 */
4467− val &= ~DREF_SSC1_ENABLE;
4468−
4469− intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
4470− intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
4471− udelay(200);
4472− }
4473− }
4474−
4475− BUG_ON(val != final);
4476−}
4477−
4478−/* Implements 3 different sequences from BSpec chapter "Display iCLK
4479− * Programming" based on the parameters passed:
4480− * - Sequence to enable CLKOUT_DP
4481− * - Sequence to enable CLKOUT_DP without spread
4482− * - Sequence to enable CLKOUT_DP for FDI usage and configure PCH FDI I/O
4483− */
4484−static void lpt_enable_clkout_dp(struct drm_i915_private *dev_priv,
4485− bool with_spread, bool with_fdi)
4486−{
4487− u32 reg, tmp;
4488−
4489− if (drm_WARN(&dev_priv->drm, with_fdi && !with_spread,
4490− "FDI requires downspread\n"))
4491− with_spread = true;
4492− if (drm_WARN(&dev_priv->drm, HAS_PCH_LPT_LP(dev_priv) &&
4493− with_fdi, "LP PCH doesn't have FDI\n"))
4494− with_fdi = false;
4495−
4496− mutex_lock(&dev_priv->sb_lock);
4497−
4498− tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
4499− tmp &= ~SBI_SSCCTL_DISABLE;
4500− tmp |= SBI_SSCCTL_PATHALT;
4501− intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
4502−
4503− udelay(24);
4504−
4505− if (with_spread) {
4506− tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
4507− tmp &= ~SBI_SSCCTL_PATHALT;
4508− intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
4509−
4510− if (with_fdi)
4511− lpt_fdi_program_mphy(dev_priv);
4512− }
4513−
4514− reg = HAS_PCH_LPT_LP(dev_priv) ? SBI_GEN0 : SBI_DBUFF0;
4515− tmp = intel_sbi_read(dev_priv, reg, SBI_ICLK);
4516− tmp |= SBI_GEN0_CFG_BUFFENABLE_DISABLE;
4517− intel_sbi_write(dev_priv, reg, tmp, SBI_ICLK);
4518−
4519− mutex_unlock(&dev_priv->sb_lock);
4520−}
4521−
4522−/* Sequence to disable CLKOUT_DP */
4523−void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv)
4524−{
4525− u32 reg, tmp;
4526−
4527− mutex_lock(&dev_priv->sb_lock);
4528−
4529− reg = HAS_PCH_LPT_LP(dev_priv) ? SBI_GEN0 : SBI_DBUFF0;
4530− tmp = intel_sbi_read(dev_priv, reg, SBI_ICLK);
4531− tmp &= ~SBI_GEN0_CFG_BUFFENABLE_DISABLE;
4532− intel_sbi_write(dev_priv, reg, tmp, SBI_ICLK);
4533−
4534− tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
4535− if (!(tmp & SBI_SSCCTL_DISABLE)) {
4536− if (!(tmp & SBI_SSCCTL_PATHALT)) {
4537− tmp |= SBI_SSCCTL_PATHALT;
4538− intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
4539− udelay(32);
4540− }
4541− tmp |= SBI_SSCCTL_DISABLE;
4542− intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
4543− }
4544−
4545− mutex_unlock(&dev_priv->sb_lock);
4546−}
4547−
4548−#define BEND_IDX(steps) ((50 + (steps)) / 5)
4549−
4550−static const u16 sscdivintphase[] = {
4551− [BEND_IDX( 50)] = 0x3B23,
4552− [BEND_IDX( 45)] = 0x3B23,
4553− [BEND_IDX( 40)] = 0x3C23,
4554− [BEND_IDX( 35)] = 0x3C23,
4555− [BEND_IDX( 30)] = 0x3D23,
4556− [BEND_IDX( 25)] = 0x3D23,
4557− [BEND_IDX( 20)] = 0x3E23,
4558− [BEND_IDX( 15)] = 0x3E23,
4559− [BEND_IDX( 10)] = 0x3F23,
4560− [BEND_IDX( 5)] = 0x3F23,
4561− [BEND_IDX( 0)] = 0x0025,
4562− [BEND_IDX( -5)] = 0x0025,
4563− [BEND_IDX(-10)] = 0x0125,
4564− [BEND_IDX(-15)] = 0x0125,
4565− [BEND_IDX(-20)] = 0x0225,
4566− [BEND_IDX(-25)] = 0x0225,
4567− [BEND_IDX(-30)] = 0x0325,
4568− [BEND_IDX(-35)] = 0x0325,
4569− [BEND_IDX(-40)] = 0x0425,
4570− [BEND_IDX(-45)] = 0x0425,
4571− [BEND_IDX(-50)] = 0x0525,
4572−};
4573−
4574−/*
4575− * Bend CLKOUT_DP
4576− * steps -50 to 50 inclusive, in steps of 5
4577− * < 0 slow down the clock, > 0 speed up the clock, 0 == no bend (135MHz)
4578− * change in clock period = -(steps / 10) * 5.787 ps
4579− */
4580−static void lpt_bend_clkout_dp(struct drm_i915_private *dev_priv, int steps)
4581−{
4582− u32 tmp;
4583− int idx = BEND_IDX(steps);
4584−
4585− if (drm_WARN_ON(&dev_priv->drm, steps % 5 != 0))
4586− return;
4587−
4588− if (drm_WARN_ON(&dev_priv->drm, idx >= ARRAY_SIZE(sscdivintphase)))
4589− return;
4590−
4591− mutex_lock(&dev_priv->sb_lock);
4592−
4593− if (steps % 10 != 0)
4594− tmp = 0xAAAAAAAB;
4595− else
4596− tmp = 0x00000000;
4597− intel_sbi_write(dev_priv, SBI_SSCDITHPHASE, tmp, SBI_ICLK);
4598−
4599− tmp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE, SBI_ICLK);
4600− tmp &= 0xffff0000;
4601− tmp |= sscdivintphase[idx];
4602− intel_sbi_write(dev_priv, SBI_SSCDIVINTPHASE, tmp, SBI_ICLK);
4603−
4604− mutex_unlock(&dev_priv->sb_lock);
4605−}
4606−
4607−#undef BEND_IDX
4608−
4609−static bool spll_uses_pch_ssc(struct drm_i915_private *dev_priv)
4610−{
4611− u32 fuse_strap = intel_de_read(dev_priv, FUSE_STRAP);
4612− u32 ctl = intel_de_read(dev_priv, SPLL_CTL);
4613−
4614− if ((ctl & SPLL_PLL_ENABLE) == 0)
4615− return false;
4616−
4617− if ((ctl & SPLL_REF_MASK) == SPLL_REF_MUXED_SSC &&
4618− (fuse_strap & HSW_CPU_SSC_ENABLE) == 0)
4619− return true;
4620−
4621− if (IS_BROADWELL(dev_priv) &&
4622− (ctl & SPLL_REF_MASK) == SPLL_REF_PCH_SSC_BDW)
4623− return true;
4624−
4625− return false;
4626−}
4627−
4628−static bool wrpll_uses_pch_ssc(struct drm_i915_private *dev_priv,
4629− enum intel_dpll_id id)
4630−{
4631− u32 fuse_strap = intel_de_read(dev_priv, FUSE_STRAP);
4632− u32 ctl = intel_de_read(dev_priv, WRPLL_CTL(id));
4633−
4634− if ((ctl & WRPLL_PLL_ENABLE) == 0)
4635− return false;
4636−
4637− if ((ctl & WRPLL_REF_MASK) == WRPLL_REF_PCH_SSC)
4638− return true;
4639−
4640− if ((IS_BROADWELL(dev_priv) || IS_HSW_ULT(dev_priv)) &&
4641− (ctl & WRPLL_REF_MASK) == WRPLL_REF_MUXED_SSC_BDW &&
4642− (fuse_strap & HSW_CPU_SSC_ENABLE) == 0)
4643− return true;
4644−
4645− return false;
4646−}
4647−
4648−static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv)
4649−{
4650− struct intel_encoder *encoder;
4651− bool has_fdi = false;
4652−
4653− for_each_intel_encoder(&dev_priv->drm, encoder) {
4654− switch (encoder->type) {
4655− case INTEL_OUTPUT_ANALOG:
4656− has_fdi = true;
4657− break;
4658− default:
4659− break;
4660− }
4661− }
4662−
4663− /*
4664− * The BIOS may have decided to use the PCH SSC
4665− * reference so we must not disable it until the
4666− * relevant PLLs have stopped relying on it. We'll
4667− * just leave the PCH SSC reference enabled in case
4668− * any active PLL is using it. It will get disabled
4669− * after runtime suspend if we don't have FDI.
4670− *
4671− * TODO: Move the whole reference clock handling
4672− * to the modeset sequence proper so that we can
4673− * actually enable/disable/reconfigure these things
4674− * safely. To do that we need to introduce a real
4675− * clock hierarchy. That would also allow us to do
4676− * clock bending finally.
4677− */
4678− dev_priv->pch_ssc_use = 0;
3603+ intel_get_transcoder_timings(crtc, pipe_config);
3604+ intel_get_pipe_src_size(crtc, pipe_config);
46793605
4680− if (spll_uses_pch_ssc(dev_priv)) {
4681− drm_dbg_kms(&dev_priv->drm, "SPLL using PCH SSC\n");
4682− dev_priv->pch_ssc_use |= BIT(DPLL_ID_SPLL);
4683− }
3606+ i9xx_get_pfit_config(pipe_config);
46843607
4685− if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL1)) {
4686− drm_dbg_kms(&dev_priv->drm, "WRPLL1 using PCH SSC\n");
4687− dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL1);
3608+ if (DISPLAY_VER(dev_priv) >= 4) {
3609+ /* No way to read it out on pipes B and C */
3610+ if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A)
3611+ tmp = dev_priv->chv_dpll_md[crtc->pipe];
3612+ else
3613+ tmp = intel_de_read(dev_priv, DPLL_MD(crtc->pipe));
3614+ pipe_config->pixel_multiplier =
3615+ ((tmp & DPLL_MD_UDI_MULTIPLIER_MASK)
3616+ >> DPLL_MD_UDI_MULTIPLIER_SHIFT) + 1;
3617+ pipe_config->dpll_hw_state.dpll_md = tmp;
3618+ } else if (IS_I945G(dev_priv) || IS_I945GM(dev_priv) ||
3619+ IS_G33(dev_priv) || IS_PINEVIEW(dev_priv)) {
3620+ tmp = intel_de_read(dev_priv, DPLL(crtc->pipe));
3621+ pipe_config->pixel_multiplier =
3622+ ((tmp & SDVO_MULTIPLIER_MASK)
3623+ >> SDVO_MULTIPLIER_SHIFT_HIRES) + 1;
3624+ } else {
3625+ /* Note that on i915G/GM the pixel multiplier is in the sdvo
3626+ * port and will be fixed up in the encoder->get_config
3627+ * function. */
3628+ pipe_config->pixel_multiplier = 1;
46883629 }
4689−
4690− if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL2)) {
4691− drm_dbg_kms(&dev_priv->drm, "WRPLL2 using PCH SSC\n");
4692− dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL2);
3630+ pipe_config->dpll_hw_state.dpll = intel_de_read(dev_priv,
3631+ DPLL(crtc->pipe));
3632+ if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
3633+ pipe_config->dpll_hw_state.fp0 = intel_de_read(dev_priv,
3634+ FP0(crtc->pipe));
3635+ pipe_config->dpll_hw_state.fp1 = intel_de_read(dev_priv,
3636+ FP1(crtc->pipe));
3637+ } else {
3638+ /* Mask out read-only status bits. */
3639+ pipe_config->dpll_hw_state.dpll &= ~(DPLL_LOCK_VLV |
3640+ DPLL_PORTC_READY_MASK |
3641+ DPLL_PORTB_READY_MASK);
46933642 }
46943643
4695− if (dev_priv->pch_ssc_use)
4696− return;
3644+ if (IS_CHERRYVIEW(dev_priv))
3645+ chv_crtc_clock_get(crtc, pipe_config);
3646+ else if (IS_VALLEYVIEW(dev_priv))
3647+ vlv_crtc_clock_get(crtc, pipe_config);
3648+ else
3649+ i9xx_crtc_clock_get(crtc, pipe_config);
46973650
4698− if (has_fdi) {
4699− lpt_bend_clkout_dp(dev_priv, 0);
4700− lpt_enable_clkout_dp(dev_priv, true, true);
4701− } else {
4702− lpt_disable_clkout_dp(dev_priv);
4703− }
4704−}
3651+ /*
3652+ * Normally the dotclock is filled in by the encoder .get_config()
3653+ * but in case the pipe is enabled w/o any ports we need a sane
3654+ * default.
3655+ */
3656+ pipe_config->hw.adjusted_mode.crtc_clock =
3657+ pipe_config->port_clock / pipe_config->pixel_multiplier;
47053658
4706−/*
4707− * Initialize reference clocks when the driver loads
4708− */
4709−void intel_init_pch_refclk(struct drm_i915_private *dev_priv)
4710−{
4711− if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv))
4712− ilk_init_pch_refclk(dev_priv);
4713− else if (HAS_PCH_LPT(dev_priv))
4714− lpt_init_pch_refclk(dev_priv);
3659+ ret = true;
3660+
3661+out:
3662+ intel_display_power_put(dev_priv, power_domain, wakeref);
3663+
3664+ return ret;
47153665 }
47163666
47173667 static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
@@ -4978,8 +3928,8 @@ void intel_dp_get_m_n(struct intel_crtc *crtc, · 260 unmodified lines
49783928 &pipe_config->dp_m2_n2);
49793929 }
49803930
4981−static void ilk_get_fdi_m_n_config(struct intel_crtc *crtc,
4982− struct intel_crtc_state *pipe_config)
3931+void ilk_get_fdi_m_n_config(struct intel_crtc *crtc,
3932+ struct intel_crtc_state *pipe_config)
49833933 {
49843934 intel_cpu_transcoder_get_m_n(crtc, pipe_config->cpu_transcoder,
49853935 &pipe_config->fdi_m_n, NULL);
@@ -5116,50 +4066,9 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc, · 130 unmodified lines
51164066 i9xx_get_pipe_color_config(pipe_config);
51174067 intel_color_get_config(pipe_config);
51184068
5119− if (intel_de_read(dev_priv, PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) {
5120− struct intel_shared_dpll *pll;
5121− enum intel_dpll_id pll_id;
5122− bool pll_active;
5123−
5124− pipe_config->has_pch_encoder = true;
5125−
5126− tmp = intel_de_read(dev_priv, FDI_RX_CTL(crtc->pipe));
5127− pipe_config->fdi_lanes = ((FDI_DP_PORT_WIDTH_MASK & tmp) >>
5128− FDI_DP_PORT_WIDTH_SHIFT) + 1;
5129−
5130− ilk_get_fdi_m_n_config(crtc, pipe_config);
5131−
5132− if (HAS_PCH_IBX(dev_priv)) {
5133− /*
5134− * The pipe->pch transcoder and pch transcoder->pll
5135− * mapping is fixed.
5136− */
5137− pll_id = (enum intel_dpll_id) crtc->pipe;
5138− } else {
5139− tmp = intel_de_read(dev_priv, PCH_DPLL_SEL);
5140− if (tmp & TRANS_DPLLB_SEL(crtc->pipe))
5141− pll_id = DPLL_ID_PCH_PLL_B;
5142− else
5143− pll_id= DPLL_ID_PCH_PLL_A;
5144− }
5145−
5146− pipe_config->shared_dpll =
5147− intel_get_shared_dpll_by_id(dev_priv, pll_id);
5148− pll = pipe_config->shared_dpll;
5149−
5150− pll_active = intel_dpll_get_hw_state(dev_priv, pll,
5151− &pipe_config->dpll_hw_state);
5152− drm_WARN_ON(dev, !pll_active);
5153−
5154− tmp = pipe_config->dpll_hw_state.dpll;
5155− pipe_config->pixel_multiplier =
5156− ((tmp & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK)
5157− >> PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) + 1;
4069+ pipe_config->pixel_multiplier = 1;
51584070
5159− ilk_pch_clock_get(crtc, pipe_config);
5160− } else {
5161− pipe_config->pixel_multiplier = 1;
5162− }
4071+ ilk_pch_get_config(pipe_config);
51634072
51644073 intel_get_transcoder_timings(crtc, pipe_config);
51654074 intel_get_pipe_src_size(crtc, pipe_config);
@@ -5174,6 +4083,16 @@ out: · 8 unmodified lines
51744083 return ret;
51754084 }
51764085
4086+static u8 bigjoiner_pipes(struct drm_i915_private *i915)
4087+{
4088+ if (DISPLAY_VER(i915) >= 12)
4089+ return BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D);
4090+ else if (DISPLAY_VER(i915) >= 11)
4091+ return BIT(PIPE_B) | BIT(PIPE_C);
4092+ else
4093+ return 0;
4094+}
4095+
51774096 static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv,
51784097 enum transcoder cpu_transcoder)
51794098 {
@@ -5189,6 +4108,54 @@ static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, · 9 unmodified lines
51894108 return tmp & TRANS_DDI_FUNC_ENABLE;
51904109 }
51914110
4111+static u8 enabled_bigjoiner_pipes(struct drm_i915_private *dev_priv)
4112+{
4113+ u8 master_pipes = 0, slave_pipes = 0;
4114+ struct intel_crtc *crtc;
4115+
4116+ for_each_intel_crtc(&dev_priv->drm, crtc) {
4117+ enum intel_display_power_domain power_domain;
4118+ enum pipe pipe = crtc->pipe;
4119+ intel_wakeref_t wakeref;
4120+
4121+ if ((bigjoiner_pipes(dev_priv) & BIT(pipe)) == 0)
4122+ continue;
4123+
4124+ power_domain = intel_dsc_power_domain(crtc, (enum transcoder) pipe);
4125+ with_intel_display_power_if_enabled(dev_priv, power_domain, wakeref) {
4126+ u32 tmp = intel_de_read(dev_priv, ICL_PIPE_DSS_CTL1(pipe));
4127+
4128+ if (!(tmp & BIG_JOINER_ENABLE))
4129+ continue;
4130+
4131+ if (tmp & MASTER_BIG_JOINER_ENABLE)
4132+ master_pipes |= BIT(pipe);
4133+ else
4134+ slave_pipes |= BIT(pipe);
4135+ }
4136+
4137+ if (DISPLAY_VER(dev_priv) < 13)
4138+ continue;
4139+
4140+ power_domain = POWER_DOMAIN_PIPE(pipe);
4141+ with_intel_display_power_if_enabled(dev_priv, power_domain, wakeref) {
4142+ u32 tmp = intel_de_read(dev_priv, ICL_PIPE_DSS_CTL1(pipe));
4143+
4144+ if (tmp & UNCOMPRESSED_JOINER_MASTER)
4145+ master_pipes |= BIT(pipe);
4146+ if (tmp & UNCOMPRESSED_JOINER_SLAVE)
4147+ slave_pipes |= BIT(pipe);
4148+ }
4149+ }
4150+
4151+ /* Bigjoiner pipes should always be consecutive master and slave */
4152+ drm_WARN(&dev_priv->drm, slave_pipes != master_pipes << 1,
4153+ "Bigjoiner misconfigured (master pipes 0x%x, slave pipes 0x%x)\n",
4154+ master_pipes, slave_pipes);
4155+
4156+ return slave_pipes;
4157+}
4158+
51924159 static u8 hsw_panel_transcoders(struct drm_i915_private *i915)
51934160 {
51944161 u8 panel_transcoder_mask = BIT(TRANSCODER_EDP);
@@ -5250,10 +4217,18 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) · 55 unmodified lines
52504217 enabled_transcoders |= BIT(cpu_transcoder);
52514218 }
52524219
4220+ /* single pipe or bigjoiner master */
52534221 cpu_transcoder = (enum transcoder) crtc->pipe;
52544222 if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
52554223 enabled_transcoders |= BIT(cpu_transcoder);
52564224
4225+ /* bigjoiner slave -> consider the master pipe's transcoder as well */
4226+ if (enabled_bigjoiner_pipes(dev_priv) & BIT(crtc->pipe)) {
4227+ cpu_transcoder = (enum transcoder) crtc->pipe - 1;
4228+ if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
4229+ enabled_transcoders |= BIT(cpu_transcoder);
4230+ }
4231+
52574232 return enabled_transcoders;
52584233 }
52594234
@@ -5374,45 +4349,6 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc, · 114 unmodified lines
53744349 return transcoder_is_dsi(pipe_config->cpu_transcoder);
53754350 }
53764351
5377−static void hsw_get_ddi_port_state(struct intel_crtc *crtc,
5378− struct intel_crtc_state *pipe_config)
5379−{
5380− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
5381− enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
5382− enum port port;
5383− u32 tmp;
5384−
5385− if (transcoder_is_dsi(cpu_transcoder)) {
5386− port = (cpu_transcoder == TRANSCODER_DSI_A) ?
5387− PORT_A : PORT_B;
5388− } else {
5389− tmp = intel_de_read(dev_priv,
5390− TRANS_DDI_FUNC_CTL(cpu_transcoder));
5391− if (!(tmp & TRANS_DDI_FUNC_ENABLE))
5392− return;
5393− if (DISPLAY_VER(dev_priv) >= 12)
5394− port = TGL_TRANS_DDI_FUNC_CTL_VAL_TO_PORT(tmp);
5395− else
5396− port = TRANS_DDI_FUNC_CTL_VAL_TO_PORT(tmp);
5397− }
5398−
5399− /*
5400− * Haswell has only FDI/PCH transcoder A. It is which is connected to
5401− * DDI E. So just check whether this pipe is wired to DDI E and whether
5402− * the PCH transcoder is on.
5403− */
5404− if (DISPLAY_VER(dev_priv) < 9 &&
5405− (port == PORT_E) && intel_de_read(dev_priv, LPT_TRANSCONF) & TRANS_ENABLE) {
5406− pipe_config->has_pch_encoder = true;
5407−
5408− tmp = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
5409− pipe_config->fdi_lanes = ((FDI_DP_PORT_WIDTH_MASK & tmp) >>
5410− FDI_DP_PORT_WIDTH_SHIFT) + 1;
5411−
5412− ilk_get_fdi_m_n_config(crtc, pipe_config);
5413− }
5414−}
5415−
54164352 static bool hsw_get_pipe_config(struct intel_crtc *crtc,
54174353 struct intel_crtc_state *pipe_config)
54184354 {
@@ -5439,21 +4375,12 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc, · 20 unmodified lines
54394375 if (DISPLAY_VER(dev_priv) >= 13 && !pipe_config->dsc.compression_enable)
54404376 intel_uncompressed_joiner_get_config(pipe_config);
54414377
5442− if (!active) {
5443− /* bigjoiner slave doesn't enable transcoder */
5444− if (!pipe_config->bigjoiner_slave)
5445− goto out;
5446−
5447− active = true;
5448− pipe_config->pixel_multiplier = 1;
4378+ if (!active)
4379+ goto out;
54494380
5450− /* we cannot read out most state, so don't bother.. */
5451− pipe_config->quirks |= PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE;
5452− } else if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
5453− DISPLAY_VER(dev_priv) >= 11) {
5454− hsw_get_ddi_port_state(crtc, pipe_config);
4381+ if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
4382+ DISPLAY_VER(dev_priv) >= 11)
54554383 intel_get_transcoder_timings(crtc, pipe_config);
5456− }
54574384
54584385 if (HAS_VRR(dev_priv) && !transcoder_is_dsi(pipe_config->cpu_transcoder))
54594386 intel_vrr_get_config(crtc, pipe_config);
@@ -5521,10 +4448,7 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc, · 61 unmodified lines
55214448 }
55224449 }
55234450
5524− if (pipe_config->bigjoiner_slave) {
5525− /* Cannot be read out as a slave, set to 0. */
5526− pipe_config->pixel_multiplier = 0;
5527− } else if (pipe_config->cpu_transcoder != TRANSCODER_EDP &&
4451+ if (pipe_config->cpu_transcoder != TRANSCODER_EDP &&
55284452 !transcoder_is_dsi(pipe_config->cpu_transcoder)) {
55294453 pipe_config->pixel_multiplier =
55304454 intel_de_read(dev_priv,
@@ -5782,8 +4706,8 @@ static int i9xx_pll_refclk(struct drm_device *dev, · 251 unmodified lines
57824706 }
57834707
57844708 /* Returns the clock of the currently programmed mode of the given pipe. */
5785−static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
5786− struct intel_crtc_state *pipe_config)
4709+void i9xx_crtc_clock_get(struct intel_crtc *crtc,
4710+ struct intel_crtc_state *pipe_config)
57874711 {
57884712 struct drm_device *dev = crtc->base.dev;
57894713 struct drm_i915_private *dev_priv = to_i915(dev);
@@ -5893,24 +4817,6 @@ int intel_dotclock_calculate(int link_freq, · 103 unmodified lines
58934817 return div_u64(mul_u32_u32(m_n->link_m, link_freq), m_n->link_n);
58944818 }
58954819
5896−static void ilk_pch_clock_get(struct intel_crtc *crtc,
5897− struct intel_crtc_state *pipe_config)
5898−{
5899− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
5900−
5901− /* read out port_clock from the DPLL */
5902− i9xx_crtc_clock_get(crtc, pipe_config);
5903−
5904− /*
5905− * In case there is an active pipe without active ports,
5906− * we may need some idea for the dotclock anyway.
5907− * Calculate one based on the FDI configuration.
5908− */
5909− pipe_config->hw.adjusted_mode.crtc_clock =
5910− intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, pipe_config),
5911− &pipe_config->fdi_m_n);
5912−}
5913−
59144820 /* Returns the currently programmed mode of the given encoder. */
59154821 struct drm_display_mode *
59164822 intel_encoder_current_mode(struct intel_encoder *encoder)
@@ -6245,6 +5151,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state) · 328 unmodified lines
62455151 linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
62465152 linked_state->color_ctl = plane_state->color_ctl;
62475153 linked_state->view = plane_state->view;
5154+ linked_state->decrypt = plane_state->decrypt;
62485155
62495156 intel_plane_copy_hw_state(linked_state, plane_state);
62505157 linked_state->uapi.src = plane_state->uapi.src;
@@ -6371,8 +5278,6 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state, · 120 unmodified lines
63715278 crtc_state->update_wm_post = true;
63725279
63735280 if (mode_changed && crtc_state->hw.enable &&
6374− dev_priv->dpll_funcs &&
6375− !crtc_state->bigjoiner_slave &&
63765281 !drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll)) {
63775282 ret = dev_priv->dpll_funcs->crtc_compute_clock(crtc_state);
63785283 if (ret)
@@ -6928,18 +5833,15 @@ static void · 549 unmodified lines
69285833 intel_crtc_copy_uapi_to_hw_state_nomodeset(struct intel_atomic_state *state,
69295834 struct intel_crtc_state *crtc_state)
69305835 {
6931− const struct intel_crtc_state *from_crtc_state = crtc_state;
5836+ const struct intel_crtc_state *master_crtc_state;
5837+ struct intel_crtc *master_crtc;
69325838
6933− if (crtc_state->bigjoiner_slave) {
6934− from_crtc_state = intel_atomic_get_new_crtc_state(state,
6935− crtc_state->bigjoiner_linked_crtc);
5839+ master_crtc = intel_master_crtc(crtc_state);
5840+ master_crtc_state = intel_atomic_get_new_crtc_state(state, master_crtc);
69365841
6937− /* No need to copy state if the master state is unchanged */
6938− if (!from_crtc_state)
6939− return;
6940− }
6941−
6942− intel_crtc_copy_color_blobs(crtc_state, from_crtc_state);
5842+ /* No need to copy state if the master state is unchanged */
5843+ if (master_crtc_state)
5844+ intel_crtc_copy_color_blobs(crtc_state, master_crtc_state);
69435845 }
69445846
69455847 static void
@@ -6982,7 +5884,6 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state, · 36 unmodified lines
69825884 const struct intel_crtc_state *from_crtc_state)
69835885 {
69845886 struct intel_crtc_state *saved_state;
6985− struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
69865887
69875888 saved_state = kmemdup(from_crtc_state, sizeof(*saved_state), GFP_KERNEL);
69885889 if (!saved_state)
@@ -7012,8 +5913,8 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state, · 23 unmodified lines
70125913 crtc_state->nv12_planes = crtc_state->c8_planes = crtc_state->update_planes = 0;
70135914 crtc_state->bigjoiner_linked_crtc = to_intel_crtc(from_crtc_state->uapi.crtc);
70145915 crtc_state->bigjoiner_slave = true;
7015− crtc_state->cpu_transcoder = (enum transcoder)crtc->pipe;
7016− crtc_state->has_audio = false;
5916+ crtc_state->cpu_transcoder = from_crtc_state->cpu_transcoder;
5917+ crtc_state->has_audio = from_crtc_state->has_audio;
70175918
70185919 return 0;
70195920 }
@@ -7609,51 +6510,48 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 589 unmodified lines
76096510
76106511 PIPE_CONF_CHECK_X(output_types);
76116512
7612− /* FIXME do the readout properly and get rid of this quirk */
7613− if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
7614− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hdisplay);
7615− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_htotal);
7616− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_start);
7617− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_end);
7618− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_start);
7619− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_end);
7620−
7621− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vdisplay);
7622− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vtotal);
7623− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_start);
7624− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_end);
7625− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_start);
7626− PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_end);
7627−
7628− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
7629− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
7630− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
7631− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
7632− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
7633− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
7634−
7635− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
7636− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
7637− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
7638− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
7639− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
7640− PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
7641−
7642− PIPE_CONF_CHECK_I(pixel_multiplier);
7643−
6513+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hdisplay);
6514+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_htotal);
6515+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_start);
6516+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hblank_end);
6517+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_start);
6518+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_hsync_end);
6519+
6520+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vdisplay);
6521+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vtotal);
6522+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_start);
6523+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vblank_end);
6524+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_start);
6525+ PIPE_CONF_CHECK_I(hw.pipe_mode.crtc_vsync_end);
6526+
6527+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
6528+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
6529+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
6530+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
6531+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
6532+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
6533+
6534+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
6535+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
6536+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
6537+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
6538+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
6539+ PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
6540+
6541+ PIPE_CONF_CHECK_I(pixel_multiplier);
6542+
6543+ PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
6544+ DRM_MODE_FLAG_INTERLACE);
6545+
6546+ if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS)) {
76446547 PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
7645− DRM_MODE_FLAG_INTERLACE);
7646−
7647− if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS)) {
7648− PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
7649− DRM_MODE_FLAG_PHSYNC);
7650− PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
7651− DRM_MODE_FLAG_NHSYNC);
7652− PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
7653− DRM_MODE_FLAG_PVSYNC);
7654− PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
7655− DRM_MODE_FLAG_NVSYNC);
7656− }
6548+ DRM_MODE_FLAG_PHSYNC);
6549+ PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
6550+ DRM_MODE_FLAG_NHSYNC);
6551+ PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
6552+ DRM_MODE_FLAG_PVSYNC);
6553+ PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
6554+ DRM_MODE_FLAG_NVSYNC);
76576555 }
76586556
76596557 PIPE_CONF_CHECK_I(output_format);
@@ -7665,9 +6563,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 5 unmodified lines
76656563 PIPE_CONF_CHECK_BOOL(hdmi_scrambling);
76666564 PIPE_CONF_CHECK_BOOL(hdmi_high_tmds_clock_ratio);
76676565 PIPE_CONF_CHECK_BOOL(has_infoframe);
7668− /* FIXME do the readout properly and get rid of this quirk */
7669− if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE))
7670− PIPE_CONF_CHECK_BOOL(fec_enable);
6566+ PIPE_CONF_CHECK_BOOL(fec_enable);
76716567
76726568 PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
76736569
@@ -7696,9 +6592,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 22 unmodified lines
76966592 }
76976593
76986594 PIPE_CONF_CHECK_I(scaler_state.scaler_id);
7699− /* FIXME do the readout properly and get rid of this quirk */
7700− if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE))
7701− PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate);
6595+ PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate);
77026596
77036597 PIPE_CONF_CHECK_X(gamma_mode);
77046598 if (IS_CHERRYVIEW(dev_priv))
@@ -7725,11 +6619,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 20 unmodified lines
77256619
77266620 PIPE_CONF_CHECK_BOOL(double_wide);
77276621
7728− if (dev_priv->dpll.mgr)
6622+ if (dev_priv->dpll.mgr) {
77296623 PIPE_CONF_CHECK_P(shared_dpll);
77306624
7731− /* FIXME do the readout properly and get rid of this quirk */
7732− if (dev_priv->dpll.mgr && !PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
77336625 PIPE_CONF_CHECK_X(dpll_hw_state.dpll);
77346626 PIPE_CONF_CHECK_X(dpll_hw_state.dpll_md);
77356627 PIPE_CONF_CHECK_X(dpll_hw_state.fp0);
@@ -7763,19 +6655,17 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 27 unmodified lines
77636655 PIPE_CONF_CHECK_X(dpll_hw_state.mg_pll_tdc_coldst_bias);
77646656 }
77656657
7766− if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE)) {
7767− PIPE_CONF_CHECK_X(dsi_pll.ctrl);
7768− PIPE_CONF_CHECK_X(dsi_pll.div);
6658+ PIPE_CONF_CHECK_X(dsi_pll.ctrl);
6659+ PIPE_CONF_CHECK_X(dsi_pll.div);
77696660
7770− if (IS_G4X(dev_priv) || DISPLAY_VER(dev_priv) >= 5)
7771− PIPE_CONF_CHECK_I(pipe_bpp);
6661+ if (IS_G4X(dev_priv) || DISPLAY_VER(dev_priv) >= 5)
6662+ PIPE_CONF_CHECK_I(pipe_bpp);
77726663
7773− PIPE_CONF_CHECK_CLOCK_FUZZY(hw.pipe_mode.crtc_clock);
7774− PIPE_CONF_CHECK_CLOCK_FUZZY(hw.adjusted_mode.crtc_clock);
7775− PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
6664+ PIPE_CONF_CHECK_CLOCK_FUZZY(hw.pipe_mode.crtc_clock);
6665+ PIPE_CONF_CHECK_CLOCK_FUZZY(hw.adjusted_mode.crtc_clock);
6666+ PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
77766667
7777− PIPE_CONF_CHECK_I(min_voltage_level);
7778− }
6668+ PIPE_CONF_CHECK_I(min_voltage_level);
77796669
77806670 if (current_config->has_psr || pipe_config->has_psr)
77816671 PIPE_CONF_CHECK_X_WITH_MASK(infoframes.enable,
@@ -8049,7 +6939,7 @@ verify_crtc_state(struct intel_crtc *crtc, · 267 unmodified lines
80496939 struct intel_encoder *encoder;
80506940 struct intel_crtc_state *pipe_config = old_crtc_state;
80516941 struct drm_atomic_state *state = old_crtc_state->uapi.state;
8052− struct intel_crtc *master = crtc;
6942+ struct intel_crtc *master_crtc;
80536943
80546944 __drm_atomic_helper_crtc_destroy_state(&old_crtc_state->uapi);
80556945 intel_crtc_free_hw_state(old_crtc_state);
@@ -8077,10 +6967,9 @@ verify_crtc_state(struct intel_crtc *crtc, · 21 unmodified lines
80776967 "(expected %i, found %i)\n",
80786968 new_crtc_state->hw.active, crtc->active);
80796969
8080− if (new_crtc_state->bigjoiner_slave)
8081− master = new_crtc_state->bigjoiner_linked_crtc;
6970+ master_crtc = intel_master_crtc(new_crtc_state);
80826971
8083− for_each_encoder_on_crtc(dev, &master->base, encoder) {
6972+ for_each_encoder_on_crtc(dev, &master_crtc->base, encoder) {
80846973 enum pipe pipe;
80856974 bool active;
80866975
@@ -8090,7 +6979,7 @@ verify_crtc_state(struct intel_crtc *crtc, · 3 unmodified lines
80906979 encoder->base.base.id, active,
80916980 new_crtc_state->hw.active);
80926981
8093− I915_STATE_WARN(active && master->pipe != pipe,
6982+ I915_STATE_WARN(active && master_crtc->pipe != pipe,
80946983 "Encoder connected to wrong pipe %c\n",
80956984 pipe_name(pipe));
80966985
@@ -8101,10 +6990,6 @@ verify_crtc_state(struct intel_crtc *crtc, · 4 unmodified lines
81016990 if (!new_crtc_state->hw.active)
81026991 return;
81036992
8104− if (new_crtc_state->bigjoiner_slave)
8105− /* No PLLs set for slave */
8106− pipe_config->shared_dpll = NULL;
8107−
81086993 intel_pipe_config_sanity_check(dev_priv, pipe_config);
81096994
81106995 if (!intel_pipe_config_compare(new_crtc_state,
@@ -8223,9 +7108,6 @@ verify_mpllb_state(struct intel_atomic_state *state, · 112 unmodified lines
82237108 if (!new_crtc_state->hw.active)
82247109 return;
82257110
8226− if (new_crtc_state->bigjoiner_slave)
8227− return;
8228−
82297111 encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
82307112 intel_mpllb_readout_hw_state(encoder, &mpllb_hw_state);
82317113
@@ -8607,28 +7489,13 @@ static int intel_bigjoiner_add_affected_planes(struct intel_atomic_state *state) · 375 unmodified lines
86077489 return 0;
86087490 }
86097491
8610−static bool bo_has_valid_encryption(struct drm_i915_gem_object *obj)
8611−{
8612− struct drm_i915_private *i915 = to_i915(obj->base.dev);
8613−
8614− return intel_pxp_key_check(&i915->gt.pxp, obj, false) == 0;
8615−}
8616−
8617−static bool pxp_is_borked(struct drm_i915_gem_object *obj)
8618−{
8619− return i915_gem_object_is_protected(obj) && !bo_has_valid_encryption(obj);
8620−}
8621−
86227492 static int intel_atomic_check_planes(struct intel_atomic_state *state)
86237493 {
86247494 struct drm_i915_private *dev_priv = to_i915(state->base.dev);
86257495 struct intel_crtc_state *old_crtc_state, *new_crtc_state;
86267496 struct intel_plane_state *plane_state;
86277497 struct intel_plane *plane;
8628− struct intel_plane_state *new_plane_state;
8629− struct intel_plane_state *old_plane_state;
86307498 struct intel_crtc *crtc;
8631− const struct drm_framebuffer *fb;
86327499 int i, ret;
86337500
86347501 ret = icl_add_linked_planes(state);
@@ -8676,19 +7543,6 @@ static int intel_atomic_check_planes(struct intel_atomic_state *state) · 41 unmodified lines
86767543 return ret;
86777544 }
86787545
8679− for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
8680− new_plane_state = intel_atomic_get_new_plane_state(state, plane);
8681− old_plane_state = intel_atomic_get_old_plane_state(state, plane);
8682− fb = new_plane_state->hw.fb;
8683− if (fb) {
8684− new_plane_state->decrypt = bo_has_valid_encryption(intel_fb_obj(fb));
8685− new_plane_state->force_black = pxp_is_borked(intel_fb_obj(fb));
8686− } else {
8687− new_plane_state->decrypt = old_plane_state->decrypt;
8688− new_plane_state->force_black = old_plane_state->force_black;
8689− }
8690− }
8691−
86927546 return 0;
86937547 }
86947548
@@ -8790,13 +7644,13 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 95 unmodified lines
87907644 struct intel_crtc_state *new_crtc_state)
87917645 {
87927646 struct intel_crtc_state *slave_crtc_state, *master_crtc_state;
8793− struct intel_crtc *slave, *master;
7647+ struct intel_crtc *slave_crtc, *master_crtc;
87947648
87957649 /* slave being enabled, is master is still claiming this crtc? */
87967650 if (old_crtc_state->bigjoiner_slave) {
8797− slave = crtc;
8798− master = old_crtc_state->bigjoiner_linked_crtc;
8799− master_crtc_state = intel_atomic_get_new_crtc_state(state, master);
7651+ slave_crtc = crtc;
7652+ master_crtc = old_crtc_state->bigjoiner_linked_crtc;
7653+ master_crtc_state = intel_atomic_get_new_crtc_state(state, master_crtc);
88007654 if (!master_crtc_state || !intel_crtc_needs_modeset(master_crtc_state))
88017655 goto claimed;
88027656 }
@@ -8804,17 +7658,17 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 1 unmodified line
88047658 if (!new_crtc_state->bigjoiner)
88057659 return 0;
88067660
8807− slave = intel_dsc_get_bigjoiner_secondary(crtc);
8808− if (!slave) {
7661+ slave_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
7662+ if (!slave_crtc) {
88097663 DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration requires "
88107664 "CRTC + 1 to be used, doesn't exist\n",
88117665 crtc->base.base.id, crtc->base.name);
88127666 return -EINVAL;
88137667 }
88147668
8815− new_crtc_state->bigjoiner_linked_crtc = slave;
8816− slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave);
8817− master = crtc;
7669+ new_crtc_state->bigjoiner_linked_crtc = slave_crtc;
7670+ slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave_crtc);
7671+ master_crtc = crtc;
88187672 if (IS_ERR(slave_crtc_state))
88197673 return PTR_ERR(slave_crtc_state);
88207674
@@ -8823,15 +7677,15 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 2 unmodified lines
88237677 goto claimed;
88247678
88257679 DRM_DEBUG_KMS("[CRTC:%d:%s] Used as slave for big joiner\n",
8826− slave->base.base.id, slave->base.name);
7680+ slave_crtc->base.base.id, slave_crtc->base.name);
88277681
88287682 return copy_bigjoiner_crtc_state(slave_crtc_state, new_crtc_state);
88297683
88307684 claimed:
88317685 DRM_DEBUG_KMS("[CRTC:%d:%s] Slave is enabled as normal CRTC, but "
88327686 "[CRTC:%d:%s] claiming this CRTC for bigjoiner.\n",
8833− slave->base.base.id, slave->base.name,
8834− master->base.base.id, master->base.name);
7687+ slave_crtc->base.base.id, slave_crtc->base.name,
7688+ master_crtc->base.base.id, master_crtc->base.name);
88357689 return -EINVAL;
88367690 }
88377691
@@ -8865,35 +7719,37 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state, · 27 unmodified lines
88657719 * correspond to the last vblank and have no relation to the actual time when
88667720 * the flip done event was sent.
88677721 */
8868−static int intel_atomic_check_async(struct intel_atomic_state *state)
7722+static int intel_atomic_check_async(struct intel_atomic_state *state, struct intel_crtc *crtc)
88697723 {
88707724 struct drm_i915_private *i915 = to_i915(state->base.dev);
88717725 const struct intel_crtc_state *old_crtc_state, *new_crtc_state;
88727726 const struct intel_plane_state *new_plane_state, *old_plane_state;
8873− struct intel_crtc *crtc;
88747727 struct intel_plane *plane;
88757728 int i;
88767729
8877− for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
8878− new_crtc_state, i) {
8879− if (intel_crtc_needs_modeset(new_crtc_state)) {
8880− drm_dbg_kms(&i915->drm, "Modeset Required. Async flip not supported\n");
8881− return -EINVAL;
8882− }
7730+ old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
7731+ new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
88837732
8884− if (!new_crtc_state->hw.active) {
8885− drm_dbg_kms(&i915->drm, "CRTC inactive\n");
8886− return -EINVAL;
8887− }
8888− if (old_crtc_state->active_planes != new_crtc_state->active_planes) {
8889− drm_dbg_kms(&i915->drm,
8890− "Active planes cannot be changed during async flip\n");
8891− return -EINVAL;
8892− }
7733+ if (intel_crtc_needs_modeset(new_crtc_state)) {
7734+ drm_dbg_kms(&i915->drm, "Modeset Required. Async flip not supported\n");
7735+ return -EINVAL;
7736+ }
7737+
7738+ if (!new_crtc_state->hw.active) {
7739+ drm_dbg_kms(&i915->drm, "CRTC inactive\n");
7740+ return -EINVAL;
7741+ }
7742+ if (old_crtc_state->active_planes != new_crtc_state->active_planes) {
7743+ drm_dbg_kms(&i915->drm,
7744+ "Active planes cannot be changed during async flip\n");
7745+ return -EINVAL;
88937746 }
88947747
88957748 for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
88967749 new_plane_state, i) {
7750+ if (plane->pipe != crtc->pipe)
7751+ continue;
7752+
88977753 /*
88987754 * TODO: Async flip is only supported through the page flip IOCTL
88997755 * as of now. So support currently added for primary plane only.
@@ -8920,8 +7776,14 @@ static int intel_atomic_check_async(struct intel_atomic_state *state) · 20 unmodified lines
89207776 return -EINVAL;
89217777 }
89227778
8923− if (old_plane_state->view.color_plane[0].stride !=
8924− new_plane_state->view.color_plane[0].stride) {
7779+ if (new_plane_state->hw.fb->format->num_planes > 1) {
7780+ drm_dbg_kms(&i915->drm,
7781+ "Planar formats not supported with async flips\n");
7782+ return -EINVAL;
7783+ }
7784+
7785+ if (old_plane_state->view.color_plane[0].mapping_stride !=
7786+ new_plane_state->view.color_plane[0].mapping_stride) {
89257787 drm_dbg_kms(&i915->drm, "Stride cannot be changed in async flip\n");
89267788 return -EINVAL;
89277789 }
@@ -9212,7 +8074,7 @@ static int intel_atomic_check(struct drm_device *dev, · 284 unmodified lines
92128074 for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
92138075 new_crtc_state, i) {
92148076 if (new_crtc_state->uapi.async_flip) {
9215− ret = intel_atomic_check_async(state);
8077+ ret = intel_atomic_check_async(state, crtc);
92168078 if (ret)
92178079 goto fail;
92188080 }
@@ -9417,15 +8279,17 @@ static void intel_update_crtc(struct intel_atomic_state *state, · 198 unmodified lines
94178279
94188280 intel_fbc_update(state, crtc);
94198281
8282+ intel_update_planes_on_crtc(state, crtc);
8283+
94208284 /* Perform vblank evasion around commit operation */
94218285 intel_pipe_update_start(new_crtc_state);
94228286
94238287 commit_pipe_pre_planes(state, crtc);
94248288
94258289 if (DISPLAY_VER(dev_priv) >= 9)
9426− skl_update_planes_on_crtc(state, crtc);
8290+ skl_arm_planes_on_crtc(state, crtc);
94278291 else
9428− i9xx_update_planes_on_crtc(state, crtc);
8292+ i9xx_arm_planes_on_crtc(state, crtc);
94298293
94308294 commit_pipe_post_planes(state, crtc);
94318295
@@ -9449,23 +8313,6 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, · 17 unmodified lines
94498313 {
94508314 struct drm_i915_private *dev_priv = to_i915(state->base.dev);
94518315
9452− drm_WARN_ON(&dev_priv->drm, old_crtc_state->bigjoiner_slave);
9453−
9454− intel_encoders_pre_disable(state, crtc);
9455−
9456− intel_crtc_disable_planes(state, crtc);
9457−
9458− /*
9459− * We still need special handling for disabling bigjoiner master
9460− * and slaves since for slave we do not have encoder or plls
9461− * so we dont need to disable those.
9462− */
9463− if (old_crtc_state->bigjoiner) {
9464− intel_crtc_disable_planes(state,
9465− old_crtc_state->bigjoiner_linked_crtc);
9466− old_crtc_state->bigjoiner_linked_crtc->active = false;
9467− }
9468−
94698316 /*
94708317 * We need to disable pipe CRC before disabling the pipe,
94718318 * or we race against vblank off.
@@ -9490,10 +8337,22 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 18 unmodified lines
94908337 u32 handled = 0;
94918338 int i;
94928339
8340+ for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
8341+ new_crtc_state, i) {
8342+ if (!intel_crtc_needs_modeset(new_crtc_state))
8343+ continue;
8344+
8345+ if (!old_crtc_state->hw.active)
8346+ continue;
8347+
8348+ intel_pre_plane_update(state, crtc);
8349+ intel_crtc_disable_planes(state, crtc);
8350+ }
8351+
94938352 /* Only disable port sync and MST slaves */
94948353 for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
94958354 new_crtc_state, i) {
9496− if (!intel_crtc_needs_modeset(new_crtc_state) || old_crtc_state->bigjoiner)
8355+ if (!intel_crtc_needs_modeset(new_crtc_state))
94978356 continue;
94988357
94998358 if (!old_crtc_state->hw.active)
@@ -9505,10 +8364,10 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 5 unmodified lines
95058364 * Slave vblanks are masked till Master Vblanks.
95068365 */
95078366 if (!is_trans_port_sync_slave(old_crtc_state) &&
9508− !intel_dp_mst_is_slave_trans(old_crtc_state))
8367+ !intel_dp_mst_is_slave_trans(old_crtc_state) &&
8368+ !old_crtc_state->bigjoiner_slave)
95098369 continue;
95108370
9511− intel_pre_plane_update(state, crtc);
95128371 intel_old_crtc_state_disables(state, old_crtc_state,
95138372 new_crtc_state, crtc);
95148373 handled |= BIT(crtc->pipe);
@@ -9518,21 +8377,14 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 3 unmodified lines
95188377 for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
95198378 new_crtc_state, i) {
95208379 if (!intel_crtc_needs_modeset(new_crtc_state) ||
9521− (handled & BIT(crtc->pipe)) ||
9522− old_crtc_state->bigjoiner_slave)
8380+ (handled & BIT(crtc->pipe)))
95238381 continue;
95248382
9525− intel_pre_plane_update(state, crtc);
9526− if (old_crtc_state->bigjoiner) {
9527− struct intel_crtc *slave =
9528− old_crtc_state->bigjoiner_linked_crtc;
9529−
9530− intel_pre_plane_update(state, slave);
9531− }
8383+ if (!old_crtc_state->hw.active)
8384+ continue;
95328385
9533− if (old_crtc_state->hw.active)
9534− intel_old_crtc_state_disables(state, old_crtc_state,
9535− new_crtc_state, crtc);
8386+ intel_old_crtc_state_disables(state, old_crtc_state,
8387+ new_crtc_state, crtc);
95368388 }
95378389 }
95388390
@@ -9752,10 +8604,14 @@ static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *s · 213 unmodified lines
97528604
97538605 for_each_new_intel_plane_in_state(state, plane, plane_state, i) {
97548606 struct drm_framebuffer *fb = plane_state->hw.fb;
8607+ int cc_plane;
97558608 int ret;
97568609
9757− if (!fb ||
9758− fb->modifier != I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC)
8610+ if (!fb)
8611+ continue;
8612+
8613+ cc_plane = intel_fb_rc_ccs_cc_plane(fb);
8614+ if (cc_plane < 0)
97598615 continue;
97608616
97618617 /*
@@ -9772,7 +8628,7 @@ static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *s · 10 unmodified lines
97728628 * GPU write on it.
97738629 */
97748630 ret = i915_gem_object_read_from_page(intel_fb_obj(fb),
9775− fb->offsets[2] + 16,
8631+ fb->offsets[cc_plane] + 16,
97768632 &plane_state->ccval,
97778633 sizeof(plane_state->ccval));
97788634 /* The above could only fail if the FB obj has an unexpected backing store type. */
@@ -9840,11 +8696,9 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) · 61 unmodified lines
98408696 }
98418697 }
98428698
9843− if (state->modeset)
9844− intel_encoders_update_prepare(state);
8699+ intel_encoders_update_prepare(state);
98458700
98468701 intel_dbuf_pre_plane_update(state);
9847− intel_psr_pre_plane_update(state);
98488702
98498703 for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
98508704 if (new_crtc_state->uapi.async_flip)
@@ -9854,11 +8708,12 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) · 3 unmodified lines
98548708 /* Now enable the clocks, plane, pipe, and connectors that we set up. */
98558709 dev_priv->display->commit_modeset_enables(state);
98568710
9857− if (state->modeset) {
9858− intel_encoders_update_complete(state);
8711+ intel_encoders_update_complete(state);
98598712
8713+ if (state->modeset)
98608714 intel_set_cdclk_post_plane_update(state);
9861− }
8715+
8716+ intel_wait_for_vblank_workers(state);
98628717
98638718 /* FIXME: We should call drm_atomic_helper_commit_hw_done() here
98648719 * already, but still need the state for the delayed optimization. To
@@ -9874,13 +8729,6 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state) · 9 unmodified lines
98748729 for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
98758730 if (new_crtc_state->uapi.async_flip)
98768731 intel_crtc_disable_flip_done(state, crtc);
9877−
9878− if (new_crtc_state->hw.active &&
9879− !intel_crtc_needs_modeset(new_crtc_state) &&
9880− !new_crtc_state->preload_luts &&
9881− (new_crtc_state->uapi.color_mgmt_changed ||
9882− new_crtc_state->update_pipe))
9883− intel_color_load_luts(new_crtc_state);
98848732 }
98858733
98868734 /*
@@ -10580,7 +9428,7 @@ intel_mode_valid_max_plane_size(struct drm_i915_private *dev_priv, · 693 unmodified lines
105809428
105819429 static const struct drm_mode_config_funcs intel_mode_funcs = {
105829430 .fb_create = intel_user_framebuffer_create,
10583− .get_format_info = intel_get_format_info,
9431+ .get_format_info = intel_fb_get_format_info,
105849432 .output_poll_changed = intel_fbdev_output_poll_changed,
105859433 .mode_valid = intel_mode_valid,
105869434 .atomic_check = intel_atomic_check,
@@ -10640,7 +9488,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) · 53 unmodified lines
106409488 return;
106419489
106429490 intel_init_cdclk_hooks(dev_priv);
10643− intel_init_audio_hooks(dev_priv);
9491+ intel_audio_hooks_init(dev_priv);
106449492
106459493 intel_dpll_init_clock_hook(dev_priv);
106469494
@@ -11628,9 +10476,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) · 981 unmodified lines
1162810476 struct intel_plane *plane;
1162910477 int min_cdclk = 0;
1163010478
11631− if (crtc_state->bigjoiner_slave)
11632− continue;
11633−
1163410479 if (crtc_state->hw.active) {
1163510480 /*
1163610481 * The initial mode needs to be set in order to keep
@@ -11690,39 +10535,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) · 53 unmodified lines
1169010535 intel_bw_crtc_update(bw_state, crtc_state);
1169110536
1169210537 intel_pipe_config_sanity_check(dev_priv, crtc_state);
11693−
11694− /* discard our incomplete slave state, copy it from master */
11695− if (crtc_state->bigjoiner && crtc_state->hw.active) {
11696− struct intel_crtc *slave = crtc_state->bigjoiner_linked_crtc;
11697− struct intel_crtc_state *slave_crtc_state =
11698− to_intel_crtc_state(slave->base.state);
11699−
11700− copy_bigjoiner_crtc_state(slave_crtc_state, crtc_state);
11701− slave->base.mode = crtc->base.mode;
11702−
11703− cdclk_state->min_cdclk[slave->pipe] = min_cdclk;
11704− cdclk_state->min_voltage_level[slave->pipe] =
11705− crtc_state->min_voltage_level;
11706−
11707− for_each_intel_plane_on_crtc(&dev_priv->drm, slave, plane) {
11708− const struct intel_plane_state *plane_state =
11709− to_intel_plane_state(plane->base.state);
11710−
11711− /*
11712− * FIXME don't have the fb yet, so can't
11713− * use intel_plane_data_rate() :(
11714− */
11715− if (plane_state->uapi.visible)
11716− crtc_state->data_rate[plane->id] =
11717− 4 * crtc_state->pixel_rate;
11718− else
11719− crtc_state->data_rate[plane->id] = 0;
11720− }
11721−
11722− intel_bw_crtc_update(bw_state, slave_crtc_state);
11723− drm_calc_timestamping_constants(&slave->base,
11724− &slave_crtc_state->hw.adjusted_mode);
11725− }
1172610538 }
1172710539 }
1172810540
@@ -12027,7 +10839,7 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915) · 298 unmodified lines
1202710839 destroy_workqueue(i915->flip_wq);
1202810840 destroy_workqueue(i915->modeset_wq);
1202910841
12030− intel_fbc_cleanup_cfb(i915);
10842+ intel_fbc_cleanup(i915);
1203110843 }
1203210844
1203310845 /* part #3: call after gem init */
drivers/gpu/drm/i915/display/intel_display.h+4−13
@@ -521,7 +521,6 @@ void intel_link_compute_m_n(u16 bpp, int nlanes, · 520 unmodified lines
521521 int pixel_clock, int link_clock,
522522 struct intel_link_m_n *m_n,
523523 bool constant_n, bool fec_enable);
524−void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
525524 u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
526525 u32 pixel_format, u64 modifier);
527526 enum drm_mode_status
@@ -542,9 +541,6 @@ int vlv_get_cck_clock(struct drm_i915_private *dev_priv, · 14 unmodified lines
542541 const char *name, u32 reg, int ref_freq);
543542 int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv,
544543 const char *name, u32 reg);
545−void lpt_pch_enable(const struct intel_crtc_state *crtc_state);
546−void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv);
547−void lpt_disable_iclkip(struct drm_i915_private *dev_priv);
548544 void intel_init_display_hooks(struct drm_i915_private *dev_priv);
549545 unsigned int intel_fb_xy_to_linear(int x, int y,
550546 const struct intel_plane_state *state,
@@ -580,10 +576,6 @@ struct drm_framebuffer * · 29 unmodified lines
580576 intel_framebuffer_create(struct drm_i915_gem_object *obj,
581577 struct drm_mode_fb_cmd2 *mode_cmd);
582578
583−void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
584− enum pipe pipe);
585−
586−int lpt_get_iclkip(struct drm_i915_private *dev_priv);
587579 bool intel_fuzzy_clock_check(int clock1, int clock2);
588580
589581 void intel_display_prepare_reset(struct drm_i915_private *dev_priv);
@@ -592,8 +584,11 @@ void intel_dp_get_m_n(struct intel_crtc *crtc, · 2 unmodified lines
592584 struct intel_crtc_state *pipe_config);
593585 void intel_dp_set_m_n(const struct intel_crtc_state *crtc_state,
594586 enum link_m_n_set m_n);
587+void ilk_get_fdi_m_n_config(struct intel_crtc *crtc,
588+ struct intel_crtc_state *pipe_config);
589+void i9xx_crtc_clock_get(struct intel_crtc *crtc,
590+ struct intel_crtc_state *pipe_config);
595591 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
596−
597592 bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state);
598593 void hsw_enable_ips(const struct intel_crtc_state *crtc_state);
599594 void hsw_disable_ips(const struct intel_crtc_state *crtc_state);
@@ -610,9 +605,6 @@ int bdw_get_pipemisc_bpp(struct intel_crtc *crtc); · 10 unmodified lines
610605 unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state);
611606
612607 bool intel_plane_uses_fence(const struct intel_plane_state *plane_state);
613−bool
614−intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
615− u64 modifier);
616608
617609 struct intel_encoder *
618610 intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
@@ -632,7 +624,6 @@ void intel_modeset_driver_remove(struct drm_i915_private *i915); · 13 unmodified lines
632624 void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915);
633625 void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915);
634626 void intel_display_resume(struct drm_device *dev);
635−void intel_init_pch_refclk(struct drm_i915_private *dev_priv);
636627 int intel_modeset_all_pipes(struct intel_atomic_state *state);
637628
638629 /* modesetting asserts */
drivers/gpu/drm/i915/display/intel_display_debugfs.c+9−60
@@ -52,27 +52,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused) · 51 unmodified lines
5252 wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
5353 mutex_lock(&fbc->lock);
5454
55− if (intel_fbc_is_active(dev_priv))
55+ if (intel_fbc_is_active(fbc)) {
5656 seq_puts(m, "FBC enabled\n");
57− else
57+ seq_printf(m, "Compressing: %s\n",
58+ yesno(intel_fbc_is_compressing(fbc)));
59+ } else {
5860 seq_printf(m, "FBC disabled: %s\n", fbc->no_fbc_reason);
59−
60− if (intel_fbc_is_active(dev_priv)) {
61− u32 mask;
62−
63− if (DISPLAY_VER(dev_priv) >= 8)
64− mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK;
65− else if (DISPLAY_VER(dev_priv) >= 7)
66− mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK;
67− else if (DISPLAY_VER(dev_priv) >= 5)
68− mask = intel_de_read(dev_priv, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK;
69− else if (IS_G4X(dev_priv))
70− mask = intel_de_read(dev_priv, DPFC_STATUS) & DPFC_COMP_SEG_MASK;
71− else
72− mask = intel_de_read(dev_priv, FBC_STATUS) &
73− (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED);
74−
75− seq_printf(m, "Compressing: %s\n", yesno(mask));
7661 }
7762
7863 mutex_unlock(&fbc->lock);
@@ -85,9 +70,6 @@ static int i915_fbc_false_color_get(void *data, u64 *val) · 6 unmodified lines
8570 {
8671 struct drm_i915_private *dev_priv = data;
8772
88− if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv))
89− return -ENODEV;
90−
9173 *val = dev_priv->fbc.false_color;
9274
9375 return 0;
@@ -96,21 +78,8 @@ static int i915_fbc_false_color_get(void *data, u64 *val) · 2 unmodified lines
9678 static int i915_fbc_false_color_set(void *data, u64 val)
9779 {
9880 struct drm_i915_private *dev_priv = data;
99− u32 reg;
100−
101− if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv))
102− return -ENODEV;
103−
104− mutex_lock(&dev_priv->fbc.lock);
105−
106− reg = intel_de_read(dev_priv, ILK_DPFC_CONTROL);
107− dev_priv->fbc.false_color = val;
10881
109− intel_de_write(dev_priv, ILK_DPFC_CONTROL,
110− val ? (reg | FBC_CTL_FALSE_COLOR) : (reg & ~FBC_CTL_FALSE_COLOR));
111−
112− mutex_unlock(&dev_priv->fbc.lock);
113− return 0;
82+ return intel_fbc_set_false_color(&dev_priv->fbc, val);
11483 }
11584
11685 DEFINE_SIMPLE_ATTRIBUTE(i915_fbc_false_color_fops,
@@ -303,8 +272,7 @@ psr_source_status(struct intel_dp *intel_dp, struct seq_file *m) · 186 unmodified lines
303272 };
304273 val = intel_de_read(dev_priv,
305274 EDP_PSR2_STATUS(intel_dp->psr.transcoder));
306− status_val = (val & EDP_PSR2_STATUS_STATE_MASK) >>
307− EDP_PSR2_STATUS_STATE_SHIFT;
275+ status_val = REG_FIELD_GET(EDP_PSR2_STATUS_STATE_MASK, val);
308276 if (status_val < ARRAY_SIZE(live_status))
309277 status = live_status[status_val];
310278 } else {
@@ -503,28 +471,9 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_edp_psr_debug_fops, · 192 unmodified lines
503471
504472 static int i915_power_domain_info(struct seq_file *m, void *unused)
505473 {
506− struct drm_i915_private *dev_priv = node_to_i915(m->private);
507− struct i915_power_domains *power_domains = &dev_priv->power_domains;
508− int i;
509−
510− mutex_lock(&power_domains->lock);
511−
512− seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count");
513− for (i = 0; i < power_domains->power_well_count; i++) {
514− struct i915_power_well *power_well;
515− enum intel_display_power_domain power_domain;
516−
517− power_well = &power_domains->power_wells[i];
518− seq_printf(m, "%-25s %d\n", power_well->desc->name,
519− power_well->count);
520−
521− for_each_power_domain(power_domain, power_well->desc->domains)
522− seq_printf(m, " %-23s %d\n",
523− intel_display_power_domain_str(power_domain),
524− power_domains->domain_use_count[power_domain]);
525− }
474+ struct drm_i915_private *i915 = node_to_i915(m->private);
526475
527− mutex_unlock(&power_domains->lock);
476+ intel_display_power_debug(i915, m);
528477
529478 return 0;
530479 }
@@ -2095,7 +2044,7 @@ i915_fifo_underrun_reset_write(struct file *filp, · 1564 unmodified lines
20952044 return ret;
20962045 }
20972046
2098− ret = intel_fbc_reset_underrun(dev_priv);
2047+ ret = intel_fbc_reset_underrun(&dev_priv->fbc);
20992048 if (ret)
21002049 return ret;
21012050
drivers/gpu/drm/i915/display/intel_display_power.c+128−4
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include "intel_dpio_phy.h"
1616 #include "intel_dpll.h"
1717 #include "intel_hotplug.h"
18+#include "intel_pch_refclk.h"
1819 #include "intel_pcode.h"
1920 #include "intel_pm.h"
2021 #include "intel_pps.h"
@@ -23,6 +24,98 @@ · 2 unmodified lines
2324 #include "intel_vga.h"
2425 #include "vlv_sideband.h"
2526
27+struct i915_power_well_ops {
28+ /*
29+ * Synchronize the well's hw state to match the current sw state, for
30+ * example enable/disable it based on the current refcount. Called
31+ * during driver init and resume time, possibly after first calling
32+ * the enable/disable handlers.
33+ */
34+ void (*sync_hw)(struct drm_i915_private *dev_priv,
35+ struct i915_power_well *power_well);
36+ /*
37+ * Enable the well and resources that depend on it (for example
38+ * interrupts located on the well). Called after the 0->1 refcount
39+ * transition.
40+ */
41+ void (*enable)(struct drm_i915_private *dev_priv,
42+ struct i915_power_well *power_well);
43+ /*
44+ * Disable the well and resources that depend on it. Called after
45+ * the 1->0 refcount transition.
46+ */
47+ void (*disable)(struct drm_i915_private *dev_priv,
48+ struct i915_power_well *power_well);
49+ /* Returns the hw enabled state. */
50+ bool (*is_enabled)(struct drm_i915_private *dev_priv,
51+ struct i915_power_well *power_well);
52+};
53+
54+struct i915_power_well_regs {
55+ i915_reg_t bios;
56+ i915_reg_t driver;
57+ i915_reg_t kvmr;
58+ i915_reg_t debug;
59+};
60+
61+/* Power well structure for haswell */
62+struct i915_power_well_desc {
63+ const char *name;
64+ bool always_on;
65+ u64 domains;
66+ /* unique identifier for this power well */
67+ enum i915_power_well_id id;
68+ /*
69+ * Arbitraty data associated with this power well. Platform and power
70+ * well specific.
71+ */
72+ union {
73+ struct {
74+ /*
75+ * request/status flag index in the PUNIT power well
76+ * control/status registers.
77+ */
78+ u8 idx;
79+ } vlv;
80+ struct {
81+ enum dpio_phy phy;
82+ } bxt;
83+ struct {
84+ const struct i915_power_well_regs *regs;
85+ /*
86+ * request/status flag index in the power well
87+ * constrol/status registers.
88+ */
89+ u8 idx;
90+ /* Mask of pipes whose IRQ logic is backed by the pw */
91+ u8 irq_pipe_mask;
92+ /*
93+ * Instead of waiting for the status bit to ack enables,
94+ * just wait a specific amount of time and then consider
95+ * the well enabled.
96+ */
97+ u16 fixed_enable_delay;
98+ /* The pw is backing the VGA functionality */
99+ bool has_vga:1;
100+ bool has_fuses:1;
101+ /*
102+ * The pw is for an ICL+ TypeC PHY port in
103+ * Thunderbolt mode.
104+ */
105+ bool is_tc_tbt:1;
106+ } hsw;
107+ };
108+ const struct i915_power_well_ops *ops;
109+};
110+
111+struct i915_power_well {
112+ const struct i915_power_well_desc *desc;
113+ /* power well enable/disable usage count */
114+ int count;
115+ /* cached hw enabled state */
116+ bool hw_enabled;
117+};
118+
26119 bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv,
27120 enum i915_power_well_id power_well_id);
28121
@@ -154,8 +247,8 @@ intel_display_power_domain_str(enum intel_display_power_domain domain) · 125 unmodified lines
154247 return "MODESET";
155248 case POWER_DOMAIN_GT_IRQ:
156249 return "GT_IRQ";
157− case POWER_DOMAIN_DPLL_DC_OFF:
158− return "DPLL_DC_OFF";
250+ case POWER_DOMAIN_DC_OFF:
251+ return "DC_OFF";
159252 case POWER_DOMAIN_TC_COLD_OFF:
160253 return "TC_COLD_OFF";
161254 default:
@@ -434,6 +527,11 @@ static void hsw_power_well_enable(struct drm_i915_private *dev_priv, · 272 unmodified lines
434527
435528 pg = DISPLAY_VER(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) :
436529 SKL_PW_CTL_IDX_TO_PG(pw_idx);
530+
531+ /* Wa_16013190616:adlp */
532+ if (IS_ALDERLAKE_P(dev_priv) && pg == SKL_PG1)
533+ intel_de_rmw(dev_priv, GEN8_CHICKEN_DCPR_1, 0, DISABLE_FLR_SRC);
534+
437535 /*
438536 * For PW1 we have to wait both for the PW0/PG0 fuse state
439537 * before enabling the power well and PW1/PG1's own fuse
@@ -894,7 +992,7 @@ static u32 · 454 unmodified lines
894992 sanitize_target_dc_state(struct drm_i915_private *dev_priv,
895993 u32 target_dc_state)
896994 {
897− u32 states[] = {
995+ static const u32 states[] = {
898996 DC_STATE_EN_UPTO_DC6,
899997 DC_STATE_EN_UPTO_DC5,
900998 DC_STATE_EN_DC3CO,
@@ -2802,7 +2900,7 @@ intel_display_power_put_mask_in_set(struct drm_i915_private *i915, · 1901 unmodified lines
28022900 ICL_PW_2_POWER_DOMAINS | \
28032901 BIT_ULL(POWER_DOMAIN_MODESET) | \
28042902 BIT_ULL(POWER_DOMAIN_AUX_A) | \
2805− BIT_ULL(POWER_DOMAIN_DPLL_DC_OFF) | \
2903+ BIT_ULL(POWER_DOMAIN_DC_OFF) | \
28062904 BIT_ULL(POWER_DOMAIN_INIT))
28072905
28082906 #define ICL_DDI_IO_A_POWER_DOMAINS ( \
@@ -3105,6 +3203,7 @@ intel_display_power_put_mask_in_set(struct drm_i915_private *i915, · 296 unmodified lines
31053203 BIT_ULL(POWER_DOMAIN_MODESET) | \
31063204 BIT_ULL(POWER_DOMAIN_AUX_A) | \
31073205 BIT_ULL(POWER_DOMAIN_AUX_B) | \
3206+ BIT_ULL(POWER_DOMAIN_PORT_DSI) | \
31083207 BIT_ULL(POWER_DOMAIN_INIT))
31093208
31103209 #define XELPD_AUX_IO_D_XELPD_POWER_DOMAINS BIT_ULL(POWER_DOMAIN_AUX_D_XELPD)
@@ -6390,3 +6489,28 @@ void intel_display_power_resume(struct drm_i915_private *i915) · 3279 unmodified lines
63906489 hsw_disable_pc8(i915);
63916490 }
63926491 }
6492+
6493+void intel_display_power_debug(struct drm_i915_private *i915, struct seq_file *m)
6494+{
6495+ struct i915_power_domains *power_domains = &i915->power_domains;
6496+ int i;
6497+
6498+ mutex_lock(&power_domains->lock);
6499+
6500+ seq_printf(m, "%-25s %s\n", "Power well/domain", "Use count");
6501+ for (i = 0; i < power_domains->power_well_count; i++) {
6502+ struct i915_power_well *power_well;
6503+ enum intel_display_power_domain power_domain;
6504+
6505+ power_well = &power_domains->power_wells[i];
6506+ seq_printf(m, "%-25s %d\n", power_well->desc->name,
6507+ power_well->count);
6508+
6509+ for_each_power_domain(power_domain, power_well->desc->domains)
6510+ seq_printf(m, " %-23s %d\n",
6511+ intel_display_power_domain_str(power_domain),
6512+ power_domains->domain_use_count[power_domain]);
6513+ }
6514+
6515+ mutex_unlock(&power_domains->lock);
6516+}
drivers/gpu/drm/i915/display/intel_display_power.h+6−96
@@ -6,11 +6,13 @@ · 5 unmodified lines
66 #ifndef __INTEL_DISPLAY_POWER_H__
77 #define __INTEL_DISPLAY_POWER_H__
88
9−#include "intel_display.h"
109 #include "intel_runtime_pm.h"
1110 #include "i915_reg.h"
1211
12+enum dpio_channel;
13+enum dpio_phy;
1314 struct drm_i915_private;
15+struct i915_power_well;
1416 struct intel_encoder;
1517
1618 enum intel_display_power_domain {
@@ -117,7 +119,7 @@ enum intel_display_power_domain { · 100 unmodified lines
117119 POWER_DOMAIN_GMBUS,
118120 POWER_DOMAIN_MODESET,
119121 POWER_DOMAIN_GT_IRQ,
120− POWER_DOMAIN_DPLL_DC_OFF,
122+ POWER_DOMAIN_DC_OFF,
121123 POWER_DOMAIN_TC_COLD_OFF,
122124 POWER_DOMAIN_INIT,
123125
@@ -155,100 +157,6 @@ enum i915_power_well_id { · 31 unmodified lines
155157 ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \
156158 (tran) + POWER_DOMAIN_TRANSCODER_A)
157159
158−struct i915_power_well;
159−
160−struct i915_power_well_ops {
161− /*
162− * Synchronize the well's hw state to match the current sw state, for
163− * example enable/disable it based on the current refcount. Called
164− * during driver init and resume time, possibly after first calling
165− * the enable/disable handlers.
166− */
167− void (*sync_hw)(struct drm_i915_private *dev_priv,
168− struct i915_power_well *power_well);
169− /*
170− * Enable the well and resources that depend on it (for example
171− * interrupts located on the well). Called after the 0->1 refcount
172− * transition.
173− */
174− void (*enable)(struct drm_i915_private *dev_priv,
175− struct i915_power_well *power_well);
176− /*
177− * Disable the well and resources that depend on it. Called after
178− * the 1->0 refcount transition.
179− */
180− void (*disable)(struct drm_i915_private *dev_priv,
181− struct i915_power_well *power_well);
182− /* Returns the hw enabled state. */
183− bool (*is_enabled)(struct drm_i915_private *dev_priv,
184− struct i915_power_well *power_well);
185−};
186−
187−struct i915_power_well_regs {
188− i915_reg_t bios;
189− i915_reg_t driver;
190− i915_reg_t kvmr;
191− i915_reg_t debug;
192−};
193−
194−/* Power well structure for haswell */
195−struct i915_power_well_desc {
196− const char *name;
197− bool always_on;
198− u64 domains;
199− /* unique identifier for this power well */
200− enum i915_power_well_id id;
201− /*
202− * Arbitraty data associated with this power well. Platform and power
203− * well specific.
204− */
205− union {
206− struct {
207− /*
208− * request/status flag index in the PUNIT power well
209− * control/status registers.
210− */
211− u8 idx;
212− } vlv;
213− struct {
214− enum dpio_phy phy;
215− } bxt;
216− struct {
217− const struct i915_power_well_regs *regs;
218− /*
219− * request/status flag index in the power well
220− * constrol/status registers.
221− */
222− u8 idx;
223− /* Mask of pipes whose IRQ logic is backed by the pw */
224− u8 irq_pipe_mask;
225− /*
226− * Instead of waiting for the status bit to ack enables,
227− * just wait a specific amount of time and then consider
228− * the well enabled.
229− */
230− u16 fixed_enable_delay;
231− /* The pw is backing the VGA functionality */
232− bool has_vga:1;
233− bool has_fuses:1;
234− /*
235− * The pw is for an ICL+ TypeC PHY port in
236− * Thunderbolt mode.
237− */
238− bool is_tc_tbt:1;
239− } hsw;
240− };
241− const struct i915_power_well_ops *ops;
242−};
243−
244−struct i915_power_well {
245− const struct i915_power_well_desc *desc;
246− /* power well enable/disable usage count */
247− int count;
248− /* cached hw enabled state */
249− bool hw_enabled;
250−};
251−
252160 struct i915_power_domains {
253161 /*
254162 * Power wells needed for initialization at driver init and suspend
@@ -391,6 +299,8 @@ intel_display_power_put_all_in_set(struct drm_i915_private *i915, · 136 unmodified lines
391299 intel_display_power_put_mask_in_set(i915, power_domain_set, power_domain_set->mask);
392300 }
393301
302+void intel_display_power_debug(struct drm_i915_private *i915, struct seq_file *m);
303+
394304 /*
395305 * FIXME: We should probably switch this to a 0-based scheme to be consistent
396306 * with how we now name/number DBUF_CTL instances.
drivers/gpu/drm/i915/display/intel_display_types.h+24−27
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828
2929 #include <linux/async.h>
3030 #include <linux/i2c.h>
31+#include <linux/pm_qos.h>
3132 #include <linux/pwm.h>
3233 #include <linux/sched/clock.h>
3334
@@ -41,6 +42,7 @@ · 7 unmodified lines
4142 #include <drm/drm_probe_helper.h>
4243 #include <drm/drm_rect.h>
4344 #include <drm/drm_vblank.h>
45+#include <drm/drm_vblank_work.h>
4446 #include <drm/i915_mei_hdcp_interface.h>
4547 #include <media/cec-notifier.h>
4648
@@ -49,6 +51,7 @@ · 2 unmodified lines
4951 struct drm_printer;
5052 struct __intel_global_objs_state;
5153 struct intel_ddi_buf_trans;
54+struct intel_fbc;
5255
5356 /*
5457 * Display related stuff
@@ -115,7 +118,8 @@ struct intel_fb_view { · 60 unmodified lines
115118 * bytes for 0/180 degree rotation
116119 * pixels for 90/270 degree rotation
117120 */
118− unsigned int stride;
121+ unsigned int mapping_stride;
122+ unsigned int scanout_stride;
119123 } color_plane[4];
120124 };
121125
@@ -194,10 +198,6 @@ struct intel_encoder { · 72 unmodified lines
194198 void (*update_complete)(struct intel_atomic_state *,
195199 struct intel_encoder *,
196200 struct intel_crtc *);
197− void (*pre_disable)(struct intel_atomic_state *,
198− struct intel_encoder *,
199− const struct intel_crtc_state *,
200− const struct drm_connector_state *);
201201 void (*disable)(struct intel_atomic_state *,
202202 struct intel_encoder *,
203203 const struct intel_crtc_state *,
@@ -949,7 +949,6 @@ struct intel_crtc_state { · 745 unmodified lines
949949 * accordingly.
950950 */
951951 #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
952−#define PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE (1<<1) /* bigjoiner slave, partial readout */
953952 unsigned long quirks;
954953
955954 unsigned fb_bits; /* framebuffers to flip */
@@ -1241,6 +1240,9 @@ struct intel_crtc_state { · 285 unmodified lines
12411240 u8 link_count;
12421241 u8 pixel_overlap;
12431242 } splitter;
1243+
1244+ /* for loading single buffered registers during vblank */
1245+ struct drm_vblank_work vblank_work;
12441246 };
12451247
12461248 enum intel_pipe_crc_source {
@@ -1325,6 +1327,9 @@ struct intel_crtc { · 78 unmodified lines
13251327 /* scalers available on this crtc */
13261328 int num_scalers;
13271329
1330+ /* for loading single buffered registers during vblank */
1331+ struct pm_qos_request vblank_pm_qos;
1332+
13281333 #ifdef CONFIG_DEBUG_FS
13291334 struct intel_pipe_crc pipe_crc;
13301335 #endif
@@ -1335,8 +1340,6 @@ struct intel_plane { · 4 unmodified lines
13351340 enum i9xx_plane_id i9xx_plane;
13361341 enum plane_id id;
13371342 enum pipe pipe;
1338− bool has_fbc;
1339− bool has_ccs;
13401343 bool need_async_flip_disable_wa;
13411344 u32 frontbuffer_bit;
13421345
@@ -1344,6 +1347,8 @@ struct intel_plane { · 1 unmodified line
13441347 u32 base, cntl, size;
13451348 } cursor;
13461349
1350+ struct intel_fbc *fbc;
1351+
13471352 /*
13481353 * NOTE: Do not place new plane state fields here (e.g., when adding
13491354 * new plane properties). New runtime state should now be placed in
@@ -1362,11 +1367,17 @@ struct intel_plane { · 12 unmodified lines
13621367 unsigned int (*max_stride)(struct intel_plane *plane,
13631368 u32 pixel_format, u64 modifier,
13641369 unsigned int rotation);
1365− void (*update_plane)(struct intel_plane *plane,
1370+ /* Write all non-self arming plane registers */
1371+ void (*update_noarm)(struct intel_plane *plane,
13661372 const struct intel_crtc_state *crtc_state,
13671373 const struct intel_plane_state *plane_state);
1368− void (*disable_plane)(struct intel_plane *plane,
1369− const struct intel_crtc_state *crtc_state);
1374+ /* Write all self-arming plane registers */
1375+ void (*update_arm)(struct intel_plane *plane,
1376+ const struct intel_crtc_state *crtc_state,
1377+ const struct intel_plane_state *plane_state);
1378+ /* Disable the plane, must arm */
1379+ void (*disable_arm)(struct intel_plane *plane,
1380+ const struct intel_crtc_state *crtc_state);
13701381 bool (*get_hw_state)(struct intel_plane *plane, enum pipe *pipe);
13711382 int (*check_plane)(struct intel_crtc_state *crtc_state,
13721383 struct intel_plane_state *plane_state);
@@ -1563,6 +1574,8 @@ struct intel_dp { · 190 unmodified lines
15631574 int num_sink_rates;
15641575 int sink_rates[DP_MAX_SUPPORTED_RATES];
15651576 bool use_rate_select;
1577+ /* Max sink lane count as reported by DP_MAX_LANE_COUNT */
1578+ int max_sink_lane_count;
15661579 /* intersection of source and sink rates */
15671580 int num_common_rates;
15681581 int common_rates[DP_MAX_SUPPORTED_RATES];
@@ -2041,20 +2054,4 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) · 472 unmodified lines
20412054 return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
20422055 }
20432056
2044−static inline bool is_ccs_modifier(u64 modifier)
2045−{
2046− return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
2047− modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC ||
2048− modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS ||
2049− modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
2050− modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
2051−}
2052−
2053−static inline bool is_gen12_ccs_modifier(u64 modifier)
2054−{
2055− return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
2056− modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC ||
2057− modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS;
2058−}
2059−
20602057 #endif /* __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_dmc.h+2−0
@@ -20,6 +20,8 @@ enum { · 19 unmodified lines
2020 DMC_FW_MAIN = 0,
2121 DMC_FW_PIPEA,
2222 DMC_FW_PIPEB,
23+ DMC_FW_PIPEC,
24+ DMC_FW_PIPED,
2325 DMC_FW_MAX
2426 };
2527
drivers/gpu/drm/i915/display/intel_dp.c+125−36
@@ -127,7 +127,7 @@ static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp) · 126 unmodified lines
127127 }
128128
129129 /* update sink rates from dpcd */
130−static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
130+static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp)
131131 {
132132 static const int dp_rates[] = {
133133 162000, 270000, 540000, 810000
@@ -197,6 +197,54 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp) · 63 unmodified lines
197197 intel_dp->num_sink_rates = i;
198198 }
199199
200+static void intel_dp_set_sink_rates(struct intel_dp *intel_dp)
201+{
202+ struct intel_connector *connector = intel_dp->attached_connector;
203+ struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
204+ struct intel_encoder *encoder = &intel_dig_port->base;
205+
206+ intel_dp_set_dpcd_sink_rates(intel_dp);
207+
208+ if (intel_dp->num_sink_rates)
209+ return;
210+
211+ drm_err(&dp_to_i915(intel_dp)->drm,
212+ "[CONNECTOR:%d:%s][ENCODER:%d:%s] Invalid DPCD with no link rates, using defaults\n",
213+ connector->base.base.id, connector->base.name,
214+ encoder->base.base.id, encoder->base.name);
215+
216+ intel_dp_set_default_sink_rates(intel_dp);
217+}
218+
219+static void intel_dp_set_default_max_sink_lane_count(struct intel_dp *intel_dp)
220+{
221+ intel_dp->max_sink_lane_count = 1;
222+}
223+
224+static void intel_dp_set_max_sink_lane_count(struct intel_dp *intel_dp)
225+{
226+ struct intel_connector *connector = intel_dp->attached_connector;
227+ struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
228+ struct intel_encoder *encoder = &intel_dig_port->base;
229+
230+ intel_dp->max_sink_lane_count = drm_dp_max_lane_count(intel_dp->dpcd);
231+
232+ switch (intel_dp->max_sink_lane_count) {
233+ case 1:
234+ case 2:
235+ case 4:
236+ return;
237+ }
238+
239+ drm_err(&dp_to_i915(intel_dp)->drm,
240+ "[CONNECTOR:%d:%s][ENCODER:%d:%s] Invalid DPCD max lane count (%d), using default\n",
241+ connector->base.base.id, connector->base.name,
242+ encoder->base.base.id, encoder->base.name,
243+ intel_dp->max_sink_lane_count);
244+
245+ intel_dp_set_default_max_sink_lane_count(intel_dp);
246+}
247+
200248 /* Get length of rates array potentially limited by max_rate. */
201249 static int intel_dp_rate_limit_len(const int *rates, int len, int max_rate)
202250 {
@@ -219,10 +267,19 @@ static int intel_dp_common_len_rate_limit(const struct intel_dp *intel_dp, · 16 unmodified lines
219267 intel_dp->num_common_rates, max_rate);
220268 }
221269
270+static int intel_dp_common_rate(struct intel_dp *intel_dp, int index)
271+{
272+ if (drm_WARN_ON(&dp_to_i915(intel_dp)->drm,
273+ index < 0 || index >= intel_dp->num_common_rates))
274+ return 162000;
275+
276+ return intel_dp->common_rates[index];
277+}
278+
222279 /* Theoretical max between source and sink */
223280 static int intel_dp_max_common_rate(struct intel_dp *intel_dp)
224281 {
225− return intel_dp->common_rates[intel_dp->num_common_rates - 1];
282+ return intel_dp_common_rate(intel_dp, intel_dp->num_common_rates - 1);
226283 }
227284
228285 /* Theoretical max between source and sink */
@@ -230,7 +287,7 @@ static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) · 1 unmodified line
230287 {
231288 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
232289 int source_max = dig_port->max_lanes;
233− int sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
290+ int sink_max = intel_dp->max_sink_lane_count;
234291 int fia_max = intel_tc_port_fia_max_lane_count(dig_port);
235292 int lttpr_max = drm_dp_lttpr_max_lane_count(intel_dp->lttpr_common_caps);
236293
@@ -242,7 +299,15 @@ static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) · 5 unmodified lines
242299
243300 int intel_dp_max_lane_count(struct intel_dp *intel_dp)
244301 {
245− return intel_dp->max_link_lane_count;
302+ switch (intel_dp->max_link_lane_count) {
303+ case 1:
304+ case 2:
305+ case 4:
306+ return intel_dp->max_link_lane_count;
307+ default:
308+ MISSING_CASE(intel_dp->max_link_lane_count);
309+ return 1;
310+ }
246311 }
247312
248313 /*
@@ -554,13 +619,13 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · 305 unmodified lines
554619 if (index > 0) {
555620 if (intel_dp_is_edp(intel_dp) &&
556621 !intel_dp_can_link_train_fallback_for_edp(intel_dp,
557− intel_dp->common_rates[index - 1],
622+ intel_dp_common_rate(intel_dp, index - 1),
558623 lane_count)) {
559624 drm_dbg_kms(&i915->drm,
560625 "Retrying Link training for eDP with same parameters\n");
561626 return 0;
562627 }
563− intel_dp->max_link_rate = intel_dp->common_rates[index - 1];
628+ intel_dp->max_link_rate = intel_dp_common_rate(intel_dp, index - 1);
564629 intel_dp->max_link_lane_count = lane_count;
565630 } else if (lane_count > 1) {
566631 if (intel_dp_is_edp(intel_dp) &&
@@ -1000,14 +1065,11 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) · 433 unmodified lines
10001065 int
10011066 intel_dp_max_link_rate(struct intel_dp *intel_dp)
10021067 {
1003− struct drm_i915_private *i915 = dp_to_i915(intel_dp);
10041068 int len;
10051069
10061070 len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->max_link_rate);
1007− if (drm_WARN_ON(&i915->drm, len <= 0))
1008− return 162000;
10091071
1010− return intel_dp->common_rates[len - 1];
1072+ return intel_dp_common_rate(intel_dp, len - 1);
10111073 }
10121074
10131075 int intel_dp_rate_select(struct intel_dp *intel_dp, int rate)
@@ -1204,7 +1266,7 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, · 190 unmodified lines
12041266 output_bpp);
12051267
12061268 for (i = 0; i < intel_dp->num_common_rates; i++) {
1207− link_rate = intel_dp->common_rates[i];
1269+ link_rate = intel_dp_common_rate(intel_dp, i);
12081270 if (link_rate < limits->min_rate ||
12091271 link_rate > limits->max_rate)
12101272 continue;
@@ -1283,7 +1345,7 @@ static int intel_dp_dsc_compute_params(struct intel_encoder *encoder, · 72 unmodified lines
12831345 else
12841346 vdsc_cfg->slice_height = 2;
12851347
1286− ret = intel_dsc_compute_params(encoder, crtc_state);
1348+ ret = intel_dsc_compute_params(crtc_state);
12871349 if (ret)
12881350 return ret;
12891351
@@ -1452,17 +1514,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, · 162 unmodified lines
14521514 &pipe_config->hw.adjusted_mode;
14531515 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
14541516 struct link_config_limits limits;
1455− int common_len;
14561517 int ret;
14571518
1458− common_len = intel_dp_common_len_rate_limit(intel_dp,
1459− intel_dp->max_link_rate);
1460−
1461− /* No common link rates between source and sink */
1462− drm_WARN_ON(encoder->base.dev, common_len <= 0);
1463−
1464− limits.min_rate = intel_dp->common_rates[0];
1465− limits.max_rate = intel_dp->common_rates[common_len - 1];
1519+ limits.min_rate = intel_dp_common_rate(intel_dp, 0);
1520+ limits.max_rate = intel_dp_max_link_rate(intel_dp);
14661521
14671522 limits.min_lane_count = 1;
14681523 limits.max_lane_count = intel_dp_max_lane_count(intel_dp);
@@ -2143,6 +2198,18 @@ static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp) · 674 unmodified lines
21432198 return max_frl_rate;
21442199 }
21452200
2201+static bool
2202+intel_dp_pcon_is_frl_trained(struct intel_dp *intel_dp,
2203+ u8 max_frl_bw_mask, u8 *frl_trained_mask)
2204+{
2205+ if (drm_dp_pcon_hdmi_link_active(&intel_dp->aux) &&
2206+ drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, frl_trained_mask) == DP_PCON_HDMI_MODE_FRL &&
2207+ *frl_trained_mask >= max_frl_bw_mask)
2208+ return true;
2209+
2210+ return false;
2211+}
2212+
21462213 static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp)
21472214 {
21482215 #define TIMEOUT_FRL_READY_MS 500
@@ -2153,10 +2220,6 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 4 unmodified lines
21532220 u8 max_frl_bw_mask = 0, frl_trained_mask;
21542221 bool is_active;
21552222
2156− ret = drm_dp_pcon_reset_frl_config(&intel_dp->aux);
2157− if (ret < 0)
2158− return ret;
2159−
21602223 max_pcon_frl_bw = intel_dp->dfp.pcon_max_frl_bw;
21612224 drm_dbg(&i915->drm, "PCON max rate = %d Gbps\n", max_pcon_frl_bw);
21622225
@@ -2168,6 +2231,12 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 5 unmodified lines
21682231 if (max_frl_bw <= 0)
21692232 return -EINVAL;
21702233
2234+ max_frl_bw_mask = intel_dp_pcon_set_frl_mask(max_frl_bw);
2235+ drm_dbg(&i915->drm, "MAX_FRL_BW_MASK = %u\n", max_frl_bw_mask);
2236+
2237+ if (intel_dp_pcon_is_frl_trained(intel_dp, max_frl_bw_mask, &frl_trained_mask))
2238+ goto frl_trained;
2239+
21712240 ret = drm_dp_pcon_frl_prepare(&intel_dp->aux, false);
21722241 if (ret < 0)
21732242 return ret;
@@ -2177,7 +2246,6 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 3 unmodified lines
21772246 if (!is_active)
21782247 return -ETIMEDOUT;
21792248
2180− max_frl_bw_mask = intel_dp_pcon_set_frl_mask(max_frl_bw);
21812249 ret = drm_dp_pcon_frl_configure_1(&intel_dp->aux, max_frl_bw,
21822250 DP_PCON_ENABLE_SEQUENTIAL_LINK);
21832251 if (ret < 0)
@@ -2193,19 +2261,15 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 9 unmodified lines
21932261 * Wait for FRL to be completed
21942262 * Check if the HDMI Link is up and active.
21952263 */
2196− wait_for(is_active = drm_dp_pcon_hdmi_link_active(&intel_dp->aux) == true, TIMEOUT_HDMI_LINK_ACTIVE_MS);
2264+ wait_for(is_active =
2265+ intel_dp_pcon_is_frl_trained(intel_dp, max_frl_bw_mask, &frl_trained_mask),
2266+ TIMEOUT_HDMI_LINK_ACTIVE_MS);
21972267
21982268 if (!is_active)
21992269 return -ETIMEDOUT;
22002270
2201− /* Verify HDMI Link configuration shows FRL Mode */
2202− if (drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, &frl_trained_mask) !=
2203− DP_PCON_HDMI_MODE_FRL) {
2204− drm_dbg(&i915->drm, "HDMI couldn't be trained in FRL Mode\n");
2205− return -EINVAL;
2206− }
2207− drm_dbg(&i915->drm, "MAX_FRL_MASK = %u, FRL_TRAINED_MASK = %u\n", max_frl_bw_mask, frl_trained_mask);
2208−
2271+frl_trained:
2272+ drm_dbg(&i915->drm, "FRL_TRAINED_MASK = %u\n", frl_trained_mask);
22092273 intel_dp->frl.trained_rate_gbps = intel_dp_pcon_get_frl_mask(frl_trained_mask);
22102274 intel_dp->frl.is_trained = true;
22112275 drm_dbg(&i915->drm, "FRL trained with : %d Gbps\n", intel_dp->frl.trained_rate_gbps);
@@ -2223,6 +2287,28 @@ static bool intel_dp_is_hdmi_2_1_sink(struct intel_dp *intel_dp) · 11 unmodified lines
22232287 return false;
22242288 }
22252289
2290+static
2291+int intel_dp_pcon_set_tmds_mode(struct intel_dp *intel_dp)
2292+{
2293+ int ret;
2294+ u8 buf = 0;
2295+
2296+ /* Set PCON source control mode */
2297+ buf |= DP_PCON_ENABLE_SOURCE_CTL_MODE;
2298+
2299+ ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, buf);
2300+ if (ret < 0)
2301+ return ret;
2302+
2303+ /* Set HDMI LINK ENABLE */
2304+ buf |= DP_PCON_ENABLE_HDMI_LINK;
2305+ ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, buf);
2306+ if (ret < 0)
2307+ return ret;
2308+
2309+ return 0;
2310+}
2311+
22262312 void intel_dp_check_frl_training(struct intel_dp *intel_dp)
22272313 {
22282314 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
@@ -2241,7 +2327,7 @@ void intel_dp_check_frl_training(struct intel_dp *intel_dp) · 12 unmodified lines
22412327 int ret, mode;
22422328
22432329 drm_dbg(&dev_priv->drm, "Couldn't set FRL mode, continuing with TMDS mode\n");
2244− ret = drm_dp_pcon_reset_frl_config(&intel_dp->aux);
2330+ ret = intel_dp_pcon_set_tmds_mode(intel_dp);
22452331 mode = drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, NULL);
22462332
22472333 if (ret < 0 || mode != DP_PCON_HDMI_MODE_TMDS)
@@ -2603,6 +2689,7 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp) · 355 unmodified lines
26032689 intel_dp->use_rate_select = true;
26042690 else
26052691 intel_dp_set_sink_rates(intel_dp);
2692+ intel_dp_set_max_sink_lane_count(intel_dp);
26062693
26072694 intel_dp_set_common_rates(intel_dp);
26082695 intel_dp_reset_max_link_params(intel_dp);
@@ -2648,6 +2735,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) · 39 unmodified lines
26482735 drm_dp_is_branch(intel_dp->dpcd));
26492736
26502737 intel_dp_set_sink_rates(intel_dp);
2738+ intel_dp_set_max_sink_lane_count(intel_dp);
26512739 intel_dp_set_common_rates(intel_dp);
26522740 }
26532741
@@ -5014,6 +5102,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port, · 2360 unmodified lines
50145102
50155103 intel_dp_set_source_rates(intel_dp);
50165104 intel_dp_set_default_sink_rates(intel_dp);
5105+ intel_dp_set_default_max_sink_lane_count(intel_dp);
50175106 intel_dp_set_common_rates(intel_dp);
50185107 intel_dp_reset_max_link_params(intel_dp);
50195108
drivers/gpu/drm/i915/display/intel_dp_link_training.c+17−26
@@ -301,7 +301,10 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp, · 300 unmodified lines
301301 static bool has_per_lane_signal_levels(struct intel_dp *intel_dp,
302302 enum drm_dp_phy dp_phy)
303303 {
304− return !intel_dp_phy_is_downstream_of_source(intel_dp, dp_phy);
304+ struct drm_i915_private *i915 = dp_to_i915(intel_dp);
305+
306+ return !intel_dp_phy_is_downstream_of_source(intel_dp, dp_phy) ||
307+ DISPLAY_VER(i915) >= 11;
305308 }
306309
307310 /* 128b/132b */
@@ -683,15 +686,6 @@ intel_dp_prepare_link_train(struct intel_dp *intel_dp, · 375 unmodified lines
683686 return true;
684687 }
685688
686−static void intel_dp_link_training_clock_recovery_delay(struct intel_dp *intel_dp,
687− enum drm_dp_phy dp_phy)
688−{
689− if (dp_phy == DP_PHY_DPRX)
690− drm_dp_link_train_clock_recovery_delay(&intel_dp->aux, intel_dp->dpcd);
691− else
692− drm_dp_lttpr_link_train_clock_recovery_delay();
693−}
694−
695689 static bool intel_dp_adjust_request_changed(const struct intel_crtc_state *crtc_state,
696690 const u8 old_link_status[DP_LINK_STATUS_SIZE],
697691 const u8 new_link_status[DP_LINK_STATUS_SIZE])
@@ -750,6 +744,11 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp, · 52 unmodified lines
750744 u8 link_status[DP_LINK_STATUS_SIZE];
751745 bool max_vswing_reached = false;
752746 char phy_name[10];
747+ int delay_us;
748+
749+ delay_us = drm_dp_read_clock_recovery_delay(&intel_dp->aux,
750+ intel_dp->dpcd, dp_phy,
751+ intel_dp_is_uhbr(crtc_state));
753752
754753 intel_dp_phy_name(dp_phy, phy_name, sizeof(phy_name));
755754
@@ -777,7 +776,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp, · 21 unmodified lines
777776
778777 voltage_tries = 1;
779778 for (cr_tries = 0; cr_tries < max_cr_tries; ++cr_tries) {
780− intel_dp_link_training_clock_recovery_delay(intel_dp, dp_phy);
779+ usleep_range(delay_us, 2 * delay_us);
781780
782781 if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, dp_phy,
783782 link_status) < 0) {
@@ -895,19 +894,6 @@ static u32 intel_dp_training_pattern(struct intel_dp *intel_dp, · 111 unmodified lines
895894 return DP_TRAINING_PATTERN_2;
896895 }
897896
898−static void
899−intel_dp_link_training_channel_equalization_delay(struct intel_dp *intel_dp,
900− enum drm_dp_phy dp_phy)
901−{
902− if (dp_phy == DP_PHY_DPRX) {
903− drm_dp_link_train_channel_eq_delay(&intel_dp->aux, intel_dp->dpcd);
904− } else {
905− const u8 *phy_caps = intel_dp_lttpr_phy_caps(intel_dp, dp_phy);
906−
907− drm_dp_lttpr_link_train_channel_eq_delay(&intel_dp->aux, phy_caps);
908− }
909−}
910−
911897 /*
912898 * Perform the link training channel equalization phase on the given DP PHY
913899 * using one of training pattern 2, 3 or 4 depending on the source and
@@ -925,6 +911,11 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp, · 11 unmodified lines
925911 u8 link_status[DP_LINK_STATUS_SIZE];
926912 bool channel_eq = false;
927913 char phy_name[10];
914+ int delay_us;
915+
916+ delay_us = drm_dp_read_channel_eq_delay(&intel_dp->aux,
917+ intel_dp->dpcd, dp_phy,
918+ intel_dp_is_uhbr(crtc_state));
928919
929920 intel_dp_phy_name(dp_phy, phy_name, sizeof(phy_name));
930921
@@ -944,8 +935,8 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp, · 13 unmodified lines
944935 }
945936
946937 for (tries = 0; tries < 5; tries++) {
947− intel_dp_link_training_channel_equalization_delay(intel_dp,
948− dp_phy);
938+ usleep_range(delay_us, 2 * delay_us);
939+
949940 if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, dp_phy,
950941 link_status) < 0) {
951942 drm_err(&i915->drm,
drivers/gpu/drm/i915/display/intel_dp_mst.c+11−21
@@ -231,6 +231,7 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 230 unmodified lines
231231 struct drm_i915_private *dev_priv = to_i915(state->base.dev);
232232 struct drm_connector_list_iter connector_list_iter;
233233 struct intel_connector *connector_iter;
234+ int ret = 0;
234235
235236 if (DISPLAY_VER(dev_priv) < 12)
236237 return 0;
@@ -243,7 +244,6 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 6 unmodified lines
243244 struct intel_digital_connector_state *conn_iter_state;
244245 struct intel_crtc_state *crtc_state;
245246 struct intel_crtc *crtc;
246− int ret;
247247
248248 if (connector_iter->mst_port != connector->mst_port ||
249249 connector_iter == connector)
@@ -252,8 +252,8 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 2 unmodified lines
252252 conn_iter_state = intel_atomic_get_digital_connector_state(state,
253253 connector_iter);
254254 if (IS_ERR(conn_iter_state)) {
255− drm_connector_list_iter_end(&connector_list_iter);
256− return PTR_ERR(conn_iter_state);
255+ ret = PTR_ERR(conn_iter_state);
256+ break;
257257 }
258258
259259 if (!conn_iter_state->base.crtc)
@@ -262,20 +262,18 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 2 unmodified lines
262262 crtc = to_intel_crtc(conn_iter_state->base.crtc);
263263 crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);
264264 if (IS_ERR(crtc_state)) {
265− drm_connector_list_iter_end(&connector_list_iter);
266− return PTR_ERR(crtc_state);
265+ ret = PTR_ERR(crtc_state);
266+ break;
267267 }
268268
269269 ret = drm_atomic_add_affected_planes(&state->base, &crtc->base);
270− if (ret) {
271− drm_connector_list_iter_end(&connector_list_iter);
272− return ret;
273− }
270+ if (ret)
271+ break;
274272 crtc_state->uapi.mode_changed = true;
275273 }
276274 drm_connector_list_iter_end(&connector_list_iter);
277275
278− return 0;
276+ return ret;
279277 }
280278
281279 static int
@@ -348,16 +346,6 @@ static void wait_for_act_sent(struct intel_encoder *encoder, · 66 unmodified lines
348346 drm_dp_check_act_status(&intel_dp->mst_mgr);
349347 }
350348
351−static void intel_mst_pre_disable_dp(struct intel_atomic_state *state,
352− struct intel_encoder *encoder,
353− const struct intel_crtc_state *old_crtc_state,
354− const struct drm_connector_state *old_conn_state)
355−{
356− if (old_crtc_state->has_audio)
357− intel_audio_codec_disable(encoder, old_crtc_state,
358− old_conn_state);
359−}
360−
361349 static void intel_mst_disable_dp(struct intel_atomic_state *state,
362350 struct intel_encoder *encoder,
363351 const struct intel_crtc_state *old_crtc_state,
@@ -382,6 +370,9 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state, · 18 unmodified lines
382370 if (ret) {
383371 drm_dbg_kms(&i915->drm, "failed to update payload %d\n", ret);
384372 }
373+ if (old_crtc_state->has_audio)
374+ intel_audio_codec_disable(encoder,
375+ old_crtc_state, old_conn_state);
385376 }
386377
387378 static void intel_mst_post_disable_dp(struct intel_atomic_state *state,
@@ -916,7 +907,6 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *dig_port, enum pipe · 528 unmodified lines
916907
917908 intel_encoder->compute_config = intel_dp_mst_compute_config;
918909 intel_encoder->compute_config_late = intel_dp_mst_compute_config_late;
919− intel_encoder->pre_disable = intel_mst_pre_disable_dp;
920910 intel_encoder->disable = intel_mst_disable_dp;
921911 intel_encoder->post_disable = intel_mst_post_disable_dp;
922912 intel_encoder->update_pipe = intel_ddi_update_pipe;
drivers/gpu/drm/i915/display/intel_dpll_mgr.c+4−3
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include "intel_dpio_phy.h"
2727 #include "intel_dpll.h"
2828 #include "intel_dpll_mgr.h"
29+#include "intel_pch_refclk.h"
2930 #include "intel_tc.h"
3031
3132 /**
@@ -3740,7 +3741,7 @@ static void combo_pll_enable(struct drm_i915_private *dev_priv, · 3708 unmodified lines
37403741 * domain.
37413742 */
37423743 pll->wakeref = intel_display_power_get(dev_priv,
3743− POWER_DOMAIN_DPLL_DC_OFF);
3744+ POWER_DOMAIN_DC_OFF);
37443745 }
37453746
37463747 icl_pll_power_enable(dev_priv, pll, enable_reg);
@@ -3847,7 +3848,7 @@ static void combo_pll_disable(struct drm_i915_private *dev_priv, · 100 unmodified lines
38473848
38483849 if (IS_JSL_EHL(dev_priv) &&
38493850 pll->info->id == DPLL_ID_EHL_DPLL4)
3850− intel_display_power_put(dev_priv, POWER_DOMAIN_DPLL_DC_OFF,
3851+ intel_display_power_put(dev_priv, POWER_DOMAIN_DC_OFF,
38513852 pll->wakeref);
38523853 }
38533854
@@ -4231,7 +4232,7 @@ static void readout_dpll_hw_state(struct drm_i915_private *i915, · 377 unmodified lines
42314232 if (IS_JSL_EHL(i915) && pll->on &&
42324233 pll->info->id == DPLL_ID_EHL_DPLL4) {
42334234 pll->wakeref = intel_display_power_get(i915,
4234− POWER_DOMAIN_DPLL_DC_OFF);
4235+ POWER_DOMAIN_DC_OFF);
42354236 }
42364237
42374238 pll->state.pipe_mask = 0;
drivers/gpu/drm/i915/display/intel_dpll_mgr.h+1−1
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727
2828 #include <linux/types.h>
2929
30−#include "intel_display.h"
3130 #include "intel_wakeref.h"
3231
3332 /*FIXME: Move this to a more appropriate place. */
@@ -37,6 +36,7 @@ · 3 unmodified lines
3736 (void) (&__a == &__b); \
3837 __a > __b ? (__a - __b) : (__b - __a); })
3938
39+enum tc_port;
4040 struct drm_device;
4141 struct drm_i915_private;
4242 struct intel_atomic_state;
drivers/gpu/drm/i915/display/intel_dpt.c+58−0
@@ -167,6 +167,64 @@ void intel_dpt_unpin(struct i915_address_space *vm) · 166 unmodified lines
167167 i915_vma_put(dpt->vma);
168168 }
169169
170+/**
171+ * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume
172+ * @i915: device instance
173+ *
174+ * Restore the memory mapping during system resume for all framebuffers which
175+ * are mapped to HW via a GGTT->DPT page table. The content of these page
176+ * tables are not stored in the hibernation image during S4 and S3RST->S4
177+ * transitions, so here we reprogram the PTE entries in those tables.
178+ *
179+ * This function must be called after the mappings in GGTT have been restored calling
180+ * i915_ggtt_resume().
181+ */
182+void intel_dpt_resume(struct drm_i915_private *i915)
183+{
184+ struct drm_framebuffer *drm_fb;
185+
186+ if (!HAS_DISPLAY(i915))
187+ return;
188+
189+ mutex_lock(&i915->drm.mode_config.fb_lock);
190+ drm_for_each_fb(drm_fb, &i915->drm) {
191+ struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
192+
193+ if (fb->dpt_vm)
194+ i915_ggtt_resume_vm(fb->dpt_vm);
195+ }
196+ mutex_unlock(&i915->drm.mode_config.fb_lock);
197+}
198+
199+/**
200+ * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend
201+ * @i915: device instance
202+ *
203+ * Suspend the memory mapping during system suspend for all framebuffers which
204+ * are mapped to HW via a GGTT->DPT page table.
205+ *
206+ * This function must be called before the mappings in GGTT are suspended calling
207+ * i915_ggtt_suspend().
208+ */
209+void intel_dpt_suspend(struct drm_i915_private *i915)
210+{
211+ struct drm_framebuffer *drm_fb;
212+
213+ if (!HAS_DISPLAY(i915))
214+ return;
215+
216+ mutex_lock(&i915->drm.mode_config.fb_lock);
217+
218+ drm_for_each_fb(drm_fb, &i915->drm) {
219+ struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
220+
221+ if (fb->dpt_vm)
222+ i915_ggtt_suspend_vm(fb->dpt_vm);
223+ }
224+
225+ mutex_unlock(&i915->drm.mode_config.fb_lock);
226+}
227+
170228 struct i915_address_space *
171229 intel_dpt_create(struct intel_framebuffer *fb)
172230 {
drivers/gpu/drm/i915/display/intel_dpt.h+4−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #ifndef __INTEL_DPT_H__
77 #define __INTEL_DPT_H__
88
9+struct drm_i915_private;
10+
911 struct i915_address_space;
1012 struct i915_vma;
1113 struct intel_framebuffer;
@@ -13,6 +15,8 @@ struct intel_framebuffer; · 1 unmodified line
1315 void intel_dpt_destroy(struct i915_address_space *vm);
1416 struct i915_vma *intel_dpt_pin(struct i915_address_space *vm);
1517 void intel_dpt_unpin(struct i915_address_space *vm);
18+void intel_dpt_suspend(struct drm_i915_private *i915);
19+void intel_dpt_resume(struct drm_i915_private *i915);
1620 struct i915_address_space *
1721 intel_dpt_create(struct intel_framebuffer *fb);
1822
drivers/gpu/drm/i915/display/intel_dsb.c+2−2
@@ -100,7 +100,7 @@ void intel_dsb_indexed_reg_write(const struct intel_crtc_state *crtc_state, · 99 unmodified lines
100100 u32 reg_val;
101101
102102 if (!dsb) {
103− intel_de_write(dev_priv, reg, val);
103+ intel_de_write_fw(dev_priv, reg, val);
104104 return;
105105 }
106106 buf = dsb->cmd_buf;
@@ -177,7 +177,7 @@ void intel_dsb_reg_write(const struct intel_crtc_state *crtc_state, · 70 unmodified lines
177177
178178 dsb = crtc_state->dsb;
179179 if (!dsb) {
180− intel_de_write(dev_priv, reg, val);
180+ intel_de_write_fw(dev_priv, reg, val);
181181 return;
182182 }
183183
drivers/gpu/drm/i915/display/intel_dsi.h+0−42
@@ -166,57 +166,15 @@ static inline u16 intel_dsi_encoder_ports(struct intel_encoder *encoder) · 165 unmodified lines
166166 return enc_to_intel_dsi(encoder)->ports;
167167 }
168168
169−/* icl_dsi.c */
170−void icl_dsi_init(struct drm_i915_private *dev_priv);
171−void icl_dsi_frame_update(struct intel_crtc_state *crtc_state);
172−
173−/* intel_dsi.c */
174169 int intel_dsi_bitrate(const struct intel_dsi *intel_dsi);
175170 int intel_dsi_tlpx_ns(const struct intel_dsi *intel_dsi);
176171 enum drm_panel_orientation
177172 intel_dsi_get_panel_orientation(struct intel_connector *connector);
178−
179−/* vlv_dsi.c */
180−void vlv_dsi_wait_for_fifo_empty(struct intel_dsi *intel_dsi, enum port port);
181−enum mipi_dsi_pixel_format pixel_format_from_register_bits(u32 fmt);
182173 int intel_dsi_get_modes(struct drm_connector *connector);
183174 enum drm_mode_status intel_dsi_mode_valid(struct drm_connector *connector,
184175 struct drm_display_mode *mode);
185176 struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
186177 const struct mipi_dsi_host_ops *funcs,
187178 enum port port);
188−void vlv_dsi_init(struct drm_i915_private *dev_priv);
189−
190−/* vlv_dsi_pll.c */
191−int vlv_dsi_pll_compute(struct intel_encoder *encoder,
192− struct intel_crtc_state *config);
193−void vlv_dsi_pll_enable(struct intel_encoder *encoder,
194− const struct intel_crtc_state *config);
195−void vlv_dsi_pll_disable(struct intel_encoder *encoder);
196−u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
197− struct intel_crtc_state *config);
198−void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
199−
200−bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv);
201−int bxt_dsi_pll_compute(struct intel_encoder *encoder,
202− struct intel_crtc_state *config);
203−void bxt_dsi_pll_enable(struct intel_encoder *encoder,
204− const struct intel_crtc_state *config);
205−void bxt_dsi_pll_disable(struct intel_encoder *encoder);
206−u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
207− struct intel_crtc_state *config);
208−void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
209−
210−void assert_dsi_pll_enabled(struct drm_i915_private *i915);
211−void assert_dsi_pll_disabled(struct drm_i915_private *i915);
212−
213−/* intel_dsi_vbt.c */
214−bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id);
215−void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on);
216−void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi);
217−void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi,
218− enum mipi_seq seq_id);
219−void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec);
220−void intel_dsi_log_params(struct intel_dsi *intel_dsi);
221179
222180 #endif /* _INTEL_DSI_H */
drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c+4−0
@@ -71,6 +71,7 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32 · 70 unmodified lines
7171 u8 data[2] = {};
7272 enum port port;
7373 size_t len = panel->backlight.max > U8_MAX ? 2 : 1;
74+ unsigned long mode_flags;
7475
7576 if (len == 1) {
7677 data[0] = level;
@@ -81,8 +82,11 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32 · 4 unmodified lines
8182
8283 for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) {
8384 dsi_device = intel_dsi->dsi_hosts[port]->device;
85+ mode_flags = dsi_device->mode_flags;
86+ dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
8487 mipi_dsi_dcs_write(dsi_device, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
8588 &data, len);
89+ dsi_device->mode_flags = mode_flags;
8690 }
8791 }
8892
drivers/gpu/drm/i915/display/intel_dsi_vbt.c+2−0
@@ -41,6 +41,8 @@ · 40 unmodified lines
4141 #include "i915_drv.h"
4242 #include "intel_display_types.h"
4343 #include "intel_dsi.h"
44+#include "intel_dsi_vbt.h"
45+#include "vlv_dsi.h"
4446 #include "vlv_sideband.h"
4547
4648 #define MIPI_TRANSFER_MODE_SHIFT 0
drivers/gpu/drm/i915/display/intel_dsi_vbt.h+22−0
@@ -0,0 +1,22 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef __INTEL_DSI_VBT_H__
7+#define __INTEL_DSI_VBT_H__
8+
9+#include <linux/types.h>
10+
11+enum mipi_seq;
12+struct intel_dsi;
13+
14+bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id);
15+void intel_dsi_vbt_gpio_init(struct intel_dsi *intel_dsi, bool panel_is_on);
16+void intel_dsi_vbt_gpio_cleanup(struct intel_dsi *intel_dsi);
17+void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi,
18+ enum mipi_seq seq_id);
19+void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec);
20+void intel_dsi_log_params(struct intel_dsi *intel_dsi);
21+
22+#endif /* __INTEL_DSI_VBT_H__ */
drivers/gpu/drm/i915/display/intel_fb.c+593−113
@@ -13,26 +13,465 @@ · 12 unmodified lines
1313
1414 #define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a))
1515
16−bool is_ccs_plane(const struct drm_framebuffer *fb, int plane)
16+/*
17+ * From the Sky Lake PRM:
18+ * "The Color Control Surface (CCS) contains the compression status of
19+ * the cache-line pairs. The compression state of the cache-line pair
20+ * is specified by 2 bits in the CCS. Each CCS cache-line represents
21+ * an area on the main surface of 16 x16 sets of 128 byte Y-tiled
22+ * cache-line-pairs. CCS is always Y tiled."
23+ *
24+ * Since cache line pairs refers to horizontally adjacent cache lines,
25+ * each cache line in the CCS corresponds to an area of 32x16 cache
26+ * lines on the main surface. Since each pixel is 4 bytes, this gives
27+ * us a ratio of one byte in the CCS for each 8x16 pixels in the
28+ * main surface.
29+ */
30+static const struct drm_format_info skl_ccs_formats[] = {
31+ { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 2,
32+ .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, },
33+ { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 2,
34+ .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, },
35+ { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 2,
36+ .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, .has_alpha = true, },
37+ { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2,
38+ .cpp = { 4, 1, }, .hsub = 8, .vsub = 16, .has_alpha = true, },
39+};
40+
41+/*
42+ * Gen-12 compression uses 4 bits of CCS data for each cache line pair in the
43+ * main surface. And each 64B CCS cache line represents an area of 4x1 Y-tiles
44+ * in the main surface. With 4 byte pixels and each Y-tile having dimensions of
45+ * 32x32 pixels, the ratio turns out to 1B in the CCS for every 2x32 pixels in
46+ * the main surface.
47+ */
48+static const struct drm_format_info gen12_ccs_formats[] = {
49+ { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 2,
50+ .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
51+ .hsub = 1, .vsub = 1, },
52+ { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 2,
53+ .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
54+ .hsub = 1, .vsub = 1, },
55+ { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 2,
56+ .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
57+ .hsub = 1, .vsub = 1, .has_alpha = true },
58+ { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2,
59+ .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
60+ .hsub = 1, .vsub = 1, .has_alpha = true },
61+ { .format = DRM_FORMAT_YUYV, .num_planes = 2,
62+ .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
63+ .hsub = 2, .vsub = 1, .is_yuv = true },
64+ { .format = DRM_FORMAT_YVYU, .num_planes = 2,
65+ .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
66+ .hsub = 2, .vsub = 1, .is_yuv = true },
67+ { .format = DRM_FORMAT_UYVY, .num_planes = 2,
68+ .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
69+ .hsub = 2, .vsub = 1, .is_yuv = true },
70+ { .format = DRM_FORMAT_VYUY, .num_planes = 2,
71+ .char_per_block = { 2, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
72+ .hsub = 2, .vsub = 1, .is_yuv = true },
73+ { .format = DRM_FORMAT_XYUV8888, .num_planes = 2,
74+ .char_per_block = { 4, 1 }, .block_w = { 1, 2 }, .block_h = { 1, 1 },
75+ .hsub = 1, .vsub = 1, .is_yuv = true },
76+ { .format = DRM_FORMAT_NV12, .num_planes = 4,
77+ .char_per_block = { 1, 2, 1, 1 }, .block_w = { 1, 1, 4, 4 }, .block_h = { 1, 1, 1, 1 },
78+ .hsub = 2, .vsub = 2, .is_yuv = true },
79+ { .format = DRM_FORMAT_P010, .num_planes = 4,
80+ .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
81+ .hsub = 2, .vsub = 2, .is_yuv = true },
82+ { .format = DRM_FORMAT_P012, .num_planes = 4,
83+ .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
84+ .hsub = 2, .vsub = 2, .is_yuv = true },
85+ { .format = DRM_FORMAT_P016, .num_planes = 4,
86+ .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
87+ .hsub = 2, .vsub = 2, .is_yuv = true },
88+};
89+
90+/*
91+ * Same as gen12_ccs_formats[] above, but with additional surface used
92+ * to pass Clear Color information in plane 2 with 64 bits of data.
93+ */
94+static const struct drm_format_info gen12_ccs_cc_formats[] = {
95+ { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 3,
96+ .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
97+ .hsub = 1, .vsub = 1, },
98+ { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 3,
99+ .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
100+ .hsub = 1, .vsub = 1, },
101+ { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 3,
102+ .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
103+ .hsub = 1, .vsub = 1, .has_alpha = true },
104+ { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 3,
105+ .char_per_block = { 4, 1, 0 }, .block_w = { 1, 2, 2 }, .block_h = { 1, 1, 1 },
106+ .hsub = 1, .vsub = 1, .has_alpha = true },
107+};
108+
109+struct intel_modifier_desc {
110+ u64 modifier;
111+ struct {
112+ u8 from;
113+ u8 until;
114+ } display_ver;
115+#define DISPLAY_VER_ALL { 0, -1 }
116+
117+ const struct drm_format_info *formats;
118+ int format_count;
119+#define FORMAT_OVERRIDE(format_list) \
120+ .formats = format_list, \
121+ .format_count = ARRAY_SIZE(format_list)
122+
123+ u8 plane_caps;
124+
125+ struct {
126+ u8 cc_planes:3;
127+ u8 packed_aux_planes:4;
128+ u8 planar_aux_planes:4;
129+ } ccs;
130+};
131+
132+#define INTEL_PLANE_CAP_CCS_MASK (INTEL_PLANE_CAP_CCS_RC | \
133+ INTEL_PLANE_CAP_CCS_RC_CC | \
134+ INTEL_PLANE_CAP_CCS_MC)
135+#define INTEL_PLANE_CAP_TILING_MASK (INTEL_PLANE_CAP_TILING_X | \
136+ INTEL_PLANE_CAP_TILING_Y | \
137+ INTEL_PLANE_CAP_TILING_Yf)
138+#define INTEL_PLANE_CAP_TILING_NONE 0
139+
140+static const struct intel_modifier_desc intel_modifiers[] = {
141+ {
142+ .modifier = I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
143+ .display_ver = { 12, 13 },
144+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_MC,
145+
146+ .ccs.packed_aux_planes = BIT(1),
147+ .ccs.planar_aux_planes = BIT(2) | BIT(3),
148+
149+ FORMAT_OVERRIDE(gen12_ccs_formats),
150+ }, {
151+ .modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
152+ .display_ver = { 12, 13 },
153+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC,
154+
155+ .ccs.packed_aux_planes = BIT(1),
156+
157+ FORMAT_OVERRIDE(gen12_ccs_formats),
158+ }, {
159+ .modifier = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
160+ .display_ver = { 12, 13 },
161+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC_CC,
162+
163+ .ccs.cc_planes = BIT(2),
164+ .ccs.packed_aux_planes = BIT(1),
165+
166+ FORMAT_OVERRIDE(gen12_ccs_cc_formats),
167+ }, {
168+ .modifier = I915_FORMAT_MOD_Yf_TILED_CCS,
169+ .display_ver = { 9, 11 },
170+ .plane_caps = INTEL_PLANE_CAP_TILING_Yf | INTEL_PLANE_CAP_CCS_RC,
171+
172+ .ccs.packed_aux_planes = BIT(1),
173+
174+ FORMAT_OVERRIDE(skl_ccs_formats),
175+ }, {
176+ .modifier = I915_FORMAT_MOD_Y_TILED_CCS,
177+ .display_ver = { 9, 11 },
178+ .plane_caps = INTEL_PLANE_CAP_TILING_Y | INTEL_PLANE_CAP_CCS_RC,
179+
180+ .ccs.packed_aux_planes = BIT(1),
181+
182+ FORMAT_OVERRIDE(skl_ccs_formats),
183+ }, {
184+ .modifier = I915_FORMAT_MOD_Yf_TILED,
185+ .display_ver = { 9, 11 },
186+ .plane_caps = INTEL_PLANE_CAP_TILING_Yf,
187+ }, {
188+ .modifier = I915_FORMAT_MOD_Y_TILED,
189+ .display_ver = { 9, 13 },
190+ .plane_caps = INTEL_PLANE_CAP_TILING_Y,
191+ }, {
192+ .modifier = I915_FORMAT_MOD_X_TILED,
193+ .display_ver = DISPLAY_VER_ALL,
194+ .plane_caps = INTEL_PLANE_CAP_TILING_X,
195+ }, {
196+ .modifier = DRM_FORMAT_MOD_LINEAR,
197+ .display_ver = DISPLAY_VER_ALL,
198+ },
199+};
200+
201+static const struct intel_modifier_desc *lookup_modifier_or_null(u64 modifier)
202+{
203+ int i;
204+
205+ for (i = 0; i < ARRAY_SIZE(intel_modifiers); i++)
206+ if (intel_modifiers[i].modifier == modifier)
207+ return &intel_modifiers[i];
208+
209+ return NULL;
210+}
211+
212+static const struct intel_modifier_desc *lookup_modifier(u64 modifier)
213+{
214+ const struct intel_modifier_desc *md = lookup_modifier_or_null(modifier);
215+
216+ if (WARN_ON(!md))
217+ return &intel_modifiers[0];
218+
219+ return md;
220+}
221+
222+static const struct drm_format_info *
223+lookup_format_info(const struct drm_format_info formats[],
224+ int num_formats, u32 format)
225+{
226+ int i;
227+
228+ for (i = 0; i < num_formats; i++) {
229+ if (formats[i].format == format)
230+ return &formats[i];
231+ }
232+
233+ return NULL;
234+}
235+
236+/**
237+ * intel_fb_get_format_info: Get a modifier specific format information
238+ * @cmd: FB add command structure
239+ *
240+ * Returns:
241+ * Returns the format information for @cmd->pixel_format specific to @cmd->modifier[0],
242+ * or %NULL if the modifier doesn't override the format.
243+ */
244+const struct drm_format_info *
245+intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
246+{
247+ const struct intel_modifier_desc *md = lookup_modifier_or_null(cmd->modifier[0]);
248+
249+ if (!md || !md->formats)
250+ return NULL;
251+
252+ return lookup_format_info(md->formats, md->format_count, cmd->pixel_format);
253+}
254+
255+static bool plane_caps_contain_any(u8 caps, u8 mask)
256+{
257+ return caps & mask;
258+}
259+
260+static bool plane_caps_contain_all(u8 caps, u8 mask)
261+{
262+ return (caps & mask) == mask;
263+}
264+
265+/**
266+ * intel_fb_is_ccs_modifier: Check if a modifier is a CCS modifier type
267+ * @modifier: Modifier to check
268+ *
269+ * Returns:
270+ * Returns %true if @modifier is a render, render with color clear or
271+ * media compression modifier.
272+ */
273+bool intel_fb_is_ccs_modifier(u64 modifier)
274+{
275+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
276+ INTEL_PLANE_CAP_CCS_MASK);
277+}
278+
279+/**
280+ * intel_fb_is_rc_ccs_cc_modifier: Check if a modifier is an RC CCS CC modifier type
281+ * @modifier: Modifier to check
282+ *
283+ * Returns:
284+ * Returns %true if @modifier is a render with color clear modifier.
285+ */
286+bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier)
287+{
288+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
289+ INTEL_PLANE_CAP_CCS_RC_CC);
290+}
291+
292+/**
293+ * intel_fb_is_mc_ccs_modifier: Check if a modifier is an MC CCS modifier type
294+ * @modifier: Modifier to check
295+ *
296+ * Returns:
297+ * Returns %true if @modifier is a media compression modifier.
298+ */
299+bool intel_fb_is_mc_ccs_modifier(u64 modifier)
300+{
301+ return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
302+ INTEL_PLANE_CAP_CCS_MC);
303+}
304+
305+static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
306+ u8 display_ver_from, u8 display_ver_until)
307+{
308+ return md->display_ver.from <= display_ver_until &&
309+ display_ver_from <= md->display_ver.until;
310+}
311+
312+static bool plane_has_modifier(struct drm_i915_private *i915,
313+ u8 plane_caps,
314+ const struct intel_modifier_desc *md)
315+{
316+ if (!IS_DISPLAY_VER(i915, md->display_ver.from, md->display_ver.until))
317+ return false;
318+
319+ if (!plane_caps_contain_all(plane_caps, md->plane_caps))
320+ return false;
321+
322+ return true;
323+}
324+
325+/**
326+ * intel_fb_plane_get_modifiers: Get the modifiers for the given platform and plane capabilities
327+ * @i915: i915 device instance
328+ * @plane_caps: capabilities for the plane the modifiers are queried for
329+ *
330+ * Returns:
331+ * Returns the list of modifiers allowed by the @i915 platform and @plane_caps.
332+ * The caller must free the returned buffer.
333+ */
334+u64 *intel_fb_plane_get_modifiers(struct drm_i915_private *i915,
335+ u8 plane_caps)
336+{
337+ u64 *list, *p;
338+ int count = 1; /* +1 for invalid modifier terminator */
339+ int i;
340+
341+ for (i = 0; i < ARRAY_SIZE(intel_modifiers); i++) {
342+ if (plane_has_modifier(i915, plane_caps, &intel_modifiers[i]))
343+ count++;
344+ }
345+
346+ list = kmalloc_array(count, sizeof(*list), GFP_KERNEL);
347+ if (drm_WARN_ON(&i915->drm, !list))
348+ return NULL;
349+
350+ p = list;
351+ for (i = 0; i < ARRAY_SIZE(intel_modifiers); i++) {
352+ if (plane_has_modifier(i915, plane_caps, &intel_modifiers[i]))
353+ *p++ = intel_modifiers[i].modifier;
354+ }
355+ *p++ = DRM_FORMAT_MOD_INVALID;
356+
357+ return list;
358+}
359+
360+/**
361+ * intel_fb_plane_supports_modifier: Determine if a modifier is supported by the given plane
362+ * @plane: Plane to check the modifier support for
363+ * @modifier: The modifier to check the support for
364+ *
365+ * Returns:
366+ * %true if the @modifier is supported on @plane.
367+ */
368+bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier)
369+{
370+ int i;
371+
372+ for (i = 0; i < plane->base.modifier_count; i++)
373+ if (plane->base.modifiers[i] == modifier)
374+ return true;
375+
376+ return false;
377+}
378+
379+static bool format_is_yuv_semiplanar(const struct intel_modifier_desc *md,
380+ const struct drm_format_info *info)
17381 {
18− if (!is_ccs_modifier(fb->modifier))
382+ int yuv_planes;
383+
384+ if (!info->is_yuv)
19385 return false;
20386
21− return plane >= fb->format->num_planes / 2;
387+ if (plane_caps_contain_any(md->plane_caps, INTEL_PLANE_CAP_CCS_MASK))
388+ yuv_planes = 4;
389+ else
390+ yuv_planes = 2;
391+
392+ return info->num_planes == yuv_planes;
393+}
394+
395+/**
396+ * intel_format_info_is_yuv_semiplanar: Check if the given format is YUV semiplanar
397+ * @info: format to check
398+ * @modifier: modifier used with the format
399+ *
400+ * Returns:
401+ * %true if @info / @modifier is YUV semiplanar.
402+ */
403+bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
404+ u64 modifier)
405+{
406+ return format_is_yuv_semiplanar(lookup_modifier(modifier), info);
407+}
408+
409+static u8 ccs_aux_plane_mask(const struct intel_modifier_desc *md,
410+ const struct drm_format_info *format)
411+{
412+ if (format_is_yuv_semiplanar(md, format))
413+ return md->ccs.planar_aux_planes;
414+ else
415+ return md->ccs.packed_aux_planes;
22416 }
23417
24−bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane)
418+/**
419+ * intel_fb_is_ccs_aux_plane: Check if a framebuffer color plane is a CCS AUX plane
420+ * @fb: Framebuffer
421+ * @color_plane: color plane index to check
422+ *
423+ * Returns:
424+ * Returns %true if @fb's color plane at index @color_plane is a CCS AUX plane.
425+ */
426+bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane)
25427 {
26− return is_gen12_ccs_modifier(fb->modifier) && is_ccs_plane(fb, plane);
428+ const struct intel_modifier_desc *md = lookup_modifier(fb->modifier);
429+
430+ return ccs_aux_plane_mask(md, fb->format) & BIT(color_plane);
27431 }
28432
29−bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane)
433+/**
434+ * intel_fb_is_gen12_ccs_aux_plane: Check if a framebuffer color plane is a GEN12 CCS AUX plane
435+ * @fb: Framebuffer
436+ * @color_plane: color plane index to check
437+ *
438+ * Returns:
439+ * Returns %true if @fb's color plane at index @color_plane is a GEN12 CCS AUX plane.
440+ */
441+static bool intel_fb_is_gen12_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane)
30442 {
31− return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
32− plane == 2;
443+ const struct intel_modifier_desc *md = lookup_modifier(fb->modifier);
444+
445+ return check_modifier_display_ver_range(md, 12, 13) &&
446+ ccs_aux_plane_mask(md, fb->format) & BIT(color_plane);
33447 }
34448
35−bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane)
449+/**
450+ * intel_fb_rc_ccs_cc_plane: Get the CCS CC color plane index for a framebuffer
451+ * @fb: Framebuffer
452+ *
453+ * Returns:
454+ * Returns the index of the color clear plane for @fb, or -1 if @fb is not a
455+ * framebuffer using a render compression/color clear modifier.
456+ */
457+int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb)
458+{
459+ const struct intel_modifier_desc *md = lookup_modifier(fb->modifier);
460+
461+ if (!md->ccs.cc_planes)
462+ return -1;
463+
464+ drm_WARN_ON_ONCE(fb->dev, hweight8(md->ccs.cc_planes) > 1);
465+
466+ return ilog2((int)md->ccs.cc_planes);
467+}
468+
469+static bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int color_plane)
470+{
471+ return intel_fb_rc_ccs_cc_plane(fb) == color_plane;
472+}
473+
474+static bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane)
36475 {
37476 return intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier) &&
38477 color_plane == 1;
@@ -41,12 +480,13 @@ bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane) · 2 unmodified lines
41480 bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane)
42481 {
43482 return fb->modifier == DRM_FORMAT_MOD_LINEAR ||
44− is_gen12_ccs_plane(fb, color_plane);
483+ intel_fb_is_gen12_ccs_aux_plane(fb, color_plane) ||
484+ is_gen12_ccs_cc_plane(fb, color_plane);
45485 }
46486
47487 int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane)
48488 {
49− drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
489+ drm_WARN_ON(fb->dev, !intel_fb_is_ccs_modifier(fb->modifier) ||
50490 (main_plane && main_plane >= fb->format->num_planes / 2));
51491
52492 return fb->format->num_planes / 2 + main_plane;
@@ -54,7 +494,7 @@ int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane) · 1 unmodified line
54494
55495 int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
56496 {
57− drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
497+ drm_WARN_ON(fb->dev, !intel_fb_is_ccs_modifier(fb->modifier) ||
58498 ccs_plane < fb->format->num_planes / 2);
59499
60500 if (is_gen12_ccs_cc_plane(fb, ccs_plane))
@@ -63,35 +503,12 @@ int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane) · 2 unmodified lines
63503 return ccs_plane - fb->format->num_planes / 2;
64504 }
65505
66−static unsigned int gen12_aligned_scanout_stride(const struct intel_framebuffer *fb,
67− int color_plane)
68−{
69− struct drm_i915_private *i915 = to_i915(fb->base.dev);
70− unsigned int stride = fb->base.pitches[color_plane];
71−
72− if (IS_ALDERLAKE_P(i915))
73− return roundup_pow_of_two(max(stride,
74− 8u * intel_tile_width_bytes(&fb->base, color_plane)));
75−
76− return stride;
77−}
78−
79506 static unsigned int gen12_ccs_aux_stride(struct intel_framebuffer *fb, int ccs_plane)
80507 {
81− struct drm_i915_private *i915 = to_i915(fb->base.dev);
82508 int main_plane = skl_ccs_to_main_plane(&fb->base, ccs_plane);
83509 unsigned int main_stride = fb->base.pitches[main_plane];
84510 unsigned int main_tile_width = intel_tile_width_bytes(&fb->base, main_plane);
85511
86− /*
87− * On ADL-P the AUX stride must align with a power-of-two aligned main
88− * surface stride. The stride of the allocated main surface object can
89− * be less than this POT stride, which is then autopadded to the POT
90− * size.
91− */
92− if (IS_ALDERLAKE_P(i915))
93− main_stride = gen12_aligned_scanout_stride(fb, main_plane);
94−
95512 return DIV_ROUND_UP(main_stride, 4 * main_tile_width) * 64;
96513 }
97514
@@ -99,7 +516,7 @@ int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane) · 1 unmodified line
99516 {
100517 struct drm_i915_private *i915 = to_i915(fb->dev);
101518
102− if (is_ccs_modifier(fb->modifier))
519+ if (intel_fb_is_ccs_modifier(fb->modifier))
103520 return main_to_ccs_plane(fb, main_plane);
104521 else if (DISPLAY_VER(i915) < 11 &&
105522 intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
@@ -128,13 +545,14 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane) · 22 unmodified lines
128545 else
129546 return 512;
130547 case I915_FORMAT_MOD_Y_TILED_CCS:
131− if (is_ccs_plane(fb, color_plane))
548+ if (intel_fb_is_ccs_aux_plane(fb, color_plane))
132549 return 128;
133550 fallthrough;
134551 case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
135552 case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
136553 case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
137− if (is_ccs_plane(fb, color_plane))
554+ if (intel_fb_is_ccs_aux_plane(fb, color_plane) ||
555+ is_gen12_ccs_cc_plane(fb, color_plane))
138556 return 64;
139557 fallthrough;
140558 case I915_FORMAT_MOD_Y_TILED:
@@ -143,7 +561,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane) · 2 unmodified lines
143561 else
144562 return 512;
145563 case I915_FORMAT_MOD_Yf_TILED_CCS:
146− if (is_ccs_plane(fb, color_plane))
564+ if (intel_fb_is_ccs_aux_plane(fb, color_plane))
147565 return 128;
148566 fallthrough;
149567 case I915_FORMAT_MOD_Yf_TILED:
@@ -199,7 +617,7 @@ static void intel_tile_block_dims(const struct drm_framebuffer *fb, int color_pl · 49 unmodified lines
199617 {
200618 intel_tile_dims(fb, color_plane, tile_width, tile_height);
201619
202− if (is_gen12_ccs_plane(fb, color_plane))
620+ if (intel_fb_is_gen12_ccs_aux_plane(fb, color_plane))
203621 *tile_height = 1;
204622 }
205623
@@ -223,16 +641,19 @@ intel_fb_align_height(const struct drm_framebuffer *fb, · 17 unmodified lines
223641
224642 static unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier)
225643 {
226− switch (fb_modifier) {
227− case I915_FORMAT_MOD_X_TILED:
228− return I915_TILING_X;
229− case I915_FORMAT_MOD_Y_TILED:
230− case I915_FORMAT_MOD_Y_TILED_CCS:
231− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
232− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
233− case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
644+ u8 tiling_caps = lookup_modifier(fb_modifier)->plane_caps &
645+ INTEL_PLANE_CAP_TILING_MASK;
646+
647+ switch (tiling_caps) {
648+ case INTEL_PLANE_CAP_TILING_Y:
234649 return I915_TILING_Y;
650+ case INTEL_PLANE_CAP_TILING_X:
651+ return I915_TILING_X;
652+ case INTEL_PLANE_CAP_TILING_Yf:
653+ case INTEL_PLANE_CAP_TILING_NONE:
654+ return I915_TILING_NONE;
235655 default:
656+ MISSING_CASE(tiling_caps);
236657 return I915_TILING_NONE;
237658 }
238659 }
@@ -271,7 +692,7 @@ unsigned int intel_surf_alignment(const struct drm_framebuffer *fb, · 32 unmodified lines
271692 return 512 * 4096;
272693
273694 /* AUX_DIST needs only 4K alignment */
274− if (is_ccs_plane(fb, color_plane))
695+ if (intel_fb_is_ccs_aux_plane(fb, color_plane))
275696 return 4096;
276697
277698 if (is_semiplanar_uv_plane(fb, color_plane)) {
@@ -330,7 +751,7 @@ void intel_fb_plane_get_subsampling(int *hsub, int *vsub, · 52 unmodified lines
330751 * TODO: Deduct the subsampling from the char block for all CCS
331752 * formats and planes.
332753 */
333− if (!is_gen12_ccs_plane(fb, color_plane)) {
754+ if (!intel_fb_is_gen12_ccs_aux_plane(fb, color_plane)) {
334755 *hsub = fb->format->hsub;
335756 *vsub = fb->format->vsub;
336757
@@ -357,24 +778,13 @@ void intel_fb_plane_get_subsampling(int *hsub, int *vsub, · 20 unmodified lines
357778
358779 static void intel_fb_plane_dims(const struct intel_framebuffer *fb, int color_plane, int *w, int *h)
359780 {
360− struct drm_i915_private *i915 = to_i915(fb->base.dev);
361− int main_plane = is_ccs_plane(&fb->base, color_plane) ?
781+ int main_plane = intel_fb_is_ccs_aux_plane(&fb->base, color_plane) ?
362782 skl_ccs_to_main_plane(&fb->base, color_plane) : 0;
363783 unsigned int main_width = fb->base.width;
364784 unsigned int main_height = fb->base.height;
365785 int main_hsub, main_vsub;
366786 int hsub, vsub;
367787
368− /*
369− * On ADL-P the CCS AUX surface layout always aligns with the
370− * power-of-two aligned main surface stride. The main surface
371− * stride in the allocated FB object may not be power-of-two
372− * sized, in which case it is auto-padded to the POT size.
373− */
374− if (IS_ALDERLAKE_P(i915) && is_ccs_plane(&fb->base, color_plane))
375− main_width = gen12_aligned_scanout_stride(fb, 0) /
376− fb->base.format->cpp[0];
377−
378788 intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, &fb->base, main_plane);
379789 intel_fb_plane_get_subsampling(&hsub, &vsub, &fb->base, color_plane);
380790
@@ -409,6 +819,20 @@ static u32 intel_adjust_tile_offset(int *x, int *y, · 28 unmodified lines
409819 return new_offset;
410820 }
411821
822+static u32 intel_adjust_linear_offset(int *x, int *y,
823+ unsigned int cpp,
824+ unsigned int pitch,
825+ u32 old_offset,
826+ u32 new_offset)
827+{
828+ old_offset += *y * pitch + *x * cpp;
829+
830+ *y = (old_offset - new_offset) / pitch;
831+ *x = ((old_offset - new_offset) - *y * pitch) / cpp;
832+
833+ return new_offset;
834+}
835+
412836 static u32 intel_adjust_aligned_offset(int *x, int *y,
413837 const struct drm_framebuffer *fb,
414838 int color_plane,
@@ -439,10 +863,8 @@ static u32 intel_adjust_aligned_offset(int *x, int *y, · 24 unmodified lines
439863 tile_size, pitch_tiles,
440864 old_offset, new_offset);
441865 } else {
442− old_offset += *y * pitch + *x * cpp;
443−
444− *y = (old_offset - new_offset) / pitch;
445− *x = ((old_offset - new_offset) - *y * pitch) / cpp;
866+ intel_adjust_linear_offset(x, y, cpp, pitch,
867+ old_offset, new_offset);
446868 }
447869
448870 return new_offset;
@@ -459,7 +881,7 @@ u32 intel_plane_adjust_aligned_offset(int *x, int *y, · 10 unmodified lines
459881 {
460882 return intel_adjust_aligned_offset(x, y, state->hw.fb, color_plane,
461883 state->hw.rotation,
462− state->view.color_plane[color_plane].stride,
884+ state->view.color_plane[color_plane].mapping_stride,
463885 old_offset, new_offset);
464886 }
465887
@@ -540,7 +962,7 @@ u32 intel_plane_compute_aligned_offset(int *x, int *y, · 74 unmodified lines
540962 struct drm_i915_private *i915 = to_i915(intel_plane->base.dev);
541963 const struct drm_framebuffer *fb = state->hw.fb;
542964 unsigned int rotation = state->hw.rotation;
543− int pitch = state->view.color_plane[color_plane].stride;
965+ int pitch = state->view.color_plane[color_plane].mapping_stride;
544966 u32 alignment;
545967
546968 if (intel_plane->id == PLANE_CURSOR)
@@ -562,6 +984,7 @@ static int intel_fb_offset_to_xy(int *x, int *y, · 15 unmodified lines
562984 u32 alignment;
563985
564986 if (DISPLAY_VER(i915) >= 12 &&
987+ !intel_fb_needs_pot_stride_remap(to_intel_framebuffer(fb)) &&
565988 is_semiplanar_uv_plane(fb, color_plane))
566989 alignment = intel_tile_row_size(fb, color_plane);
567990 else if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
@@ -610,7 +1033,7 @@ static int intel_fb_check_ccs_xy(const struct drm_framebuffer *fb, int ccs_plane · 42 unmodified lines
6101033 int ccs_x, ccs_y;
6111034 int main_x, main_y;
6121035
613− if (!is_ccs_plane(fb, ccs_plane) || is_gen12_ccs_cc_plane(fb, ccs_plane))
1036+ if (!intel_fb_is_ccs_aux_plane(fb, ccs_plane))
6141037 return 0;
6151038
6161039 /*
@@ -673,7 +1096,7 @@ static bool intel_plane_can_remap(const struct intel_plane_state *plane_state) · 56 unmodified lines
6731096 * The new CCS hash mode isn't compatible with remapping as
6741097 * the virtual address of the pages affects the compressed data.
6751098 */
676− if (is_ccs_modifier(fb->modifier))
1099+ if (intel_fb_is_ccs_modifier(fb->modifier))
6771100 return false;
6781101
6791102 /* Linear needs a page aligned stride for remapping */
@@ -699,11 +1122,11 @@ bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb) · 19 unmodified lines
6991122 static int intel_fb_pitch(const struct intel_framebuffer *fb, int color_plane, unsigned int rotation)
7001123 {
7011124 if (drm_rotation_90_or_270(rotation))
702− return fb->rotated_view.color_plane[color_plane].stride;
1125+ return fb->rotated_view.color_plane[color_plane].mapping_stride;
7031126 else if (intel_fb_needs_pot_stride_remap(fb))
704− return fb->remapped_view.color_plane[color_plane].stride;
1127+ return fb->remapped_view.color_plane[color_plane].mapping_stride;
7051128 else
706− return fb->normal_view.color_plane[color_plane].stride;
1129+ return fb->normal_view.color_plane[color_plane].mapping_stride;
7071130 }
7081131
7091132 static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
@@ -814,17 +1237,31 @@ plane_view_dst_stride_tiles(const struct intel_framebuffer *fb, int color_plane, · 104 unmodified lines
8141237 unsigned int pitch_tiles)
8151238 {
8161239 if (intel_fb_needs_pot_stride_remap(fb)) {
817− unsigned int min_stride = is_ccs_plane(&fb->base, color_plane) ? 2 : 8;
8181240 /*
8191241 * ADL_P, the only platform needing a POT stride has a minimum
820− * of 8 main surface and 2 CCS AUX stride tiles.
1242+ * of 8 main surface tiles.
8211243 */
822− return roundup_pow_of_two(max(pitch_tiles, min_stride));
1244+ return roundup_pow_of_two(max(pitch_tiles, 8u));
8231245 } else {
8241246 return pitch_tiles;
8251247 }
8261248 }
8271249
1250+static unsigned int
1251+plane_view_scanout_stride(const struct intel_framebuffer *fb, int color_plane,
1252+ unsigned int tile_width,
1253+ unsigned int src_stride_tiles, unsigned int dst_stride_tiles)
1254+{
1255+ unsigned int stride_tiles;
1256+
1257+ if (IS_ALDERLAKE_P(to_i915(fb->base.dev)))
1258+ stride_tiles = src_stride_tiles;
1259+ else
1260+ stride_tiles = dst_stride_tiles;
1261+
1262+ return stride_tiles * tile_width * fb->base.format->cpp[color_plane];
1263+}
1264+
8281265 static unsigned int
8291266 plane_view_width_tiles(const struct intel_framebuffer *fb, int color_plane,
8301267 const struct fb_plane_view_dims *dims,
@@ -841,11 +1278,31 @@ plane_view_height_tiles(const struct intel_framebuffer *fb, int color_plane, · 10 unmodified lines
8411278 return DIV_ROUND_UP(y + dims->height, dims->tile_height);
8421279 }
8431280
1281+static unsigned int
1282+plane_view_linear_tiles(const struct intel_framebuffer *fb, int color_plane,
1283+ const struct fb_plane_view_dims *dims,
1284+ int x, int y)
1285+{
1286+ struct drm_i915_private *i915 = to_i915(fb->base.dev);
1287+ unsigned int size;
1288+
1289+ size = (y + dims->height) * fb->base.pitches[color_plane] +
1290+ x * fb->base.format->cpp[color_plane];
1291+
1292+ return DIV_ROUND_UP(size, intel_tile_size(i915));
1293+}
1294+
8441295 #define assign_chk_ovf(i915, var, val) ({ \
8451296 drm_WARN_ON(&(i915)->drm, overflows_type(val, var)); \
8461297 (var) = (val); \
8471298 })
8481299
1300+#define assign_bfld_chk_ovf(i915, var, val) ({ \
1301+ (var) = (val); \
1302+ drm_WARN_ON(&(i915)->drm, (var) != (val)); \
1303+ (var); \
1304+})
1305+
8491306 static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_plane,
8501307 const struct fb_plane_view_dims *dims,
8511308 u32 obj_offset, u32 gtt_offset, int x, int y,
@@ -860,12 +1317,26 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 8 unmodified lines
8601317 struct drm_rect r;
8611318 u32 size = 0;
8621319
863− assign_chk_ovf(i915, remap_info->offset, obj_offset);
864− assign_chk_ovf(i915, remap_info->src_stride, plane_view_src_stride_tiles(fb, color_plane, dims));
865− assign_chk_ovf(i915, remap_info->width, plane_view_width_tiles(fb, color_plane, dims, x));
866− assign_chk_ovf(i915, remap_info->height, plane_view_height_tiles(fb, color_plane, dims, y));
1320+ assign_bfld_chk_ovf(i915, remap_info->offset, obj_offset);
1321+
1322+ if (intel_fb_is_gen12_ccs_aux_plane(&fb->base, color_plane)) {
1323+ remap_info->linear = 1;
1324+
1325+ assign_chk_ovf(i915, remap_info->size,
1326+ plane_view_linear_tiles(fb, color_plane, dims, x, y));
1327+ } else {
1328+ remap_info->linear = 0;
1329+
1330+ assign_chk_ovf(i915, remap_info->src_stride,
1331+ plane_view_src_stride_tiles(fb, color_plane, dims));
1332+ assign_chk_ovf(i915, remap_info->width,
1333+ plane_view_width_tiles(fb, color_plane, dims, x));
1334+ assign_chk_ovf(i915, remap_info->height,
1335+ plane_view_height_tiles(fb, color_plane, dims, y));
1336+ }
8671337
8681338 if (view->gtt.type == I915_GGTT_VIEW_ROTATED) {
1339+ drm_WARN_ON(&i915->drm, remap_info->linear);
8691340 check_array_bounds(i915, view->gtt.rotated.plane, color_plane);
8701341
8711342 assign_chk_ovf(i915, remap_info->dst_stride,
@@ -881,7 +1352,8 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 9 unmodified lines
8811352 color_plane_info->x = r.x1;
8821353 color_plane_info->y = r.y1;
8831354
884− color_plane_info->stride = remap_info->dst_stride * tile_height;
1355+ color_plane_info->mapping_stride = remap_info->dst_stride * tile_height;
1356+ color_plane_info->scanout_stride = color_plane_info->mapping_stride;
8851357
8861358 size += remap_info->dst_stride * remap_info->width;
8871359
@@ -900,16 +1372,29 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 12 unmodified lines
9001372 gtt_offset = aligned_offset;
9011373 }
9021374
903− assign_chk_ovf(i915, remap_info->dst_stride,
904− plane_view_dst_stride_tiles(fb, color_plane, remap_info->width));
905−
9061375 color_plane_info->x = x;
9071376 color_plane_info->y = y;
9081377
909− color_plane_info->stride = remap_info->dst_stride * tile_width *
910− fb->base.format->cpp[color_plane];
1378+ if (remap_info->linear) {
1379+ color_plane_info->mapping_stride = fb->base.pitches[color_plane];
1380+ color_plane_info->scanout_stride = color_plane_info->mapping_stride;
9111381
912− size += remap_info->dst_stride * remap_info->height;
1382+ size += remap_info->size;
1383+ } else {
1384+ unsigned int dst_stride = plane_view_dst_stride_tiles(fb, color_plane,
1385+ remap_info->width);
1386+
1387+ assign_chk_ovf(i915, remap_info->dst_stride, dst_stride);
1388+ color_plane_info->mapping_stride = dst_stride *
1389+ tile_width *
1390+ fb->base.format->cpp[color_plane];
1391+ color_plane_info->scanout_stride =
1392+ plane_view_scanout_stride(fb, color_plane, tile_width,
1393+ remap_info->src_stride,
1394+ dst_stride);
1395+
1396+ size += dst_stride * remap_info->height;
1397+ }
9131398 }
9141399
9151400 /*
@@ -917,10 +1402,16 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 1 unmodified line
9171402 * the x/y offsets. x,y will hold the first pixel of the framebuffer
9181403 * plane from the start of the remapped/rotated gtt mapping.
9191404 */
920− intel_adjust_tile_offset(&color_plane_info->x, &color_plane_info->y,
921− tile_width, tile_height,
922− tile_size, remap_info->dst_stride,
923− gtt_offset * tile_size, 0);
1405+ if (remap_info->linear)
1406+ intel_adjust_linear_offset(&color_plane_info->x, &color_plane_info->y,
1407+ fb->base.format->cpp[color_plane],
1408+ color_plane_info->mapping_stride,
1409+ gtt_offset * tile_size, 0);
1410+ else
1411+ intel_adjust_tile_offset(&color_plane_info->x, &color_plane_info->y,
1412+ tile_width, tile_height,
1413+ tile_size, remap_info->dst_stride,
1414+ gtt_offset * tile_size, 0);
9241415
9251416 return size;
9261417 }
@@ -933,15 +1424,10 @@ calc_plane_normal_size(const struct intel_framebuffer *fb, int color_plane, · 6 unmodified lines
9331424 const struct fb_plane_view_dims *dims,
9341425 int x, int y)
9351426 {
936− struct drm_i915_private *i915 = to_i915(fb->base.dev);
9371427 unsigned int tiles;
9381428
9391429 if (is_surface_linear(&fb->base, color_plane)) {
940− unsigned int size;
941−
942− size = (y + dims->height) * fb->base.pitches[color_plane] +
943− x * fb->base.format->cpp[color_plane];
944− tiles = DIV_ROUND_UP(size, intel_tile_size(i915));
1430+ tiles = plane_view_linear_tiles(fb, color_plane, dims, x, y);
9451431 } else {
9461432 tiles = plane_view_src_stride_tiles(fb, color_plane, dims) *
9471433 plane_view_height_tiles(fb, color_plane, dims, y);
@@ -1030,7 +1516,9 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer * · 82 unmodified lines
10301516 */
10311517 fb->normal_view.color_plane[i].x = x;
10321518 fb->normal_view.color_plane[i].y = y;
1033− fb->normal_view.color_plane[i].stride = fb->base.pitches[i];
1519+ fb->normal_view.color_plane[i].mapping_stride = fb->base.pitches[i];
1520+ fb->normal_view.color_plane[i].scanout_stride =
1521+ fb->normal_view.color_plane[i].mapping_stride;
10341522
10351523 offset = calc_plane_aligned_offset(fb, i, &x, &y);
10361524
@@ -1080,7 +1568,7 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state) · 43 unmodified lines
10801568 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
10811569 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
10821570
1083− drm_WARN_ON(&i915->drm, is_ccs_modifier(fb->modifier));
1571+ drm_WARN_ON(&i915->drm, intel_fb_is_ccs_modifier(fb->modifier));
10841572
10851573 /* Make src coordinates relative to the viewport */
10861574 drm_rect_translate(&plane_state->uapi.src,
@@ -1143,7 +1631,7 @@ u32 intel_fb_max_stride(struct drm_i915_private *dev_priv, · 56 unmodified lines
11431631 *
11441632 * The new CCS hash mode makes remapping impossible
11451633 */
1146− if (DISPLAY_VER(dev_priv) < 4 || is_ccs_modifier(modifier) ||
1634+ if (DISPLAY_VER(dev_priv) < 4 || intel_fb_is_ccs_modifier(modifier) ||
11471635 intel_modifier_uses_dpt(dev_priv, modifier))
11481636 return intel_plane_fb_max_stride(dev_priv, pixel_format, modifier);
11491637 else if (DISPLAY_VER(dev_priv) >= 7)
@@ -1168,27 +1656,19 @@ intel_fb_stride_alignment(const struct drm_framebuffer *fb, int color_plane) · 18 unmodified lines
11681656 * we need the stride to be page aligned.
11691657 */
11701658 if (fb->pitches[color_plane] > max_stride &&
1171− !is_ccs_modifier(fb->modifier))
1659+ !intel_fb_is_ccs_modifier(fb->modifier))
11721660 return intel_tile_size(dev_priv);
11731661 else
11741662 return 64;
11751663 }
11761664
11771665 tile_width = intel_tile_width_bytes(fb, color_plane);
1178− if (is_ccs_modifier(fb->modifier)) {
1179− /*
1180− * On ADL-P the stride must be either 8 tiles or a stride
1181− * that is aligned to 16 tiles, required by the 16 tiles =
1182− * 64 kbyte CCS AUX PTE granularity, allowing CCS FBs to be
1183− * remapped.
1184− */
1185− if (IS_ALDERLAKE_P(dev_priv))
1186− tile_width *= fb->pitches[0] <= tile_width * 8 ? 8 : 16;
1666+ if (intel_fb_is_ccs_modifier(fb->modifier)) {
11871667 /*
11881668 * On TGL the surface stride must be 4 tile aligned, mapped by
11891669 * one 64 byte cacheline on the CCS AUX surface.
11901670 */
1191− else if (DISPLAY_VER(dev_priv) >= 12)
1671+ if (DISPLAY_VER(dev_priv) >= 12)
11921672 tile_width *= 4;
11931673 /*
11941674 * Display WA #0531: skl,bxt,kbl,glk
@@ -1224,7 +1704,7 @@ static int intel_plane_check_stride(const struct intel_plane_state *plane_state) · 29 unmodified lines
12241704 return 0;
12251705
12261706 /* FIXME other color planes? */
1227− stride = plane_state->view.color_plane[0].stride;
1707+ stride = plane_state->view.color_plane[0].mapping_stride;
12281708 max_stride = plane->max_stride(plane, fb->format->format,
12291709 fb->modifier, rotation);
12301710
@@ -1430,7 +1910,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb, · 199 unmodified lines
14301910 goto err;
14311911 }
14321912
1433− if (is_gen12_ccs_plane(fb, i) && !is_gen12_ccs_cc_plane(fb, i)) {
1913+ if (intel_fb_is_gen12_ccs_aux_plane(fb, i)) {
14341914 int ccs_aux_stride = gen12_ccs_aux_stride(intel_fb, i);
14351915
14361916 if (fb->pitches[i] != ccs_aux_stride) {
drivers/gpu/drm/i915/display/intel_fb.h+27−4
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #ifndef __INTEL_FB_H__
77 #define __INTEL_FB_H__
88
9+#include <linux/bits.h>
910 #include <linux/types.h>
1011
1112 struct drm_device;
@@ -16,12 +17,34 @@ struct drm_i915_private; · 4 unmodified lines
1617 struct drm_mode_fb_cmd2;
1718 struct intel_fb_view;
1819 struct intel_framebuffer;
20+struct intel_plane;
1921 struct intel_plane_state;
2022
21−bool is_ccs_plane(const struct drm_framebuffer *fb, int plane);
22−bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane);
23−bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane);
24−bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane);
23+#define INTEL_PLANE_CAP_NONE 0
24+#define INTEL_PLANE_CAP_CCS_RC BIT(0)
25+#define INTEL_PLANE_CAP_CCS_RC_CC BIT(1)
26+#define INTEL_PLANE_CAP_CCS_MC BIT(2)
27+#define INTEL_PLANE_CAP_TILING_X BIT(3)
28+#define INTEL_PLANE_CAP_TILING_Y BIT(4)
29+#define INTEL_PLANE_CAP_TILING_Yf BIT(5)
30+
31+bool intel_fb_is_ccs_modifier(u64 modifier);
32+bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
33+bool intel_fb_is_mc_ccs_modifier(u64 modifier);
34+
35+bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
36+int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
37+
38+u64 *intel_fb_plane_get_modifiers(struct drm_i915_private *i915,
39+ u8 plane_caps);
40+bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
41+
42+const struct drm_format_info *
43+intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
44+
45+bool
46+intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
47+ u64 modifier);
2548
2649 bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
2750
drivers/gpu/drm/i915/display/intel_fb_pin.c+5−7
@@ -142,13 +142,11 @@ retry: · 141 unmodified lines
142142 if (ret)
143143 goto err;
144144
145− if (!ret) {
146− vma = i915_gem_object_pin_to_display_plane(obj, &ww, alignment,
147− view, pinctl);
148− if (IS_ERR(vma)) {
149− ret = PTR_ERR(vma);
150− goto err_unpin;
151− }
145+ vma = i915_gem_object_pin_to_display_plane(obj, &ww, alignment,
146+ view, pinctl);
147+ if (IS_ERR(vma)) {
148+ ret = PTR_ERR(vma);
149+ goto err_unpin;
152150 }
153151
154152 if (uses_fence && i915_vma_is_map_and_fenceable(vma)) {
drivers/gpu/drm/i915/display/intel_fbc.c+576−424
@@ -48,6 +48,16 @@ · 47 unmodified lines
4848 #include "intel_fbc.h"
4949 #include "intel_frontbuffer.h"
5050
51+struct intel_fbc_funcs {
52+ void (*activate)(struct intel_fbc *fbc);
53+ void (*deactivate)(struct intel_fbc *fbc);
54+ bool (*is_active)(struct intel_fbc *fbc);
55+ bool (*is_compressing)(struct intel_fbc *fbc);
56+ void (*nuke)(struct intel_fbc *fbc);
57+ void (*program_cfb)(struct intel_fbc *fbc);
58+ void (*set_false_color)(struct intel_fbc *fbc, bool enable);
59+};
60+
5161 /*
5262 * For SKL+, the plane source size used by the hardware is based on the value we
5363 * write to the PLANE_SIZE register. For BDW-, the hardware looks at the value
@@ -68,7 +78,7 @@ static unsigned int intel_fbc_plane_stride(const struct intel_plane_state *plane · 14 unmodified lines
6878 const struct drm_framebuffer *fb = plane_state->hw.fb;
6979 unsigned int stride;
7080
71− stride = plane_state->view.color_plane[0].stride;
81+ stride = plane_state->view.color_plane[0].mapping_stride;
7282 if (!drm_rotation_90_or_270(plane_state->hw.rotation))
7383 stride /= fb->format->cpp[0];
7484
@@ -84,9 +94,10 @@ static unsigned int _intel_fbc_cfb_stride(const struct intel_fbc_state_cache *ca · 9 unmodified lines
8494 }
8595
8696 /* minimum acceptable cfb stride in bytes, assuming 1:1 compression limit */
87−static unsigned int skl_fbc_min_cfb_stride(struct drm_i915_private *i915,
97+static unsigned int skl_fbc_min_cfb_stride(struct intel_fbc *fbc,
8898 const struct intel_fbc_state_cache *cache)
8999 {
100+ struct drm_i915_private *i915 = fbc->i915;
90101 unsigned int limit = 4; /* 1:4 compression limit is the worst case */
91102 unsigned int cpp = 4; /* FBC always 4 bytes per pixel */
92103 unsigned int height = 4; /* FBC segment is 4 lines */
@@ -113,9 +124,10 @@ static unsigned int skl_fbc_min_cfb_stride(struct drm_i915_private *i915, · 20 unmodified lines
113124 }
114125
115126 /* properly aligned cfb stride in bytes, assuming 1:1 compression limit */
116−static unsigned int intel_fbc_cfb_stride(struct drm_i915_private *i915,
127+static unsigned int intel_fbc_cfb_stride(struct intel_fbc *fbc,
117128 const struct intel_fbc_state_cache *cache)
118129 {
130+ struct drm_i915_private *i915 = fbc->i915;
119131 unsigned int stride = _intel_fbc_cfb_stride(cache);
120132
121133 /*
@@ -124,98 +136,182 @@ static unsigned int intel_fbc_cfb_stride(struct drm_i915_private *i915, · 2 unmodified lines
124136 * that regardless of the compression limit we choose later.
125137 */
126138 if (DISPLAY_VER(i915) >= 9)
127− return max(ALIGN(stride, 512), skl_fbc_min_cfb_stride(i915, cache));
139+ return max(ALIGN(stride, 512), skl_fbc_min_cfb_stride(fbc, cache));
128140 else
129141 return stride;
130142 }
131143
132−static unsigned int intel_fbc_cfb_size(struct drm_i915_private *dev_priv,
144+static unsigned int intel_fbc_cfb_size(struct intel_fbc *fbc,
133145 const struct intel_fbc_state_cache *cache)
134146 {
147+ struct drm_i915_private *i915 = fbc->i915;
135148 int lines = cache->plane.src_h;
136149
137− if (DISPLAY_VER(dev_priv) == 7)
150+ if (DISPLAY_VER(i915) == 7)
138151 lines = min(lines, 2048);
139− else if (DISPLAY_VER(dev_priv) >= 8)
152+ else if (DISPLAY_VER(i915) >= 8)
140153 lines = min(lines, 2560);
141154
142− return lines * intel_fbc_cfb_stride(dev_priv, cache);
155+ return lines * intel_fbc_cfb_stride(fbc, cache);
143156 }
144157
145−static void i8xx_fbc_deactivate(struct drm_i915_private *dev_priv)
158+static u32 i8xx_fbc_ctl(struct intel_fbc *fbc)
146159 {
160+ const struct intel_fbc_reg_params *params = &fbc->params;
161+ struct drm_i915_private *i915 = fbc->i915;
162+ unsigned int cfb_stride;
163+ u32 fbc_ctl;
164+
165+ cfb_stride = params->cfb_stride / fbc->limit;
166+
167+ /* FBC_CTL wants 32B or 64B units */
168+ if (DISPLAY_VER(i915) == 2)
169+ cfb_stride = (cfb_stride / 32) - 1;
170+ else
171+ cfb_stride = (cfb_stride / 64) - 1;
172+
173+ fbc_ctl = FBC_CTL_PERIODIC |
174+ FBC_CTL_INTERVAL(params->interval) |
175+ FBC_CTL_STRIDE(cfb_stride);
176+
177+ if (IS_I945GM(i915))
178+ fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */
179+
180+ if (params->fence_id >= 0)
181+ fbc_ctl |= FBC_CTL_FENCENO(params->fence_id);
182+
183+ return fbc_ctl;
184+}
185+
186+static u32 i965_fbc_ctl2(struct intel_fbc *fbc)
187+{
188+ const struct intel_fbc_reg_params *params = &fbc->params;
189+ u32 fbc_ctl2;
190+
191+ fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM |
192+ FBC_CTL_PLANE(params->crtc.i9xx_plane);
193+
194+ if (params->fence_id >= 0)
195+ fbc_ctl2 |= FBC_CTL_CPU_FENCE_EN;
196+
197+ return fbc_ctl2;
198+}
199+
200+static void i8xx_fbc_deactivate(struct intel_fbc *fbc)
201+{
202+ struct drm_i915_private *i915 = fbc->i915;
147203 u32 fbc_ctl;
148204
149205 /* Disable compression */
150− fbc_ctl = intel_de_read(dev_priv, FBC_CONTROL);
206+ fbc_ctl = intel_de_read(i915, FBC_CONTROL);
151207 if ((fbc_ctl & FBC_CTL_EN) == 0)
152208 return;
153209
154210 fbc_ctl &= ~FBC_CTL_EN;
155− intel_de_write(dev_priv, FBC_CONTROL, fbc_ctl);
211+ intel_de_write(i915, FBC_CONTROL, fbc_ctl);
156212
157213 /* Wait for compressing bit to clear */
158− if (intel_de_wait_for_clear(dev_priv, FBC_STATUS,
214+ if (intel_de_wait_for_clear(i915, FBC_STATUS,
159215 FBC_STAT_COMPRESSING, 10)) {
160− drm_dbg_kms(&dev_priv->drm, "FBC idle timed out\n");
216+ drm_dbg_kms(&i915->drm, "FBC idle timed out\n");
161217 return;
162218 }
163219 }
164220
165−static void i8xx_fbc_activate(struct drm_i915_private *dev_priv)
221+static void i8xx_fbc_activate(struct intel_fbc *fbc)
166222 {
167− struct intel_fbc *fbc = &dev_priv->fbc;
168223 const struct intel_fbc_reg_params *params = &fbc->params;
169− int cfb_pitch;
224+ struct drm_i915_private *i915 = fbc->i915;
170225 int i;
171− u32 fbc_ctl;
172−
173− cfb_pitch = params->cfb_stride / fbc->limit;
174−
175− /* FBC_CTL wants 32B or 64B units */
176− if (DISPLAY_VER(dev_priv) == 2)
177− cfb_pitch = (cfb_pitch / 32) - 1;
178− else
179− cfb_pitch = (cfb_pitch / 64) - 1;
180226
181227 /* Clear old tags */
182228 for (i = 0; i < (FBC_LL_SIZE / 32) + 1; i++)
183− intel_de_write(dev_priv, FBC_TAG(i), 0);
184−
185− if (DISPLAY_VER(dev_priv) == 4) {
186− u32 fbc_ctl2;
187−
188− /* Set it up... */
189− fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM;
190− fbc_ctl2 |= FBC_CTL_PLANE(params->crtc.i9xx_plane);
191− if (params->fence_id >= 0)
192− fbc_ctl2 |= FBC_CTL_CPU_FENCE;
193− intel_de_write(dev_priv, FBC_CONTROL2, fbc_ctl2);
194− intel_de_write(dev_priv, FBC_FENCE_OFF,
229+ intel_de_write(i915, FBC_TAG(i), 0);
230+
231+ if (DISPLAY_VER(i915) == 4) {
232+ intel_de_write(i915, FBC_CONTROL2,
233+ i965_fbc_ctl2(fbc));
234+ intel_de_write(i915, FBC_FENCE_OFF,
195235 params->fence_y_offset);
196236 }
197237
198− /* enable it... */
199− fbc_ctl = FBC_CTL_INTERVAL(params->interval);
200− fbc_ctl |= FBC_CTL_EN | FBC_CTL_PERIODIC;
201− if (IS_I945GM(dev_priv))
202− fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */
203− fbc_ctl |= FBC_CTL_STRIDE(cfb_pitch & 0xff);
204− if (params->fence_id >= 0)
205− fbc_ctl |= FBC_CTL_FENCENO(params->fence_id);
206− intel_de_write(dev_priv, FBC_CONTROL, fbc_ctl);
238+ intel_de_write(i915, FBC_CONTROL,
239+ FBC_CTL_EN | i8xx_fbc_ctl(fbc));
207240 }
208241
209−static bool i8xx_fbc_is_active(struct drm_i915_private *dev_priv)
242+static bool i8xx_fbc_is_active(struct intel_fbc *fbc)
210243 {
211− return intel_de_read(dev_priv, FBC_CONTROL) & FBC_CTL_EN;
244+ return intel_de_read(fbc->i915, FBC_CONTROL) & FBC_CTL_EN;
212245 }
213246
214−static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915)
247+static bool i8xx_fbc_is_compressing(struct intel_fbc *fbc)
215248 {
216− switch (i915->fbc.limit) {
249+ return intel_de_read(fbc->i915, FBC_STATUS) &
250+ (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED);
251+}
252+
253+static void i8xx_fbc_nuke(struct intel_fbc *fbc)
254+{
255+ struct intel_fbc_reg_params *params = &fbc->params;
256+ enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
257+ struct drm_i915_private *dev_priv = fbc->i915;
258+
259+ spin_lock_irq(&dev_priv->uncore.lock);
260+ intel_de_write_fw(dev_priv, DSPADDR(i9xx_plane),
261+ intel_de_read_fw(dev_priv, DSPADDR(i9xx_plane)));
262+ spin_unlock_irq(&dev_priv->uncore.lock);
263+}
264+
265+static void i8xx_fbc_program_cfb(struct intel_fbc *fbc)
266+{
267+ struct drm_i915_private *i915 = fbc->i915;
268+
269+ GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.start,
270+ fbc->compressed_fb.start, U32_MAX));
271+ GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.start,
272+ fbc->compressed_llb.start, U32_MAX));
273+
274+ intel_de_write(i915, FBC_CFB_BASE,
275+ i915->dsm.start + fbc->compressed_fb.start);
276+ intel_de_write(i915, FBC_LL_BASE,
277+ i915->dsm.start + fbc->compressed_llb.start);
278+}
279+
280+static const struct intel_fbc_funcs i8xx_fbc_funcs = {
281+ .activate = i8xx_fbc_activate,
282+ .deactivate = i8xx_fbc_deactivate,
283+ .is_active = i8xx_fbc_is_active,
284+ .is_compressing = i8xx_fbc_is_compressing,
285+ .nuke = i8xx_fbc_nuke,
286+ .program_cfb = i8xx_fbc_program_cfb,
287+};
288+
289+static void i965_fbc_nuke(struct intel_fbc *fbc)
290+{
291+ struct intel_fbc_reg_params *params = &fbc->params;
292+ enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
293+ struct drm_i915_private *dev_priv = fbc->i915;
294+
295+ spin_lock_irq(&dev_priv->uncore.lock);
296+ intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane),
297+ intel_de_read_fw(dev_priv, DSPSURF(i9xx_plane)));
298+ spin_unlock_irq(&dev_priv->uncore.lock);
299+}
300+
301+static const struct intel_fbc_funcs i965_fbc_funcs = {
302+ .activate = i8xx_fbc_activate,
303+ .deactivate = i8xx_fbc_deactivate,
304+ .is_active = i8xx_fbc_is_active,
305+ .is_compressing = i8xx_fbc_is_compressing,
306+ .nuke = i965_fbc_nuke,
307+ .program_cfb = i8xx_fbc_program_cfb,
308+};
309+
310+static u32 g4x_dpfc_ctl_limit(struct intel_fbc *fbc)
311+{
312+ switch (fbc->limit) {
217313 default:
218− MISSING_CASE(i915->fbc.limit);
314+ MISSING_CASE(fbc->limit);
219315 fallthrough;
220316 case 1:
221317 return DPFC_CTL_LIMIT_1X;
@@ -226,260 +322,334 @@ static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) · 4 unmodified lines
226322 }
227323 }
228324
229−static void g4x_fbc_activate(struct drm_i915_private *dev_priv)
325+static u32 g4x_dpfc_ctl(struct intel_fbc *fbc)
230326 {
231− struct intel_fbc_reg_params *params = &dev_priv->fbc.params;
327+ const struct intel_fbc_reg_params *params = &fbc->params;
328+ struct drm_i915_private *i915 = fbc->i915;
232329 u32 dpfc_ctl;
233330
234− dpfc_ctl = DPFC_CTL_PLANE(params->crtc.i9xx_plane) | DPFC_SR_EN;
331+ dpfc_ctl = g4x_dpfc_ctl_limit(fbc) |
332+ DPFC_CTL_PLANE_G4X(params->crtc.i9xx_plane);
235333
236− dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv);
334+ if (IS_G4X(i915))
335+ dpfc_ctl |= DPFC_CTL_SR_EN;
237336
238337 if (params->fence_id >= 0) {
239− dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fence_id;
240− intel_de_write(dev_priv, DPFC_FENCE_YOFF,
241− params->fence_y_offset);
242− } else {
243− intel_de_write(dev_priv, DPFC_FENCE_YOFF, 0);
338+ dpfc_ctl |= DPFC_CTL_FENCE_EN_G4X;
339+
340+ if (DISPLAY_VER(i915) < 6)
341+ dpfc_ctl |= DPFC_CTL_FENCENO(params->fence_id);
244342 }
245343
246− /* enable it... */
247− intel_de_write(dev_priv, DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN);
344+ return dpfc_ctl;
345+}
346+
347+static void g4x_fbc_activate(struct intel_fbc *fbc)
348+{
349+ const struct intel_fbc_reg_params *params = &fbc->params;
350+ struct drm_i915_private *i915 = fbc->i915;
351+
352+ intel_de_write(i915, DPFC_FENCE_YOFF,
353+ params->fence_y_offset);
354+
355+ intel_de_write(i915, DPFC_CONTROL,
356+ DPFC_CTL_EN | g4x_dpfc_ctl(fbc));
248357 }
249358
250−static void g4x_fbc_deactivate(struct drm_i915_private *dev_priv)
359+static void g4x_fbc_deactivate(struct intel_fbc *fbc)
251360 {
361+ struct drm_i915_private *i915 = fbc->i915;
252362 u32 dpfc_ctl;
253363
254364 /* Disable compression */
255− dpfc_ctl = intel_de_read(dev_priv, DPFC_CONTROL);
365+ dpfc_ctl = intel_de_read(i915, DPFC_CONTROL);
256366 if (dpfc_ctl & DPFC_CTL_EN) {
257367 dpfc_ctl &= ~DPFC_CTL_EN;
258− intel_de_write(dev_priv, DPFC_CONTROL, dpfc_ctl);
368+ intel_de_write(i915, DPFC_CONTROL, dpfc_ctl);
259369 }
260370 }
261371
262−static bool g4x_fbc_is_active(struct drm_i915_private *dev_priv)
372+static bool g4x_fbc_is_active(struct intel_fbc *fbc)
263373 {
264− return intel_de_read(dev_priv, DPFC_CONTROL) & DPFC_CTL_EN;
374+ return intel_de_read(fbc->i915, DPFC_CONTROL) & DPFC_CTL_EN;
265375 }
266376
267−static void i8xx_fbc_recompress(struct drm_i915_private *dev_priv)
377+static bool g4x_fbc_is_compressing(struct intel_fbc *fbc)
268378 {
269− struct intel_fbc_reg_params *params = &dev_priv->fbc.params;
270− enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
379+ return intel_de_read(fbc->i915, DPFC_STATUS) & DPFC_COMP_SEG_MASK;
380+}
271381
272− spin_lock_irq(&dev_priv->uncore.lock);
273− intel_de_write_fw(dev_priv, DSPADDR(i9xx_plane),
274− intel_de_read_fw(dev_priv, DSPADDR(i9xx_plane)));
275− spin_unlock_irq(&dev_priv->uncore.lock);
382+static void g4x_fbc_program_cfb(struct intel_fbc *fbc)
383+{
384+ struct drm_i915_private *i915 = fbc->i915;
385+
386+ intel_de_write(i915, DPFC_CB_BASE, fbc->compressed_fb.start);
276387 }
277388
278−static void i965_fbc_recompress(struct drm_i915_private *dev_priv)
389+static const struct intel_fbc_funcs g4x_fbc_funcs = {
390+ .activate = g4x_fbc_activate,
391+ .deactivate = g4x_fbc_deactivate,
392+ .is_active = g4x_fbc_is_active,
393+ .is_compressing = g4x_fbc_is_compressing,
394+ .nuke = i965_fbc_nuke,
395+ .program_cfb = g4x_fbc_program_cfb,
396+};
397+
398+static void ilk_fbc_activate(struct intel_fbc *fbc)
279399 {
280− struct intel_fbc_reg_params *params = &dev_priv->fbc.params;
281− enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
400+ struct intel_fbc_reg_params *params = &fbc->params;
401+ struct drm_i915_private *i915 = fbc->i915;
282402
283− spin_lock_irq(&dev_priv->uncore.lock);
284− intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane),
285− intel_de_read_fw(dev_priv, DSPSURF(i9xx_plane)));
286− spin_unlock_irq(&dev_priv->uncore.lock);
403+ intel_de_write(i915, ILK_DPFC_FENCE_YOFF,
404+ params->fence_y_offset);
405+
406+ intel_de_write(i915, ILK_DPFC_CONTROL,
407+ DPFC_CTL_EN | g4x_dpfc_ctl(fbc));
287408 }
288409
289−/* This function forces a CFB recompression through the nuke operation. */
290−static void snb_fbc_recompress(struct drm_i915_private *dev_priv)
410+static void ilk_fbc_deactivate(struct intel_fbc *fbc)
291411 {
292− intel_de_write(dev_priv, MSG_FBC_REND_STATE, FBC_REND_NUKE);
293− intel_de_posting_read(dev_priv, MSG_FBC_REND_STATE);
412+ struct drm_i915_private *i915 = fbc->i915;
413+ u32 dpfc_ctl;
414+
415+ /* Disable compression */
416+ dpfc_ctl = intel_de_read(i915, ILK_DPFC_CONTROL);
417+ if (dpfc_ctl & DPFC_CTL_EN) {
418+ dpfc_ctl &= ~DPFC_CTL_EN;
419+ intel_de_write(i915, ILK_DPFC_CONTROL, dpfc_ctl);
420+ }
294421 }
295422
296−static void intel_fbc_recompress(struct drm_i915_private *dev_priv)
423+static bool ilk_fbc_is_active(struct intel_fbc *fbc)
297424 {
298− struct intel_fbc *fbc = &dev_priv->fbc;
425+ return intel_de_read(fbc->i915, ILK_DPFC_CONTROL) & DPFC_CTL_EN;
426+}
299427
300− trace_intel_fbc_nuke(fbc->crtc);
428+static bool ilk_fbc_is_compressing(struct intel_fbc *fbc)
429+{
430+ return intel_de_read(fbc->i915, ILK_DPFC_STATUS) & DPFC_COMP_SEG_MASK;
431+}
301432
302− if (DISPLAY_VER(dev_priv) >= 6)
303− snb_fbc_recompress(dev_priv);
304− else if (DISPLAY_VER(dev_priv) >= 4)
305− i965_fbc_recompress(dev_priv);
306− else
307− i8xx_fbc_recompress(dev_priv);
433+static void ilk_fbc_program_cfb(struct intel_fbc *fbc)
434+{
435+ struct drm_i915_private *i915 = fbc->i915;
436+
437+ intel_de_write(i915, ILK_DPFC_CB_BASE, fbc->compressed_fb.start);
308438 }
309439
310−static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
440+static const struct intel_fbc_funcs ilk_fbc_funcs = {
441+ .activate = ilk_fbc_activate,
442+ .deactivate = ilk_fbc_deactivate,
443+ .is_active = ilk_fbc_is_active,
444+ .is_compressing = ilk_fbc_is_compressing,
445+ .nuke = i965_fbc_nuke,
446+ .program_cfb = ilk_fbc_program_cfb,
447+};
448+
449+static void snb_fbc_program_fence(struct intel_fbc *fbc)
311450 {
312− struct intel_fbc_reg_params *params = &dev_priv->fbc.params;
313− u32 dpfc_ctl;
451+ const struct intel_fbc_reg_params *params = &fbc->params;
452+ struct drm_i915_private *i915 = fbc->i915;
453+ u32 ctl = 0;
314454
315− dpfc_ctl = DPFC_CTL_PLANE(params->crtc.i9xx_plane);
455+ if (params->fence_id >= 0)
456+ ctl = SNB_DPFC_FENCE_EN | SNB_DPFC_FENCENO(params->fence_id);
316457
317− dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv);
458+ intel_de_write(i915, SNB_DPFC_CTL_SA, ctl);
459+ intel_de_write(i915, SNB_DPFC_CPU_FENCE_OFFSET, params->fence_y_offset);
460+}
318461
319− if (params->fence_id >= 0) {
320− dpfc_ctl |= DPFC_CTL_FENCE_EN;
321− if (IS_IRONLAKE(dev_priv))
322− dpfc_ctl |= params->fence_id;
323− if (IS_SANDYBRIDGE(dev_priv)) {
324− intel_de_write(dev_priv, SNB_DPFC_CTL_SA,
325− SNB_CPU_FENCE_ENABLE | params->fence_id);
326− intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET,
327− params->fence_y_offset);
328− }
329− } else {
330− if (IS_SANDYBRIDGE(dev_priv)) {
331− intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0);
332− intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0);
333− }
334− }
462+static void snb_fbc_activate(struct intel_fbc *fbc)
463+{
464+ snb_fbc_program_fence(fbc);
335465
336− intel_de_write(dev_priv, ILK_DPFC_FENCE_YOFF,
337− params->fence_y_offset);
338− /* enable it... */
339− intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN);
466+ ilk_fbc_activate(fbc);
340467 }
341468
342−static void ilk_fbc_deactivate(struct drm_i915_private *dev_priv)
469+static void snb_fbc_nuke(struct intel_fbc *fbc)
343470 {
344− u32 dpfc_ctl;
471+ struct drm_i915_private *i915 = fbc->i915;
345472
346− /* Disable compression */
347− dpfc_ctl = intel_de_read(dev_priv, ILK_DPFC_CONTROL);
348− if (dpfc_ctl & DPFC_CTL_EN) {
349− dpfc_ctl &= ~DPFC_CTL_EN;
350− intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl);
351− }
473+ intel_de_write(i915, MSG_FBC_REND_STATE, FBC_REND_NUKE);
474+ intel_de_posting_read(i915, MSG_FBC_REND_STATE);
475+}
476+
477+static const struct intel_fbc_funcs snb_fbc_funcs = {
478+ .activate = snb_fbc_activate,
479+ .deactivate = ilk_fbc_deactivate,
480+ .is_active = ilk_fbc_is_active,
481+ .is_compressing = ilk_fbc_is_compressing,
482+ .nuke = snb_fbc_nuke,
483+ .program_cfb = ilk_fbc_program_cfb,
484+};
485+
486+static void glk_fbc_program_cfb_stride(struct intel_fbc *fbc)
487+{
488+ const struct intel_fbc_reg_params *params = &fbc->params;
489+ struct drm_i915_private *i915 = fbc->i915;
490+ u32 val = 0;
491+
492+ if (params->override_cfb_stride)
493+ val |= FBC_STRIDE_OVERRIDE |
494+ FBC_STRIDE(params->override_cfb_stride / fbc->limit);
495+
496+ intel_de_write(i915, GLK_FBC_STRIDE, val);
352497 }
353498
354−static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv)
499+static void skl_fbc_program_cfb_stride(struct intel_fbc *fbc)
355500 {
356− return intel_de_read(dev_priv, ILK_DPFC_CONTROL) & DPFC_CTL_EN;
501+ const struct intel_fbc_reg_params *params = &fbc->params;
502+ struct drm_i915_private *i915 = fbc->i915;
503+ u32 val = 0;
504+
505+ /* Display WA #0529: skl, kbl, bxt. */
506+ if (params->override_cfb_stride)
507+ val |= CHICKEN_FBC_STRIDE_OVERRIDE |
508+ CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit);
509+
510+ intel_de_rmw(i915, CHICKEN_MISC_4,
511+ CHICKEN_FBC_STRIDE_OVERRIDE |
512+ CHICKEN_FBC_STRIDE_MASK, val);
357513 }
358514
359−static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
515+static u32 ivb_dpfc_ctl(struct intel_fbc *fbc)
360516 {
361− struct intel_fbc *fbc = &dev_priv->fbc;
362517 const struct intel_fbc_reg_params *params = &fbc->params;
518+ struct drm_i915_private *i915 = fbc->i915;
363519 u32 dpfc_ctl;
364520
365− if (DISPLAY_VER(dev_priv) >= 10) {
366− u32 val = 0;
521+ dpfc_ctl = g4x_dpfc_ctl_limit(fbc);
367522
368− if (params->override_cfb_stride)
369− val |= FBC_STRIDE_OVERRIDE |
370− FBC_STRIDE(params->override_cfb_stride / fbc->limit);
523+ if (IS_IVYBRIDGE(i915))
524+ dpfc_ctl |= DPFC_CTL_PLANE_IVB(params->crtc.i9xx_plane);
371525
372− intel_de_write(dev_priv, GLK_FBC_STRIDE, val);
373− } else if (DISPLAY_VER(dev_priv) == 9) {
374− u32 val = 0;
526+ if (params->fence_id >= 0)
527+ dpfc_ctl |= DPFC_CTL_FENCE_EN_IVB;
375528
376− /* Display WA #0529: skl, kbl, bxt. */
377− if (params->override_cfb_stride)
378− val |= CHICKEN_FBC_STRIDE_OVERRIDE |
379− CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit);
529+ if (fbc->false_color)
530+ dpfc_ctl |= DPFC_CTL_FALSE_COLOR;
380531
381− intel_de_rmw(dev_priv, CHICKEN_MISC_4,
382− CHICKEN_FBC_STRIDE_OVERRIDE |
383− CHICKEN_FBC_STRIDE_MASK, val);
384− }
532+ return dpfc_ctl;
533+}
385534
386− dpfc_ctl = 0;
387− if (IS_IVYBRIDGE(dev_priv))
388− dpfc_ctl |= IVB_DPFC_CTL_PLANE(params->crtc.i9xx_plane);
535+static void ivb_fbc_activate(struct intel_fbc *fbc)
536+{
537+ struct drm_i915_private *i915 = fbc->i915;
389538
390− dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv);
539+ if (DISPLAY_VER(i915) >= 10)
540+ glk_fbc_program_cfb_stride(fbc);
541+ else if (DISPLAY_VER(i915) == 9)
542+ skl_fbc_program_cfb_stride(fbc);
391543
392− if (params->fence_id >= 0) {
393− dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN;
394− intel_de_write(dev_priv, SNB_DPFC_CTL_SA,
395− SNB_CPU_FENCE_ENABLE | params->fence_id);
396− intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET,
397− params->fence_y_offset);
398− } else if (dev_priv->ggtt.num_fences) {
399− intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0);
400− intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0);
401− }
544+ if (i915->ggtt.num_fences)
545+ snb_fbc_program_fence(fbc);
402546
403− if (dev_priv->fbc.false_color)
404− dpfc_ctl |= FBC_CTL_FALSE_COLOR;
547+ intel_de_write(i915, ILK_DPFC_CONTROL,
548+ DPFC_CTL_EN | ivb_dpfc_ctl(fbc));
549+}
405550
406− intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN);
551+static bool ivb_fbc_is_compressing(struct intel_fbc *fbc)
552+{
553+ return intel_de_read(fbc->i915, ILK_DPFC_STATUS2) & DPFC_COMP_SEG_MASK_IVB;
407554 }
408555
409−static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv)
556+static void ivb_fbc_set_false_color(struct intel_fbc *fbc,
557+ bool enable)
410558 {
411− if (DISPLAY_VER(dev_priv) >= 5)
412− return ilk_fbc_is_active(dev_priv);
413− else if (IS_GM45(dev_priv))
414− return g4x_fbc_is_active(dev_priv);
415− else
416− return i8xx_fbc_is_active(dev_priv);
559+ intel_de_rmw(fbc->i915, ILK_DPFC_CONTROL,
560+ DPFC_CTL_FALSE_COLOR, enable ? DPFC_CTL_FALSE_COLOR : 0);
417561 }
418562
419−static void intel_fbc_hw_activate(struct drm_i915_private *dev_priv)
563+static const struct intel_fbc_funcs ivb_fbc_funcs = {
564+ .activate = ivb_fbc_activate,
565+ .deactivate = ilk_fbc_deactivate,
566+ .is_active = ilk_fbc_is_active,
567+ .is_compressing = ivb_fbc_is_compressing,
568+ .nuke = snb_fbc_nuke,
569+ .program_cfb = ilk_fbc_program_cfb,
570+ .set_false_color = ivb_fbc_set_false_color,
571+};
572+
573+static bool intel_fbc_hw_is_active(struct intel_fbc *fbc)
420574 {
421− struct intel_fbc *fbc = &dev_priv->fbc;
575+ return fbc->funcs->is_active(fbc);
576+}
422577
578+static void intel_fbc_hw_activate(struct intel_fbc *fbc)
579+{
423580 trace_intel_fbc_activate(fbc->crtc);
424581
425582 fbc->active = true;
426583 fbc->activated = true;
427584
428− if (DISPLAY_VER(dev_priv) >= 7)
429− gen7_fbc_activate(dev_priv);
430− else if (DISPLAY_VER(dev_priv) >= 5)
431− ilk_fbc_activate(dev_priv);
432− else if (IS_GM45(dev_priv))
433− g4x_fbc_activate(dev_priv);
434− else
435− i8xx_fbc_activate(dev_priv);
585+ fbc->funcs->activate(fbc);
436586 }
437587
438−static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv)
588+static void intel_fbc_hw_deactivate(struct intel_fbc *fbc)
439589 {
440− struct intel_fbc *fbc = &dev_priv->fbc;
441−
442590 trace_intel_fbc_deactivate(fbc->crtc);
443591
444592 fbc->active = false;
445593
446− if (DISPLAY_VER(dev_priv) >= 5)
447− ilk_fbc_deactivate(dev_priv);
448− else if (IS_GM45(dev_priv))
449− g4x_fbc_deactivate(dev_priv);
450− else
451− i8xx_fbc_deactivate(dev_priv);
594+ fbc->funcs->deactivate(fbc);
595+}
596+
597+bool intel_fbc_is_compressing(struct intel_fbc *fbc)
598+{
599+ return fbc->funcs->is_compressing(fbc);
600+}
601+
602+static void intel_fbc_nuke(struct intel_fbc *fbc)
603+{
604+ trace_intel_fbc_nuke(fbc->crtc);
605+
606+ fbc->funcs->nuke(fbc);
607+}
608+
609+int intel_fbc_set_false_color(struct intel_fbc *fbc, bool enable)
610+{
611+ if (!fbc->funcs || !fbc->funcs->set_false_color)
612+ return -ENODEV;
613+
614+ mutex_lock(&fbc->lock);
615+
616+ fbc->false_color = enable;
617+
618+ fbc->funcs->set_false_color(fbc, enable);
619+
620+ mutex_unlock(&fbc->lock);
621+
622+ return 0;
452623 }
453624
454625 /**
455626 * intel_fbc_is_active - Is FBC active?
456− * @dev_priv: i915 device instance
627+ * @fbc: The FBC instance
457628 *
458629 * This function is used to verify the current state of FBC.
459630 *
460631 * FIXME: This should be tracked in the plane config eventually
461632 * instead of queried at runtime for most callers.
462633 */
463−bool intel_fbc_is_active(struct drm_i915_private *dev_priv)
634+bool intel_fbc_is_active(struct intel_fbc *fbc)
464635 {
465− return dev_priv->fbc.active;
636+ return fbc->active;
466637 }
467638
468−static void intel_fbc_activate(struct drm_i915_private *dev_priv)
639+static void intel_fbc_activate(struct intel_fbc *fbc)
469640 {
470− intel_fbc_hw_activate(dev_priv);
471− intel_fbc_recompress(dev_priv);
641+ intel_fbc_hw_activate(fbc);
642+ intel_fbc_nuke(fbc);
472643 }
473644
474−static void intel_fbc_deactivate(struct drm_i915_private *dev_priv,
475− const char *reason)
645+static void intel_fbc_deactivate(struct intel_fbc *fbc, const char *reason)
476646 {
477− struct intel_fbc *fbc = &dev_priv->fbc;
647+ struct drm_i915_private *i915 = fbc->i915;
478648
479− drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock));
649+ drm_WARN_ON(&i915->drm, !mutex_is_locked(&fbc->lock));
480650
481651 if (fbc->active)
482− intel_fbc_hw_deactivate(dev_priv);
652+ intel_fbc_hw_deactivate(fbc);
483653
484654 fbc->no_fbc_reason = reason;
485655 }
@@ -492,7 +662,7 @@ static u64 intel_fbc_cfb_base_max(struct drm_i915_private *i915) · 6 unmodified lines
492662 return BIT_ULL(32);
493663 }
494664
495−static u64 intel_fbc_stolen_end(struct drm_i915_private *dev_priv)
665+static u64 intel_fbc_stolen_end(struct drm_i915_private *i915)
496666 {
497667 u64 end;
498668
@@ -500,13 +670,13 @@ static u64 intel_fbc_stolen_end(struct drm_i915_private *dev_priv) · 1 unmodified line
500670 * reserved range size, so it always assumes the maximum (8mb) is used.
501671 * If we enable FBC using a CFB on that memory range we'll get FIFO
502672 * underruns, even if that range is not reserved by the BIOS. */
503− if (IS_BROADWELL(dev_priv) || (DISPLAY_VER(dev_priv) == 9 &&
504− !IS_BROXTON(dev_priv)))
505− end = resource_size(&dev_priv->dsm) - 8 * 1024 * 1024;
673+ if (IS_BROADWELL(i915) ||
674+ (DISPLAY_VER(i915) == 9 && !IS_BROXTON(i915)))
675+ end = resource_size(&i915->dsm) - 8 * 1024 * 1024;
506676 else
507677 end = U64_MAX;
508678
509− return min(end, intel_fbc_cfb_base_max(dev_priv));
679+ return min(end, intel_fbc_cfb_base_max(i915));
510680 }
511681
512682 static int intel_fbc_min_limit(int fb_cpp)
@@ -514,10 +684,10 @@ static int intel_fbc_min_limit(int fb_cpp) · 1 unmodified line
514684 return fb_cpp == 2 ? 2 : 1;
515685 }
516686
517−static int intel_fbc_max_limit(struct drm_i915_private *dev_priv)
687+static int intel_fbc_max_limit(struct drm_i915_private *i915)
518688 {
519689 /* WaFbcOnly1to1Ratio:ctg */
520− if (IS_G4X(dev_priv))
690+ if (IS_G4X(i915))
521691 return 1;
522692
523693 /*
@@ -527,23 +697,23 @@ static int intel_fbc_max_limit(struct drm_i915_private *dev_priv) · 3 unmodified lines
527697 return 4;
528698 }
529699
530−static int find_compression_limit(struct drm_i915_private *dev_priv,
700+static int find_compression_limit(struct intel_fbc *fbc,
531701 unsigned int size, int min_limit)
532702 {
533− struct intel_fbc *fbc = &dev_priv->fbc;
534− u64 end = intel_fbc_stolen_end(dev_priv);
703+ struct drm_i915_private *i915 = fbc->i915;
704+ u64 end = intel_fbc_stolen_end(i915);
535705 int ret, limit = min_limit;
536706
537707 size /= limit;
538708
539709 /* Try to over-allocate to reduce reallocations and fragmentation. */
540− ret = i915_gem_stolen_insert_node_in_range(dev_priv, &fbc->compressed_fb,
710+ ret = i915_gem_stolen_insert_node_in_range(i915, &fbc->compressed_fb,
541711 size <<= 1, 4096, 0, end);
542712 if (ret == 0)
543713 return limit;
544714
545− for (; limit <= intel_fbc_max_limit(dev_priv); limit <<= 1) {
546− ret = i915_gem_stolen_insert_node_in_range(dev_priv, &fbc->compressed_fb,
715+ for (; limit <= intel_fbc_max_limit(i915); limit <<= 1) {
716+ ret = i915_gem_stolen_insert_node_in_range(i915, &fbc->compressed_fb,
547717 size >>= 1, 4096, 0, end);
548718 if (ret == 0)
549719 return limit;
@@ -552,34 +722,34 @@ static int find_compression_limit(struct drm_i915_private *dev_priv, · 2 unmodified lines
552722 return 0;
553723 }
554724
555−static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv,
725+static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
556726 unsigned int size, int min_limit)
557727 {
558− struct intel_fbc *fbc = &dev_priv->fbc;
728+ struct drm_i915_private *i915 = fbc->i915;
559729 int ret;
560730
561− drm_WARN_ON(&dev_priv->drm,
731+ drm_WARN_ON(&i915->drm,
562732 drm_mm_node_allocated(&fbc->compressed_fb));
563− drm_WARN_ON(&dev_priv->drm,
733+ drm_WARN_ON(&i915->drm,
564734 drm_mm_node_allocated(&fbc->compressed_llb));
565735
566− if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv)) {
567− ret = i915_gem_stolen_insert_node(dev_priv, &fbc->compressed_llb,
736+ if (DISPLAY_VER(i915) < 5 && !IS_G4X(i915)) {
737+ ret = i915_gem_stolen_insert_node(i915, &fbc->compressed_llb,
568738 4096, 4096);
569739 if (ret)
570740 goto err;
571741 }
572742
573− ret = find_compression_limit(dev_priv, size, min_limit);
743+ ret = find_compression_limit(fbc, size, min_limit);
574744 if (!ret)
575745 goto err_llb;
576746 else if (ret > min_limit)
577− drm_info_once(&dev_priv->drm,
747+ drm_info_once(&i915->drm,
578748 "Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n");
579749
580750 fbc->limit = ret;
581751
582− drm_dbg_kms(&dev_priv->drm,
752+ drm_dbg_kms(&i915->drm,
583753 "reserved %llu bytes of contiguous stolen space for FBC, limit: %d\n",
584754 fbc->compressed_fb.size, fbc->limit);
585755
@@ -587,82 +757,62 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv, · 1 unmodified line
587757
588758 err_llb:
589759 if (drm_mm_node_allocated(&fbc->compressed_llb))
590− i915_gem_stolen_remove_node(dev_priv, &fbc->compressed_llb);
760+ i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
591761 err:
592− if (drm_mm_initialized(&dev_priv->mm.stolen))
593− drm_info_once(&dev_priv->drm, "not enough stolen space for compressed buffer (need %d more bytes), disabling. Hint: you may be able to increase stolen memory size in the BIOS to avoid this.\n", size);
762+ if (drm_mm_initialized(&i915->mm.stolen))
763+ drm_info_once(&i915->drm, "not enough stolen space for compressed buffer (need %d more bytes), disabling. Hint: you may be able to increase stolen memory size in the BIOS to avoid this.\n", size);
594764 return -ENOSPC;
595765 }
596766
597−static void intel_fbc_program_cfb(struct drm_i915_private *dev_priv)
767+static void intel_fbc_program_cfb(struct intel_fbc *fbc)
598768 {
599− struct intel_fbc *fbc = &dev_priv->fbc;
600−
601− if (DISPLAY_VER(dev_priv) >= 5) {
602− intel_de_write(dev_priv, ILK_DPFC_CB_BASE,
603− fbc->compressed_fb.start);
604− } else if (IS_GM45(dev_priv)) {
605− intel_de_write(dev_priv, DPFC_CB_BASE,
606− fbc->compressed_fb.start);
607− } else {
608− GEM_BUG_ON(range_overflows_end_t(u64, dev_priv->dsm.start,
609− fbc->compressed_fb.start,
610− U32_MAX));
611− GEM_BUG_ON(range_overflows_end_t(u64, dev_priv->dsm.start,
612− fbc->compressed_llb.start,
613− U32_MAX));
614−
615− intel_de_write(dev_priv, FBC_CFB_BASE,
616− dev_priv->dsm.start + fbc->compressed_fb.start);
617− intel_de_write(dev_priv, FBC_LL_BASE,
618− dev_priv->dsm.start + fbc->compressed_llb.start);
619− }
769+ fbc->funcs->program_cfb(fbc);
620770 }
621771
622−static void __intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv)
772+static void __intel_fbc_cleanup_cfb(struct intel_fbc *fbc)
623773 {
624− struct intel_fbc *fbc = &dev_priv->fbc;
774+ struct drm_i915_private *i915 = fbc->i915;
625775
626− if (WARN_ON(intel_fbc_hw_is_active(dev_priv)))
776+ if (WARN_ON(intel_fbc_hw_is_active(fbc)))
627777 return;
628778
629779 if (drm_mm_node_allocated(&fbc->compressed_llb))
630− i915_gem_stolen_remove_node(dev_priv, &fbc->compressed_llb);
780+ i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
631781 if (drm_mm_node_allocated(&fbc->compressed_fb))
632− i915_gem_stolen_remove_node(dev_priv, &fbc->compressed_fb);
782+ i915_gem_stolen_remove_node(i915, &fbc->compressed_fb);
633783 }
634784
635−void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv)
785+void intel_fbc_cleanup(struct drm_i915_private *i915)
636786 {
637− struct intel_fbc *fbc = &dev_priv->fbc;
787+ struct intel_fbc *fbc = &i915->fbc;
638788
639− if (!HAS_FBC(dev_priv))
789+ if (!HAS_FBC(i915))
640790 return;
641791
642792 mutex_lock(&fbc->lock);
643− __intel_fbc_cleanup_cfb(dev_priv);
793+ __intel_fbc_cleanup_cfb(fbc);
644794 mutex_unlock(&fbc->lock);
645795 }
646796
647−static bool stride_is_valid(struct drm_i915_private *dev_priv,
797+static bool stride_is_valid(struct drm_i915_private *i915,
648798 u64 modifier, unsigned int stride)
649799 {
650800 /* This should have been caught earlier. */
651− if (drm_WARN_ON_ONCE(&dev_priv->drm, (stride & (64 - 1)) != 0))
801+ if (drm_WARN_ON_ONCE(&i915->drm, (stride & (64 - 1)) != 0))
652802 return false;
653803
654804 /* Below are the additional FBC restrictions. */
655805 if (stride < 512)
656806 return false;
657807
658− if (DISPLAY_VER(dev_priv) == 2 || DISPLAY_VER(dev_priv) == 3)
808+ if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3)
659809 return stride == 4096 || stride == 8192;
660810
661− if (DISPLAY_VER(dev_priv) == 4 && !IS_G4X(dev_priv) && stride < 2048)
811+ if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048)
662812 return false;
663813
664814 /* Display WA #1105: skl,bxt,kbl,cfl,glk */
665− if ((DISPLAY_VER(dev_priv) == 9 || IS_GEMINILAKE(dev_priv)) &&
815+ if ((DISPLAY_VER(i915) == 9 || IS_GEMINILAKE(i915)) &&
666816 modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
667817 return false;
668818
@@ -672,7 +822,7 @@ static bool stride_is_valid(struct drm_i915_private *dev_priv, · 3 unmodified lines
672822 return true;
673823 }
674824
675−static bool pixel_format_is_valid(struct drm_i915_private *dev_priv,
825+static bool pixel_format_is_valid(struct drm_i915_private *i915,
676826 u32 pixel_format)
677827 {
678828 switch (pixel_format) {
@@ -682,10 +832,10 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv, · 3 unmodified lines
682832 case DRM_FORMAT_XRGB1555:
683833 case DRM_FORMAT_RGB565:
684834 /* 16bpp not supported on gen2 */
685− if (DISPLAY_VER(dev_priv) == 2)
835+ if (DISPLAY_VER(i915) == 2)
686836 return false;
687837 /* WaFbcOnly1to1Ratio:ctg */
688− if (IS_G4X(dev_priv))
838+ if (IS_G4X(i915))
689839 return false;
690840 return true;
691841 default:
@@ -693,13 +843,13 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv, · 1 unmodified line
693843 }
694844 }
695845
696−static bool rotation_is_valid(struct drm_i915_private *dev_priv,
846+static bool rotation_is_valid(struct drm_i915_private *i915,
697847 u32 pixel_format, unsigned int rotation)
698848 {
699− if (DISPLAY_VER(dev_priv) >= 9 && pixel_format == DRM_FORMAT_RGB565 &&
849+ if (DISPLAY_VER(i915) >= 9 && pixel_format == DRM_FORMAT_RGB565 &&
700850 drm_rotation_90_or_270(rotation))
701851 return false;
702− else if (DISPLAY_VER(dev_priv) <= 4 && !IS_G4X(dev_priv) &&
852+ else if (DISPLAY_VER(i915) <= 4 && !IS_G4X(i915) &&
703853 rotation != DRM_MODE_ROTATE_0)
704854 return false;
705855
@@ -712,19 +862,19 @@ static bool rotation_is_valid(struct drm_i915_private *dev_priv, · 6 unmodified lines
712862 * the X and Y offset registers. That's why we include the src x/y offsets
713863 * instead of just looking at the plane size.
714864 */
715−static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc)
865+static bool intel_fbc_hw_tracking_covers_screen(struct intel_fbc *fbc,
866+ struct intel_crtc *crtc)
716867 {
717− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
718− struct intel_fbc *fbc = &dev_priv->fbc;
868+ struct drm_i915_private *i915 = fbc->i915;
719869 unsigned int effective_w, effective_h, max_w, max_h;
720870
721− if (DISPLAY_VER(dev_priv) >= 10) {
871+ if (DISPLAY_VER(i915) >= 10) {
722872 max_w = 5120;
723873 max_h = 4096;
724− } else if (DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL(dev_priv)) {
874+ } else if (DISPLAY_VER(i915) >= 8 || IS_HASWELL(i915)) {
725875 max_w = 4096;
726876 max_h = 4096;
727− } else if (IS_G4X(dev_priv) || DISPLAY_VER(dev_priv) >= 5) {
877+ } else if (IS_G4X(i915) || DISPLAY_VER(i915) >= 5) {
728878 max_w = 4096;
729879 max_h = 2048;
730880 } else {
@@ -740,14 +890,14 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) · 9 unmodified lines
740890 return effective_w <= max_w && effective_h <= max_h;
741891 }
742892
743−static bool tiling_is_valid(struct drm_i915_private *dev_priv,
893+static bool tiling_is_valid(struct drm_i915_private *i915,
744894 u64 modifier)
745895 {
746896 switch (modifier) {
747897 case DRM_FORMAT_MOD_LINEAR:
748898 case I915_FORMAT_MOD_Y_TILED:
749899 case I915_FORMAT_MOD_Yf_TILED:
750− return DISPLAY_VER(dev_priv) >= 9;
900+ return DISPLAY_VER(i915) >= 9;
751901 case I915_FORMAT_MOD_X_TILED:
752902 return true;
753903 default:
@@ -759,8 +909,8 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 5 unmodified lines
759909 const struct intel_crtc_state *crtc_state,
760910 const struct intel_plane_state *plane_state)
761911 {
762− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
763− struct intel_fbc *fbc = &dev_priv->fbc;
912+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
913+ struct intel_fbc *fbc = &i915->fbc;
764914 struct intel_fbc_state_cache *cache = &fbc->state_cache;
765915 struct drm_framebuffer *fb = plane_state->hw.fb;
766916
@@ -769,7 +919,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 2 unmodified lines
769919 return;
770920
771921 cache->crtc.mode_flags = crtc_state->hw.adjusted_mode.flags;
772− if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
922+ if (IS_HASWELL(i915) || IS_BROADWELL(i915))
773923 cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate;
774924
775925 cache->plane.rotation = plane_state->hw.rotation;
@@ -794,7 +944,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 18 unmodified lines
794944
795945 cache->fence_y_offset = intel_plane_fence_y_offset(plane_state);
796946
797− drm_WARN_ON(&dev_priv->drm, plane_state->flags & PLANE_HAS_FENCE &&
947+ drm_WARN_ON(&i915->drm, plane_state->flags & PLANE_HAS_FENCE &&
798948 !plane_state->ggtt_vma->fence);
799949
800950 if (plane_state->flags & PLANE_HAS_FENCE &&
@@ -806,19 +956,17 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 5 unmodified lines
806956 cache->psr2_active = crtc_state->has_psr2;
807957 }
808958
809−static bool intel_fbc_cfb_size_changed(struct drm_i915_private *dev_priv)
959+static bool intel_fbc_cfb_size_changed(struct intel_fbc *fbc)
810960 {
811− struct intel_fbc *fbc = &dev_priv->fbc;
812−
813− return intel_fbc_cfb_size(dev_priv, &fbc->state_cache) >
961+ return intel_fbc_cfb_size(fbc, &fbc->state_cache) >
814962 fbc->compressed_fb.size * fbc->limit;
815963 }
816964
817−static u16 intel_fbc_override_cfb_stride(struct drm_i915_private *dev_priv,
965+static u16 intel_fbc_override_cfb_stride(struct intel_fbc *fbc,
818966 const struct intel_fbc_state_cache *cache)
819967 {
820968 unsigned int stride = _intel_fbc_cfb_stride(cache);
821− unsigned int stride_aligned = intel_fbc_cfb_stride(dev_priv, cache);
969+ unsigned int stride_aligned = intel_fbc_cfb_stride(fbc, cache);
822970
823971 /*
824972 * Override stride in 64 byte units per 4 line segment.
@@ -828,23 +976,23 @@ static u16 intel_fbc_override_cfb_stride(struct drm_i915_private *dev_priv, · 3 unmodified lines
828976 * we always need to use the override there.
829977 */
830978 if (stride != stride_aligned ||
831− (DISPLAY_VER(dev_priv) == 9 &&
979+ (DISPLAY_VER(fbc->i915) == 9 &&
832980 cache->fb.modifier == DRM_FORMAT_MOD_LINEAR))
833981 return stride_aligned * 4 / 64;
834982
835983 return 0;
836984 }
837985
838−static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv)
986+static bool intel_fbc_can_enable(struct intel_fbc *fbc)
839987 {
840− struct intel_fbc *fbc = &dev_priv->fbc;
988+ struct drm_i915_private *i915 = fbc->i915;
841989
842− if (intel_vgpu_active(dev_priv)) {
990+ if (intel_vgpu_active(i915)) {
843991 fbc->no_fbc_reason = "VGPU is active";
844992 return false;
845993 }
846994
847− if (!dev_priv->params.enable_fbc) {
995+ if (!i915->params.enable_fbc) {
848996 fbc->no_fbc_reason = "disabled per module param or by default";
849997 return false;
850998 }
@@ -859,11 +1007,11 @@ static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv) · 8 unmodified lines
8591007
8601008 static bool intel_fbc_can_activate(struct intel_crtc *crtc)
8611009 {
862− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
863− struct intel_fbc *fbc = &dev_priv->fbc;
1010+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
1011+ struct intel_fbc *fbc = &i915->fbc;
8641012 struct intel_fbc_state_cache *cache = &fbc->state_cache;
8651013
866− if (!intel_fbc_can_enable(dev_priv))
1014+ if (!intel_fbc_can_enable(fbc))
8671015 return false;
8681016
8691017 if (!cache->plane.visible) {
@@ -884,7 +1032,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 14 unmodified lines
8841032 return false;
8851033 }
8861034
887− if (!intel_fbc_hw_tracking_covers_screen(crtc)) {
1035+ if (!intel_fbc_hw_tracking_covers_screen(fbc, crtc)) {
8881036 fbc->no_fbc_reason = "mode too large for compression";
8891037 return false;
8901038 }
@@ -906,28 +1054,28 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 15 unmodified lines
9061054 * For now this will effectively disable FBC with 90/270 degree
9071055 * rotation.
9081056 */
909− if (DISPLAY_VER(dev_priv) < 9 && cache->fence_id < 0) {
1057+ if (DISPLAY_VER(i915) < 9 && cache->fence_id < 0) {
9101058 fbc->no_fbc_reason = "framebuffer not tiled or fenced";
9111059 return false;
9121060 }
9131061
914− if (!pixel_format_is_valid(dev_priv, cache->fb.format->format)) {
1062+ if (!pixel_format_is_valid(i915, cache->fb.format->format)) {
9151063 fbc->no_fbc_reason = "pixel format is invalid";
9161064 return false;
9171065 }
9181066
919− if (!rotation_is_valid(dev_priv, cache->fb.format->format,
1067+ if (!rotation_is_valid(i915, cache->fb.format->format,
9201068 cache->plane.rotation)) {
9211069 fbc->no_fbc_reason = "rotation unsupported";
9221070 return false;
9231071 }
9241072
925− if (!tiling_is_valid(dev_priv, cache->fb.modifier)) {
1073+ if (!tiling_is_valid(i915, cache->fb.modifier)) {
9261074 fbc->no_fbc_reason = "tiling unsupported";
9271075 return false;
9281076 }
9291077
930− if (!stride_is_valid(dev_priv, cache->fb.modifier,
1078+ if (!stride_is_valid(i915, cache->fb.modifier,
9311079 cache->fb.stride * cache->fb.format->cpp[0])) {
9321080 fbc->no_fbc_reason = "framebuffer stride not supported";
9331081 return false;
@@ -940,8 +1088,8 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 6 unmodified lines
9401088 }
9411089
9421090 /* WaFbcExceedCdClockThreshold:hsw,bdw */
943− if ((IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) &&
944− cache->crtc.hsw_bdw_pixel_rate >= dev_priv->cdclk.hw.cdclk * 95 / 100) {
1091+ if ((IS_HASWELL(i915) || IS_BROADWELL(i915)) &&
1092+ cache->crtc.hsw_bdw_pixel_rate >= i915->cdclk.hw.cdclk * 95 / 100) {
9451093 fbc->no_fbc_reason = "pixel rate is too big";
9461094 return false;
9471095 }
@@ -956,7 +1104,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 8 unmodified lines
9561104 * we didn't get any invalidate/deactivate calls, but this would require
9571105 * a lot of tracking just for a specific case. If we conclude it's an
9581106 * important case, we can implement it later. */
959− if (intel_fbc_cfb_size_changed(dev_priv)) {
1107+ if (intel_fbc_cfb_size_changed(fbc)) {
9601108 fbc->no_fbc_reason = "CFB requirements changed";
9611109 return false;
9621110 }
@@ -966,14 +1114,14 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 3 unmodified lines
9661114 * having a Y offset that isn't divisible by 4 causes FIFO underrun
9671115 * and screen flicker.
9681116 */
969− if (DISPLAY_VER(dev_priv) >= 9 &&
1117+ if (DISPLAY_VER(i915) >= 9 &&
9701118 (fbc->state_cache.plane.adjusted_y & 3)) {
9711119 fbc->no_fbc_reason = "plane Y offset is misaligned";
9721120 return false;
9731121 }
9741122
9751123 /* Wa_22010751166: icl, ehl, tgl, dg1, rkl */
976− if (DISPLAY_VER(dev_priv) >= 11 &&
1124+ if (DISPLAY_VER(i915) >= 11 &&
9771125 (cache->plane.src_h + cache->plane.adjusted_y) % 4) {
9781126 fbc->no_fbc_reason = "plane height + offset is non-modulo of 4";
9791127 return false;
@@ -984,7 +1132,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 4 unmodified lines
9841132 * Recommendation is to keep this combination disabled
9851133 * Bspec: 50422 HSD: 14010260002
9861134 */
987− if (fbc->state_cache.psr2_active && DISPLAY_VER(dev_priv) >= 12) {
1135+ if (fbc->state_cache.psr2_active && DISPLAY_VER(i915) >= 12) {
9881136 fbc->no_fbc_reason = "not supported with PSR2";
9891137 return false;
9901138 }
@@ -992,12 +1140,11 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 1 unmodified line
9921140 return true;
9931141 }
9941142
995−static void intel_fbc_get_reg_params(struct intel_crtc *crtc,
996− struct intel_fbc_reg_params *params)
1143+static void intel_fbc_get_reg_params(struct intel_fbc *fbc,
1144+ struct intel_crtc *crtc)
9971145 {
998− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
999− struct intel_fbc *fbc = &dev_priv->fbc;
1000− struct intel_fbc_state_cache *cache = &fbc->state_cache;
1146+ const struct intel_fbc_state_cache *cache = &fbc->state_cache;
1147+ struct intel_fbc_reg_params *params = &fbc->params;
10011148
10021149 /* Since all our fields are integer types, use memset here so the
10031150 * comparison function can rely on memcmp because the padding will be
@@ -1016,9 +1163,9 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, · 12 unmodified lines
10161163 params->fb.modifier = cache->fb.modifier;
10171164 params->fb.stride = cache->fb.stride;
10181165
1019− params->cfb_stride = intel_fbc_cfb_stride(dev_priv, cache);
1020− params->cfb_size = intel_fbc_cfb_size(dev_priv, cache);
1021− params->override_cfb_stride = intel_fbc_override_cfb_stride(dev_priv, cache);
1166+ params->cfb_stride = intel_fbc_cfb_stride(fbc, cache);
1167+ params->cfb_size = intel_fbc_cfb_size(fbc, cache);
1168+ params->override_cfb_stride = intel_fbc_override_cfb_stride(fbc, cache);
10221169
10231170 params->plane_visible = cache->plane.visible;
10241171 }
@@ -1026,8 +1173,8 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, · 1 unmodified line
10261173 static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state)
10271174 {
10281175 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1029− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1030− const struct intel_fbc *fbc = &dev_priv->fbc;
1176+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
1177+ struct intel_fbc *fbc = &i915->fbc;
10311178 const struct intel_fbc_state_cache *cache = &fbc->state_cache;
10321179 const struct intel_fbc_reg_params *params = &fbc->params;
10331180
@@ -1049,13 +1196,13 @@ static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state) · 15 unmodified lines
10491196 if (params->fb.stride != cache->fb.stride)
10501197 return false;
10511198
1052− if (params->cfb_stride != intel_fbc_cfb_stride(dev_priv, cache))
1199+ if (params->cfb_stride != intel_fbc_cfb_stride(fbc, cache))
10531200 return false;
10541201
1055− if (params->cfb_size != intel_fbc_cfb_size(dev_priv, cache))
1202+ if (params->cfb_size != intel_fbc_cfb_size(fbc, cache))
10561203 return false;
10571204
1058− if (params->override_cfb_stride != intel_fbc_override_cfb_stride(dev_priv, cache))
1205+ if (params->override_cfb_stride != intel_fbc_override_cfb_stride(fbc, cache))
10591206 return false;
10601207
10611208 return true;
@@ -1069,12 +1216,12 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 7 unmodified lines
10691216 intel_atomic_get_new_crtc_state(state, crtc);
10701217 const struct intel_plane_state *plane_state =
10711218 intel_atomic_get_new_plane_state(state, plane);
1072− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1073− struct intel_fbc *fbc = &dev_priv->fbc;
1219+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
1220+ struct intel_fbc *fbc = plane->fbc;
10741221 const char *reason = "update pending";
10751222 bool need_vblank_wait = false;
10761223
1077− if (!plane->has_fbc || !plane_state)
1224+ if (!fbc || !plane_state)
10781225 return need_vblank_wait;
10791226
10801227 mutex_lock(&fbc->lock);
@@ -1086,7 +1233,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 5 unmodified lines
10861233 fbc->flip_pending = true;
10871234
10881235 if (!intel_fbc_can_flip_nuke(crtc_state)) {
1089− intel_fbc_deactivate(dev_priv, reason);
1236+ intel_fbc_deactivate(fbc, reason);
10901237
10911238 /*
10921239 * Display WA #1198: glk+
@@ -1102,7 +1249,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 9 unmodified lines
11021249 * if at least one frame has already passed.
11031250 */
11041251 if (fbc->activated &&
1105− DISPLAY_VER(dev_priv) >= 10)
1252+ DISPLAY_VER(i915) >= 10)
11061253 need_vblank_wait = true;
11071254 fbc->activated = false;
11081255 }
@@ -1112,70 +1259,62 @@ unlock: · 3 unmodified lines
11121259 return need_vblank_wait;
11131260 }
11141261
1115−/**
1116− * __intel_fbc_disable - disable FBC
1117− * @dev_priv: i915 device instance
1118− *
1119− * This is the low level function that actually disables FBC. Callers should
1120− * grab the FBC lock.
1121− */
1122−static void __intel_fbc_disable(struct drm_i915_private *dev_priv)
1262+static void __intel_fbc_disable(struct intel_fbc *fbc)
11231263 {
1124− struct intel_fbc *fbc = &dev_priv->fbc;
1264+ struct drm_i915_private *i915 = fbc->i915;
11251265 struct intel_crtc *crtc = fbc->crtc;
11261266
1127− drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock));
1128− drm_WARN_ON(&dev_priv->drm, !fbc->crtc);
1129− drm_WARN_ON(&dev_priv->drm, fbc->active);
1267+ drm_WARN_ON(&i915->drm, !mutex_is_locked(&fbc->lock));
1268+ drm_WARN_ON(&i915->drm, !fbc->crtc);
1269+ drm_WARN_ON(&i915->drm, fbc->active);
11301270
1131− drm_dbg_kms(&dev_priv->drm, "Disabling FBC on pipe %c\n",
1271+ drm_dbg_kms(&i915->drm, "Disabling FBC on pipe %c\n",
11321272 pipe_name(crtc->pipe));
11331273
1134− __intel_fbc_cleanup_cfb(dev_priv);
1274+ __intel_fbc_cleanup_cfb(fbc);
11351275
11361276 fbc->crtc = NULL;
11371277 }
11381278
11391279 static void __intel_fbc_post_update(struct intel_crtc *crtc)
11401280 {
1141− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1142− struct intel_fbc *fbc = &dev_priv->fbc;
1281+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
1282+ struct intel_fbc *fbc = &i915->fbc;
11431283
1144− drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock));
1284+ drm_WARN_ON(&i915->drm, !mutex_is_locked(&fbc->lock));
11451285
11461286 if (fbc->crtc != crtc)
11471287 return;
11481288
11491289 fbc->flip_pending = false;
11501290
1151− if (!dev_priv->params.enable_fbc) {
1152− intel_fbc_deactivate(dev_priv, "disabled at runtime per module param");
1153− __intel_fbc_disable(dev_priv);
1291+ if (!i915->params.enable_fbc) {
1292+ intel_fbc_deactivate(fbc, "disabled at runtime per module param");
1293+ __intel_fbc_disable(fbc);
11541294
11551295 return;
11561296 }
11571297
1158− intel_fbc_get_reg_params(crtc, &fbc->params);
1298+ intel_fbc_get_reg_params(fbc, crtc);
11591299
11601300 if (!intel_fbc_can_activate(crtc))
11611301 return;
11621302
11631303 if (!fbc->busy_bits)
1164− intel_fbc_activate(dev_priv);
1304+ intel_fbc_activate(fbc);
11651305 else
1166− intel_fbc_deactivate(dev_priv, "frontbuffer write");
1306+ intel_fbc_deactivate(fbc, "frontbuffer write");
11671307 }
11681308
11691309 void intel_fbc_post_update(struct intel_atomic_state *state,
11701310 struct intel_crtc *crtc)
11711311 {
1172− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
11731312 struct intel_plane *plane = to_intel_plane(crtc->base.primary);
11741313 const struct intel_plane_state *plane_state =
11751314 intel_atomic_get_new_plane_state(state, plane);
1176− struct intel_fbc *fbc = &dev_priv->fbc;
1315+ struct intel_fbc *fbc = plane->fbc;
11771316
1178− if (!plane->has_fbc || !plane_state)
1317+ if (!fbc || !plane_state)
11791318 return;
11801319
11811320 mutex_lock(&fbc->lock);
@@ -1191,13 +1330,13 @@ static unsigned int intel_fbc_get_frontbuffer_bit(struct intel_fbc *fbc) · 9 unmodified lines
11911330 return fbc->possible_framebuffer_bits;
11921331 }
11931332
1194−void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
1333+void intel_fbc_invalidate(struct drm_i915_private *i915,
11951334 unsigned int frontbuffer_bits,
11961335 enum fb_op_origin origin)
11971336 {
1198− struct intel_fbc *fbc = &dev_priv->fbc;
1337+ struct intel_fbc *fbc = &i915->fbc;
11991338
1200− if (!HAS_FBC(dev_priv))
1339+ if (!HAS_FBC(i915))
12011340 return;
12021341
12031342 if (origin == ORIGIN_FLIP || origin == ORIGIN_CURSOR_UPDATE)
@@ -1208,17 +1347,17 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, · 4 unmodified lines
12081347 fbc->busy_bits |= intel_fbc_get_frontbuffer_bit(fbc) & frontbuffer_bits;
12091348
12101349 if (fbc->crtc && fbc->busy_bits)
1211− intel_fbc_deactivate(dev_priv, "frontbuffer write");
1350+ intel_fbc_deactivate(fbc, "frontbuffer write");
12121351
12131352 mutex_unlock(&fbc->lock);
12141353 }
12151354
1216−void intel_fbc_flush(struct drm_i915_private *dev_priv,
1355+void intel_fbc_flush(struct drm_i915_private *i915,
12171356 unsigned int frontbuffer_bits, enum fb_op_origin origin)
12181357 {
1219− struct intel_fbc *fbc = &dev_priv->fbc;
1358+ struct intel_fbc *fbc = &i915->fbc;
12201359
1221− if (!HAS_FBC(dev_priv))
1360+ if (!HAS_FBC(i915))
12221361 return;
12231362
12241363 mutex_lock(&fbc->lock);
@@ -1231,7 +1370,7 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv, · 6 unmodified lines
12311370 if (!fbc->busy_bits && fbc->crtc &&
12321371 (frontbuffer_bits & intel_fbc_get_frontbuffer_bit(fbc))) {
12331372 if (fbc->active)
1234− intel_fbc_recompress(dev_priv);
1373+ intel_fbc_nuke(fbc);
12351374 else if (!fbc->flip_pending)
12361375 __intel_fbc_post_update(fbc->crtc);
12371376 }
@@ -1242,7 +1381,7 @@ out: · 4 unmodified lines
12421381
12431382 /**
12441383 * intel_fbc_choose_crtc - select a CRTC to enable FBC on
1245− * @dev_priv: i915 device instance
1384+ * @i915: i915 device instance
12461385 * @state: the atomic state structure
12471386 *
12481387 * This function looks at the proposed state for CRTCs and planes, then chooses
@@ -1250,12 +1389,12 @@ out: · 1 unmodified line
12501389 * true.
12511390 *
12521391 * Later, intel_fbc_enable is going to look for state->enable_fbc and then maybe
1253− * enable FBC for the chosen CRTC. If it does, it will set dev_priv->fbc.crtc.
1392+ * enable FBC for the chosen CRTC. If it does, it will set i915->fbc.crtc.
12541393 */
1255−void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
1394+void intel_fbc_choose_crtc(struct drm_i915_private *i915,
12561395 struct intel_atomic_state *state)
12571396 {
1258− struct intel_fbc *fbc = &dev_priv->fbc;
1397+ struct intel_fbc *fbc = &i915->fbc;
12591398 struct intel_plane *plane;
12601399 struct intel_plane_state *plane_state;
12611400 bool crtc_chosen = false;
@@ -1268,7 +1407,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · 6 unmodified lines
12681407 !intel_atomic_get_new_crtc_state(state, fbc->crtc))
12691408 goto out;
12701409
1271− if (!intel_fbc_can_enable(dev_priv))
1410+ if (!intel_fbc_can_enable(fbc))
12721411 goto out;
12731412
12741413 /* Simply choose the first CRTC that is compatible and has a visible
@@ -1279,7 +1418,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · 4 unmodified lines
12791418 struct intel_crtc_state *crtc_state;
12801419 struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc);
12811420
1282− if (!plane->has_fbc)
1421+ if (plane->fbc != fbc)
12831422 continue;
12841423
12851424 if (!plane_state->uapi.visible)
@@ -1312,19 +1451,21 @@ out: · 26 unmodified lines
13121451 static void intel_fbc_enable(struct intel_atomic_state *state,
13131452 struct intel_crtc *crtc)
13141453 {
1315− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
1454+ struct drm_i915_private *i915 = to_i915(crtc->base.dev);
13161455 struct intel_plane *plane = to_intel_plane(crtc->base.primary);
13171456 const struct intel_crtc_state *crtc_state =
13181457 intel_atomic_get_new_crtc_state(state, crtc);
13191458 const struct intel_plane_state *plane_state =
13201459 intel_atomic_get_new_plane_state(state, plane);
1321− struct intel_fbc *fbc = &dev_priv->fbc;
1322− struct intel_fbc_state_cache *cache = &fbc->state_cache;
1460+ struct intel_fbc *fbc = plane->fbc;
1461+ struct intel_fbc_state_cache *cache;
13231462 int min_limit;
13241463
1325− if (!plane->has_fbc || !plane_state)
1464+ if (!fbc || !plane_state)
13261465 return;
13271466
1467+ cache = &fbc->state_cache;
1468+
13281469 min_limit = intel_fbc_min_limit(plane_state->hw.fb ?
13291470 plane_state->hw.fb->format->cpp[0] : 0);
13301471
@@ -1335,13 +1476,13 @@ static void intel_fbc_enable(struct intel_atomic_state *state, · 4 unmodified lines
13351476 goto out;
13361477
13371478 if (fbc->limit >= min_limit &&
1338− !intel_fbc_cfb_size_changed(dev_priv))
1479+ !intel_fbc_cfb_size_changed(fbc))
13391480 goto out;
13401481
1341− __intel_fbc_disable(dev_priv);
1482+ __intel_fbc_disable(fbc);
13421483 }
13431484
1344− drm_WARN_ON(&dev_priv->drm, fbc->active);
1485+ drm_WARN_ON(&i915->drm, fbc->active);
13451486
13461487 intel_fbc_update_state_cache(crtc, crtc_state, plane_state);
13471488
@@ -1349,20 +1490,19 @@ static void intel_fbc_enable(struct intel_atomic_state *state, · 1 unmodified line
13491490 if (!cache->plane.visible)
13501491 goto out;
13511492
1352− if (intel_fbc_alloc_cfb(dev_priv,
1353− intel_fbc_cfb_size(dev_priv, cache), min_limit)) {
1493+ if (intel_fbc_alloc_cfb(fbc, intel_fbc_cfb_size(fbc, cache), min_limit)) {
13541494 cache->plane.visible = false;
13551495 fbc->no_fbc_reason = "not enough stolen memory";
13561496 goto out;
13571497 }
13581498
1359− drm_dbg_kms(&dev_priv->drm, "Enabling FBC on pipe %c\n",
1499+ drm_dbg_kms(&i915->drm, "Enabling FBC on pipe %c\n",
13601500 pipe_name(crtc->pipe));
13611501 fbc->no_fbc_reason = "FBC enabled but not active yet\n";
13621502
13631503 fbc->crtc = crtc;
13641504
1365− intel_fbc_program_cfb(dev_priv);
1505+ intel_fbc_program_cfb(fbc);
13661506 out:
13671507 mutex_unlock(&fbc->lock);
13681508 }
@@ -1375,16 +1515,15 @@ out: · 6 unmodified lines
13751515 */
13761516 void intel_fbc_disable(struct intel_crtc *crtc)
13771517 {
1378− struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
13791518 struct intel_plane *plane = to_intel_plane(crtc->base.primary);
1380− struct intel_fbc *fbc = &dev_priv->fbc;
1519+ struct intel_fbc *fbc = plane->fbc;
13811520
1382− if (!plane->has_fbc)
1521+ if (!fbc)
13831522 return;
13841523
13851524 mutex_lock(&fbc->lock);
13861525 if (fbc->crtc == crtc)
1387− __intel_fbc_disable(dev_priv);
1526+ __intel_fbc_disable(fbc);
13881527 mutex_unlock(&fbc->lock);
13891528 }
13901529
@@ -1412,30 +1551,30 @@ void intel_fbc_update(struct intel_atomic_state *state, · 21 unmodified lines
14121551
14131552 /**
14141553 * intel_fbc_global_disable - globally disable FBC
1415− * @dev_priv: i915 device instance
1554+ * @i915: i915 device instance
14161555 *
14171556 * This function disables FBC regardless of which CRTC is associated with it.
14181557 */
1419−void intel_fbc_global_disable(struct drm_i915_private *dev_priv)
1558+void intel_fbc_global_disable(struct drm_i915_private *i915)
14201559 {
1421− struct intel_fbc *fbc = &dev_priv->fbc;
1560+ struct intel_fbc *fbc = &i915->fbc;
14221561
1423− if (!HAS_FBC(dev_priv))
1562+ if (!HAS_FBC(i915))
14241563 return;
14251564
14261565 mutex_lock(&fbc->lock);
14271566 if (fbc->crtc) {
1428− drm_WARN_ON(&dev_priv->drm, fbc->crtc->active);
1429− __intel_fbc_disable(dev_priv);
1567+ drm_WARN_ON(&i915->drm, fbc->crtc->active);
1568+ __intel_fbc_disable(fbc);
14301569 }
14311570 mutex_unlock(&fbc->lock);
14321571 }
14331572
14341573 static void intel_fbc_underrun_work_fn(struct work_struct *work)
14351574 {
1436− struct drm_i915_private *dev_priv =
1575+ struct drm_i915_private *i915 =
14371576 container_of(work, struct drm_i915_private, fbc.underrun_work);
1438− struct intel_fbc *fbc = &dev_priv->fbc;
1577+ struct intel_fbc *fbc = &i915->fbc;
14391578
14401579 mutex_lock(&fbc->lock);
14411580
@@ -1443,46 +1582,47 @@ static void intel_fbc_underrun_work_fn(struct work_struct *work) · 1 unmodified line
14431582 if (fbc->underrun_detected || !fbc->crtc)
14441583 goto out;
14451584
1446− drm_dbg_kms(&dev_priv->drm, "Disabling FBC due to FIFO underrun.\n");
1585+ drm_dbg_kms(&i915->drm, "Disabling FBC due to FIFO underrun.\n");
14471586 fbc->underrun_detected = true;
14481587
1449− intel_fbc_deactivate(dev_priv, "FIFO underrun");
1588+ intel_fbc_deactivate(fbc, "FIFO underrun");
14501589 out:
14511590 mutex_unlock(&fbc->lock);
14521591 }
14531592
14541593 /*
14551594 * intel_fbc_reset_underrun - reset FBC fifo underrun status.
1456− * @dev_priv: i915 device instance
1595+ * @fbc: The FBC instance
14571596 *
14581597 * See intel_fbc_handle_fifo_underrun_irq(). For automated testing we
14591598 * want to re-enable FBC after an underrun to increase test coverage.
14601599 */
1461−int intel_fbc_reset_underrun(struct drm_i915_private *dev_priv)
1600+int intel_fbc_reset_underrun(struct intel_fbc *fbc)
14621601 {
1602+ struct drm_i915_private *i915 = fbc->i915;
14631603 int ret;
14641604
1465− cancel_work_sync(&dev_priv->fbc.underrun_work);
1605+ cancel_work_sync(&fbc->underrun_work);
14661606
1467− ret = mutex_lock_interruptible(&dev_priv->fbc.lock);
1607+ ret = mutex_lock_interruptible(&fbc->lock);
14681608 if (ret)
14691609 return ret;
14701610
1471− if (dev_priv->fbc.underrun_detected) {
1472− drm_dbg_kms(&dev_priv->drm,
1611+ if (fbc->underrun_detected) {
1612+ drm_dbg_kms(&i915->drm,
14731613 "Re-allowing FBC after fifo underrun\n");
1474− dev_priv->fbc.no_fbc_reason = "FIFO underrun cleared";
1614+ fbc->no_fbc_reason = "FIFO underrun cleared";
14751615 }
14761616
1477− dev_priv->fbc.underrun_detected = false;
1478− mutex_unlock(&dev_priv->fbc.lock);
1617+ fbc->underrun_detected = false;
1618+ mutex_unlock(&fbc->lock);
14791619
14801620 return 0;
14811621 }
14821622
14831623 /**
14841624 * intel_fbc_handle_fifo_underrun_irq - disable FBC when we get a FIFO underrun
1485− * @dev_priv: i915 device instance
1625+ * @fbc: The FBC instance
14861626 *
14871627 * Without FBC, most underruns are harmless and don't really cause too many
14881628 * problems, except for an annoying message on dmesg. With FBC, underruns can
@@ -1494,11 +1634,9 @@ int intel_fbc_reset_underrun(struct drm_i915_private *dev_priv) · 5 unmodified lines
14941634 *
14951635 * This function is called from the IRQ handler.
14961636 */
1497−void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv)
1637+void intel_fbc_handle_fifo_underrun_irq(struct intel_fbc *fbc)
14981638 {
1499− struct intel_fbc *fbc = &dev_priv->fbc;
1500−
1501− if (!HAS_FBC(dev_priv))
1639+ if (!HAS_FBC(fbc->i915))
15021640 return;
15031641
15041642 /* There's no guarantee that underrun_detected won't be set to true
@@ -1522,26 +1660,26 @@ void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv) · 17 unmodified lines
15221660 * space to change the value during runtime without sanitizing it again. IGT
15231661 * relies on being able to change i915.enable_fbc at runtime.
15241662 */
1525−static int intel_sanitize_fbc_option(struct drm_i915_private *dev_priv)
1663+static int intel_sanitize_fbc_option(struct drm_i915_private *i915)
15261664 {
1527− if (dev_priv->params.enable_fbc >= 0)
1528− return !!dev_priv->params.enable_fbc;
1665+ if (i915->params.enable_fbc >= 0)
1666+ return !!i915->params.enable_fbc;
15291667
1530− if (!HAS_FBC(dev_priv))
1668+ if (!HAS_FBC(i915))
15311669 return 0;
15321670
1533− if (IS_BROADWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 9)
1671+ if (IS_BROADWELL(i915) || DISPLAY_VER(i915) >= 9)
15341672 return 1;
15351673
15361674 return 0;
15371675 }
15381676
1539−static bool need_fbc_vtd_wa(struct drm_i915_private *dev_priv)
1677+static bool need_fbc_vtd_wa(struct drm_i915_private *i915)
15401678 {
15411679 /* WaFbcTurnOffFbcWhenHyperVisorIsUsed:skl,bxt */
15421680 if (intel_vtd_active() &&
1543− (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))) {
1544− drm_info(&dev_priv->drm,
1681+ (IS_SKYLAKE(i915) || IS_BROXTON(i915))) {
1682+ drm_info(&i915->drm,
15451683 "Disabling framebuffer compression (FBC) to prevent screen flicker with VT-d enabled\n");
15461684 return true;
15471685 }
@@ -1551,36 +1689,50 @@ static bool need_fbc_vtd_wa(struct drm_i915_private *dev_priv) · 3 unmodified lines
15511689
15521690 /**
15531691 * intel_fbc_init - Initialize FBC
1554− * @dev_priv: the i915 device
1692+ * @i915: the i915 device
15551693 *
15561694 * This function might be called during PM init process.
15571695 */
1558−void intel_fbc_init(struct drm_i915_private *dev_priv)
1696+void intel_fbc_init(struct drm_i915_private *i915)
15591697 {
1560− struct intel_fbc *fbc = &dev_priv->fbc;
1698+ struct intel_fbc *fbc = &i915->fbc;
15611699
1700+ fbc->i915 = i915;
15621701 INIT_WORK(&fbc->underrun_work, intel_fbc_underrun_work_fn);
15631702 mutex_init(&fbc->lock);
15641703 fbc->active = false;
15651704
1566− if (!drm_mm_initialized(&dev_priv->mm.stolen))
1567− mkwrite_device_info(dev_priv)->display.has_fbc = false;
1705+ if (!drm_mm_initialized(&i915->mm.stolen))
1706+ mkwrite_device_info(i915)->display.has_fbc = false;
15681707
1569− if (need_fbc_vtd_wa(dev_priv))
1570− mkwrite_device_info(dev_priv)->display.has_fbc = false;
1708+ if (need_fbc_vtd_wa(i915))
1709+ mkwrite_device_info(i915)->display.has_fbc = false;
15711710
1572− dev_priv->params.enable_fbc = intel_sanitize_fbc_option(dev_priv);
1573− drm_dbg_kms(&dev_priv->drm, "Sanitized enable_fbc value: %d\n",
1574− dev_priv->params.enable_fbc);
1711+ i915->params.enable_fbc = intel_sanitize_fbc_option(i915);
1712+ drm_dbg_kms(&i915->drm, "Sanitized enable_fbc value: %d\n",
1713+ i915->params.enable_fbc);
15751714
1576− if (!HAS_FBC(dev_priv)) {
1715+ if (!HAS_FBC(i915)) {
15771716 fbc->no_fbc_reason = "unsupported by this chipset";
15781717 return;
15791718 }
15801719
1720+ if (DISPLAY_VER(i915) >= 7)
1721+ fbc->funcs = &ivb_fbc_funcs;
1722+ else if (DISPLAY_VER(i915) == 6)
1723+ fbc->funcs = &snb_fbc_funcs;
1724+ else if (DISPLAY_VER(i915) == 5)
1725+ fbc->funcs = &ilk_fbc_funcs;
1726+ else if (IS_G4X(i915))
1727+ fbc->funcs = &g4x_fbc_funcs;
1728+ else if (DISPLAY_VER(i915) == 4)
1729+ fbc->funcs = &i965_fbc_funcs;
1730+ else
1731+ fbc->funcs = &i8xx_fbc_funcs;
1732+
15811733 /* We still don't have any sort of hardware state readout for FBC, so
15821734 * deactivate it in case the BIOS activated it to make sure software
15831735 * matches the hardware state. */
1584− if (intel_fbc_hw_is_active(dev_priv))
1585− intel_fbc_hw_deactivate(dev_priv);
1736+ if (intel_fbc_hw_is_active(fbc))
1737+ intel_fbc_hw_deactivate(fbc);
15861738 }
drivers/gpu/drm/i915/display/intel_fbc.h+7−4
@@ -14,16 +14,19 @@ struct drm_i915_private; · 13 unmodified lines
1414 struct intel_atomic_state;
1515 struct intel_crtc;
1616 struct intel_crtc_state;
17+struct intel_fbc;
1718 struct intel_plane_state;
1819
1920 void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
2021 struct intel_atomic_state *state);
21−bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
22+bool intel_fbc_is_active(struct intel_fbc *fbc);
23+bool intel_fbc_is_compressing(struct intel_fbc *fbc);
2224 bool intel_fbc_pre_update(struct intel_atomic_state *state,
2325 struct intel_crtc *crtc);
2426 void intel_fbc_post_update(struct intel_atomic_state *state,
2527 struct intel_crtc *crtc);
2628 void intel_fbc_init(struct drm_i915_private *dev_priv);
29+void intel_fbc_cleanup(struct drm_i915_private *dev_priv);
2730 void intel_fbc_update(struct intel_atomic_state *state,
2831 struct intel_crtc *crtc);
2932 void intel_fbc_disable(struct intel_crtc *crtc);
@@ -33,8 +36,8 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, · 3 unmodified lines
3336 enum fb_op_origin origin);
3437 void intel_fbc_flush(struct drm_i915_private *dev_priv,
3538 unsigned int frontbuffer_bits, enum fb_op_origin origin);
36−void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
37−void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv);
38−int intel_fbc_reset_underrun(struct drm_i915_private *dev_priv);
39+void intel_fbc_handle_fifo_underrun_irq(struct intel_fbc *fbc);
40+int intel_fbc_reset_underrun(struct intel_fbc *fbc);
41+int intel_fbc_set_false_color(struct intel_fbc *fbc, bool enable);
3942
4043 #endif /* __INTEL_FBC_H__ */
drivers/gpu/drm/i915/display/intel_fdi.c+37−99
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #include "intel_de.h"
99 #include "intel_display_types.h"
1010 #include "intel_fdi.h"
11−#include "intel_sbi.h"
1211
1312 static void assert_fdi_tx(struct drm_i915_private *dev_priv,
1413 enum pipe pipe, bool state)
@@ -887,6 +886,43 @@ void hsw_fdi_link_train(struct intel_encoder *encoder, · 872 unmodified lines
887886 DP_TP_CTL_ENABLE);
888887 }
889888
889+void hsw_fdi_disable(struct intel_encoder *encoder)
890+{
891+ struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
892+ u32 val;
893+
894+ /*
895+ * Bspec lists this as both step 13 (before DDI_BUF_CTL disable)
896+ * and step 18 (after clearing PORT_CLK_SEL). Based on a BUN,
897+ * step 13 is the correct place for it. Step 18 is where it was
898+ * originally before the BUN.
899+ */
900+ val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
901+ val &= ~FDI_RX_ENABLE;
902+ intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
903+
904+ val = intel_de_read(dev_priv, DDI_BUF_CTL(PORT_E));
905+ val &= ~DDI_BUF_CTL_ENABLE;
906+ intel_de_write(dev_priv, DDI_BUF_CTL(PORT_E), val);
907+
908+ intel_wait_ddi_buf_idle(dev_priv, PORT_E);
909+
910+ intel_ddi_disable_clock(encoder);
911+
912+ val = intel_de_read(dev_priv, FDI_RX_MISC(PIPE_A));
913+ val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
914+ val |= FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2);
915+ intel_de_write(dev_priv, FDI_RX_MISC(PIPE_A), val);
916+
917+ val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
918+ val &= ~FDI_PCDCLK;
919+ intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
920+
921+ val = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
922+ val &= ~FDI_RX_PLL_ENABLE;
923+ intel_de_write(dev_priv, FDI_RX_CTL(PIPE_A), val);
924+}
925+
890926 void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state)
891927 {
892928 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1006,104 +1042,6 @@ void ilk_fdi_disable(struct intel_crtc *crtc) · 113 unmodified lines
10061042 udelay(100);
10071043 }
10081044
1009−static void lpt_fdi_reset_mphy(struct drm_i915_private *dev_priv)
1010−{
1011− u32 tmp;
1012−
1013− tmp = intel_de_read(dev_priv, SOUTH_CHICKEN2);
1014− tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
1015− intel_de_write(dev_priv, SOUTH_CHICKEN2, tmp);
1016−
1017− if (wait_for_us(intel_de_read(dev_priv, SOUTH_CHICKEN2) &
1018− FDI_MPHY_IOSFSB_RESET_STATUS, 100))
1019− drm_err(&dev_priv->drm, "FDI mPHY reset assert timeout\n");
1020−
1021− tmp = intel_de_read(dev_priv, SOUTH_CHICKEN2);
1022− tmp &= ~FDI_MPHY_IOSFSB_RESET_CTL;
1023− intel_de_write(dev_priv, SOUTH_CHICKEN2, tmp);
1024−
1025− if (wait_for_us((intel_de_read(dev_priv, SOUTH_CHICKEN2) &
1026− FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))
1027− drm_err(&dev_priv->drm, "FDI mPHY reset de-assert timeout\n");
1028−}
1029−
1030−/* WaMPhyProgramming:hsw */
1031−void lpt_fdi_program_mphy(struct drm_i915_private *dev_priv)
1032−{
1033− u32 tmp;
1034−
1035− lpt_fdi_reset_mphy(dev_priv);
1036−
1037− tmp = intel_sbi_read(dev_priv, 0x8008, SBI_MPHY);
1038− tmp &= ~(0xFF << 24);
1039− tmp |= (0x12 << 24);
1040− intel_sbi_write(dev_priv, 0x8008, tmp, SBI_MPHY);
1041−
1042− tmp = intel_sbi_read(dev_priv, 0x2008, SBI_MPHY);
1043− tmp |= (1 << 11);
1044− intel_sbi_write(dev_priv, 0x2008, tmp, SBI_MPHY);
1045−
1046− tmp = intel_sbi_read(dev_priv, 0x2108, SBI_MPHY);
1047− tmp |= (1 << 11);
1048− intel_sbi_write(dev_priv, 0x2108, tmp, SBI_MPHY);
1049−
1050− tmp = intel_sbi_read(dev_priv, 0x206C, SBI_MPHY);
1051− tmp |= (1 << 24) | (1 << 21) | (1 << 18);
1052− intel_sbi_write(dev_priv, 0x206C, tmp, SBI_MPHY);
1053−
1054− tmp = intel_sbi_read(dev_priv, 0x216C, SBI_MPHY);
1055− tmp |= (1 << 24) | (1 << 21) | (1 << 18);
1056− intel_sbi_write(dev_priv, 0x216C, tmp, SBI_MPHY);
1057−
1058− tmp = intel_sbi_read(dev_priv, 0x2080, SBI_MPHY);
1059− tmp &= ~(7 << 13);
1060− tmp |= (5 << 13);
1061− intel_sbi_write(dev_priv, 0x2080, tmp, SBI_MPHY);
1062−
1063− tmp = intel_sbi_read(dev_priv, 0x2180, SBI_MPHY);
1064− tmp &= ~(7 << 13);
1065− tmp |= (5 << 13);
1066− intel_sbi_write(dev_priv, 0x2180, tmp, SBI_MPHY);
1067−
1068− tmp = intel_sbi_read(dev_priv, 0x208C, SBI_MPHY);
1069− tmp &= ~0xFF;
1070− tmp |= 0x1C;
1071− intel_sbi_write(dev_priv, 0x208C, tmp, SBI_MPHY);
1072−
1073− tmp = intel_sbi_read(dev_priv, 0x218C, SBI_MPHY);
1074− tmp &= ~0xFF;
1075− tmp |= 0x1C;
1076− intel_sbi_write(dev_priv, 0x218C, tmp, SBI_MPHY);
1077−
1078− tmp = intel_sbi_read(dev_priv, 0x2098, SBI_MPHY);
1079− tmp &= ~(0xFF << 16);
1080− tmp |= (0x1C << 16);
1081− intel_sbi_write(dev_priv, 0x2098, tmp, SBI_MPHY);
1082−
1083− tmp = intel_sbi_read(dev_priv, 0x2198, SBI_MPHY);
1084− tmp &= ~(0xFF << 16);
1085− tmp |= (0x1C << 16);
1086− intel_sbi_write(dev_priv, 0x2198, tmp, SBI_MPHY);
1087−
1088− tmp = intel_sbi_read(dev_priv, 0x20C4, SBI_MPHY);
1089− tmp |= (1 << 27);
1090− intel_sbi_write(dev_priv, 0x20C4, tmp, SBI_MPHY);
1091−
1092− tmp = intel_sbi_read(dev_priv, 0x21C4, SBI_MPHY);
1093− tmp |= (1 << 27);
1094− intel_sbi_write(dev_priv, 0x21C4, tmp, SBI_MPHY);
1095−
1096− tmp = intel_sbi_read(dev_priv, 0x20EC, SBI_MPHY);
1097− tmp &= ~(0xF << 28);
1098− tmp |= (4 << 28);
1099− intel_sbi_write(dev_priv, 0x20EC, tmp, SBI_MPHY);
1100−
1101− tmp = intel_sbi_read(dev_priv, 0x21EC, SBI_MPHY);
1102− tmp &= ~(0xF << 28);
1103− tmp |= (4 << 28);
1104− intel_sbi_write(dev_priv, 0x21EC, tmp, SBI_MPHY);
1105−}
1106−
11071045 static const struct intel_fdi_funcs ilk_funcs = {
11081046 .fdi_link_train = ilk_fdi_link_train,
11091047 };
drivers/gpu/drm/i915/display/intel_fdi.h+1−1
@@ -23,8 +23,8 @@ void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state); · 22 unmodified lines
2323 void intel_fdi_init_hook(struct drm_i915_private *dev_priv);
2424 void hsw_fdi_link_train(struct intel_encoder *encoder,
2525 const struct intel_crtc_state *crtc_state);
26+void hsw_fdi_disable(struct intel_encoder *encoder);
2627 void intel_fdi_pll_freq_update(struct drm_i915_private *i915);
27−void lpt_fdi_program_mphy(struct drm_i915_private *i915);
2828
2929 void intel_fdi_link_train(struct intel_crtc *crtc,
3030 const struct intel_crtc_state *crtc_state);
drivers/gpu/drm/i915/display/intel_fifo_underrun.c+1−1
@@ -434,7 +434,7 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, · 433 unmodified lines
434434 drm_err(&dev_priv->drm, "CPU pipe %c FIFO underrun\n", pipe_name(pipe));
435435 }
436436
437− intel_fbc_handle_fifo_underrun_irq(dev_priv);
437+ intel_fbc_handle_fifo_underrun_irq(&dev_priv->fbc);
438438 }
439439
440440 /**
drivers/gpu/drm/i915/display/intel_gmbus.c+11−2
@@ -334,6 +334,15 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin) · 333 unmodified lines
334334 algo->data = bus;
335335 }
336336
337+static bool has_gmbus_irq(struct drm_i915_private *i915)
338+{
339+ /*
340+ * encoder->shutdown() may want to use GMBUS
341+ * after irqs have already been disabled.
342+ */
343+ return HAS_GMBUS_IRQ(i915) && intel_irqs_enabled(i915);
344+}
345+
337346 static int gmbus_wait(struct drm_i915_private *dev_priv, u32 status, u32 irq_en)
338347 {
339348 DEFINE_WAIT(wait);
@@ -344,7 +353,7 @@ static int gmbus_wait(struct drm_i915_private *dev_priv, u32 status, u32 irq_en) · 4 unmodified lines
344353 * we also need to check for NAKs besides the hw ready/idle signal, we
345354 * need to wake up periodically and check that ourselves.
346355 */
347− if (!HAS_GMBUS_IRQ(dev_priv))
356+ if (!has_gmbus_irq(dev_priv))
348357 irq_en = 0;
349358
350359 add_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
@@ -375,7 +384,7 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv) · 24 unmodified lines
375384
376385 /* Important: The hw handles only the first bit, so set only one! */
377386 irq_enable = 0;
378− if (HAS_GMBUS_IRQ(dev_priv))
387+ if (has_gmbus_irq(dev_priv))
379388 irq_enable = GMBUS_IDLE_EN;
380389
381390 add_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
drivers/gpu/drm/i915/display/intel_hdmi.c+72−45
@@ -1800,6 +1800,11 @@ static bool intel_has_hdmi_sink(struct intel_hdmi *hdmi, · 1799 unmodified lines
18001800 READ_ONCE(to_intel_digital_connector_state(conn_state)->force_audio) != HDMI_AUDIO_OFF_DVI;
18011801 }
18021802
1803+static bool intel_hdmi_is_ycbcr420(const struct intel_crtc_state *crtc_state)
1804+{
1805+ return crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420;
1806+}
1807+
18031808 static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
18041809 bool respect_downstream_limits,
18051810 bool has_hdmi_sink)
@@ -1864,8 +1869,12 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi, · 58 unmodified lines
18641869 return MODE_OK;
18651870 }
18661871
1867−static int intel_hdmi_port_clock(int clock, int bpc)
1872+static int intel_hdmi_tmds_clock(int clock, int bpc, bool ycbcr420_output)
18681873 {
1874+ /* YCBCR420 TMDS rate requirement is half the pixel clock */
1875+ if (ycbcr420_output)
1876+ clock /= 2;
1877+
18691878 /*
18701879 * Need to adjust the port link by:
18711880 * 1.5x for 12bpc
@@ -1874,18 +1883,29 @@ static int intel_hdmi_port_clock(int clock, int bpc) · 2 unmodified lines
18741883 return clock * bpc / 8;
18751884 }
18761885
1877−static bool intel_hdmi_bpc_possible(struct drm_connector *connector,
1878− int bpc, bool has_hdmi_sink, bool ycbcr420_output)
1886+static bool intel_hdmi_source_bpc_possible(struct drm_i915_private *i915, int bpc)
1887+{
1888+ switch (bpc) {
1889+ case 12:
1890+ return !HAS_GMCH(i915);
1891+ case 10:
1892+ return DISPLAY_VER(i915) >= 11;
1893+ case 8:
1894+ return true;
1895+ default:
1896+ MISSING_CASE(bpc);
1897+ return false;
1898+ }
1899+}
1900+
1901+static bool intel_hdmi_sink_bpc_possible(struct drm_connector *connector,
1902+ int bpc, bool has_hdmi_sink, bool ycbcr420_output)
18791903 {
1880− struct drm_i915_private *i915 = to_i915(connector->dev);
18811904 const struct drm_display_info *info = &connector->display_info;
18821905 const struct drm_hdmi_info *hdmi = &info->hdmi;
18831906
18841907 switch (bpc) {
18851908 case 12:
1886− if (HAS_GMCH(i915))
1887− return false;
1888−
18891909 if (!has_hdmi_sink)
18901910 return false;
18911911
@@ -1894,9 +1914,6 @@ static bool intel_hdmi_bpc_possible(struct drm_connector *connector, · 2 unmodified lines
18941914 else
18951915 return info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_36;
18961916 case 10:
1897− if (DISPLAY_VER(i915) < 11)
1898− return false;
1899−
19001917 if (!has_hdmi_sink)
19011918 return false;
19021919
@@ -1916,26 +1933,26 @@ static enum drm_mode_status · 13 unmodified lines
19161933 intel_hdmi_mode_clock_valid(struct drm_connector *connector, int clock,
19171934 bool has_hdmi_sink, bool ycbcr420_output)
19181935 {
1936+ struct drm_i915_private *i915 = to_i915(connector->dev);
19191937 struct intel_hdmi *hdmi = intel_attached_hdmi(to_intel_connector(connector));
19201938 enum drm_mode_status status;
19211939
1922− if (ycbcr420_output)
1923− clock /= 2;
1924−
19251940 /* check if we can do 8bpc */
1926− status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 8),
1941+ status = hdmi_port_clock_valid(hdmi, intel_hdmi_tmds_clock(clock, 8, ycbcr420_output),
19271942 true, has_hdmi_sink);
19281943
19291944 /* if we can't do 8bpc we may still be able to do 12bpc */
19301945 if (status != MODE_OK &&
1931− intel_hdmi_bpc_possible(connector, 12, has_hdmi_sink, ycbcr420_output))
1932− status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 12),
1946+ intel_hdmi_source_bpc_possible(i915, 12) &&
1947+ intel_hdmi_sink_bpc_possible(connector, 12, has_hdmi_sink, ycbcr420_output))
1948+ status = hdmi_port_clock_valid(hdmi, intel_hdmi_tmds_clock(clock, 12, ycbcr420_output),
19331949 true, has_hdmi_sink);
19341950
19351951 /* if we can't do 8,12bpc we may still be able to do 10bpc */
19361952 if (status != MODE_OK &&
1937− intel_hdmi_bpc_possible(connector, 10, has_hdmi_sink, ycbcr420_output))
1938− status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 10),
1953+ intel_hdmi_source_bpc_possible(i915, 10) &&
1954+ intel_hdmi_sink_bpc_possible(connector, 10, has_hdmi_sink, ycbcr420_output))
1955+ status = hdmi_port_clock_valid(hdmi, intel_hdmi_tmds_clock(clock, 10, ycbcr420_output),
19391956 true, has_hdmi_sink);
19401957
19411958 return status;
@@ -2000,7 +2017,7 @@ bool intel_hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 58 unmodified lines
20002017 if (connector_state->crtc != crtc_state->uapi.crtc)
20012018 continue;
20022019
2003− if (!intel_hdmi_bpc_possible(connector, bpc, has_hdmi_sink, ycbcr420_output))
2020+ if (!intel_hdmi_sink_bpc_possible(connector, bpc, has_hdmi_sink, ycbcr420_output))
20042021 return false;
20052022 }
20062023
@@ -2015,6 +2032,9 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 8 unmodified lines
20152032 const struct drm_display_mode *adjusted_mode =
20162033 &crtc_state->hw.adjusted_mode;
20172034
2035+ if (!intel_hdmi_source_bpc_possible(dev_priv, bpc))
2036+ return false;
2037+
20182038 /*
20192039 * HDMI deep color affects the clocks, so it's only possible
20202040 * when not cloning with other encoder types.
@@ -2023,7 +2043,7 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 2 unmodified lines
20232043 return false;
20242044
20252045 /* Display Wa_1405510057:icl,ehl */
2026− if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 &&
2046+ if (intel_hdmi_is_ycbcr420(crtc_state) &&
20272047 bpc == 10 && DISPLAY_VER(dev_priv) == 11 &&
20282048 (adjusted_mode->crtc_hblank_end -
20292049 adjusted_mode->crtc_hblank_start) % 8 == 2)
@@ -2031,8 +2051,7 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 1 unmodified line
20312051
20322052 return intel_hdmi_deep_color_possible(crtc_state, bpc,
20332053 crtc_state->has_hdmi_sink,
2034− crtc_state->output_format ==
2035− INTEL_OUTPUT_FORMAT_YCBCR420);
2054+ intel_hdmi_is_ycbcr420(crtc_state));
20362055 }
20372056
20382057 static int intel_hdmi_compute_bpc(struct intel_encoder *encoder,
@@ -2040,12 +2059,13 @@ static int intel_hdmi_compute_bpc(struct intel_encoder *encoder, · 1 unmodified line
20402059 int clock)
20412060 {
20422061 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
2062+ bool ycbcr420_output = intel_hdmi_is_ycbcr420(crtc_state);
20432063 int bpc;
20442064
20452065 for (bpc = 12; bpc >= 10; bpc -= 2) {
20462066 if (hdmi_deep_color_possible(crtc_state, bpc) &&
20472067 hdmi_port_clock_valid(intel_hdmi,
2048− intel_hdmi_port_clock(clock, bpc),
2068+ intel_hdmi_tmds_clock(clock, bpc, ycbcr420_output),
20492069 true, crtc_state->has_hdmi_sink) == MODE_OK)
20502070 return bpc;
20512071 }
@@ -2065,13 +2085,10 @@ static int intel_hdmi_compute_clock(struct intel_encoder *encoder, · 13 unmodified lines
20652085 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
20662086 clock *= 2;
20672087
2068− /* YCBCR420 TMDS rate requirement is half the pixel clock */
2069− if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420)
2070− clock /= 2;
2071−
20722088 bpc = intel_hdmi_compute_bpc(encoder, crtc_state, clock);
20732089
2074− crtc_state->port_clock = intel_hdmi_port_clock(clock, bpc);
2090+ crtc_state->port_clock = intel_hdmi_tmds_clock(clock, bpc,
2091+ intel_hdmi_is_ycbcr420(crtc_state));
20752092
20762093 /*
20772094 * pipe_bpp could already be below 8bpc due to
@@ -2141,34 +2158,44 @@ static bool intel_hdmi_has_audio(struct intel_encoder *encoder, · 63 unmodified lines
21412158 return intel_conn_state->force_audio == HDMI_AUDIO_ON;
21422159 }
21432160
2161+static enum intel_output_format
2162+intel_hdmi_output_format(struct intel_connector *connector,
2163+ bool ycbcr_420_output)
2164+{
2165+ if (connector->base.ycbcr_420_allowed && ycbcr_420_output)
2166+ return INTEL_OUTPUT_FORMAT_YCBCR420;
2167+ else
2168+ return INTEL_OUTPUT_FORMAT_RGB;
2169+}
2170+
21442171 static int intel_hdmi_compute_output_format(struct intel_encoder *encoder,
21452172 struct intel_crtc_state *crtc_state,
21462173 const struct drm_connector_state *conn_state)
21472174 {
2148− struct drm_connector *connector = conn_state->connector;
2149− struct drm_i915_private *i915 = to_i915(connector->dev);
2175+ struct intel_connector *connector = to_intel_connector(conn_state->connector);
21502176 const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
2177+ const struct drm_display_info *info = &connector->base.display_info;
2178+ struct drm_i915_private *i915 = to_i915(connector->base.dev);
2179+ bool ycbcr_420_only = drm_mode_is_420_only(info, adjusted_mode);
21512180 int ret;
2152− bool ycbcr_420_only;
21532181
2154− ycbcr_420_only = drm_mode_is_420_only(&connector->display_info, adjusted_mode);
2155− if (connector->ycbcr_420_allowed && ycbcr_420_only) {
2156− crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
2157− } else {
2158− if (!connector->ycbcr_420_allowed && ycbcr_420_only)
2159− drm_dbg_kms(&i915->drm,
2160− "YCbCr 4:2:0 mode but YCbCr 4:2:0 output not possible. Falling back to RGB.\n");
2182+ crtc_state->output_format = intel_hdmi_output_format(connector, ycbcr_420_only);
2183+
2184+ if (ycbcr_420_only && !intel_hdmi_is_ycbcr420(crtc_state)) {
2185+ drm_dbg_kms(&i915->drm,
2186+ "YCbCr 4:2:0 mode but YCbCr 4:2:0 output not possible. Falling back to RGB.\n");
21612187 crtc_state->output_format = INTEL_OUTPUT_FORMAT_RGB;
21622188 }
21632189
21642190 ret = intel_hdmi_compute_clock(encoder, crtc_state);
21652191 if (ret) {
2166− if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420 &&
2167− connector->ycbcr_420_allowed &&
2168− drm_mode_is_420_also(&connector->display_info, adjusted_mode)) {
2169− crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
2170− ret = intel_hdmi_compute_clock(encoder, crtc_state);
2171− }
2192+ if (intel_hdmi_is_ycbcr420(crtc_state) ||
2193+ !connector->base.ycbcr_420_allowed ||
2194+ !drm_mode_is_420_also(info, adjusted_mode))
2195+ return ret;
2196+
2197+ crtc_state->output_format = intel_hdmi_output_format(connector, true);
2198+ ret = intel_hdmi_compute_clock(encoder, crtc_state);
21722199 }
21732200
21742201 return ret;
@@ -2208,7 +2235,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder, · 33 unmodified lines
22082235 if (ret)
22092236 return ret;
22102237
2211− if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) {
2238+ if (intel_hdmi_is_ycbcr420(pipe_config)) {
22122239 ret = intel_panel_fitting(pipe_config, conn_state);
22132240 if (ret)
22142241 return ret;
drivers/gpu/drm/i915/display/intel_lpe_audio.c+21−21
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #include "intel_de.h"
7575 #include "intel_lpe_audio.h"
7676
77−#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL)
77+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->audio.lpe.platdev != NULL)
7878
7979 static struct platform_device *
8080 lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
@@ -96,7 +96,7 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv) · 15 unmodified lines
9696 return ERR_PTR(-ENOMEM);
9797 }
9898
99− rsc[0].start = rsc[0].end = dev_priv->lpe_audio.irq;
99+ rsc[0].start = rsc[0].end = dev_priv->audio.lpe.irq;
100100 rsc[0].flags = IORESOURCE_IRQ;
101101 rsc[0].name = "hdmi-lpe-audio-irq";
102102
@@ -148,7 +148,7 @@ static void lpe_audio_platdev_destroy(struct drm_i915_private *dev_priv) · 45 unmodified lines
148148 * than us fiddle with its internals.
149149 */
150150
151− platform_device_unregister(dev_priv->lpe_audio.platdev);
151+ platform_device_unregister(dev_priv->audio.lpe.platdev);
152152 }
153153
154154 static void lpe_audio_irq_unmask(struct irq_data *d)
@@ -167,7 +167,7 @@ static struct irq_chip lpe_audio_irqchip = { · 12 unmodified lines
167167
168168 static int lpe_audio_irq_init(struct drm_i915_private *dev_priv)
169169 {
170− int irq = dev_priv->lpe_audio.irq;
170+ int irq = dev_priv->audio.lpe.irq;
171171
172172 drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv));
173173 irq_set_chip_and_handler_name(irq,
@@ -204,15 +204,15 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv) · 30 unmodified lines
204204 {
205205 int ret;
206206
207− dev_priv->lpe_audio.irq = irq_alloc_desc(0);
208− if (dev_priv->lpe_audio.irq < 0) {
207+ dev_priv->audio.lpe.irq = irq_alloc_desc(0);
208+ if (dev_priv->audio.lpe.irq < 0) {
209209 drm_err(&dev_priv->drm, "Failed to allocate IRQ desc: %d\n",
210− dev_priv->lpe_audio.irq);
211− ret = dev_priv->lpe_audio.irq;
210+ dev_priv->audio.lpe.irq);
211+ ret = dev_priv->audio.lpe.irq;
212212 goto err;
213213 }
214214
215− drm_dbg(&dev_priv->drm, "irq = %d\n", dev_priv->lpe_audio.irq);
215+ drm_dbg(&dev_priv->drm, "irq = %d\n", dev_priv->audio.lpe.irq);
216216
217217 ret = lpe_audio_irq_init(dev_priv);
218218
@@ -223,10 +223,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv) · 4 unmodified lines
223223 goto err_free_irq;
224224 }
225225
226− dev_priv->lpe_audio.platdev = lpe_audio_platdev_create(dev_priv);
226+ dev_priv->audio.lpe.platdev = lpe_audio_platdev_create(dev_priv);
227227
228− if (IS_ERR(dev_priv->lpe_audio.platdev)) {
229− ret = PTR_ERR(dev_priv->lpe_audio.platdev);
228+ if (IS_ERR(dev_priv->audio.lpe.platdev)) {
229+ ret = PTR_ERR(dev_priv->audio.lpe.platdev);
230230 drm_err(&dev_priv->drm,
231231 "Failed to create lpe audio platform device: %d\n",
232232 ret);
@@ -241,10 +241,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv) · 8 unmodified lines
241241
242242 return 0;
243243 err_free_irq:
244− irq_free_desc(dev_priv->lpe_audio.irq);
244+ irq_free_desc(dev_priv->audio.lpe.irq);
245245 err:
246− dev_priv->lpe_audio.irq = -1;
247− dev_priv->lpe_audio.platdev = NULL;
246+ dev_priv->audio.lpe.irq = -1;
247+ dev_priv->audio.lpe.platdev = NULL;
248248 return ret;
249249 }
250250
@@ -262,7 +262,7 @@ void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv) · 11 unmodified lines
262262 if (!HAS_LPE_AUDIO(dev_priv))
263263 return;
264264
265− ret = generic_handle_irq(dev_priv->lpe_audio.irq);
265+ ret = generic_handle_irq(dev_priv->audio.lpe.irq);
266266 if (ret)
267267 drm_err_ratelimited(&dev_priv->drm,
268268 "error handling LPE audio irq: %d\n", ret);
@@ -303,10 +303,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) · 34 unmodified lines
303303
304304 lpe_audio_platdev_destroy(dev_priv);
305305
306− irq_free_desc(dev_priv->lpe_audio.irq);
306+ irq_free_desc(dev_priv->audio.lpe.irq);
307307
308− dev_priv->lpe_audio.irq = -1;
309− dev_priv->lpe_audio.platdev = NULL;
308+ dev_priv->audio.lpe.irq = -1;
309+ dev_priv->audio.lpe.platdev = NULL;
310310 }
311311
312312 /**
@@ -333,7 +333,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, · 20 unmodified lines
333333 if (!HAS_LPE_AUDIO(dev_priv))
334334 return;
335335
336− pdata = dev_get_platdata(&dev_priv->lpe_audio.platdev->dev);
336+ pdata = dev_get_platdata(&dev_priv->audio.lpe.platdev->dev);
337337 ppdata = &pdata->port[port - PORT_B];
338338
339339 spin_lock_irqsave(&pdata->lpe_audio_slock, irqflags);
@@ -361,7 +361,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, · 21 unmodified lines
361361 }
362362
363363 if (pdata->notify_audio_lpe)
364− pdata->notify_audio_lpe(dev_priv->lpe_audio.platdev, port - PORT_B);
364+ pdata->notify_audio_lpe(dev_priv->audio.lpe.platdev, port - PORT_B);
365365
366366 spin_unlock_irqrestore(&pdata->lpe_audio_slock, irqflags);
367367 }
drivers/gpu/drm/i915/display/intel_pch_display.c+501−0
@@ -0,0 +1,501 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#include "g4x_dp.h"
7+#include "intel_crt.h"
8+#include "intel_de.h"
9+#include "intel_display_types.h"
10+#include "intel_fdi.h"
11+#include "intel_lvds.h"
12+#include "intel_pch_display.h"
13+#include "intel_pch_refclk.h"
14+#include "intel_pps.h"
15+#include "intel_sdvo.h"
16+
17+static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
18+ enum pipe pipe, enum port port,
19+ i915_reg_t dp_reg)
20+{
21+ enum pipe port_pipe;
22+ bool state;
23+
24+ state = g4x_dp_port_enabled(dev_priv, dp_reg, port, &port_pipe);
25+
26+ I915_STATE_WARN(state && port_pipe == pipe,
27+ "PCH DP %c enabled on transcoder %c, should be disabled\n",
28+ port_name(port), pipe_name(pipe));
29+
30+ I915_STATE_WARN(HAS_PCH_IBX(dev_priv) && !state && port_pipe == PIPE_B,
31+ "IBX PCH DP %c still using transcoder B\n",
32+ port_name(port));
33+}
34+
35+static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
36+ enum pipe pipe, enum port port,
37+ i915_reg_t hdmi_reg)
38+{
39+ enum pipe port_pipe;
40+ bool state;
41+
42+ state = intel_sdvo_port_enabled(dev_priv, hdmi_reg, &port_pipe);
43+
44+ I915_STATE_WARN(state && port_pipe == pipe,
45+ "PCH HDMI %c enabled on transcoder %c, should be disabled\n",
46+ port_name(port), pipe_name(pipe));
47+
48+ I915_STATE_WARN(HAS_PCH_IBX(dev_priv) && !state && port_pipe == PIPE_B,
49+ "IBX PCH HDMI %c still using transcoder B\n",
50+ port_name(port));
51+}
52+
53+static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv,
54+ enum pipe pipe)
55+{
56+ enum pipe port_pipe;
57+
58+ assert_pch_dp_disabled(dev_priv, pipe, PORT_B, PCH_DP_B);
59+ assert_pch_dp_disabled(dev_priv, pipe, PORT_C, PCH_DP_C);
60+ assert_pch_dp_disabled(dev_priv, pipe, PORT_D, PCH_DP_D);
61+
62+ I915_STATE_WARN(intel_crt_port_enabled(dev_priv, PCH_ADPA, &port_pipe) &&
63+ port_pipe == pipe,
64+ "PCH VGA enabled on transcoder %c, should be disabled\n",
65+ pipe_name(pipe));
66+
67+ I915_STATE_WARN(intel_lvds_port_enabled(dev_priv, PCH_LVDS, &port_pipe) &&
68+ port_pipe == pipe,
69+ "PCH LVDS enabled on transcoder %c, should be disabled\n",
70+ pipe_name(pipe));
71+
72+ /* PCH SDVOB multiplex with HDMIB */
73+ assert_pch_hdmi_disabled(dev_priv, pipe, PORT_B, PCH_HDMIB);
74+ assert_pch_hdmi_disabled(dev_priv, pipe, PORT_C, PCH_HDMIC);
75+ assert_pch_hdmi_disabled(dev_priv, pipe, PORT_D, PCH_HDMID);
76+}
77+
78+static void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
79+ enum pipe pipe)
80+{
81+ u32 val;
82+ bool enabled;
83+
84+ val = intel_de_read(dev_priv, PCH_TRANSCONF(pipe));
85+ enabled = !!(val & TRANS_ENABLE);
86+ I915_STATE_WARN(enabled,
87+ "transcoder assertion failed, should be off on pipe %c but is still active\n",
88+ pipe_name(pipe));
89+}
90+
91+static void ilk_pch_transcoder_set_timings(const struct intel_crtc_state *crtc_state,
92+ enum pipe pch_transcoder)
93+{
94+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
95+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
96+ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
97+
98+ intel_de_write(dev_priv, PCH_TRANS_HTOTAL(pch_transcoder),
99+ intel_de_read(dev_priv, HTOTAL(cpu_transcoder)));
100+ intel_de_write(dev_priv, PCH_TRANS_HBLANK(pch_transcoder),
101+ intel_de_read(dev_priv, HBLANK(cpu_transcoder)));
102+ intel_de_write(dev_priv, PCH_TRANS_HSYNC(pch_transcoder),
103+ intel_de_read(dev_priv, HSYNC(cpu_transcoder)));
104+
105+ intel_de_write(dev_priv, PCH_TRANS_VTOTAL(pch_transcoder),
106+ intel_de_read(dev_priv, VTOTAL(cpu_transcoder)));
107+ intel_de_write(dev_priv, PCH_TRANS_VBLANK(pch_transcoder),
108+ intel_de_read(dev_priv, VBLANK(cpu_transcoder)));
109+ intel_de_write(dev_priv, PCH_TRANS_VSYNC(pch_transcoder),
110+ intel_de_read(dev_priv, VSYNC(cpu_transcoder)));
111+ intel_de_write(dev_priv, PCH_TRANS_VSYNCSHIFT(pch_transcoder),
112+ intel_de_read(dev_priv, VSYNCSHIFT(cpu_transcoder)));
113+}
114+
115+static void ilk_enable_pch_transcoder(const struct intel_crtc_state *crtc_state)
116+{
117+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
118+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
119+ enum pipe pipe = crtc->pipe;
120+ i915_reg_t reg;
121+ u32 val, pipeconf_val;
122+
123+ /* Make sure PCH DPLL is enabled */
124+ assert_shared_dpll_enabled(dev_priv, crtc_state->shared_dpll);
125+
126+ /* FDI must be feeding us bits for PCH ports */
127+ assert_fdi_tx_enabled(dev_priv, pipe);
128+ assert_fdi_rx_enabled(dev_priv, pipe);
129+
130+ if (HAS_PCH_CPT(dev_priv)) {
131+ reg = TRANS_CHICKEN2(pipe);
132+ val = intel_de_read(dev_priv, reg);
133+ /*
134+ * Workaround: Set the timing override bit
135+ * before enabling the pch transcoder.
136+ */
137+ val |= TRANS_CHICKEN2_TIMING_OVERRIDE;
138+ /* Configure frame start delay to match the CPU */
139+ val &= ~TRANS_CHICKEN2_FRAME_START_DELAY_MASK;
140+ val |= TRANS_CHICKEN2_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
141+ intel_de_write(dev_priv, reg, val);
142+ }
143+
144+ reg = PCH_TRANSCONF(pipe);
145+ val = intel_de_read(dev_priv, reg);
146+ pipeconf_val = intel_de_read(dev_priv, PIPECONF(pipe));
147+
148+ if (HAS_PCH_IBX(dev_priv)) {
149+ /* Configure frame start delay to match the CPU */
150+ val &= ~TRANS_FRAME_START_DELAY_MASK;
151+ val |= TRANS_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
152+
153+ /*
154+ * Make the BPC in transcoder be consistent with
155+ * that in pipeconf reg. For HDMI we must use 8bpc
156+ * here for both 8bpc and 12bpc.
157+ */
158+ val &= ~PIPECONF_BPC_MASK;
159+ if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
160+ val |= PIPECONF_8BPC;
161+ else
162+ val |= pipeconf_val & PIPECONF_BPC_MASK;
163+ }
164+
165+ val &= ~TRANS_INTERLACE_MASK;
166+ if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK) {
167+ if (HAS_PCH_IBX(dev_priv) &&
168+ intel_crtc_has_type(crtc_state, INTEL_OUTPUT_SDVO))
169+ val |= TRANS_LEGACY_INTERLACED_ILK;
170+ else
171+ val |= TRANS_INTERLACED;
172+ } else {
173+ val |= TRANS_PROGRESSIVE;
174+ }
175+
176+ intel_de_write(dev_priv, reg, val | TRANS_ENABLE);
177+ if (intel_de_wait_for_set(dev_priv, reg, TRANS_STATE_ENABLE, 100))
178+ drm_err(&dev_priv->drm, "failed to enable transcoder %c\n",
179+ pipe_name(pipe));
180+}
181+
182+static void ilk_disable_pch_transcoder(struct intel_crtc *crtc)
183+{
184+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
185+ enum pipe pipe = crtc->pipe;
186+ i915_reg_t reg;
187+ u32 val;
188+
189+ /* FDI relies on the transcoder */
190+ assert_fdi_tx_disabled(dev_priv, pipe);
191+ assert_fdi_rx_disabled(dev_priv, pipe);
192+
193+ /* Ports must be off as well */
194+ assert_pch_ports_disabled(dev_priv, pipe);
195+
196+ reg = PCH_TRANSCONF(pipe);
197+ val = intel_de_read(dev_priv, reg);
198+ val &= ~TRANS_ENABLE;
199+ intel_de_write(dev_priv, reg, val);
200+ /* wait for PCH transcoder off, transcoder state */
201+ if (intel_de_wait_for_clear(dev_priv, reg, TRANS_STATE_ENABLE, 50))
202+ drm_err(&dev_priv->drm, "failed to disable transcoder %c\n",
203+ pipe_name(pipe));
204+
205+ if (HAS_PCH_CPT(dev_priv)) {
206+ /* Workaround: Clear the timing override chicken bit again. */
207+ reg = TRANS_CHICKEN2(pipe);
208+ val = intel_de_read(dev_priv, reg);
209+ val &= ~TRANS_CHICKEN2_TIMING_OVERRIDE;
210+ intel_de_write(dev_priv, reg, val);
211+ }
212+}
213+
214+/*
215+ * Enable PCH resources required for PCH ports:
216+ * - PCH PLLs
217+ * - FDI training & RX/TX
218+ * - update transcoder timings
219+ * - DP transcoding bits
220+ * - transcoder
221+ */
222+void ilk_pch_enable(struct intel_atomic_state *state,
223+ struct intel_crtc *crtc)
224+{
225+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
226+ const struct intel_crtc_state *crtc_state =
227+ intel_atomic_get_new_crtc_state(state, crtc);
228+ enum pipe pipe = crtc->pipe;
229+ u32 temp;
230+
231+ assert_pch_transcoder_disabled(dev_priv, pipe);
232+
233+ /* For PCH output, training FDI link */
234+ intel_fdi_link_train(crtc, crtc_state);
235+
236+ /*
237+ * We need to program the right clock selection
238+ * before writing the pixel multiplier into the DPLL.
239+ */
240+ if (HAS_PCH_CPT(dev_priv)) {
241+ u32 sel;
242+
243+ temp = intel_de_read(dev_priv, PCH_DPLL_SEL);
244+ temp |= TRANS_DPLL_ENABLE(pipe);
245+ sel = TRANS_DPLLB_SEL(pipe);
246+ if (crtc_state->shared_dpll ==
247+ intel_get_shared_dpll_by_id(dev_priv, DPLL_ID_PCH_PLL_B))
248+ temp |= sel;
249+ else
250+ temp &= ~sel;
251+ intel_de_write(dev_priv, PCH_DPLL_SEL, temp);
252+ }
253+
254+ /*
255+ * XXX: pch pll's can be enabled any time before we enable the PCH
256+ * transcoder, and we actually should do this to not upset any PCH
257+ * transcoder that already use the clock when we share it.
258+ *
259+ * Note that enable_shared_dpll tries to do the right thing, but
260+ * get_shared_dpll unconditionally resets the pll - we need that
261+ * to have the right LVDS enable sequence.
262+ */
263+ intel_enable_shared_dpll(crtc_state);
264+
265+ /* set transcoder timing, panel must allow it */
266+ assert_pps_unlocked(dev_priv, pipe);
267+ ilk_pch_transcoder_set_timings(crtc_state, pipe);
268+
269+ intel_fdi_normal_train(crtc);
270+
271+ /* For PCH DP, enable TRANS_DP_CTL */
272+ if (HAS_PCH_CPT(dev_priv) &&
273+ intel_crtc_has_dp_encoder(crtc_state)) {
274+ const struct drm_display_mode *adjusted_mode =
275+ &crtc_state->hw.adjusted_mode;
276+ u32 bpc = (intel_de_read(dev_priv, PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
277+ i915_reg_t reg = TRANS_DP_CTL(pipe);
278+ enum port port;
279+
280+ temp = intel_de_read(dev_priv, reg);
281+ temp &= ~(TRANS_DP_PORT_SEL_MASK |
282+ TRANS_DP_SYNC_MASK |
283+ TRANS_DP_BPC_MASK);
284+ temp |= TRANS_DP_OUTPUT_ENABLE;
285+ temp |= bpc << 9; /* same format but at 11:9 */
286+
287+ if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
288+ temp |= TRANS_DP_HSYNC_ACTIVE_HIGH;
289+ if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
290+ temp |= TRANS_DP_VSYNC_ACTIVE_HIGH;
291+
292+ port = intel_get_crtc_new_encoder(state, crtc_state)->port;
293+ drm_WARN_ON(&dev_priv->drm, port < PORT_B || port > PORT_D);
294+ temp |= TRANS_DP_PORT_SEL(port);
295+
296+ intel_de_write(dev_priv, reg, temp);
297+ }
298+
299+ ilk_enable_pch_transcoder(crtc_state);
300+}
301+
302+void ilk_pch_disable(struct intel_atomic_state *state,
303+ struct intel_crtc *crtc)
304+{
305+ ilk_fdi_disable(crtc);
306+}
307+
308+void ilk_pch_post_disable(struct intel_atomic_state *state,
309+ struct intel_crtc *crtc)
310+{
311+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
312+ enum pipe pipe = crtc->pipe;
313+
314+ ilk_disable_pch_transcoder(crtc);
315+
316+ if (HAS_PCH_CPT(dev_priv)) {
317+ i915_reg_t reg;
318+ u32 temp;
319+
320+ /* disable TRANS_DP_CTL */
321+ reg = TRANS_DP_CTL(pipe);
322+ temp = intel_de_read(dev_priv, reg);
323+ temp &= ~(TRANS_DP_OUTPUT_ENABLE |
324+ TRANS_DP_PORT_SEL_MASK);
325+ temp |= TRANS_DP_PORT_SEL_NONE;
326+ intel_de_write(dev_priv, reg, temp);
327+
328+ /* disable DPLL_SEL */
329+ temp = intel_de_read(dev_priv, PCH_DPLL_SEL);
330+ temp &= ~(TRANS_DPLL_ENABLE(pipe) | TRANS_DPLLB_SEL(pipe));
331+ intel_de_write(dev_priv, PCH_DPLL_SEL, temp);
332+ }
333+
334+ ilk_fdi_pll_disable(crtc);
335+}
336+
337+static void ilk_pch_clock_get(struct intel_crtc_state *crtc_state)
338+{
339+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
340+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
341+
342+ /* read out port_clock from the DPLL */
343+ i9xx_crtc_clock_get(crtc, crtc_state);
344+
345+ /*
346+ * In case there is an active pipe without active ports,
347+ * we may need some idea for the dotclock anyway.
348+ * Calculate one based on the FDI configuration.
349+ */
350+ crtc_state->hw.adjusted_mode.crtc_clock =
351+ intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, crtc_state),
352+ &crtc_state->fdi_m_n);
353+}
354+
355+void ilk_pch_get_config(struct intel_crtc_state *crtc_state)
356+{
357+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
358+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
359+ struct intel_shared_dpll *pll;
360+ enum pipe pipe = crtc->pipe;
361+ enum intel_dpll_id pll_id;
362+ bool pll_active;
363+ u32 tmp;
364+
365+ if ((intel_de_read(dev_priv, PCH_TRANSCONF(pipe)) & TRANS_ENABLE) == 0)
366+ return;
367+
368+ crtc_state->has_pch_encoder = true;
369+
370+ tmp = intel_de_read(dev_priv, FDI_RX_CTL(pipe));
371+ crtc_state->fdi_lanes = ((FDI_DP_PORT_WIDTH_MASK & tmp) >>
372+ FDI_DP_PORT_WIDTH_SHIFT) + 1;
373+
374+ ilk_get_fdi_m_n_config(crtc, crtc_state);
375+
376+ if (HAS_PCH_IBX(dev_priv)) {
377+ /*
378+ * The pipe->pch transcoder and pch transcoder->pll
379+ * mapping is fixed.
380+ */
381+ pll_id = (enum intel_dpll_id) pipe;
382+ } else {
383+ tmp = intel_de_read(dev_priv, PCH_DPLL_SEL);
384+ if (tmp & TRANS_DPLLB_SEL(pipe))
385+ pll_id = DPLL_ID_PCH_PLL_B;
386+ else
387+ pll_id = DPLL_ID_PCH_PLL_A;
388+ }
389+
390+ crtc_state->shared_dpll = intel_get_shared_dpll_by_id(dev_priv, pll_id);
391+ pll = crtc_state->shared_dpll;
392+
393+ pll_active = intel_dpll_get_hw_state(dev_priv, pll,
394+ &crtc_state->dpll_hw_state);
395+ drm_WARN_ON(&dev_priv->drm, !pll_active);
396+
397+ tmp = crtc_state->dpll_hw_state.dpll;
398+ crtc_state->pixel_multiplier =
399+ ((tmp & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK)
400+ >> PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) + 1;
401+
402+ ilk_pch_clock_get(crtc_state);
403+}
404+
405+static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,
406+ enum transcoder cpu_transcoder)
407+{
408+ u32 val, pipeconf_val;
409+
410+ /* FDI must be feeding us bits for PCH ports */
411+ assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder);
412+ assert_fdi_rx_enabled(dev_priv, PIPE_A);
413+
414+ val = intel_de_read(dev_priv, TRANS_CHICKEN2(PIPE_A));
415+ /* Workaround: set timing override bit. */
416+ val |= TRANS_CHICKEN2_TIMING_OVERRIDE;
417+ /* Configure frame start delay to match the CPU */
418+ val &= ~TRANS_CHICKEN2_FRAME_START_DELAY_MASK;
419+ val |= TRANS_CHICKEN2_FRAME_START_DELAY(dev_priv->framestart_delay - 1);
420+ intel_de_write(dev_priv, TRANS_CHICKEN2(PIPE_A), val);
421+
422+ val = TRANS_ENABLE;
423+ pipeconf_val = intel_de_read(dev_priv, PIPECONF(cpu_transcoder));
424+
425+ if ((pipeconf_val & PIPECONF_INTERLACE_MASK_HSW) ==
426+ PIPECONF_INTERLACED_ILK)
427+ val |= TRANS_INTERLACED;
428+ else
429+ val |= TRANS_PROGRESSIVE;
430+
431+ intel_de_write(dev_priv, LPT_TRANSCONF, val);
432+ if (intel_de_wait_for_set(dev_priv, LPT_TRANSCONF,
433+ TRANS_STATE_ENABLE, 100))
434+ drm_err(&dev_priv->drm, "Failed to enable PCH transcoder\n");
435+}
436+
437+static void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv)
438+{
439+ u32 val;
440+
441+ val = intel_de_read(dev_priv, LPT_TRANSCONF);
442+ val &= ~TRANS_ENABLE;
443+ intel_de_write(dev_priv, LPT_TRANSCONF, val);
444+ /* wait for PCH transcoder off, transcoder state */
445+ if (intel_de_wait_for_clear(dev_priv, LPT_TRANSCONF,
446+ TRANS_STATE_ENABLE, 50))
447+ drm_err(&dev_priv->drm, "Failed to disable PCH transcoder\n");
448+
449+ /* Workaround: clear timing override bit. */
450+ val = intel_de_read(dev_priv, TRANS_CHICKEN2(PIPE_A));
451+ val &= ~TRANS_CHICKEN2_TIMING_OVERRIDE;
452+ intel_de_write(dev_priv, TRANS_CHICKEN2(PIPE_A), val);
453+}
454+
455+void lpt_pch_enable(struct intel_atomic_state *state,
456+ struct intel_crtc *crtc)
457+{
458+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
459+ const struct intel_crtc_state *crtc_state =
460+ intel_atomic_get_new_crtc_state(state, crtc);
461+ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
462+
463+ assert_pch_transcoder_disabled(dev_priv, PIPE_A);
464+
465+ lpt_program_iclkip(crtc_state);
466+
467+ /* Set transcoder timing. */
468+ ilk_pch_transcoder_set_timings(crtc_state, PIPE_A);
469+
470+ lpt_enable_pch_transcoder(dev_priv, cpu_transcoder);
471+}
472+
473+void lpt_pch_disable(struct intel_atomic_state *state,
474+ struct intel_crtc *crtc)
475+{
476+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
477+
478+ lpt_disable_pch_transcoder(dev_priv);
479+
480+ lpt_disable_iclkip(dev_priv);
481+}
482+
483+void lpt_pch_get_config(struct intel_crtc_state *crtc_state)
484+{
485+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
486+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
487+ u32 tmp;
488+
489+ if ((intel_de_read(dev_priv, LPT_TRANSCONF) & TRANS_ENABLE) == 0)
490+ return;
491+
492+ crtc_state->has_pch_encoder = true;
493+
494+ tmp = intel_de_read(dev_priv, FDI_RX_CTL(PIPE_A));
495+ crtc_state->fdi_lanes = ((FDI_DP_PORT_WIDTH_MASK & tmp) >>
496+ FDI_DP_PORT_WIDTH_SHIFT) + 1;
497+
498+ ilk_get_fdi_m_n_config(crtc, crtc_state);
499+
500+ crtc_state->hw.adjusted_mode.crtc_clock = lpt_get_iclkip(dev_priv);
501+}
drivers/gpu/drm/i915/display/intel_pch_display.h+27−0
@@ -0,0 +1,27 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef _INTEL_PCH_DISPLAY_H_
7+#define _INTEL_PCH_DISPLAY_H_
8+
9+struct intel_atomic_state;
10+struct intel_crtc;
11+struct intel_crtc_state;
12+
13+void ilk_pch_enable(struct intel_atomic_state *state,
14+ struct intel_crtc *crtc);
15+void ilk_pch_disable(struct intel_atomic_state *state,
16+ struct intel_crtc *crtc);
17+void ilk_pch_post_disable(struct intel_atomic_state *state,
18+ struct intel_crtc *crtc);
19+void ilk_pch_get_config(struct intel_crtc_state *crtc_state);
20+
21+void lpt_pch_enable(struct intel_atomic_state *state,
22+ struct intel_crtc *crtc);
23+void lpt_pch_disable(struct intel_atomic_state *state,
24+ struct intel_crtc *crtc);
25+void lpt_pch_get_config(struct intel_crtc_state *crtc_state);
26+
27+#endif
drivers/gpu/drm/i915/display/intel_pch_refclk.c+648−0
@@ -0,0 +1,648 @@
1+// SPDX-License-Identifier: MIT
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#include "intel_de.h"
7+#include "intel_display_types.h"
8+#include "intel_panel.h"
9+#include "intel_pch_refclk.h"
10+#include "intel_sbi.h"
11+
12+static void lpt_fdi_reset_mphy(struct drm_i915_private *dev_priv)
13+{
14+ u32 tmp;
15+
16+ tmp = intel_de_read(dev_priv, SOUTH_CHICKEN2);
17+ tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
18+ intel_de_write(dev_priv, SOUTH_CHICKEN2, tmp);
19+
20+ if (wait_for_us(intel_de_read(dev_priv, SOUTH_CHICKEN2) &
21+ FDI_MPHY_IOSFSB_RESET_STATUS, 100))
22+ drm_err(&dev_priv->drm, "FDI mPHY reset assert timeout\n");
23+
24+ tmp = intel_de_read(dev_priv, SOUTH_CHICKEN2);
25+ tmp &= ~FDI_MPHY_IOSFSB_RESET_CTL;
26+ intel_de_write(dev_priv, SOUTH_CHICKEN2, tmp);
27+
28+ if (wait_for_us((intel_de_read(dev_priv, SOUTH_CHICKEN2) &
29+ FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))
30+ drm_err(&dev_priv->drm, "FDI mPHY reset de-assert timeout\n");
31+}
32+
33+/* WaMPhyProgramming:hsw */
34+static void lpt_fdi_program_mphy(struct drm_i915_private *dev_priv)
35+{
36+ u32 tmp;
37+
38+ lpt_fdi_reset_mphy(dev_priv);
39+
40+ tmp = intel_sbi_read(dev_priv, 0x8008, SBI_MPHY);
41+ tmp &= ~(0xFF << 24);
42+ tmp |= (0x12 << 24);
43+ intel_sbi_write(dev_priv, 0x8008, tmp, SBI_MPHY);
44+
45+ tmp = intel_sbi_read(dev_priv, 0x2008, SBI_MPHY);
46+ tmp |= (1 << 11);
47+ intel_sbi_write(dev_priv, 0x2008, tmp, SBI_MPHY);
48+
49+ tmp = intel_sbi_read(dev_priv, 0x2108, SBI_MPHY);
50+ tmp |= (1 << 11);
51+ intel_sbi_write(dev_priv, 0x2108, tmp, SBI_MPHY);
52+
53+ tmp = intel_sbi_read(dev_priv, 0x206C, SBI_MPHY);
54+ tmp |= (1 << 24) | (1 << 21) | (1 << 18);
55+ intel_sbi_write(dev_priv, 0x206C, tmp, SBI_MPHY);
56+
57+ tmp = intel_sbi_read(dev_priv, 0x216C, SBI_MPHY);
58+ tmp |= (1 << 24) | (1 << 21) | (1 << 18);
59+ intel_sbi_write(dev_priv, 0x216C, tmp, SBI_MPHY);
60+
61+ tmp = intel_sbi_read(dev_priv, 0x2080, SBI_MPHY);
62+ tmp &= ~(7 << 13);
63+ tmp |= (5 << 13);
64+ intel_sbi_write(dev_priv, 0x2080, tmp, SBI_MPHY);
65+
66+ tmp = intel_sbi_read(dev_priv, 0x2180, SBI_MPHY);
67+ tmp &= ~(7 << 13);
68+ tmp |= (5 << 13);
69+ intel_sbi_write(dev_priv, 0x2180, tmp, SBI_MPHY);
70+
71+ tmp = intel_sbi_read(dev_priv, 0x208C, SBI_MPHY);
72+ tmp &= ~0xFF;
73+ tmp |= 0x1C;
74+ intel_sbi_write(dev_priv, 0x208C, tmp, SBI_MPHY);
75+
76+ tmp = intel_sbi_read(dev_priv, 0x218C, SBI_MPHY);
77+ tmp &= ~0xFF;
78+ tmp |= 0x1C;
79+ intel_sbi_write(dev_priv, 0x218C, tmp, SBI_MPHY);
80+
81+ tmp = intel_sbi_read(dev_priv, 0x2098, SBI_MPHY);
82+ tmp &= ~(0xFF << 16);
83+ tmp |= (0x1C << 16);
84+ intel_sbi_write(dev_priv, 0x2098, tmp, SBI_MPHY);
85+
86+ tmp = intel_sbi_read(dev_priv, 0x2198, SBI_MPHY);
87+ tmp &= ~(0xFF << 16);
88+ tmp |= (0x1C << 16);
89+ intel_sbi_write(dev_priv, 0x2198, tmp, SBI_MPHY);
90+
91+ tmp = intel_sbi_read(dev_priv, 0x20C4, SBI_MPHY);
92+ tmp |= (1 << 27);
93+ intel_sbi_write(dev_priv, 0x20C4, tmp, SBI_MPHY);
94+
95+ tmp = intel_sbi_read(dev_priv, 0x21C4, SBI_MPHY);
96+ tmp |= (1 << 27);
97+ intel_sbi_write(dev_priv, 0x21C4, tmp, SBI_MPHY);
98+
99+ tmp = intel_sbi_read(dev_priv, 0x20EC, SBI_MPHY);
100+ tmp &= ~(0xF << 28);
101+ tmp |= (4 << 28);
102+ intel_sbi_write(dev_priv, 0x20EC, tmp, SBI_MPHY);
103+
104+ tmp = intel_sbi_read(dev_priv, 0x21EC, SBI_MPHY);
105+ tmp &= ~(0xF << 28);
106+ tmp |= (4 << 28);
107+ intel_sbi_write(dev_priv, 0x21EC, tmp, SBI_MPHY);
108+}
109+
110+void lpt_disable_iclkip(struct drm_i915_private *dev_priv)
111+{
112+ u32 temp;
113+
114+ intel_de_write(dev_priv, PIXCLK_GATE, PIXCLK_GATE_GATE);
115+
116+ mutex_lock(&dev_priv->sb_lock);
117+
118+ temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
119+ temp |= SBI_SSCCTL_DISABLE;
120+ intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
121+
122+ mutex_unlock(&dev_priv->sb_lock);
123+}
124+
125+/* Program iCLKIP clock to the desired frequency */
126+void lpt_program_iclkip(const struct intel_crtc_state *crtc_state)
127+{
128+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
129+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
130+ int clock = crtc_state->hw.adjusted_mode.crtc_clock;
131+ u32 divsel, phaseinc, auxdiv, phasedir = 0;
132+ u32 temp;
133+
134+ lpt_disable_iclkip(dev_priv);
135+
136+ /* The iCLK virtual clock root frequency is in MHz,
137+ * but the adjusted_mode->crtc_clock in KHz. To get the
138+ * divisors, it is necessary to divide one by another, so we
139+ * convert the virtual clock precision to KHz here for higher
140+ * precision.
141+ */
142+ for (auxdiv = 0; auxdiv < 2; auxdiv++) {
143+ u32 iclk_virtual_root_freq = 172800 * 1000;
144+ u32 iclk_pi_range = 64;
145+ u32 desired_divisor;
146+
147+ desired_divisor = DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
148+ clock << auxdiv);
149+ divsel = (desired_divisor / iclk_pi_range) - 2;
150+ phaseinc = desired_divisor % iclk_pi_range;
151+
152+ /*
153+ * Near 20MHz is a corner case which is
154+ * out of range for the 7-bit divisor
155+ */
156+ if (divsel <= 0x7f)
157+ break;
158+ }
159+
160+ /* This should not happen with any sane values */
161+ drm_WARN_ON(&dev_priv->drm, SBI_SSCDIVINTPHASE_DIVSEL(divsel) &
162+ ~SBI_SSCDIVINTPHASE_DIVSEL_MASK);
163+ drm_WARN_ON(&dev_priv->drm, SBI_SSCDIVINTPHASE_DIR(phasedir) &
164+ ~SBI_SSCDIVINTPHASE_INCVAL_MASK);
165+
166+ drm_dbg_kms(&dev_priv->drm,
167+ "iCLKIP clock: found settings for %dKHz refresh rate: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n",
168+ clock, auxdiv, divsel, phasedir, phaseinc);
169+
170+ mutex_lock(&dev_priv->sb_lock);
171+
172+ /* Program SSCDIVINTPHASE6 */
173+ temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6, SBI_ICLK);
174+ temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
175+ temp |= SBI_SSCDIVINTPHASE_DIVSEL(divsel);
176+ temp &= ~SBI_SSCDIVINTPHASE_INCVAL_MASK;
177+ temp |= SBI_SSCDIVINTPHASE_INCVAL(phaseinc);
178+ temp |= SBI_SSCDIVINTPHASE_DIR(phasedir);
179+ temp |= SBI_SSCDIVINTPHASE_PROPAGATE;
180+ intel_sbi_write(dev_priv, SBI_SSCDIVINTPHASE6, temp, SBI_ICLK);
181+
182+ /* Program SSCAUXDIV */
183+ temp = intel_sbi_read(dev_priv, SBI_SSCAUXDIV6, SBI_ICLK);
184+ temp &= ~SBI_SSCAUXDIV_FINALDIV2SEL(1);
185+ temp |= SBI_SSCAUXDIV_FINALDIV2SEL(auxdiv);
186+ intel_sbi_write(dev_priv, SBI_SSCAUXDIV6, temp, SBI_ICLK);
187+
188+ /* Enable modulator and associated divider */
189+ temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
190+ temp &= ~SBI_SSCCTL_DISABLE;
191+ intel_sbi_write(dev_priv, SBI_SSCCTL6, temp, SBI_ICLK);
192+
193+ mutex_unlock(&dev_priv->sb_lock);
194+
195+ /* Wait for initialization time */
196+ udelay(24);
197+
198+ intel_de_write(dev_priv, PIXCLK_GATE, PIXCLK_GATE_UNGATE);
199+}
200+
201+int lpt_get_iclkip(struct drm_i915_private *dev_priv)
202+{
203+ u32 divsel, phaseinc, auxdiv;
204+ u32 iclk_virtual_root_freq = 172800 * 1000;
205+ u32 iclk_pi_range = 64;
206+ u32 desired_divisor;
207+ u32 temp;
208+
209+ if ((intel_de_read(dev_priv, PIXCLK_GATE) & PIXCLK_GATE_UNGATE) == 0)
210+ return 0;
211+
212+ mutex_lock(&dev_priv->sb_lock);
213+
214+ temp = intel_sbi_read(dev_priv, SBI_SSCCTL6, SBI_ICLK);
215+ if (temp & SBI_SSCCTL_DISABLE) {
216+ mutex_unlock(&dev_priv->sb_lock);
217+ return 0;
218+ }
219+
220+ temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6, SBI_ICLK);
221+ divsel = (temp & SBI_SSCDIVINTPHASE_DIVSEL_MASK) >>
222+ SBI_SSCDIVINTPHASE_DIVSEL_SHIFT;
223+ phaseinc = (temp & SBI_SSCDIVINTPHASE_INCVAL_MASK) >>
224+ SBI_SSCDIVINTPHASE_INCVAL_SHIFT;
225+
226+ temp = intel_sbi_read(dev_priv, SBI_SSCAUXDIV6, SBI_ICLK);
227+ auxdiv = (temp & SBI_SSCAUXDIV_FINALDIV2SEL_MASK) >>
228+ SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT;
229+
230+ mutex_unlock(&dev_priv->sb_lock);
231+
232+ desired_divisor = (divsel + 2) * iclk_pi_range + phaseinc;
233+
234+ return DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
235+ desired_divisor << auxdiv);
236+}
237+
238+/* Implements 3 different sequences from BSpec chapter "Display iCLK
239+ * Programming" based on the parameters passed:
240+ * - Sequence to enable CLKOUT_DP
241+ * - Sequence to enable CLKOUT_DP without spread
242+ * - Sequence to enable CLKOUT_DP for FDI usage and configure PCH FDI I/O
243+ */
244+static void lpt_enable_clkout_dp(struct drm_i915_private *dev_priv,
245+ bool with_spread, bool with_fdi)
246+{
247+ u32 reg, tmp;
248+
249+ if (drm_WARN(&dev_priv->drm, with_fdi && !with_spread,
250+ "FDI requires downspread\n"))
251+ with_spread = true;
252+ if (drm_WARN(&dev_priv->drm, HAS_PCH_LPT_LP(dev_priv) &&
253+ with_fdi, "LP PCH doesn't have FDI\n"))
254+ with_fdi = false;
255+
256+ mutex_lock(&dev_priv->sb_lock);
257+
258+ tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
259+ tmp &= ~SBI_SSCCTL_DISABLE;
260+ tmp |= SBI_SSCCTL_PATHALT;
261+ intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
262+
263+ udelay(24);
264+
265+ if (with_spread) {
266+ tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
267+ tmp &= ~SBI_SSCCTL_PATHALT;
268+ intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
269+
270+ if (with_fdi)
271+ lpt_fdi_program_mphy(dev_priv);
272+ }
273+
274+ reg = HAS_PCH_LPT_LP(dev_priv) ? SBI_GEN0 : SBI_DBUFF0;
275+ tmp = intel_sbi_read(dev_priv, reg, SBI_ICLK);
276+ tmp |= SBI_GEN0_CFG_BUFFENABLE_DISABLE;
277+ intel_sbi_write(dev_priv, reg, tmp, SBI_ICLK);
278+
279+ mutex_unlock(&dev_priv->sb_lock);
280+}
281+
282+/* Sequence to disable CLKOUT_DP */
283+void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv)
284+{
285+ u32 reg, tmp;
286+
287+ mutex_lock(&dev_priv->sb_lock);
288+
289+ reg = HAS_PCH_LPT_LP(dev_priv) ? SBI_GEN0 : SBI_DBUFF0;
290+ tmp = intel_sbi_read(dev_priv, reg, SBI_ICLK);
291+ tmp &= ~SBI_GEN0_CFG_BUFFENABLE_DISABLE;
292+ intel_sbi_write(dev_priv, reg, tmp, SBI_ICLK);
293+
294+ tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
295+ if (!(tmp & SBI_SSCCTL_DISABLE)) {
296+ if (!(tmp & SBI_SSCCTL_PATHALT)) {
297+ tmp |= SBI_SSCCTL_PATHALT;
298+ intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
299+ udelay(32);
300+ }
301+ tmp |= SBI_SSCCTL_DISABLE;
302+ intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
303+ }
304+
305+ mutex_unlock(&dev_priv->sb_lock);
306+}
307+
308+#define BEND_IDX(steps) ((50 + (steps)) / 5)
309+
310+static const u16 sscdivintphase[] = {
311+ [BEND_IDX( 50)] = 0x3B23,
312+ [BEND_IDX( 45)] = 0x3B23,
313+ [BEND_IDX( 40)] = 0x3C23,
314+ [BEND_IDX( 35)] = 0x3C23,
315+ [BEND_IDX( 30)] = 0x3D23,
316+ [BEND_IDX( 25)] = 0x3D23,
317+ [BEND_IDX( 20)] = 0x3E23,
318+ [BEND_IDX( 15)] = 0x3E23,
319+ [BEND_IDX( 10)] = 0x3F23,
320+ [BEND_IDX( 5)] = 0x3F23,
321+ [BEND_IDX( 0)] = 0x0025,
322+ [BEND_IDX( -5)] = 0x0025,
323+ [BEND_IDX(-10)] = 0x0125,
324+ [BEND_IDX(-15)] = 0x0125,
325+ [BEND_IDX(-20)] = 0x0225,
326+ [BEND_IDX(-25)] = 0x0225,
327+ [BEND_IDX(-30)] = 0x0325,
328+ [BEND_IDX(-35)] = 0x0325,
329+ [BEND_IDX(-40)] = 0x0425,
330+ [BEND_IDX(-45)] = 0x0425,
331+ [BEND_IDX(-50)] = 0x0525,
332+};
333+
334+/*
335+ * Bend CLKOUT_DP
336+ * steps -50 to 50 inclusive, in steps of 5
337+ * < 0 slow down the clock, > 0 speed up the clock, 0 == no bend (135MHz)
338+ * change in clock period = -(steps / 10) * 5.787 ps
339+ */
340+static void lpt_bend_clkout_dp(struct drm_i915_private *dev_priv, int steps)
341+{
342+ u32 tmp;
343+ int idx = BEND_IDX(steps);
344+
345+ if (drm_WARN_ON(&dev_priv->drm, steps % 5 != 0))
346+ return;
347+
348+ if (drm_WARN_ON(&dev_priv->drm, idx >= ARRAY_SIZE(sscdivintphase)))
349+ return;
350+
351+ mutex_lock(&dev_priv->sb_lock);
352+
353+ if (steps % 10 != 0)
354+ tmp = 0xAAAAAAAB;
355+ else
356+ tmp = 0x00000000;
357+ intel_sbi_write(dev_priv, SBI_SSCDITHPHASE, tmp, SBI_ICLK);
358+
359+ tmp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE, SBI_ICLK);
360+ tmp &= 0xffff0000;
361+ tmp |= sscdivintphase[idx];
362+ intel_sbi_write(dev_priv, SBI_SSCDIVINTPHASE, tmp, SBI_ICLK);
363+
364+ mutex_unlock(&dev_priv->sb_lock);
365+}
366+
367+#undef BEND_IDX
368+
369+static bool spll_uses_pch_ssc(struct drm_i915_private *dev_priv)
370+{
371+ u32 fuse_strap = intel_de_read(dev_priv, FUSE_STRAP);
372+ u32 ctl = intel_de_read(dev_priv, SPLL_CTL);
373+
374+ if ((ctl & SPLL_PLL_ENABLE) == 0)
375+ return false;
376+
377+ if ((ctl & SPLL_REF_MASK) == SPLL_REF_MUXED_SSC &&
378+ (fuse_strap & HSW_CPU_SSC_ENABLE) == 0)
379+ return true;
380+
381+ if (IS_BROADWELL(dev_priv) &&
382+ (ctl & SPLL_REF_MASK) == SPLL_REF_PCH_SSC_BDW)
383+ return true;
384+
385+ return false;
386+}
387+
388+static bool wrpll_uses_pch_ssc(struct drm_i915_private *dev_priv,
389+ enum intel_dpll_id id)
390+{
391+ u32 fuse_strap = intel_de_read(dev_priv, FUSE_STRAP);
392+ u32 ctl = intel_de_read(dev_priv, WRPLL_CTL(id));
393+
394+ if ((ctl & WRPLL_PLL_ENABLE) == 0)
395+ return false;
396+
397+ if ((ctl & WRPLL_REF_MASK) == WRPLL_REF_PCH_SSC)
398+ return true;
399+
400+ if ((IS_BROADWELL(dev_priv) || IS_HSW_ULT(dev_priv)) &&
401+ (ctl & WRPLL_REF_MASK) == WRPLL_REF_MUXED_SSC_BDW &&
402+ (fuse_strap & HSW_CPU_SSC_ENABLE) == 0)
403+ return true;
404+
405+ return false;
406+}
407+
408+static void lpt_init_pch_refclk(struct drm_i915_private *dev_priv)
409+{
410+ struct intel_encoder *encoder;
411+ bool has_fdi = false;
412+
413+ for_each_intel_encoder(&dev_priv->drm, encoder) {
414+ switch (encoder->type) {
415+ case INTEL_OUTPUT_ANALOG:
416+ has_fdi = true;
417+ break;
418+ default:
419+ break;
420+ }
421+ }
422+
423+ /*
424+ * The BIOS may have decided to use the PCH SSC
425+ * reference so we must not disable it until the
426+ * relevant PLLs have stopped relying on it. We'll
427+ * just leave the PCH SSC reference enabled in case
428+ * any active PLL is using it. It will get disabled
429+ * after runtime suspend if we don't have FDI.
430+ *
431+ * TODO: Move the whole reference clock handling
432+ * to the modeset sequence proper so that we can
433+ * actually enable/disable/reconfigure these things
434+ * safely. To do that we need to introduce a real
435+ * clock hierarchy. That would also allow us to do
436+ * clock bending finally.
437+ */
438+ dev_priv->pch_ssc_use = 0;
439+
440+ if (spll_uses_pch_ssc(dev_priv)) {
441+ drm_dbg_kms(&dev_priv->drm, "SPLL using PCH SSC\n");
442+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_SPLL);
443+ }
444+
445+ if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL1)) {
446+ drm_dbg_kms(&dev_priv->drm, "WRPLL1 using PCH SSC\n");
447+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL1);
448+ }
449+
450+ if (wrpll_uses_pch_ssc(dev_priv, DPLL_ID_WRPLL2)) {
451+ drm_dbg_kms(&dev_priv->drm, "WRPLL2 using PCH SSC\n");
452+ dev_priv->pch_ssc_use |= BIT(DPLL_ID_WRPLL2);
453+ }
454+
455+ if (dev_priv->pch_ssc_use)
456+ return;
457+
458+ if (has_fdi) {
459+ lpt_bend_clkout_dp(dev_priv, 0);
460+ lpt_enable_clkout_dp(dev_priv, true, true);
461+ } else {
462+ lpt_disable_clkout_dp(dev_priv);
463+ }
464+}
465+
466+static void ilk_init_pch_refclk(struct drm_i915_private *dev_priv)
467+{
468+ struct intel_encoder *encoder;
469+ int i;
470+ u32 val, final;
471+ bool has_lvds = false;
472+ bool has_cpu_edp = false;
473+ bool has_panel = false;
474+ bool has_ck505 = false;
475+ bool can_ssc = false;
476+ bool using_ssc_source = false;
477+
478+ /* We need to take the global config into account */
479+ for_each_intel_encoder(&dev_priv->drm, encoder) {
480+ switch (encoder->type) {
481+ case INTEL_OUTPUT_LVDS:
482+ has_panel = true;
483+ has_lvds = true;
484+ break;
485+ case INTEL_OUTPUT_EDP:
486+ has_panel = true;
487+ if (encoder->port == PORT_A)
488+ has_cpu_edp = true;
489+ break;
490+ default:
491+ break;
492+ }
493+ }
494+
495+ if (HAS_PCH_IBX(dev_priv)) {
496+ has_ck505 = dev_priv->vbt.display_clock_mode;
497+ can_ssc = has_ck505;
498+ } else {
499+ has_ck505 = false;
500+ can_ssc = true;
501+ }
502+
503+ /* Check if any DPLLs are using the SSC source */
504+ for (i = 0; i < dev_priv->dpll.num_shared_dpll; i++) {
505+ u32 temp = intel_de_read(dev_priv, PCH_DPLL(i));
506+
507+ if (!(temp & DPLL_VCO_ENABLE))
508+ continue;
509+
510+ if ((temp & PLL_REF_INPUT_MASK) ==
511+ PLLB_REF_INPUT_SPREADSPECTRUMIN) {
512+ using_ssc_source = true;
513+ break;
514+ }
515+ }
516+
517+ drm_dbg_kms(&dev_priv->drm,
518+ "has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n",
519+ has_panel, has_lvds, has_ck505, using_ssc_source);
520+
521+ /* Ironlake: try to setup display ref clock before DPLL
522+ * enabling. This is only under driver's control after
523+ * PCH B stepping, previous chipset stepping should be
524+ * ignoring this setting.
525+ */
526+ val = intel_de_read(dev_priv, PCH_DREF_CONTROL);
527+
528+ /* As we must carefully and slowly disable/enable each source in turn,
529+ * compute the final state we want first and check if we need to
530+ * make any changes at all.
531+ */
532+ final = val;
533+ final &= ~DREF_NONSPREAD_SOURCE_MASK;
534+ if (has_ck505)
535+ final |= DREF_NONSPREAD_CK505_ENABLE;
536+ else
537+ final |= DREF_NONSPREAD_SOURCE_ENABLE;
538+
539+ final &= ~DREF_SSC_SOURCE_MASK;
540+ final &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
541+ final &= ~DREF_SSC1_ENABLE;
542+
543+ if (has_panel) {
544+ final |= DREF_SSC_SOURCE_ENABLE;
545+
546+ if (intel_panel_use_ssc(dev_priv) && can_ssc)
547+ final |= DREF_SSC1_ENABLE;
548+
549+ if (has_cpu_edp) {
550+ if (intel_panel_use_ssc(dev_priv) && can_ssc)
551+ final |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD;
552+ else
553+ final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
554+ } else {
555+ final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
556+ }
557+ } else if (using_ssc_source) {
558+ final |= DREF_SSC_SOURCE_ENABLE;
559+ final |= DREF_SSC1_ENABLE;
560+ }
561+
562+ if (final == val)
563+ return;
564+
565+ /* Always enable nonspread source */
566+ val &= ~DREF_NONSPREAD_SOURCE_MASK;
567+
568+ if (has_ck505)
569+ val |= DREF_NONSPREAD_CK505_ENABLE;
570+ else
571+ val |= DREF_NONSPREAD_SOURCE_ENABLE;
572+
573+ if (has_panel) {
574+ val &= ~DREF_SSC_SOURCE_MASK;
575+ val |= DREF_SSC_SOURCE_ENABLE;
576+
577+ /* SSC must be turned on before enabling the CPU output */
578+ if (intel_panel_use_ssc(dev_priv) && can_ssc) {
579+ drm_dbg_kms(&dev_priv->drm, "Using SSC on panel\n");
580+ val |= DREF_SSC1_ENABLE;
581+ } else {
582+ val &= ~DREF_SSC1_ENABLE;
583+ }
584+
585+ /* Get SSC going before enabling the outputs */
586+ intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
587+ intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
588+ udelay(200);
589+
590+ val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
591+
592+ /* Enable CPU source on CPU attached eDP */
593+ if (has_cpu_edp) {
594+ if (intel_panel_use_ssc(dev_priv) && can_ssc) {
595+ drm_dbg_kms(&dev_priv->drm,
596+ "Using SSC on eDP\n");
597+ val |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD;
598+ } else {
599+ val |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
600+ }
601+ } else {
602+ val |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
603+ }
604+
605+ intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
606+ intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
607+ udelay(200);
608+ } else {
609+ drm_dbg_kms(&dev_priv->drm, "Disabling CPU source output\n");
610+
611+ val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
612+
613+ /* Turn off CPU output */
614+ val |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
615+
616+ intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
617+ intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
618+ udelay(200);
619+
620+ if (!using_ssc_source) {
621+ drm_dbg_kms(&dev_priv->drm, "Disabling SSC source\n");
622+
623+ /* Turn off the SSC source */
624+ val &= ~DREF_SSC_SOURCE_MASK;
625+ val |= DREF_SSC_SOURCE_DISABLE;
626+
627+ /* Turn off SSC1 */
628+ val &= ~DREF_SSC1_ENABLE;
629+
630+ intel_de_write(dev_priv, PCH_DREF_CONTROL, val);
631+ intel_de_posting_read(dev_priv, PCH_DREF_CONTROL);
632+ udelay(200);
633+ }
634+ }
635+
636+ BUG_ON(val != final);
637+}
638+
639+/*
640+ * Initialize reference clocks when the driver loads
641+ */
642+void intel_init_pch_refclk(struct drm_i915_private *dev_priv)
643+{
644+ if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv))
645+ ilk_init_pch_refclk(dev_priv);
646+ else if (HAS_PCH_LPT(dev_priv))
647+ lpt_init_pch_refclk(dev_priv);
648+}
drivers/gpu/drm/i915/display/intel_pch_refclk.h+21−0
@@ -0,0 +1,21 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef _INTEL_PCH_REFCLK_H_
7+#define _INTEL_PCH_REFCLK_H_
8+
9+#include <linux/types.h>
10+
11+struct drm_i915_private;
12+struct intel_crtc_state;
13+
14+void lpt_program_iclkip(const struct intel_crtc_state *crtc_state);
15+void lpt_disable_iclkip(struct drm_i915_private *dev_priv);
16+int lpt_get_iclkip(struct drm_i915_private *dev_priv);
17+
18+void intel_init_pch_refclk(struct drm_i915_private *dev_priv);
19+void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
20+
21+#endif
drivers/gpu/drm/i915/display/intel_psr.c+78−47
@@ -28,13 +28,13 @@ · 27 unmodified lines
2828
2929 #include "i915_drv.h"
3030 #include "intel_atomic.h"
31+#include "intel_crtc.h"
3132 #include "intel_de.h"
3233 #include "intel_display_types.h"
3334 #include "intel_dp_aux.h"
3435 #include "intel_hdmi.h"
3536 #include "intel_psr.h"
3637 #include "intel_snps_phy.h"
37−#include "intel_sprite.h"
3838 #include "skl_universal_plane.h"
3939
4040 /**
@@ -588,7 +588,9 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp) · 547 unmodified lines
588588 static bool
589589 transcoder_has_psr2(struct drm_i915_private *dev_priv, enum transcoder trans)
590590 {
591− if (DISPLAY_VER(dev_priv) >= 12)
591+ if (IS_ALDERLAKE_P(dev_priv))
592+ return trans == TRANSCODER_A || trans == TRANSCODER_B;
593+ else if (DISPLAY_VER(dev_priv) >= 12)
592594 return trans == TRANSCODER_A;
593595 else
594596 return trans == TRANSCODER_EDP;
@@ -1346,6 +1348,7 @@ void intel_psr_disable(struct intel_dp *intel_dp, · 751 unmodified lines
13461348 */
13471349 void intel_psr_pause(struct intel_dp *intel_dp)
13481350 {
1351+ struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
13491352 struct intel_psr *psr = &intel_dp->psr;
13501353
13511354 if (!CAN_PSR(intel_dp))
@@ -1358,6 +1361,9 @@ void intel_psr_pause(struct intel_dp *intel_dp) · 6 unmodified lines
13581361 return;
13591362 }
13601363
1364+ /* If we ever hit this, we will need to add refcount to pause/resume */
1365+ drm_WARN_ON(&dev_priv->drm, psr->paused);
1366+
13611367 intel_psr_exit(intel_dp);
13621368 intel_psr_wait_exit_locked(intel_dp);
13631369 psr->paused = true;
@@ -1463,10 +1469,19 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane, · 99 unmodified lines
14631469 val |= plane_state->uapi.dst.x1;
14641470 intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_POS(pipe, plane->id), val);
14651471
1466− /* TODO: consider auxiliary surfaces */
1467− x = plane_state->uapi.src.x1 >> 16;
1468− y = (plane_state->uapi.src.y1 >> 16) + clip->y1;
1472+ x = plane_state->view.color_plane[color_plane].x;
1473+
1474+ /*
1475+ * From Bspec: UV surface Start Y Position = half of Y plane Y
1476+ * start position.
1477+ */
1478+ if (!color_plane)
1479+ y = plane_state->view.color_plane[color_plane].y + clip->y1;
1480+ else
1481+ y = plane_state->view.color_plane[color_plane].y + clip->y1 / 2;
1482+
14691483 val = y << 16 | x;
1484+
14701485 intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_OFFSET(pipe, plane->id),
14711486 val);
14721487
@@ -1558,9 +1573,6 @@ static void intel_psr2_sel_fetch_pipe_alignment(const struct intel_crtc_state *c · 85 unmodified lines
15581573 * also planes are not updated if they have a negative X
15591574 * position so for now doing a full update in this cases
15601575 *
1561− * TODO: We are missing multi-planar formats handling, until it is
1562− * implemented it will send full frame updates.
1563− *
15641576 * Plane scaling and rotation is not supported by selective fetch and both
15651577 * properties can change without a modeset, so need to be check at every
15661578 * atomic commmit.
@@ -1570,7 +1582,6 @@ static bool psr2_sel_fetch_plane_state_supported(const struct intel_plane_state · 3 unmodified lines
15701582 if (plane_state->uapi.dst.y1 < 0 ||
15711583 plane_state->uapi.dst.x1 < 0 ||
15721584 plane_state->scaler_id >= 0 ||
1573− plane_state->hw.fb->format->num_planes > 1 ||
15741585 plane_state->uapi.rotation != DRM_MODE_ROTATE_0)
15751586 return false;
15761587
@@ -1696,6 +1707,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · 119 unmodified lines
16961707 for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
16971708 new_plane_state, i) {
16981709 struct drm_rect *sel_fetch_area, inter;
1710+ struct intel_plane *linked = new_plane_state->planar_linked_plane;
16991711
17001712 if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc ||
17011713 !new_plane_state->uapi.visible)
@@ -1714,6 +1726,24 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · 12 unmodified lines
17141726 sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1;
17151727 sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1;
17161728 crtc_state->update_planes |= BIT(plane->id);
1729+
1730+ /*
1731+ * Sel_fetch_area is calculated for UV plane. Use
1732+ * same area for Y plane as well.
1733+ */
1734+ if (linked) {
1735+ struct intel_plane_state *linked_new_plane_state;
1736+ struct drm_rect *linked_sel_fetch_area;
1737+
1738+ linked_new_plane_state = intel_atomic_get_plane_state(state, linked);
1739+ if (IS_ERR(linked_new_plane_state))
1740+ return PTR_ERR(linked_new_plane_state);
1741+
1742+ linked_sel_fetch_area = &linked_new_plane_state->psr2_sel_fetch_area;
1743+ linked_sel_fetch_area->y1 = sel_fetch_area->y1;
1744+ linked_sel_fetch_area->y2 = sel_fetch_area->y2;
1745+ crtc_state->update_planes |= BIT(linked->id);
1746+ }
17171747 }
17181748
17191749 skip_sel_fetch_set_loop:
@@ -1721,11 +1751,17 @@ skip_sel_fetch_set_loop: · 1 unmodified line
17211751 return 0;
17221752 }
17231753
1724−static void _intel_psr_pre_plane_update(const struct intel_atomic_state *state,
1725− const struct intel_crtc_state *crtc_state)
1754+void intel_psr_pre_plane_update(struct intel_atomic_state *state,
1755+ struct intel_crtc *crtc)
17261756 {
1757+ struct drm_i915_private *i915 = to_i915(state->base.dev);
1758+ const struct intel_crtc_state *crtc_state =
1759+ intel_atomic_get_new_crtc_state(state, crtc);
17271760 struct intel_encoder *encoder;
17281761
1762+ if (!HAS_PSR(i915))
1763+ return;
1764+
17291765 for_each_intel_encoder_mask_with_psr(state->base.dev, encoder,
17301766 crtc_state->uapi.encoder_mask) {
17311767 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
@@ -1740,6 +1776,7 @@ static void _intel_psr_pre_plane_update(const struct intel_atomic_state *state, · 8 unmodified lines
17401776 * - All planes will go inactive
17411777 * - Changing between PSR versions
17421778 */
1779+ needs_to_disable |= intel_crtc_needs_modeset(crtc_state);
17431780 needs_to_disable |= !crtc_state->has_psr;
17441781 needs_to_disable |= !crtc_state->active_planes;
17451782 needs_to_disable |= crtc_state->has_psr2 != psr->psr2_enabled;
@@ -1751,20 +1788,6 @@ static void _intel_psr_pre_plane_update(const struct intel_atomic_state *state, · 5 unmodified lines
17511788 }
17521789 }
17531790
1754−void intel_psr_pre_plane_update(const struct intel_atomic_state *state)
1755−{
1756− struct drm_i915_private *dev_priv = to_i915(state->base.dev);
1757− struct intel_crtc_state *crtc_state;
1758− struct intel_crtc *crtc;
1759− int i;
1760−
1761− if (!HAS_PSR(dev_priv))
1762− return;
1763−
1764− for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i)
1765− _intel_psr_pre_plane_update(state, crtc_state);
1766−}
1767−
17681791 static void _intel_psr_post_plane_update(const struct intel_atomic_state *state,
17691792 const struct intel_crtc_state *crtc_state)
17701793 {
@@ -1809,15 +1832,21 @@ void intel_psr_post_plane_update(const struct intel_atomic_state *state) · 38 unmodified lines
18091832 _intel_psr_post_plane_update(state, crtc_state);
18101833 }
18111834
1812−/**
1813− * psr_wait_for_idle - wait for PSR1 to idle
1814− * @intel_dp: Intel DP
1815− * @out_value: PSR status in case of failure
1816− *
1817− * Returns: 0 on success or -ETIMEOUT if PSR status does not idle.
1818− *
1819− */
1820−static int psr_wait_for_idle(struct intel_dp *intel_dp, u32 *out_value)
1835+static int _psr2_ready_for_pipe_update_locked(struct intel_dp *intel_dp)
1836+{
1837+ struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
1838+
1839+ /*
1840+ * Any state lower than EDP_PSR2_STATUS_STATE_DEEP_SLEEP is enough.
1841+ * As all higher states has bit 4 of PSR2 state set we can just wait for
1842+ * EDP_PSR2_STATUS_STATE_DEEP_SLEEP to be cleared.
1843+ */
1844+ return intel_de_wait_for_clear(dev_priv,
1845+ EDP_PSR2_STATUS(intel_dp->psr.transcoder),
1846+ EDP_PSR2_STATUS_STATE_DEEP_SLEEP, 50);
1847+}
1848+
1849+static int _psr1_ready_for_pipe_update_locked(struct intel_dp *intel_dp)
18211850 {
18221851 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
18231852
@@ -1827,15 +1856,13 @@ static int psr_wait_for_idle(struct intel_dp *intel_dp, u32 *out_value) · 3 unmodified lines
18271856 * exit training time + 1.5 ms of aux channel handshake. 50 ms is
18281857 * defensive enough to cover everything.
18291858 */
1830− return __intel_wait_for_register(&dev_priv->uncore,
1831− EDP_PSR_STATUS(intel_dp->psr.transcoder),
1832− EDP_PSR_STATUS_STATE_MASK,
1833− EDP_PSR_STATUS_STATE_IDLE, 2, 50,
1834− out_value);
1859+ return intel_de_wait_for_clear(dev_priv,
1860+ EDP_PSR_STATUS(intel_dp->psr.transcoder),
1861+ EDP_PSR_STATUS_STATE_MASK, 50);
18351862 }
18361863
18371864 /**
1838− * intel_psr_wait_for_idle - wait for PSR1 to idle
1865+ * intel_psr_wait_for_idle - wait for PSR be ready for a pipe update
18391866 * @new_crtc_state: new CRTC state
18401867 *
18411868 * This function is expected to be called from pipe_update_start() where it is
@@ -1852,19 +1879,23 @@ void intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state) · 10 unmodified lines
18521879 for_each_intel_encoder_mask_with_psr(&dev_priv->drm, encoder,
18531880 new_crtc_state->uapi.encoder_mask) {
18541881 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1855− u32 psr_status;
1882+ int ret;
18561883
18571884 mutex_lock(&intel_dp->psr.lock);
1858− if (!intel_dp->psr.enabled || intel_dp->psr.psr2_enabled) {
1885+
1886+ if (!intel_dp->psr.enabled) {
18591887 mutex_unlock(&intel_dp->psr.lock);
18601888 continue;
18611889 }
18621890
1863− /* when the PSR1 is enabled */
1864− if (psr_wait_for_idle(intel_dp, &psr_status))
1865− drm_err(&dev_priv->drm,
1866− "PSR idle timed out 0x%x, atomic update may fail\n",
1867− psr_status);
1891+ if (intel_dp->psr.psr2_enabled)
1892+ ret = _psr2_ready_for_pipe_update_locked(intel_dp);
1893+ else
1894+ ret = _psr1_ready_for_pipe_update_locked(intel_dp);
1895+
1896+ if (ret)
1897+ drm_err(&dev_priv->drm, "PSR wait timed out, atomic update may fail\n");
1898+
18681899 mutex_unlock(&intel_dp->psr.lock);
18691900 }
18701901 }
drivers/gpu/drm/i915/display/intel_psr.h+2−1
@@ -20,7 +20,8 @@ struct intel_plane; · 19 unmodified lines
2020 struct intel_encoder;
2121
2222 void intel_psr_init_dpcd(struct intel_dp *intel_dp);
23−void intel_psr_pre_plane_update(const struct intel_atomic_state *state);
23+void intel_psr_pre_plane_update(struct intel_atomic_state *state,
24+ struct intel_crtc *crtc);
2425 void intel_psr_post_plane_update(const struct intel_atomic_state *state);
2526 void intel_psr_disable(struct intel_dp *intel_dp,
2627 const struct intel_crtc_state *old_crtc_state);
drivers/gpu/drm/i915/display/intel_snps_phy.c+1−1
@@ -58,7 +58,6 @@ void intel_snps_phy_set_signal_levels(struct intel_encoder *encoder, · 57 unmodified lines
5858 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
5959 const struct intel_ddi_buf_trans *trans;
6060 enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
61− int level = intel_ddi_level(encoder, crtc_state, 0);
6261 int n_entries, ln;
6362
6463 trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries);
@@ -66,6 +65,7 @@ void intel_snps_phy_set_signal_levels(struct intel_encoder *encoder, · 1 unmodified line
6665 return;
6766
6867 for (ln = 0; ln < 4; ln++) {
68+ int level = intel_ddi_level(encoder, crtc_state, ln);
6969 u32 val = 0;
7070
7171 val |= REG_FIELD_PREP(SNPS_PHY_TX_EQ_MAIN, trans->entries[level].snps.vswing);
drivers/gpu/drm/i915/display/intel_sprite.c+142−115
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include "intel_atomic_plane.h"
4646 #include "intel_de.h"
4747 #include "intel_display_types.h"
48+#include "intel_fb.h"
4849 #include "intel_frontbuffer.h"
4950 #include "intel_sprite.h"
5051 #include "i9xx_plane.h"
@@ -118,7 +119,7 @@ static void i9xx_plane_linear_gamma(u16 gamma[8]) · 67 unmodified lines
118119 }
119120
120121 static void
121−chv_update_csc(const struct intel_plane_state *plane_state)
122+chv_sprite_update_csc(const struct intel_plane_state *plane_state)
122123 {
123124 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
124125 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -190,7 +191,7 @@ chv_update_csc(const struct intel_plane_state *plane_state) · 65 unmodified lines
190191 #define COS_0 1
191192
192193 static void
193−vlv_update_clrc(const struct intel_plane_state *plane_state)
194+vlv_sprite_update_clrc(const struct intel_plane_state *plane_state)
194195 {
195196 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
196197 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -393,7 +394,7 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, · 196 unmodified lines
393394 return sprctl;
394395 }
395396
396−static void vlv_update_gamma(const struct intel_plane_state *plane_state)
397+static void vlv_sprite_update_gamma(const struct intel_plane_state *plane_state)
397398 {
398399 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
399400 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -417,45 +418,58 @@ static void vlv_update_gamma(const struct intel_plane_state *plane_state) · 17 unmodified lines
417418 }
418419
419420 static void
420−vlv_update_plane(struct intel_plane *plane,
421− const struct intel_crtc_state *crtc_state,
422− const struct intel_plane_state *plane_state)
421+vlv_sprite_update_noarm(struct intel_plane *plane,
422+ const struct intel_crtc_state *crtc_state,
423+ const struct intel_plane_state *plane_state)
423424 {
424425 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
425426 enum pipe pipe = plane->pipe;
426427 enum plane_id plane_id = plane->id;
427− u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
428− u32 linear_offset;
429− const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
430428 int crtc_x = plane_state->uapi.dst.x1;
431429 int crtc_y = plane_state->uapi.dst.y1;
432430 u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
433431 u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
434− u32 x = plane_state->view.color_plane[0].x;
435− u32 y = plane_state->view.color_plane[0].y;
436432 unsigned long irqflags;
437− u32 sprctl;
438−
439− sprctl = plane_state->ctl | vlv_sprite_ctl_crtc(crtc_state);
440433
441434 /* Sizes are 0 based */
442435 crtc_w--;
443436 crtc_h--;
444437
445− linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
446−
447438 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
448439
449440 intel_de_write_fw(dev_priv, SPSTRIDE(pipe, plane_id),
450− plane_state->view.color_plane[0].stride);
441+ plane_state->view.color_plane[0].mapping_stride);
451442 intel_de_write_fw(dev_priv, SPPOS(pipe, plane_id),
452443 (crtc_y << 16) | crtc_x);
453444 intel_de_write_fw(dev_priv, SPSIZE(pipe, plane_id),
454445 (crtc_h << 16) | crtc_w);
455− intel_de_write_fw(dev_priv, SPCONSTALPHA(pipe, plane_id), 0);
446+
447+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
448+}
449+
450+static void
451+vlv_sprite_update_arm(struct intel_plane *plane,
452+ const struct intel_crtc_state *crtc_state,
453+ const struct intel_plane_state *plane_state)
454+{
455+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
456+ enum pipe pipe = plane->pipe;
457+ enum plane_id plane_id = plane->id;
458+ const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
459+ u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
460+ u32 x = plane_state->view.color_plane[0].x;
461+ u32 y = plane_state->view.color_plane[0].y;
462+ u32 sprctl, linear_offset;
463+ unsigned long irqflags;
464+
465+ sprctl = plane_state->ctl | vlv_sprite_ctl_crtc(crtc_state);
466+
467+ linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
468+
469+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
456470
457471 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B)
458− chv_update_csc(plane_state);
472+ chv_sprite_update_csc(plane_state);
459473
460474 if (key->flags) {
461475 intel_de_write_fw(dev_priv, SPKEYMINVAL(pipe, plane_id),
@@ -466,6 +480,8 @@ vlv_update_plane(struct intel_plane *plane, · 4 unmodified lines
466480 key->max_value);
467481 }
468482
483+ intel_de_write_fw(dev_priv, SPCONSTALPHA(pipe, plane_id), 0);
484+
469485 intel_de_write_fw(dev_priv, SPLINOFF(pipe, plane_id), linear_offset);
470486 intel_de_write_fw(dev_priv, SPTILEOFF(pipe, plane_id), (y << 16) | x);
471487
@@ -478,15 +494,15 @@ vlv_update_plane(struct intel_plane *plane, · 6 unmodified lines
478494 intel_de_write_fw(dev_priv, SPSURF(pipe, plane_id),
479495 intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
480496
481− vlv_update_clrc(plane_state);
482− vlv_update_gamma(plane_state);
497+ vlv_sprite_update_clrc(plane_state);
498+ vlv_sprite_update_gamma(plane_state);
483499
484500 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
485501 }
486502
487503 static void
488−vlv_disable_plane(struct intel_plane *plane,
489− const struct intel_crtc_state *crtc_state)
504+vlv_sprite_disable_arm(struct intel_plane *plane,
505+ const struct intel_crtc_state *crtc_state)
490506 {
491507 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
492508 enum pipe pipe = plane->pipe;
@@ -502,8 +518,8 @@ vlv_disable_plane(struct intel_plane *plane, · 9 unmodified lines
502518 }
503519
504520 static bool
505−vlv_plane_get_hw_state(struct intel_plane *plane,
506− enum pipe *pipe)
521+vlv_sprite_get_hw_state(struct intel_plane *plane,
522+ enum pipe *pipe)
507523 {
508524 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
509525 enum intel_display_power_domain power_domain;
@@ -805,7 +821,7 @@ static void ivb_sprite_linear_gamma(const struct intel_plane_state *plane_state, · 295 unmodified lines
805821 i++;
806822 }
807823
808−static void ivb_update_gamma(const struct intel_plane_state *plane_state)
824+static void ivb_sprite_update_gamma(const struct intel_plane_state *plane_state)
809825 {
810826 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
811827 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -835,28 +851,21 @@ static void ivb_update_gamma(const struct intel_plane_state *plane_state) · 23 unmodified lines
835851 }
836852
837853 static void
838−ivb_update_plane(struct intel_plane *plane,
839− const struct intel_crtc_state *crtc_state,
840− const struct intel_plane_state *plane_state)
854+ivb_sprite_update_noarm(struct intel_plane *plane,
855+ const struct intel_crtc_state *crtc_state,
856+ const struct intel_plane_state *plane_state)
841857 {
842858 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
843859 enum pipe pipe = plane->pipe;
844− u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
845− u32 linear_offset;
846− const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
847860 int crtc_x = plane_state->uapi.dst.x1;
848861 int crtc_y = plane_state->uapi.dst.y1;
849862 u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
850863 u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
851− u32 x = plane_state->view.color_plane[0].x;
852− u32 y = plane_state->view.color_plane[0].y;
853864 u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
854865 u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
855− u32 sprctl, sprscale = 0;
866+ u32 sprscale = 0;
856867 unsigned long irqflags;
857868
858− sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state);
859−
860869 /* Sizes are 0 based */
861870 src_w--;
862871 src_h--;
@@ -866,17 +875,38 @@ ivb_update_plane(struct intel_plane *plane, · 3 unmodified lines
866875 if (crtc_w != src_w || crtc_h != src_h)
867876 sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h;
868877
869− linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
870−
871878 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
872879
873880 intel_de_write_fw(dev_priv, SPRSTRIDE(pipe),
874− plane_state->view.color_plane[0].stride);
881+ plane_state->view.color_plane[0].mapping_stride);
875882 intel_de_write_fw(dev_priv, SPRPOS(pipe), (crtc_y << 16) | crtc_x);
876883 intel_de_write_fw(dev_priv, SPRSIZE(pipe), (crtc_h << 16) | crtc_w);
877884 if (IS_IVYBRIDGE(dev_priv))
878885 intel_de_write_fw(dev_priv, SPRSCALE(pipe), sprscale);
879886
887+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
888+}
889+
890+static void
891+ivb_sprite_update_arm(struct intel_plane *plane,
892+ const struct intel_crtc_state *crtc_state,
893+ const struct intel_plane_state *plane_state)
894+{
895+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
896+ enum pipe pipe = plane->pipe;
897+ const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
898+ u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
899+ u32 x = plane_state->view.color_plane[0].x;
900+ u32 y = plane_state->view.color_plane[0].y;
901+ u32 sprctl, linear_offset;
902+ unsigned long irqflags;
903+
904+ sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state);
905+
906+ linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
907+
908+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
909+
880910 if (key->flags) {
881911 intel_de_write_fw(dev_priv, SPRKEYVAL(pipe), key->min_value);
882912 intel_de_write_fw(dev_priv, SPRKEYMSK(pipe),
@@ -902,14 +932,14 @@ ivb_update_plane(struct intel_plane *plane, · 19 unmodified lines
902932 intel_de_write_fw(dev_priv, SPRSURF(pipe),
903933 intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
904934
905− ivb_update_gamma(plane_state);
935+ ivb_sprite_update_gamma(plane_state);
906936
907937 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
908938 }
909939
910940 static void
911−ivb_disable_plane(struct intel_plane *plane,
912− const struct intel_crtc_state *crtc_state)
941+ivb_sprite_disable_arm(struct intel_plane *plane,
942+ const struct intel_crtc_state *crtc_state)
913943 {
914944 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
915945 enum pipe pipe = plane->pipe;
@@ -927,8 +957,8 @@ ivb_disable_plane(struct intel_plane *plane, · 11 unmodified lines
927957 }
928958
929959 static bool
930−ivb_plane_get_hw_state(struct intel_plane *plane,
931− enum pipe *pipe)
960+ivb_sprite_get_hw_state(struct intel_plane *plane,
961+ enum pipe *pipe)
932962 {
933963 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
934964 enum intel_display_power_domain power_domain;
@@ -1106,7 +1136,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, · 171 unmodified lines
11061136 return dvscntr;
11071137 }
11081138
1109−static void g4x_update_gamma(const struct intel_plane_state *plane_state)
1139+static void g4x_sprite_update_gamma(const struct intel_plane_state *plane_state)
11101140 {
11111141 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
11121142 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -1136,7 +1166,7 @@ static void ilk_sprite_linear_gamma(u16 gamma[17]) · 23 unmodified lines
11361166 gamma[i] = (i << 10) / 16;
11371167 }
11381168
1139−static void ilk_update_gamma(const struct intel_plane_state *plane_state)
1169+static void ilk_sprite_update_gamma(const struct intel_plane_state *plane_state)
11401170 {
11411171 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
11421172 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
@@ -1163,28 +1193,21 @@ static void ilk_update_gamma(const struct intel_plane_state *plane_state) · 20 unmodified lines
11631193 }
11641194
11651195 static void
1166−g4x_update_plane(struct intel_plane *plane,
1167− const struct intel_crtc_state *crtc_state,
1168− const struct intel_plane_state *plane_state)
1196+g4x_sprite_update_noarm(struct intel_plane *plane,
1197+ const struct intel_crtc_state *crtc_state,
1198+ const struct intel_plane_state *plane_state)
11691199 {
11701200 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
11711201 enum pipe pipe = plane->pipe;
1172− u32 dvssurf_offset = plane_state->view.color_plane[0].offset;
1173− u32 linear_offset;
1174− const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
11751202 int crtc_x = plane_state->uapi.dst.x1;
11761203 int crtc_y = plane_state->uapi.dst.y1;
11771204 u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
11781205 u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
1179− u32 x = plane_state->view.color_plane[0].x;
1180− u32 y = plane_state->view.color_plane[0].y;
11811206 u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
11821207 u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
1183− u32 dvscntr, dvsscale = 0;
1208+ u32 dvsscale = 0;
11841209 unsigned long irqflags;
11851210
1186− dvscntr = plane_state->ctl | g4x_sprite_ctl_crtc(crtc_state);
1187−
11881211 /* Sizes are 0 based */
11891212 src_w--;
11901213 src_h--;
@@ -1194,16 +1217,37 @@ g4x_update_plane(struct intel_plane *plane, · 3 unmodified lines
11941217 if (crtc_w != src_w || crtc_h != src_h)
11951218 dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h;
11961219
1197− linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
1198−
11991220 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
12001221
12011222 intel_de_write_fw(dev_priv, DVSSTRIDE(pipe),
1202− plane_state->view.color_plane[0].stride);
1223+ plane_state->view.color_plane[0].mapping_stride);
12031224 intel_de_write_fw(dev_priv, DVSPOS(pipe), (crtc_y << 16) | crtc_x);
12041225 intel_de_write_fw(dev_priv, DVSSIZE(pipe), (crtc_h << 16) | crtc_w);
12051226 intel_de_write_fw(dev_priv, DVSSCALE(pipe), dvsscale);
12061227
1228+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
1229+}
1230+
1231+static void
1232+g4x_sprite_update_arm(struct intel_plane *plane,
1233+ const struct intel_crtc_state *crtc_state,
1234+ const struct intel_plane_state *plane_state)
1235+{
1236+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
1237+ enum pipe pipe = plane->pipe;
1238+ const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
1239+ u32 dvssurf_offset = plane_state->view.color_plane[0].offset;
1240+ u32 x = plane_state->view.color_plane[0].x;
1241+ u32 y = plane_state->view.color_plane[0].y;
1242+ u32 dvscntr, linear_offset;
1243+ unsigned long irqflags;
1244+
1245+ dvscntr = plane_state->ctl | g4x_sprite_ctl_crtc(crtc_state);
1246+
1247+ linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
1248+
1249+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
1250+
12071251 if (key->flags) {
12081252 intel_de_write_fw(dev_priv, DVSKEYVAL(pipe), key->min_value);
12091253 intel_de_write_fw(dev_priv, DVSKEYMSK(pipe),
@@ -1224,16 +1268,16 @@ g4x_update_plane(struct intel_plane *plane, · 14 unmodified lines
12241268 intel_plane_ggtt_offset(plane_state) + dvssurf_offset);
12251269
12261270 if (IS_G4X(dev_priv))
1227− g4x_update_gamma(plane_state);
1271+ g4x_sprite_update_gamma(plane_state);
12281272 else
1229− ilk_update_gamma(plane_state);
1273+ ilk_sprite_update_gamma(plane_state);
12301274
12311275 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
12321276 }
12331277
12341278 static void
1235−g4x_disable_plane(struct intel_plane *plane,
1236− const struct intel_crtc_state *crtc_state)
1279+g4x_sprite_disable_arm(struct intel_plane *plane,
1280+ const struct intel_crtc_state *crtc_state)
12371281 {
12381282 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
12391283 enum pipe pipe = plane->pipe;
@@ -1250,8 +1294,8 @@ g4x_disable_plane(struct intel_plane *plane, · 10 unmodified lines
12501294 }
12511295
12521296 static bool
1253−g4x_plane_get_hw_state(struct intel_plane *plane,
1254− enum pipe *pipe)
1297+g4x_sprite_get_hw_state(struct intel_plane *plane,
1298+ enum pipe *pipe)
12551299 {
12561300 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
12571301 enum intel_display_power_domain power_domain;
@@ -1299,7 +1343,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 41 unmodified lines
12991343 int src_x, src_w, src_h, crtc_w, crtc_h;
13001344 const struct drm_display_mode *adjusted_mode =
13011345 &crtc_state->hw.adjusted_mode;
1302− unsigned int stride = plane_state->view.color_plane[0].stride;
1346+ unsigned int stride = plane_state->view.color_plane[0].mapping_stride;
13031347 unsigned int cpp = fb->format->cpp[0];
13041348 unsigned int width_bytes;
13051349 int min_width, min_height;
@@ -1567,7 +1611,7 @@ out: · 261 unmodified lines
15671611 return ret;
15681612 }
15691613
1570−static const u32 g4x_plane_formats[] = {
1614+static const u32 g4x_sprite_formats[] = {
15711615 DRM_FORMAT_XRGB8888,
15721616 DRM_FORMAT_YUYV,
15731617 DRM_FORMAT_YVYU,
@@ -1575,13 +1619,7 @@ static const u32 g4x_plane_formats[] = { · 1 unmodified line
15751619 DRM_FORMAT_VYUY,
15761620 };
15771621
1578−static const u64 i9xx_plane_format_modifiers[] = {
1579− I915_FORMAT_MOD_X_TILED,
1580− DRM_FORMAT_MOD_LINEAR,
1581− DRM_FORMAT_MOD_INVALID
1582−};
1583−
1584−static const u32 snb_plane_formats[] = {
1622+static const u32 snb_sprite_formats[] = {
15851623 DRM_FORMAT_XRGB8888,
15861624 DRM_FORMAT_XBGR8888,
15871625 DRM_FORMAT_XRGB2101010,
@@ -1594,7 +1632,7 @@ static const u32 snb_plane_formats[] = { · 6 unmodified lines
15941632 DRM_FORMAT_VYUY,
15951633 };
15961634
1597−static const u32 vlv_plane_formats[] = {
1635+static const u32 vlv_sprite_formats[] = {
15981636 DRM_FORMAT_C8,
15991637 DRM_FORMAT_RGB565,
16001638 DRM_FORMAT_XRGB8888,
@@ -1629,13 +1667,8 @@ static const u32 chv_pipe_b_sprite_formats[] = { · 28 unmodified lines
16291667 static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane,
16301668 u32 format, u64 modifier)
16311669 {
1632− switch (modifier) {
1633− case DRM_FORMAT_MOD_LINEAR:
1634− case I915_FORMAT_MOD_X_TILED:
1635− break;
1636− default:
1670+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
16371671 return false;
1638− }
16391672
16401673 switch (format) {
16411674 case DRM_FORMAT_XRGB8888:
@@ -1655,13 +1688,8 @@ static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane, · 13 unmodified lines
16551688 static bool snb_sprite_format_mod_supported(struct drm_plane *_plane,
16561689 u32 format, u64 modifier)
16571690 {
1658− switch (modifier) {
1659− case DRM_FORMAT_MOD_LINEAR:
1660− case I915_FORMAT_MOD_X_TILED:
1661− break;
1662− default:
1691+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
16631692 return false;
1664− }
16651693
16661694 switch (format) {
16671695 case DRM_FORMAT_XRGB8888:
@@ -1686,13 +1714,8 @@ static bool snb_sprite_format_mod_supported(struct drm_plane *_plane, · 18 unmodified lines
16861714 static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane,
16871715 u32 format, u64 modifier)
16881716 {
1689− switch (modifier) {
1690− case DRM_FORMAT_MOD_LINEAR:
1691− case I915_FORMAT_MOD_X_TILED:
1692− break;
1693− default:
1717+ if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
16941718 return false;
1695− }
16961719
16971720 switch (format) {
16981721 case DRM_FORMAT_C8:
@@ -1762,9 +1785,10 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 63 unmodified lines
17621785 return plane;
17631786
17641787 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1765− plane->update_plane = vlv_update_plane;
1766− plane->disable_plane = vlv_disable_plane;
1767− plane->get_hw_state = vlv_plane_get_hw_state;
1788+ plane->update_noarm = vlv_sprite_update_noarm;
1789+ plane->update_arm = vlv_sprite_update_arm;
1790+ plane->disable_arm = vlv_sprite_disable_arm;
1791+ plane->get_hw_state = vlv_sprite_get_hw_state;
17681792 plane->check_plane = vlv_sprite_check;
17691793 plane->max_stride = i965_plane_max_stride;
17701794 plane->min_cdclk = vlv_plane_min_cdclk;
@@ -1773,16 +1797,16 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 2 unmodified lines
17731797 formats = chv_pipe_b_sprite_formats;
17741798 num_formats = ARRAY_SIZE(chv_pipe_b_sprite_formats);
17751799 } else {
1776− formats = vlv_plane_formats;
1777− num_formats = ARRAY_SIZE(vlv_plane_formats);
1800+ formats = vlv_sprite_formats;
1801+ num_formats = ARRAY_SIZE(vlv_sprite_formats);
17781802 }
1779− modifiers = i9xx_plane_format_modifiers;
17801803
17811804 plane_funcs = &vlv_sprite_funcs;
17821805 } else if (DISPLAY_VER(dev_priv) >= 7) {
1783− plane->update_plane = ivb_update_plane;
1784− plane->disable_plane = ivb_disable_plane;
1785− plane->get_hw_state = ivb_plane_get_hw_state;
1806+ plane->update_noarm = ivb_sprite_update_noarm;
1807+ plane->update_arm = ivb_sprite_update_arm;
1808+ plane->disable_arm = ivb_sprite_disable_arm;
1809+ plane->get_hw_state = ivb_sprite_get_hw_state;
17861810 plane->check_plane = g4x_sprite_check;
17871811
17881812 if (IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) {
@@ -1793,28 +1817,27 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 4 unmodified lines
17931817 plane->min_cdclk = ivb_sprite_min_cdclk;
17941818 }
17951819
1796− formats = snb_plane_formats;
1797− num_formats = ARRAY_SIZE(snb_plane_formats);
1798− modifiers = i9xx_plane_format_modifiers;
1820+ formats = snb_sprite_formats;
1821+ num_formats = ARRAY_SIZE(snb_sprite_formats);
17991822
18001823 plane_funcs = &snb_sprite_funcs;
18011824 } else {
1802− plane->update_plane = g4x_update_plane;
1803− plane->disable_plane = g4x_disable_plane;
1804− plane->get_hw_state = g4x_plane_get_hw_state;
1825+ plane->update_noarm = g4x_sprite_update_noarm;
1826+ plane->update_arm = g4x_sprite_update_arm;
1827+ plane->disable_arm = g4x_sprite_disable_arm;
1828+ plane->get_hw_state = g4x_sprite_get_hw_state;
18051829 plane->check_plane = g4x_sprite_check;
18061830 plane->max_stride = g4x_sprite_max_stride;
18071831 plane->min_cdclk = g4x_sprite_min_cdclk;
18081832
1809− modifiers = i9xx_plane_format_modifiers;
18101833 if (IS_SANDYBRIDGE(dev_priv)) {
1811− formats = snb_plane_formats;
1812− num_formats = ARRAY_SIZE(snb_plane_formats);
1834+ formats = snb_sprite_formats;
1835+ num_formats = ARRAY_SIZE(snb_sprite_formats);
18131836
18141837 plane_funcs = &snb_sprite_funcs;
18151838 } else {
1816− formats = g4x_plane_formats;
1817− num_formats = ARRAY_SIZE(g4x_plane_formats);
1839+ formats = g4x_sprite_formats;
1840+ num_formats = ARRAY_SIZE(g4x_sprite_formats);
18181841
18191842 plane_funcs = &g4x_sprite_funcs;
18201843 }
@@ -1833,11 +1856,15 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 12 unmodified lines
18331856 plane->id = PLANE_SPRITE0 + sprite;
18341857 plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id);
18351858
1859+ modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_TILING_X);
1860+
18361861 ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
18371862 0, plane_funcs,
18381863 formats, num_formats, modifiers,
18391864 DRM_PLANE_TYPE_OVERLAY,
18401865 "sprite %c", sprite_name(pipe, sprite));
1866+ kfree(modifiers);
1867+
18411868 if (ret)
18421869 goto fail;
18431870
drivers/gpu/drm/i915/display/intel_sprite.h+0−4
@@ -27,14 +27,10 @@ struct intel_plane_state; · 26 unmodified lines
2727 #define VBLANK_EVASION_TIME_US 100
2828 #endif
2929
30−int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
31− int usecs);
3230 struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
3331 enum pipe pipe, int plane);
3432 int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data,
3533 struct drm_file *file_priv);
36−void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state);
37−void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state);
3834 int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state);
3935 int chv_plane_check_rotation(const struct intel_plane_state *plane_state);
4036
drivers/gpu/drm/i915/display/intel_vdsc.c+31−34
@@ -442,10 +442,10 @@ calculate_rc_params(struct rc_parameters *rc, · 441 unmodified lines
442442 }
443443 }
444444
445−int intel_dsc_compute_params(struct intel_encoder *encoder,
446− struct intel_crtc_state *pipe_config)
445+int intel_dsc_compute_params(struct intel_crtc_state *pipe_config)
447446 {
448− struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
447+ struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
448+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
449449 struct drm_dsc_config *vdsc_cfg = &pipe_config->dsc.config;
450450 u16 compressed_bpp = pipe_config->dsc.compressed_bpp;
451451 const struct rc_parameters *rc_params;
@@ -598,7 +598,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 146 unmodified lines
598598 pps_val |= DSC_422_ENABLE;
599599 if (vdsc_cfg->vbr_enable)
600600 pps_val |= DSC_VBR_ENABLE;
601− drm_info(&dev_priv->drm, "PPS0 = 0x%08x\n", pps_val);
601+ drm_dbg_kms(&dev_priv->drm, "PPS0 = 0x%08x\n", pps_val);
602602 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
603603 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_0,
604604 pps_val);
@@ -622,7 +622,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 17 unmodified lines
622622 /* Populate PICTURE_PARAMETER_SET_1 registers */
623623 pps_val = 0;
624624 pps_val |= DSC_BPP(vdsc_cfg->bits_per_pixel);
625− drm_info(&dev_priv->drm, "PPS1 = 0x%08x\n", pps_val);
625+ drm_dbg_kms(&dev_priv->drm, "PPS1 = 0x%08x\n", pps_val);
626626 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
627627 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_1,
628628 pps_val);
@@ -647,7 +647,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
647647 pps_val = 0;
648648 pps_val |= DSC_PIC_HEIGHT(vdsc_cfg->pic_height) |
649649 DSC_PIC_WIDTH(vdsc_cfg->pic_width / num_vdsc_instances);
650− drm_info(&dev_priv->drm, "PPS2 = 0x%08x\n", pps_val);
650+ drm_dbg_kms(&dev_priv->drm, "PPS2 = 0x%08x\n", pps_val);
651651 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
652652 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_2,
653653 pps_val);
@@ -672,7 +672,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
672672 pps_val = 0;
673673 pps_val |= DSC_SLICE_HEIGHT(vdsc_cfg->slice_height) |
674674 DSC_SLICE_WIDTH(vdsc_cfg->slice_width);
675− drm_info(&dev_priv->drm, "PPS3 = 0x%08x\n", pps_val);
675+ drm_dbg_kms(&dev_priv->drm, "PPS3 = 0x%08x\n", pps_val);
676676 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
677677 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_3,
678678 pps_val);
@@ -697,7 +697,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
697697 pps_val = 0;
698698 pps_val |= DSC_INITIAL_XMIT_DELAY(vdsc_cfg->initial_xmit_delay) |
699699 DSC_INITIAL_DEC_DELAY(vdsc_cfg->initial_dec_delay);
700− drm_info(&dev_priv->drm, "PPS4 = 0x%08x\n", pps_val);
700+ drm_dbg_kms(&dev_priv->drm, "PPS4 = 0x%08x\n", pps_val);
701701 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
702702 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_4,
703703 pps_val);
@@ -722,7 +722,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
722722 pps_val = 0;
723723 pps_val |= DSC_SCALE_INC_INT(vdsc_cfg->scale_increment_interval) |
724724 DSC_SCALE_DEC_INT(vdsc_cfg->scale_decrement_interval);
725− drm_info(&dev_priv->drm, "PPS5 = 0x%08x\n", pps_val);
725+ drm_dbg_kms(&dev_priv->drm, "PPS5 = 0x%08x\n", pps_val);
726726 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
727727 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_5,
728728 pps_val);
@@ -749,7 +749,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines
749749 DSC_FIRST_LINE_BPG_OFFSET(vdsc_cfg->first_line_bpg_offset) |
750750 DSC_FLATNESS_MIN_QP(vdsc_cfg->flatness_min_qp) |
751751 DSC_FLATNESS_MAX_QP(vdsc_cfg->flatness_max_qp);
752− drm_info(&dev_priv->drm, "PPS6 = 0x%08x\n", pps_val);
752+ drm_dbg_kms(&dev_priv->drm, "PPS6 = 0x%08x\n", pps_val);
753753 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
754754 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_6,
755755 pps_val);
@@ -774,7 +774,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
774774 pps_val = 0;
775775 pps_val |= DSC_SLICE_BPG_OFFSET(vdsc_cfg->slice_bpg_offset) |
776776 DSC_NFL_BPG_OFFSET(vdsc_cfg->nfl_bpg_offset);
777− drm_info(&dev_priv->drm, "PPS7 = 0x%08x\n", pps_val);
777+ drm_dbg_kms(&dev_priv->drm, "PPS7 = 0x%08x\n", pps_val);
778778 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
779779 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_7,
780780 pps_val);
@@ -799,7 +799,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
799799 pps_val = 0;
800800 pps_val |= DSC_FINAL_OFFSET(vdsc_cfg->final_offset) |
801801 DSC_INITIAL_OFFSET(vdsc_cfg->initial_offset);
802− drm_info(&dev_priv->drm, "PPS8 = 0x%08x\n", pps_val);
802+ drm_dbg_kms(&dev_priv->drm, "PPS8 = 0x%08x\n", pps_val);
803803 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
804804 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_8,
805805 pps_val);
@@ -824,7 +824,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines
824824 pps_val = 0;
825825 pps_val |= DSC_RC_MODEL_SIZE(vdsc_cfg->rc_model_size) |
826826 DSC_RC_EDGE_FACTOR(DSC_RC_EDGE_FACTOR_CONST);
827− drm_info(&dev_priv->drm, "PPS9 = 0x%08x\n", pps_val);
827+ drm_dbg_kms(&dev_priv->drm, "PPS9 = 0x%08x\n", pps_val);
828828 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
829829 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_9,
830830 pps_val);
@@ -851,7 +851,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines
851851 DSC_RC_QUANT_INC_LIMIT1(vdsc_cfg->rc_quant_incr_limit1) |
852852 DSC_RC_TARGET_OFF_HIGH(DSC_RC_TGT_OFFSET_HI_CONST) |
853853 DSC_RC_TARGET_OFF_LOW(DSC_RC_TGT_OFFSET_LO_CONST);
854− drm_info(&dev_priv->drm, "PPS10 = 0x%08x\n", pps_val);
854+ drm_dbg_kms(&dev_priv->drm, "PPS10 = 0x%08x\n", pps_val);
855855 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
856856 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_10,
857857 pps_val);
@@ -879,7 +879,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 21 unmodified lines
879879 vdsc_cfg->slice_width) |
880880 DSC_SLICE_ROW_PER_FRAME(vdsc_cfg->pic_height /
881881 vdsc_cfg->slice_height);
882− drm_info(&dev_priv->drm, "PPS16 = 0x%08x\n", pps_val);
882+ drm_dbg_kms(&dev_priv->drm, "PPS16 = 0x%08x\n", pps_val);
883883 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
884884 intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_16,
885885 pps_val);
@@ -906,8 +906,8 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines
906906 rc_buf_thresh_dword[i / 4] |=
907907 (u32)(vdsc_cfg->rc_buf_thresh[i] <<
908908 BITS_PER_BYTE * (i % 4));
909− drm_info(&dev_priv->drm, " RC_BUF_THRESH%d = 0x%08x\n", i,
910− rc_buf_thresh_dword[i / 4]);
909+ drm_dbg_kms(&dev_priv->drm, "RC_BUF_THRESH_%d = 0x%08x\n", i,
910+ rc_buf_thresh_dword[i / 4]);
911911 }
912912 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
913913 intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_0,
@@ -963,8 +963,8 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 49 unmodified lines
963963 RC_MAX_QP_SHIFT) |
964964 (vdsc_cfg->rc_range_params[i].range_min_qp <<
965965 RC_MIN_QP_SHIFT)) << 16 * (i % 2));
966− drm_info(&dev_priv->drm, " RC_RANGE_PARAM_%d = 0x%08x\n", i,
967− rc_range_params_dword[i / 2]);
966+ drm_dbg_kms(&dev_priv->drm, "RC_RANGE_PARAM_%d = 0x%08x\n", i,
967+ rc_range_params_dword[i / 2]);
968968 }
969969 if (!is_pipe_dsc(crtc, cpu_transcoder)) {
970970 intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_0,
@@ -1055,8 +1055,8 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 84 unmodified lines
10551055 }
10561056 }
10571057
1058−static void intel_dsc_dsi_pps_write(struct intel_encoder *encoder,
1059− const struct intel_crtc_state *crtc_state)
1058+void intel_dsc_dsi_pps_write(struct intel_encoder *encoder,
1059+ const struct intel_crtc_state *crtc_state)
10601060 {
10611061 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config;
10621062 struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
@@ -1064,6 +1064,9 @@ static void intel_dsc_dsi_pps_write(struct intel_encoder *encoder, · 1 unmodified line
10641064 struct drm_dsc_picture_parameter_set pps;
10651065 enum port port;
10661066
1067+ if (!crtc_state->dsc.compression_enable)
1068+ return;
1069+
10671070 drm_dsc_pps_payload_pack(&pps, vdsc_cfg);
10681071
10691072 for_each_dsi_port(port, intel_dsi->ports) {
@@ -1074,14 +1077,16 @@ static void intel_dsc_dsi_pps_write(struct intel_encoder *encoder, · 4 unmodified lines
10741077 }
10751078 }
10761079
1077−static void intel_dsc_dp_pps_write(struct intel_encoder *encoder,
1078− const struct intel_crtc_state *crtc_state)
1080+void intel_dsc_dp_pps_write(struct intel_encoder *encoder,
1081+ const struct intel_crtc_state *crtc_state)
10791082 {
1080− struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
1081− struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
1083+ struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
10821084 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config;
10831085 struct drm_dsc_pps_infoframe dp_dsc_pps_sdp;
10841086
1087+ if (!crtc_state->dsc.compression_enable)
1088+ return;
1089+
10851090 /* Prepare DP SDP PPS header as per DP 1.4 spec, Table 2-123 */
10861091 drm_dsc_dp_pps_header_init(&dp_dsc_pps_sdp.pps_header);
10871092
@@ -1142,8 +1147,7 @@ void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state) · 54 unmodified lines
11421147 }
11431148 }
11441149
1145−void intel_dsc_enable(struct intel_encoder *encoder,
1146− const struct intel_crtc_state *crtc_state)
1150+void intel_dsc_enable(const struct intel_crtc_state *crtc_state)
11471151 {
11481152 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
11491153 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -1155,13 +1159,6 @@ void intel_dsc_enable(struct intel_encoder *encoder, · 5 unmodified lines
11551159
11561160 intel_dsc_pps_configure(crtc_state);
11571161
1158− if (!crtc_state->bigjoiner_slave) {
1159− if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI))
1160− intel_dsc_dsi_pps_write(encoder, crtc_state);
1161− else
1162− intel_dsc_dp_pps_write(encoder, crtc_state);
1163− }
1164−
11651162 dss_ctl2_val |= LEFT_BRANCH_VDSC_ENABLE;
11661163 if (crtc_state->dsc.dsc_split) {
11671164 dss_ctl2_val |= RIGHT_BRANCH_VDSC_ENABLE;
drivers/gpu/drm/i915/display/intel_vdsc.h+6−4
@@ -15,15 +15,17 @@ struct intel_encoder; · 14 unmodified lines
1515
1616 bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state);
1717 void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state);
18−void intel_dsc_enable(struct intel_encoder *encoder,
19− const struct intel_crtc_state *crtc_state);
18+void intel_dsc_enable(const struct intel_crtc_state *crtc_state);
2019 void intel_dsc_disable(const struct intel_crtc_state *crtc_state);
21−int intel_dsc_compute_params(struct intel_encoder *encoder,
22− struct intel_crtc_state *pipe_config);
20+int intel_dsc_compute_params(struct intel_crtc_state *pipe_config);
2321 void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state);
2422 void intel_dsc_get_config(struct intel_crtc_state *crtc_state);
2523 enum intel_display_power_domain
2624 intel_dsc_power_domain(struct intel_crtc *crtc, enum transcoder cpu_transcoder);
2725 struct intel_crtc *intel_dsc_get_bigjoiner_secondary(const struct intel_crtc *primary_crtc);
26+void intel_dsc_dsi_pps_write(struct intel_encoder *encoder,
27+ const struct intel_crtc_state *crtc_state);
28+void intel_dsc_dp_pps_write(struct intel_encoder *encoder,
29+ const struct intel_crtc_state *crtc_state);
2830
2931 #endif /* __INTEL_VDSC_H__ */
drivers/gpu/drm/i915/display/intel_vrr.c+15−3
@@ -60,7 +60,7 @@ intel_vrr_check_modeset(struct intel_atomic_state *state) · 59 unmodified lines
6060 * Between those two points the vblank exit starts (and hence registers get
6161 * latched) ASAP after a push is sent.
6262 *
63− * framestart_delay is programmable 0-3.
63+ * framestart_delay is programmable 1-4.
6464 */
6565 static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_state)
6666 {
@@ -138,13 +138,13 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state, · 71 unmodified lines
138138 i915->window2_delay;
139139 else
140140 /*
141− * FIXME: s/4/framestart_delay+1/ to get consistent
141+ * FIXME: s/4/framestart_delay/ to get consistent
142142 * earliest/latest points for register latching regardless
143143 * of the framestart_delay used?
144144 *
145145 * FIXME: this really needs the extra scanline to provide consistent
146146 * behaviour for all framestart_delay values. Otherwise with
147− * framestart_delay==3 we will end up extending the min vblank by
147+ * framestart_delay==4 we will end up extending the min vblank by
148148 * one extra line.
149149 */
150150 crtc_state->vrr.pipeline_full =
@@ -193,6 +193,18 @@ void intel_vrr_send_push(const struct intel_crtc_state *crtc_state) · 42 unmodified lines
193193 TRANS_PUSH_EN | TRANS_PUSH_SEND);
194194 }
195195
196+bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state)
197+{
198+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
199+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
200+ enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
201+
202+ if (!crtc_state->vrr.enable)
203+ return false;
204+
205+ return intel_de_read(dev_priv, TRANS_PUSH(cpu_transcoder)) & TRANS_PUSH_SEND;
206+}
207+
196208 void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state)
197209 {
198210 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
drivers/gpu/drm/i915/display/intel_vrr.h+1−0
@@ -23,6 +23,7 @@ void intel_vrr_compute_config(struct intel_crtc_state *crtc_state, · 22 unmodified lines
2323 void intel_vrr_enable(struct intel_encoder *encoder,
2424 const struct intel_crtc_state *crtc_state);
2525 void intel_vrr_send_push(const struct intel_crtc_state *crtc_state);
26+bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state);
2627 void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state);
2728 void intel_vrr_get_config(struct intel_crtc *crtc,
2829 struct intel_crtc_state *crtc_state);
drivers/gpu/drm/i915/display/skl_scaler.c+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 */
55 #include "intel_de.h"
66 #include "intel_display_types.h"
7+#include "intel_fb.h"
78 #include "skl_scaler.h"
89 #include "skl_universal_plane.h"
910
drivers/gpu/drm/i915/display/skl_universal_plane.c+224−238
@@ -163,50 +163,6 @@ static const u32 icl_hdr_plane_formats[] = { · 162 unmodified lines
163163 DRM_FORMAT_XVYU16161616,
164164 };
165165
166−static const u64 skl_plane_format_modifiers_noccs[] = {
167− I915_FORMAT_MOD_Yf_TILED,
168− I915_FORMAT_MOD_Y_TILED,
169− I915_FORMAT_MOD_X_TILED,
170− DRM_FORMAT_MOD_LINEAR,
171− DRM_FORMAT_MOD_INVALID
172−};
173−
174−static const u64 skl_plane_format_modifiers_ccs[] = {
175− I915_FORMAT_MOD_Yf_TILED_CCS,
176− I915_FORMAT_MOD_Y_TILED_CCS,
177− I915_FORMAT_MOD_Yf_TILED,
178− I915_FORMAT_MOD_Y_TILED,
179− I915_FORMAT_MOD_X_TILED,
180− DRM_FORMAT_MOD_LINEAR,
181− DRM_FORMAT_MOD_INVALID
182−};
183−
184−static const u64 gen12_plane_format_modifiers_mc_ccs[] = {
185− I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS,
186− I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
187− I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
188− I915_FORMAT_MOD_Y_TILED,
189− I915_FORMAT_MOD_X_TILED,
190− DRM_FORMAT_MOD_LINEAR,
191− DRM_FORMAT_MOD_INVALID
192−};
193−
194−static const u64 gen12_plane_format_modifiers_rc_ccs[] = {
195− I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS,
196− I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC,
197− I915_FORMAT_MOD_Y_TILED,
198− I915_FORMAT_MOD_X_TILED,
199− DRM_FORMAT_MOD_LINEAR,
200− DRM_FORMAT_MOD_INVALID
201−};
202−
203−static const u64 adlp_step_a_plane_format_modifiers[] = {
204− I915_FORMAT_MOD_Y_TILED,
205− I915_FORMAT_MOD_X_TILED,
206− DRM_FORMAT_MOD_LINEAR,
207− DRM_FORMAT_MOD_INVALID
208−};
209−
210166 int skl_format_to_fourcc(int format, bool rgb_order, bool alpha)
211167 {
212168 switch (format) {
@@ -633,7 +589,7 @@ static u32 skl_plane_stride(const struct intel_plane_state *plane_state, · 420 unmodified lines
633589 {
634590 const struct drm_framebuffer *fb = plane_state->hw.fb;
635591 unsigned int rotation = plane_state->hw.rotation;
636− u32 stride = plane_state->view.color_plane[color_plane].stride;
592+ u32 stride = plane_state->view.color_plane[color_plane].scanout_stride;
637593
638594 if (color_plane >= fb->format->num_planes)
639595 return 0;
@@ -642,8 +598,8 @@ static u32 skl_plane_stride(const struct intel_plane_state *plane_state, · 2 unmodified lines
642598 }
643599
644600 static void
645−skl_disable_plane(struct intel_plane *plane,
646− const struct intel_crtc_state *crtc_state)
601+skl_plane_disable_arm(struct intel_plane *plane,
602+ const struct intel_crtc_state *crtc_state)
647603 {
648604 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
649605 enum plane_id plane_id = plane->id;
@@ -985,6 +941,9 @@ static u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, · 335 unmodified lines
985941 plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
986942 }
987943
944+ if (plane_state->force_black)
945+ plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
946+
988947 return plane_color_ctl;
989948 }
990949
@@ -1008,115 +967,145 @@ static u32 skl_surf_address(const struct intel_plane_state *plane_state, · 17 unmodified lines
1008967 }
1009968 }
1010969
1011−static void intel_load_plane_csc_black(struct intel_plane *intel_plane)
970+static u32 skl_plane_surf(const struct intel_plane_state *plane_state,
971+ int color_plane)
1012972 {
1013− struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev);
1014− enum pipe pipe = intel_plane->pipe;
1015− enum plane_id plane = intel_plane->id;
1016− u16 postoff = 0;
973+ u32 plane_surf;
1017974
1018− drm_dbg_kms(&dev_priv->drm, "plane color CTM to black %s:%d\n",
1019− intel_plane->base.name, plane);
1020− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 0), 0);
1021− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 1), 0);
975+ plane_surf = intel_plane_ggtt_offset(plane_state) +
976+ skl_surf_address(plane_state, color_plane);
1022977
1023− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 2), 0);
1024− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 3), 0);
978+ if (plane_state->decrypt)
979+ plane_surf |= PLANE_SURF_DECRYPT;
1025980
1026− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 4), 0);
1027− intel_de_write_fw(dev_priv, PLANE_CSC_COEFF(pipe, plane, 5), 0);
981+ return plane_surf;
982+}
1028983
1029− intel_de_write_fw(dev_priv, PLANE_CSC_PREOFF(pipe, plane, 0), 0);
1030− intel_de_write_fw(dev_priv, PLANE_CSC_PREOFF(pipe, plane, 1), 0);
1031− intel_de_write_fw(dev_priv, PLANE_CSC_PREOFF(pipe, plane, 2), 0);
984+static void icl_plane_csc_load_black(struct intel_plane *plane)
985+{
986+ struct drm_i915_private *i915 = to_i915(plane->base.dev);
987+ enum plane_id plane_id = plane->id;
988+ enum pipe pipe = plane->pipe;
989+
990+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 0), 0);
991+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 1), 0);
992+
993+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 2), 0);
994+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 3), 0);
995+
996+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 4), 0);
997+ intel_de_write_fw(i915, PLANE_CSC_COEFF(pipe, plane_id, 5), 0);
998+
999+ intel_de_write_fw(i915, PLANE_CSC_PREOFF(pipe, plane_id, 0), 0);
1000+ intel_de_write_fw(i915, PLANE_CSC_PREOFF(pipe, plane_id, 1), 0);
1001+ intel_de_write_fw(i915, PLANE_CSC_PREOFF(pipe, plane_id, 2), 0);
10321002
1033− intel_de_write_fw(dev_priv, PLANE_CSC_POSTOFF(pipe, plane, 0), postoff);
1034− intel_de_write_fw(dev_priv, PLANE_CSC_POSTOFF(pipe, plane, 1), postoff);
1035− intel_de_write_fw(dev_priv, PLANE_CSC_POSTOFF(pipe, plane, 2), postoff);
1003+ intel_de_write_fw(i915, PLANE_CSC_POSTOFF(pipe, plane_id, 0), 0);
1004+ intel_de_write_fw(i915, PLANE_CSC_POSTOFF(pipe, plane_id, 1), 0);
1005+ intel_de_write_fw(i915, PLANE_CSC_POSTOFF(pipe, plane_id, 2), 0);
10361006 }
10371007
10381008 static void
1039−skl_program_plane(struct intel_plane *plane,
1040− const struct intel_crtc_state *crtc_state,
1041− const struct intel_plane_state *plane_state,
1042− int color_plane)
1009+skl_program_plane_noarm(struct intel_plane *plane,
1010+ const struct intel_crtc_state *crtc_state,
1011+ const struct intel_plane_state *plane_state,
1012+ int color_plane)
10431013 {
10441014 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
10451015 enum plane_id plane_id = plane->id;
10461016 enum pipe pipe = plane->pipe;
1047− const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
1048− u32 surf_addr = skl_surf_address(plane_state, color_plane);
10491017 u32 stride = skl_plane_stride(plane_state, color_plane);
10501018 const struct drm_framebuffer *fb = plane_state->hw.fb;
1051− int aux_plane = skl_main_to_aux_plane(fb, color_plane);
10521019 int crtc_x = plane_state->uapi.dst.x1;
10531020 int crtc_y = plane_state->uapi.dst.y1;
1054− u32 x = plane_state->view.color_plane[color_plane].x;
1055− u32 y = plane_state->view.color_plane[color_plane].y;
10561021 u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
10571022 u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
1058− u8 alpha = plane_state->hw.alpha >> 8;
1059− u32 plane_color_ctl = 0, aux_dist = 0;
10601023 unsigned long irqflags;
1061− u32 keymsk, keymax, plane_surf;
1062− u32 plane_ctl = plane_state->ctl;
1063−
1064− plane_ctl |= skl_plane_ctl_crtc(crtc_state);
1065−
1066− if (DISPLAY_VER(dev_priv) >= 10)
1067− plane_color_ctl = plane_state->color_ctl |
1068− glk_plane_color_ctl_crtc(crtc_state);
10691024
10701025 /* Sizes are 0 based */
10711026 src_w--;
10721027 src_h--;
10731028
1074− keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha);
1075−
1076− keymsk = key->channel_mask & 0x7ffffff;
1077− if (alpha < 0xff)
1078− keymsk |= PLANE_KEYMSK_ALPHA_ENABLE;
1079−
10801029 /* The scaler will handle the output position */
10811030 if (plane_state->scaler_id >= 0) {
10821031 crtc_x = 0;
10831032 crtc_y = 0;
10841033 }
10851034
1086− if (aux_plane) {
1087− aux_dist = skl_surf_address(plane_state, aux_plane) - surf_addr;
1088−
1089− if (DISPLAY_VER(dev_priv) < 12)
1090− aux_dist |= skl_plane_stride(plane_state, aux_plane);
1091− }
1092−
10931035 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
10941036
1037+ /*
1038+ * FIXME: pxp session invalidation can hit any time even at time of commit
1039+ * or after the commit, display content will be garbage.
1040+ */
1041+ if (plane_state->force_black)
1042+ icl_plane_csc_load_black(plane);
1043+
10951044 intel_de_write_fw(dev_priv, PLANE_STRIDE(pipe, plane_id), stride);
10961045 intel_de_write_fw(dev_priv, PLANE_POS(pipe, plane_id),
10971046 (crtc_y << 16) | crtc_x);
10981047 intel_de_write_fw(dev_priv, PLANE_SIZE(pipe, plane_id),
10991048 (src_h << 16) | src_w);
11001049
1101− intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist);
1102−
11031050 if (icl_is_hdr_plane(dev_priv, plane_id))
11041051 intel_de_write_fw(dev_priv, PLANE_CUS_CTL(pipe, plane_id),
11051052 plane_state->cus_ctl);
11061053
1107− if (DISPLAY_VER(dev_priv) >= 10)
1108− intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id),
1109− plane_color_ctl);
1110−
11111054 if (fb->format->is_yuv && icl_is_hdr_plane(dev_priv, plane_id))
11121055 icl_program_input_csc(plane, crtc_state, plane_state);
11131056
1114− if (fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC)
1057+ if (intel_fb_is_rc_ccs_cc_modifier(fb->modifier))
11151058 intel_uncore_write64_fw(&dev_priv->uncore,
11161059 PLANE_CC_VAL(pipe, plane_id), plane_state->ccval);
11171060
11181061 skl_write_plane_wm(plane, crtc_state);
11191062
1063+ intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, color_plane);
1064+
1065+ spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
1066+}
1067+
1068+static void
1069+skl_program_plane_arm(struct intel_plane *plane,
1070+ const struct intel_crtc_state *crtc_state,
1071+ const struct intel_plane_state *plane_state,
1072+ int color_plane)
1073+{
1074+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
1075+ enum plane_id plane_id = plane->id;
1076+ enum pipe pipe = plane->pipe;
1077+ const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
1078+ const struct drm_framebuffer *fb = plane_state->hw.fb;
1079+ int aux_plane = skl_main_to_aux_plane(fb, color_plane);
1080+ u32 x = plane_state->view.color_plane[color_plane].x;
1081+ u32 y = plane_state->view.color_plane[color_plane].y;
1082+ u32 keymsk, keymax, aux_dist = 0, plane_color_ctl = 0;
1083+ u8 alpha = plane_state->hw.alpha >> 8;
1084+ u32 plane_ctl = plane_state->ctl;
1085+ unsigned long irqflags;
1086+
1087+ plane_ctl |= skl_plane_ctl_crtc(crtc_state);
1088+
1089+ if (DISPLAY_VER(dev_priv) >= 10)
1090+ plane_color_ctl = plane_state->color_ctl |
1091+ glk_plane_color_ctl_crtc(crtc_state);
1092+
1093+ keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha);
1094+
1095+ keymsk = key->channel_mask & 0x7ffffff;
1096+ if (alpha < 0xff)
1097+ keymsk |= PLANE_KEYMSK_ALPHA_ENABLE;
1098+
1099+ if (aux_plane) {
1100+ aux_dist = skl_surf_address(plane_state, aux_plane) -
1101+ skl_surf_address(plane_state, color_plane);
1102+
1103+ if (DISPLAY_VER(dev_priv) < 12)
1104+ aux_dist |= skl_plane_stride(plane_state, aux_plane);
1105+ }
1106+
1107+ spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
1108+
11201109 intel_de_write_fw(dev_priv, PLANE_KEYVAL(pipe, plane_id),
11211110 key->min_value);
11221111 intel_de_write_fw(dev_priv, PLANE_KEYMSK(pipe, plane_id), keymsk);
@@ -1125,17 +1114,22 @@ skl_program_plane(struct intel_plane *plane, · 2 unmodified lines
11251114 intel_de_write_fw(dev_priv, PLANE_OFFSET(pipe, plane_id),
11261115 (y << 16) | x);
11271116
1117+ intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist);
1118+
11281119 if (DISPLAY_VER(dev_priv) < 11)
11291120 intel_de_write_fw(dev_priv, PLANE_AUX_OFFSET(pipe, plane_id),
11301121 (plane_state->view.color_plane[1].y << 16) |
11311122 plane_state->view.color_plane[1].x);
11321123
1133− intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, color_plane);
1124+ if (DISPLAY_VER(dev_priv) >= 10)
1125+ intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id), plane_color_ctl);
11341126
11351127 /*
11361128 * Enable the scaler before the plane so that we don't
11371129 * get a catastrophic underrun even if the two operations
11381130 * end up happening in two different frames.
1131+ *
1132+ * TODO: split into noarm+arm pair
11391133 */
11401134 if (plane_state->scaler_id >= 0)
11411135 skl_program_plane_scaler(plane, crtc_state, plane_state);
@@ -1146,23 +1140,8 @@ skl_program_plane(struct intel_plane *plane, · 4 unmodified lines
11461140 * the control register just before the surface register.
11471141 */
11481142 intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl);
1149− plane_surf = intel_plane_ggtt_offset(plane_state) + surf_addr;
1150− plane_color_ctl = intel_de_read_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id));
1151−
1152− /*
1153− * FIXME: pxp session invalidation can hit any time even at time of commit
1154− * or after the commit, display content will be garbage.
1155− */
1156− if (plane_state->decrypt) {
1157− plane_surf |= PLANE_SURF_DECRYPT;
1158− } else if (plane_state->force_black) {
1159− intel_load_plane_csc_black(plane);
1160− plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE;
1161− }
1162−
1163− intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id),
1164− plane_color_ctl);
1165− intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id), plane_surf);
1143+ intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id),
1144+ skl_plane_surf(plane_state, color_plane));
11661145
11671146 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
11681147 }
@@ -1177,7 +1156,6 @@ skl_plane_async_flip(struct intel_plane *plane, · 8 unmodified lines
11771156 unsigned long irqflags;
11781157 enum plane_id plane_id = plane->id;
11791158 enum pipe pipe = plane->pipe;
1180− u32 surf_addr = plane_state->view.color_plane[0].offset;
11811159 u32 plane_ctl = plane_state->ctl;
11821160
11831161 plane_ctl |= skl_plane_ctl_crtc(crtc_state);
@@ -1189,15 +1167,15 @@ skl_plane_async_flip(struct intel_plane *plane, · 5 unmodified lines
11891167
11901168 intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl);
11911169 intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id),
1192− intel_plane_ggtt_offset(plane_state) + surf_addr);
1170+ skl_plane_surf(plane_state, 0));
11931171
11941172 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
11951173 }
11961174
11971175 static void
1198−skl_update_plane(struct intel_plane *plane,
1199− const struct intel_crtc_state *crtc_state,
1200− const struct intel_plane_state *plane_state)
1176+skl_plane_update_noarm(struct intel_plane *plane,
1177+ const struct intel_crtc_state *crtc_state,
1178+ const struct intel_plane_state *plane_state)
12011179 {
12021180 int color_plane = 0;
12031181
@@ -1205,7 +1183,21 @@ skl_update_plane(struct intel_plane *plane, · 1 unmodified line
12051183 /* Program the UV plane on planar master */
12061184 color_plane = 1;
12071185
1208− skl_program_plane(plane, crtc_state, plane_state, color_plane);
1186+ skl_program_plane_noarm(plane, crtc_state, plane_state, color_plane);
1187+}
1188+
1189+static void
1190+skl_plane_update_arm(struct intel_plane *plane,
1191+ const struct intel_crtc_state *crtc_state,
1192+ const struct intel_plane_state *plane_state)
1193+{
1194+ int color_plane = 0;
1195+
1196+ if (plane_state->planar_linked_plane && !plane_state->planar_slave)
1197+ /* Program the UV plane on planar master */
1198+ color_plane = 1;
1199+
1200+ skl_program_plane_arm(plane, crtc_state, plane_state, color_plane);
12091201 }
12101202
12111203 static bool intel_format_is_p01x(u32 format)
@@ -1232,7 +1224,7 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state, · 20 unmodified lines
12321224 return 0;
12331225
12341226 if (rotation & ~(DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180) &&
1235− is_ccs_modifier(fb->modifier)) {
1227+ intel_fb_is_ccs_modifier(fb->modifier)) {
12361228 drm_dbg_kms(&dev_priv->drm,
12371229 "RC support only with 0/180 degree rotation (%x)\n",
12381230 rotation);
@@ -1284,13 +1276,8 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state, · 45 unmodified lines
12841276 /* Y-tiling is not supported in IF-ID Interlace mode */
12851277 if (crtc_state->hw.enable &&
12861278 crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE &&
1287− (fb->modifier == I915_FORMAT_MOD_Y_TILED ||
1288− fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
1289− fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
1290− fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS ||
1291− fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
1292− fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS ||
1293− fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC)) {
1279+ fb->modifier != DRM_FORMAT_MOD_LINEAR &&
1280+ fb->modifier != I915_FORMAT_MOD_X_TILED) {
12941281 drm_dbg_kms(&dev_priv->drm,
12951282 "Y/Yf tiling not supported in IF-ID mode\n");
12961283 return -EINVAL;
@@ -1487,7 +1474,7 @@ int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state, · 190 unmodified lines
14871474 if (fb->modifier == I915_FORMAT_MOD_X_TILED) {
14881475 int cpp = fb->format->cpp[0];
14891476
1490− while ((*x + w) * cpp > plane_state->view.color_plane[0].stride) {
1477+ while ((*x + w) * cpp > plane_state->view.color_plane[0].mapping_stride) {
14911478 if (*offset == 0) {
14921479 drm_dbg_kms(&dev_priv->drm,
14931480 "Unable to find suitable display surface offset due to X-tiling\n");
@@ -1536,7 +1523,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state) · 42 unmodified lines
15361523 * CCS AUX surface doesn't have its own x/y offsets, we must make sure
15371524 * they match with the main surface x/y offsets.
15381525 */
1539− if (is_ccs_modifier(fb->modifier)) {
1526+ if (intel_fb_is_ccs_modifier(fb->modifier)) {
15401527 while (!skl_check_main_ccs_coordinates(plane_state, x, y,
15411528 offset, aux_plane)) {
15421529 if (offset == 0)
@@ -1600,7 +1587,7 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state) · 57 unmodified lines
16001587 offset = intel_plane_compute_aligned_offset(&x, &y,
16011588 plane_state, uv_plane);
16021589
1603− if (is_ccs_modifier(fb->modifier)) {
1590+ if (intel_fb_is_ccs_modifier(fb->modifier)) {
16041591 int ccs_plane = main_to_ccs_plane(fb, uv_plane);
16051592 u32 aux_offset = plane_state->view.color_plane[ccs_plane].offset;
16061593 u32 alignment = intel_surf_alignment(fb, uv_plane);
@@ -1656,8 +1643,7 @@ static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state) · 49 unmodified lines
16561643 int hsub, vsub;
16571644 int x, y;
16581645
1659− if (!is_ccs_plane(fb, ccs_plane) ||
1660− is_gen12_ccs_cc_plane(fb, ccs_plane))
1646+ if (!intel_fb_is_ccs_aux_plane(fb, ccs_plane))
16611647 continue;
16621648
16631649 intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb,
@@ -1699,7 +1685,7 @@ static int skl_check_plane_surface(struct intel_plane_state *plane_state) · 35 unmodified lines
16991685 * Handle the AUX surface first since the main surface setup depends on
17001686 * it.
17011687 */
1702− if (is_ccs_modifier(fb->modifier)) {
1688+ if (intel_fb_is_ccs_modifier(fb->modifier)) {
17031689 ret = skl_check_ccs_aux_surface(plane_state);
17041690 if (ret)
17051691 return ret;
@@ -1737,6 +1723,18 @@ static bool skl_fb_scalable(const struct drm_framebuffer *fb) · 31 unmodified lines
17371723 }
17381724 }
17391725
1726+static bool bo_has_valid_encryption(struct drm_i915_gem_object *obj)
1727+{
1728+ struct drm_i915_private *i915 = to_i915(obj->base.dev);
1729+
1730+ return intel_pxp_key_check(&i915->gt.pxp, obj, false) == 0;
1731+}
1732+
1733+static bool pxp_is_borked(struct drm_i915_gem_object *obj)
1734+{
1735+ return i915_gem_object_is_protected(obj) && !bo_has_valid_encryption(obj);
1736+}
1737+
17401738 static int skl_plane_check(struct intel_crtc_state *crtc_state,
17411739 struct intel_plane_state *plane_state)
17421740 {
@@ -1781,6 +1779,11 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state, · 38 unmodified lines
17811779 if (ret)
17821780 return ret;
17831781
1782+ if (DISPLAY_VER(dev_priv) >= 11) {
1783+ plane_state->decrypt = bo_has_valid_encryption(intel_fb_obj(fb));
1784+ plane_state->force_black = pxp_is_borked(intel_fb_obj(fb));
1785+ }
1786+
17841787 /* HW only has 8 bits pixel precision, disable plane if invisible */
17851788 if (!(plane_state->hw.alpha >> 8))
17861789 plane_state->uapi.visible = false;
@@ -1870,49 +1873,20 @@ static const u32 *icl_get_plane_formats(struct drm_i915_private *dev_priv, · 83 unmodified lines
18701873 }
18711874 }
18721875
1873−static bool skl_plane_has_ccs(struct drm_i915_private *dev_priv,
1874− enum pipe pipe, enum plane_id plane_id)
1875−{
1876− if (plane_id == PLANE_CURSOR)
1877− return false;
1878−
1879− if (DISPLAY_VER(dev_priv) >= 11)
1880− return true;
1881−
1882− if (IS_GEMINILAKE(dev_priv))
1883− return pipe != PIPE_C;
1884−
1885− return pipe != PIPE_C &&
1886− (plane_id == PLANE_PRIMARY ||
1887− plane_id == PLANE_SPRITE0);
1888−}
1889−
18901876 static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
18911877 u32 format, u64 modifier)
18921878 {
18931879 struct intel_plane *plane = to_intel_plane(_plane);
18941880
1895− switch (modifier) {
1896− case DRM_FORMAT_MOD_LINEAR:
1897− case I915_FORMAT_MOD_X_TILED:
1898− case I915_FORMAT_MOD_Y_TILED:
1899− case I915_FORMAT_MOD_Yf_TILED:
1900− break;
1901− case I915_FORMAT_MOD_Y_TILED_CCS:
1902− case I915_FORMAT_MOD_Yf_TILED_CCS:
1903− if (!plane->has_ccs)
1904− return false;
1905− break;
1906− default:
1881+ if (!intel_fb_plane_supports_modifier(plane, modifier))
19071882 return false;
1908− }
19091883
19101884 switch (format) {
19111885 case DRM_FORMAT_XRGB8888:
19121886 case DRM_FORMAT_XBGR8888:
19131887 case DRM_FORMAT_ARGB8888:
19141888 case DRM_FORMAT_ABGR8888:
1915− if (is_ccs_modifier(modifier))
1889+ if (intel_fb_is_ccs_modifier(modifier))
19161890 return true;
19171891 fallthrough;
19181892 case DRM_FORMAT_RGB565:
@@ -1953,52 +1927,20 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane, · 34 unmodified lines
19531927 }
19541928 }
19551929
1956−static bool gen12_plane_supports_mc_ccs(struct drm_i915_private *dev_priv,
1957− enum plane_id plane_id)
1958−{
1959− /* Wa_14010477008:tgl[a0..c0],rkl[all],dg1[all] */
1960− if (IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv) ||
1961− IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_D0))
1962− return false;
1963−
1964− /* Wa_22011186057 */
1965− if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
1966− return false;
1967−
1968− return plane_id < PLANE_SPRITE4;
1969−}
1970−
19711930 static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
19721931 u32 format, u64 modifier)
19731932 {
1974− struct drm_i915_private *dev_priv = to_i915(_plane->dev);
19751933 struct intel_plane *plane = to_intel_plane(_plane);
19761934
1977− switch (modifier) {
1978− case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
1979− if (!gen12_plane_supports_mc_ccs(dev_priv, plane->id))
1980− return false;
1981− fallthrough;
1982− case DRM_FORMAT_MOD_LINEAR:
1983− case I915_FORMAT_MOD_X_TILED:
1984− case I915_FORMAT_MOD_Y_TILED:
1985− break;
1986− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
1987− case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
1988− /* Wa_22011186057 */
1989− if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
1990− return false;
1991− break;
1992− default:
1935+ if (!intel_fb_plane_supports_modifier(plane, modifier))
19931936 return false;
1994− }
19951937
19961938 switch (format) {
19971939 case DRM_FORMAT_XRGB8888:
19981940 case DRM_FORMAT_XBGR8888:
19991941 case DRM_FORMAT_ARGB8888:
20001942 case DRM_FORMAT_ABGR8888:
2001− if (is_ccs_modifier(modifier))
1943+ if (intel_fb_is_ccs_modifier(modifier))
20021944 return true;
20031945 fallthrough;
20041946 case DRM_FORMAT_YUYV:
@@ -2010,7 +1952,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, · 5 unmodified lines
20101952 case DRM_FORMAT_P010:
20111953 case DRM_FORMAT_P012:
20121954 case DRM_FORMAT_P016:
2013− if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS)
1955+ if (intel_fb_is_mc_ccs_modifier(modifier))
20141956 return true;
20151957 fallthrough;
20161958 case DRM_FORMAT_RGB565:
@@ -2039,18 +1981,6 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, · 22 unmodified lines
20391981 }
20401982 }
20411983
2042−static const u64 *gen12_get_plane_modifiers(struct drm_i915_private *dev_priv,
2043− enum plane_id plane_id)
2044−{
2045− /* Wa_22011186057 */
2046− if (IS_ADLP_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
2047− return adlp_step_a_plane_format_modifiers;
2048− else if (gen12_plane_supports_mc_ccs(dev_priv, plane_id))
2049− return gen12_plane_format_modifiers_mc_ccs;
2050− else
2051− return gen12_plane_format_modifiers_rc_ccs;
2052−}
2053−
20541984 static const struct drm_plane_funcs skl_plane_funcs = {
20551985 .update_plane = drm_atomic_helper_update_plane,
20561986 .disable_plane = drm_atomic_helper_disable_plane,
@@ -2091,6 +2021,64 @@ skl_plane_disable_flip_done(struct intel_plane *plane) · 34 unmodified lines
20912021 spin_unlock_irq(&i915->irq_lock);
20922022 }
20932023
2024+static bool skl_plane_has_rc_ccs(struct drm_i915_private *i915,
2025+ enum pipe pipe, enum plane_id plane_id)
2026+{
2027+ /* Wa_22011186057 */
2028+ if (IS_ADLP_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
2029+ return false;
2030+
2031+ if (DISPLAY_VER(i915) >= 11)
2032+ return true;
2033+
2034+ if (IS_GEMINILAKE(i915))
2035+ return pipe != PIPE_C;
2036+
2037+ return pipe != PIPE_C &&
2038+ (plane_id == PLANE_PRIMARY ||
2039+ plane_id == PLANE_SPRITE0);
2040+}
2041+
2042+static bool gen12_plane_has_mc_ccs(struct drm_i915_private *i915,
2043+ enum plane_id plane_id)
2044+{
2045+ if (DISPLAY_VER(i915) < 12)
2046+ return false;
2047+
2048+ /* Wa_14010477008:tgl[a0..c0],rkl[all],dg1[all] */
2049+ if (IS_DG1(i915) || IS_ROCKETLAKE(i915) ||
2050+ IS_TGL_DISPLAY_STEP(i915, STEP_A0, STEP_D0))
2051+ return false;
2052+
2053+ /* Wa_22011186057 */
2054+ if (IS_ADLP_DISPLAY_STEP(i915, STEP_A0, STEP_B0))
2055+ return false;
2056+
2057+ return plane_id < PLANE_SPRITE4;
2058+}
2059+
2060+static u8 skl_get_plane_caps(struct drm_i915_private *i915,
2061+ enum pipe pipe, enum plane_id plane_id)
2062+{
2063+ u8 caps = INTEL_PLANE_CAP_TILING_X;
2064+
2065+ if (DISPLAY_VER(i915) < 13 || IS_ALDERLAKE_P(i915))
2066+ caps |= INTEL_PLANE_CAP_TILING_Y;
2067+ if (DISPLAY_VER(i915) < 12)
2068+ caps |= INTEL_PLANE_CAP_TILING_Yf;
2069+
2070+ if (skl_plane_has_rc_ccs(i915, pipe, plane_id)) {
2071+ caps |= INTEL_PLANE_CAP_CCS_RC;
2072+ if (DISPLAY_VER(i915) >= 12)
2073+ caps |= INTEL_PLANE_CAP_CCS_RC_CC;
2074+ }
2075+
2076+ if (gen12_plane_has_mc_ccs(i915, plane_id))
2077+ caps |= INTEL_PLANE_CAP_CCS_MC;
2078+
2079+ return caps;
2080+}
2081+
20942082 struct intel_plane *
20952083 skl_universal_plane_create(struct drm_i915_private *dev_priv,
20962084 enum pipe pipe, enum plane_id plane_id)
@@ -2113,12 +2101,10 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 16 unmodified lines
21132101 plane->id = plane_id;
21142102 plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane_id);
21152103
2116− plane->has_fbc = skl_plane_has_fbc(dev_priv, pipe, plane_id);
2117− if (plane->has_fbc) {
2118− struct intel_fbc *fbc = &dev_priv->fbc;
2119−
2120− fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
2121− }
2104+ if (skl_plane_has_fbc(dev_priv, pipe, plane_id))
2105+ plane->fbc = &dev_priv->fbc;
2106+ if (plane->fbc)
2107+ plane->fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
21222108
21232109 if (DISPLAY_VER(dev_priv) >= 11) {
21242110 plane->min_width = icl_plane_min_width;
@@ -2136,8 +2122,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 11 unmodified lines
21362122 }
21372123
21382124 plane->max_stride = skl_plane_max_stride;
2139− plane->update_plane = skl_update_plane;
2140− plane->disable_plane = skl_disable_plane;
2125+ plane->update_noarm = skl_plane_update_noarm;
2126+ plane->update_arm = skl_plane_update_arm;
2127+ plane->disable_arm = skl_plane_disable_arm;
21412128 plane->get_hw_state = skl_plane_get_hw_state;
21422129 plane->check_plane = skl_plane_check;
21432130
@@ -2159,29 +2146,28 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 15 unmodified lines
21592146 formats = skl_get_plane_formats(dev_priv, pipe,
21602147 plane_id, &num_formats);
21612148
2162− plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id);
2163− if (DISPLAY_VER(dev_priv) >= 12) {
2164− modifiers = gen12_get_plane_modifiers(dev_priv, plane_id);
2149+ if (DISPLAY_VER(dev_priv) >= 12)
21652150 plane_funcs = &gen12_plane_funcs;
2166− } else {
2167− if (plane->has_ccs)
2168− modifiers = skl_plane_format_modifiers_ccs;
2169− else
2170− modifiers = skl_plane_format_modifiers_noccs;
2151+ else
21712152 plane_funcs = &skl_plane_funcs;
2172− }
21732153
21742154 if (plane_id == PLANE_PRIMARY)
21752155 plane_type = DRM_PLANE_TYPE_PRIMARY;
21762156 else
21772157 plane_type = DRM_PLANE_TYPE_OVERLAY;
21782158
2159+ modifiers = intel_fb_plane_get_modifiers(dev_priv,
2160+ skl_get_plane_caps(dev_priv, pipe, plane_id));
2161+
21792162 ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
21802163 0, plane_funcs,
21812164 formats, num_formats, modifiers,
21822165 plane_type,
21832166 "plane %d%c", plane_id + 1,
21842167 pipe_name(pipe));
2168+
2169+ kfree(modifiers);
2170+
21852171 if (ret)
21862172 goto fail;
21872173
drivers/gpu/drm/i915/display/vlv_dsi.c+8−0
@@ -38,9 +38,12 @@ · 37 unmodified lines
3838 #include "intel_de.h"
3939 #include "intel_display_types.h"
4040 #include "intel_dsi.h"
41+#include "intel_dsi_vbt.h"
4142 #include "intel_fifo_underrun.h"
4243 #include "intel_panel.h"
4344 #include "skl_scaler.h"
45+#include "vlv_dsi.h"
46+#include "vlv_dsi_pll.h"
4447 #include "vlv_sideband.h"
4548
4649 /* return pixels in terms of txbyteclkhs */
@@ -1258,7 +1261,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder, · 1211 unmodified lines
12581261 struct intel_crtc_state *pipe_config)
12591262 {
12601263 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
1264+ struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
12611265 u32 pclk;
1266+
12621267 drm_dbg_kms(&dev_priv->drm, "\n");
12631268
12641269 pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
@@ -1270,6 +1275,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder, · 5 unmodified lines
12701275 pclk = vlv_dsi_get_pclk(encoder, pipe_config);
12711276 }
12721277
1278+ if (intel_dsi->dual_link)
1279+ pclk *= 2;
1280+
12731281 if (pclk) {
12741282 pipe_config->hw.adjusted_mode.crtc_clock = pclk;
12751283 pipe_config->port_clock = pclk;
drivers/gpu/drm/i915/display/vlv_dsi.h+19−0
@@ -0,0 +1,19 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef __VLV_DSI_H__
7+#define __VLV_DSI_H__
8+
9+#include <linux/types.h>
10+
11+enum port;
12+struct drm_i915_private;
13+struct intel_dsi;
14+
15+void vlv_dsi_wait_for_fifo_empty(struct intel_dsi *intel_dsi, enum port port);
16+enum mipi_dsi_pixel_format pixel_format_from_register_bits(u32 fmt);
17+void vlv_dsi_init(struct drm_i915_private *dev_priv);
18+
19+#endif /* __VLV_DSI_H__ */
drivers/gpu/drm/i915/display/vlv_dsi_pll.c+1−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include "intel_de.h"
3232 #include "intel_display_types.h"
3333 #include "intel_dsi.h"
34+#include "vlv_dsi_pll.h"
3435 #include "vlv_sideband.h"
3536
3637 static const u16 lfsr_converts[] = {
drivers/gpu/drm/i915/display/vlv_dsi_pll.h+38−0
@@ -0,0 +1,38 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef __VLV_DSI_PLL_H__
7+#define __VLV_DSI_PLL_H__
8+
9+#include <linux/types.h>
10+
11+enum port;
12+struct drm_i915_private;
13+struct intel_crtc_state;
14+struct intel_encoder;
15+
16+int vlv_dsi_pll_compute(struct intel_encoder *encoder,
17+ struct intel_crtc_state *config);
18+void vlv_dsi_pll_enable(struct intel_encoder *encoder,
19+ const struct intel_crtc_state *config);
20+void vlv_dsi_pll_disable(struct intel_encoder *encoder);
21+u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
22+ struct intel_crtc_state *config);
23+void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
24+
25+bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv);
26+int bxt_dsi_pll_compute(struct intel_encoder *encoder,
27+ struct intel_crtc_state *config);
28+void bxt_dsi_pll_enable(struct intel_encoder *encoder,
29+ const struct intel_crtc_state *config);
30+void bxt_dsi_pll_disable(struct intel_encoder *encoder);
31+u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
32+ struct intel_crtc_state *config);
33+void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
34+
35+void assert_dsi_pll_enabled(struct drm_i915_private *i915);
36+void assert_dsi_pll_disabled(struct drm_i915_private *i915);
37+
38+#endif /* __VLV_DSI_PLL_H__ */
drivers/gpu/drm/i915/gem/i915_gem_context.c+1−1
@@ -479,7 +479,7 @@ set_proto_ctx_engines_bond(struct i915_user_extension __user *base, void *data) · 478 unmodified lines
479479 if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915) &&
480480 !IS_ROCKETLAKE(i915) && !IS_ALDERLAKE_S(i915)) {
481481 drm_dbg(&i915->drm,
482− "Bonding on gen12+ aside from TGL, RKL, and ADL_S not supported\n");
482+ "Bonding not supported on this platform\n");
483483 return -ENODEV;
484484 }
485485
drivers/gpu/drm/i915/gt/intel_ggtt.c+180−86
@@ -3,12 +3,14 @@ · 2 unmodified lines
33 * Copyright © 2020 Intel Corporation
44 */
55
6+#include <linux/agp_backend.h>
67 #include <linux/stop_machine.h>
78
89 #include <asm/set_memory.h>
910 #include <asm/smp.h>
1011
1112 #include <drm/i915_drm.h>
13+#include <drm/intel-gtt.h>
1214
1315 #include "gem/i915_gem_lmem.h"
1416
@@ -116,17 +118,26 @@ static bool needs_idle_maps(struct drm_i915_private *i915) · 101 unmodified lines
116118 return false;
117119 }
118120
119−void i915_ggtt_suspend(struct i915_ggtt *ggtt)
121+/**
122+ * i915_ggtt_suspend_vm - Suspend the memory mappings for a GGTT or DPT VM
123+ * @vm: The VM to suspend the mappings for
124+ *
125+ * Suspend the memory mappings for all objects mapped to HW via the GGTT or a
126+ * DPT page table.
127+ */
128+void i915_ggtt_suspend_vm(struct i915_address_space *vm)
120129 {
121130 struct i915_vma *vma, *vn;
122131 int open;
123132
124− mutex_lock(&ggtt->vm.mutex);
133+ drm_WARN_ON(&vm->i915->drm, !vm->is_ggtt && !vm->is_dpt);
134+
135+ mutex_lock(&vm->mutex);
125136
126137 /* Skip rewriting PTE on VMA unbind. */
127− open = atomic_xchg(&ggtt->vm.open, 0);
138+ open = atomic_xchg(&vm->open, 0);
128139
129− list_for_each_entry_safe(vma, vn, &ggtt->vm.bound_list, vm_link) {
140+ list_for_each_entry_safe(vma, vn, &vm->bound_list, vm_link) {
130141 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node));
131142 i915_vma_wait_for_bind(vma);
132143
@@ -139,11 +150,17 @@ void i915_ggtt_suspend(struct i915_ggtt *ggtt) · 6 unmodified lines
139150 }
140151 }
141152
142− ggtt->vm.clear_range(&ggtt->vm, 0, ggtt->vm.total);
143− ggtt->invalidate(ggtt);
144− atomic_set(&ggtt->vm.open, open);
153+ vm->clear_range(vm, 0, vm->total);
145154
146− mutex_unlock(&ggtt->vm.mutex);
155+ atomic_set(&vm->open, open);
156+
157+ mutex_unlock(&vm->mutex);
158+}
159+
160+void i915_ggtt_suspend(struct i915_ggtt *ggtt)
161+{
162+ i915_ggtt_suspend_vm(&ggtt->vm);
163+ ggtt->invalidate(ggtt);
147164
148165 intel_gt_check_and_clear_faults(ggtt->vm.gt);
149166 }
@@ -1253,37 +1270,59 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt) · 1103 unmodified lines
12531270 ggtt->invalidate(ggtt);
12541271 }
12551272
1256−void i915_ggtt_resume(struct i915_ggtt *ggtt)
1273+/**
1274+ * i915_ggtt_resume_vm - Restore the memory mappings for a GGTT or DPT VM
1275+ * @vm: The VM to restore the mappings for
1276+ *
1277+ * Restore the memory mappings for all objects mapped to HW via the GGTT or a
1278+ * DPT page table.
1279+ *
1280+ * Returns %true if restoring the mapping for any object that was in a write
1281+ * domain before suspend.
1282+ */
1283+bool i915_ggtt_resume_vm(struct i915_address_space *vm)
12571284 {
12581285 struct i915_vma *vma;
1259− bool flush = false;
1286+ bool write_domain_objs = false;
12601287 int open;
12611288
1262− intel_gt_check_and_clear_faults(ggtt->vm.gt);
1289+ drm_WARN_ON(&vm->i915->drm, !vm->is_ggtt && !vm->is_dpt);
12631290
12641291 /* First fill our portion of the GTT with scratch pages */
1265− ggtt->vm.clear_range(&ggtt->vm, 0, ggtt->vm.total);
1292+ vm->clear_range(vm, 0, vm->total);
12661293
12671294 /* Skip rewriting PTE on VMA unbind. */
1268− open = atomic_xchg(&ggtt->vm.open, 0);
1295+ open = atomic_xchg(&vm->open, 0);
12691296
12701297 /* clflush objects bound into the GGTT and rebind them. */
1271− list_for_each_entry(vma, &ggtt->vm.bound_list, vm_link) {
1298+ list_for_each_entry(vma, &vm->bound_list, vm_link) {
12721299 struct drm_i915_gem_object *obj = vma->obj;
12731300 unsigned int was_bound =
12741301 atomic_read(&vma->flags) & I915_VMA_BIND_MASK;
12751302
12761303 GEM_BUG_ON(!was_bound);
1277− vma->ops->bind_vma(&ggtt->vm, NULL, vma,
1304+ vma->ops->bind_vma(vm, NULL, vma,
12781305 obj ? obj->cache_level : 0,
12791306 was_bound);
12801307 if (obj) { /* only used during resume => exclusive access */
1281− flush |= fetch_and_zero(&obj->write_domain);
1308+ write_domain_objs |= fetch_and_zero(&obj->write_domain);
12821309 obj->read_domains |= I915_GEM_DOMAIN_GTT;
12831310 }
12841311 }
12851312
1286− atomic_set(&ggtt->vm.open, open);
1313+ atomic_set(&vm->open, open);
1314+
1315+ return write_domain_objs;
1316+}
1317+
1318+void i915_ggtt_resume(struct i915_ggtt *ggtt)
1319+{
1320+ bool flush;
1321+
1322+ intel_gt_check_and_clear_faults(ggtt->vm.gt);
1323+
1324+ flush = i915_ggtt_resume_vm(&ggtt->vm);
1325+
12871326 ggtt->invalidate(ggtt);
12881327
12891328 if (flush)
@@ -1388,30 +1427,39 @@ err_st_alloc: · 98 unmodified lines
13881427 }
13891428
13901429 static struct scatterlist *
1391−remap_pages(struct drm_i915_gem_object *obj,
1392− unsigned int offset, unsigned int alignment_pad,
1393− unsigned int width, unsigned int height,
1394− unsigned int src_stride, unsigned int dst_stride,
1395− struct sg_table *st, struct scatterlist *sg)
1430+add_padding_pages(unsigned int count,
1431+ struct sg_table *st, struct scatterlist *sg)
1432+{
1433+ st->nents++;
1434+
1435+ /*
1436+ * The DE ignores the PTEs for the padding tiles, the sg entry
1437+ * here is just a convenience to indicate how many padding PTEs
1438+ * to insert at this spot.
1439+ */
1440+ sg_set_page(sg, NULL, count * I915_GTT_PAGE_SIZE, 0);
1441+ sg_dma_address(sg) = 0;
1442+ sg_dma_len(sg) = count * I915_GTT_PAGE_SIZE;
1443+ sg = sg_next(sg);
1444+
1445+ return sg;
1446+}
1447+
1448+static struct scatterlist *
1449+remap_tiled_color_plane_pages(struct drm_i915_gem_object *obj,
1450+ unsigned int offset, unsigned int alignment_pad,
1451+ unsigned int width, unsigned int height,
1452+ unsigned int src_stride, unsigned int dst_stride,
1453+ struct sg_table *st, struct scatterlist *sg,
1454+ unsigned int *gtt_offset)
13961455 {
13971456 unsigned int row;
13981457
13991458 if (!width || !height)
14001459 return sg;
14011460
1402− if (alignment_pad) {
1403− st->nents++;
1404−
1405− /*
1406− * The DE ignores the PTEs for the padding tiles, the sg entry
1407− * here is just a convenience to indicate how many padding PTEs
1408− * to insert at this spot.
1409− */
1410− sg_set_page(sg, NULL, alignment_pad * 4096, 0);
1411− sg_dma_address(sg) = 0;
1412− sg_dma_len(sg) = alignment_pad * 4096;
1413− sg = sg_next(sg);
1414− }
1461+ if (alignment_pad)
1462+ sg = add_padding_pages(alignment_pad, st, sg);
14151463
14161464 for (row = 0; row < height; row++) {
14171465 unsigned int left = width * I915_GTT_PAGE_SIZE;
@@ -1448,18 +1496,98 @@ remap_pages(struct drm_i915_gem_object *obj, · 30 unmodified lines
14481496 if (!left)
14491497 continue;
14501498
1499+ sg = add_padding_pages(left >> PAGE_SHIFT, st, sg);
1500+ }
1501+
1502+ *gtt_offset += alignment_pad + dst_stride * height;
1503+
1504+ return sg;
1505+}
1506+
1507+static struct scatterlist *
1508+remap_contiguous_pages(struct drm_i915_gem_object *obj,
1509+ unsigned int obj_offset,
1510+ unsigned int count,
1511+ struct sg_table *st, struct scatterlist *sg)
1512+{
1513+ struct scatterlist *iter;
1514+ unsigned int offset;
1515+
1516+ iter = i915_gem_object_get_sg_dma(obj, obj_offset, &offset);
1517+ GEM_BUG_ON(!iter);
1518+
1519+ do {
1520+ unsigned int len;
1521+
1522+ len = min(sg_dma_len(iter) - (offset << PAGE_SHIFT),
1523+ count << PAGE_SHIFT);
1524+ sg_set_page(sg, NULL, len, 0);
1525+ sg_dma_address(sg) =
1526+ sg_dma_address(iter) + (offset << PAGE_SHIFT);
1527+ sg_dma_len(sg) = len;
1528+
14511529 st->nents++;
1530+ count -= len >> PAGE_SHIFT;
1531+ if (count == 0)
1532+ return sg;
14521533
1453− /*
1454− * The DE ignores the PTEs for the padding tiles, the sg entry
1455− * here is just a conenience to indicate how many padding PTEs
1456− * to insert at this spot.
1457− */
1458− sg_set_page(sg, NULL, left, 0);
1459− sg_dma_address(sg) = 0;
1460− sg_dma_len(sg) = left;
1461− sg = sg_next(sg);
1462− }
1534+ sg = __sg_next(sg);
1535+ iter = __sg_next(iter);
1536+ offset = 0;
1537+ } while (1);
1538+}
1539+
1540+static struct scatterlist *
1541+remap_linear_color_plane_pages(struct drm_i915_gem_object *obj,
1542+ unsigned int obj_offset, unsigned int alignment_pad,
1543+ unsigned int size,
1544+ struct sg_table *st, struct scatterlist *sg,
1545+ unsigned int *gtt_offset)
1546+{
1547+ if (!size)
1548+ return sg;
1549+
1550+ if (alignment_pad)
1551+ sg = add_padding_pages(alignment_pad, st, sg);
1552+
1553+ sg = remap_contiguous_pages(obj, obj_offset, size, st, sg);
1554+ sg = sg_next(sg);
1555+
1556+ *gtt_offset += alignment_pad + size;
1557+
1558+ return sg;
1559+}
1560+
1561+static struct scatterlist *
1562+remap_color_plane_pages(const struct intel_remapped_info *rem_info,
1563+ struct drm_i915_gem_object *obj,
1564+ int color_plane,
1565+ struct sg_table *st, struct scatterlist *sg,
1566+ unsigned int *gtt_offset)
1567+{
1568+ unsigned int alignment_pad = 0;
1569+
1570+ if (rem_info->plane_alignment)
1571+ alignment_pad = ALIGN(*gtt_offset, rem_info->plane_alignment) - *gtt_offset;
1572+
1573+ if (rem_info->plane[color_plane].linear)
1574+ sg = remap_linear_color_plane_pages(obj,
1575+ rem_info->plane[color_plane].offset,
1576+ alignment_pad,
1577+ rem_info->plane[color_plane].size,
1578+ st, sg,
1579+ gtt_offset);
1580+
1581+ else
1582+ sg = remap_tiled_color_plane_pages(obj,
1583+ rem_info->plane[color_plane].offset,
1584+ alignment_pad,
1585+ rem_info->plane[color_plane].width,
1586+ rem_info->plane[color_plane].height,
1587+ rem_info->plane[color_plane].src_stride,
1588+ rem_info->plane[color_plane].dst_stride,
1589+ st, sg,
1590+ gtt_offset);
14631591
14641592 return sg;
14651593 }
@@ -1488,21 +1616,8 @@ intel_remap_pages(struct intel_remapped_info *rem_info, · 22 unmodified lines
14881616 st->nents = 0;
14891617 sg = st->sgl;
14901618
1491− for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) {
1492− unsigned int alignment_pad = 0;
1493−
1494− if (rem_info->plane_alignment)
1495− alignment_pad = ALIGN(gtt_offset, rem_info->plane_alignment) - gtt_offset;
1496−
1497− sg = remap_pages(obj,
1498− rem_info->plane[i].offset, alignment_pad,
1499− rem_info->plane[i].width, rem_info->plane[i].height,
1500− rem_info->plane[i].src_stride, rem_info->plane[i].dst_stride,
1501− st, sg);
1502−
1503− gtt_offset += alignment_pad +
1504− rem_info->plane[i].dst_stride * rem_info->plane[i].height;
1505− }
1619+ for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++)
1620+ sg = remap_color_plane_pages(rem_info, obj, i, st, sg, &gtt_offset);
15061621
15071622 i915_sg_trim(st);
15081623
@@ -1524,9 +1639,8 @@ intel_partial_pages(const struct i915_ggtt_view *view, · 15 unmodified lines
15241639 struct drm_i915_gem_object *obj)
15251640 {
15261641 struct sg_table *st;
1527− struct scatterlist *sg, *iter;
1642+ struct scatterlist *sg;
15281643 unsigned int count = view->partial.size;
1529− unsigned int offset;
15301644 int ret = -ENOMEM;
15311645
15321646 st = kmalloc(sizeof(*st), GFP_KERNEL);
@@ -1537,34 +1651,14 @@ intel_partial_pages(const struct i915_ggtt_view *view, · 4 unmodified lines
15371651 if (ret)
15381652 goto err_sg_alloc;
15391653
1540− iter = i915_gem_object_get_sg_dma(obj, view->partial.offset, &offset);
1541− GEM_BUG_ON(!iter);
1542−
1543− sg = st->sgl;
15441654 st->nents = 0;
1545− do {
1546− unsigned int len;
15471655
1548− len = min(sg_dma_len(iter) - (offset << PAGE_SHIFT),
1549− count << PAGE_SHIFT);
1550− sg_set_page(sg, NULL, len, 0);
1551− sg_dma_address(sg) =
1552− sg_dma_address(iter) + (offset << PAGE_SHIFT);
1553− sg_dma_len(sg) = len;
1656+ sg = remap_contiguous_pages(obj, view->partial.offset, count, st, st->sgl);
15541657
1555− st->nents++;
1556− count -= len >> PAGE_SHIFT;
1557− if (count == 0) {
1558− sg_mark_end(sg);
1559− i915_sg_trim(st); /* Drop any unused tail entries. */
1658+ sg_mark_end(sg);
1659+ i915_sg_trim(st); /* Drop any unused tail entries. */
15601660
1561− return st;
1562− }
1563−
1564− sg = __sg_next(sg);
1565− iter = __sg_next(iter);
1566− offset = 0;
1567− } while (1);
1661+ return st;
15681662
15691663 err_sg_alloc:
15701664 kfree(st);
drivers/gpu/drm/i915/gt/intel_gt.c+2−0
@@ -3,6 +3,8 @@ · 2 unmodified lines
33 * Copyright © 2019 Intel Corporation
44 */
55
6+#include <drm/intel-gtt.h>
7+
68 #include "intel_gt_debugfs.h"
79
810 #include "gem/i915_gem_lmem.h"
drivers/gpu/drm/i915/gt/intel_gtt.h+2−0
@@ -544,6 +544,8 @@ int i915_ppgtt_init_hw(struct intel_gt *gt); · 543 unmodified lines
544544 struct i915_ppgtt *i915_ppgtt_create(struct intel_gt *gt,
545545 unsigned long lmem_pt_obj_flags);
546546
547+void i915_ggtt_suspend_vm(struct i915_address_space *vm);
548+bool i915_ggtt_resume_vm(struct i915_address_space *vm);
547549 void i915_ggtt_suspend(struct i915_ggtt *gtt);
548550 void i915_ggtt_resume(struct i915_ggtt *ggtt);
549551
drivers/gpu/drm/i915/i915_driver.crenamed from drivers/gpu/drm/i915/i915_drv.c+35−8
@@ -29,8 +29,8 @@ · 28 unmodified lines
2929
3030 #include <linux/acpi.h>
3131 #include <linux/device.h>
32−#include <linux/oom.h>
3332 #include <linux/module.h>
33+#include <linux/oom.h>
3434 #include <linux/pci.h>
3535 #include <linux/pm.h>
3636 #include <linux/pm_runtime.h>
@@ -48,12 +48,14 @@ · 11 unmodified lines
4848 #include "display/intel_acpi.h"
4949 #include "display/intel_bw.h"
5050 #include "display/intel_cdclk.h"
51−#include "display/intel_dmc.h"
5251 #include "display/intel_display_types.h"
52+#include "display/intel_dmc.h"
5353 #include "display/intel_dp.h"
54+#include "display/intel_dpt.h"
5455 #include "display/intel_fbdev.h"
5556 #include "display/intel_hotplug.h"
5657 #include "display/intel_overlay.h"
58+#include "display/intel_pch_refclk.h"
5759 #include "display/intel_pipe_crc.h"
5860 #include "display/intel_pps.h"
5961 #include "display/intel_sprite.h"
@@ -70,6 +72,7 @@ · 10 unmodified lines
7072 #include "pxp/intel_pxp_pm.h"
7173
7274 #include "i915_debugfs.h"
75+#include "i915_driver.h"
7376 #include "i915_drv.h"
7477 #include "i915_ioc32.h"
7578 #include "i915_irq.h"
@@ -89,7 +92,7 @@ · 13 unmodified lines
8992 #include "intel_region_ttm.h"
9093 #include "vlv_suspend.h"
9194
92−static const struct drm_driver driver;
95+static const struct drm_driver i915_drm_driver;
9396
9497 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
9598 {
@@ -322,7 +325,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv) · 226 unmodified lines
322325 mutex_init(&dev_priv->sb_lock);
323326 cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE);
324327
325− mutex_init(&dev_priv->av_mutex);
328+ mutex_init(&dev_priv->audio.mutex);
326329 mutex_init(&dev_priv->wm.wm_mutex);
327330 mutex_init(&dev_priv->pps_mutex);
328331 mutex_init(&dev_priv->hdcp_comp_mutex);
@@ -766,7 +769,7 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent) · 437 unmodified lines
766769 struct intel_device_info *device_info;
767770 struct drm_i915_private *i915;
768771
769− i915 = devm_drm_dev_alloc(&pdev->dev, &driver,
772+ i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver,
770773 struct drm_i915_private, drm);
771774 if (IS_ERR(i915))
772775 return i915;
@@ -1127,6 +1130,8 @@ static int i915_drm_suspend(struct drm_device *dev) · 354 unmodified lines
11271130
11281131 intel_suspend_hw(dev_priv);
11291132
1133+ /* Must be called before GGTT is suspended. */
1134+ intel_dpt_suspend(dev_priv);
11301135 i915_ggtt_suspend(&dev_priv->ggtt);
11311136
11321137 i915_save_display(dev_priv);
@@ -1183,6 +1188,14 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation) · 50 unmodified lines
11831188 goto out;
11841189 }
11851190
1191+ /*
1192+ * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
1193+ * This should be totally removed when we handle the pci states properly
1194+ * on runtime PM and on s2idle cases.
1195+ */
1196+ if (suspend_to_idle(dev_priv))
1197+ pci_d3cold_disable(pdev);
1198+
11861199 pci_disable_device(pdev);
11871200 /*
11881201 * During hibernation on some platforms the BIOS may try to access
@@ -1207,7 +1220,8 @@ out: · 18 unmodified lines
12071220 return ret;
12081221 }
12091222
1210−int i915_suspend_switcheroo(struct drm_i915_private *i915, pm_message_t state)
1223+int i915_driver_suspend_switcheroo(struct drm_i915_private *i915,
1224+ pm_message_t state)
12111225 {
12121226 int error;
12131227
@@ -1243,6 +1257,8 @@ static int i915_drm_resume(struct drm_device *dev) · 29 unmodified lines
12431257 drm_err(&dev_priv->drm, "failed to re-enable GGTT\n");
12441258
12451259 i915_ggtt_resume(&dev_priv->ggtt);
1260+ /* Must be called after GGTT is resumed. */
1261+ intel_dpt_resume(dev_priv);
12461262
12471263 intel_dmc_ucode_resume(dev_priv);
12481264
@@ -1344,6 +1360,8 @@ static int i915_drm_resume_early(struct drm_device *dev) · 95 unmodified lines
13441360
13451361 pci_set_master(pdev);
13461362
1363+ pci_d3cold_enable(pdev);
1364+
13471365 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
13481366
13491367 ret = vlv_resume_prepare(dev_priv, false);
@@ -1364,7 +1382,7 @@ static int i915_drm_resume_early(struct drm_device *dev) · 14 unmodified lines
13641382 return ret;
13651383 }
13661384
1367−int i915_resume_switcheroo(struct drm_i915_private *i915)
1385+int i915_driver_resume_switcheroo(struct drm_i915_private *i915)
13681386 {
13691387 int ret;
13701388
@@ -1520,6 +1538,7 @@ static int intel_runtime_suspend(struct device *kdev) · 149 unmodified lines
15201538 {
15211539 struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
15221540 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
1541+ struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
15231542 int ret;
15241543
15251544 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
@@ -1565,6 +1584,12 @@ static int intel_runtime_suspend(struct device *kdev) · 39 unmodified lines
15651584 drm_err(&dev_priv->drm,
15661585 "Unclaimed access detected prior to suspending\n");
15671586
1587+ /*
1588+ * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
1589+ * This should be totally removed when we handle the pci states properly
1590+ * on runtime PM and on s2idle cases.
1591+ */
1592+ pci_d3cold_disable(pdev);
15681593 rpm->suspended = true;
15691594
15701595 /*
@@ -1603,6 +1628,7 @@ static int intel_runtime_resume(struct device *kdev) · 32 unmodified lines
16031628 {
16041629 struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
16051630 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
1631+ struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
16061632 int ret;
16071633
16081634 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv)))
@@ -1615,6 +1641,7 @@ static int intel_runtime_resume(struct device *kdev) · 6 unmodified lines
16151641
16161642 intel_opregion_notify_adapter(dev_priv, PCI_D0);
16171643 rpm->suspended = false;
1644+ pci_d3cold_enable(pdev);
16181645 if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
16191646 drm_dbg(&dev_priv->drm,
16201647 "Unclaimed access during suspend, bios?\n");
@@ -1777,7 +1804,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = { · 156 unmodified lines
17771804 DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW),
17781805 };
17791806
1780−static const struct drm_driver driver = {
1807+static const struct drm_driver i915_drm_driver = {
17811808 /* Don't use MTRRs here; the Xserver or userspace app should
17821809 * deal with them for Intel hardware.
17831810 */
drivers/gpu/drm/i915/i915_driver.h+24−0
@@ -0,0 +1,24 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2019 Intel Corporation
4+ */
5+
6+#ifndef __I915_DRIVER_H__
7+#define __I915_DRIVER_H__
8+
9+#include <linux/pm.h>
10+
11+struct pci_dev;
12+struct pci_device_id;
13+struct drm_i915_private;
14+
15+extern const struct dev_pm_ops i915_pm_ops;
16+
17+int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
18+void i915_driver_remove(struct drm_i915_private *i915);
19+void i915_driver_shutdown(struct drm_i915_private *i915);
20+
21+int i915_driver_resume_switcheroo(struct drm_i915_private *i915);
22+int i915_driver_suspend_switcheroo(struct drm_i915_private *i915, pm_message_t state);
23+
24+#endif /* __I915_DRIVER_H__ */
drivers/gpu/drm/i915/i915_drv.h+31−44
@@ -50,7 +50,6 @@ · 49 unmodified lines
5050 #include <linux/stackdepot.h>
5151 #include <linux/xarray.h>
5252
53−#include <drm/intel-gtt.h>
5453 #include <drm/drm_gem.h>
5554 #include <drm/drm_auth.h>
5655 #include <drm/drm_cache.h>
@@ -364,15 +363,6 @@ struct intel_color_funcs { · 307 unmodified lines
364363 void (*read_luts)(struct intel_crtc_state *crtc_state);
365364 };
366365
367−struct intel_audio_funcs {
368− void (*audio_codec_enable)(struct intel_encoder *encoder,
369− const struct intel_crtc_state *crtc_state,
370− const struct drm_connector_state *conn_state);
371− void (*audio_codec_disable)(struct intel_encoder *encoder,
372− const struct intel_crtc_state *old_crtc_state,
373− const struct drm_connector_state *old_conn_state);
374−};
375−
376366 struct intel_cdclk_funcs {
377367 void (*get_cdclk)(struct drm_i915_private *dev_priv,
378368 struct intel_cdclk_config *cdclk_config);
@@ -411,10 +401,14 @@ struct drm_i915_display_funcs { · 32 unmodified lines
411401 void (*commit_modeset_enables)(struct intel_atomic_state *state);
412402 };
413403
404+struct intel_fbc_funcs;
414405
415406 #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */
416407
417408 struct intel_fbc {
409+ struct drm_i915_private *i915;
410+ const struct intel_fbc_funcs *funcs;
411+
418412 /* This is always the inner lock when overlapping with struct_mutex and
419413 * it's the outer lock when overlapping with stolen_lock. */
420414 struct mutex lock;
@@ -828,6 +822,30 @@ struct i915_selftest_stash { · 407 unmodified lines
828822 struct ida mock_region_instances;
829823 };
830824
825+/* intel_audio.c private */
826+struct intel_audio_funcs;
827+struct intel_audio_private {
828+ /* Display internal audio functions */
829+ const struct intel_audio_funcs *funcs;
830+
831+ /* hda/i915 audio component */
832+ struct i915_audio_component *component;
833+ bool component_registered;
834+ /* mutex for audio/video sync */
835+ struct mutex mutex;
836+ int power_refcount;
837+ u32 freq_cntrl;
838+
839+ /* Used to save the pipe-to-encoder mapping for audio */
840+ struct intel_encoder *encoder_map[I915_MAX_PIPES];
841+
842+ /* necessary resource sharing with HDMI LPE audio driver. */
843+ struct {
844+ struct platform_device *platdev;
845+ int irq;
846+ } lpe;
847+};
848+
831849 struct drm_i915_private {
832850 struct drm_device drm;
833851
@@ -995,9 +1013,6 @@ struct drm_i915_private { · 161 unmodified lines
9951013 /* Display internal color functions */
9961014 const struct intel_color_funcs *color_funcs;
9971015
998− /* Display internal audio functions */
999− const struct intel_audio_funcs *audio_funcs;
1000−
10011016 /* Display CDCLK functions */
10021017 const struct intel_cdclk_funcs *cdclk_funcs;
10031018
@@ -1084,17 +1099,6 @@ struct drm_i915_private { · 80 unmodified lines
10841099 struct drm_property *broadcast_rgb_property;
10851100 struct drm_property *force_audio_property;
10861101
1087− /* hda/i915 audio component */
1088− struct i915_audio_component *audio_component;
1089− bool audio_component_registered;
1090− /**
1091− * av_mutex - mutex for audio/video sync
1092− *
1093− */
1094− struct mutex av_mutex;
1095− int audio_power_refcount;
1096− u32 audio_freq_cntrl;
1097−
10981102 u32 fdi_rx_config;
10991103
11001104 /* Shadow for DISPLAY_PHY_CONTROL which can't be safely read */
@@ -1227,14 +1231,7 @@ struct drm_i915_private { · 126 unmodified lines
12271231
12281232 bool ipc_enabled;
12291233
1230− /* Used to save the pipe-to-encoder mapping for audio */
1231− struct intel_encoder *av_enc_map[I915_MAX_PIPES];
1232−
1233− /* necessary resource sharing with HDMI LPE audio driver. */
1234− struct {
1235− struct platform_device *platdev;
1236− int irq;
1237− } lpe_audio;
1234+ struct intel_audio_private audio;
12381235
12391236 struct i915_pmu pmu;
12401237
@@ -1455,7 +1452,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 214 unmodified lines
14551452 #define IS_GEMINILAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_GEMINILAKE)
14561453 #define IS_COFFEELAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_COFFEELAKE)
14571454 #define IS_COMETLAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_COMETLAKE)
1458−#define IS_CANNONLAKE(dev_priv) 0
14591455 #define IS_ICELAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_ICELAKE)
14601456 #define IS_JSL_EHL(dev_priv) (IS_PLATFORM(dev_priv, INTEL_JASPERLAKE) || \
14611457 IS_PLATFORM(dev_priv, INTEL_ELKHARTLAKE))
@@ -1745,7 +1741,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 283 unmodified lines
17451741
17461742 #define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->pipe_mask != 0)
17471743
1748−#define HAS_VRR(i915) (GRAPHICS_VER(i915) >= 12)
1744+#define HAS_VRR(i915) (GRAPHICS_VER(i915) >= 11)
17491745
17501746 #define HAS_ASYNC_FLIPS(i915) (DISPLAY_VER(i915) >= 5)
17511747
@@ -1789,16 +1785,7 @@ intel_vm_no_concurrent_access_wa(struct drm_i915_private *i915) · 37 unmodified lines
17891785 return IS_CHERRYVIEW(i915) || intel_ggtt_update_needs_vtd_wa(i915);
17901786 }
17911787
1792−/* i915_drv.c */
1793−extern const struct dev_pm_ops i915_pm_ops;
1794−
1795−int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
1796−void i915_driver_remove(struct drm_i915_private *i915);
1797−void i915_driver_shutdown(struct drm_i915_private *i915);
1798−
1799−int i915_resume_switcheroo(struct drm_i915_private *i915);
1800−int i915_suspend_switcheroo(struct drm_i915_private *i915, pm_message_t state);
1801−
1788+/* i915_getparam.c */
18021789 int i915_getparam_ioctl(struct drm_device *dev, void *data,
18031790 struct drm_file *file_priv);
18041791
drivers/gpu/drm/i915/i915_iosf_mbi.h+42−0
@@ -0,0 +1,42 @@
1+/* SPDX-License-Identifier: MIT */
2+/*
3+ * Copyright © 2021 Intel Corporation
4+ */
5+
6+#ifndef __I915_IOSF_MBI_H__
7+#define __I915_IOSF_MBI_H__
8+
9+#if IS_ENABLED(CONFIG_IOSF_MBI)
10+#include <asm/iosf_mbi.h>
11+#else
12+
13+/* Stubs to compile for all non-x86 archs */
14+#define MBI_PMIC_BUS_ACCESS_BEGIN 1
15+#define MBI_PMIC_BUS_ACCESS_END 2
16+
17+struct notifier_block;
18+
19+static inline void iosf_mbi_punit_acquire(void) {}
20+static inline void iosf_mbi_punit_release(void) {}
21+static inline void iosf_mbi_assert_punit_acquired(void) {}
22+
23+static inline
24+int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb)
25+{
26+ return 0;
27+}
28+
29+static inline int
30+iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(struct notifier_block *nb)
31+{
32+ return 0;
33+}
34+
35+static inline
36+int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
37+{
38+ return 0;
39+}
40+#endif
41+
42+#endif /* __I915_IOSF_MBI_H__ */
drivers/gpu/drm/i915/i915_irq.c+1−1
@@ -3016,7 +3016,7 @@ static void vlv_display_irq_reset(struct drm_i915_private *dev_priv) · 3015 unmodified lines
30163016 if (IS_CHERRYVIEW(dev_priv))
30173017 intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK_CHV);
30183018 else
3019− intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK);
3019+ intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK_VLV);
30203020
30213021 i915_hotplug_interrupt_update_locked(dev_priv, 0xffffffff, 0);
30223022 intel_uncore_write(uncore, PORT_HOTPLUG_STAT, intel_uncore_read(&dev_priv->uncore, PORT_HOTPLUG_STAT));
drivers/gpu/drm/i915/i915_module.c+2−2
@@ -24,8 +24,8 @@ static int i915_check_nomodeset(void) · 23 unmodified lines
2424
2525 /*
2626 * Enable KMS by default, unless explicitly overriden by
27− * either the i915.modeset prarameter or by the
28− * vga_text_mode_force boot option.
27+ * either the i915.modeset parameter or by the
28+ * nomodeset boot option.
2929 */
3030
3131 if (i915_modparams.modeset == 0)
drivers/gpu/drm/i915/i915_pci.c+18−4
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <drm/drm_drv.h>
2828 #include <drm/i915_pciids.h>
2929
30+#include "i915_driver.h"
3031 #include "i915_drv.h"
3132 #include "i915_pci.h"
3233
@@ -145,6 +146,12 @@ · 112 unmodified lines
145146 .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
146147 DRM_COLOR_LUT_EQUAL_CHANNELS, \
147148 }
149+#define ICL_COLORS \
150+ .color = { .degamma_lut_size = 33, .gamma_lut_size = 262145, \
151+ .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
152+ DRM_COLOR_LUT_EQUAL_CHANNELS, \
153+ .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
154+ }
148155
149156 /* Keep in gen based order, and chronological order within a gen */
150157
@@ -811,7 +818,7 @@ static const struct intel_device_info cml_gt2_info = { · 660 unmodified lines
811818 [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
812819 }, \
813820 GEN(11), \
814− .color = { .degamma_lut_size = 33, .gamma_lut_size = 262145 }, \
821+ ICL_COLORS, \
815822 .dbuf.size = 2048, \
816823 .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2), \
817824 .display.has_dsc = 1, \
@@ -866,7 +873,7 @@ static const struct intel_device_info jsl_info = { · 48 unmodified lines
866873 TGL_CURSOR_OFFSETS, \
867874 .has_global_mocs = 1, \
868875 .has_pxp = 1, \
869− .display.has_dsb = 1
876+ .display.has_dsb = 0 /* FIXME: LUT load is broken with DSB */
870877
871878 static const struct intel_device_info tgl_info = {
872879 GEN12_FEATURES,
@@ -932,8 +939,6 @@ static const struct intel_device_info adl_s_info = { · 59 unmodified lines
932939 #define XE_LPD_FEATURES \
933940 .abox_mask = GENMASK(1, 0), \
934941 .color = { .degamma_lut_size = 0, .gamma_lut_size = 0 }, \
935− .cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
936− BIT(TRANSCODER_C) | BIT(TRANSCODER_D), \
937942 .dbuf.size = 4096, \
938943 .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2) | BIT(DBUF_S3) | \
939944 BIT(DBUF_S4), \
@@ -955,12 +960,16 @@ static const struct intel_device_info adl_s_info = { · 15 unmodified lines
955960 [TRANSCODER_B] = PIPE_B_OFFSET, \
956961 [TRANSCODER_C] = PIPE_C_OFFSET, \
957962 [TRANSCODER_D] = PIPE_D_OFFSET, \
963+ [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
964+ [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
958965 }, \
959966 .trans_offsets = { \
960967 [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
961968 [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
962969 [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
963970 [TRANSCODER_D] = TRANSCODER_D_OFFSET, \
971+ [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
972+ [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
964973 }, \
965974 XE_LPD_CURSOR_OFFSETS
966975
@@ -969,6 +978,9 @@ static const struct intel_device_info adl_p_info = { · 2 unmodified lines
969978 XE_LPD_FEATURES,
970979 PLATFORM(INTEL_ALDERLAKE_P),
971980 .require_force_probe = 1,
981+ .cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
982+ BIT(TRANSCODER_C) | BIT(TRANSCODER_D) |
983+ BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1),
972984 .display.has_cdclk_crawl = 1,
973985 .display.has_modular_fia = 1,
974986 .display.has_psr_hw_tracking = 0,
@@ -1038,6 +1050,8 @@ static const struct intel_device_info dg2_info = { · 63 unmodified lines
10381050 BIT(VECS0) | BIT(VECS1) |
10391051 BIT(VCS0) | BIT(VCS2),
10401052 .require_force_probe = 1,
1053+ .cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
1054+ BIT(TRANSCODER_C) | BIT(TRANSCODER_D),
10411055 };
10421056
10431057 #undef PLATFORM
drivers/gpu/drm/i915/i915_reg.h+188−170
@@ -371,6 +371,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 370 unmodified lines
371371 #define VLV_G3DCTL _MMIO(0x9024)
372372 #define VLV_GSCKGCTL _MMIO(0x9028)
373373
374+#define FBC_LLC_READ_CTRL _MMIO(0x9044)
375+#define FBC_LLC_FULLY_OPEN REG_BIT(30)
376+
374377 #define GEN6_MBCTL _MMIO(0x0907c)
375378 #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4)
376379 #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3)
@@ -2795,12 +2798,12 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 2418 unmodified lines
27952798 #define GEN12_AUX_ERR_DBG _MMIO(0x43f4)
27962799
27972800 #define FPGA_DBG _MMIO(0x42300)
2798−#define FPGA_DBG_RM_NOCLAIM (1 << 31)
2801+#define FPGA_DBG_RM_NOCLAIM REG_BIT(31)
27992802
28002803 #define CLAIM_ER _MMIO(VLV_DISPLAY_BASE + 0x2028)
2801−#define CLAIM_ER_CLR (1 << 31)
2802−#define CLAIM_ER_OVERFLOW (1 << 16)
2803−#define CLAIM_ER_CTR_MASK 0xffff
2804+#define CLAIM_ER_CLR REG_BIT(31)
2805+#define CLAIM_ER_OVERFLOW REG_BIT(16)
2806+#define CLAIM_ER_CTR_MASK REG_GENMASK(15, 0)
28042807
28052808 #define DERRMR _MMIO(0x44050)
28062809 /* Note that HBLANK events are reserved on bdw+ */
@@ -3307,93 +3310,98 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 500 unmodified lines
33073310 #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */
33083311 #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */
33093312 #define FBC_CONTROL _MMIO(0x3208)
3310−#define FBC_CTL_EN REG_BIT(31)
3311−#define FBC_CTL_PERIODIC REG_BIT(30)
3312−#define FBC_CTL_INTERVAL_MASK REG_GENMASK(29, 16)
3313−#define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x))
3314−#define FBC_CTL_STOP_ON_MOD REG_BIT(15)
3315−#define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */
3316−#define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm */
3317−#define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5)
3318−#define FBC_CTL_STRIDE(x) REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x))
3319−#define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0)
3320−#define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x))
3313+#define FBC_CTL_EN REG_BIT(31)
3314+#define FBC_CTL_PERIODIC REG_BIT(30)
3315+#define FBC_CTL_INTERVAL_MASK REG_GENMASK(29, 16)
3316+#define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x))
3317+#define FBC_CTL_STOP_ON_MOD REG_BIT(15)
3318+#define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */
3319+#define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm only */
3320+#define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5)
3321+#define FBC_CTL_STRIDE(x) REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x))
3322+#define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0)
3323+#define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x))
33213324 #define FBC_COMMAND _MMIO(0x320c)
3322−#define FBC_CMD_COMPRESS (1 << 0)
3325+#define FBC_CMD_COMPRESS REG_BIT(0)
33233326 #define FBC_STATUS _MMIO(0x3210)
3324−#define FBC_STAT_COMPRESSING (1 << 31)
3325−#define FBC_STAT_COMPRESSED (1 << 30)
3326−#define FBC_STAT_MODIFIED (1 << 29)
3327−#define FBC_STAT_CURRENT_LINE_SHIFT (0)
3328−#define FBC_CONTROL2 _MMIO(0x3214)
3329−#define FBC_CTL_FENCE_DBL (0 << 4)
3330−#define FBC_CTL_IDLE_IMM (0 << 2)
3331−#define FBC_CTL_IDLE_FULL (1 << 2)
3332−#define FBC_CTL_IDLE_LINE (2 << 2)
3333−#define FBC_CTL_IDLE_DEBUG (3 << 2)
3334−#define FBC_CTL_CPU_FENCE (1 << 1)
3335−#define FBC_CTL_PLANE(plane) ((plane) << 0)
3336−#define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */
3337−#define FBC_TAG(i) _MMIO(0x3300 + (i) * 4)
3327+#define FBC_STAT_COMPRESSING REG_BIT(31)
3328+#define FBC_STAT_COMPRESSED REG_BIT(30)
3329+#define FBC_STAT_MODIFIED REG_BIT(29)
3330+#define FBC_STAT_CURRENT_LINE_MASK REG_GENMASK(10, 0)
3331+#define FBC_CONTROL2 _MMIO(0x3214) /* i965gm only */
3332+#define FBC_CTL_FENCE_DBL REG_BIT(4)
3333+#define FBC_CTL_IDLE_MASK REG_GENMASK(3, 2)
3334+#define FBC_CTL_IDLE_IMM REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 0)
3335+#define FBC_CTL_IDLE_FULL REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 1)
3336+#define FBC_CTL_IDLE_LINE REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 2)
3337+#define FBC_CTL_IDLE_DEBUG REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 3)
3338+#define FBC_CTL_CPU_FENCE_EN REG_BIT(1)
3339+#define FBC_CTL_PLANE_MASK REG_GENMASK(1, 0)
3340+#define FBC_CTL_PLANE(i9xx_plane) REG_FIELD_PREP(FBC_CTL_PLANE_MASK, (i9xx_plane))
3341+#define FBC_FENCE_OFF _MMIO(0x3218) /* i965gm only, BSpec typo has 321Bh */
3342+#define FBC_MOD_NUM _MMIO(0x3220) /* i965gm only */
3343+#define FBC_MOD_NUM_MASK REG_GENMASK(31, 1)
3344+#define FBC_MOD_NUM_VALID REG_BIT(0)
3345+#define FBC_TAG(i) _MMIO(0x3300 + (i) * 4) /* 49 reisters */
3346+#define FBC_TAG_MASK REG_GENMASK(1, 0) /* 16 tags per register */
3347+#define FBC_TAG_MODIFIED REG_FIELD_PREP(FBC_TAG_MASK, 0)
3348+#define FBC_TAG_UNCOMPRESSED REG_FIELD_PREP(FBC_TAG_MASK, 1)
3349+#define FBC_TAG_UNCOMPRESSIBLE REG_FIELD_PREP(FBC_TAG_MASK, 2)
3350+#define FBC_TAG_COMPRESSED REG_FIELD_PREP(FBC_TAG_MASK, 3)
33383351
33393352 #define FBC_LL_SIZE (1536)
33403353
3341−#define FBC_LLC_READ_CTRL _MMIO(0x9044)
3342−#define FBC_LLC_FULLY_OPEN (1 << 30)
3343−
33443354 /* Framebuffer compression for GM45+ */
33453355 #define DPFC_CB_BASE _MMIO(0x3200)
3356+#define ILK_DPFC_CB_BASE _MMIO(0x43200)
33463357 #define DPFC_CONTROL _MMIO(0x3208)
3347−#define DPFC_CTL_EN (1 << 31)
3348−#define DPFC_CTL_PLANE(plane) ((plane) << 30)
3349−#define IVB_DPFC_CTL_PLANE(plane) ((plane) << 29)
3350−#define DPFC_CTL_FENCE_EN (1 << 29)
3351−#define IVB_DPFC_CTL_FENCE_EN (1 << 28)
3352−#define DPFC_CTL_PERSISTENT_MODE (1 << 25)
3353−#define DPFC_SR_EN (1 << 10)
3354−#define DPFC_CTL_LIMIT_1X (0 << 6)
3355−#define DPFC_CTL_LIMIT_2X (1 << 6)
3356−#define DPFC_CTL_LIMIT_4X (2 << 6)
3358+#define ILK_DPFC_CONTROL _MMIO(0x43208)
3359+#define DPFC_CTL_EN REG_BIT(31)
3360+#define DPFC_CTL_PLANE_MASK_G4X REG_BIT(30) /* g4x-snb */
3361+#define DPFC_CTL_PLANE_G4X(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_G4X, (i9xx_plane))
3362+#define DPFC_CTL_FENCE_EN_G4X REG_BIT(29) /* g4x-snb */
3363+#define DPFC_CTL_PLANE_MASK_IVB REG_GENMASK(30, 29) /* ivb only */
3364+#define DPFC_CTL_PLANE_IVB(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_IVB, (i9xx_plane))
3365+#define DPFC_CTL_FENCE_EN_IVB REG_BIT(28) /* ivb+ */
3366+#define DPFC_CTL_PERSISTENT_MODE REG_BIT(25) /* g4x-snb */
3367+#define DPFC_CTL_FALSE_COLOR REG_BIT(10) /* ivb+ */
3368+#define DPFC_CTL_SR_EN REG_BIT(10) /* g4x only */
3369+#define DPFC_CTL_SR_EXIT_DIS REG_BIT(9) /* g4x only */
3370+#define DPFC_CTL_LIMIT_MASK REG_GENMASK(7, 6)
3371+#define DPFC_CTL_LIMIT_1X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 0)
3372+#define DPFC_CTL_LIMIT_2X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 1)
3373+#define DPFC_CTL_LIMIT_4X REG_FIELD_PREP(DPFC_CTL_LIMIT_MASK, 2)
3374+#define DPFC_CTL_FENCENO_MASK REG_GENMASK(3, 0)
3375+#define DPFC_CTL_FENCENO(fence) REG_FIELD_PREP(DPFC_CTL_FENCENO_MASK, (fence))
33573376 #define DPFC_RECOMP_CTL _MMIO(0x320c)
3358−#define DPFC_RECOMP_STALL_EN (1 << 27)
3359−#define DPFC_RECOMP_STALL_WM_SHIFT (16)
3360−#define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
3361−#define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
3362−#define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
3377+#define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
3378+#define DPFC_RECOMP_STALL_EN REG_BIT(27)
3379+#define DPFC_RECOMP_STALL_WM_MASK REG_GENMASK(26, 16)
3380+#define DPFC_RECOMP_TIMER_COUNT_MASK REG_GENMASK(5, 0)
33633381 #define DPFC_STATUS _MMIO(0x3210)
3364−#define DPFC_INVAL_SEG_SHIFT (16)
3365−#define DPFC_INVAL_SEG_MASK (0x07ff0000)
3366−#define DPFC_COMP_SEG_SHIFT (0)
3367−#define DPFC_COMP_SEG_MASK (0x000007ff)
3382+#define ILK_DPFC_STATUS _MMIO(0x43210)
3383+#define DPFC_INVAL_SEG_MASK REG_GENMASK(26, 16)
3384+#define DPFC_COMP_SEG_MASK REG_GENMASK(10, 0)
33683385 #define DPFC_STATUS2 _MMIO(0x3214)
3386+#define ILK_DPFC_STATUS2 _MMIO(0x43214)
3387+#define DPFC_COMP_SEG_MASK_IVB REG_GENMASK(11, 0)
33693388 #define DPFC_FENCE_YOFF _MMIO(0x3218)
3370−#define DPFC_CHICKEN _MMIO(0x3224)
3371−#define DPFC_HT_MODIFY (1 << 31)
3372−
3373−/* Framebuffer compression for Ironlake */
3374−#define ILK_DPFC_CB_BASE _MMIO(0x43200)
3375−#define ILK_DPFC_CONTROL _MMIO(0x43208)
3376−#define FBC_CTL_FALSE_COLOR (1 << 10)
3377−/* The bit 28-8 is reserved */
3378−#define DPFC_RESERVED (0x1FFFFF00)
3379−#define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
3380−#define ILK_DPFC_STATUS _MMIO(0x43210)
3381−#define ILK_DPFC_COMP_SEG_MASK 0x7ff
3382−#define IVB_FBC_STATUS2 _MMIO(0x43214)
3383−#define IVB_FBC_COMP_SEG_MASK 0x7ff
3384−#define BDW_FBC_COMP_SEG_MASK 0xfff
33853389 #define ILK_DPFC_FENCE_YOFF _MMIO(0x43218)
3390+#define DPFC_CHICKEN _MMIO(0x3224)
33863391 #define ILK_DPFC_CHICKEN _MMIO(0x43224)
3387−#define ILK_DPFC_DISABLE_DUMMY0 (1 << 8)
3388−#define ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL (1 << 14)
3389−#define ILK_DPFC_NUKE_ON_ANY_MODIFICATION (1 << 23)
3392+#define DPFC_HT_MODIFY REG_BIT(31) /* pre-ivb */
3393+#define DPFC_NUKE_ON_ANY_MODIFICATION REG_BIT(23) /* bdw+ */
3394+#define DPFC_CHICKEN_COMP_DUMMY_PIXEL REG_BIT(14) /* glk+ */
3395+#define DPFC_DISABLE_DUMMY0 REG_BIT(8) /* ivb+ */
3396+
33903397 #define GLK_FBC_STRIDE _MMIO(0x43228)
33913398 #define FBC_STRIDE_OVERRIDE REG_BIT(15)
33923399 #define FBC_STRIDE_MASK REG_GENMASK(14, 0)
33933400 #define FBC_STRIDE(x) REG_FIELD_PREP(FBC_STRIDE_MASK, (x))
3401+
33943402 #define ILK_FBC_RT_BASE _MMIO(0x2128)
3395−#define ILK_FBC_RT_VALID (1 << 0)
3396−#define SNB_FBC_FRONT_BUFFER (1 << 1)
3403+#define ILK_FBC_RT_VALID REG_BIT(0)
3404+#define SNB_FBC_FRONT_BUFFER REG_BIT(1)
33973405
33983406 #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
33993407 #define ILK_FBCQ_DIS (1 << 22)
@@ -3417,8 +3425,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 17 unmodified lines
34173425 * The following two registers are of type GTTMMADR
34183426 */
34193427 #define SNB_DPFC_CTL_SA _MMIO(0x100100)
3420−#define SNB_CPU_FENCE_ENABLE (1 << 29)
3421−#define DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
3428+#define SNB_DPFC_FENCE_EN REG_BIT(29)
3429+#define SNB_DPFC_FENCENO_MASK REG_GENMASK(4, 0)
3430+#define SNB_DPFC_FENCENO(fence) REG_FIELD_PREP(SNB_DPFC_FENCENO_MASK, (fence))
3431+#define SNB_DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
34223432
34233433 /* Framebuffer compression for Ivybridge */
34243434 #define IVB_FBC_RT_BASE _MMIO(0x7020)
@@ -3428,8 +3438,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 3 unmodified lines
34283438 #define IPS_ENABLE (1 << 31)
34293439
34303440 #define MSG_FBC_REND_STATE _MMIO(0x50380)
3431−#define FBC_REND_NUKE (1 << 2)
3432−#define FBC_REND_CACHE_CLEAN (1 << 1)
3441+#define FBC_REND_NUKE REG_BIT(2)
3442+#define FBC_REND_CACHE_CLEAN REG_BIT(1)
34333443
34343444 /*
34353445 * GPIO regs
@@ -4309,47 +4319,52 @@ enum { · 873 unmodified lines
43094319
43104320 /* Pipe A CRC regs */
43114321 #define _PIPE_CRC_CTL_A 0x60050
4312−#define PIPE_CRC_ENABLE (1 << 31)
4322+#define PIPE_CRC_ENABLE REG_BIT(31)
43134323 /* skl+ source selection */
4314−#define PIPE_CRC_SOURCE_PLANE_1_SKL (0 << 28)
4315−#define PIPE_CRC_SOURCE_PLANE_2_SKL (2 << 28)
4316−#define PIPE_CRC_SOURCE_DMUX_SKL (4 << 28)
4317−#define PIPE_CRC_SOURCE_PLANE_3_SKL (6 << 28)
4318−#define PIPE_CRC_SOURCE_PLANE_4_SKL (7 << 28)
4319−#define PIPE_CRC_SOURCE_PLANE_5_SKL (5 << 28)
4320−#define PIPE_CRC_SOURCE_PLANE_6_SKL (3 << 28)
4321−#define PIPE_CRC_SOURCE_PLANE_7_SKL (1 << 28)
4324+#define PIPE_CRC_SOURCE_MASK_SKL REG_GENMASK(30, 28)
4325+#define PIPE_CRC_SOURCE_PLANE_1_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 0)
4326+#define PIPE_CRC_SOURCE_PLANE_2_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 2)
4327+#define PIPE_CRC_SOURCE_DMUX_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 4)
4328+#define PIPE_CRC_SOURCE_PLANE_3_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 6)
4329+#define PIPE_CRC_SOURCE_PLANE_4_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 7)
4330+#define PIPE_CRC_SOURCE_PLANE_5_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 5)
4331+#define PIPE_CRC_SOURCE_PLANE_6_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 3)
4332+#define PIPE_CRC_SOURCE_PLANE_7_SKL REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_SKL, 1)
43224333 /* ivb+ source selection */
4323−#define PIPE_CRC_SOURCE_PRIMARY_IVB (0 << 29)
4324−#define PIPE_CRC_SOURCE_SPRITE_IVB (1 << 29)
4325−#define PIPE_CRC_SOURCE_PF_IVB (2 << 29)
4334+#define PIPE_CRC_SOURCE_MASK_IVB REG_GENMASK(30, 29)
4335+#define PIPE_CRC_SOURCE_PRIMARY_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 0)
4336+#define PIPE_CRC_SOURCE_SPRITE_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 1)
4337+#define PIPE_CRC_SOURCE_PF_IVB REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_IVB, 2)
43264338 /* ilk+ source selection */
4327−#define PIPE_CRC_SOURCE_PRIMARY_ILK (0 << 28)
4328−#define PIPE_CRC_SOURCE_SPRITE_ILK (1 << 28)
4329−#define PIPE_CRC_SOURCE_PIPE_ILK (2 << 28)
4330−/* embedded DP port on the north display block, reserved on ivb */
4331−#define PIPE_CRC_SOURCE_PORT_A_ILK (4 << 28)
4332−#define PIPE_CRC_SOURCE_FDI_ILK (5 << 28) /* reserved on ivb */
4339+#define PIPE_CRC_SOURCE_MASK_ILK REG_GENMASK(30, 28)
4340+#define PIPE_CRC_SOURCE_PRIMARY_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 0)
4341+#define PIPE_CRC_SOURCE_SPRITE_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 1)
4342+#define PIPE_CRC_SOURCE_PIPE_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 2)
4343+/* embedded DP port on the north display block */
4344+#define PIPE_CRC_SOURCE_PORT_A_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 4)
4345+#define PIPE_CRC_SOURCE_FDI_ILK REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_ILK, 5)
43334346 /* vlv source selection */
4334−#define PIPE_CRC_SOURCE_PIPE_VLV (0 << 27)
4335−#define PIPE_CRC_SOURCE_HDMIB_VLV (1 << 27)
4336−#define PIPE_CRC_SOURCE_HDMIC_VLV (2 << 27)
4347+#define PIPE_CRC_SOURCE_MASK_VLV REG_GENMASK(30, 27)
4348+#define PIPE_CRC_SOURCE_PIPE_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 0)
4349+#define PIPE_CRC_SOURCE_HDMIB_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 1)
4350+#define PIPE_CRC_SOURCE_HDMIC_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 2)
43374351 /* with DP port the pipe source is invalid */
4338−#define PIPE_CRC_SOURCE_DP_D_VLV (3 << 27)
4339−#define PIPE_CRC_SOURCE_DP_B_VLV (6 << 27)
4340−#define PIPE_CRC_SOURCE_DP_C_VLV (7 << 27)
4352+#define PIPE_CRC_SOURCE_DP_D_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 3)
4353+#define PIPE_CRC_SOURCE_DP_B_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 6)
4354+#define PIPE_CRC_SOURCE_DP_C_VLV REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_VLV, 7)
43414355 /* gen3+ source selection */
4342−#define PIPE_CRC_SOURCE_PIPE_I9XX (0 << 28)
4343−#define PIPE_CRC_SOURCE_SDVOB_I9XX (1 << 28)
4344−#define PIPE_CRC_SOURCE_SDVOC_I9XX (2 << 28)
4356+#define PIPE_CRC_SOURCE_MASK_I9XX REG_GENMASK(30, 28)
4357+#define PIPE_CRC_SOURCE_PIPE_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 0)
4358+#define PIPE_CRC_SOURCE_SDVOB_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 1)
4359+#define PIPE_CRC_SOURCE_SDVOC_I9XX REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 2)
43454360 /* with DP/TV port the pipe source is invalid */
4346−#define PIPE_CRC_SOURCE_DP_D_G4X (3 << 28)
4347−#define PIPE_CRC_SOURCE_TV_PRE (4 << 28)
4348−#define PIPE_CRC_SOURCE_TV_POST (5 << 28)
4349−#define PIPE_CRC_SOURCE_DP_B_G4X (6 << 28)
4350−#define PIPE_CRC_SOURCE_DP_C_G4X (7 << 28)
4361+#define PIPE_CRC_SOURCE_DP_D_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 3)
4362+#define PIPE_CRC_SOURCE_TV_PRE REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 4)
4363+#define PIPE_CRC_SOURCE_TV_POST REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 5)
4364+#define PIPE_CRC_SOURCE_DP_B_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 6)
4365+#define PIPE_CRC_SOURCE_DP_C_G4X REG_FIELD_PREP(PIPE_CRC_SOURCE_MASK_I9XX, 7)
43514366 /* gen2 doesn't have source selection bits */
4352−#define PIPE_CRC_INCLUDE_BORDER_I8XX (1 << 30)
4367+#define PIPE_CRC_INCLUDE_BORDER_I8XX REG_BIT(30)
43534368
43544369 #define _PIPE_CRC_RES_1_A_IVB 0x60064
43554370 #define _PIPE_CRC_RES_2_A_IVB 0x60068
@@ -4698,11 +4713,11 @@ enum { · 342 unmodified lines
46984713 #define PSR_EVENT_LPSP_MODE_EXIT (1 << 1)
46994714 #define PSR_EVENT_PSR_DISABLE (1 << 0)
47004715
4701−#define _PSR2_STATUS_A 0x60940
4702−#define _PSR2_STATUS_EDP 0x6f940
4703−#define EDP_PSR2_STATUS(tran) _MMIO_TRANS2(tran, _PSR2_STATUS_A)
4704−#define EDP_PSR2_STATUS_STATE_MASK (0xf << 28)
4705−#define EDP_PSR2_STATUS_STATE_SHIFT 28
4716+#define _PSR2_STATUS_A 0x60940
4717+#define _PSR2_STATUS_EDP 0x6f940
4718+#define EDP_PSR2_STATUS(tran) _MMIO_TRANS2(tran, _PSR2_STATUS_A)
4719+#define EDP_PSR2_STATUS_STATE_MASK REG_GENMASK(31, 28)
4720+#define EDP_PSR2_STATUS_STATE_DEEP_SLEEP REG_FIELD_PREP(EDP_PSR2_STATUS_STATE_MASK, 0x8)
47064721
47074722 #define _PSR2_SU_STATUS_A 0x60914
47084723 #define _PSR2_SU_STATUS_EDP 0x6f914
@@ -4999,9 +5014,9 @@ enum { · 290 unmodified lines
49995014 #define PORT_DFT2_G4X _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61154)
50005015 #define DC_BALANCE_RESET_VLV (1 << 31)
50015016 #define PIPE_SCRAMBLE_RESET_MASK ((1 << 14) | (0x3 << 0))
5002−#define PIPE_C_SCRAMBLE_RESET (1 << 14) /* chv */
5003−#define PIPE_B_SCRAMBLE_RESET (1 << 1)
5004−#define PIPE_A_SCRAMBLE_RESET (1 << 0)
5017+#define PIPE_C_SCRAMBLE_RESET REG_BIT(14) /* chv */
5018+#define PIPE_B_SCRAMBLE_RESET REG_BIT(1)
5019+#define PIPE_A_SCRAMBLE_RESET REG_BIT(0)
50055020
50065021 /* Gen 3 SDVO bits: */
50075022 #define SDVO_ENABLE (1 << 31)
@@ -6266,55 +6281,55 @@ enum { · 1258 unmodified lines
62666281 #define PIPE_STATUS_PORT_UNDERRUN_XELPD REG_BIT(26)
62676282
62686283 #define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)
6269−#define PIPEB_LINE_COMPARE_INT_EN (1 << 29)
6270−#define PIPEB_HLINE_INT_EN (1 << 28)
6271−#define PIPEB_VBLANK_INT_EN (1 << 27)
6272−#define SPRITED_FLIP_DONE_INT_EN (1 << 26)
6273−#define SPRITEC_FLIP_DONE_INT_EN (1 << 25)
6274−#define PLANEB_FLIP_DONE_INT_EN (1 << 24)
6275−#define PIPE_PSR_INT_EN (1 << 22)
6276−#define PIPEA_LINE_COMPARE_INT_EN (1 << 21)
6277−#define PIPEA_HLINE_INT_EN (1 << 20)
6278−#define PIPEA_VBLANK_INT_EN (1 << 19)
6279−#define SPRITEB_FLIP_DONE_INT_EN (1 << 18)
6280−#define SPRITEA_FLIP_DONE_INT_EN (1 << 17)
6281−#define PLANEA_FLIPDONE_INT_EN (1 << 16)
6282−#define PIPEC_LINE_COMPARE_INT_EN (1 << 13)
6283−#define PIPEC_HLINE_INT_EN (1 << 12)
6284−#define PIPEC_VBLANK_INT_EN (1 << 11)
6285−#define SPRITEF_FLIPDONE_INT_EN (1 << 10)
6286−#define SPRITEE_FLIPDONE_INT_EN (1 << 9)
6287−#define PLANEC_FLIPDONE_INT_EN (1 << 8)
6284+#define PIPEB_LINE_COMPARE_INT_EN REG_BIT(29)
6285+#define PIPEB_HLINE_INT_EN REG_BIT(28)
6286+#define PIPEB_VBLANK_INT_EN REG_BIT(27)
6287+#define SPRITED_FLIP_DONE_INT_EN REG_BIT(26)
6288+#define SPRITEC_FLIP_DONE_INT_EN REG_BIT(25)
6289+#define PLANEB_FLIP_DONE_INT_EN REG_BIT(24)
6290+#define PIPE_PSR_INT_EN REG_BIT(22)
6291+#define PIPEA_LINE_COMPARE_INT_EN REG_BIT(21)
6292+#define PIPEA_HLINE_INT_EN REG_BIT(20)
6293+#define PIPEA_VBLANK_INT_EN REG_BIT(19)
6294+#define SPRITEB_FLIP_DONE_INT_EN REG_BIT(18)
6295+#define SPRITEA_FLIP_DONE_INT_EN REG_BIT(17)
6296+#define PLANEA_FLIPDONE_INT_EN REG_BIT(16)
6297+#define PIPEC_LINE_COMPARE_INT_EN REG_BIT(13)
6298+#define PIPEC_HLINE_INT_EN REG_BIT(12)
6299+#define PIPEC_VBLANK_INT_EN REG_BIT(11)
6300+#define SPRITEF_FLIPDONE_INT_EN REG_BIT(10)
6301+#define SPRITEE_FLIPDONE_INT_EN REG_BIT(9)
6302+#define PLANEC_FLIPDONE_INT_EN REG_BIT(8)
62886303
62896304 #define DPINVGTT _MMIO(VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */
6290−#define SPRITEF_INVALID_GTT_INT_EN (1 << 27)
6291−#define SPRITEE_INVALID_GTT_INT_EN (1 << 26)
6292−#define PLANEC_INVALID_GTT_INT_EN (1 << 25)
6293−#define CURSORC_INVALID_GTT_INT_EN (1 << 24)
6294−#define CURSORB_INVALID_GTT_INT_EN (1 << 23)
6295−#define CURSORA_INVALID_GTT_INT_EN (1 << 22)
6296−#define SPRITED_INVALID_GTT_INT_EN (1 << 21)
6297−#define SPRITEC_INVALID_GTT_INT_EN (1 << 20)
6298−#define PLANEB_INVALID_GTT_INT_EN (1 << 19)
6299−#define SPRITEB_INVALID_GTT_INT_EN (1 << 18)
6300−#define SPRITEA_INVALID_GTT_INT_EN (1 << 17)
6301−#define PLANEA_INVALID_GTT_INT_EN (1 << 16)
6302−#define DPINVGTT_EN_MASK 0xff0000
6303−#define DPINVGTT_EN_MASK_CHV 0xfff0000
6304−#define SPRITEF_INVALID_GTT_STATUS (1 << 11)
6305−#define SPRITEE_INVALID_GTT_STATUS (1 << 10)
6306−#define PLANEC_INVALID_GTT_STATUS (1 << 9)
6307−#define CURSORC_INVALID_GTT_STATUS (1 << 8)
6308−#define CURSORB_INVALID_GTT_STATUS (1 << 7)
6309−#define CURSORA_INVALID_GTT_STATUS (1 << 6)
6310−#define SPRITED_INVALID_GTT_STATUS (1 << 5)
6311−#define SPRITEC_INVALID_GTT_STATUS (1 << 4)
6312−#define PLANEB_INVALID_GTT_STATUS (1 << 3)
6313−#define SPRITEB_INVALID_GTT_STATUS (1 << 2)
6314−#define SPRITEA_INVALID_GTT_STATUS (1 << 1)
6315−#define PLANEA_INVALID_GTT_STATUS (1 << 0)
6316−#define DPINVGTT_STATUS_MASK 0xff
6317−#define DPINVGTT_STATUS_MASK_CHV 0xfff
6305+#define DPINVGTT_EN_MASK_CHV REG_GENMASK(27, 16)
6306+#define DPINVGTT_EN_MASK_VLV REG_GENMASK(23, 16)
6307+#define SPRITEF_INVALID_GTT_INT_EN REG_BIT(27)
6308+#define SPRITEE_INVALID_GTT_INT_EN REG_BIT(26)
6309+#define PLANEC_INVALID_GTT_INT_EN REG_BIT(25)
6310+#define CURSORC_INVALID_GTT_INT_EN REG_BIT(24)
6311+#define CURSORB_INVALID_GTT_INT_EN REG_BIT(23)
6312+#define CURSORA_INVALID_GTT_INT_EN REG_BIT(22)
6313+#define SPRITED_INVALID_GTT_INT_EN REG_BIT(21)
6314+#define SPRITEC_INVALID_GTT_INT_EN REG_BIT(20)
6315+#define PLANEB_INVALID_GTT_INT_EN REG_BIT(19)
6316+#define SPRITEB_INVALID_GTT_INT_EN REG_BIT(18)
6317+#define SPRITEA_INVALID_GTT_INT_EN REG_BIT(17)
6318+#define PLANEA_INVALID_GTT_INT_EN REG_BIT(16)
6319+#define DPINVGTT_STATUS_MASK_CHV REG_GENMASK(11, 0)
6320+#define DPINVGTT_STATUS_MASK_VLV REG_GENMASK(7, 0)
6321+#define SPRITEF_INVALID_GTT_STATUS REG_BIT(11)
6322+#define SPRITEE_INVALID_GTT_STATUS REG_BIT(10)
6323+#define PLANEC_INVALID_GTT_STATUS REG_BIT(9)
6324+#define CURSORC_INVALID_GTT_STATUS REG_BIT(8)
6325+#define CURSORB_INVALID_GTT_STATUS REG_BIT(7)
6326+#define CURSORA_INVALID_GTT_STATUS REG_BIT(6)
6327+#define SPRITED_INVALID_GTT_STATUS REG_BIT(5)
6328+#define SPRITEC_INVALID_GTT_STATUS REG_BIT(4)
6329+#define PLANEB_INVALID_GTT_STATUS REG_BIT(3)
6330+#define SPRITEB_INVALID_GTT_STATUS REG_BIT(2)
6331+#define SPRITEA_INVALID_GTT_STATUS REG_BIT(1)
6332+#define PLANEA_INVALID_GTT_STATUS REG_BIT(0)
63186333
63196334 #define DSPARB _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70030)
63206335 #define DSPARB_CSTART_MASK (0x7f << 7)
@@ -8263,7 +8278,7 @@ enum { · 1942 unmodified lines
82638278
82648279 /*
82658280 * The below are numbered starting from "S1" on gen11/gen12, but starting
8266− * with gen13 display, the bspec switches to a 0-based numbering scheme
8281+ * with display 13, the bspec switches to a 0-based numbering scheme
82678282 * (although the addresses stay the same so new S0 = old S1, new S1 = old S2).
82688283 * We'll just use the 0-based numbering here for all platforms since it's the
82698284 * way things will be named by the hardware team going forward, plus it's more
@@ -8308,9 +8323,10 @@ enum { · 38 unmodified lines
83088323 #define RESET_PCH_HANDSHAKE_ENABLE (1 << 4)
83098324
83108325 #define GEN8_CHICKEN_DCPR_1 _MMIO(0x46430)
8311−#define SKL_SELECT_ALTERNATE_DC_EXIT (1 << 30)
8312−#define ICL_DELAY_PMRSP (1 << 22)
8313−#define MASK_WAKEMEM (1 << 13)
8326+#define SKL_SELECT_ALTERNATE_DC_EXIT REG_BIT(30)
8327+#define ICL_DELAY_PMRSP REG_BIT(22)
8328+#define DISABLE_FLR_SRC REG_BIT(15)
8329+#define MASK_WAKEMEM REG_BIT(13)
83148330
83158331 #define GEN11_CHICKEN_DCPR_2 _MMIO(0x46434)
83168332 #define DCPR_MASK_MAXLATENCY_MEMUP_CLR REG_BIT(27)
@@ -9781,6 +9797,10 @@ enum { · 1464 unmodified lines
97819797 #define AUD_PIN_BUF_CTL _MMIO(0x48414)
97829798 #define AUD_PIN_BUF_ENABLE REG_BIT(31)
97839799
9800+#define AUD_TS_CDCLK_M _MMIO(0x65ea0)
9801+#define AUD_TS_CDCLK_M_EN REG_BIT(31)
9802+#define AUD_TS_CDCLK_N _MMIO(0x65ea4)
9803+
97849804 /* Display Audio Config Reg */
97859805 #define AUD_CONFIG_BE _MMIO(0x65ef0)
97869806 #define HBLANK_EARLY_ENABLE_ICL(pipe) (0x1 << (20 - (pipe)))
@@ -10212,8 +10232,6 @@ enum skl_power_gate { · 425 unmodified lines
1021210232 #define TGL_TRANS_DDI_PORT_MASK (0xf << TGL_TRANS_DDI_PORT_SHIFT)
1021310233 #define TRANS_DDI_SELECT_PORT(x) ((x) << TRANS_DDI_PORT_SHIFT)
1021410234 #define TGL_TRANS_DDI_SELECT_PORT(x) (((x) + 1) << TGL_TRANS_DDI_PORT_SHIFT)
10215−#define TRANS_DDI_FUNC_CTL_VAL_TO_PORT(val) (((val) & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT)
10216−#define TGL_TRANS_DDI_FUNC_CTL_VAL_TO_PORT(val) ((((val) & TGL_TRANS_DDI_PORT_MASK) >> TGL_TRANS_DDI_PORT_SHIFT) - 1)
1021710235 #define TRANS_DDI_MODE_SELECT_MASK (7 << 24)
1021810236 #define TRANS_DDI_MODE_SELECT_HDMI (0 << 24)
1021910237 #define TRANS_DDI_MODE_SELECT_DVI (1 << 24)
drivers/gpu/drm/i915/i915_switcheroo.c+3−2
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 #include <linux/vga_switcheroo.h>
77
8+#include "i915_driver.h"
89 #include "i915_drv.h"
910 #include "i915_switcheroo.h"
1011
@@ -24,12 +25,12 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, · 13 unmodified lines
2425 i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING;
2526 /* i915 resume handler doesn't set to D0 */
2627 pci_set_power_state(pdev, PCI_D0);
27− i915_resume_switcheroo(i915);
28+ i915_driver_resume_switcheroo(i915);
2829 i915->drm.switch_power_state = DRM_SWITCH_POWER_ON;
2930 } else {
3031 drm_info(&i915->drm, "switched off\n");
3132 i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING;
32− i915_suspend_switcheroo(i915, pmm);
33+ i915_driver_suspend_switcheroo(i915, pmm);
3334 i915->drm.switch_power_state = DRM_SWITCH_POWER_OFF;
3435 }
3536 }
drivers/gpu/drm/i915/i915_trace.h+73−2
@@ -288,7 +288,7 @@ TRACE_EVENT(vlv_fifo_size, · 287 unmodified lines
288288
289289 /* plane updates */
290290
291−TRACE_EVENT(intel_update_plane,
291+TRACE_EVENT(intel_plane_update_noarm,
292292 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
293293 TP_ARGS(plane, crtc),
294294
@@ -317,7 +317,36 @@ TRACE_EVENT(intel_update_plane, · 22 unmodified lines
317317 DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
318318 );
319319
320−TRACE_EVENT(intel_disable_plane,
320+TRACE_EVENT(intel_plane_update_arm,
321+ TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
322+ TP_ARGS(plane, crtc),
323+
324+ TP_STRUCT__entry(
325+ __field(enum pipe, pipe)
326+ __field(u32, frame)
327+ __field(u32, scanline)
328+ __array(int, src, 4)
329+ __array(int, dst, 4)
330+ __string(name, plane->name)
331+ ),
332+
333+ TP_fast_assign(
334+ __assign_str(name, plane->name);
335+ __entry->pipe = crtc->pipe;
336+ __entry->frame = intel_crtc_get_vblank_counter(crtc);
337+ __entry->scanline = intel_get_crtc_scanline(crtc);
338+ memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
339+ memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
340+ ),
341+
342+ TP_printk("pipe %c, plane %s, frame=%u, scanline=%u, " DRM_RECT_FP_FMT " -> " DRM_RECT_FMT,
343+ pipe_name(__entry->pipe), __get_str(name),
344+ __entry->frame, __entry->scanline,
345+ DRM_RECT_FP_ARG((const struct drm_rect *)__entry->src),
346+ DRM_RECT_ARG((const struct drm_rect *)__entry->dst))
347+);
348+
349+TRACE_EVENT(intel_plane_disable_arm,
321350 TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc),
322351 TP_ARGS(plane, crtc),
323352
@@ -404,6 +433,48 @@ TRACE_EVENT(intel_fbc_nuke, · 80 unmodified lines
404433
405434 /* pipe updates */
406435
436+TRACE_EVENT(intel_crtc_vblank_work_start,
437+ TP_PROTO(struct intel_crtc *crtc),
438+ TP_ARGS(crtc),
439+
440+ TP_STRUCT__entry(
441+ __field(enum pipe, pipe)
442+ __field(u32, frame)
443+ __field(u32, scanline)
444+ ),
445+
446+ TP_fast_assign(
447+ __entry->pipe = crtc->pipe;
448+ __entry->frame = intel_crtc_get_vblank_counter(crtc);
449+ __entry->scanline = intel_get_crtc_scanline(crtc);
450+ ),
451+
452+ TP_printk("pipe %c, frame=%u, scanline=%u",
453+ pipe_name(__entry->pipe), __entry->frame,
454+ __entry->scanline)
455+);
456+
457+TRACE_EVENT(intel_crtc_vblank_work_end,
458+ TP_PROTO(struct intel_crtc *crtc),
459+ TP_ARGS(crtc),
460+
461+ TP_STRUCT__entry(
462+ __field(enum pipe, pipe)
463+ __field(u32, frame)
464+ __field(u32, scanline)
465+ ),
466+
467+ TP_fast_assign(
468+ __entry->pipe = crtc->pipe;
469+ __entry->frame = intel_crtc_get_vblank_counter(crtc);
470+ __entry->scanline = intel_get_crtc_scanline(crtc);
471+ ),
472+
473+ TP_printk("pipe %c, frame=%u, scanline=%u",
474+ pipe_name(__entry->pipe), __entry->frame,
475+ __entry->scanline)
476+);
477+
407478 TRACE_EVENT(intel_pipe_update_start,
408479 TP_PROTO(struct intel_crtc *crtc),
409480 TP_ARGS(crtc),
drivers/gpu/drm/i915/i915_vma_types.h+14−5
@@ -97,11 +97,20 @@ enum i915_cache_level; · 96 unmodified lines
9797
9898 struct intel_remapped_plane_info {
9999 /* in gtt pages */
100− u32 offset;
101− u16 width;
102− u16 height;
103− u16 src_stride;
104− u16 dst_stride;
100+ u32 offset:31;
101+ u32 linear:1;
102+ union {
103+ /* in gtt pages for !linear */
104+ struct {
105+ u16 width;
106+ u16 height;
107+ u16 src_stride;
108+ u16 dst_stride;
109+ };
110+
111+ /* in gtt pages for linear */
112+ u32 size;
113+ };
105114 } __packed;
106115
107116 struct intel_remapped_info {
drivers/gpu/drm/i915/intel_pm.c+25−16
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "display/intel_bw.h"
3838 #include "display/intel_de.h"
3939 #include "display/intel_display_types.h"
40+#include "display/intel_fb.h"
4041 #include "display/intel_fbc.h"
4142 #include "display/intel_sprite.h"
4243 #include "display/skl_universal_plane.h"
@@ -160,7 +161,7 @@ static void bxt_init_clock_gating(struct drm_i915_private *dev_priv) · 117 unmodified lines
160161 * Display WA #0883: bxt
161162 */
162163 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, intel_uncore_read(&dev_priv->uncore, ILK_DPFC_CHICKEN) |
163− ILK_DPFC_DISABLE_DUMMY0);
164+ DPFC_DISABLE_DUMMY0);
164165 }
165166
166167 static void glk_init_clock_gating(struct drm_i915_private *dev_priv)
@@ -3062,9 +3063,9 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv) · 2895 unmodified lines
30623063 * The BIOS provided WM memory latency values are often
30633064 * inadequate for high resolution displays. Adjust them.
30643065 */
3065− changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) |
3066− ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) |
3067− ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12);
3066+ changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12);
3067+ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12);
3068+ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12);
30683069
30693070 if (!changed)
30703071 return;
@@ -3374,7 +3375,7 @@ static void ilk_wm_merge(struct drm_i915_private *dev_priv, · 303 unmodified lines
33743375 * enabled sometime later.
33753376 */
33763377 if (DISPLAY_VER(dev_priv) == 5 && !merged->fbc_wm_enabled &&
3377− intel_fbc_is_active(dev_priv)) {
3378+ intel_fbc_is_active(&dev_priv->fbc)) {
33783379 for (level = 2; level <= max_level; level++) {
33793380 struct intel_wm_level *wm = &merged->wm[level];
33803381
@@ -5094,6 +5095,18 @@ skl_check_nv12_wm_level(struct skl_wm_level *wm, struct skl_wm_level *uv_wm, · 1713 unmodified lines
50945095 }
50955096 }
50965097
5098+static bool icl_need_wm1_wa(struct drm_i915_private *i915,
5099+ enum plane_id plane_id)
5100+{
5101+ /*
5102+ * Wa_1408961008:icl, ehl
5103+ * Wa_14012656716:tgl, adl
5104+ * Underruns with WM1+ disabled
5105+ */
5106+ return DISPLAY_VER(i915) == 11 ||
5107+ (IS_DISPLAY_VER(i915, 12, 13) && plane_id == PLANE_CURSOR);
5108+}
5109+
50975110 static int
50985111 skl_allocate_plane_ddb(struct intel_atomic_state *state,
50995112 struct intel_crtc *crtc)
@@ -5264,11 +5277,7 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state, · 164 unmodified lines
52645277 skl_check_nv12_wm_level(&wm->wm[level], &wm->uv_wm[level],
52655278 total[plane_id], uv_total[plane_id]);
52665279
5267− /*
5268− * Wa_1408961008:icl, ehl
5269− * Underruns with WM1+ disabled
5270− */
5271− if (DISPLAY_VER(dev_priv) == 11 &&
5280+ if (icl_need_wm1_wa(dev_priv, plane_id) &&
52725281 level == 1 && wm->wm[0].enable) {
52735282 wm->wm[level].blocks = wm->wm[0].blocks;
52745283 wm->wm[level].lines = wm->wm[0].lines;
@@ -7434,7 +7443,7 @@ static void icl_init_clock_gating(struct drm_i915_private *dev_priv) · 2159 unmodified lines
74347443 {
74357444 /* Wa_1409120013:icl,ehl */
74367445 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN,
7437− ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL);
7446+ DPFC_CHICKEN_COMP_DUMMY_PIXEL);
74387447
74397448 /*Wa_14010594013:icl, ehl */
74407449 intel_uncore_rmw(&dev_priv->uncore, GEN8_CHICKEN_DCPR_1,
@@ -7447,7 +7456,7 @@ static void gen12lp_init_clock_gating(struct drm_i915_private *dev_priv) · 6 unmodified lines
74477456 if (IS_TIGERLAKE(dev_priv) || IS_ROCKETLAKE(dev_priv) ||
74487457 IS_ALDERLAKE_S(dev_priv) || IS_DG1(dev_priv))
74497458 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN,
7450− ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL);
7459+ DPFC_CHICKEN_COMP_DUMMY_PIXEL);
74517460
74527461 /* Wa_1409825376:tgl (pre-prod)*/
74537462 if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_C0))
@@ -7509,7 +7518,7 @@ static void cfl_init_clock_gating(struct drm_i915_private *dev_priv) · 55 unmodified lines
75097518 * Display WA #0873: cfl
75107519 */
75117520 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, intel_uncore_read(&dev_priv->uncore, ILK_DPFC_CHICKEN) |
7512− ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
7521+ DPFC_NUKE_ON_ANY_MODIFICATION);
75137522 }
75147523
75157524 static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
@@ -7542,7 +7551,7 @@ static void kbl_init_clock_gating(struct drm_i915_private *dev_priv) · 26 unmodified lines
75427551 * Display WA #0873: kbl
75437552 */
75447553 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, intel_uncore_read(&dev_priv->uncore, ILK_DPFC_CHICKEN) |
7545− ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
7554+ DPFC_NUKE_ON_ANY_MODIFICATION);
75467555 }
75477556
75487557 static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
@@ -7569,14 +7578,14 @@ static void skl_init_clock_gating(struct drm_i915_private *dev_priv) · 20 unmodified lines
75697578 * Display WA #0873: skl
75707579 */
75717580 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, intel_uncore_read(&dev_priv->uncore, ILK_DPFC_CHICKEN) |
7572− ILK_DPFC_NUKE_ON_ANY_MODIFICATION);
7581+ DPFC_NUKE_ON_ANY_MODIFICATION);
75737582
75747583 /*
75757584 * WaFbcHighMemBwCorruptionAvoidance:skl
75767585 * Display WA #0883: skl
75777586 */
75787587 intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, intel_uncore_read(&dev_priv->uncore, ILK_DPFC_CHICKEN) |
7579− ILK_DPFC_DISABLE_DUMMY0);
7588+ DPFC_DISABLE_DUMMY0);
75807589 }
75817590
75827591 static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_runtime_pm.c+3−0
@@ -590,6 +590,9 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm) · 589 unmodified lines
590590 pm_runtime_use_autosuspend(kdev);
591591 }
592592
593+ /* Enable by default */
594+ pm_runtime_allow(kdev);
595+
593596 /*
594597 * The core calls the driver load handler with an RPM reference held.
595598 * We drop that here and will reacquire it during unloading in
drivers/gpu/drm/i915/intel_uncore.c+1−1
@@ -22,11 +22,11 @@ · 21 unmodified lines
2222 */
2323
2424 #include <linux/pm_runtime.h>
25−#include <asm/iosf_mbi.h>
2625
2726 #include "gt/intel_lrc_reg.h" /* for shadow reg list */
2827
2928 #include "i915_drv.h"
29+#include "i915_iosf_mbi.h"
3030 #include "i915_trace.h"
3131 #include "i915_vgpu.h"
3232 #include "intel_pm.h"
drivers/gpu/drm/i915/pxp/intel_pxp_session.c+2−1
@@ -3,7 +3,8 @@ · 2 unmodified lines
33 * Copyright(c) 2020, Intel Corporation. All rights reserved.
44 */
55
6−#include "drm/i915_drm.h"
6+#include <drm/i915_drm.h>
7+
78 #include "i915_drv.h"
89
910 #include "intel_pxp.h"
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c+4−2
@@ -4,8 +4,10 @@ · 3 unmodified lines
44 */
55
66 #include <linux/component.h>
7−#include "drm/i915_pxp_tee_interface.h"
8−#include "drm/i915_component.h"
7+
8+#include <drm/i915_pxp_tee_interface.h>
9+#include <drm/i915_component.h>
10+
911 #include "i915_drv.h"
1012 #include "intel_pxp.h"
1113 #include "intel_pxp_session.h"
drivers/gpu/drm/i915/vlv_sideband.c+1−2
@@ -3,9 +3,8 @@ · 2 unmodified lines
33 * Copyright © 2013-2021 Intel Corporation
44 */
55
6−#include <asm/iosf_mbi.h>
7−
86 #include "i915_drv.h"
7+#include "i915_iosf_mbi.h"
98 #include "vlv_sideband.h"
109
1110 /*
include/drm/intel-gtt.h+5−3
@@ -4,9 +4,11 @@ · 3 unmodified lines
44 #ifndef _DRM_INTEL_GTT_H
55 #define _DRM_INTEL_GTT_H
66
7−#include <linux/agp_backend.h>
8−#include <linux/intel-iommu.h>
9−#include <linux/kernel.h>
7+#include <linux/types.h>
8+
9+struct agp_bridge_data;
10+struct pci_dev;
11+struct sg_table;
1012
1113 void intel_gtt_get(u64 *gtt_total,
1214 phys_addr_t *mappable_base,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t