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)
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/kernel.h> |
| 21 | 21 | #include <linux/pagemap.h> |
| 22 | 22 | #include <linux/agp_backend.h> |
| 23 | +#include <linux/intel-iommu.h> | |
| 23 | 24 | #include <linux/delay.h> |
| 24 | 25 | #include <asm/smp.h> |
| 25 | 26 | #include "agp.h" |
| @@ -21,7 +21,7 @@ config DRM_I915 · 20 unmodified lines | ||
| 21 | 21 | select ACPI_VIDEO if ACPI |
| 22 | 22 | select ACPI_BUTTON if ACPI |
| 23 | 23 | select SYNC_FILE |
| 24 | − select IOSF_MBI | |
| 24 | + select IOSF_MBI if X86 | |
| 25 | 25 | select CRC32 |
| 26 | 26 | select SND_HDA_I915 if SND_HDA_CORE |
| 27 | 27 | select CEC_CORE if CEC_NOTIFIER |
| @@ -30,7 +30,7 @@ subdir-ccflags-y += -I$(srctree)/$(src) · 29 unmodified lines | ||
| 30 | 30 | # Please keep these build lists sorted! |
| 31 | 31 | |
| 32 | 32 | # core driver code |
| 33 | −i915-y += i915_drv.o \ | |
| 33 | +i915-y += i915_driver.o \ | |
| 34 | 34 | i915_config.o \ |
| 35 | 35 | i915_irq.o \ |
| 36 | 36 | i915_getparam.o \ |
| @@ -226,6 +226,8 @@ i915-y += \ · 189 unmodified lines | ||
| 226 | 226 | display/intel_hotplug.o \ |
| 227 | 227 | display/intel_lpe_audio.o \ |
| 228 | 228 | display/intel_overlay.o \ |
| 229 | + display/intel_pch_display.o \ | |
| 230 | + display/intel_pch_refclk.o \ | |
| 229 | 231 | display/intel_plane_initial.o \ |
| 230 | 232 | display/intel_psr.o \ |
| 231 | 233 | display/intel_quirks.o \ |
| @@ -60,22 +60,11 @@ static const u32 vlv_primary_formats[] = { · 59 unmodified lines | ||
| 60 | 60 | DRM_FORMAT_XBGR16161616F, |
| 61 | 61 | }; |
| 62 | 62 | |
| 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 | − | |
| 69 | 63 | static bool i8xx_plane_format_mod_supported(struct drm_plane *_plane, |
| 70 | 64 | u32 format, u64 modifier) |
| 71 | 65 | { |
| 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)) | |
| 77 | 67 | return false; |
| 78 | − } | |
| 79 | 68 | |
| 80 | 69 | switch (format) { |
| 81 | 70 | case DRM_FORMAT_C8: |
| @@ -92,13 +81,8 @@ static bool i8xx_plane_format_mod_supported(struct drm_plane *_plane, · 10 unmodified lines | ||
| 92 | 81 | static bool i965_plane_format_mod_supported(struct drm_plane *_plane, |
| 93 | 82 | u32 format, u64 modifier) |
| 94 | 83 | { |
| 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)) | |
| 100 | 85 | return false; |
| 101 | − } | |
| 102 | 86 | |
| 103 | 87 | switch (format) { |
| 104 | 88 | case DRM_FORMAT_C8: |
| @@ -272,7 +256,7 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) · 167 unmodified lines | ||
| 272 | 256 | u32 alignment = intel_surf_alignment(fb, 0); |
| 273 | 257 | int cpp = fb->format->cpp[0]; |
| 274 | 258 | |
| 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) { | |
| 276 | 260 | if (offset == 0) { |
| 277 | 261 | drm_dbg_kms(&dev_priv->drm, |
| 278 | 262 | "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 | ||
| 418 | 402 | return DIV_ROUND_UP(pixel_rate * num, den); |
| 419 | 403 | } |
| 420 | 404 | |
| 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) | |
| 424 | 408 | { |
| 425 | 409 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 426 | 410 | 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); | |
| 434 | 411 | 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; | |
| 446 | 412 | |
| 447 | 413 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
| 448 | 414 | |
| 449 | 415 | 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); | |
| 451 | 417 | |
| 452 | 418 | 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 | + | |
| 453 | 424 | /* |
| 454 | 425 | * PLANE_A doesn't actually have a full window |
| 455 | 426 | * 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 | ||
| 459 | 430 | (crtc_y << 16) | crtc_x); |
| 460 | 431 | intel_de_write_fw(dev_priv, DSPSIZE(i9xx_plane), |
| 461 | 432 | ((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 | + | |
| 463 | 466 | intel_de_write_fw(dev_priv, PRIMPOS(i9xx_plane), |
| 464 | 467 | (crtc_y << 16) | crtc_x); |
| 465 | 468 | 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 | ||
| 493 | 496 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 494 | 497 | } |
| 495 | 498 | |
| 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) | |
| 498 | 515 | { |
| 499 | 516 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 500 | 517 | 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 | ||
| 768 | 785 | struct intel_plane *plane; |
| 769 | 786 | const struct drm_plane_funcs *plane_funcs; |
| 770 | 787 | unsigned int supported_rotations; |
| 788 | + const u64 *modifiers; | |
| 771 | 789 | const u32 *formats; |
| 772 | 790 | int num_formats; |
| 773 | 791 | int ret, zpos; |
| @@ -789,12 +807,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 15 unmodified lines | ||
| 789 | 807 | plane->id = PLANE_PRIMARY; |
| 790 | 808 | plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id); |
| 791 | 809 | |
| 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; | |
| 798 | 814 | |
| 799 | 815 | if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { |
| 800 | 816 | formats = vlv_primary_formats; |
| @@ -851,8 +867,13 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 50 unmodified lines | ||
| 851 | 867 | plane->max_stride = ilk_primary_max_stride; |
| 852 | 868 | } |
| 853 | 869 | |
| 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; | |
| 856 | 877 | plane->get_hw_state = i9xx_plane_get_hw_state; |
| 857 | 878 | plane->check_plane = i9xx_plane_check; |
| 858 | 879 | |
| @@ -875,21 +896,26 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) · 16 unmodified lines | ||
| 875 | 896 | plane->disable_flip_done = ilk_primary_disable_flip_done; |
| 876 | 897 | } |
| 877 | 898 | |
| 899 | + modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_TILING_X); | |
| 900 | + | |
| 878 | 901 | if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv)) |
| 879 | 902 | ret = drm_universal_plane_init(&dev_priv->drm, &plane->base, |
| 880 | 903 | 0, plane_funcs, |
| 881 | 904 | formats, num_formats, |
| 882 | − i9xx_format_modifiers, | |
| 905 | + modifiers, | |
| 883 | 906 | DRM_PLANE_TYPE_PRIMARY, |
| 884 | 907 | "primary %c", pipe_name(pipe)); |
| 885 | 908 | else |
| 886 | 909 | ret = drm_universal_plane_init(&dev_priv->drm, &plane->base, |
| 887 | 910 | 0, plane_funcs, |
| 888 | 911 | formats, num_formats, |
| 889 | − i9xx_format_modifiers, | |
| 912 | + modifiers, | |
| 890 | 913 | DRM_PLANE_TYPE_PRIMARY, |
| 891 | 914 | "plane %c", |
| 892 | 915 | plane_name(plane->i9xx_plane)); |
| 916 | + | |
| 917 | + kfree(modifiers); | |
| 918 | + | |
| 893 | 919 | if (ret) |
| 894 | 920 | goto fail; |
| 895 | 921 | |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <drm/drm_atomic_helper.h> |
| 29 | 29 | #include <drm/drm_mipi_dsi.h> |
| 30 | 30 | |
| 31 | +#include "icl_dsi.h" | |
| 31 | 32 | #include "intel_atomic.h" |
| 32 | 33 | #include "intel_backlight.h" |
| 33 | 34 | #include "intel_combo_phy.h" |
| @@ -36,6 +37,7 @@ · 2 unmodified lines | ||
| 36 | 37 | #include "intel_ddi.h" |
| 37 | 38 | #include "intel_de.h" |
| 38 | 39 | #include "intel_dsi.h" |
| 40 | +#include "intel_dsi_vbt.h" | |
| 39 | 41 | #include "intel_panel.h" |
| 40 | 42 | #include "intel_vdsc.h" |
| 41 | 43 | #include "skl_scaler.h" |
| @@ -183,6 +185,8 @@ static int dsi_send_pkt_hdr(struct intel_dsi_host *host, · 141 unmodified lines | ||
| 183 | 185 | |
| 184 | 186 | if (enable_lpdt) |
| 185 | 187 | tmp |= LP_DATA_TRANSFER; |
| 188 | + else | |
| 189 | + tmp &= ~LP_DATA_TRANSFER; | |
| 186 | 190 | |
| 187 | 191 | tmp &= ~(PARAM_WC_MASK | VC_MASK | DT_MASK); |
| 188 | 192 | 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 | ||
| 1226 | 1230 | /* step5: program and powerup panel */ |
| 1227 | 1231 | gen11_dsi_powerup_panel(encoder); |
| 1228 | 1232 | |
| 1229 | − intel_dsc_enable(encoder, pipe_config); | |
| 1233 | + intel_dsc_dsi_pps_write(encoder, pipe_config); | |
| 1234 | + | |
| 1235 | + intel_dsc_enable(pipe_config); | |
| 1230 | 1236 | |
| 1231 | 1237 | /* step6c: configure transcoder timings */ |
| 1232 | 1238 | 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 | ||
| 1623 | 1629 | /* FIXME: initialize from VBT */ |
| 1624 | 1630 | vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; |
| 1625 | 1631 | |
| 1626 | − ret = intel_dsc_compute_params(encoder, crtc_state); | |
| 1632 | + ret = intel_dsc_compute_params(crtc_state); | |
| 1627 | 1633 | if (ret) |
| 1628 | 1634 | return ret; |
| 1629 | 1635 | |
| @@ -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__ */ | |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | #include "intel_atomic_plane.h" |
| 40 | 40 | #include "intel_cdclk.h" |
| 41 | 41 | #include "intel_display_types.h" |
| 42 | +#include "intel_fb.h" | |
| 42 | 43 | #include "intel_fb_pin.h" |
| 43 | 44 | #include "intel_pm.h" |
| 44 | 45 | #include "intel_sprite.h" |
| @@ -469,31 +470,72 @@ skl_next_plane_to_commit(struct intel_atomic_state *state, · 424 unmodified lines | ||
| 469 | 470 | return NULL; |
| 470 | 471 | } |
| 471 | 472 | |
| 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) | |
| 475 | 476 | { |
| 476 | 477 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); |
| 477 | 478 | |
| 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); | |
| 479 | 492 | |
| 480 | 493 | if (crtc_state->uapi.async_flip && plane->async_flip) |
| 481 | 494 | plane->async_flip(plane, crtc_state, plane_state, true); |
| 482 | 495 | else |
| 483 | − plane->update_plane(plane, crtc_state, plane_state); | |
| 496 | + plane->update_arm(plane, crtc_state, plane_state); | |
| 484 | 497 | } |
| 485 | 498 | |
| 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) | |
| 488 | 501 | { |
| 489 | 502 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); |
| 490 | 503 | |
| 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); | |
| 493 | 506 | } |
| 494 | 507 | |
| 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) | |
| 497 | 539 | { |
| 498 | 540 | struct intel_crtc_state *old_crtc_state = |
| 499 | 541 | 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 | ||
| 515 | 557 | struct intel_plane_state *new_plane_state = |
| 516 | 558 | intel_atomic_get_new_plane_state(state, plane); |
| 517 | 559 | |
| 560 | + /* | |
| 561 | + * TODO: for mailbox updates intel_plane_update_noarm() | |
| 562 | + * would have to be called here as well. | |
| 563 | + */ | |
| 518 | 564 | 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); | |
| 524 | 569 | } |
| 525 | 570 | } |
| 526 | 571 | |
| 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) | |
| 529 | 574 | { |
| 530 | 575 | struct intel_crtc_state *new_crtc_state = |
| 531 | 576 | 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 | ||
| 539 | 584 | !(update_mask & BIT(plane->id))) |
| 540 | 585 | continue; |
| 541 | 586 | |
| 587 | + /* | |
| 588 | + * TODO: for mailbox updates intel_plane_update_noarm() | |
| 589 | + * would have to be called here as well. | |
| 590 | + */ | |
| 542 | 591 | 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); | |
| 544 | 593 | else |
| 545 | − intel_disable_plane(plane, new_crtc_state); | |
| 594 | + intel_plane_disable_arm(plane, new_crtc_state); | |
| 546 | 595 | } |
| 547 | 596 | } |
| 548 | 597 | |
| @@ -30,20 +30,25 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, · 29 unmodified lines | ||
| 30 | 30 | struct intel_crtc *crtc); |
| 31 | 31 | void intel_plane_copy_hw_state(struct intel_plane_state *plane_state, |
| 32 | 32 | 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); | |
| 38 | 41 | struct intel_plane *intel_plane_alloc(void); |
| 39 | 42 | void intel_plane_free(struct intel_plane *plane); |
| 40 | 43 | struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane); |
| 41 | 44 | void intel_plane_destroy_state(struct drm_plane *plane, |
| 42 | 45 | 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); | |
| 47 | 52 | int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state, |
| 48 | 53 | struct intel_crtc_state *crtc_state, |
| 49 | 54 | const struct intel_plane_state *old_plane_state, |
| @@ -62,6 +62,15 @@ · 61 unmodified lines | ||
| 62 | 62 | * struct &i915_audio_component_audio_ops @audio_ops is called from i915 driver. |
| 63 | 63 | */ |
| 64 | 64 | |
| 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 | + | |
| 65 | 74 | /* DP N/M table */ |
| 66 | 75 | #define LC_810M 810000 |
| 67 | 76 | #define LC_540M 540000 |
| @@ -388,7 +397,7 @@ hsw_dp_audio_config_update(struct intel_encoder *encoder, · 320 unmodified lines | ||
| 388 | 397 | const struct intel_crtc_state *crtc_state) |
| 389 | 398 | { |
| 390 | 399 | 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; | |
| 392 | 401 | enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; |
| 393 | 402 | enum port port = encoder->port; |
| 394 | 403 | const struct dp_aud_n_m *nm; |
| @@ -436,7 +445,7 @@ hsw_hdmi_audio_config_update(struct intel_encoder *encoder, · 41 unmodified lines | ||
| 436 | 445 | const struct intel_crtc_state *crtc_state) |
| 437 | 446 | { |
| 438 | 447 | 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; | |
| 440 | 449 | enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; |
| 441 | 450 | enum port port = encoder->port; |
| 442 | 451 | int n, rate; |
| @@ -494,7 +503,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder, · 51 unmodified lines | ||
| 494 | 503 | drm_dbg_kms(&dev_priv->drm, "Disable audio codec on transcoder %s\n", |
| 495 | 504 | transcoder_name(cpu_transcoder)); |
| 496 | 505 | |
| 497 | − mutex_lock(&dev_priv->av_mutex); | |
| 506 | + mutex_lock(&dev_priv->audio.mutex); | |
| 498 | 507 | |
| 499 | 508 | /* Disable timestamps */ |
| 500 | 509 | 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 | ||
| 512 | 521 | tmp &= ~AUDIO_OUTPUT_ENABLE(cpu_transcoder); |
| 513 | 522 | intel_de_write(dev_priv, HSW_AUD_PIN_ELD_CP_VLD, tmp); |
| 514 | 523 | |
| 515 | − mutex_unlock(&dev_priv->av_mutex); | |
| 524 | + mutex_unlock(&dev_priv->audio.mutex); | |
| 516 | 525 | } |
| 517 | 526 | |
| 518 | 527 | 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 | ||
| 641 | 650 | "Enable audio codec on transcoder %s, %u bytes ELD\n", |
| 642 | 651 | transcoder_name(cpu_transcoder), drm_eld_size(eld)); |
| 643 | 652 | |
| 644 | − mutex_lock(&dev_priv->av_mutex); | |
| 653 | + mutex_lock(&dev_priv->audio.mutex); | |
| 645 | 654 | |
| 646 | 655 | /* Enable Audio WA for 4k DSC usecases */ |
| 647 | 656 | 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 | ||
| 679 | 688 | /* Enable timestamps */ |
| 680 | 689 | hsw_audio_config_update(encoder, crtc_state); |
| 681 | 690 | |
| 682 | − mutex_unlock(&dev_priv->av_mutex); | |
| 691 | + mutex_unlock(&dev_priv->audio.mutex); | |
| 683 | 692 | } |
| 684 | 693 | |
| 685 | 694 | 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 | ||
| 826 | 835 | const struct drm_connector_state *conn_state) |
| 827 | 836 | { |
| 828 | 837 | 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; | |
| 830 | 839 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); |
| 831 | 840 | struct drm_connector *connector = conn_state->connector; |
| 832 | 841 | const struct drm_display_mode *adjusted_mode = |
| @@ -848,17 +857,17 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, · 15 unmodified lines | ||
| 848 | 857 | |
| 849 | 858 | connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2; |
| 850 | 859 | |
| 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, | |
| 853 | 862 | crtc_state, |
| 854 | 863 | conn_state); |
| 855 | 864 | |
| 856 | − mutex_lock(&dev_priv->av_mutex); | |
| 865 | + mutex_lock(&dev_priv->audio.mutex); | |
| 857 | 866 | encoder->audio_connector = connector; |
| 858 | 867 | |
| 859 | 868 | /* 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); | |
| 862 | 871 | |
| 863 | 872 | if (acomp && acomp->base.audio_ops && |
| 864 | 873 | acomp->base.audio_ops->pin_eld_notify) { |
| @@ -888,20 +897,20 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, · 23 unmodified lines | ||
| 888 | 897 | const struct drm_connector_state *old_conn_state) |
| 889 | 898 | { |
| 890 | 899 | 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; | |
| 892 | 901 | struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); |
| 893 | 902 | enum port port = encoder->port; |
| 894 | 903 | enum pipe pipe = crtc->pipe; |
| 895 | 904 | |
| 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, | |
| 898 | 907 | old_crtc_state, |
| 899 | 908 | old_conn_state); |
| 900 | 909 | |
| 901 | − mutex_lock(&dev_priv->av_mutex); | |
| 910 | + mutex_lock(&dev_priv->audio.mutex); | |
| 902 | 911 | 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); | |
| 905 | 914 | |
| 906 | 915 | if (acomp && acomp->base.audio_ops && |
| 907 | 916 | acomp->base.audio_ops->pin_eld_notify) { |
| @@ -931,19 +940,53 @@ static const struct intel_audio_funcs hsw_audio_funcs = { · 23 unmodified lines | ||
| 931 | 940 | }; |
| 932 | 941 | |
| 933 | 942 | /** |
| 934 | − * intel_init_audio_hooks - Set up chip specific audio hooks | |
| 943 | + * intel_audio_hooks_init - Set up chip specific audio hooks | |
| 935 | 944 | * @dev_priv: device private |
| 936 | 945 | */ |
| 937 | −void intel_init_audio_hooks(struct drm_i915_private *dev_priv) | |
| 946 | +void intel_audio_hooks_init(struct drm_i915_private *dev_priv) | |
| 938 | 947 | { |
| 939 | 948 | if (IS_G4X(dev_priv)) { |
| 940 | − dev_priv->audio_funcs = &g4x_audio_funcs; | |
| 949 | + dev_priv->audio.funcs = &g4x_audio_funcs; | |
| 941 | 950 | } 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; | |
| 943 | 952 | } 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; | |
| 945 | 954 | } 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); | |
| 947 | 990 | } |
| 948 | 991 | } |
| 949 | 992 | |
| @@ -1014,13 +1057,13 @@ static unsigned long i915_audio_component_get_power(struct device *kdev) · 64 unmodified lines | ||
| 1014 | 1057 | |
| 1015 | 1058 | ret = intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO_PLAYBACK); |
| 1016 | 1059 | |
| 1017 | − if (dev_priv->audio_power_refcount++ == 0) { | |
| 1060 | + if (dev_priv->audio.power_refcount++ == 0) { | |
| 1018 | 1061 | if (DISPLAY_VER(dev_priv) >= 9) { |
| 1019 | 1062 | intel_de_write(dev_priv, AUD_FREQ_CNTRL, |
| 1020 | − dev_priv->audio_freq_cntrl); | |
| 1063 | + dev_priv->audio.freq_cntrl); | |
| 1021 | 1064 | drm_dbg_kms(&dev_priv->drm, |
| 1022 | 1065 | "restored AUD_FREQ_CNTRL to 0x%x\n", |
| 1023 | − dev_priv->audio_freq_cntrl); | |
| 1066 | + dev_priv->audio.freq_cntrl); | |
| 1024 | 1067 | } |
| 1025 | 1068 | |
| 1026 | 1069 | /* 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 | ||
| 1041 | 1084 | struct drm_i915_private *dev_priv = kdev_to_i915(kdev); |
| 1042 | 1085 | |
| 1043 | 1086 | /* 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) | |
| 1045 | 1088 | if (IS_GEMINILAKE(dev_priv)) |
| 1046 | 1089 | glk_force_audio_cdclk(dev_priv, false); |
| 1047 | 1090 | |
| @@ -1093,7 +1136,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) · 45 unmodified lines | ||
| 1093 | 1136 | /* |
| 1094 | 1137 | * get the intel_encoder according to the parameter port and pipe |
| 1095 | 1138 | * 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], | |
| 1097 | 1140 | * when port is matched |
| 1098 | 1141 | * MST & (pipe < 0): this is invalid |
| 1099 | 1142 | * 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 | ||
| 1108 | 1151 | /* MST */ |
| 1109 | 1152 | if (pipe >= 0) { |
| 1110 | 1153 | 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))) | |
| 1112 | 1155 | return NULL; |
| 1113 | 1156 | |
| 1114 | − encoder = dev_priv->av_enc_map[pipe]; | |
| 1157 | + encoder = dev_priv->audio.encoder_map[pipe]; | |
| 1115 | 1158 | /* |
| 1116 | 1159 | * when bootup, audio driver may not know it is |
| 1117 | 1160 | * 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 | ||
| 1127 | 1170 | return NULL; |
| 1128 | 1171 | |
| 1129 | 1172 | for_each_pipe(dev_priv, pipe) { |
| 1130 | − encoder = dev_priv->av_enc_map[pipe]; | |
| 1173 | + encoder = dev_priv->audio.encoder_map[pipe]; | |
| 1131 | 1174 | if (encoder == NULL) |
| 1132 | 1175 | continue; |
| 1133 | 1176 | |
| @@ -1145,7 +1188,7 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, · 11 unmodified lines | ||
| 1145 | 1188 | int pipe, int rate) |
| 1146 | 1189 | { |
| 1147 | 1190 | 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; | |
| 1149 | 1192 | struct intel_encoder *encoder; |
| 1150 | 1193 | struct intel_crtc *crtc; |
| 1151 | 1194 | unsigned long cookie; |
| @@ -1155,7 +1198,7 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, · 3 unmodified lines | ||
| 1155 | 1198 | return 0; |
| 1156 | 1199 | |
| 1157 | 1200 | cookie = i915_audio_component_get_power(kdev); |
| 1158 | − mutex_lock(&dev_priv->av_mutex); | |
| 1201 | + mutex_lock(&dev_priv->audio.mutex); | |
| 1159 | 1202 | |
| 1160 | 1203 | /* 1. get the pipe */ |
| 1161 | 1204 | 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 | ||
| 1174 | 1217 | hsw_audio_config_update(encoder, crtc->config); |
| 1175 | 1218 | |
| 1176 | 1219 | unlock: |
| 1177 | − mutex_unlock(&dev_priv->av_mutex); | |
| 1220 | + mutex_unlock(&dev_priv->audio.mutex); | |
| 1178 | 1221 | i915_audio_component_put_power(kdev, cookie); |
| 1179 | 1222 | return err; |
| 1180 | 1223 | } |
| @@ -1188,13 +1231,13 @@ static int i915_audio_component_get_eld(struct device *kdev, int port, · 7 unmodified lines | ||
| 1188 | 1231 | const u8 *eld; |
| 1189 | 1232 | int ret = -EINVAL; |
| 1190 | 1233 | |
| 1191 | − mutex_lock(&dev_priv->av_mutex); | |
| 1234 | + mutex_lock(&dev_priv->audio.mutex); | |
| 1192 | 1235 | |
| 1193 | 1236 | intel_encoder = get_saved_enc(dev_priv, port, pipe); |
| 1194 | 1237 | if (!intel_encoder) { |
| 1195 | 1238 | drm_dbg_kms(&dev_priv->drm, "Not valid for port %c\n", |
| 1196 | 1239 | port_name(port)); |
| 1197 | − mutex_unlock(&dev_priv->av_mutex); | |
| 1240 | + mutex_unlock(&dev_priv->audio.mutex); | |
| 1198 | 1241 | return ret; |
| 1199 | 1242 | } |
| 1200 | 1243 | |
| @@ -1206,7 +1249,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port, · 5 unmodified lines | ||
| 1206 | 1249 | memcpy(buf, eld, min(max_bytes, ret)); |
| 1207 | 1250 | } |
| 1208 | 1251 | |
| 1209 | − mutex_unlock(&dev_priv->av_mutex); | |
| 1252 | + mutex_unlock(&dev_priv->audio.mutex); | |
| 1210 | 1253 | return ret; |
| 1211 | 1254 | } |
| 1212 | 1255 | |
| @@ -1241,7 +1284,7 @@ static int i915_audio_component_bind(struct device *i915_kdev, · 28 unmodified lines | ||
| 1241 | 1284 | BUILD_BUG_ON(MAX_PORTS != I915_MAX_PORTS); |
| 1242 | 1285 | for (i = 0; i < ARRAY_SIZE(acomp->aud_sample_rate); i++) |
| 1243 | 1286 | acomp->aud_sample_rate[i] = 0; |
| 1244 | − dev_priv->audio_component = acomp; | |
| 1287 | + dev_priv->audio.component = acomp; | |
| 1245 | 1288 | drm_modeset_unlock_all(&dev_priv->drm); |
| 1246 | 1289 | |
| 1247 | 1290 | return 0; |
| @@ -1256,14 +1299,14 @@ static void i915_audio_component_unbind(struct device *i915_kdev, · 8 unmodified lines | ||
| 1256 | 1299 | drm_modeset_lock_all(&dev_priv->drm); |
| 1257 | 1300 | acomp->base.ops = NULL; |
| 1258 | 1301 | acomp->base.dev = NULL; |
| 1259 | − dev_priv->audio_component = NULL; | |
| 1302 | + dev_priv->audio.component = NULL; | |
| 1260 | 1303 | drm_modeset_unlock_all(&dev_priv->drm); |
| 1261 | 1304 | |
| 1262 | 1305 | device_link_remove(hda_kdev, i915_kdev); |
| 1263 | 1306 | |
| 1264 | − if (dev_priv->audio_power_refcount) | |
| 1307 | + if (dev_priv->audio.power_refcount) | |
| 1265 | 1308 | drm_err(&dev_priv->drm, "audio power refcount %d after unbind\n", |
| 1266 | − dev_priv->audio_power_refcount); | |
| 1309 | + dev_priv->audio.power_refcount); | |
| 1267 | 1310 | } |
| 1268 | 1311 | |
| 1269 | 1312 | 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 | ||
| 1327 | 1370 | drm_dbg_kms(&dev_priv->drm, "use AUD_FREQ_CNTRL of 0x%x (init value 0x%x)\n", |
| 1328 | 1371 | aud_freq, aud_freq_init); |
| 1329 | 1372 | |
| 1330 | − dev_priv->audio_freq_cntrl = aud_freq; | |
| 1373 | + dev_priv->audio.freq_cntrl = aud_freq; | |
| 1331 | 1374 | } |
| 1332 | 1375 | |
| 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; | |
| 1334 | 1380 | } |
| 1335 | 1381 | |
| 1336 | 1382 | /** |
| @@ -1342,11 +1388,11 @@ static void i915_audio_component_init(struct drm_i915_private *dev_priv) · 5 unmodified lines | ||
| 1342 | 1388 | */ |
| 1343 | 1389 | static void i915_audio_component_cleanup(struct drm_i915_private *dev_priv) |
| 1344 | 1390 | { |
| 1345 | − if (!dev_priv->audio_component_registered) | |
| 1391 | + if (!dev_priv->audio.component_registered) | |
| 1346 | 1392 | return; |
| 1347 | 1393 | |
| 1348 | 1394 | 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; | |
| 1350 | 1396 | } |
| 1351 | 1397 | |
| 1352 | 1398 | /** |
| @@ -1368,7 +1414,7 @@ void intel_audio_init(struct drm_i915_private *dev_priv) · 15 unmodified lines | ||
| 1368 | 1414 | */ |
| 1369 | 1415 | void intel_audio_deinit(struct drm_i915_private *dev_priv) |
| 1370 | 1416 | { |
| 1371 | − if ((dev_priv)->lpe_audio.platdev != NULL) | |
| 1417 | + if ((dev_priv)->audio.lpe.platdev != NULL) | |
| 1372 | 1418 | intel_lpe_audio_teardown(dev_priv); |
| 1373 | 1419 | else |
| 1374 | 1420 | i915_audio_component_cleanup(dev_priv); |
| @@ -11,13 +11,15 @@ struct drm_i915_private; · 10 unmodified lines | ||
| 11 | 11 | struct intel_crtc_state; |
| 12 | 12 | struct intel_encoder; |
| 13 | 13 | |
| 14 | −void intel_init_audio_hooks(struct drm_i915_private *dev_priv); | |
| 14 | +void intel_audio_hooks_init(struct drm_i915_private *dev_priv); | |
| 15 | 15 | void intel_audio_codec_enable(struct intel_encoder *encoder, |
| 16 | 16 | const struct intel_crtc_state *crtc_state, |
| 17 | 17 | const struct drm_connector_state *conn_state); |
| 18 | 18 | void intel_audio_codec_disable(struct intel_encoder *encoder, |
| 19 | 19 | const struct intel_crtc_state *old_crtc_state, |
| 20 | 20 | 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); | |
| 21 | 23 | void intel_audio_init(struct drm_i915_private *dev_priv); |
| 22 | 24 | void intel_audio_deinit(struct drm_i915_private *dev_priv); |
| 23 | 25 | |
| @@ -27,6 +27,9 @@ struct intel_qgv_info { · 26 unmodified lines | ||
| 27 | 27 | u8 num_points; |
| 28 | 28 | u8 num_psf_points; |
| 29 | 29 | u8 t_bl; |
| 30 | + u8 max_numchannels; | |
| 31 | + u8 channel_width; | |
| 32 | + u8 deinterleave; | |
| 30 | 33 | }; |
| 31 | 34 | |
| 32 | 35 | 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 | ||
| 42 | 45 | dclk_reference = 6; /* 6 * 16.666 MHz = 100 MHz */ |
| 43 | 46 | else |
| 44 | 47 | 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); | |
| 46 | 49 | |
| 47 | 50 | val = intel_uncore_read(&dev_priv->uncore, SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU); |
| 48 | 51 | 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 | ||
| 69 | 72 | int point) |
| 70 | 73 | { |
| 71 | 74 | u32 val = 0, val2 = 0; |
| 75 | + u16 dclk; | |
| 72 | 76 | int ret; |
| 73 | 77 | |
| 74 | 78 | 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 | ||
| 78 | 82 | if (ret) |
| 79 | 83 | return ret; |
| 80 | 84 | |
| 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); | |
| 82 | 87 | sp->t_rp = (val & 0xff0000) >> 16; |
| 83 | 88 | sp->t_rcd = (val & 0xff000000) >> 24; |
| 84 | 89 | |
| @@ -133,7 +138,8 @@ int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv, · 48 unmodified lines | ||
| 133 | 138 | } |
| 134 | 139 | |
| 135 | 140 | 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) | |
| 137 | 143 | { |
| 138 | 144 | const struct dram_info *dram_info = &dev_priv->dram_info; |
| 139 | 145 | int i, ret; |
| @@ -141,20 +147,44 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv, · 1 unmodified line | ||
| 141 | 147 | qi->num_points = dram_info->num_qgv_points; |
| 142 | 148 | qi->num_psf_points = dram_info->num_psf_gv_points; |
| 143 | 149 | |
| 144 | − if (DISPLAY_VER(dev_priv) == 12) | |
| 150 | + if (DISPLAY_VER(dev_priv) >= 12) | |
| 145 | 151 | switch (dram_info->type) { |
| 146 | 152 | 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; | |
| 148 | 157 | break; |
| 149 | 158 | 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; | |
| 151 | 178 | break; |
| 152 | 179 | default: |
| 153 | 180 | qi->t_bl = 16; |
| 181 | + qi->max_numchannels = 1; | |
| 154 | 182 | break; |
| 155 | 183 | } |
| 156 | − else if (DISPLAY_VER(dev_priv) == 11) | |
| 184 | + else if (DISPLAY_VER(dev_priv) == 11) { | |
| 157 | 185 | qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8; |
| 186 | + qi->max_numchannels = 1; | |
| 187 | + } | |
| 158 | 188 | |
| 159 | 189 | if (drm_WARN_ON(&dev_priv->drm, |
| 160 | 190 | 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 | ||
| 193 | 223 | return 0; |
| 194 | 224 | } |
| 195 | 225 | |
| 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 | − | |
| 202 | 226 | static int adl_calc_psf_bw(int clk) |
| 203 | 227 | { |
| 204 | 228 | /* |
| @@ -240,7 +264,7 @@ static const struct intel_sa_info tgl_sa_info = { · 35 unmodified lines | ||
| 240 | 264 | }; |
| 241 | 265 | |
| 242 | 266 | static const struct intel_sa_info rkl_sa_info = { |
| 243 | − .deburst = 16, | |
| 267 | + .deburst = 8, | |
| 244 | 268 | .deprogbwlimit = 20, /* GB/s */ |
| 245 | 269 | .displayrtids = 128, |
| 246 | 270 | .derating = 10, |
| @@ -265,35 +289,130 @@ static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel · 18 unmodified lines | ||
| 265 | 289 | struct intel_qgv_info qi = {}; |
| 266 | 290 | bool is_y_tile = true; /* assume y tile may be used */ |
| 267 | 291 | 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; | |
| 270 | 293 | int dclk_max; |
| 271 | 294 | int maxdebw; |
| 295 | + int num_groups = ARRAY_SIZE(dev_priv->max_bw); | |
| 272 | 296 | int i, ret; |
| 273 | 297 | |
| 274 | − ret = icl_get_qgv_points(dev_priv, &qi); | |
| 298 | + ret = icl_get_qgv_points(dev_priv, &qi, is_y_tile); | |
| 275 | 299 | if (ret) { |
| 276 | 300 | drm_dbg_kms(&dev_priv->drm, |
| 277 | 301 | "Failed to get memory subsystem information, ignoring bandwidth limits"); |
| 278 | 302 | return ret; |
| 279 | 303 | } |
| 280 | 304 | |
| 281 | − deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2); | |
| 282 | 305 | 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); | |
| 283 | 334 | |
| 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% */ | |
| 285 | 393 | |
| 286 | − maxdebw = min(sa->deprogbwlimit * 1000, | |
| 287 | − icl_calc_bw(dclk_max, 16, 1) * 6 / 10); /* 60% */ | |
| 288 | 394 | 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; | |
| 289 | 400 | |
| 290 | − for (i = 0; i < ARRAY_SIZE(dev_priv->max_bw); i++) { | |
| 401 | + for (i = 0; i < num_groups; i++) { | |
| 291 | 402 | struct intel_bw_info *bi = &dev_priv->max_bw[i]; |
| 403 | + struct intel_bw_info *bi_next; | |
| 292 | 404 | int clpchgroup; |
| 293 | 405 | int j; |
| 294 | 406 | |
| 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; | |
| 297 | 416 | |
| 298 | 417 | bi->num_qgv_points = qi.num_points; |
| 299 | 418 | 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 | ||
| 310 | 429 | */ |
| 311 | 430 | ct = max_t(int, sp->t_rc, sp->t_rp + sp->t_rcd + |
| 312 | 431 | (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); | |
| 314 | 433 | |
| 315 | 434 | bi->deratedbw[j] = min(maxdebw, |
| 316 | 435 | 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 | ||
| 329 | 448 | "BW%d / PSF GV %d: num_planes=%d bw=%u\n", |
| 330 | 449 | i, j, bi->num_planes, bi->psf_bw[j]); |
| 331 | 450 | } |
| 332 | − | |
| 333 | − if (bi->num_planes == 1) | |
| 334 | − break; | |
| 335 | 451 | } |
| 336 | 452 | |
| 337 | 453 | /* |
| @@ -395,6 +511,34 @@ static unsigned int icl_max_bw(struct drm_i915_private *dev_priv, · 57 unmodified lines | ||
| 395 | 511 | return 0; |
| 396 | 512 | } |
| 397 | 513 | |
| 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 | + | |
| 398 | 542 | static unsigned int adl_psf_bw(struct drm_i915_private *dev_priv, |
| 399 | 543 | int psf_gv_point) |
| 400 | 544 | { |
| @@ -412,13 +556,13 @@ void intel_bw_init_hw(struct drm_i915_private *dev_priv) · 11 unmodified lines | ||
| 412 | 556 | if (IS_DG2(dev_priv)) |
| 413 | 557 | dg2_get_bw_info(dev_priv); |
| 414 | 558 | 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); | |
| 416 | 560 | 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); | |
| 418 | 562 | 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); | |
| 420 | 564 | 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); | |
| 422 | 566 | else if (DISPLAY_VER(dev_priv) == 11) |
| 423 | 567 | icl_get_bw_info(dev_priv, &icl_sa_info); |
| 424 | 568 | } |
| @@ -746,7 +890,10 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 321 unmodified lines | ||
| 746 | 890 | for (i = 0; i < num_qgv_points; i++) { |
| 747 | 891 | unsigned int max_data_rate; |
| 748 | 892 | |
| 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); | |
| 750 | 897 | /* |
| 751 | 898 | * We need to know which qgv point gives us |
| 752 | 899 | * maximum bandwidth in order to disable SAGV |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/time.h> |
| 25 | 25 | |
| 26 | 26 | #include "intel_atomic.h" |
| 27 | +#include "intel_audio.h" | |
| 27 | 28 | #include "intel_bw.h" |
| 28 | 29 | #include "intel_cdclk.h" |
| 29 | 30 | #include "intel_de.h" |
| @@ -1975,6 +1976,8 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, · 1945 unmodified lines | ||
| 1975 | 1976 | intel_psr_pause(intel_dp); |
| 1976 | 1977 | } |
| 1977 | 1978 | |
| 1979 | + intel_audio_cdclk_change_pre(dev_priv); | |
| 1980 | + | |
| 1978 | 1981 | /* |
| 1979 | 1982 | * Lock aux/gmbus while we change cdclk in case those |
| 1980 | 1983 | * 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 | ||
| 2003 | 2006 | intel_psr_resume(intel_dp); |
| 2004 | 2007 | } |
| 2005 | 2008 | |
| 2009 | + intel_audio_cdclk_change_post(dev_priv); | |
| 2010 | + | |
| 2006 | 2011 | if (drm_WARN(&dev_priv->drm, |
| 2007 | 2012 | intel_cdclk_changed(&dev_priv->cdclk.hw, cdclk_config), |
| 2008 | 2013 | "cdclk state doesn't match!\n")) { |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "intel_de.h" |
| 27 | 27 | #include "intel_display_types.h" |
| 28 | 28 | #include "intel_dpll.h" |
| 29 | −#include "intel_dsi.h" | |
| 29 | +#include "vlv_dsi_pll.h" | |
| 30 | 30 | |
| 31 | 31 | #define CTM_COEFF_SIGN (1ULL << 63) |
| 32 | 32 | |
| @@ -552,8 +552,8 @@ static void i9xx_load_lut_8(struct intel_crtc *crtc, · 519 unmodified lines | ||
| 552 | 552 | lut = blob->data; |
| 553 | 553 | |
| 554 | 554 | 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])); | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | 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 | ||
| 576 | 576 | enum pipe pipe = crtc->pipe; |
| 577 | 577 | |
| 578 | 578 | 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])); | |
| 583 | 583 | } |
| 584 | 584 | |
| 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); | |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | 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 | ||
| 618 | 618 | lut = blob->data; |
| 619 | 619 | |
| 620 | 620 | 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])); | |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | 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 | ||
| 631 | 631 | enum pipe pipe = crtc->pipe; |
| 632 | 632 | |
| 633 | 633 | 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])); | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | 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 | ||
| 681 | 681 | const struct drm_color_lut *entry = |
| 682 | 682 | &lut[i * (lut_size - 1) / (hw_lut_size - 1)]; |
| 683 | 683 | |
| 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)); | |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /* |
| 690 | 690 | * Reset the index, otherwise it prevents the legacy palette to be |
| 691 | 691 | * written properly. |
| 692 | 692 | */ |
| 693 | − intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 693 | + intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /* 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 | ||
| 704 | 704 | int i, lut_size = drm_color_lut_size(blob); |
| 705 | 705 | enum pipe pipe = crtc->pipe; |
| 706 | 706 | |
| 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); | |
| 709 | 709 | |
| 710 | 710 | for (i = 0; i < hw_lut_size; i++) { |
| 711 | 711 | /* We discard half the user entries in split gamma mode */ |
| 712 | 712 | const struct drm_color_lut *entry = |
| 713 | 713 | &lut[i * (lut_size - 1) / (hw_lut_size - 1)]; |
| 714 | 714 | |
| 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)); | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /* |
| 720 | 720 | * Reset the index, otherwise it prevents the legacy palette to be |
| 721 | 721 | * written properly. |
| 722 | 722 | */ |
| 723 | − intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 723 | + intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | 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 | ||
| 821 | 821 | * ignore the index bits, so we need to reset it to index 0 |
| 822 | 822 | * separately. |
| 823 | 823 | */ |
| 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); | |
| 827 | 827 | |
| 828 | 828 | for (i = 0; i < lut_size; i++) { |
| 829 | 829 | /* |
| @@ -839,15 +839,15 @@ static void glk_load_degamma_lut(const struct intel_crtc_state *crtc_state) · 9 unmodified lines | ||
| 839 | 839 | * ToDo: Extend to max 7.0. Enable 32 bit input value |
| 840 | 840 | * as compared to just 16 to achieve this. |
| 841 | 841 | */ |
| 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); | |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | /* Clamp values > 1.0. */ |
| 847 | 847 | 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); | |
| 849 | 849 | |
| 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); | |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | 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 | ||
| 862 | 862 | * ignore the index bits, so we need to reset it to index 0 |
| 863 | 863 | * separately. |
| 864 | 864 | */ |
| 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); | |
| 868 | 868 | |
| 869 | 869 | for (i = 0; i < lut_size; i++) { |
| 870 | 870 | u32 v = (i << 16) / (lut_size - 1); |
| 871 | 871 | |
| 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); | |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | /* Clamp values > 1.0. */ |
| 876 | 876 | 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); | |
| 878 | 878 | |
| 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); | |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | 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 | ||
| 1071 | 1071 | enum pipe pipe = crtc->pipe; |
| 1072 | 1072 | |
| 1073 | 1073 | 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])); | |
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | |
| @@ -1105,10 +1105,10 @@ static void chv_load_cgm_gamma(struct intel_crtc *crtc, · 24 unmodified lines | ||
| 1105 | 1105 | enum pipe pipe = crtc->pipe; |
| 1106 | 1106 | |
| 1107 | 1107 | 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])); | |
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| @@ -1131,8 +1131,8 @@ static void chv_load_luts(const struct intel_crtc_state *crtc_state) · 16 unmodified lines | ||
| 1131 | 1131 | else |
| 1132 | 1132 | i965_load_luts(crtc_state); |
| 1133 | 1133 | |
| 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); | |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | 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 | ||
| 1808 | 1808 | lut = blob->data; |
| 1809 | 1809 | |
| 1810 | 1810 | 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)); | |
| 1812 | 1812 | |
| 1813 | 1813 | i9xx_lut_8_pack(&lut[i], val); |
| 1814 | 1814 | } |
| @@ -1843,15 +1843,15 @@ static struct drm_property_blob *i965_read_lut_10p6(struct intel_crtc *crtc) · 28 unmodified lines | ||
| 1843 | 1843 | lut = blob->data; |
| 1844 | 1844 | |
| 1845 | 1845 | 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)); | |
| 1848 | 1848 | |
| 1849 | 1849 | i965_lut_10p6_pack(&lut[i], ldw, udw); |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 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))); | |
| 1855 | 1855 | |
| 1856 | 1856 | return blob; |
| 1857 | 1857 | } |
| @@ -1886,8 +1886,8 @@ static struct drm_property_blob *chv_read_cgm_gamma(struct intel_crtc *crtc) · 28 unmodified lines | ||
| 1886 | 1886 | lut = blob->data; |
| 1887 | 1887 | |
| 1888 | 1888 | 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)); | |
| 1891 | 1891 | |
| 1892 | 1892 | chv_cgm_gamma_pack(&lut[i], ldw, udw); |
| 1893 | 1893 | } |
| @@ -1922,7 +1922,7 @@ static struct drm_property_blob *ilk_read_lut_8(struct intel_crtc *crtc) · 28 unmodified lines | ||
| 1922 | 1922 | lut = blob->data; |
| 1923 | 1923 | |
| 1924 | 1924 | 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)); | |
| 1926 | 1926 | |
| 1927 | 1927 | i9xx_lut_8_pack(&lut[i], val); |
| 1928 | 1928 | } |
| @@ -1947,7 +1947,7 @@ static struct drm_property_blob *ilk_read_lut_10(struct intel_crtc *crtc) · 18 unmodified lines | ||
| 1947 | 1947 | lut = blob->data; |
| 1948 | 1948 | |
| 1949 | 1949 | 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)); | |
| 1951 | 1951 | |
| 1952 | 1952 | ilk_lut_10_pack(&lut[i], val); |
| 1953 | 1953 | } |
| @@ -1999,16 +1999,16 @@ static struct drm_property_blob *bdw_read_lut_10(struct intel_crtc *crtc, · 45 unmodified lines | ||
| 1999 | 1999 | |
| 2000 | 2000 | lut = blob->data; |
| 2001 | 2001 | |
| 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); | |
| 2004 | 2004 | |
| 2005 | 2005 | 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)); | |
| 2007 | 2007 | |
| 2008 | 2008 | ilk_lut_10_pack(&lut[i], val); |
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | − intel_de_write(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 2011 | + intel_de_write_fw(dev_priv, PREC_PAL_INDEX(pipe), 0); | |
| 2012 | 2012 | |
| 2013 | 2013 | return blob; |
| 2014 | 2014 | } |
| @@ -2050,17 +2050,17 @@ icl_read_lut_multi_segment(struct intel_crtc *crtc) · 35 unmodified lines | ||
| 2050 | 2050 | |
| 2051 | 2051 | lut = blob->data; |
| 2052 | 2052 | |
| 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); | |
| 2055 | 2055 | |
| 2056 | 2056 | 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)); | |
| 2059 | 2059 | |
| 2060 | 2060 | icl_lut_multi_seg_pack(&lut[i], ldw, udw); |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 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); | |
| 2064 | 2064 | |
| 2065 | 2065 | /* |
| 2066 | 2066 | * FIXME readouts from PAL_PREC_DATA register aren't giving |
| @@ -301,7 +301,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv, · 300 unmodified lines | ||
| 301 | 301 | |
| 302 | 302 | val = intel_de_read(dev_priv, ICL_PORT_CL_DW10(phy)); |
| 303 | 303 | val &= ~PWR_DOWN_LN_MASK; |
| 304 | − val |= lane_mask << PWR_DOWN_LN_SHIFT; | |
| 304 | + val |= lane_mask; | |
| 305 | 305 | intel_de_write(dev_priv, ICL_PORT_CL_DW10(phy), val); |
| 306 | 306 | } |
| 307 | 307 | |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #include "intel_fifo_underrun.h" |
| 46 | 46 | #include "intel_gmbus.h" |
| 47 | 47 | #include "intel_hotplug.h" |
| 48 | +#include "intel_pch_display.h" | |
| 48 | 49 | |
| 49 | 50 | /* Here's the desired hotplug mode */ |
| 50 | 51 | #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 | ||
| 143 | 144 | static void hsw_crt_get_config(struct intel_encoder *encoder, |
| 144 | 145 | struct intel_crtc_state *pipe_config) |
| 145 | 146 | { |
| 146 | − struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | |
| 147 | + lpt_pch_get_config(pipe_config); | |
| 147 | 148 | |
| 148 | 149 | hsw_ddi_get_config(encoder, pipe_config); |
| 149 | 150 | |
| @@ -152,8 +153,6 @@ static void hsw_crt_get_config(struct intel_encoder *encoder, · 2 unmodified lines | ||
| 152 | 153 | DRM_MODE_FLAG_PVSYNC | |
| 153 | 154 | DRM_MODE_FLAG_NVSYNC); |
| 154 | 155 | 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); | |
| 157 | 156 | } |
| 158 | 157 | |
| 159 | 158 | /* 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 | ||
| 247 | 246 | const struct intel_crtc_state *old_crtc_state, |
| 248 | 247 | const struct drm_connector_state *old_conn_state) |
| 249 | 248 | { |
| 249 | + struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); | |
| 250 | 250 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 251 | 251 | |
| 252 | 252 | 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 | ||
| 261 | 261 | |
| 262 | 262 | pch_post_disable_crt(state, encoder, old_crtc_state, old_conn_state); |
| 263 | 263 | |
| 264 | − lpt_disable_pch_transcoder(dev_priv); | |
| 265 | − lpt_disable_iclkip(dev_priv); | |
| 264 | + lpt_pch_disable(state, crtc); | |
| 266 | 265 | |
| 267 | − intel_ddi_fdi_post_disable(state, encoder, old_crtc_state, old_conn_state); | |
| 266 | + hsw_fdi_disable(encoder); | |
| 268 | 267 | |
| 269 | 268 | drm_WARN_ON(&dev_priv->drm, !old_crtc_state->has_pch_encoder); |
| 270 | 269 | |
| @@ -316,7 +315,7 @@ static void hsw_enable_crt(struct intel_atomic_state *state, · 45 unmodified lines | ||
| 316 | 315 | |
| 317 | 316 | intel_enable_transcoder(crtc_state); |
| 318 | 317 | |
| 319 | − lpt_pch_enable(crtc_state); | |
| 318 | + lpt_pch_enable(state, crtc); | |
| 320 | 319 | |
| 321 | 320 | intel_crtc_vblank_on(crtc_state); |
| 322 | 321 | |
| @@ -3,16 +3,18 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright © 2020 Intel Corporation |
| 4 | 4 | */ |
| 5 | 5 | #include <linux/kernel.h> |
| 6 | +#include <linux/pm_qos.h> | |
| 6 | 7 | #include <linux/slab.h> |
| 7 | 8 | |
| 8 | 9 | #include <drm/drm_atomic_helper.h> |
| 9 | 10 | #include <drm/drm_fourcc.h> |
| 10 | 11 | #include <drm/drm_plane.h> |
| 11 | 12 | #include <drm/drm_plane_helper.h> |
| 13 | +#include <drm/drm_vblank_work.h> | |
| 12 | 14 | |
| 13 | 15 | #include "i915_trace.h" |
| 14 | 16 | #include "i915_vgpu.h" |
| 15 | − | |
| 17 | +#include "icl_dsi.h" | |
| 16 | 18 | #include "intel_atomic.h" |
| 17 | 19 | #include "intel_atomic_plane.h" |
| 18 | 20 | #include "intel_color.h" |
| @@ -167,6 +169,8 @@ static void intel_crtc_destroy(struct drm_crtc *_crtc) · 148 unmodified lines | ||
| 167 | 169 | { |
| 168 | 170 | struct intel_crtc *crtc = to_intel_crtc(_crtc); |
| 169 | 171 | |
| 172 | + cpu_latency_qos_remove_request(&crtc->vblank_pm_qos); | |
| 173 | + | |
| 170 | 174 | drm_crtc_cleanup(&crtc->base); |
| 171 | 175 | kfree(crtc); |
| 172 | 176 | } |
| @@ -344,6 +348,8 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe) · 171 unmodified lines | ||
| 344 | 348 | |
| 345 | 349 | intel_crtc_crc_init(crtc); |
| 346 | 350 | |
| 351 | + cpu_latency_qos_add_request(&crtc->vblank_pm_qos, PM_QOS_DEFAULT_VALUE); | |
| 352 | + | |
| 347 | 353 | drm_WARN_ON(&dev_priv->drm, drm_crtc_index(&crtc->base) != crtc->pipe); |
| 348 | 354 | |
| 349 | 355 | return 0; |
| @@ -354,6 +360,65 @@ fail: · 4 unmodified lines | ||
| 354 | 360 | return ret; |
| 355 | 361 | } |
| 356 | 362 | |
| 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 | + | |
| 357 | 422 | int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, |
| 358 | 423 | int usecs) |
| 359 | 424 | { |
| @@ -387,7 +452,7 @@ static int intel_mode_vblank_start(const struct drm_display_mode *mode) · 27 unmodified lines | ||
| 387 | 452 | * until a subsequent call to intel_pipe_update_end(). That is done to |
| 388 | 453 | * avoid random delays. |
| 389 | 454 | */ |
| 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) | |
| 391 | 456 | { |
| 392 | 457 | struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); |
| 393 | 458 | 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 | ||
| 402 | 467 | if (new_crtc_state->uapi.async_flip) |
| 403 | 468 | return; |
| 404 | 469 | |
| 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 { | |
| 408 | 479 | vblank_start = intel_mode_vblank_start(adjusted_mode); |
| 480 | + } | |
| 409 | 481 | |
| 410 | 482 | /* FIXME needs to be calibrated sensibly */ |
| 411 | 483 | 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 | ||
| 554 | 626 | * Would be slightly nice to just grab the vblank count and arm the |
| 555 | 627 | * event outside of the critical section - the spinlock might spin for a |
| 556 | 628 | * 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) { | |
| 558 | 634 | drm_WARN_ON(&dev_priv->drm, |
| 559 | 635 | drm_crtc_vblank_get(&crtc->base) != 0); |
| 560 | 636 | |
| @@ -566,11 +642,24 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) · 5 unmodified lines | ||
| 566 | 642 | new_crtc_state->uapi.event = NULL; |
| 567 | 643 | } |
| 568 | 644 | |
| 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 | + */ | |
| 572 | 659 | intel_vrr_send_push(new_crtc_state); |
| 573 | 660 | |
| 661 | + local_irq_enable(); | |
| 662 | + | |
| 574 | 663 | if (intel_vgpu_active(dev_priv)) |
| 575 | 664 | return; |
| 576 | 665 | |
| @@ -9,10 +9,14 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/types.h> |
| 10 | 10 | |
| 11 | 11 | enum pipe; |
| 12 | +struct drm_display_mode; | |
| 12 | 13 | struct drm_i915_private; |
| 14 | +struct intel_atomic_state; | |
| 13 | 15 | struct intel_crtc; |
| 14 | 16 | struct intel_crtc_state; |
| 15 | 17 | |
| 18 | +int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, | |
| 19 | + int usecs); | |
| 16 | 20 | u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state); |
| 17 | 21 | int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe); |
| 18 | 22 | 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 | ||
| 21 | 25 | u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc); |
| 22 | 26 | void intel_crtc_vblank_on(const struct intel_crtc_state *crtc_state); |
| 23 | 27 | 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); | |
| 24 | 31 | |
| 25 | 32 | #endif |
| @@ -28,11 +28,6 @@ static const u32 intel_cursor_formats[] = { · 27 unmodified lines | ||
| 28 | 28 | DRM_FORMAT_ARGB8888, |
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | −static const u64 cursor_format_modifiers[] = { | |
| 32 | − DRM_FORMAT_MOD_LINEAR, | |
| 33 | − DRM_FORMAT_MOD_INVALID | |
| 34 | −}; | |
| 35 | − | |
| 36 | 31 | static u32 intel_cursor_base(const struct intel_plane_state *plane_state) |
| 37 | 32 | { |
| 38 | 33 | 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 | ||
| 195 | 190 | { |
| 196 | 191 | return CURSOR_ENABLE | |
| 197 | 192 | CURSOR_FORMAT_ARGB | |
| 198 | − CURSOR_STRIDE(plane_state->view.color_plane[0].stride); | |
| 193 | + CURSOR_STRIDE(plane_state->view.color_plane[0].mapping_stride); | |
| 199 | 194 | } |
| 200 | 195 | |
| 201 | 196 | 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 | ||
| 234 | 229 | } |
| 235 | 230 | |
| 236 | 231 | 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]); | |
| 238 | 233 | |
| 239 | 234 | switch (fb->pitches[0]) { |
| 240 | 235 | case 256: |
| @@ -253,9 +248,10 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state, · 12 unmodified lines | ||
| 253 | 248 | return 0; |
| 254 | 249 | } |
| 255 | 250 | |
| 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) | |
| 259 | 255 | { |
| 260 | 256 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 261 | 257 | 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 | ||
| 298 | 294 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 299 | 295 | } |
| 300 | 296 | |
| 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) | |
| 303 | 299 | { |
| 304 | − i845_update_cursor(plane, crtc_state, NULL); | |
| 300 | + i845_cursor_update_arm(plane, crtc_state, NULL); | |
| 305 | 301 | } |
| 306 | 302 | |
| 307 | 303 | 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 | ||
| 455 | 451 | } |
| 456 | 452 | |
| 457 | 453 | 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]); | |
| 459 | 455 | |
| 460 | 456 | if (fb->pitches[0] != |
| 461 | 457 | 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 | ||
| 488 | 484 | return 0; |
| 489 | 485 | } |
| 490 | 486 | |
| 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) | |
| 494 | 491 | { |
| 495 | 492 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 496 | 493 | enum pipe pipe = plane->pipe; |
| @@ -562,10 +559,10 @@ static void i9xx_update_cursor(struct intel_plane *plane, · 65 unmodified lines | ||
| 562 | 559 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 563 | 560 | } |
| 564 | 561 | |
| 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) | |
| 567 | 564 | { |
| 568 | − i9xx_update_cursor(plane, crtc_state, NULL); | |
| 565 | + i9xx_cursor_update_arm(plane, crtc_state, NULL); | |
| 569 | 566 | } |
| 570 | 567 | |
| 571 | 568 | 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 | ||
| 605 | 602 | static bool intel_cursor_format_mod_supported(struct drm_plane *_plane, |
| 606 | 603 | u32 format, u64 modifier) |
| 607 | 604 | { |
| 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; | |
| 610 | 609 | } |
| 611 | 610 | |
| 612 | 611 | static int |
| @@ -717,10 +716,12 @@ intel_legacy_cursor_update(struct drm_plane *_plane, · 104 unmodified lines | ||
| 717 | 716 | */ |
| 718 | 717 | crtc_state->active_planes = new_crtc_state->active_planes; |
| 719 | 718 | |
| 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 | + } | |
| 724 | 725 | |
| 725 | 726 | intel_plane_unpin_fb(old_plane_state); |
| 726 | 727 | |
| @@ -754,6 +755,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 27 unmodified lines | ||
| 754 | 755 | { |
| 755 | 756 | struct intel_plane *cursor; |
| 756 | 757 | int ret, zpos; |
| 758 | + u64 *modifiers; | |
| 757 | 759 | |
| 758 | 760 | cursor = intel_plane_alloc(); |
| 759 | 761 | if (IS_ERR(cursor)) |
| @@ -766,14 +768,14 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 6 unmodified lines | ||
| 766 | 768 | |
| 767 | 769 | if (IS_I845G(dev_priv) || IS_I865G(dev_priv)) { |
| 768 | 770 | 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; | |
| 771 | 773 | cursor->get_hw_state = i845_cursor_get_hw_state; |
| 772 | 774 | cursor->check_plane = i845_check_cursor; |
| 773 | 775 | } else { |
| 774 | 776 | 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; | |
| 777 | 779 | cursor->get_hw_state = i9xx_cursor_get_hw_state; |
| 778 | 780 | cursor->check_plane = i9xx_check_cursor; |
| 779 | 781 | } |
| @@ -784,13 +786,18 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, · 4 unmodified lines | ||
| 784 | 786 | if (IS_I845G(dev_priv) || IS_I865G(dev_priv) || HAS_CUR_FBC(dev_priv)) |
| 785 | 787 | cursor->cursor.size = ~0; |
| 786 | 788 | |
| 789 | + modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_NONE); | |
| 790 | + | |
| 787 | 791 | ret = drm_universal_plane_init(&dev_priv->drm, &cursor->base, |
| 788 | 792 | 0, &intel_cursor_plane_funcs, |
| 789 | 793 | intel_cursor_formats, |
| 790 | 794 | ARRAY_SIZE(intel_cursor_formats), |
| 791 | − cursor_format_modifiers, | |
| 795 | + modifiers, | |
| 792 | 796 | DRM_PLANE_TYPE_CURSOR, |
| 793 | 797 | "cursor %c", pipe_name(pipe)); |
| 798 | + | |
| 799 | + kfree(modifiers); | |
| 800 | + | |
| 794 | 801 | if (ret) |
| 795 | 802 | goto fail; |
| 796 | 803 | |
| @@ -321,10 +321,11 @@ static void ddi_dotclock_get(struct intel_crtc_state *pipe_config) · 320 unmodified lines | ||
| 321 | 321 | { |
| 322 | 322 | int dotclock; |
| 323 | 323 | |
| 324 | + /* CRT dotclock is determined via other means */ | |
| 324 | 325 | 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)) | |
| 328 | 329 | dotclock = intel_dotclock_calculate(pipe_config->port_clock, |
| 329 | 330 | &pipe_config->dp_m_n); |
| 330 | 331 | 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 | ||
| 1039 | 1040 | const struct intel_crtc_state *crtc_state) |
| 1040 | 1041 | { |
| 1041 | 1042 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1042 | − int level = intel_ddi_level(encoder, crtc_state, 0); | |
| 1043 | 1043 | const struct intel_ddi_buf_trans *trans; |
| 1044 | 1044 | enum phy phy = intel_port_to_phy(dev_priv, encoder->port); |
| 1045 | 1045 | int n_entries, ln; |
| @@ -1068,32 +1068,36 @@ static void icl_ddi_combo_vswing_program(struct intel_encoder *encoder, · 22 unmodified lines | ||
| 1068 | 1068 | intel_de_write(dev_priv, ICL_PORT_TX_DW5_GRP(phy), val); |
| 1069 | 1069 | |
| 1070 | 1070 | /* 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 | + } | |
| 1079 | 1080 | |
| 1080 | 1081 | /* Program PORT_TX_DW4 */ |
| 1081 | 1082 | /* We cannot write to GRP. It would overwrite individual loadgen. */ |
| 1082 | 1083 | 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)); | |
| 1090 | 1091 | } |
| 1091 | 1092 | |
| 1092 | 1093 | /* 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 | + } | |
| 1097 | 1101 | } |
| 1098 | 1102 | |
| 1099 | 1103 | 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 | ||
| 1124 | 1128 | * > 6 GHz (LN0=0, LN1=0, LN2=0, LN3=0) |
| 1125 | 1129 | */ |
| 1126 | 1130 | 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)); | |
| 1131 | 1134 | } |
| 1132 | 1135 | |
| 1133 | 1136 | /* 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); | |
| 1137 | 1139 | |
| 1138 | 1140 | /* 4. Clear training enable to change swing values */ |
| 1139 | 1141 | 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 | ||
| 1154 | 1156 | { |
| 1155 | 1157 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1156 | 1158 | enum tc_port tc_port = intel_port_to_tc(dev_priv, encoder->port); |
| 1157 | − int level = intel_ddi_level(encoder, crtc_state, 0); | |
| 1158 | 1159 | const struct intel_ddi_buf_trans *trans; |
| 1159 | 1160 | int n_entries, ln; |
| 1160 | − u32 val; | |
| 1161 | 1161 | |
| 1162 | 1162 | if (intel_tc_port_in_tbt_alt_mode(enc_to_dig_port(encoder))) |
| 1163 | 1163 | return; |
| @@ -1166,53 +1166,51 @@ static void icl_mg_phy_set_signal_levels(struct intel_encoder *encoder, · 2 unmodified lines | ||
| 1166 | 1166 | if (drm_WARN_ON_ONCE(&dev_priv->drm, !trans)) |
| 1167 | 1167 | return; |
| 1168 | 1168 | |
| 1169 | − /* Set MG_TX_LINK_PARAMS cri_use_fs32 to 0. */ | |
| 1170 | 1169 | 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); | |
| 1178 | 1174 | } |
| 1179 | 1175 | |
| 1180 | 1176 | /* Program MG_TX_SWINGCTRL with values from vswing table */ |
| 1181 | 1177 | 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)); | |
| 1193 | 1191 | } |
| 1194 | 1192 | |
| 1195 | 1193 | /* Program MG_TX_DRVCTRL with values from vswing table */ |
| 1196 | 1194 | 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); | |
| 1216 | 1214 | |
| 1217 | 1215 | /* FIXME: Program CRI_LOADGEN_SEL after the spec is updated */ |
| 1218 | 1216 | } |
| @@ -1223,50 +1221,34 @@ static void icl_mg_phy_set_signal_levels(struct intel_encoder *encoder, · 4 unmodified lines | ||
| 1223 | 1221 | * values from table for which TX1 and TX2 enabled. |
| 1224 | 1222 | */ |
| 1225 | 1223 | 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); | |
| 1232 | 1227 | } |
| 1233 | 1228 | |
| 1234 | 1229 | /* Program the MG_TX_DCC<LN, port being used> based on the link frequency */ |
| 1235 | 1230 | 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); | |
| 1255 | 1244 | } |
| 1256 | 1245 | |
| 1257 | 1246 | /* Program MG_TX_PISO_READLOAD with values from vswing table */ |
| 1258 | 1247 | 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); | |
| 1270 | 1252 | } |
| 1271 | 1253 | } |
| 1272 | 1254 | |
| @@ -1275,9 +1257,7 @@ static void tgl_dkl_phy_set_signal_levels(struct intel_encoder *encoder, · 2 unmodified lines | ||
| 1275 | 1257 | { |
| 1276 | 1258 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1277 | 1259 | enum tc_port tc_port = intel_port_to_tc(dev_priv, encoder->port); |
| 1278 | − int level = intel_ddi_level(encoder, crtc_state, 0); | |
| 1279 | 1260 | const struct intel_ddi_buf_trans *trans; |
| 1280 | − u32 val, dpcnt_mask, dpcnt_val; | |
| 1281 | 1261 | int n_entries, ln; |
| 1282 | 1262 | |
| 1283 | 1263 | 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 | ||
| 1287 | 1267 | if (drm_WARN_ON_ONCE(&dev_priv->drm, !trans)) |
| 1288 | 1268 | return; |
| 1289 | 1269 | |
| 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 | − | |
| 1297 | 1270 | for (ln = 0; ln < 2; ln++) { |
| 1271 | + int level; | |
| 1272 | + | |
| 1298 | 1273 | intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), |
| 1299 | 1274 | HIP_INDEX_VAL(tc_port, ln)); |
| 1300 | 1275 | |
| 1301 | 1276 | intel_de_write(dev_priv, DKL_TX_PMD_LANE_SUS(tc_port), 0); |
| 1302 | 1277 | |
| 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); | |
| 1308 | 1289 | |
| 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)); | |
| 1313 | 1297 | |
| 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); | |
| 1317 | 1300 | } |
| 1318 | 1301 | } |
| 1319 | 1302 | |
| @@ -1938,7 +1921,7 @@ void intel_ddi_enable_clock(struct intel_encoder *encoder, · 618 unmodified lines | ||
| 1938 | 1921 | encoder->enable_clock(encoder, crtc_state); |
| 1939 | 1922 | } |
| 1940 | 1923 | |
| 1941 | −static void intel_ddi_disable_clock(struct intel_encoder *encoder) | |
| 1924 | +void intel_ddi_disable_clock(struct intel_encoder *encoder) | |
| 1942 | 1925 | { |
| 1943 | 1926 | if (encoder->disable_clock) |
| 1944 | 1927 | encoder->disable_clock(encoder); |
| @@ -2385,7 +2368,10 @@ static void dg2_ddi_pre_enable_dp(struct intel_atomic_state *state, · 440 unmodified lines | ||
| 2385 | 2368 | |
| 2386 | 2369 | /* 5.k Configure and enable FEC if needed */ |
| 2387 | 2370 | 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); | |
| 2389 | 2375 | } |
| 2390 | 2376 | |
| 2391 | 2377 | 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 | ||
| 2519 | 2505 | |
| 2520 | 2506 | /* 7.l Configure and enable FEC if needed */ |
| 2521 | 2507 | intel_ddi_enable_fec(encoder, crtc_state); |
| 2508 | + | |
| 2509 | + intel_dsc_dp_pps_write(encoder, crtc_state); | |
| 2510 | + | |
| 2522 | 2511 | if (!crtc_state->bigjoiner) |
| 2523 | − intel_dsc_enable(encoder, crtc_state); | |
| 2512 | + intel_dsc_enable(crtc_state); | |
| 2524 | 2513 | } |
| 2525 | 2514 | |
| 2526 | 2515 | 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 | ||
| 2585 | 2574 | if (!is_mst) |
| 2586 | 2575 | intel_ddi_enable_pipe_clock(encoder, crtc_state); |
| 2587 | 2576 | |
| 2577 | + intel_dsc_dp_pps_write(encoder, crtc_state); | |
| 2578 | + | |
| 2588 | 2579 | if (!crtc_state->bigjoiner) |
| 2589 | − intel_dsc_enable(encoder, crtc_state); | |
| 2580 | + intel_dsc_enable(crtc_state); | |
| 2590 | 2581 | } |
| 2591 | 2582 | |
| 2592 | 2583 | 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 | ||
| 2824 | 2815 | } |
| 2825 | 2816 | |
| 2826 | 2817 | 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 = | |
| 2830 | 2819 | old_crtc_state->bigjoiner_linked_crtc; |
| 2831 | 2820 | 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); | |
| 2833 | 2822 | |
| 2834 | 2823 | intel_crtc_vblank_off(old_slave_crtc_state); |
| 2835 | 2824 | |
| @@ -2866,41 +2855,6 @@ static void intel_ddi_post_disable(struct intel_atomic_state *state, · 30 unmodified lines | ||
| 2866 | 2855 | intel_tc_port_put_link(dig_port); |
| 2867 | 2856 | } |
| 2868 | 2857 | |
| 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 | − | |
| 2904 | 2858 | static void trans_port_sync_stop_link_train(struct intel_atomic_state *state, |
| 2905 | 2859 | struct intel_encoder *encoder, |
| 2906 | 2860 | 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 | ||
| 3095 | 3049 | |
| 3096 | 3050 | intel_dp->link_trained = false; |
| 3097 | 3051 | |
| 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); | |
| 3098 | 3058 | intel_edp_backlight_off(old_conn_state); |
| 3099 | 3059 | /* Disable the decompression in DP Sink */ |
| 3100 | 3060 | 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 | ||
| 3112 | 3072 | struct drm_i915_private *i915 = to_i915(encoder->base.dev); |
| 3113 | 3073 | struct drm_connector *connector = old_conn_state->connector; |
| 3114 | 3074 | |
| 3075 | + if (old_crtc_state->has_audio) | |
| 3076 | + intel_audio_codec_disable(encoder, | |
| 3077 | + old_crtc_state, old_conn_state); | |
| 3078 | + | |
| 3115 | 3079 | if (!intel_hdmi_handle_sink_scrambling(encoder, connector, |
| 3116 | 3080 | false, false)) |
| 3117 | 3081 | drm_dbg_kms(&i915->drm, |
| @@ -3119,25 +3083,6 @@ static void intel_disable_ddi_hdmi(struct intel_atomic_state *state, · 1 unmodified line | ||
| 3119 | 3083 | connector->base.id, connector->name); |
| 3120 | 3084 | } |
| 3121 | 3085 | |
| 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 | − | |
| 3141 | 3086 | static void intel_disable_ddi(struct intel_atomic_state *state, |
| 3142 | 3087 | struct intel_encoder *encoder, |
| 3143 | 3088 | const struct intel_crtc_state *old_crtc_state, |
| @@ -3195,8 +3140,14 @@ intel_ddi_update_prepare(struct intel_atomic_state *state, · 51 unmodified lines | ||
| 3195 | 3140 | |
| 3196 | 3141 | intel_tc_port_get_link(enc_to_dig_port(encoder), |
| 3197 | 3142 | 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 | + | |
| 3199 | 3146 | intel_update_active_dpll(state, crtc, encoder); |
| 3147 | + | |
| 3148 | + if (slave_crtc) | |
| 3149 | + intel_update_active_dpll(state, slave_crtc, encoder); | |
| 3150 | + } | |
| 3200 | 3151 | } |
| 3201 | 3152 | |
| 3202 | 3153 | static void |
| @@ -3552,18 +3503,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, · 349 unmodified lines | ||
| 3552 | 3503 | if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder))) |
| 3553 | 3504 | return; |
| 3554 | 3505 | |
| 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); | |
| 3567 | 3507 | |
| 3568 | 3508 | intel_ddi_mso_get_config(encoder, pipe_config); |
| 3569 | 3509 | |
| @@ -3591,8 +3531,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, · 21 unmodified lines | ||
| 3591 | 3531 | dev_priv->vbt.edp.bpp = pipe_config->pipe_bpp; |
| 3592 | 3532 | } |
| 3593 | 3533 | |
| 3594 | − if (!pipe_config->bigjoiner_slave) | |
| 3595 | − ddi_dotclock_get(pipe_config); | |
| 3534 | + ddi_dotclock_get(pipe_config); | |
| 3596 | 3535 | |
| 3597 | 3536 | if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) |
| 3598 | 3537 | 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 | ||
| 4472 | 4411 | encoder->enable = intel_enable_ddi; |
| 4473 | 4412 | encoder->pre_pll_enable = intel_ddi_pre_pll_enable; |
| 4474 | 4413 | encoder->pre_enable = intel_ddi_pre_enable; |
| 4475 | − encoder->pre_disable = intel_pre_disable_ddi; | |
| 4476 | 4414 | encoder->disable = intel_disable_ddi; |
| 4477 | 4415 | encoder->post_disable = intel_ddi_post_disable; |
| 4478 | 4416 | encoder->update_pipe = intel_ddi_update_pipe; |
| @@ -6,11 +6,11 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __INTEL_DDI_H__ |
| 7 | 7 | #define __INTEL_DDI_H__ |
| 8 | 8 | |
| 9 | −#include "intel_display.h" | |
| 10 | 9 | #include "i915_reg.h" |
| 11 | 10 | |
| 12 | 11 | struct drm_connector_state; |
| 13 | 12 | struct drm_i915_private; |
| 13 | +struct intel_atomic_state; | |
| 14 | 14 | struct intel_connector; |
| 15 | 15 | struct intel_crtc; |
| 16 | 16 | struct intel_crtc_state; |
| @@ -18,6 +18,8 @@ struct intel_dp; · 1 unmodified line | ||
| 18 | 18 | struct intel_dpll_hw_state; |
| 19 | 19 | struct intel_encoder; |
| 20 | 20 | struct intel_shared_dpll; |
| 21 | +enum pipe; | |
| 22 | +enum port; | |
| 21 | 23 | enum transcoder; |
| 22 | 24 | |
| 23 | 25 | 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 | ||
| 30 | 32 | const struct drm_connector_state *old_conn_state); |
| 31 | 33 | void intel_ddi_enable_clock(struct intel_encoder *encoder, |
| 32 | 34 | const struct intel_crtc_state *crtc_state); |
| 35 | +void intel_ddi_disable_clock(struct intel_encoder *encoder); | |
| 33 | 36 | void intel_ddi_get_clock(struct intel_encoder *encoder, |
| 34 | 37 | struct intel_crtc_state *crtc_state, |
| 35 | 38 | struct intel_shared_dpll *pll); |
| @@ -70,11 +70,10 @@ · 69 unmodified lines | ||
| 70 | 70 | |
| 71 | 71 | #include "gt/gen8_ppgtt.h" |
| 72 | 72 | |
| 73 | −#include "pxp/intel_pxp.h" | |
| 74 | − | |
| 75 | 73 | #include "g4x_dp.h" |
| 76 | 74 | #include "g4x_hdmi.h" |
| 77 | 75 | #include "i915_drv.h" |
| 76 | +#include "icl_dsi.h" | |
| 78 | 77 | #include "intel_acpi.h" |
| 79 | 78 | #include "intel_atomic.h" |
| 80 | 79 | #include "intel_atomic_plane.h" |
| @@ -96,6 +95,8 @@ · 15 unmodified lines | ||
| 96 | 95 | #include "intel_hotplug.h" |
| 97 | 96 | #include "intel_overlay.h" |
| 98 | 97 | #include "intel_panel.h" |
| 98 | +#include "intel_pch_display.h" | |
| 99 | +#include "intel_pch_refclk.h" | |
| 99 | 100 | #include "intel_pcode.h" |
| 100 | 101 | #include "intel_pipe_crc.h" |
| 101 | 102 | #include "intel_plane_initial.h" |
| @@ -103,19 +104,15 @@ · 1 unmodified line | ||
| 103 | 104 | #include "intel_pps.h" |
| 104 | 105 | #include "intel_psr.h" |
| 105 | 106 | #include "intel_quirks.h" |
| 106 | −#include "intel_sbi.h" | |
| 107 | 107 | #include "intel_sprite.h" |
| 108 | 108 | #include "intel_tc.h" |
| 109 | 109 | #include "intel_vga.h" |
| 110 | 110 | #include "i9xx_plane.h" |
| 111 | 111 | #include "skl_scaler.h" |
| 112 | 112 | #include "skl_universal_plane.h" |
| 113 | +#include "vlv_dsi_pll.h" | |
| 113 | 114 | #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" | |
| 119 | 116 | |
| 120 | 117 | static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_state); |
| 121 | 118 | 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 | ||
| 341 | 338 | is_trans_port_sync_slave(crtc_state); |
| 342 | 339 | } |
| 343 | 340 | |
| 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 | + | |
| 344 | 349 | static bool pipe_scanline_is_moving(struct drm_i915_private *dev_priv, |
| 345 | 350 | enum pipe pipe) |
| 346 | 351 | { |
| @@ -454,80 +459,6 @@ static void assert_planes_disabled(struct intel_crtc *crtc) · 107 unmodified lines | ||
| 454 | 459 | assert_plane_disabled(plane); |
| 455 | 460 | } |
| 456 | 461 | |
| 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 | − | |
| 531 | 462 | void vlv_wait_port_ready(struct drm_i915_private *dev_priv, |
| 532 | 463 | struct intel_digital_port *dig_port, |
| 533 | 464 | unsigned int expected_mask) |
| @@ -562,154 +493,6 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, · 28 unmodified lines | ||
| 562 | 493 | expected_mask); |
| 563 | 494 | } |
| 564 | 495 | |
| 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 | − | |
| 713 | 496 | enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc) |
| 714 | 497 | { |
| 715 | 498 | 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 | ||
| 823 | 606 | intel_wait_for_pipe_off(old_crtc_state); |
| 824 | 607 | } |
| 825 | 608 | |
| 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 | − | |
| 834 | 609 | unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info) |
| 835 | 610 | { |
| 836 | 611 | unsigned int size = 0; |
| @@ -850,7 +625,11 @@ unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info · 13 unmodified lines | ||
| 850 | 625 | for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) { |
| 851 | 626 | unsigned int plane_size; |
| 852 | 627 | |
| 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 | + | |
| 854 | 633 | if (plane_size == 0) |
| 855 | 634 | continue; |
| 856 | 635 | |
| @@ -869,7 +648,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state) · 12 unmodified lines | ||
| 869 | 648 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 870 | 649 | |
| 871 | 650 | return DISPLAY_VER(dev_priv) < 4 || |
| 872 | − (plane->has_fbc && | |
| 651 | + (plane->fbc && | |
| 873 | 652 | plane_state->view.gtt.type == I915_GGTT_VIEW_NORMAL); |
| 874 | 653 | } |
| 875 | 654 | |
| @@ -885,7 +664,7 @@ u32 intel_fb_xy_to_linear(int x, int y, · 9 unmodified lines | ||
| 885 | 664 | { |
| 886 | 665 | const struct drm_framebuffer *fb = state->hw.fb; |
| 887 | 666 | 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; | |
| 889 | 668 | |
| 890 | 669 | return y * pitch + x * cpp; |
| 891 | 670 | } |
| @@ -904,136 +683,6 @@ void intel_add_fb_offsets(int *x, int *y, · 12 unmodified lines | ||
| 904 | 683 | *y += state->view.color_plane[color_plane].y; |
| 905 | 684 | } |
| 906 | 685 | |
| 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 | − | |
| 1037 | 686 | u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv, |
| 1038 | 687 | u32 pixel_format, u64 modifier) |
| 1039 | 688 | { |
| @@ -1135,7 +784,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc, · 95 unmodified lines | ||
| 1135 | 784 | if (DISPLAY_VER(dev_priv) == 2 && !crtc_state->active_planes) |
| 1136 | 785 | intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false); |
| 1137 | 786 | |
| 1138 | − intel_disable_plane(plane, crtc_state); | |
| 787 | + intel_plane_disable_arm(plane, crtc_state); | |
| 1139 | 788 | intel_wait_for_vblank(dev_priv, crtc->pipe); |
| 1140 | 789 | } |
| 1141 | 790 | |
| @@ -1310,26 +959,6 @@ unlock: · 168 unmodified lines | ||
| 1310 | 959 | clear_bit_unlock(I915_RESET_MODESET, &dev_priv->gt.reset.flags); |
| 1311 | 960 | } |
| 1312 | 961 | |
| 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 | − | |
| 1333 | 962 | static void icl_set_pipe_chicken(const struct intel_crtc_state *crtc_state) |
| 1334 | 963 | { |
| 1335 | 964 | 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 | ||
| 1353 | 982 | */ |
| 1354 | 983 | tmp |= PIXEL_ROUNDING_TRUNC_FB_PASSTHRU; |
| 1355 | 984 | |
| 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)) | |
| 1362 | 990 | 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; | |
| 1369 | 993 | |
| 1370 | 994 | intel_de_write(dev_priv, PIPE_CHICKEN(pipe), tmp); |
| 1371 | 995 | } |
| @@ -1395,158 +1019,6 @@ bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv) · 23 unmodified lines | ||
| 1395 | 1019 | return false; |
| 1396 | 1020 | } |
| 1397 | 1021 | |
| 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 | − | |
| 1550 | 1022 | /* |
| 1551 | 1023 | * Finds the encoder associated with the given CRTC. This can only be |
| 1552 | 1024 | * used when we know that the CRTC isn't feeding multiple encoders! |
| @@ -1555,15 +1027,17 @@ struct intel_encoder * · 2 unmodified lines | ||
| 1555 | 1027 | intel_get_crtc_new_encoder(const struct intel_atomic_state *state, |
| 1556 | 1028 | const struct intel_crtc_state *crtc_state) |
| 1557 | 1029 | { |
| 1558 | − struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); | |
| 1559 | 1030 | const struct drm_connector_state *connector_state; |
| 1560 | 1031 | const struct drm_connector *connector; |
| 1561 | 1032 | struct intel_encoder *encoder = NULL; |
| 1033 | + struct intel_crtc *master_crtc; | |
| 1562 | 1034 | int num_encoders = 0; |
| 1563 | 1035 | int i; |
| 1564 | 1036 | |
| 1037 | + master_crtc = intel_master_crtc(crtc_state); | |
| 1038 | + | |
| 1565 | 1039 | 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) | |
| 1567 | 1041 | continue; |
| 1568 | 1042 | |
| 1569 | 1043 | 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 | ||
| 1572 | 1046 | |
| 1573 | 1047 | drm_WARN(encoder->base.dev, num_encoders != 1, |
| 1574 | 1048 | "%d encoders for pipe %c\n", |
| 1575 | − num_encoders, pipe_name(crtc->pipe)); | |
| 1049 | + num_encoders, pipe_name(master_crtc->pipe)); | |
| 1576 | 1050 | |
| 1577 | 1051 | return encoder; |
| 1578 | 1052 | } |
| 1579 | 1053 | |
| 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 | − | |
| 1680 | 1054 | static void cpt_verify_modeset(struct drm_i915_private *dev_priv, |
| 1681 | 1055 | enum pipe pipe) |
| 1682 | 1056 | { |
| @@ -2054,6 +1428,8 @@ static void intel_pre_plane_update(struct intel_atomic_state *state, · 371 unmodified lines | ||
| 2054 | 1428 | intel_atomic_get_new_crtc_state(state, crtc); |
| 2055 | 1429 | enum pipe pipe = crtc->pipe; |
| 2056 | 1430 | |
| 1431 | + intel_psr_pre_plane_update(state, crtc); | |
| 1432 | + | |
| 2057 | 1433 | if (hsw_pre_update_disable_ips(old_crtc_state, new_crtc_state)) |
| 2058 | 1434 | hsw_disable_ips(old_crtc_state); |
| 2059 | 1435 | |
| @@ -2165,7 +1541,7 @@ static void intel_crtc_disable_planes(struct intel_atomic_state *state, · 105 unmodified lines | ||
| 2165 | 1541 | !(update_mask & BIT(plane->id))) |
| 2166 | 1542 | continue; |
| 2167 | 1543 | |
| 2168 | − intel_disable_plane(plane, new_crtc_state); | |
| 1544 | + intel_plane_disable_arm(plane, new_crtc_state); | |
| 2169 | 1545 | |
| 2170 | 1546 | if (old_plane_state->uapi.visible) |
| 2171 | 1547 | fb_bits |= plane->frontbuffer_bit; |
| @@ -2199,10 +1575,30 @@ intel_connector_primary_encoder(struct intel_connector *connector) · 27 unmodified lines | ||
| 2199 | 1575 | |
| 2200 | 1576 | static void intel_encoders_update_prepare(struct intel_atomic_state *state) |
| 2201 | 1577 | { |
| 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; | |
| 2202 | 1581 | struct drm_connector_state *new_conn_state; |
| 2203 | 1582 | struct drm_connector *connector; |
| 2204 | 1583 | int i; |
| 2205 | 1584 | |
| 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 | + | |
| 2206 | 1602 | for_each_new_connector_in_state(&state->base, connector, new_conn_state, |
| 2207 | 1603 | i) { |
| 2208 | 1604 | struct intel_connector *intel_connector; |
| @@ -2229,6 +1625,9 @@ static void intel_encoders_update_complete(struct intel_atomic_state *state) · 20 unmodified lines | ||
| 2229 | 1625 | struct drm_connector *connector; |
| 2230 | 1626 | int i; |
| 2231 | 1627 | |
| 1628 | + if (!state->modeset) | |
| 1629 | + return; | |
| 1630 | + | |
| 2232 | 1631 | for_each_new_connector_in_state(&state->base, connector, new_conn_state, |
| 2233 | 1632 | i) { |
| 2234 | 1633 | struct intel_connector *intel_connector; |
| @@ -2316,28 +1715,6 @@ static void intel_encoders_enable(struct intel_atomic_state *state, · 81 unmodified lines | ||
| 2316 | 1715 | } |
| 2317 | 1716 | } |
| 2318 | 1717 | |
| 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 | − | |
| 2341 | 1718 | static void intel_encoders_disable(struct intel_atomic_state *state, |
| 2342 | 1719 | struct intel_crtc *crtc) |
| 2343 | 1720 | { |
| @@ -2432,7 +1809,7 @@ static void intel_disable_primary_plane(const struct intel_crtc_state *crtc_stat · 88 unmodified lines | ||
| 2432 | 1809 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); |
| 2433 | 1810 | struct intel_plane *plane = to_intel_plane(crtc->base.primary); |
| 2434 | 1811 | |
| 2435 | − plane->disable_plane(plane, crtc_state); | |
| 1812 | + plane->disable_arm(plane, crtc_state); | |
| 2436 | 1813 | } |
| 2437 | 1814 | |
| 2438 | 1815 | 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 | ||
| 2500 | 1877 | intel_enable_transcoder(new_crtc_state); |
| 2501 | 1878 | |
| 2502 | 1879 | if (new_crtc_state->has_pch_encoder) |
| 2503 | − ilk_pch_enable(state, new_crtc_state); | |
| 1880 | + ilk_pch_enable(state, crtc); | |
| 2504 | 1881 | |
| 2505 | 1882 | intel_crtc_vblank_on(new_crtc_state); |
| 2506 | 1883 | |
| @@ -2592,42 +1969,39 @@ static void hsw_set_frame_start_delay(const struct intel_crtc_state *crtc_state) · 85 unmodified lines | ||
| 2592 | 1969 | static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state, |
| 2593 | 1970 | const struct intel_crtc_state *crtc_state) |
| 2594 | 1971 | { |
| 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); | |
| 2597 | 1973 | struct intel_crtc_state *master_crtc_state; |
| 1974 | + struct intel_crtc *master_crtc; | |
| 2598 | 1975 | struct drm_connector_state *conn_state; |
| 2599 | 1976 | struct drm_connector *conn; |
| 2600 | 1977 | struct intel_encoder *encoder = NULL; |
| 2601 | 1978 | int i; |
| 2602 | 1979 | |
| 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); | |
| 2607 | 1982 | |
| 2608 | 1983 | 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) | |
| 2610 | 1985 | continue; |
| 2611 | 1986 | |
| 2612 | 1987 | encoder = to_intel_encoder(conn_state->best_encoder); |
| 2613 | 1988 | break; |
| 2614 | 1989 | } |
| 2615 | 1990 | |
| 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); | |
| 2627 | 1996 | |
| 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); | |
| 2631 | 2005 | |
| 2632 | 2006 | if (DISPLAY_VER(dev_priv) >= 13) |
| 2633 | 2007 | intel_uncompressed_joiner_enable(crtc_state); |
| @@ -2774,33 +2148,12 @@ static void ilk_crtc_disable(struct intel_atomic_state *state, · 140 unmodified lines | ||
| 2774 | 2148 | ilk_pfit_disable(old_crtc_state); |
| 2775 | 2149 | |
| 2776 | 2150 | if (old_crtc_state->has_pch_encoder) |
| 2777 | − ilk_fdi_disable(crtc); | |
| 2151 | + ilk_pch_disable(state, crtc); | |
| 2778 | 2152 | |
| 2779 | 2153 | intel_encoders_post_disable(state, crtc); |
| 2780 | 2154 | |
| 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); | |
| 2804 | 2157 | |
| 2805 | 2158 | intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true); |
| 2806 | 2159 | 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 | ||
| 2809 | 2162 | static void hsw_crtc_disable(struct intel_atomic_state *state, |
| 2810 | 2163 | struct intel_crtc *crtc) |
| 2811 | 2164 | { |
| 2165 | + const struct intel_crtc_state *old_crtc_state = | |
| 2166 | + intel_atomic_get_old_crtc_state(state, crtc); | |
| 2167 | + | |
| 2812 | 2168 | /* |
| 2813 | 2169 | * FIXME collapse everything to one hook. |
| 2814 | 2170 | * Need care with mst->ddi interactions. |
| 2815 | 2171 | */ |
| 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 | + } | |
| 2818 | 2176 | } |
| 2819 | 2177 | |
| 2820 | 2178 | 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 | ||
| 4242 | 3600 | if (DISPLAY_VER(dev_priv) < 4) |
| 4243 | 3601 | pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE; |
| 4244 | 3602 | |
| 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); | |
| 4679 | 3605 | |
| 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); | |
| 4684 | 3607 | |
| 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; | |
| 4688 | 3629 | } |
| 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); | |
| 4693 | 3642 | } |
| 4694 | 3643 | |
| 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); | |
| 4697 | 3650 | |
| 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; | |
| 4705 | 3658 | |
| 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; | |
| 4715 | 3665 | } |
| 4716 | 3666 | |
| 4717 | 3667 | 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 | ||
| 4978 | 3928 | &pipe_config->dp_m2_n2); |
| 4979 | 3929 | } |
| 4980 | 3930 | |
| 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) | |
| 4983 | 3933 | { |
| 4984 | 3934 | intel_cpu_transcoder_get_m_n(crtc, pipe_config->cpu_transcoder, |
| 4985 | 3935 | &pipe_config->fdi_m_n, NULL); |
| @@ -5116,50 +4066,9 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc, · 130 unmodified lines | ||
| 5116 | 4066 | i9xx_get_pipe_color_config(pipe_config); |
| 5117 | 4067 | intel_color_get_config(pipe_config); |
| 5118 | 4068 | |
| 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; | |
| 5158 | 4070 | |
| 5159 | − ilk_pch_clock_get(crtc, pipe_config); | |
| 5160 | − } else { | |
| 5161 | − pipe_config->pixel_multiplier = 1; | |
| 5162 | − } | |
| 4071 | + ilk_pch_get_config(pipe_config); | |
| 5163 | 4072 | |
| 5164 | 4073 | intel_get_transcoder_timings(crtc, pipe_config); |
| 5165 | 4074 | intel_get_pipe_src_size(crtc, pipe_config); |
| @@ -5174,6 +4083,16 @@ out: · 8 unmodified lines | ||
| 5174 | 4083 | return ret; |
| 5175 | 4084 | } |
| 5176 | 4085 | |
| 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 | + | |
| 5177 | 4096 | static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, |
| 5178 | 4097 | enum transcoder cpu_transcoder) |
| 5179 | 4098 | { |
| @@ -5189,6 +4108,54 @@ static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, · 9 unmodified lines | ||
| 5189 | 4108 | return tmp & TRANS_DDI_FUNC_ENABLE; |
| 5190 | 4109 | } |
| 5191 | 4110 | |
| 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 | + | |
| 5192 | 4159 | static u8 hsw_panel_transcoders(struct drm_i915_private *i915) |
| 5193 | 4160 | { |
| 5194 | 4161 | u8 panel_transcoder_mask = BIT(TRANSCODER_EDP); |
| @@ -5250,10 +4217,18 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) · 55 unmodified lines | ||
| 5250 | 4217 | enabled_transcoders |= BIT(cpu_transcoder); |
| 5251 | 4218 | } |
| 5252 | 4219 | |
| 4220 | + /* single pipe or bigjoiner master */ | |
| 5253 | 4221 | cpu_transcoder = (enum transcoder) crtc->pipe; |
| 5254 | 4222 | if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder)) |
| 5255 | 4223 | enabled_transcoders |= BIT(cpu_transcoder); |
| 5256 | 4224 | |
| 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 | + | |
| 5257 | 4232 | return enabled_transcoders; |
| 5258 | 4233 | } |
| 5259 | 4234 | |
| @@ -5374,45 +4349,6 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc, · 114 unmodified lines | ||
| 5374 | 4349 | return transcoder_is_dsi(pipe_config->cpu_transcoder); |
| 5375 | 4350 | } |
| 5376 | 4351 | |
| 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 | − | |
| 5416 | 4352 | static bool hsw_get_pipe_config(struct intel_crtc *crtc, |
| 5417 | 4353 | struct intel_crtc_state *pipe_config) |
| 5418 | 4354 | { |
| @@ -5439,21 +4375,12 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc, · 20 unmodified lines | ||
| 5439 | 4375 | if (DISPLAY_VER(dev_priv) >= 13 && !pipe_config->dsc.compression_enable) |
| 5440 | 4376 | intel_uncompressed_joiner_get_config(pipe_config); |
| 5441 | 4377 | |
| 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; | |
| 5449 | 4380 | |
| 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) | |
| 5455 | 4383 | intel_get_transcoder_timings(crtc, pipe_config); |
| 5456 | − } | |
| 5457 | 4384 | |
| 5458 | 4385 | if (HAS_VRR(dev_priv) && !transcoder_is_dsi(pipe_config->cpu_transcoder)) |
| 5459 | 4386 | intel_vrr_get_config(crtc, pipe_config); |
| @@ -5521,10 +4448,7 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc, · 61 unmodified lines | ||
| 5521 | 4448 | } |
| 5522 | 4449 | } |
| 5523 | 4450 | |
| 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 && | |
| 5528 | 4452 | !transcoder_is_dsi(pipe_config->cpu_transcoder)) { |
| 5529 | 4453 | pipe_config->pixel_multiplier = |
| 5530 | 4454 | intel_de_read(dev_priv, |
| @@ -5782,8 +4706,8 @@ static int i9xx_pll_refclk(struct drm_device *dev, · 251 unmodified lines | ||
| 5782 | 4706 | } |
| 5783 | 4707 | |
| 5784 | 4708 | /* 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) | |
| 5787 | 4711 | { |
| 5788 | 4712 | struct drm_device *dev = crtc->base.dev; |
| 5789 | 4713 | struct drm_i915_private *dev_priv = to_i915(dev); |
| @@ -5893,24 +4817,6 @@ int intel_dotclock_calculate(int link_freq, · 103 unmodified lines | ||
| 5893 | 4817 | return div_u64(mul_u32_u32(m_n->link_m, link_freq), m_n->link_n); |
| 5894 | 4818 | } |
| 5895 | 4819 | |
| 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 | − | |
| 5914 | 4820 | /* Returns the currently programmed mode of the given encoder. */ |
| 5915 | 4821 | struct drm_display_mode * |
| 5916 | 4822 | 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 | ||
| 6245 | 5151 | linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE; |
| 6246 | 5152 | linked_state->color_ctl = plane_state->color_ctl; |
| 6247 | 5153 | linked_state->view = plane_state->view; |
| 5154 | + linked_state->decrypt = plane_state->decrypt; | |
| 6248 | 5155 | |
| 6249 | 5156 | intel_plane_copy_hw_state(linked_state, plane_state); |
| 6250 | 5157 | 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 | ||
| 6371 | 5278 | crtc_state->update_wm_post = true; |
| 6372 | 5279 | |
| 6373 | 5280 | if (mode_changed && crtc_state->hw.enable && |
| 6374 | − dev_priv->dpll_funcs && | |
| 6375 | − !crtc_state->bigjoiner_slave && | |
| 6376 | 5281 | !drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll)) { |
| 6377 | 5282 | ret = dev_priv->dpll_funcs->crtc_compute_clock(crtc_state); |
| 6378 | 5283 | if (ret) |
| @@ -6928,18 +5833,15 @@ static void · 549 unmodified lines | ||
| 6928 | 5833 | intel_crtc_copy_uapi_to_hw_state_nomodeset(struct intel_atomic_state *state, |
| 6929 | 5834 | struct intel_crtc_state *crtc_state) |
| 6930 | 5835 | { |
| 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; | |
| 6932 | 5838 | |
| 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); | |
| 6936 | 5841 | |
| 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); | |
| 6943 | 5845 | } |
| 6944 | 5846 | |
| 6945 | 5847 | static void |
| @@ -6982,7 +5884,6 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state, · 36 unmodified lines | ||
| 6982 | 5884 | const struct intel_crtc_state *from_crtc_state) |
| 6983 | 5885 | { |
| 6984 | 5886 | struct intel_crtc_state *saved_state; |
| 6985 | − struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); | |
| 6986 | 5887 | |
| 6987 | 5888 | saved_state = kmemdup(from_crtc_state, sizeof(*saved_state), GFP_KERNEL); |
| 6988 | 5889 | if (!saved_state) |
| @@ -7012,8 +5913,8 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state, · 23 unmodified lines | ||
| 7012 | 5913 | crtc_state->nv12_planes = crtc_state->c8_planes = crtc_state->update_planes = 0; |
| 7013 | 5914 | crtc_state->bigjoiner_linked_crtc = to_intel_crtc(from_crtc_state->uapi.crtc); |
| 7014 | 5915 | 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; | |
| 7017 | 5918 | |
| 7018 | 5919 | return 0; |
| 7019 | 5920 | } |
| @@ -7609,51 +6510,48 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 589 unmodified lines | ||
| 7609 | 6510 | |
| 7610 | 6511 | PIPE_CONF_CHECK_X(output_types); |
| 7611 | 6512 | |
| 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)) { | |
| 7644 | 6547 | 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); | |
| 7657 | 6555 | } |
| 7658 | 6556 | |
| 7659 | 6557 | PIPE_CONF_CHECK_I(output_format); |
| @@ -7665,9 +6563,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 5 unmodified lines | ||
| 7665 | 6563 | PIPE_CONF_CHECK_BOOL(hdmi_scrambling); |
| 7666 | 6564 | PIPE_CONF_CHECK_BOOL(hdmi_high_tmds_clock_ratio); |
| 7667 | 6565 | 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); | |
| 7671 | 6567 | |
| 7672 | 6568 | PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio); |
| 7673 | 6569 | |
| @@ -7696,9 +6592,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 22 unmodified lines | ||
| 7696 | 6592 | } |
| 7697 | 6593 | |
| 7698 | 6594 | 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); | |
| 7702 | 6596 | |
| 7703 | 6597 | PIPE_CONF_CHECK_X(gamma_mode); |
| 7704 | 6598 | if (IS_CHERRYVIEW(dev_priv)) |
| @@ -7725,11 +6619,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, · 20 unmodified lines | ||
| 7725 | 6619 | |
| 7726 | 6620 | PIPE_CONF_CHECK_BOOL(double_wide); |
| 7727 | 6621 | |
| 7728 | − if (dev_priv->dpll.mgr) | |
| 6622 | + if (dev_priv->dpll.mgr) { | |
| 7729 | 6623 | PIPE_CONF_CHECK_P(shared_dpll); |
| 7730 | 6624 | |
| 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)) { | |
| 7733 | 6625 | PIPE_CONF_CHECK_X(dpll_hw_state.dpll); |
| 7734 | 6626 | PIPE_CONF_CHECK_X(dpll_hw_state.dpll_md); |
| 7735 | 6627 | 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 | ||
| 7763 | 6655 | PIPE_CONF_CHECK_X(dpll_hw_state.mg_pll_tdc_coldst_bias); |
| 7764 | 6656 | } |
| 7765 | 6657 | |
| 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); | |
| 7769 | 6660 | |
| 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); | |
| 7772 | 6663 | |
| 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); | |
| 7776 | 6667 | |
| 7777 | − PIPE_CONF_CHECK_I(min_voltage_level); | |
| 7778 | − } | |
| 6668 | + PIPE_CONF_CHECK_I(min_voltage_level); | |
| 7779 | 6669 | |
| 7780 | 6670 | if (current_config->has_psr || pipe_config->has_psr) |
| 7781 | 6671 | PIPE_CONF_CHECK_X_WITH_MASK(infoframes.enable, |
| @@ -8049,7 +6939,7 @@ verify_crtc_state(struct intel_crtc *crtc, · 267 unmodified lines | ||
| 8049 | 6939 | struct intel_encoder *encoder; |
| 8050 | 6940 | struct intel_crtc_state *pipe_config = old_crtc_state; |
| 8051 | 6941 | struct drm_atomic_state *state = old_crtc_state->uapi.state; |
| 8052 | − struct intel_crtc *master = crtc; | |
| 6942 | + struct intel_crtc *master_crtc; | |
| 8053 | 6943 | |
| 8054 | 6944 | __drm_atomic_helper_crtc_destroy_state(&old_crtc_state->uapi); |
| 8055 | 6945 | intel_crtc_free_hw_state(old_crtc_state); |
| @@ -8077,10 +6967,9 @@ verify_crtc_state(struct intel_crtc *crtc, · 21 unmodified lines | ||
| 8077 | 6967 | "(expected %i, found %i)\n", |
| 8078 | 6968 | new_crtc_state->hw.active, crtc->active); |
| 8079 | 6969 | |
| 8080 | − if (new_crtc_state->bigjoiner_slave) | |
| 8081 | − master = new_crtc_state->bigjoiner_linked_crtc; | |
| 6970 | + master_crtc = intel_master_crtc(new_crtc_state); | |
| 8082 | 6971 | |
| 8083 | − for_each_encoder_on_crtc(dev, &master->base, encoder) { | |
| 6972 | + for_each_encoder_on_crtc(dev, &master_crtc->base, encoder) { | |
| 8084 | 6973 | enum pipe pipe; |
| 8085 | 6974 | bool active; |
| 8086 | 6975 | |
| @@ -8090,7 +6979,7 @@ verify_crtc_state(struct intel_crtc *crtc, · 3 unmodified lines | ||
| 8090 | 6979 | encoder->base.base.id, active, |
| 8091 | 6980 | new_crtc_state->hw.active); |
| 8092 | 6981 | |
| 8093 | − I915_STATE_WARN(active && master->pipe != pipe, | |
| 6982 | + I915_STATE_WARN(active && master_crtc->pipe != pipe, | |
| 8094 | 6983 | "Encoder connected to wrong pipe %c\n", |
| 8095 | 6984 | pipe_name(pipe)); |
| 8096 | 6985 | |
| @@ -8101,10 +6990,6 @@ verify_crtc_state(struct intel_crtc *crtc, · 4 unmodified lines | ||
| 8101 | 6990 | if (!new_crtc_state->hw.active) |
| 8102 | 6991 | return; |
| 8103 | 6992 | |
| 8104 | − if (new_crtc_state->bigjoiner_slave) | |
| 8105 | − /* No PLLs set for slave */ | |
| 8106 | − pipe_config->shared_dpll = NULL; | |
| 8107 | − | |
| 8108 | 6993 | intel_pipe_config_sanity_check(dev_priv, pipe_config); |
| 8109 | 6994 | |
| 8110 | 6995 | if (!intel_pipe_config_compare(new_crtc_state, |
| @@ -8223,9 +7108,6 @@ verify_mpllb_state(struct intel_atomic_state *state, · 112 unmodified lines | ||
| 8223 | 7108 | if (!new_crtc_state->hw.active) |
| 8224 | 7109 | return; |
| 8225 | 7110 | |
| 8226 | − if (new_crtc_state->bigjoiner_slave) | |
| 8227 | − return; | |
| 8228 | − | |
| 8229 | 7111 | encoder = intel_get_crtc_new_encoder(state, new_crtc_state); |
| 8230 | 7112 | intel_mpllb_readout_hw_state(encoder, &mpllb_hw_state); |
| 8231 | 7113 | |
| @@ -8607,28 +7489,13 @@ static int intel_bigjoiner_add_affected_planes(struct intel_atomic_state *state) · 375 unmodified lines | ||
| 8607 | 7489 | return 0; |
| 8608 | 7490 | } |
| 8609 | 7491 | |
| 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 | − | |
| 8622 | 7492 | static int intel_atomic_check_planes(struct intel_atomic_state *state) |
| 8623 | 7493 | { |
| 8624 | 7494 | struct drm_i915_private *dev_priv = to_i915(state->base.dev); |
| 8625 | 7495 | struct intel_crtc_state *old_crtc_state, *new_crtc_state; |
| 8626 | 7496 | struct intel_plane_state *plane_state; |
| 8627 | 7497 | struct intel_plane *plane; |
| 8628 | − struct intel_plane_state *new_plane_state; | |
| 8629 | − struct intel_plane_state *old_plane_state; | |
| 8630 | 7498 | struct intel_crtc *crtc; |
| 8631 | − const struct drm_framebuffer *fb; | |
| 8632 | 7499 | int i, ret; |
| 8633 | 7500 | |
| 8634 | 7501 | ret = icl_add_linked_planes(state); |
| @@ -8676,19 +7543,6 @@ static int intel_atomic_check_planes(struct intel_atomic_state *state) · 41 unmodified lines | ||
| 8676 | 7543 | return ret; |
| 8677 | 7544 | } |
| 8678 | 7545 | |
| 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 | − | |
| 8692 | 7546 | return 0; |
| 8693 | 7547 | } |
| 8694 | 7548 | |
| @@ -8790,13 +7644,13 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 95 unmodified lines | ||
| 8790 | 7644 | struct intel_crtc_state *new_crtc_state) |
| 8791 | 7645 | { |
| 8792 | 7646 | struct intel_crtc_state *slave_crtc_state, *master_crtc_state; |
| 8793 | − struct intel_crtc *slave, *master; | |
| 7647 | + struct intel_crtc *slave_crtc, *master_crtc; | |
| 8794 | 7648 | |
| 8795 | 7649 | /* slave being enabled, is master is still claiming this crtc? */ |
| 8796 | 7650 | 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); | |
| 8800 | 7654 | if (!master_crtc_state || !intel_crtc_needs_modeset(master_crtc_state)) |
| 8801 | 7655 | goto claimed; |
| 8802 | 7656 | } |
| @@ -8804,17 +7658,17 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 1 unmodified line | ||
| 8804 | 7658 | if (!new_crtc_state->bigjoiner) |
| 8805 | 7659 | return 0; |
| 8806 | 7660 | |
| 8807 | − slave = intel_dsc_get_bigjoiner_secondary(crtc); | |
| 8808 | − if (!slave) { | |
| 7661 | + slave_crtc = intel_dsc_get_bigjoiner_secondary(crtc); | |
| 7662 | + if (!slave_crtc) { | |
| 8809 | 7663 | DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration requires " |
| 8810 | 7664 | "CRTC + 1 to be used, doesn't exist\n", |
| 8811 | 7665 | crtc->base.base.id, crtc->base.name); |
| 8812 | 7666 | return -EINVAL; |
| 8813 | 7667 | } |
| 8814 | 7668 | |
| 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; | |
| 8818 | 7672 | if (IS_ERR(slave_crtc_state)) |
| 8819 | 7673 | return PTR_ERR(slave_crtc_state); |
| 8820 | 7674 | |
| @@ -8823,15 +7677,15 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, · 2 unmodified lines | ||
| 8823 | 7677 | goto claimed; |
| 8824 | 7678 | |
| 8825 | 7679 | 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); | |
| 8827 | 7681 | |
| 8828 | 7682 | return copy_bigjoiner_crtc_state(slave_crtc_state, new_crtc_state); |
| 8829 | 7683 | |
| 8830 | 7684 | claimed: |
| 8831 | 7685 | DRM_DEBUG_KMS("[CRTC:%d:%s] Slave is enabled as normal CRTC, but " |
| 8832 | 7686 | "[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); | |
| 8835 | 7689 | return -EINVAL; |
| 8836 | 7690 | } |
| 8837 | 7691 | |
| @@ -8865,35 +7719,37 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state, · 27 unmodified lines | ||
| 8865 | 7719 | * correspond to the last vblank and have no relation to the actual time when |
| 8866 | 7720 | * the flip done event was sent. |
| 8867 | 7721 | */ |
| 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) | |
| 8869 | 7723 | { |
| 8870 | 7724 | struct drm_i915_private *i915 = to_i915(state->base.dev); |
| 8871 | 7725 | const struct intel_crtc_state *old_crtc_state, *new_crtc_state; |
| 8872 | 7726 | const struct intel_plane_state *new_plane_state, *old_plane_state; |
| 8873 | − struct intel_crtc *crtc; | |
| 8874 | 7727 | struct intel_plane *plane; |
| 8875 | 7728 | int i; |
| 8876 | 7729 | |
| 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); | |
| 8883 | 7732 | |
| 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; | |
| 8893 | 7746 | } |
| 8894 | 7747 | |
| 8895 | 7748 | for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state, |
| 8896 | 7749 | new_plane_state, i) { |
| 7750 | + if (plane->pipe != crtc->pipe) | |
| 7751 | + continue; | |
| 7752 | + | |
| 8897 | 7753 | /* |
| 8898 | 7754 | * TODO: Async flip is only supported through the page flip IOCTL |
| 8899 | 7755 | * 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 | ||
| 8920 | 7776 | return -EINVAL; |
| 8921 | 7777 | } |
| 8922 | 7778 | |
| 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) { | |
| 8925 | 7787 | drm_dbg_kms(&i915->drm, "Stride cannot be changed in async flip\n"); |
| 8926 | 7788 | return -EINVAL; |
| 8927 | 7789 | } |
| @@ -9212,7 +8074,7 @@ static int intel_atomic_check(struct drm_device *dev, · 284 unmodified lines | ||
| 9212 | 8074 | for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, |
| 9213 | 8075 | new_crtc_state, i) { |
| 9214 | 8076 | if (new_crtc_state->uapi.async_flip) { |
| 9215 | − ret = intel_atomic_check_async(state); | |
| 8077 | + ret = intel_atomic_check_async(state, crtc); | |
| 9216 | 8078 | if (ret) |
| 9217 | 8079 | goto fail; |
| 9218 | 8080 | } |
| @@ -9417,15 +8279,17 @@ static void intel_update_crtc(struct intel_atomic_state *state, · 198 unmodified lines | ||
| 9417 | 8279 | |
| 9418 | 8280 | intel_fbc_update(state, crtc); |
| 9419 | 8281 | |
| 8282 | + intel_update_planes_on_crtc(state, crtc); | |
| 8283 | + | |
| 9420 | 8284 | /* Perform vblank evasion around commit operation */ |
| 9421 | 8285 | intel_pipe_update_start(new_crtc_state); |
| 9422 | 8286 | |
| 9423 | 8287 | commit_pipe_pre_planes(state, crtc); |
| 9424 | 8288 | |
| 9425 | 8289 | if (DISPLAY_VER(dev_priv) >= 9) |
| 9426 | − skl_update_planes_on_crtc(state, crtc); | |
| 8290 | + skl_arm_planes_on_crtc(state, crtc); | |
| 9427 | 8291 | else |
| 9428 | − i9xx_update_planes_on_crtc(state, crtc); | |
| 8292 | + i9xx_arm_planes_on_crtc(state, crtc); | |
| 9429 | 8293 | |
| 9430 | 8294 | commit_pipe_post_planes(state, crtc); |
| 9431 | 8295 | |
| @@ -9449,23 +8313,6 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, · 17 unmodified lines | ||
| 9449 | 8313 | { |
| 9450 | 8314 | struct drm_i915_private *dev_priv = to_i915(state->base.dev); |
| 9451 | 8315 | |
| 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 | − | |
| 9469 | 8316 | /* |
| 9470 | 8317 | * We need to disable pipe CRC before disabling the pipe, |
| 9471 | 8318 | * or we race against vblank off. |
| @@ -9490,10 +8337,22 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 18 unmodified lines | ||
| 9490 | 8337 | u32 handled = 0; |
| 9491 | 8338 | int i; |
| 9492 | 8339 | |
| 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 | + | |
| 9493 | 8352 | /* Only disable port sync and MST slaves */ |
| 9494 | 8353 | for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, |
| 9495 | 8354 | 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)) | |
| 9497 | 8356 | continue; |
| 9498 | 8357 | |
| 9499 | 8358 | if (!old_crtc_state->hw.active) |
| @@ -9505,10 +8364,10 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 5 unmodified lines | ||
| 9505 | 8364 | * Slave vblanks are masked till Master Vblanks. |
| 9506 | 8365 | */ |
| 9507 | 8366 | 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) | |
| 9509 | 8369 | continue; |
| 9510 | 8370 | |
| 9511 | − intel_pre_plane_update(state, crtc); | |
| 9512 | 8371 | intel_old_crtc_state_disables(state, old_crtc_state, |
| 9513 | 8372 | new_crtc_state, crtc); |
| 9514 | 8373 | handled |= BIT(crtc->pipe); |
| @@ -9518,21 +8377,14 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) · 3 unmodified lines | ||
| 9518 | 8377 | for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, |
| 9519 | 8378 | new_crtc_state, i) { |
| 9520 | 8379 | if (!intel_crtc_needs_modeset(new_crtc_state) || |
| 9521 | − (handled & BIT(crtc->pipe)) || | |
| 9522 | − old_crtc_state->bigjoiner_slave) | |
| 8380 | + (handled & BIT(crtc->pipe))) | |
| 9523 | 8381 | continue; |
| 9524 | 8382 | |
| 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; | |
| 9532 | 8385 | |
| 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); | |
| 9536 | 8388 | } |
| 9537 | 8389 | } |
| 9538 | 8390 | |
| @@ -9752,10 +8604,14 @@ static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *s · 213 unmodified lines | ||
| 9752 | 8604 | |
| 9753 | 8605 | for_each_new_intel_plane_in_state(state, plane, plane_state, i) { |
| 9754 | 8606 | struct drm_framebuffer *fb = plane_state->hw.fb; |
| 8607 | + int cc_plane; | |
| 9755 | 8608 | int ret; |
| 9756 | 8609 | |
| 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) | |
| 9759 | 8615 | continue; |
| 9760 | 8616 | |
| 9761 | 8617 | /* |
| @@ -9772,7 +8628,7 @@ static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *s · 10 unmodified lines | ||
| 9772 | 8628 | * GPU write on it. |
| 9773 | 8629 | */ |
| 9774 | 8630 | ret = i915_gem_object_read_from_page(intel_fb_obj(fb), |
| 9775 | − fb->offsets[2] + 16, | |
| 8631 | + fb->offsets[cc_plane] + 16, | |
| 9776 | 8632 | &plane_state->ccval, |
| 9777 | 8633 | sizeof(plane_state->ccval)); |
| 9778 | 8634 | /* 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 | ||
| 9840 | 8696 | } |
| 9841 | 8697 | } |
| 9842 | 8698 | |
| 9843 | − if (state->modeset) | |
| 9844 | − intel_encoders_update_prepare(state); | |
| 8699 | + intel_encoders_update_prepare(state); | |
| 9845 | 8700 | |
| 9846 | 8701 | intel_dbuf_pre_plane_update(state); |
| 9847 | − intel_psr_pre_plane_update(state); | |
| 9848 | 8702 | |
| 9849 | 8703 | for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { |
| 9850 | 8704 | 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 | ||
| 9854 | 8708 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ |
| 9855 | 8709 | dev_priv->display->commit_modeset_enables(state); |
| 9856 | 8710 | |
| 9857 | − if (state->modeset) { | |
| 9858 | − intel_encoders_update_complete(state); | |
| 8711 | + intel_encoders_update_complete(state); | |
| 9859 | 8712 | |
| 8713 | + if (state->modeset) | |
| 9860 | 8714 | intel_set_cdclk_post_plane_update(state); |
| 9861 | − } | |
| 8715 | + | |
| 8716 | + intel_wait_for_vblank_workers(state); | |
| 9862 | 8717 | |
| 9863 | 8718 | /* FIXME: We should call drm_atomic_helper_commit_hw_done() here |
| 9864 | 8719 | * 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 | ||
| 9874 | 8729 | for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { |
| 9875 | 8730 | if (new_crtc_state->uapi.async_flip) |
| 9876 | 8731 | 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); | |
| 9884 | 8732 | } |
| 9885 | 8733 | |
| 9886 | 8734 | /* |
| @@ -10580,7 +9428,7 @@ intel_mode_valid_max_plane_size(struct drm_i915_private *dev_priv, · 693 unmodified lines | ||
| 10580 | 9428 | |
| 10581 | 9429 | static const struct drm_mode_config_funcs intel_mode_funcs = { |
| 10582 | 9430 | .fb_create = intel_user_framebuffer_create, |
| 10583 | − .get_format_info = intel_get_format_info, | |
| 9431 | + .get_format_info = intel_fb_get_format_info, | |
| 10584 | 9432 | .output_poll_changed = intel_fbdev_output_poll_changed, |
| 10585 | 9433 | .mode_valid = intel_mode_valid, |
| 10586 | 9434 | .atomic_check = intel_atomic_check, |
| @@ -10640,7 +9488,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) · 53 unmodified lines | ||
| 10640 | 9488 | return; |
| 10641 | 9489 | |
| 10642 | 9490 | intel_init_cdclk_hooks(dev_priv); |
| 10643 | − intel_init_audio_hooks(dev_priv); | |
| 9491 | + intel_audio_hooks_init(dev_priv); | |
| 10644 | 9492 | |
| 10645 | 9493 | intel_dpll_init_clock_hook(dev_priv); |
| 10646 | 9494 | |
| @@ -11628,9 +10476,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) · 981 unmodified lines | ||
| 11628 | 10476 | struct intel_plane *plane; |
| 11629 | 10477 | int min_cdclk = 0; |
| 11630 | 10478 | |
| 11631 | − if (crtc_state->bigjoiner_slave) | |
| 11632 | − continue; | |
| 11633 | − | |
| 11634 | 10479 | if (crtc_state->hw.active) { |
| 11635 | 10480 | /* |
| 11636 | 10481 | * 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 | ||
| 11690 | 10535 | intel_bw_crtc_update(bw_state, crtc_state); |
| 11691 | 10536 | |
| 11692 | 10537 | 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 | − } | |
| 11726 | 10538 | } |
| 11727 | 10539 | } |
| 11728 | 10540 | |
| @@ -12027,7 +10839,7 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915) · 298 unmodified lines | ||
| 12027 | 10839 | destroy_workqueue(i915->flip_wq); |
| 12028 | 10840 | destroy_workqueue(i915->modeset_wq); |
| 12029 | 10841 | |
| 12030 | − intel_fbc_cleanup_cfb(i915); | |
| 10842 | + intel_fbc_cleanup(i915); | |
| 12031 | 10843 | } |
| 12032 | 10844 | |
| 12033 | 10845 | /* part #3: call after gem init */ |
| @@ -521,7 +521,6 @@ void intel_link_compute_m_n(u16 bpp, int nlanes, · 520 unmodified lines | ||
| 521 | 521 | int pixel_clock, int link_clock, |
| 522 | 522 | struct intel_link_m_n *m_n, |
| 523 | 523 | bool constant_n, bool fec_enable); |
| 524 | −void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv); | |
| 525 | 524 | u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv, |
| 526 | 525 | u32 pixel_format, u64 modifier); |
| 527 | 526 | enum drm_mode_status |
| @@ -542,9 +541,6 @@ int vlv_get_cck_clock(struct drm_i915_private *dev_priv, · 14 unmodified lines | ||
| 542 | 541 | const char *name, u32 reg, int ref_freq); |
| 543 | 542 | int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv, |
| 544 | 543 | 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); | |
| 548 | 544 | void intel_init_display_hooks(struct drm_i915_private *dev_priv); |
| 549 | 545 | unsigned int intel_fb_xy_to_linear(int x, int y, |
| 550 | 546 | const struct intel_plane_state *state, |
| @@ -580,10 +576,6 @@ struct drm_framebuffer * · 29 unmodified lines | ||
| 580 | 576 | intel_framebuffer_create(struct drm_i915_gem_object *obj, |
| 581 | 577 | struct drm_mode_fb_cmd2 *mode_cmd); |
| 582 | 578 | |
| 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); | |
| 587 | 579 | bool intel_fuzzy_clock_check(int clock1, int clock2); |
| 588 | 580 | |
| 589 | 581 | 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 | ||
| 592 | 584 | struct intel_crtc_state *pipe_config); |
| 593 | 585 | void intel_dp_set_m_n(const struct intel_crtc_state *crtc_state, |
| 594 | 586 | 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); | |
| 595 | 591 | int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n); |
| 596 | − | |
| 597 | 592 | bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state); |
| 598 | 593 | void hsw_enable_ips(const struct intel_crtc_state *crtc_state); |
| 599 | 594 | 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 | ||
| 610 | 605 | unsigned int intel_plane_fence_y_offset(const struct intel_plane_state *plane_state); |
| 611 | 606 | |
| 612 | 607 | 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); | |
| 616 | 608 | |
| 617 | 609 | struct intel_encoder * |
| 618 | 610 | 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 | ||
| 632 | 624 | void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915); |
| 633 | 625 | void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915); |
| 634 | 626 | void intel_display_resume(struct drm_device *dev); |
| 635 | −void intel_init_pch_refclk(struct drm_i915_private *dev_priv); | |
| 636 | 627 | int intel_modeset_all_pipes(struct intel_atomic_state *state); |
| 637 | 628 | |
| 638 | 629 | /* modesetting asserts */ |
| @@ -52,27 +52,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused) · 51 unmodified lines | ||
| 52 | 52 | wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); |
| 53 | 53 | mutex_lock(&fbc->lock); |
| 54 | 54 | |
| 55 | − if (intel_fbc_is_active(dev_priv)) | |
| 55 | + if (intel_fbc_is_active(fbc)) { | |
| 56 | 56 | seq_puts(m, "FBC enabled\n"); |
| 57 | − else | |
| 57 | + seq_printf(m, "Compressing: %s\n", | |
| 58 | + yesno(intel_fbc_is_compressing(fbc))); | |
| 59 | + } else { | |
| 58 | 60 | 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)); | |
| 76 | 61 | } |
| 77 | 62 | |
| 78 | 63 | mutex_unlock(&fbc->lock); |
| @@ -85,9 +70,6 @@ static int i915_fbc_false_color_get(void *data, u64 *val) · 6 unmodified lines | ||
| 85 | 70 | { |
| 86 | 71 | struct drm_i915_private *dev_priv = data; |
| 87 | 72 | |
| 88 | − if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv)) | |
| 89 | − return -ENODEV; | |
| 90 | − | |
| 91 | 73 | *val = dev_priv->fbc.false_color; |
| 92 | 74 | |
| 93 | 75 | return 0; |
| @@ -96,21 +78,8 @@ static int i915_fbc_false_color_get(void *data, u64 *val) · 2 unmodified lines | ||
| 96 | 78 | static int i915_fbc_false_color_set(void *data, u64 val) |
| 97 | 79 | { |
| 98 | 80 | 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; | |
| 108 | 81 | |
| 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); | |
| 114 | 83 | } |
| 115 | 84 | |
| 116 | 85 | 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 | ||
| 303 | 272 | }; |
| 304 | 273 | val = intel_de_read(dev_priv, |
| 305 | 274 | 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); | |
| 308 | 276 | if (status_val < ARRAY_SIZE(live_status)) |
| 309 | 277 | status = live_status[status_val]; |
| 310 | 278 | } else { |
| @@ -503,28 +471,9 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_edp_psr_debug_fops, · 192 unmodified lines | ||
| 503 | 471 | |
| 504 | 472 | static int i915_power_domain_info(struct seq_file *m, void *unused) |
| 505 | 473 | { |
| 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); | |
| 526 | 475 | |
| 527 | − mutex_unlock(&power_domains->lock); | |
| 476 | + intel_display_power_debug(i915, m); | |
| 528 | 477 | |
| 529 | 478 | return 0; |
| 530 | 479 | } |
| @@ -2095,7 +2044,7 @@ i915_fifo_underrun_reset_write(struct file *filp, · 1564 unmodified lines | ||
| 2095 | 2044 | return ret; |
| 2096 | 2045 | } |
| 2097 | 2046 | |
| 2098 | − ret = intel_fbc_reset_underrun(dev_priv); | |
| 2047 | + ret = intel_fbc_reset_underrun(&dev_priv->fbc); | |
| 2099 | 2048 | if (ret) |
| 2100 | 2049 | return ret; |
| 2101 | 2050 | |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include "intel_dpio_phy.h" |
| 16 | 16 | #include "intel_dpll.h" |
| 17 | 17 | #include "intel_hotplug.h" |
| 18 | +#include "intel_pch_refclk.h" | |
| 18 | 19 | #include "intel_pcode.h" |
| 19 | 20 | #include "intel_pm.h" |
| 20 | 21 | #include "intel_pps.h" |
| @@ -23,6 +24,98 @@ · 2 unmodified lines | ||
| 23 | 24 | #include "intel_vga.h" |
| 24 | 25 | #include "vlv_sideband.h" |
| 25 | 26 | |
| 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 | + | |
| 26 | 119 | bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv, |
| 27 | 120 | enum i915_power_well_id power_well_id); |
| 28 | 121 | |
| @@ -154,8 +247,8 @@ intel_display_power_domain_str(enum intel_display_power_domain domain) · 125 unmodified lines | ||
| 154 | 247 | return "MODESET"; |
| 155 | 248 | case POWER_DOMAIN_GT_IRQ: |
| 156 | 249 | 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"; | |
| 159 | 252 | case POWER_DOMAIN_TC_COLD_OFF: |
| 160 | 253 | return "TC_COLD_OFF"; |
| 161 | 254 | default: |
| @@ -434,6 +527,11 @@ static void hsw_power_well_enable(struct drm_i915_private *dev_priv, · 272 unmodified lines | ||
| 434 | 527 | |
| 435 | 528 | pg = DISPLAY_VER(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) : |
| 436 | 529 | 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 | + | |
| 437 | 535 | /* |
| 438 | 536 | * For PW1 we have to wait both for the PW0/PG0 fuse state |
| 439 | 537 | * before enabling the power well and PW1/PG1's own fuse |
| @@ -894,7 +992,7 @@ static u32 · 454 unmodified lines | ||
| 894 | 992 | sanitize_target_dc_state(struct drm_i915_private *dev_priv, |
| 895 | 993 | u32 target_dc_state) |
| 896 | 994 | { |
| 897 | − u32 states[] = { | |
| 995 | + static const u32 states[] = { | |
| 898 | 996 | DC_STATE_EN_UPTO_DC6, |
| 899 | 997 | DC_STATE_EN_UPTO_DC5, |
| 900 | 998 | DC_STATE_EN_DC3CO, |
| @@ -2802,7 +2900,7 @@ intel_display_power_put_mask_in_set(struct drm_i915_private *i915, · 1901 unmodified lines | ||
| 2802 | 2900 | ICL_PW_2_POWER_DOMAINS | \ |
| 2803 | 2901 | BIT_ULL(POWER_DOMAIN_MODESET) | \ |
| 2804 | 2902 | BIT_ULL(POWER_DOMAIN_AUX_A) | \ |
| 2805 | − BIT_ULL(POWER_DOMAIN_DPLL_DC_OFF) | \ | |
| 2903 | + BIT_ULL(POWER_DOMAIN_DC_OFF) | \ | |
| 2806 | 2904 | BIT_ULL(POWER_DOMAIN_INIT)) |
| 2807 | 2905 | |
| 2808 | 2906 | #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 | ||
| 3105 | 3203 | BIT_ULL(POWER_DOMAIN_MODESET) | \ |
| 3106 | 3204 | BIT_ULL(POWER_DOMAIN_AUX_A) | \ |
| 3107 | 3205 | BIT_ULL(POWER_DOMAIN_AUX_B) | \ |
| 3206 | + BIT_ULL(POWER_DOMAIN_PORT_DSI) | \ | |
| 3108 | 3207 | BIT_ULL(POWER_DOMAIN_INIT)) |
| 3109 | 3208 | |
| 3110 | 3209 | #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 | ||
| 6390 | 6489 | hsw_disable_pc8(i915); |
| 6391 | 6490 | } |
| 6392 | 6491 | } |
| 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 | +} | |
| @@ -6,11 +6,13 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __INTEL_DISPLAY_POWER_H__ |
| 7 | 7 | #define __INTEL_DISPLAY_POWER_H__ |
| 8 | 8 | |
| 9 | −#include "intel_display.h" | |
| 10 | 9 | #include "intel_runtime_pm.h" |
| 11 | 10 | #include "i915_reg.h" |
| 12 | 11 | |
| 12 | +enum dpio_channel; | |
| 13 | +enum dpio_phy; | |
| 13 | 14 | struct drm_i915_private; |
| 15 | +struct i915_power_well; | |
| 14 | 16 | struct intel_encoder; |
| 15 | 17 | |
| 16 | 18 | enum intel_display_power_domain { |
| @@ -117,7 +119,7 @@ enum intel_display_power_domain { · 100 unmodified lines | ||
| 117 | 119 | POWER_DOMAIN_GMBUS, |
| 118 | 120 | POWER_DOMAIN_MODESET, |
| 119 | 121 | POWER_DOMAIN_GT_IRQ, |
| 120 | − POWER_DOMAIN_DPLL_DC_OFF, | |
| 122 | + POWER_DOMAIN_DC_OFF, | |
| 121 | 123 | POWER_DOMAIN_TC_COLD_OFF, |
| 122 | 124 | POWER_DOMAIN_INIT, |
| 123 | 125 | |
| @@ -155,100 +157,6 @@ enum i915_power_well_id { · 31 unmodified lines | ||
| 155 | 157 | ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \ |
| 156 | 158 | (tran) + POWER_DOMAIN_TRANSCODER_A) |
| 157 | 159 | |
| 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 | − | |
| 252 | 160 | struct i915_power_domains { |
| 253 | 161 | /* |
| 254 | 162 | * 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 | ||
| 391 | 299 | intel_display_power_put_mask_in_set(i915, power_domain_set, power_domain_set->mask); |
| 392 | 300 | } |
| 393 | 301 | |
| 302 | +void intel_display_power_debug(struct drm_i915_private *i915, struct seq_file *m); | |
| 303 | + | |
| 394 | 304 | /* |
| 395 | 305 | * FIXME: We should probably switch this to a 0-based scheme to be consistent |
| 396 | 306 | * with how we now name/number DBUF_CTL instances. |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include <linux/async.h> |
| 30 | 30 | #include <linux/i2c.h> |
| 31 | +#include <linux/pm_qos.h> | |
| 31 | 32 | #include <linux/pwm.h> |
| 32 | 33 | #include <linux/sched/clock.h> |
| 33 | 34 | |
| @@ -41,6 +42,7 @@ · 7 unmodified lines | ||
| 41 | 42 | #include <drm/drm_probe_helper.h> |
| 42 | 43 | #include <drm/drm_rect.h> |
| 43 | 44 | #include <drm/drm_vblank.h> |
| 45 | +#include <drm/drm_vblank_work.h> | |
| 44 | 46 | #include <drm/i915_mei_hdcp_interface.h> |
| 45 | 47 | #include <media/cec-notifier.h> |
| 46 | 48 | |
| @@ -49,6 +51,7 @@ · 2 unmodified lines | ||
| 49 | 51 | struct drm_printer; |
| 50 | 52 | struct __intel_global_objs_state; |
| 51 | 53 | struct intel_ddi_buf_trans; |
| 54 | +struct intel_fbc; | |
| 52 | 55 | |
| 53 | 56 | /* |
| 54 | 57 | * Display related stuff |
| @@ -115,7 +118,8 @@ struct intel_fb_view { · 60 unmodified lines | ||
| 115 | 118 | * bytes for 0/180 degree rotation |
| 116 | 119 | * pixels for 90/270 degree rotation |
| 117 | 120 | */ |
| 118 | − unsigned int stride; | |
| 121 | + unsigned int mapping_stride; | |
| 122 | + unsigned int scanout_stride; | |
| 119 | 123 | } color_plane[4]; |
| 120 | 124 | }; |
| 121 | 125 | |
| @@ -194,10 +198,6 @@ struct intel_encoder { · 72 unmodified lines | ||
| 194 | 198 | void (*update_complete)(struct intel_atomic_state *, |
| 195 | 199 | struct intel_encoder *, |
| 196 | 200 | 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 *); | |
| 201 | 201 | void (*disable)(struct intel_atomic_state *, |
| 202 | 202 | struct intel_encoder *, |
| 203 | 203 | const struct intel_crtc_state *, |
| @@ -949,7 +949,6 @@ struct intel_crtc_state { · 745 unmodified lines | ||
| 949 | 949 | * accordingly. |
| 950 | 950 | */ |
| 951 | 951 | #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 */ | |
| 953 | 952 | unsigned long quirks; |
| 954 | 953 | |
| 955 | 954 | unsigned fb_bits; /* framebuffers to flip */ |
| @@ -1241,6 +1240,9 @@ struct intel_crtc_state { · 285 unmodified lines | ||
| 1241 | 1240 | u8 link_count; |
| 1242 | 1241 | u8 pixel_overlap; |
| 1243 | 1242 | } splitter; |
| 1243 | + | |
| 1244 | + /* for loading single buffered registers during vblank */ | |
| 1245 | + struct drm_vblank_work vblank_work; | |
| 1244 | 1246 | }; |
| 1245 | 1247 | |
| 1246 | 1248 | enum intel_pipe_crc_source { |
| @@ -1325,6 +1327,9 @@ struct intel_crtc { · 78 unmodified lines | ||
| 1325 | 1327 | /* scalers available on this crtc */ |
| 1326 | 1328 | int num_scalers; |
| 1327 | 1329 | |
| 1330 | + /* for loading single buffered registers during vblank */ | |
| 1331 | + struct pm_qos_request vblank_pm_qos; | |
| 1332 | + | |
| 1328 | 1333 | #ifdef CONFIG_DEBUG_FS |
| 1329 | 1334 | struct intel_pipe_crc pipe_crc; |
| 1330 | 1335 | #endif |
| @@ -1335,8 +1340,6 @@ struct intel_plane { · 4 unmodified lines | ||
| 1335 | 1340 | enum i9xx_plane_id i9xx_plane; |
| 1336 | 1341 | enum plane_id id; |
| 1337 | 1342 | enum pipe pipe; |
| 1338 | − bool has_fbc; | |
| 1339 | − bool has_ccs; | |
| 1340 | 1343 | bool need_async_flip_disable_wa; |
| 1341 | 1344 | u32 frontbuffer_bit; |
| 1342 | 1345 | |
| @@ -1344,6 +1347,8 @@ struct intel_plane { · 1 unmodified line | ||
| 1344 | 1347 | u32 base, cntl, size; |
| 1345 | 1348 | } cursor; |
| 1346 | 1349 | |
| 1350 | + struct intel_fbc *fbc; | |
| 1351 | + | |
| 1347 | 1352 | /* |
| 1348 | 1353 | * NOTE: Do not place new plane state fields here (e.g., when adding |
| 1349 | 1354 | * new plane properties). New runtime state should now be placed in |
| @@ -1362,11 +1367,17 @@ struct intel_plane { · 12 unmodified lines | ||
| 1362 | 1367 | unsigned int (*max_stride)(struct intel_plane *plane, |
| 1363 | 1368 | u32 pixel_format, u64 modifier, |
| 1364 | 1369 | 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, | |
| 1366 | 1372 | const struct intel_crtc_state *crtc_state, |
| 1367 | 1373 | 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); | |
| 1370 | 1381 | bool (*get_hw_state)(struct intel_plane *plane, enum pipe *pipe); |
| 1371 | 1382 | int (*check_plane)(struct intel_crtc_state *crtc_state, |
| 1372 | 1383 | struct intel_plane_state *plane_state); |
| @@ -1563,6 +1574,8 @@ struct intel_dp { · 190 unmodified lines | ||
| 1563 | 1574 | int num_sink_rates; |
| 1564 | 1575 | int sink_rates[DP_MAX_SUPPORTED_RATES]; |
| 1565 | 1576 | bool use_rate_select; |
| 1577 | + /* Max sink lane count as reported by DP_MAX_LANE_COUNT */ | |
| 1578 | + int max_sink_lane_count; | |
| 1566 | 1579 | /* intersection of source and sink rates */ |
| 1567 | 1580 | int num_common_rates; |
| 1568 | 1581 | int common_rates[DP_MAX_SUPPORTED_RATES]; |
| @@ -2041,20 +2054,4 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) · 472 unmodified lines | ||
| 2041 | 2054 | return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; |
| 2042 | 2055 | } |
| 2043 | 2056 | |
| 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 | − | |
| 2060 | 2057 | #endif /* __INTEL_DISPLAY_TYPES_H__ */ |
| @@ -20,6 +20,8 @@ enum { · 19 unmodified lines | ||
| 20 | 20 | DMC_FW_MAIN = 0, |
| 21 | 21 | DMC_FW_PIPEA, |
| 22 | 22 | DMC_FW_PIPEB, |
| 23 | + DMC_FW_PIPEC, | |
| 24 | + DMC_FW_PIPED, | |
| 23 | 25 | DMC_FW_MAX |
| 24 | 26 | }; |
| 25 | 27 | |
| @@ -127,7 +127,7 @@ static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp) · 126 unmodified lines | ||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /* 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) | |
| 131 | 131 | { |
| 132 | 132 | static const int dp_rates[] = { |
| 133 | 133 | 162000, 270000, 540000, 810000 |
| @@ -197,6 +197,54 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp) · 63 unmodified lines | ||
| 197 | 197 | intel_dp->num_sink_rates = i; |
| 198 | 198 | } |
| 199 | 199 | |
| 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 | + | |
| 200 | 248 | /* Get length of rates array potentially limited by max_rate. */ |
| 201 | 249 | static int intel_dp_rate_limit_len(const int *rates, int len, int max_rate) |
| 202 | 250 | { |
| @@ -219,10 +267,19 @@ static int intel_dp_common_len_rate_limit(const struct intel_dp *intel_dp, · 16 unmodified lines | ||
| 219 | 267 | intel_dp->num_common_rates, max_rate); |
| 220 | 268 | } |
| 221 | 269 | |
| 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 | + | |
| 222 | 279 | /* Theoretical max between source and sink */ |
| 223 | 280 | static int intel_dp_max_common_rate(struct intel_dp *intel_dp) |
| 224 | 281 | { |
| 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); | |
| 226 | 283 | } |
| 227 | 284 | |
| 228 | 285 | /* 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 | ||
| 230 | 287 | { |
| 231 | 288 | struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); |
| 232 | 289 | 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; | |
| 234 | 291 | int fia_max = intel_tc_port_fia_max_lane_count(dig_port); |
| 235 | 292 | int lttpr_max = drm_dp_lttpr_max_lane_count(intel_dp->lttpr_common_caps); |
| 236 | 293 | |
| @@ -242,7 +299,15 @@ static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) · 5 unmodified lines | ||
| 242 | 299 | |
| 243 | 300 | int intel_dp_max_lane_count(struct intel_dp *intel_dp) |
| 244 | 301 | { |
| 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 | + } | |
| 246 | 311 | } |
| 247 | 312 | |
| 248 | 313 | /* |
| @@ -554,13 +619,13 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · 305 unmodified lines | ||
| 554 | 619 | if (index > 0) { |
| 555 | 620 | if (intel_dp_is_edp(intel_dp) && |
| 556 | 621 | !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), | |
| 558 | 623 | lane_count)) { |
| 559 | 624 | drm_dbg_kms(&i915->drm, |
| 560 | 625 | "Retrying Link training for eDP with same parameters\n"); |
| 561 | 626 | return 0; |
| 562 | 627 | } |
| 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); | |
| 564 | 629 | intel_dp->max_link_lane_count = lane_count; |
| 565 | 630 | } else if (lane_count > 1) { |
| 566 | 631 | 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 | ||
| 1000 | 1065 | int |
| 1001 | 1066 | intel_dp_max_link_rate(struct intel_dp *intel_dp) |
| 1002 | 1067 | { |
| 1003 | − struct drm_i915_private *i915 = dp_to_i915(intel_dp); | |
| 1004 | 1068 | int len; |
| 1005 | 1069 | |
| 1006 | 1070 | 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; | |
| 1009 | 1071 | |
| 1010 | − return intel_dp->common_rates[len - 1]; | |
| 1072 | + return intel_dp_common_rate(intel_dp, len - 1); | |
| 1011 | 1073 | } |
| 1012 | 1074 | |
| 1013 | 1075 | 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 | ||
| 1204 | 1266 | output_bpp); |
| 1205 | 1267 | |
| 1206 | 1268 | 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); | |
| 1208 | 1270 | if (link_rate < limits->min_rate || |
| 1209 | 1271 | link_rate > limits->max_rate) |
| 1210 | 1272 | continue; |
| @@ -1283,7 +1345,7 @@ static int intel_dp_dsc_compute_params(struct intel_encoder *encoder, · 72 unmodified lines | ||
| 1283 | 1345 | else |
| 1284 | 1346 | vdsc_cfg->slice_height = 2; |
| 1285 | 1347 | |
| 1286 | − ret = intel_dsc_compute_params(encoder, crtc_state); | |
| 1348 | + ret = intel_dsc_compute_params(crtc_state); | |
| 1287 | 1349 | if (ret) |
| 1288 | 1350 | return ret; |
| 1289 | 1351 | |
| @@ -1452,17 +1514,10 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, · 162 unmodified lines | ||
| 1452 | 1514 | &pipe_config->hw.adjusted_mode; |
| 1453 | 1515 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
| 1454 | 1516 | struct link_config_limits limits; |
| 1455 | − int common_len; | |
| 1456 | 1517 | int ret; |
| 1457 | 1518 | |
| 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); | |
| 1466 | 1521 | |
| 1467 | 1522 | limits.min_lane_count = 1; |
| 1468 | 1523 | 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 | ||
| 2143 | 2198 | return max_frl_rate; |
| 2144 | 2199 | } |
| 2145 | 2200 | |
| 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 | + | |
| 2146 | 2213 | static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) |
| 2147 | 2214 | { |
| 2148 | 2215 | #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 | ||
| 2153 | 2220 | u8 max_frl_bw_mask = 0, frl_trained_mask; |
| 2154 | 2221 | bool is_active; |
| 2155 | 2222 | |
| 2156 | − ret = drm_dp_pcon_reset_frl_config(&intel_dp->aux); | |
| 2157 | − if (ret < 0) | |
| 2158 | − return ret; | |
| 2159 | − | |
| 2160 | 2223 | max_pcon_frl_bw = intel_dp->dfp.pcon_max_frl_bw; |
| 2161 | 2224 | drm_dbg(&i915->drm, "PCON max rate = %d Gbps\n", max_pcon_frl_bw); |
| 2162 | 2225 | |
| @@ -2168,6 +2231,12 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 5 unmodified lines | ||
| 2168 | 2231 | if (max_frl_bw <= 0) |
| 2169 | 2232 | return -EINVAL; |
| 2170 | 2233 | |
| 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 | + | |
| 2171 | 2240 | ret = drm_dp_pcon_frl_prepare(&intel_dp->aux, false); |
| 2172 | 2241 | if (ret < 0) |
| 2173 | 2242 | return ret; |
| @@ -2177,7 +2246,6 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 3 unmodified lines | ||
| 2177 | 2246 | if (!is_active) |
| 2178 | 2247 | return -ETIMEDOUT; |
| 2179 | 2248 | |
| 2180 | − max_frl_bw_mask = intel_dp_pcon_set_frl_mask(max_frl_bw); | |
| 2181 | 2249 | ret = drm_dp_pcon_frl_configure_1(&intel_dp->aux, max_frl_bw, |
| 2182 | 2250 | DP_PCON_ENABLE_SEQUENTIAL_LINK); |
| 2183 | 2251 | if (ret < 0) |
| @@ -2193,19 +2261,15 @@ static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) · 9 unmodified lines | ||
| 2193 | 2261 | * Wait for FRL to be completed |
| 2194 | 2262 | * Check if the HDMI Link is up and active. |
| 2195 | 2263 | */ |
| 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); | |
| 2197 | 2267 | |
| 2198 | 2268 | if (!is_active) |
| 2199 | 2269 | return -ETIMEDOUT; |
| 2200 | 2270 | |
| 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); | |
| 2209 | 2273 | intel_dp->frl.trained_rate_gbps = intel_dp_pcon_get_frl_mask(frl_trained_mask); |
| 2210 | 2274 | intel_dp->frl.is_trained = true; |
| 2211 | 2275 | 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 | ||
| 2223 | 2287 | return false; |
| 2224 | 2288 | } |
| 2225 | 2289 | |
| 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 | + | |
| 2226 | 2312 | void intel_dp_check_frl_training(struct intel_dp *intel_dp) |
| 2227 | 2313 | { |
| 2228 | 2314 | 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 | ||
| 2241 | 2327 | int ret, mode; |
| 2242 | 2328 | |
| 2243 | 2329 | 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); | |
| 2245 | 2331 | mode = drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, NULL); |
| 2246 | 2332 | |
| 2247 | 2333 | 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 | ||
| 2603 | 2689 | intel_dp->use_rate_select = true; |
| 2604 | 2690 | else |
| 2605 | 2691 | intel_dp_set_sink_rates(intel_dp); |
| 2692 | + intel_dp_set_max_sink_lane_count(intel_dp); | |
| 2606 | 2693 | |
| 2607 | 2694 | intel_dp_set_common_rates(intel_dp); |
| 2608 | 2695 | intel_dp_reset_max_link_params(intel_dp); |
| @@ -2648,6 +2735,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) · 39 unmodified lines | ||
| 2648 | 2735 | drm_dp_is_branch(intel_dp->dpcd)); |
| 2649 | 2736 | |
| 2650 | 2737 | intel_dp_set_sink_rates(intel_dp); |
| 2738 | + intel_dp_set_max_sink_lane_count(intel_dp); | |
| 2651 | 2739 | intel_dp_set_common_rates(intel_dp); |
| 2652 | 2740 | } |
| 2653 | 2741 | |
| @@ -5014,6 +5102,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port, · 2360 unmodified lines | ||
| 5014 | 5102 | |
| 5015 | 5103 | intel_dp_set_source_rates(intel_dp); |
| 5016 | 5104 | intel_dp_set_default_sink_rates(intel_dp); |
| 5105 | + intel_dp_set_default_max_sink_lane_count(intel_dp); | |
| 5017 | 5106 | intel_dp_set_common_rates(intel_dp); |
| 5018 | 5107 | intel_dp_reset_max_link_params(intel_dp); |
| 5019 | 5108 | |
| @@ -301,7 +301,10 @@ static u8 intel_dp_phy_preemph_max(struct intel_dp *intel_dp, · 300 unmodified lines | ||
| 301 | 301 | static bool has_per_lane_signal_levels(struct intel_dp *intel_dp, |
| 302 | 302 | enum drm_dp_phy dp_phy) |
| 303 | 303 | { |
| 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; | |
| 305 | 308 | } |
| 306 | 309 | |
| 307 | 310 | /* 128b/132b */ |
| @@ -683,15 +686,6 @@ intel_dp_prepare_link_train(struct intel_dp *intel_dp, · 375 unmodified lines | ||
| 683 | 686 | return true; |
| 684 | 687 | } |
| 685 | 688 | |
| 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 | − | |
| 695 | 689 | static bool intel_dp_adjust_request_changed(const struct intel_crtc_state *crtc_state, |
| 696 | 690 | const u8 old_link_status[DP_LINK_STATUS_SIZE], |
| 697 | 691 | 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 | ||
| 750 | 744 | u8 link_status[DP_LINK_STATUS_SIZE]; |
| 751 | 745 | bool max_vswing_reached = false; |
| 752 | 746 | 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)); | |
| 753 | 752 | |
| 754 | 753 | intel_dp_phy_name(dp_phy, phy_name, sizeof(phy_name)); |
| 755 | 754 | |
| @@ -777,7 +776,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp, · 21 unmodified lines | ||
| 777 | 776 | |
| 778 | 777 | voltage_tries = 1; |
| 779 | 778 | 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); | |
| 781 | 780 | |
| 782 | 781 | if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, dp_phy, |
| 783 | 782 | link_status) < 0) { |
| @@ -895,19 +894,6 @@ static u32 intel_dp_training_pattern(struct intel_dp *intel_dp, · 111 unmodified lines | ||
| 895 | 894 | return DP_TRAINING_PATTERN_2; |
| 896 | 895 | } |
| 897 | 896 | |
| 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 | − | |
| 911 | 897 | /* |
| 912 | 898 | * Perform the link training channel equalization phase on the given DP PHY |
| 913 | 899 | * 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 | ||
| 925 | 911 | u8 link_status[DP_LINK_STATUS_SIZE]; |
| 926 | 912 | bool channel_eq = false; |
| 927 | 913 | 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)); | |
| 928 | 919 | |
| 929 | 920 | intel_dp_phy_name(dp_phy, phy_name, sizeof(phy_name)); |
| 930 | 921 | |
| @@ -944,8 +935,8 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp, · 13 unmodified lines | ||
| 944 | 935 | } |
| 945 | 936 | |
| 946 | 937 | 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 | + | |
| 949 | 940 | if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, dp_phy, |
| 950 | 941 | link_status) < 0) { |
| 951 | 942 | drm_err(&i915->drm, |
| @@ -231,6 +231,7 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 230 unmodified lines | ||
| 231 | 231 | struct drm_i915_private *dev_priv = to_i915(state->base.dev); |
| 232 | 232 | struct drm_connector_list_iter connector_list_iter; |
| 233 | 233 | struct intel_connector *connector_iter; |
| 234 | + int ret = 0; | |
| 234 | 235 | |
| 235 | 236 | if (DISPLAY_VER(dev_priv) < 12) |
| 236 | 237 | return 0; |
| @@ -243,7 +244,6 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 6 unmodified lines | ||
| 243 | 244 | struct intel_digital_connector_state *conn_iter_state; |
| 244 | 245 | struct intel_crtc_state *crtc_state; |
| 245 | 246 | struct intel_crtc *crtc; |
| 246 | − int ret; | |
| 247 | 247 | |
| 248 | 248 | if (connector_iter->mst_port != connector->mst_port || |
| 249 | 249 | connector_iter == connector) |
| @@ -252,8 +252,8 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 2 unmodified lines | ||
| 252 | 252 | conn_iter_state = intel_atomic_get_digital_connector_state(state, |
| 253 | 253 | connector_iter); |
| 254 | 254 | 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; | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if (!conn_iter_state->base.crtc) |
| @@ -262,20 +262,18 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector, · 2 unmodified lines | ||
| 262 | 262 | crtc = to_intel_crtc(conn_iter_state->base.crtc); |
| 263 | 263 | crtc_state = intel_atomic_get_crtc_state(&state->base, crtc); |
| 264 | 264 | 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; | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | 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; | |
| 274 | 272 | crtc_state->uapi.mode_changed = true; |
| 275 | 273 | } |
| 276 | 274 | drm_connector_list_iter_end(&connector_list_iter); |
| 277 | 275 | |
| 278 | − return 0; | |
| 276 | + return ret; | |
| 279 | 277 | } |
| 280 | 278 | |
| 281 | 279 | static int |
| @@ -348,16 +346,6 @@ static void wait_for_act_sent(struct intel_encoder *encoder, · 66 unmodified lines | ||
| 348 | 346 | drm_dp_check_act_status(&intel_dp->mst_mgr); |
| 349 | 347 | } |
| 350 | 348 | |
| 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 | − | |
| 361 | 349 | static void intel_mst_disable_dp(struct intel_atomic_state *state, |
| 362 | 350 | struct intel_encoder *encoder, |
| 363 | 351 | 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 | ||
| 382 | 370 | if (ret) { |
| 383 | 371 | drm_dbg_kms(&i915->drm, "failed to update payload %d\n", ret); |
| 384 | 372 | } |
| 373 | + if (old_crtc_state->has_audio) | |
| 374 | + intel_audio_codec_disable(encoder, | |
| 375 | + old_crtc_state, old_conn_state); | |
| 385 | 376 | } |
| 386 | 377 | |
| 387 | 378 | 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 | ||
| 916 | 907 | |
| 917 | 908 | intel_encoder->compute_config = intel_dp_mst_compute_config; |
| 918 | 909 | intel_encoder->compute_config_late = intel_dp_mst_compute_config_late; |
| 919 | − intel_encoder->pre_disable = intel_mst_pre_disable_dp; | |
| 920 | 910 | intel_encoder->disable = intel_mst_disable_dp; |
| 921 | 911 | intel_encoder->post_disable = intel_mst_post_disable_dp; |
| 922 | 912 | intel_encoder->update_pipe = intel_ddi_update_pipe; |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "intel_dpio_phy.h" |
| 27 | 27 | #include "intel_dpll.h" |
| 28 | 28 | #include "intel_dpll_mgr.h" |
| 29 | +#include "intel_pch_refclk.h" | |
| 29 | 30 | #include "intel_tc.h" |
| 30 | 31 | |
| 31 | 32 | /** |
| @@ -3740,7 +3741,7 @@ static void combo_pll_enable(struct drm_i915_private *dev_priv, · 3708 unmodified lines | ||
| 3740 | 3741 | * domain. |
| 3741 | 3742 | */ |
| 3742 | 3743 | pll->wakeref = intel_display_power_get(dev_priv, |
| 3743 | − POWER_DOMAIN_DPLL_DC_OFF); | |
| 3744 | + POWER_DOMAIN_DC_OFF); | |
| 3744 | 3745 | } |
| 3745 | 3746 | |
| 3746 | 3747 | 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 | ||
| 3847 | 3848 | |
| 3848 | 3849 | if (IS_JSL_EHL(dev_priv) && |
| 3849 | 3850 | 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, | |
| 3851 | 3852 | pll->wakeref); |
| 3852 | 3853 | } |
| 3853 | 3854 | |
| @@ -4231,7 +4232,7 @@ static void readout_dpll_hw_state(struct drm_i915_private *i915, · 377 unmodified lines | ||
| 4231 | 4232 | if (IS_JSL_EHL(i915) && pll->on && |
| 4232 | 4233 | pll->info->id == DPLL_ID_EHL_DPLL4) { |
| 4233 | 4234 | pll->wakeref = intel_display_power_get(i915, |
| 4234 | − POWER_DOMAIN_DPLL_DC_OFF); | |
| 4235 | + POWER_DOMAIN_DC_OFF); | |
| 4235 | 4236 | } |
| 4236 | 4237 | |
| 4237 | 4238 | pll->state.pipe_mask = 0; |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #include <linux/types.h> |
| 29 | 29 | |
| 30 | −#include "intel_display.h" | |
| 31 | 30 | #include "intel_wakeref.h" |
| 32 | 31 | |
| 33 | 32 | /*FIXME: Move this to a more appropriate place. */ |
| @@ -37,6 +36,7 @@ · 3 unmodified lines | ||
| 37 | 36 | (void) (&__a == &__b); \ |
| 38 | 37 | __a > __b ? (__a - __b) : (__b - __a); }) |
| 39 | 38 | |
| 39 | +enum tc_port; | |
| 40 | 40 | struct drm_device; |
| 41 | 41 | struct drm_i915_private; |
| 42 | 42 | struct intel_atomic_state; |
| @@ -167,6 +167,64 @@ void intel_dpt_unpin(struct i915_address_space *vm) · 166 unmodified lines | ||
| 167 | 167 | i915_vma_put(dpt->vma); |
| 168 | 168 | } |
| 169 | 169 | |
| 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 | + | |
| 170 | 228 | struct i915_address_space * |
| 171 | 229 | intel_dpt_create(struct intel_framebuffer *fb) |
| 172 | 230 | { |
| @@ -6,6 +6,8 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __INTEL_DPT_H__ |
| 7 | 7 | #define __INTEL_DPT_H__ |
| 8 | 8 | |
| 9 | +struct drm_i915_private; | |
| 10 | + | |
| 9 | 11 | struct i915_address_space; |
| 10 | 12 | struct i915_vma; |
| 11 | 13 | struct intel_framebuffer; |
| @@ -13,6 +15,8 @@ struct intel_framebuffer; · 1 unmodified line | ||
| 13 | 15 | void intel_dpt_destroy(struct i915_address_space *vm); |
| 14 | 16 | struct i915_vma *intel_dpt_pin(struct i915_address_space *vm); |
| 15 | 17 | 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); | |
| 16 | 20 | struct i915_address_space * |
| 17 | 21 | intel_dpt_create(struct intel_framebuffer *fb); |
| 18 | 22 | |
| @@ -100,7 +100,7 @@ void intel_dsb_indexed_reg_write(const struct intel_crtc_state *crtc_state, · 99 unmodified lines | ||
| 100 | 100 | u32 reg_val; |
| 101 | 101 | |
| 102 | 102 | if (!dsb) { |
| 103 | − intel_de_write(dev_priv, reg, val); | |
| 103 | + intel_de_write_fw(dev_priv, reg, val); | |
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | buf = dsb->cmd_buf; |
| @@ -177,7 +177,7 @@ void intel_dsb_reg_write(const struct intel_crtc_state *crtc_state, · 70 unmodified lines | ||
| 177 | 177 | |
| 178 | 178 | dsb = crtc_state->dsb; |
| 179 | 179 | if (!dsb) { |
| 180 | − intel_de_write(dev_priv, reg, val); | |
| 180 | + intel_de_write_fw(dev_priv, reg, val); | |
| 181 | 181 | return; |
| 182 | 182 | } |
| 183 | 183 | |
| @@ -166,57 +166,15 @@ static inline u16 intel_dsi_encoder_ports(struct intel_encoder *encoder) · 165 unmodified lines | ||
| 166 | 166 | return enc_to_intel_dsi(encoder)->ports; |
| 167 | 167 | } |
| 168 | 168 | |
| 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 */ | |
| 174 | 169 | int intel_dsi_bitrate(const struct intel_dsi *intel_dsi); |
| 175 | 170 | int intel_dsi_tlpx_ns(const struct intel_dsi *intel_dsi); |
| 176 | 171 | enum drm_panel_orientation |
| 177 | 172 | 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); | |
| 182 | 173 | int intel_dsi_get_modes(struct drm_connector *connector); |
| 183 | 174 | enum drm_mode_status intel_dsi_mode_valid(struct drm_connector *connector, |
| 184 | 175 | struct drm_display_mode *mode); |
| 185 | 176 | struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi, |
| 186 | 177 | const struct mipi_dsi_host_ops *funcs, |
| 187 | 178 | 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); | |
| 221 | 179 | |
| 222 | 180 | #endif /* _INTEL_DSI_H */ |
| @@ -71,6 +71,7 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32 · 70 unmodified lines | ||
| 71 | 71 | u8 data[2] = {}; |
| 72 | 72 | enum port port; |
| 73 | 73 | size_t len = panel->backlight.max > U8_MAX ? 2 : 1; |
| 74 | + unsigned long mode_flags; | |
| 74 | 75 | |
| 75 | 76 | if (len == 1) { |
| 76 | 77 | data[0] = level; |
| @@ -81,8 +82,11 @@ static void dcs_set_backlight(const struct drm_connector_state *conn_state, u32 · 4 unmodified lines | ||
| 81 | 82 | |
| 82 | 83 | for_each_dsi_port(port, intel_dsi->dcs_backlight_ports) { |
| 83 | 84 | dsi_device = intel_dsi->dsi_hosts[port]->device; |
| 85 | + mode_flags = dsi_device->mode_flags; | |
| 86 | + dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM; | |
| 84 | 87 | mipi_dsi_dcs_write(dsi_device, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, |
| 85 | 88 | &data, len); |
| 89 | + dsi_device->mode_flags = mode_flags; | |
| 86 | 90 | } |
| 87 | 91 | } |
| 88 | 92 | |
| @@ -41,6 +41,8 @@ · 40 unmodified lines | ||
| 41 | 41 | #include "i915_drv.h" |
| 42 | 42 | #include "intel_display_types.h" |
| 43 | 43 | #include "intel_dsi.h" |
| 44 | +#include "intel_dsi_vbt.h" | |
| 45 | +#include "vlv_dsi.h" | |
| 44 | 46 | #include "vlv_sideband.h" |
| 45 | 47 | |
| 46 | 48 | #define MIPI_TRANSFER_MODE_SHIFT 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__ */ | |
| @@ -13,26 +13,465 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a)) |
| 15 | 15 | |
| 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) | |
| 17 | 381 | { |
| 18 | − if (!is_ccs_modifier(fb->modifier)) | |
| 382 | + int yuv_planes; | |
| 383 | + | |
| 384 | + if (!info->is_yuv) | |
| 19 | 385 | return false; |
| 20 | 386 | |
| 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; | |
| 22 | 416 | } |
| 23 | 417 | |
| 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) | |
| 25 | 427 | { |
| 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); | |
| 27 | 431 | } |
| 28 | 432 | |
| 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) | |
| 30 | 442 | { |
| 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); | |
| 33 | 447 | } |
| 34 | 448 | |
| 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) | |
| 36 | 475 | { |
| 37 | 476 | return intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier) && |
| 38 | 477 | color_plane == 1; |
| @@ -41,12 +480,13 @@ bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane) · 2 unmodified lines | ||
| 41 | 480 | bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane) |
| 42 | 481 | { |
| 43 | 482 | 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); | |
| 45 | 485 | } |
| 46 | 486 | |
| 47 | 487 | int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane) |
| 48 | 488 | { |
| 49 | − drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) || | |
| 489 | + drm_WARN_ON(fb->dev, !intel_fb_is_ccs_modifier(fb->modifier) || | |
| 50 | 490 | (main_plane && main_plane >= fb->format->num_planes / 2)); |
| 51 | 491 | |
| 52 | 492 | 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 | ||
| 54 | 494 | |
| 55 | 495 | int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane) |
| 56 | 496 | { |
| 57 | − drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) || | |
| 497 | + drm_WARN_ON(fb->dev, !intel_fb_is_ccs_modifier(fb->modifier) || | |
| 58 | 498 | ccs_plane < fb->format->num_planes / 2); |
| 59 | 499 | |
| 60 | 500 | 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 | ||
| 63 | 503 | return ccs_plane - fb->format->num_planes / 2; |
| 64 | 504 | } |
| 65 | 505 | |
| 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 | − | |
| 79 | 506 | static unsigned int gen12_ccs_aux_stride(struct intel_framebuffer *fb, int ccs_plane) |
| 80 | 507 | { |
| 81 | − struct drm_i915_private *i915 = to_i915(fb->base.dev); | |
| 82 | 508 | int main_plane = skl_ccs_to_main_plane(&fb->base, ccs_plane); |
| 83 | 509 | unsigned int main_stride = fb->base.pitches[main_plane]; |
| 84 | 510 | unsigned int main_tile_width = intel_tile_width_bytes(&fb->base, main_plane); |
| 85 | 511 | |
| 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 | − | |
| 95 | 512 | return DIV_ROUND_UP(main_stride, 4 * main_tile_width) * 64; |
| 96 | 513 | } |
| 97 | 514 | |
| @@ -99,7 +516,7 @@ int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane) · 1 unmodified line | ||
| 99 | 516 | { |
| 100 | 517 | struct drm_i915_private *i915 = to_i915(fb->dev); |
| 101 | 518 | |
| 102 | − if (is_ccs_modifier(fb->modifier)) | |
| 519 | + if (intel_fb_is_ccs_modifier(fb->modifier)) | |
| 103 | 520 | return main_to_ccs_plane(fb, main_plane); |
| 104 | 521 | else if (DISPLAY_VER(i915) < 11 && |
| 105 | 522 | 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 | ||
| 128 | 545 | else |
| 129 | 546 | return 512; |
| 130 | 547 | 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)) | |
| 132 | 549 | return 128; |
| 133 | 550 | fallthrough; |
| 134 | 551 | case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS: |
| 135 | 552 | case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC: |
| 136 | 553 | 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)) | |
| 138 | 556 | return 64; |
| 139 | 557 | fallthrough; |
| 140 | 558 | 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 | ||
| 143 | 561 | else |
| 144 | 562 | return 512; |
| 145 | 563 | 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)) | |
| 147 | 565 | return 128; |
| 148 | 566 | fallthrough; |
| 149 | 567 | 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 | ||
| 199 | 617 | { |
| 200 | 618 | intel_tile_dims(fb, color_plane, tile_width, tile_height); |
| 201 | 619 | |
| 202 | − if (is_gen12_ccs_plane(fb, color_plane)) | |
| 620 | + if (intel_fb_is_gen12_ccs_aux_plane(fb, color_plane)) | |
| 203 | 621 | *tile_height = 1; |
| 204 | 622 | } |
| 205 | 623 | |
| @@ -223,16 +641,19 @@ intel_fb_align_height(const struct drm_framebuffer *fb, · 17 unmodified lines | ||
| 223 | 641 | |
| 224 | 642 | static unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier) |
| 225 | 643 | { |
| 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: | |
| 234 | 649 | 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; | |
| 235 | 655 | default: |
| 656 | + MISSING_CASE(tiling_caps); | |
| 236 | 657 | return I915_TILING_NONE; |
| 237 | 658 | } |
| 238 | 659 | } |
| @@ -271,7 +692,7 @@ unsigned int intel_surf_alignment(const struct drm_framebuffer *fb, · 32 unmodified lines | ||
| 271 | 692 | return 512 * 4096; |
| 272 | 693 | |
| 273 | 694 | /* 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)) | |
| 275 | 696 | return 4096; |
| 276 | 697 | |
| 277 | 698 | 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 | ||
| 330 | 751 | * TODO: Deduct the subsampling from the char block for all CCS |
| 331 | 752 | * formats and planes. |
| 332 | 753 | */ |
| 333 | − if (!is_gen12_ccs_plane(fb, color_plane)) { | |
| 754 | + if (!intel_fb_is_gen12_ccs_aux_plane(fb, color_plane)) { | |
| 334 | 755 | *hsub = fb->format->hsub; |
| 335 | 756 | *vsub = fb->format->vsub; |
| 336 | 757 | |
| @@ -357,24 +778,13 @@ void intel_fb_plane_get_subsampling(int *hsub, int *vsub, · 20 unmodified lines | ||
| 357 | 778 | |
| 358 | 779 | static void intel_fb_plane_dims(const struct intel_framebuffer *fb, int color_plane, int *w, int *h) |
| 359 | 780 | { |
| 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) ? | |
| 362 | 782 | skl_ccs_to_main_plane(&fb->base, color_plane) : 0; |
| 363 | 783 | unsigned int main_width = fb->base.width; |
| 364 | 784 | unsigned int main_height = fb->base.height; |
| 365 | 785 | int main_hsub, main_vsub; |
| 366 | 786 | int hsub, vsub; |
| 367 | 787 | |
| 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 | − | |
| 378 | 788 | intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, &fb->base, main_plane); |
| 379 | 789 | intel_fb_plane_get_subsampling(&hsub, &vsub, &fb->base, color_plane); |
| 380 | 790 | |
| @@ -409,6 +819,20 @@ static u32 intel_adjust_tile_offset(int *x, int *y, · 28 unmodified lines | ||
| 409 | 819 | return new_offset; |
| 410 | 820 | } |
| 411 | 821 | |
| 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 | + | |
| 412 | 836 | static u32 intel_adjust_aligned_offset(int *x, int *y, |
| 413 | 837 | const struct drm_framebuffer *fb, |
| 414 | 838 | int color_plane, |
| @@ -439,10 +863,8 @@ static u32 intel_adjust_aligned_offset(int *x, int *y, · 24 unmodified lines | ||
| 439 | 863 | tile_size, pitch_tiles, |
| 440 | 864 | old_offset, new_offset); |
| 441 | 865 | } 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); | |
| 446 | 868 | } |
| 447 | 869 | |
| 448 | 870 | return new_offset; |
| @@ -459,7 +881,7 @@ u32 intel_plane_adjust_aligned_offset(int *x, int *y, · 10 unmodified lines | ||
| 459 | 881 | { |
| 460 | 882 | return intel_adjust_aligned_offset(x, y, state->hw.fb, color_plane, |
| 461 | 883 | state->hw.rotation, |
| 462 | − state->view.color_plane[color_plane].stride, | |
| 884 | + state->view.color_plane[color_plane].mapping_stride, | |
| 463 | 885 | old_offset, new_offset); |
| 464 | 886 | } |
| 465 | 887 | |
| @@ -540,7 +962,7 @@ u32 intel_plane_compute_aligned_offset(int *x, int *y, · 74 unmodified lines | ||
| 540 | 962 | struct drm_i915_private *i915 = to_i915(intel_plane->base.dev); |
| 541 | 963 | const struct drm_framebuffer *fb = state->hw.fb; |
| 542 | 964 | 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; | |
| 544 | 966 | u32 alignment; |
| 545 | 967 | |
| 546 | 968 | if (intel_plane->id == PLANE_CURSOR) |
| @@ -562,6 +984,7 @@ static int intel_fb_offset_to_xy(int *x, int *y, · 15 unmodified lines | ||
| 562 | 984 | u32 alignment; |
| 563 | 985 | |
| 564 | 986 | if (DISPLAY_VER(i915) >= 12 && |
| 987 | + !intel_fb_needs_pot_stride_remap(to_intel_framebuffer(fb)) && | |
| 565 | 988 | is_semiplanar_uv_plane(fb, color_plane)) |
| 566 | 989 | alignment = intel_tile_row_size(fb, color_plane); |
| 567 | 990 | 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 | ||
| 610 | 1033 | int ccs_x, ccs_y; |
| 611 | 1034 | int main_x, main_y; |
| 612 | 1035 | |
| 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)) | |
| 614 | 1037 | return 0; |
| 615 | 1038 | |
| 616 | 1039 | /* |
| @@ -673,7 +1096,7 @@ static bool intel_plane_can_remap(const struct intel_plane_state *plane_state) · 56 unmodified lines | ||
| 673 | 1096 | * The new CCS hash mode isn't compatible with remapping as |
| 674 | 1097 | * the virtual address of the pages affects the compressed data. |
| 675 | 1098 | */ |
| 676 | − if (is_ccs_modifier(fb->modifier)) | |
| 1099 | + if (intel_fb_is_ccs_modifier(fb->modifier)) | |
| 677 | 1100 | return false; |
| 678 | 1101 | |
| 679 | 1102 | /* 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 | ||
| 699 | 1122 | static int intel_fb_pitch(const struct intel_framebuffer *fb, int color_plane, unsigned int rotation) |
| 700 | 1123 | { |
| 701 | 1124 | 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; | |
| 703 | 1126 | 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; | |
| 705 | 1128 | else |
| 706 | − return fb->normal_view.color_plane[color_plane].stride; | |
| 1129 | + return fb->normal_view.color_plane[color_plane].mapping_stride; | |
| 707 | 1130 | } |
| 708 | 1131 | |
| 709 | 1132 | 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 | ||
| 814 | 1237 | unsigned int pitch_tiles) |
| 815 | 1238 | { |
| 816 | 1239 | if (intel_fb_needs_pot_stride_remap(fb)) { |
| 817 | − unsigned int min_stride = is_ccs_plane(&fb->base, color_plane) ? 2 : 8; | |
| 818 | 1240 | /* |
| 819 | 1241 | * 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. | |
| 821 | 1243 | */ |
| 822 | − return roundup_pow_of_two(max(pitch_tiles, min_stride)); | |
| 1244 | + return roundup_pow_of_two(max(pitch_tiles, 8u)); | |
| 823 | 1245 | } else { |
| 824 | 1246 | return pitch_tiles; |
| 825 | 1247 | } |
| 826 | 1248 | } |
| 827 | 1249 | |
| 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 | + | |
| 828 | 1265 | static unsigned int |
| 829 | 1266 | plane_view_width_tiles(const struct intel_framebuffer *fb, int color_plane, |
| 830 | 1267 | 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 | ||
| 841 | 1278 | return DIV_ROUND_UP(y + dims->height, dims->tile_height); |
| 842 | 1279 | } |
| 843 | 1280 | |
| 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 | + | |
| 844 | 1295 | #define assign_chk_ovf(i915, var, val) ({ \ |
| 845 | 1296 | drm_WARN_ON(&(i915)->drm, overflows_type(val, var)); \ |
| 846 | 1297 | (var) = (val); \ |
| 847 | 1298 | }) |
| 848 | 1299 | |
| 1300 | +#define assign_bfld_chk_ovf(i915, var, val) ({ \ | |
| 1301 | + (var) = (val); \ | |
| 1302 | + drm_WARN_ON(&(i915)->drm, (var) != (val)); \ | |
| 1303 | + (var); \ | |
| 1304 | +}) | |
| 1305 | + | |
| 849 | 1306 | static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_plane, |
| 850 | 1307 | const struct fb_plane_view_dims *dims, |
| 851 | 1308 | 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 | ||
| 860 | 1317 | struct drm_rect r; |
| 861 | 1318 | u32 size = 0; |
| 862 | 1319 | |
| 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 | + } | |
| 867 | 1337 | |
| 868 | 1338 | if (view->gtt.type == I915_GGTT_VIEW_ROTATED) { |
| 1339 | + drm_WARN_ON(&i915->drm, remap_info->linear); | |
| 869 | 1340 | check_array_bounds(i915, view->gtt.rotated.plane, color_plane); |
| 870 | 1341 | |
| 871 | 1342 | 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 | ||
| 881 | 1352 | color_plane_info->x = r.x1; |
| 882 | 1353 | color_plane_info->y = r.y1; |
| 883 | 1354 | |
| 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; | |
| 885 | 1357 | |
| 886 | 1358 | size += remap_info->dst_stride * remap_info->width; |
| 887 | 1359 | |
| @@ -900,16 +1372,29 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 12 unmodified lines | ||
| 900 | 1372 | gtt_offset = aligned_offset; |
| 901 | 1373 | } |
| 902 | 1374 | |
| 903 | − assign_chk_ovf(i915, remap_info->dst_stride, | |
| 904 | − plane_view_dst_stride_tiles(fb, color_plane, remap_info->width)); | |
| 905 | − | |
| 906 | 1375 | color_plane_info->x = x; |
| 907 | 1376 | color_plane_info->y = y; |
| 908 | 1377 | |
| 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; | |
| 911 | 1381 | |
| 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 | + } | |
| 913 | 1398 | } |
| 914 | 1399 | |
| 915 | 1400 | /* |
| @@ -917,10 +1402,16 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p · 1 unmodified line | ||
| 917 | 1402 | * the x/y offsets. x,y will hold the first pixel of the framebuffer |
| 918 | 1403 | * plane from the start of the remapped/rotated gtt mapping. |
| 919 | 1404 | */ |
| 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); | |
| 924 | 1415 | |
| 925 | 1416 | return size; |
| 926 | 1417 | } |
| @@ -933,15 +1424,10 @@ calc_plane_normal_size(const struct intel_framebuffer *fb, int color_plane, · 6 unmodified lines | ||
| 933 | 1424 | const struct fb_plane_view_dims *dims, |
| 934 | 1425 | int x, int y) |
| 935 | 1426 | { |
| 936 | − struct drm_i915_private *i915 = to_i915(fb->base.dev); | |
| 937 | 1427 | unsigned int tiles; |
| 938 | 1428 | |
| 939 | 1429 | 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); | |
| 945 | 1431 | } else { |
| 946 | 1432 | tiles = plane_view_src_stride_tiles(fb, color_plane, dims) * |
| 947 | 1433 | 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 | ||
| 1030 | 1516 | */ |
| 1031 | 1517 | fb->normal_view.color_plane[i].x = x; |
| 1032 | 1518 | 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; | |
| 1034 | 1522 | |
| 1035 | 1523 | offset = calc_plane_aligned_offset(fb, i, &x, &y); |
| 1036 | 1524 | |
| @@ -1080,7 +1568,7 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state) · 43 unmodified lines | ||
| 1080 | 1568 | src_w = drm_rect_width(&plane_state->uapi.src) >> 16; |
| 1081 | 1569 | src_h = drm_rect_height(&plane_state->uapi.src) >> 16; |
| 1082 | 1570 | |
| 1083 | − drm_WARN_ON(&i915->drm, is_ccs_modifier(fb->modifier)); | |
| 1571 | + drm_WARN_ON(&i915->drm, intel_fb_is_ccs_modifier(fb->modifier)); | |
| 1084 | 1572 | |
| 1085 | 1573 | /* Make src coordinates relative to the viewport */ |
| 1086 | 1574 | 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 | ||
| 1143 | 1631 | * |
| 1144 | 1632 | * The new CCS hash mode makes remapping impossible |
| 1145 | 1633 | */ |
| 1146 | − if (DISPLAY_VER(dev_priv) < 4 || is_ccs_modifier(modifier) || | |
| 1634 | + if (DISPLAY_VER(dev_priv) < 4 || intel_fb_is_ccs_modifier(modifier) || | |
| 1147 | 1635 | intel_modifier_uses_dpt(dev_priv, modifier)) |
| 1148 | 1636 | return intel_plane_fb_max_stride(dev_priv, pixel_format, modifier); |
| 1149 | 1637 | 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 | ||
| 1168 | 1656 | * we need the stride to be page aligned. |
| 1169 | 1657 | */ |
| 1170 | 1658 | if (fb->pitches[color_plane] > max_stride && |
| 1171 | − !is_ccs_modifier(fb->modifier)) | |
| 1659 | + !intel_fb_is_ccs_modifier(fb->modifier)) | |
| 1172 | 1660 | return intel_tile_size(dev_priv); |
| 1173 | 1661 | else |
| 1174 | 1662 | return 64; |
| 1175 | 1663 | } |
| 1176 | 1664 | |
| 1177 | 1665 | 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)) { | |
| 1187 | 1667 | /* |
| 1188 | 1668 | * On TGL the surface stride must be 4 tile aligned, mapped by |
| 1189 | 1669 | * one 64 byte cacheline on the CCS AUX surface. |
| 1190 | 1670 | */ |
| 1191 | − else if (DISPLAY_VER(dev_priv) >= 12) | |
| 1671 | + if (DISPLAY_VER(dev_priv) >= 12) | |
| 1192 | 1672 | tile_width *= 4; |
| 1193 | 1673 | /* |
| 1194 | 1674 | * 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 | ||
| 1224 | 1704 | return 0; |
| 1225 | 1705 | |
| 1226 | 1706 | /* FIXME other color planes? */ |
| 1227 | − stride = plane_state->view.color_plane[0].stride; | |
| 1707 | + stride = plane_state->view.color_plane[0].mapping_stride; | |
| 1228 | 1708 | max_stride = plane->max_stride(plane, fb->format->format, |
| 1229 | 1709 | fb->modifier, rotation); |
| 1230 | 1710 | |
| @@ -1430,7 +1910,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb, · 199 unmodified lines | ||
| 1430 | 1910 | goto err; |
| 1431 | 1911 | } |
| 1432 | 1912 | |
| 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)) { | |
| 1434 | 1914 | int ccs_aux_stride = gen12_ccs_aux_stride(intel_fb, i); |
| 1435 | 1915 | |
| 1436 | 1916 | if (fb->pitches[i] != ccs_aux_stride) { |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | #ifndef __INTEL_FB_H__ |
| 7 | 7 | #define __INTEL_FB_H__ |
| 8 | 8 | |
| 9 | +#include <linux/bits.h> | |
| 9 | 10 | #include <linux/types.h> |
| 10 | 11 | |
| 11 | 12 | struct drm_device; |
| @@ -16,12 +17,34 @@ struct drm_i915_private; · 4 unmodified lines | ||
| 16 | 17 | struct drm_mode_fb_cmd2; |
| 17 | 18 | struct intel_fb_view; |
| 18 | 19 | struct intel_framebuffer; |
| 20 | +struct intel_plane; | |
| 19 | 21 | struct intel_plane_state; |
| 20 | 22 | |
| 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); | |
| 25 | 48 | |
| 26 | 49 | bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane); |
| 27 | 50 | |
| @@ -142,13 +142,11 @@ retry: · 141 unmodified lines | ||
| 142 | 142 | if (ret) |
| 143 | 143 | goto err; |
| 144 | 144 | |
| 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; | |
| 152 | 150 | } |
| 153 | 151 | |
| 154 | 152 | if (uses_fence && i915_vma_is_map_and_fenceable(vma)) { |
| @@ -48,6 +48,16 @@ · 47 unmodified lines | ||
| 48 | 48 | #include "intel_fbc.h" |
| 49 | 49 | #include "intel_frontbuffer.h" |
| 50 | 50 | |
| 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 | + | |
| 51 | 61 | /* |
| 52 | 62 | * For SKL+, the plane source size used by the hardware is based on the value we |
| 53 | 63 | * 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 | ||
| 68 | 78 | const struct drm_framebuffer *fb = plane_state->hw.fb; |
| 69 | 79 | unsigned int stride; |
| 70 | 80 | |
| 71 | − stride = plane_state->view.color_plane[0].stride; | |
| 81 | + stride = plane_state->view.color_plane[0].mapping_stride; | |
| 72 | 82 | if (!drm_rotation_90_or_270(plane_state->hw.rotation)) |
| 73 | 83 | stride /= fb->format->cpp[0]; |
| 74 | 84 | |
| @@ -84,9 +94,10 @@ static unsigned int _intel_fbc_cfb_stride(const struct intel_fbc_state_cache *ca · 9 unmodified lines | ||
| 84 | 94 | } |
| 85 | 95 | |
| 86 | 96 | /* 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, | |
| 88 | 98 | const struct intel_fbc_state_cache *cache) |
| 89 | 99 | { |
| 100 | + struct drm_i915_private *i915 = fbc->i915; | |
| 90 | 101 | unsigned int limit = 4; /* 1:4 compression limit is the worst case */ |
| 91 | 102 | unsigned int cpp = 4; /* FBC always 4 bytes per pixel */ |
| 92 | 103 | 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 | ||
| 113 | 124 | } |
| 114 | 125 | |
| 115 | 126 | /* 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, | |
| 117 | 128 | const struct intel_fbc_state_cache *cache) |
| 118 | 129 | { |
| 130 | + struct drm_i915_private *i915 = fbc->i915; | |
| 119 | 131 | unsigned int stride = _intel_fbc_cfb_stride(cache); |
| 120 | 132 | |
| 121 | 133 | /* |
| @@ -124,98 +136,182 @@ static unsigned int intel_fbc_cfb_stride(struct drm_i915_private *i915, · 2 unmodified lines | ||
| 124 | 136 | * that regardless of the compression limit we choose later. |
| 125 | 137 | */ |
| 126 | 138 | 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)); | |
| 128 | 140 | else |
| 129 | 141 | return stride; |
| 130 | 142 | } |
| 131 | 143 | |
| 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, | |
| 133 | 145 | const struct intel_fbc_state_cache *cache) |
| 134 | 146 | { |
| 147 | + struct drm_i915_private *i915 = fbc->i915; | |
| 135 | 148 | int lines = cache->plane.src_h; |
| 136 | 149 | |
| 137 | − if (DISPLAY_VER(dev_priv) == 7) | |
| 150 | + if (DISPLAY_VER(i915) == 7) | |
| 138 | 151 | lines = min(lines, 2048); |
| 139 | − else if (DISPLAY_VER(dev_priv) >= 8) | |
| 152 | + else if (DISPLAY_VER(i915) >= 8) | |
| 140 | 153 | lines = min(lines, 2560); |
| 141 | 154 | |
| 142 | − return lines * intel_fbc_cfb_stride(dev_priv, cache); | |
| 155 | + return lines * intel_fbc_cfb_stride(fbc, cache); | |
| 143 | 156 | } |
| 144 | 157 | |
| 145 | −static void i8xx_fbc_deactivate(struct drm_i915_private *dev_priv) | |
| 158 | +static u32 i8xx_fbc_ctl(struct intel_fbc *fbc) | |
| 146 | 159 | { |
| 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; | |
| 147 | 203 | u32 fbc_ctl; |
| 148 | 204 | |
| 149 | 205 | /* Disable compression */ |
| 150 | − fbc_ctl = intel_de_read(dev_priv, FBC_CONTROL); | |
| 206 | + fbc_ctl = intel_de_read(i915, FBC_CONTROL); | |
| 151 | 207 | if ((fbc_ctl & FBC_CTL_EN) == 0) |
| 152 | 208 | return; |
| 153 | 209 | |
| 154 | 210 | fbc_ctl &= ~FBC_CTL_EN; |
| 155 | − intel_de_write(dev_priv, FBC_CONTROL, fbc_ctl); | |
| 211 | + intel_de_write(i915, FBC_CONTROL, fbc_ctl); | |
| 156 | 212 | |
| 157 | 213 | /* 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, | |
| 159 | 215 | 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"); | |
| 161 | 217 | return; |
| 162 | 218 | } |
| 163 | 219 | } |
| 164 | 220 | |
| 165 | −static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) | |
| 221 | +static void i8xx_fbc_activate(struct intel_fbc *fbc) | |
| 166 | 222 | { |
| 167 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 168 | 223 | const struct intel_fbc_reg_params *params = &fbc->params; |
| 169 | − int cfb_pitch; | |
| 224 | + struct drm_i915_private *i915 = fbc->i915; | |
| 170 | 225 | 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; | |
| 180 | 226 | |
| 181 | 227 | /* Clear old tags */ |
| 182 | 228 | 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, | |
| 195 | 235 | params->fence_y_offset); |
| 196 | 236 | } |
| 197 | 237 | |
| 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)); | |
| 207 | 240 | } |
| 208 | 241 | |
| 209 | −static bool i8xx_fbc_is_active(struct drm_i915_private *dev_priv) | |
| 242 | +static bool i8xx_fbc_is_active(struct intel_fbc *fbc) | |
| 210 | 243 | { |
| 211 | − return intel_de_read(dev_priv, FBC_CONTROL) & FBC_CTL_EN; | |
| 244 | + return intel_de_read(fbc->i915, FBC_CONTROL) & FBC_CTL_EN; | |
| 212 | 245 | } |
| 213 | 246 | |
| 214 | −static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) | |
| 247 | +static bool i8xx_fbc_is_compressing(struct intel_fbc *fbc) | |
| 215 | 248 | { |
| 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) { | |
| 217 | 313 | default: |
| 218 | − MISSING_CASE(i915->fbc.limit); | |
| 314 | + MISSING_CASE(fbc->limit); | |
| 219 | 315 | fallthrough; |
| 220 | 316 | case 1: |
| 221 | 317 | return DPFC_CTL_LIMIT_1X; |
| @@ -226,260 +322,334 @@ static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) · 4 unmodified lines | ||
| 226 | 322 | } |
| 227 | 323 | } |
| 228 | 324 | |
| 229 | −static void g4x_fbc_activate(struct drm_i915_private *dev_priv) | |
| 325 | +static u32 g4x_dpfc_ctl(struct intel_fbc *fbc) | |
| 230 | 326 | { |
| 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; | |
| 232 | 329 | u32 dpfc_ctl; |
| 233 | 330 | |
| 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); | |
| 235 | 333 | |
| 236 | − dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv); | |
| 334 | + if (IS_G4X(i915)) | |
| 335 | + dpfc_ctl |= DPFC_CTL_SR_EN; | |
| 237 | 336 | |
| 238 | 337 | 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); | |
| 244 | 342 | } |
| 245 | 343 | |
| 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)); | |
| 248 | 357 | } |
| 249 | 358 | |
| 250 | −static void g4x_fbc_deactivate(struct drm_i915_private *dev_priv) | |
| 359 | +static void g4x_fbc_deactivate(struct intel_fbc *fbc) | |
| 251 | 360 | { |
| 361 | + struct drm_i915_private *i915 = fbc->i915; | |
| 252 | 362 | u32 dpfc_ctl; |
| 253 | 363 | |
| 254 | 364 | /* Disable compression */ |
| 255 | − dpfc_ctl = intel_de_read(dev_priv, DPFC_CONTROL); | |
| 365 | + dpfc_ctl = intel_de_read(i915, DPFC_CONTROL); | |
| 256 | 366 | if (dpfc_ctl & DPFC_CTL_EN) { |
| 257 | 367 | dpfc_ctl &= ~DPFC_CTL_EN; |
| 258 | − intel_de_write(dev_priv, DPFC_CONTROL, dpfc_ctl); | |
| 368 | + intel_de_write(i915, DPFC_CONTROL, dpfc_ctl); | |
| 259 | 369 | } |
| 260 | 370 | } |
| 261 | 371 | |
| 262 | −static bool g4x_fbc_is_active(struct drm_i915_private *dev_priv) | |
| 372 | +static bool g4x_fbc_is_active(struct intel_fbc *fbc) | |
| 263 | 373 | { |
| 264 | − return intel_de_read(dev_priv, DPFC_CONTROL) & DPFC_CTL_EN; | |
| 374 | + return intel_de_read(fbc->i915, DPFC_CONTROL) & DPFC_CTL_EN; | |
| 265 | 375 | } |
| 266 | 376 | |
| 267 | −static void i8xx_fbc_recompress(struct drm_i915_private *dev_priv) | |
| 377 | +static bool g4x_fbc_is_compressing(struct intel_fbc *fbc) | |
| 268 | 378 | { |
| 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 | +} | |
| 271 | 381 | |
| 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); | |
| 276 | 387 | } |
| 277 | 388 | |
| 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) | |
| 279 | 399 | { |
| 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; | |
| 282 | 402 | |
| 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)); | |
| 287 | 408 | } |
| 288 | 409 | |
| 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) | |
| 291 | 411 | { |
| 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 | + } | |
| 294 | 421 | } |
| 295 | 422 | |
| 296 | −static void intel_fbc_recompress(struct drm_i915_private *dev_priv) | |
| 423 | +static bool ilk_fbc_is_active(struct intel_fbc *fbc) | |
| 297 | 424 | { |
| 298 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 425 | + return intel_de_read(fbc->i915, ILK_DPFC_CONTROL) & DPFC_CTL_EN; | |
| 426 | +} | |
| 299 | 427 | |
| 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 | +} | |
| 301 | 432 | |
| 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); | |
| 308 | 438 | } |
| 309 | 439 | |
| 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) | |
| 311 | 450 | { |
| 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; | |
| 314 | 454 | |
| 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); | |
| 316 | 457 | |
| 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 | +} | |
| 318 | 461 | |
| 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); | |
| 335 | 465 | |
| 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); | |
| 340 | 467 | } |
| 341 | 468 | |
| 342 | −static void ilk_fbc_deactivate(struct drm_i915_private *dev_priv) | |
| 469 | +static void snb_fbc_nuke(struct intel_fbc *fbc) | |
| 343 | 470 | { |
| 344 | − u32 dpfc_ctl; | |
| 471 | + struct drm_i915_private *i915 = fbc->i915; | |
| 345 | 472 | |
| 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); | |
| 352 | 497 | } |
| 353 | 498 | |
| 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) | |
| 355 | 500 | { |
| 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); | |
| 357 | 513 | } |
| 358 | 514 | |
| 359 | −static void gen7_fbc_activate(struct drm_i915_private *dev_priv) | |
| 515 | +static u32 ivb_dpfc_ctl(struct intel_fbc *fbc) | |
| 360 | 516 | { |
| 361 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 362 | 517 | const struct intel_fbc_reg_params *params = &fbc->params; |
| 518 | + struct drm_i915_private *i915 = fbc->i915; | |
| 363 | 519 | u32 dpfc_ctl; |
| 364 | 520 | |
| 365 | − if (DISPLAY_VER(dev_priv) >= 10) { | |
| 366 | − u32 val = 0; | |
| 521 | + dpfc_ctl = g4x_dpfc_ctl_limit(fbc); | |
| 367 | 522 | |
| 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); | |
| 371 | 525 | |
| 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; | |
| 375 | 528 | |
| 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; | |
| 380 | 531 | |
| 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 | +} | |
| 385 | 534 | |
| 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; | |
| 389 | 538 | |
| 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); | |
| 391 | 543 | |
| 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); | |
| 402 | 546 | |
| 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 | +} | |
| 405 | 550 | |
| 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; | |
| 407 | 554 | } |
| 408 | 555 | |
| 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) | |
| 410 | 558 | { |
| 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); | |
| 417 | 561 | } |
| 418 | 562 | |
| 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) | |
| 420 | 574 | { |
| 421 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 575 | + return fbc->funcs->is_active(fbc); | |
| 576 | +} | |
| 422 | 577 | |
| 578 | +static void intel_fbc_hw_activate(struct intel_fbc *fbc) | |
| 579 | +{ | |
| 423 | 580 | trace_intel_fbc_activate(fbc->crtc); |
| 424 | 581 | |
| 425 | 582 | fbc->active = true; |
| 426 | 583 | fbc->activated = true; |
| 427 | 584 | |
| 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); | |
| 436 | 586 | } |
| 437 | 587 | |
| 438 | −static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv) | |
| 588 | +static void intel_fbc_hw_deactivate(struct intel_fbc *fbc) | |
| 439 | 589 | { |
| 440 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 441 | − | |
| 442 | 590 | trace_intel_fbc_deactivate(fbc->crtc); |
| 443 | 591 | |
| 444 | 592 | fbc->active = false; |
| 445 | 593 | |
| 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; | |
| 452 | 623 | } |
| 453 | 624 | |
| 454 | 625 | /** |
| 455 | 626 | * intel_fbc_is_active - Is FBC active? |
| 456 | − * @dev_priv: i915 device instance | |
| 627 | + * @fbc: The FBC instance | |
| 457 | 628 | * |
| 458 | 629 | * This function is used to verify the current state of FBC. |
| 459 | 630 | * |
| 460 | 631 | * FIXME: This should be tracked in the plane config eventually |
| 461 | 632 | * instead of queried at runtime for most callers. |
| 462 | 633 | */ |
| 463 | −bool intel_fbc_is_active(struct drm_i915_private *dev_priv) | |
| 634 | +bool intel_fbc_is_active(struct intel_fbc *fbc) | |
| 464 | 635 | { |
| 465 | − return dev_priv->fbc.active; | |
| 636 | + return fbc->active; | |
| 466 | 637 | } |
| 467 | 638 | |
| 468 | −static void intel_fbc_activate(struct drm_i915_private *dev_priv) | |
| 639 | +static void intel_fbc_activate(struct intel_fbc *fbc) | |
| 469 | 640 | { |
| 470 | − intel_fbc_hw_activate(dev_priv); | |
| 471 | − intel_fbc_recompress(dev_priv); | |
| 641 | + intel_fbc_hw_activate(fbc); | |
| 642 | + intel_fbc_nuke(fbc); | |
| 472 | 643 | } |
| 473 | 644 | |
| 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) | |
| 476 | 646 | { |
| 477 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 647 | + struct drm_i915_private *i915 = fbc->i915; | |
| 478 | 648 | |
| 479 | − drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock)); | |
| 649 | + drm_WARN_ON(&i915->drm, !mutex_is_locked(&fbc->lock)); | |
| 480 | 650 | |
| 481 | 651 | if (fbc->active) |
| 482 | − intel_fbc_hw_deactivate(dev_priv); | |
| 652 | + intel_fbc_hw_deactivate(fbc); | |
| 483 | 653 | |
| 484 | 654 | fbc->no_fbc_reason = reason; |
| 485 | 655 | } |
| @@ -492,7 +662,7 @@ static u64 intel_fbc_cfb_base_max(struct drm_i915_private *i915) · 6 unmodified lines | ||
| 492 | 662 | return BIT_ULL(32); |
| 493 | 663 | } |
| 494 | 664 | |
| 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) | |
| 496 | 666 | { |
| 497 | 667 | u64 end; |
| 498 | 668 | |
| @@ -500,13 +670,13 @@ static u64 intel_fbc_stolen_end(struct drm_i915_private *dev_priv) · 1 unmodified line | ||
| 500 | 670 | * reserved range size, so it always assumes the maximum (8mb) is used. |
| 501 | 671 | * If we enable FBC using a CFB on that memory range we'll get FIFO |
| 502 | 672 | * 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; | |
| 506 | 676 | else |
| 507 | 677 | end = U64_MAX; |
| 508 | 678 | |
| 509 | − return min(end, intel_fbc_cfb_base_max(dev_priv)); | |
| 679 | + return min(end, intel_fbc_cfb_base_max(i915)); | |
| 510 | 680 | } |
| 511 | 681 | |
| 512 | 682 | 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 | ||
| 514 | 684 | return fb_cpp == 2 ? 2 : 1; |
| 515 | 685 | } |
| 516 | 686 | |
| 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) | |
| 518 | 688 | { |
| 519 | 689 | /* WaFbcOnly1to1Ratio:ctg */ |
| 520 | − if (IS_G4X(dev_priv)) | |
| 690 | + if (IS_G4X(i915)) | |
| 521 | 691 | return 1; |
| 522 | 692 | |
| 523 | 693 | /* |
| @@ -527,23 +697,23 @@ static int intel_fbc_max_limit(struct drm_i915_private *dev_priv) · 3 unmodified lines | ||
| 527 | 697 | return 4; |
| 528 | 698 | } |
| 529 | 699 | |
| 530 | −static int find_compression_limit(struct drm_i915_private *dev_priv, | |
| 700 | +static int find_compression_limit(struct intel_fbc *fbc, | |
| 531 | 701 | unsigned int size, int min_limit) |
| 532 | 702 | { |
| 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); | |
| 535 | 705 | int ret, limit = min_limit; |
| 536 | 706 | |
| 537 | 707 | size /= limit; |
| 538 | 708 | |
| 539 | 709 | /* 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, | |
| 541 | 711 | size <<= 1, 4096, 0, end); |
| 542 | 712 | if (ret == 0) |
| 543 | 713 | return limit; |
| 544 | 714 | |
| 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, | |
| 547 | 717 | size >>= 1, 4096, 0, end); |
| 548 | 718 | if (ret == 0) |
| 549 | 719 | return limit; |
| @@ -552,34 +722,34 @@ static int find_compression_limit(struct drm_i915_private *dev_priv, · 2 unmodified lines | ||
| 552 | 722 | return 0; |
| 553 | 723 | } |
| 554 | 724 | |
| 555 | −static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv, | |
| 725 | +static int intel_fbc_alloc_cfb(struct intel_fbc *fbc, | |
| 556 | 726 | unsigned int size, int min_limit) |
| 557 | 727 | { |
| 558 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 728 | + struct drm_i915_private *i915 = fbc->i915; | |
| 559 | 729 | int ret; |
| 560 | 730 | |
| 561 | − drm_WARN_ON(&dev_priv->drm, | |
| 731 | + drm_WARN_ON(&i915->drm, | |
| 562 | 732 | drm_mm_node_allocated(&fbc->compressed_fb)); |
| 563 | − drm_WARN_ON(&dev_priv->drm, | |
| 733 | + drm_WARN_ON(&i915->drm, | |
| 564 | 734 | drm_mm_node_allocated(&fbc->compressed_llb)); |
| 565 | 735 | |
| 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, | |
| 568 | 738 | 4096, 4096); |
| 569 | 739 | if (ret) |
| 570 | 740 | goto err; |
| 571 | 741 | } |
| 572 | 742 | |
| 573 | − ret = find_compression_limit(dev_priv, size, min_limit); | |
| 743 | + ret = find_compression_limit(fbc, size, min_limit); | |
| 574 | 744 | if (!ret) |
| 575 | 745 | goto err_llb; |
| 576 | 746 | else if (ret > min_limit) |
| 577 | − drm_info_once(&dev_priv->drm, | |
| 747 | + drm_info_once(&i915->drm, | |
| 578 | 748 | "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"); |
| 579 | 749 | |
| 580 | 750 | fbc->limit = ret; |
| 581 | 751 | |
| 582 | − drm_dbg_kms(&dev_priv->drm, | |
| 752 | + drm_dbg_kms(&i915->drm, | |
| 583 | 753 | "reserved %llu bytes of contiguous stolen space for FBC, limit: %d\n", |
| 584 | 754 | fbc->compressed_fb.size, fbc->limit); |
| 585 | 755 | |
| @@ -587,82 +757,62 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv, · 1 unmodified line | ||
| 587 | 757 | |
| 588 | 758 | err_llb: |
| 589 | 759 | 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); | |
| 591 | 761 | 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); | |
| 594 | 764 | return -ENOSPC; |
| 595 | 765 | } |
| 596 | 766 | |
| 597 | −static void intel_fbc_program_cfb(struct drm_i915_private *dev_priv) | |
| 767 | +static void intel_fbc_program_cfb(struct intel_fbc *fbc) | |
| 598 | 768 | { |
| 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); | |
| 620 | 770 | } |
| 621 | 771 | |
| 622 | −static void __intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv) | |
| 772 | +static void __intel_fbc_cleanup_cfb(struct intel_fbc *fbc) | |
| 623 | 773 | { |
| 624 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 774 | + struct drm_i915_private *i915 = fbc->i915; | |
| 625 | 775 | |
| 626 | − if (WARN_ON(intel_fbc_hw_is_active(dev_priv))) | |
| 776 | + if (WARN_ON(intel_fbc_hw_is_active(fbc))) | |
| 627 | 777 | return; |
| 628 | 778 | |
| 629 | 779 | 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); | |
| 631 | 781 | 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); | |
| 633 | 783 | } |
| 634 | 784 | |
| 635 | −void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv) | |
| 785 | +void intel_fbc_cleanup(struct drm_i915_private *i915) | |
| 636 | 786 | { |
| 637 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 787 | + struct intel_fbc *fbc = &i915->fbc; | |
| 638 | 788 | |
| 639 | − if (!HAS_FBC(dev_priv)) | |
| 789 | + if (!HAS_FBC(i915)) | |
| 640 | 790 | return; |
| 641 | 791 | |
| 642 | 792 | mutex_lock(&fbc->lock); |
| 643 | − __intel_fbc_cleanup_cfb(dev_priv); | |
| 793 | + __intel_fbc_cleanup_cfb(fbc); | |
| 644 | 794 | mutex_unlock(&fbc->lock); |
| 645 | 795 | } |
| 646 | 796 | |
| 647 | −static bool stride_is_valid(struct drm_i915_private *dev_priv, | |
| 797 | +static bool stride_is_valid(struct drm_i915_private *i915, | |
| 648 | 798 | u64 modifier, unsigned int stride) |
| 649 | 799 | { |
| 650 | 800 | /* 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)) | |
| 652 | 802 | return false; |
| 653 | 803 | |
| 654 | 804 | /* Below are the additional FBC restrictions. */ |
| 655 | 805 | if (stride < 512) |
| 656 | 806 | return false; |
| 657 | 807 | |
| 658 | − if (DISPLAY_VER(dev_priv) == 2 || DISPLAY_VER(dev_priv) == 3) | |
| 808 | + if (DISPLAY_VER(i915) == 2 || DISPLAY_VER(i915) == 3) | |
| 659 | 809 | return stride == 4096 || stride == 8192; |
| 660 | 810 | |
| 661 | − if (DISPLAY_VER(dev_priv) == 4 && !IS_G4X(dev_priv) && stride < 2048) | |
| 811 | + if (DISPLAY_VER(i915) == 4 && !IS_G4X(i915) && stride < 2048) | |
| 662 | 812 | return false; |
| 663 | 813 | |
| 664 | 814 | /* 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)) && | |
| 666 | 816 | modifier == DRM_FORMAT_MOD_LINEAR && stride & 511) |
| 667 | 817 | return false; |
| 668 | 818 | |
| @@ -672,7 +822,7 @@ static bool stride_is_valid(struct drm_i915_private *dev_priv, · 3 unmodified lines | ||
| 672 | 822 | return true; |
| 673 | 823 | } |
| 674 | 824 | |
| 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, | |
| 676 | 826 | u32 pixel_format) |
| 677 | 827 | { |
| 678 | 828 | switch (pixel_format) { |
| @@ -682,10 +832,10 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv, · 3 unmodified lines | ||
| 682 | 832 | case DRM_FORMAT_XRGB1555: |
| 683 | 833 | case DRM_FORMAT_RGB565: |
| 684 | 834 | /* 16bpp not supported on gen2 */ |
| 685 | − if (DISPLAY_VER(dev_priv) == 2) | |
| 835 | + if (DISPLAY_VER(i915) == 2) | |
| 686 | 836 | return false; |
| 687 | 837 | /* WaFbcOnly1to1Ratio:ctg */ |
| 688 | − if (IS_G4X(dev_priv)) | |
| 838 | + if (IS_G4X(i915)) | |
| 689 | 839 | return false; |
| 690 | 840 | return true; |
| 691 | 841 | default: |
| @@ -693,13 +843,13 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv, · 1 unmodified line | ||
| 693 | 843 | } |
| 694 | 844 | } |
| 695 | 845 | |
| 696 | −static bool rotation_is_valid(struct drm_i915_private *dev_priv, | |
| 846 | +static bool rotation_is_valid(struct drm_i915_private *i915, | |
| 697 | 847 | u32 pixel_format, unsigned int rotation) |
| 698 | 848 | { |
| 699 | − if (DISPLAY_VER(dev_priv) >= 9 && pixel_format == DRM_FORMAT_RGB565 && | |
| 849 | + if (DISPLAY_VER(i915) >= 9 && pixel_format == DRM_FORMAT_RGB565 && | |
| 700 | 850 | drm_rotation_90_or_270(rotation)) |
| 701 | 851 | return false; |
| 702 | − else if (DISPLAY_VER(dev_priv) <= 4 && !IS_G4X(dev_priv) && | |
| 852 | + else if (DISPLAY_VER(i915) <= 4 && !IS_G4X(i915) && | |
| 703 | 853 | rotation != DRM_MODE_ROTATE_0) |
| 704 | 854 | return false; |
| 705 | 855 | |
| @@ -712,19 +862,19 @@ static bool rotation_is_valid(struct drm_i915_private *dev_priv, · 6 unmodified lines | ||
| 712 | 862 | * the X and Y offset registers. That's why we include the src x/y offsets |
| 713 | 863 | * instead of just looking at the plane size. |
| 714 | 864 | */ |
| 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) | |
| 716 | 867 | { |
| 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; | |
| 719 | 869 | unsigned int effective_w, effective_h, max_w, max_h; |
| 720 | 870 | |
| 721 | − if (DISPLAY_VER(dev_priv) >= 10) { | |
| 871 | + if (DISPLAY_VER(i915) >= 10) { | |
| 722 | 872 | max_w = 5120; |
| 723 | 873 | 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)) { | |
| 725 | 875 | max_w = 4096; |
| 726 | 876 | 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) { | |
| 728 | 878 | max_w = 4096; |
| 729 | 879 | max_h = 2048; |
| 730 | 880 | } else { |
| @@ -740,14 +890,14 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) · 9 unmodified lines | ||
| 740 | 890 | return effective_w <= max_w && effective_h <= max_h; |
| 741 | 891 | } |
| 742 | 892 | |
| 743 | −static bool tiling_is_valid(struct drm_i915_private *dev_priv, | |
| 893 | +static bool tiling_is_valid(struct drm_i915_private *i915, | |
| 744 | 894 | u64 modifier) |
| 745 | 895 | { |
| 746 | 896 | switch (modifier) { |
| 747 | 897 | case DRM_FORMAT_MOD_LINEAR: |
| 748 | 898 | case I915_FORMAT_MOD_Y_TILED: |
| 749 | 899 | case I915_FORMAT_MOD_Yf_TILED: |
| 750 | − return DISPLAY_VER(dev_priv) >= 9; | |
| 900 | + return DISPLAY_VER(i915) >= 9; | |
| 751 | 901 | case I915_FORMAT_MOD_X_TILED: |
| 752 | 902 | return true; |
| 753 | 903 | default: |
| @@ -759,8 +909,8 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 5 unmodified lines | ||
| 759 | 909 | const struct intel_crtc_state *crtc_state, |
| 760 | 910 | const struct intel_plane_state *plane_state) |
| 761 | 911 | { |
| 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; | |
| 764 | 914 | struct intel_fbc_state_cache *cache = &fbc->state_cache; |
| 765 | 915 | struct drm_framebuffer *fb = plane_state->hw.fb; |
| 766 | 916 | |
| @@ -769,7 +919,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 2 unmodified lines | ||
| 769 | 919 | return; |
| 770 | 920 | |
| 771 | 921 | 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)) | |
| 773 | 923 | cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate; |
| 774 | 924 | |
| 775 | 925 | 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 | ||
| 794 | 944 | |
| 795 | 945 | cache->fence_y_offset = intel_plane_fence_y_offset(plane_state); |
| 796 | 946 | |
| 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 && | |
| 798 | 948 | !plane_state->ggtt_vma->fence); |
| 799 | 949 | |
| 800 | 950 | 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 | ||
| 806 | 956 | cache->psr2_active = crtc_state->has_psr2; |
| 807 | 957 | } |
| 808 | 958 | |
| 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) | |
| 810 | 960 | { |
| 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) > | |
| 814 | 962 | fbc->compressed_fb.size * fbc->limit; |
| 815 | 963 | } |
| 816 | 964 | |
| 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, | |
| 818 | 966 | const struct intel_fbc_state_cache *cache) |
| 819 | 967 | { |
| 820 | 968 | 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); | |
| 822 | 970 | |
| 823 | 971 | /* |
| 824 | 972 | * 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 | ||
| 828 | 976 | * we always need to use the override there. |
| 829 | 977 | */ |
| 830 | 978 | if (stride != stride_aligned || |
| 831 | − (DISPLAY_VER(dev_priv) == 9 && | |
| 979 | + (DISPLAY_VER(fbc->i915) == 9 && | |
| 832 | 980 | cache->fb.modifier == DRM_FORMAT_MOD_LINEAR)) |
| 833 | 981 | return stride_aligned * 4 / 64; |
| 834 | 982 | |
| 835 | 983 | return 0; |
| 836 | 984 | } |
| 837 | 985 | |
| 838 | −static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv) | |
| 986 | +static bool intel_fbc_can_enable(struct intel_fbc *fbc) | |
| 839 | 987 | { |
| 840 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 988 | + struct drm_i915_private *i915 = fbc->i915; | |
| 841 | 989 | |
| 842 | − if (intel_vgpu_active(dev_priv)) { | |
| 990 | + if (intel_vgpu_active(i915)) { | |
| 843 | 991 | fbc->no_fbc_reason = "VGPU is active"; |
| 844 | 992 | return false; |
| 845 | 993 | } |
| 846 | 994 | |
| 847 | − if (!dev_priv->params.enable_fbc) { | |
| 995 | + if (!i915->params.enable_fbc) { | |
| 848 | 996 | fbc->no_fbc_reason = "disabled per module param or by default"; |
| 849 | 997 | return false; |
| 850 | 998 | } |
| @@ -859,11 +1007,11 @@ static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv) · 8 unmodified lines | ||
| 859 | 1007 | |
| 860 | 1008 | static bool intel_fbc_can_activate(struct intel_crtc *crtc) |
| 861 | 1009 | { |
| 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; | |
| 864 | 1012 | struct intel_fbc_state_cache *cache = &fbc->state_cache; |
| 865 | 1013 | |
| 866 | − if (!intel_fbc_can_enable(dev_priv)) | |
| 1014 | + if (!intel_fbc_can_enable(fbc)) | |
| 867 | 1015 | return false; |
| 868 | 1016 | |
| 869 | 1017 | if (!cache->plane.visible) { |
| @@ -884,7 +1032,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 14 unmodified lines | ||
| 884 | 1032 | return false; |
| 885 | 1033 | } |
| 886 | 1034 | |
| 887 | − if (!intel_fbc_hw_tracking_covers_screen(crtc)) { | |
| 1035 | + if (!intel_fbc_hw_tracking_covers_screen(fbc, crtc)) { | |
| 888 | 1036 | fbc->no_fbc_reason = "mode too large for compression"; |
| 889 | 1037 | return false; |
| 890 | 1038 | } |
| @@ -906,28 +1054,28 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 15 unmodified lines | ||
| 906 | 1054 | * For now this will effectively disable FBC with 90/270 degree |
| 907 | 1055 | * rotation. |
| 908 | 1056 | */ |
| 909 | − if (DISPLAY_VER(dev_priv) < 9 && cache->fence_id < 0) { | |
| 1057 | + if (DISPLAY_VER(i915) < 9 && cache->fence_id < 0) { | |
| 910 | 1058 | fbc->no_fbc_reason = "framebuffer not tiled or fenced"; |
| 911 | 1059 | return false; |
| 912 | 1060 | } |
| 913 | 1061 | |
| 914 | − if (!pixel_format_is_valid(dev_priv, cache->fb.format->format)) { | |
| 1062 | + if (!pixel_format_is_valid(i915, cache->fb.format->format)) { | |
| 915 | 1063 | fbc->no_fbc_reason = "pixel format is invalid"; |
| 916 | 1064 | return false; |
| 917 | 1065 | } |
| 918 | 1066 | |
| 919 | − if (!rotation_is_valid(dev_priv, cache->fb.format->format, | |
| 1067 | + if (!rotation_is_valid(i915, cache->fb.format->format, | |
| 920 | 1068 | cache->plane.rotation)) { |
| 921 | 1069 | fbc->no_fbc_reason = "rotation unsupported"; |
| 922 | 1070 | return false; |
| 923 | 1071 | } |
| 924 | 1072 | |
| 925 | − if (!tiling_is_valid(dev_priv, cache->fb.modifier)) { | |
| 1073 | + if (!tiling_is_valid(i915, cache->fb.modifier)) { | |
| 926 | 1074 | fbc->no_fbc_reason = "tiling unsupported"; |
| 927 | 1075 | return false; |
| 928 | 1076 | } |
| 929 | 1077 | |
| 930 | − if (!stride_is_valid(dev_priv, cache->fb.modifier, | |
| 1078 | + if (!stride_is_valid(i915, cache->fb.modifier, | |
| 931 | 1079 | cache->fb.stride * cache->fb.format->cpp[0])) { |
| 932 | 1080 | fbc->no_fbc_reason = "framebuffer stride not supported"; |
| 933 | 1081 | return false; |
| @@ -940,8 +1088,8 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 6 unmodified lines | ||
| 940 | 1088 | } |
| 941 | 1089 | |
| 942 | 1090 | /* 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) { | |
| 945 | 1093 | fbc->no_fbc_reason = "pixel rate is too big"; |
| 946 | 1094 | return false; |
| 947 | 1095 | } |
| @@ -956,7 +1104,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 8 unmodified lines | ||
| 956 | 1104 | * we didn't get any invalidate/deactivate calls, but this would require |
| 957 | 1105 | * a lot of tracking just for a specific case. If we conclude it's an |
| 958 | 1106 | * important case, we can implement it later. */ |
| 959 | − if (intel_fbc_cfb_size_changed(dev_priv)) { | |
| 1107 | + if (intel_fbc_cfb_size_changed(fbc)) { | |
| 960 | 1108 | fbc->no_fbc_reason = "CFB requirements changed"; |
| 961 | 1109 | return false; |
| 962 | 1110 | } |
| @@ -966,14 +1114,14 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 3 unmodified lines | ||
| 966 | 1114 | * having a Y offset that isn't divisible by 4 causes FIFO underrun |
| 967 | 1115 | * and screen flicker. |
| 968 | 1116 | */ |
| 969 | − if (DISPLAY_VER(dev_priv) >= 9 && | |
| 1117 | + if (DISPLAY_VER(i915) >= 9 && | |
| 970 | 1118 | (fbc->state_cache.plane.adjusted_y & 3)) { |
| 971 | 1119 | fbc->no_fbc_reason = "plane Y offset is misaligned"; |
| 972 | 1120 | return false; |
| 973 | 1121 | } |
| 974 | 1122 | |
| 975 | 1123 | /* Wa_22010751166: icl, ehl, tgl, dg1, rkl */ |
| 976 | − if (DISPLAY_VER(dev_priv) >= 11 && | |
| 1124 | + if (DISPLAY_VER(i915) >= 11 && | |
| 977 | 1125 | (cache->plane.src_h + cache->plane.adjusted_y) % 4) { |
| 978 | 1126 | fbc->no_fbc_reason = "plane height + offset is non-modulo of 4"; |
| 979 | 1127 | return false; |
| @@ -984,7 +1132,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 4 unmodified lines | ||
| 984 | 1132 | * Recommendation is to keep this combination disabled |
| 985 | 1133 | * Bspec: 50422 HSD: 14010260002 |
| 986 | 1134 | */ |
| 987 | − if (fbc->state_cache.psr2_active && DISPLAY_VER(dev_priv) >= 12) { | |
| 1135 | + if (fbc->state_cache.psr2_active && DISPLAY_VER(i915) >= 12) { | |
| 988 | 1136 | fbc->no_fbc_reason = "not supported with PSR2"; |
| 989 | 1137 | return false; |
| 990 | 1138 | } |
| @@ -992,12 +1140,11 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) · 1 unmodified line | ||
| 992 | 1140 | return true; |
| 993 | 1141 | } |
| 994 | 1142 | |
| 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) | |
| 997 | 1145 | { |
| 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; | |
| 1001 | 1148 | |
| 1002 | 1149 | /* Since all our fields are integer types, use memset here so the |
| 1003 | 1150 | * 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 | ||
| 1016 | 1163 | params->fb.modifier = cache->fb.modifier; |
| 1017 | 1164 | params->fb.stride = cache->fb.stride; |
| 1018 | 1165 | |
| 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); | |
| 1022 | 1169 | |
| 1023 | 1170 | params->plane_visible = cache->plane.visible; |
| 1024 | 1171 | } |
| @@ -1026,8 +1173,8 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, · 1 unmodified line | ||
| 1026 | 1173 | static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state) |
| 1027 | 1174 | { |
| 1028 | 1175 | 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; | |
| 1031 | 1178 | const struct intel_fbc_state_cache *cache = &fbc->state_cache; |
| 1032 | 1179 | const struct intel_fbc_reg_params *params = &fbc->params; |
| 1033 | 1180 | |
| @@ -1049,13 +1196,13 @@ static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state) · 15 unmodified lines | ||
| 1049 | 1196 | if (params->fb.stride != cache->fb.stride) |
| 1050 | 1197 | return false; |
| 1051 | 1198 | |
| 1052 | − if (params->cfb_stride != intel_fbc_cfb_stride(dev_priv, cache)) | |
| 1199 | + if (params->cfb_stride != intel_fbc_cfb_stride(fbc, cache)) | |
| 1053 | 1200 | return false; |
| 1054 | 1201 | |
| 1055 | − if (params->cfb_size != intel_fbc_cfb_size(dev_priv, cache)) | |
| 1202 | + if (params->cfb_size != intel_fbc_cfb_size(fbc, cache)) | |
| 1056 | 1203 | return false; |
| 1057 | 1204 | |
| 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)) | |
| 1059 | 1206 | return false; |
| 1060 | 1207 | |
| 1061 | 1208 | return true; |
| @@ -1069,12 +1216,12 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 7 unmodified lines | ||
| 1069 | 1216 | intel_atomic_get_new_crtc_state(state, crtc); |
| 1070 | 1217 | const struct intel_plane_state *plane_state = |
| 1071 | 1218 | 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; | |
| 1074 | 1221 | const char *reason = "update pending"; |
| 1075 | 1222 | bool need_vblank_wait = false; |
| 1076 | 1223 | |
| 1077 | − if (!plane->has_fbc || !plane_state) | |
| 1224 | + if (!fbc || !plane_state) | |
| 1078 | 1225 | return need_vblank_wait; |
| 1079 | 1226 | |
| 1080 | 1227 | mutex_lock(&fbc->lock); |
| @@ -1086,7 +1233,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 5 unmodified lines | ||
| 1086 | 1233 | fbc->flip_pending = true; |
| 1087 | 1234 | |
| 1088 | 1235 | if (!intel_fbc_can_flip_nuke(crtc_state)) { |
| 1089 | − intel_fbc_deactivate(dev_priv, reason); | |
| 1236 | + intel_fbc_deactivate(fbc, reason); | |
| 1090 | 1237 | |
| 1091 | 1238 | /* |
| 1092 | 1239 | * Display WA #1198: glk+ |
| @@ -1102,7 +1249,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, · 9 unmodified lines | ||
| 1102 | 1249 | * if at least one frame has already passed. |
| 1103 | 1250 | */ |
| 1104 | 1251 | if (fbc->activated && |
| 1105 | − DISPLAY_VER(dev_priv) >= 10) | |
| 1252 | + DISPLAY_VER(i915) >= 10) | |
| 1106 | 1253 | need_vblank_wait = true; |
| 1107 | 1254 | fbc->activated = false; |
| 1108 | 1255 | } |
| @@ -1112,70 +1259,62 @@ unlock: · 3 unmodified lines | ||
| 1112 | 1259 | return need_vblank_wait; |
| 1113 | 1260 | } |
| 1114 | 1261 | |
| 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) | |
| 1123 | 1263 | { |
| 1124 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1264 | + struct drm_i915_private *i915 = fbc->i915; | |
| 1125 | 1265 | struct intel_crtc *crtc = fbc->crtc; |
| 1126 | 1266 | |
| 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); | |
| 1130 | 1270 | |
| 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", | |
| 1132 | 1272 | pipe_name(crtc->pipe)); |
| 1133 | 1273 | |
| 1134 | − __intel_fbc_cleanup_cfb(dev_priv); | |
| 1274 | + __intel_fbc_cleanup_cfb(fbc); | |
| 1135 | 1275 | |
| 1136 | 1276 | fbc->crtc = NULL; |
| 1137 | 1277 | } |
| 1138 | 1278 | |
| 1139 | 1279 | static void __intel_fbc_post_update(struct intel_crtc *crtc) |
| 1140 | 1280 | { |
| 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; | |
| 1143 | 1283 | |
| 1144 | − drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock)); | |
| 1284 | + drm_WARN_ON(&i915->drm, !mutex_is_locked(&fbc->lock)); | |
| 1145 | 1285 | |
| 1146 | 1286 | if (fbc->crtc != crtc) |
| 1147 | 1287 | return; |
| 1148 | 1288 | |
| 1149 | 1289 | fbc->flip_pending = false; |
| 1150 | 1290 | |
| 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); | |
| 1154 | 1294 | |
| 1155 | 1295 | return; |
| 1156 | 1296 | } |
| 1157 | 1297 | |
| 1158 | − intel_fbc_get_reg_params(crtc, &fbc->params); | |
| 1298 | + intel_fbc_get_reg_params(fbc, crtc); | |
| 1159 | 1299 | |
| 1160 | 1300 | if (!intel_fbc_can_activate(crtc)) |
| 1161 | 1301 | return; |
| 1162 | 1302 | |
| 1163 | 1303 | if (!fbc->busy_bits) |
| 1164 | − intel_fbc_activate(dev_priv); | |
| 1304 | + intel_fbc_activate(fbc); | |
| 1165 | 1305 | else |
| 1166 | − intel_fbc_deactivate(dev_priv, "frontbuffer write"); | |
| 1306 | + intel_fbc_deactivate(fbc, "frontbuffer write"); | |
| 1167 | 1307 | } |
| 1168 | 1308 | |
| 1169 | 1309 | void intel_fbc_post_update(struct intel_atomic_state *state, |
| 1170 | 1310 | struct intel_crtc *crtc) |
| 1171 | 1311 | { |
| 1172 | − struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 1173 | 1312 | struct intel_plane *plane = to_intel_plane(crtc->base.primary); |
| 1174 | 1313 | const struct intel_plane_state *plane_state = |
| 1175 | 1314 | intel_atomic_get_new_plane_state(state, plane); |
| 1176 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1315 | + struct intel_fbc *fbc = plane->fbc; | |
| 1177 | 1316 | |
| 1178 | − if (!plane->has_fbc || !plane_state) | |
| 1317 | + if (!fbc || !plane_state) | |
| 1179 | 1318 | return; |
| 1180 | 1319 | |
| 1181 | 1320 | mutex_lock(&fbc->lock); |
| @@ -1191,13 +1330,13 @@ static unsigned int intel_fbc_get_frontbuffer_bit(struct intel_fbc *fbc) · 9 unmodified lines | ||
| 1191 | 1330 | return fbc->possible_framebuffer_bits; |
| 1192 | 1331 | } |
| 1193 | 1332 | |
| 1194 | −void intel_fbc_invalidate(struct drm_i915_private *dev_priv, | |
| 1333 | +void intel_fbc_invalidate(struct drm_i915_private *i915, | |
| 1195 | 1334 | unsigned int frontbuffer_bits, |
| 1196 | 1335 | enum fb_op_origin origin) |
| 1197 | 1336 | { |
| 1198 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1337 | + struct intel_fbc *fbc = &i915->fbc; | |
| 1199 | 1338 | |
| 1200 | − if (!HAS_FBC(dev_priv)) | |
| 1339 | + if (!HAS_FBC(i915)) | |
| 1201 | 1340 | return; |
| 1202 | 1341 | |
| 1203 | 1342 | 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 | ||
| 1208 | 1347 | fbc->busy_bits |= intel_fbc_get_frontbuffer_bit(fbc) & frontbuffer_bits; |
| 1209 | 1348 | |
| 1210 | 1349 | if (fbc->crtc && fbc->busy_bits) |
| 1211 | − intel_fbc_deactivate(dev_priv, "frontbuffer write"); | |
| 1350 | + intel_fbc_deactivate(fbc, "frontbuffer write"); | |
| 1212 | 1351 | |
| 1213 | 1352 | mutex_unlock(&fbc->lock); |
| 1214 | 1353 | } |
| 1215 | 1354 | |
| 1216 | −void intel_fbc_flush(struct drm_i915_private *dev_priv, | |
| 1355 | +void intel_fbc_flush(struct drm_i915_private *i915, | |
| 1217 | 1356 | unsigned int frontbuffer_bits, enum fb_op_origin origin) |
| 1218 | 1357 | { |
| 1219 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1358 | + struct intel_fbc *fbc = &i915->fbc; | |
| 1220 | 1359 | |
| 1221 | − if (!HAS_FBC(dev_priv)) | |
| 1360 | + if (!HAS_FBC(i915)) | |
| 1222 | 1361 | return; |
| 1223 | 1362 | |
| 1224 | 1363 | mutex_lock(&fbc->lock); |
| @@ -1231,7 +1370,7 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv, · 6 unmodified lines | ||
| 1231 | 1370 | if (!fbc->busy_bits && fbc->crtc && |
| 1232 | 1371 | (frontbuffer_bits & intel_fbc_get_frontbuffer_bit(fbc))) { |
| 1233 | 1372 | if (fbc->active) |
| 1234 | − intel_fbc_recompress(dev_priv); | |
| 1373 | + intel_fbc_nuke(fbc); | |
| 1235 | 1374 | else if (!fbc->flip_pending) |
| 1236 | 1375 | __intel_fbc_post_update(fbc->crtc); |
| 1237 | 1376 | } |
| @@ -1242,7 +1381,7 @@ out: · 4 unmodified lines | ||
| 1242 | 1381 | |
| 1243 | 1382 | /** |
| 1244 | 1383 | * intel_fbc_choose_crtc - select a CRTC to enable FBC on |
| 1245 | − * @dev_priv: i915 device instance | |
| 1384 | + * @i915: i915 device instance | |
| 1246 | 1385 | * @state: the atomic state structure |
| 1247 | 1386 | * |
| 1248 | 1387 | * This function looks at the proposed state for CRTCs and planes, then chooses |
| @@ -1250,12 +1389,12 @@ out: · 1 unmodified line | ||
| 1250 | 1389 | * true. |
| 1251 | 1390 | * |
| 1252 | 1391 | * 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. | |
| 1254 | 1393 | */ |
| 1255 | −void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, | |
| 1394 | +void intel_fbc_choose_crtc(struct drm_i915_private *i915, | |
| 1256 | 1395 | struct intel_atomic_state *state) |
| 1257 | 1396 | { |
| 1258 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1397 | + struct intel_fbc *fbc = &i915->fbc; | |
| 1259 | 1398 | struct intel_plane *plane; |
| 1260 | 1399 | struct intel_plane_state *plane_state; |
| 1261 | 1400 | bool crtc_chosen = false; |
| @@ -1268,7 +1407,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, · 6 unmodified lines | ||
| 1268 | 1407 | !intel_atomic_get_new_crtc_state(state, fbc->crtc)) |
| 1269 | 1408 | goto out; |
| 1270 | 1409 | |
| 1271 | − if (!intel_fbc_can_enable(dev_priv)) | |
| 1410 | + if (!intel_fbc_can_enable(fbc)) | |
| 1272 | 1411 | goto out; |
| 1273 | 1412 | |
| 1274 | 1413 | /* 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 | ||
| 1279 | 1418 | struct intel_crtc_state *crtc_state; |
| 1280 | 1419 | struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); |
| 1281 | 1420 | |
| 1282 | − if (!plane->has_fbc) | |
| 1421 | + if (plane->fbc != fbc) | |
| 1283 | 1422 | continue; |
| 1284 | 1423 | |
| 1285 | 1424 | if (!plane_state->uapi.visible) |
| @@ -1312,19 +1451,21 @@ out: · 26 unmodified lines | ||
| 1312 | 1451 | static void intel_fbc_enable(struct intel_atomic_state *state, |
| 1313 | 1452 | struct intel_crtc *crtc) |
| 1314 | 1453 | { |
| 1315 | − struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 1454 | + struct drm_i915_private *i915 = to_i915(crtc->base.dev); | |
| 1316 | 1455 | struct intel_plane *plane = to_intel_plane(crtc->base.primary); |
| 1317 | 1456 | const struct intel_crtc_state *crtc_state = |
| 1318 | 1457 | intel_atomic_get_new_crtc_state(state, crtc); |
| 1319 | 1458 | const struct intel_plane_state *plane_state = |
| 1320 | 1459 | 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; | |
| 1323 | 1462 | int min_limit; |
| 1324 | 1463 | |
| 1325 | − if (!plane->has_fbc || !plane_state) | |
| 1464 | + if (!fbc || !plane_state) | |
| 1326 | 1465 | return; |
| 1327 | 1466 | |
| 1467 | + cache = &fbc->state_cache; | |
| 1468 | + | |
| 1328 | 1469 | min_limit = intel_fbc_min_limit(plane_state->hw.fb ? |
| 1329 | 1470 | plane_state->hw.fb->format->cpp[0] : 0); |
| 1330 | 1471 | |
| @@ -1335,13 +1476,13 @@ static void intel_fbc_enable(struct intel_atomic_state *state, · 4 unmodified lines | ||
| 1335 | 1476 | goto out; |
| 1336 | 1477 | |
| 1337 | 1478 | if (fbc->limit >= min_limit && |
| 1338 | − !intel_fbc_cfb_size_changed(dev_priv)) | |
| 1479 | + !intel_fbc_cfb_size_changed(fbc)) | |
| 1339 | 1480 | goto out; |
| 1340 | 1481 | |
| 1341 | − __intel_fbc_disable(dev_priv); | |
| 1482 | + __intel_fbc_disable(fbc); | |
| 1342 | 1483 | } |
| 1343 | 1484 | |
| 1344 | − drm_WARN_ON(&dev_priv->drm, fbc->active); | |
| 1485 | + drm_WARN_ON(&i915->drm, fbc->active); | |
| 1345 | 1486 | |
| 1346 | 1487 | intel_fbc_update_state_cache(crtc, crtc_state, plane_state); |
| 1347 | 1488 | |
| @@ -1349,20 +1490,19 @@ static void intel_fbc_enable(struct intel_atomic_state *state, · 1 unmodified line | ||
| 1349 | 1490 | if (!cache->plane.visible) |
| 1350 | 1491 | goto out; |
| 1351 | 1492 | |
| 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)) { | |
| 1354 | 1494 | cache->plane.visible = false; |
| 1355 | 1495 | fbc->no_fbc_reason = "not enough stolen memory"; |
| 1356 | 1496 | goto out; |
| 1357 | 1497 | } |
| 1358 | 1498 | |
| 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", | |
| 1360 | 1500 | pipe_name(crtc->pipe)); |
| 1361 | 1501 | fbc->no_fbc_reason = "FBC enabled but not active yet\n"; |
| 1362 | 1502 | |
| 1363 | 1503 | fbc->crtc = crtc; |
| 1364 | 1504 | |
| 1365 | − intel_fbc_program_cfb(dev_priv); | |
| 1505 | + intel_fbc_program_cfb(fbc); | |
| 1366 | 1506 | out: |
| 1367 | 1507 | mutex_unlock(&fbc->lock); |
| 1368 | 1508 | } |
| @@ -1375,16 +1515,15 @@ out: · 6 unmodified lines | ||
| 1375 | 1515 | */ |
| 1376 | 1516 | void intel_fbc_disable(struct intel_crtc *crtc) |
| 1377 | 1517 | { |
| 1378 | − struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 1379 | 1518 | 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; | |
| 1381 | 1520 | |
| 1382 | − if (!plane->has_fbc) | |
| 1521 | + if (!fbc) | |
| 1383 | 1522 | return; |
| 1384 | 1523 | |
| 1385 | 1524 | mutex_lock(&fbc->lock); |
| 1386 | 1525 | if (fbc->crtc == crtc) |
| 1387 | − __intel_fbc_disable(dev_priv); | |
| 1526 | + __intel_fbc_disable(fbc); | |
| 1388 | 1527 | mutex_unlock(&fbc->lock); |
| 1389 | 1528 | } |
| 1390 | 1529 | |
| @@ -1412,30 +1551,30 @@ void intel_fbc_update(struct intel_atomic_state *state, · 21 unmodified lines | ||
| 1412 | 1551 | |
| 1413 | 1552 | /** |
| 1414 | 1553 | * intel_fbc_global_disable - globally disable FBC |
| 1415 | − * @dev_priv: i915 device instance | |
| 1554 | + * @i915: i915 device instance | |
| 1416 | 1555 | * |
| 1417 | 1556 | * This function disables FBC regardless of which CRTC is associated with it. |
| 1418 | 1557 | */ |
| 1419 | −void intel_fbc_global_disable(struct drm_i915_private *dev_priv) | |
| 1558 | +void intel_fbc_global_disable(struct drm_i915_private *i915) | |
| 1420 | 1559 | { |
| 1421 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1560 | + struct intel_fbc *fbc = &i915->fbc; | |
| 1422 | 1561 | |
| 1423 | − if (!HAS_FBC(dev_priv)) | |
| 1562 | + if (!HAS_FBC(i915)) | |
| 1424 | 1563 | return; |
| 1425 | 1564 | |
| 1426 | 1565 | mutex_lock(&fbc->lock); |
| 1427 | 1566 | 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); | |
| 1430 | 1569 | } |
| 1431 | 1570 | mutex_unlock(&fbc->lock); |
| 1432 | 1571 | } |
| 1433 | 1572 | |
| 1434 | 1573 | static void intel_fbc_underrun_work_fn(struct work_struct *work) |
| 1435 | 1574 | { |
| 1436 | − struct drm_i915_private *dev_priv = | |
| 1575 | + struct drm_i915_private *i915 = | |
| 1437 | 1576 | 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; | |
| 1439 | 1578 | |
| 1440 | 1579 | mutex_lock(&fbc->lock); |
| 1441 | 1580 | |
| @@ -1443,46 +1582,47 @@ static void intel_fbc_underrun_work_fn(struct work_struct *work) · 1 unmodified line | ||
| 1443 | 1582 | if (fbc->underrun_detected || !fbc->crtc) |
| 1444 | 1583 | goto out; |
| 1445 | 1584 | |
| 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"); | |
| 1447 | 1586 | fbc->underrun_detected = true; |
| 1448 | 1587 | |
| 1449 | − intel_fbc_deactivate(dev_priv, "FIFO underrun"); | |
| 1588 | + intel_fbc_deactivate(fbc, "FIFO underrun"); | |
| 1450 | 1589 | out: |
| 1451 | 1590 | mutex_unlock(&fbc->lock); |
| 1452 | 1591 | } |
| 1453 | 1592 | |
| 1454 | 1593 | /* |
| 1455 | 1594 | * intel_fbc_reset_underrun - reset FBC fifo underrun status. |
| 1456 | − * @dev_priv: i915 device instance | |
| 1595 | + * @fbc: The FBC instance | |
| 1457 | 1596 | * |
| 1458 | 1597 | * See intel_fbc_handle_fifo_underrun_irq(). For automated testing we |
| 1459 | 1598 | * want to re-enable FBC after an underrun to increase test coverage. |
| 1460 | 1599 | */ |
| 1461 | −int intel_fbc_reset_underrun(struct drm_i915_private *dev_priv) | |
| 1600 | +int intel_fbc_reset_underrun(struct intel_fbc *fbc) | |
| 1462 | 1601 | { |
| 1602 | + struct drm_i915_private *i915 = fbc->i915; | |
| 1463 | 1603 | int ret; |
| 1464 | 1604 | |
| 1465 | − cancel_work_sync(&dev_priv->fbc.underrun_work); | |
| 1605 | + cancel_work_sync(&fbc->underrun_work); | |
| 1466 | 1606 | |
| 1467 | − ret = mutex_lock_interruptible(&dev_priv->fbc.lock); | |
| 1607 | + ret = mutex_lock_interruptible(&fbc->lock); | |
| 1468 | 1608 | if (ret) |
| 1469 | 1609 | return ret; |
| 1470 | 1610 | |
| 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, | |
| 1473 | 1613 | "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"; | |
| 1475 | 1615 | } |
| 1476 | 1616 | |
| 1477 | − dev_priv->fbc.underrun_detected = false; | |
| 1478 | − mutex_unlock(&dev_priv->fbc.lock); | |
| 1617 | + fbc->underrun_detected = false; | |
| 1618 | + mutex_unlock(&fbc->lock); | |
| 1479 | 1619 | |
| 1480 | 1620 | return 0; |
| 1481 | 1621 | } |
| 1482 | 1622 | |
| 1483 | 1623 | /** |
| 1484 | 1624 | * 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 | |
| 1486 | 1626 | * |
| 1487 | 1627 | * Without FBC, most underruns are harmless and don't really cause too many |
| 1488 | 1628 | * 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 | ||
| 1494 | 1634 | * |
| 1495 | 1635 | * This function is called from the IRQ handler. |
| 1496 | 1636 | */ |
| 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) | |
| 1498 | 1638 | { |
| 1499 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1500 | − | |
| 1501 | − if (!HAS_FBC(dev_priv)) | |
| 1639 | + if (!HAS_FBC(fbc->i915)) | |
| 1502 | 1640 | return; |
| 1503 | 1641 | |
| 1504 | 1642 | /* 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 | ||
| 1522 | 1660 | * space to change the value during runtime without sanitizing it again. IGT |
| 1523 | 1661 | * relies on being able to change i915.enable_fbc at runtime. |
| 1524 | 1662 | */ |
| 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) | |
| 1526 | 1664 | { |
| 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; | |
| 1529 | 1667 | |
| 1530 | − if (!HAS_FBC(dev_priv)) | |
| 1668 | + if (!HAS_FBC(i915)) | |
| 1531 | 1669 | return 0; |
| 1532 | 1670 | |
| 1533 | − if (IS_BROADWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 9) | |
| 1671 | + if (IS_BROADWELL(i915) || DISPLAY_VER(i915) >= 9) | |
| 1534 | 1672 | return 1; |
| 1535 | 1673 | |
| 1536 | 1674 | return 0; |
| 1537 | 1675 | } |
| 1538 | 1676 | |
| 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) | |
| 1540 | 1678 | { |
| 1541 | 1679 | /* WaFbcTurnOffFbcWhenHyperVisorIsUsed:skl,bxt */ |
| 1542 | 1680 | 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, | |
| 1545 | 1683 | "Disabling framebuffer compression (FBC) to prevent screen flicker with VT-d enabled\n"); |
| 1546 | 1684 | return true; |
| 1547 | 1685 | } |
| @@ -1551,36 +1689,50 @@ static bool need_fbc_vtd_wa(struct drm_i915_private *dev_priv) · 3 unmodified lines | ||
| 1551 | 1689 | |
| 1552 | 1690 | /** |
| 1553 | 1691 | * intel_fbc_init - Initialize FBC |
| 1554 | − * @dev_priv: the i915 device | |
| 1692 | + * @i915: the i915 device | |
| 1555 | 1693 | * |
| 1556 | 1694 | * This function might be called during PM init process. |
| 1557 | 1695 | */ |
| 1558 | −void intel_fbc_init(struct drm_i915_private *dev_priv) | |
| 1696 | +void intel_fbc_init(struct drm_i915_private *i915) | |
| 1559 | 1697 | { |
| 1560 | − struct intel_fbc *fbc = &dev_priv->fbc; | |
| 1698 | + struct intel_fbc *fbc = &i915->fbc; | |
| 1561 | 1699 | |
| 1700 | + fbc->i915 = i915; | |
| 1562 | 1701 | INIT_WORK(&fbc->underrun_work, intel_fbc_underrun_work_fn); |
| 1563 | 1702 | mutex_init(&fbc->lock); |
| 1564 | 1703 | fbc->active = false; |
| 1565 | 1704 | |
| 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; | |
| 1568 | 1707 | |
| 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; | |
| 1571 | 1710 | |
| 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); | |
| 1575 | 1714 | |
| 1576 | − if (!HAS_FBC(dev_priv)) { | |
| 1715 | + if (!HAS_FBC(i915)) { | |
| 1577 | 1716 | fbc->no_fbc_reason = "unsupported by this chipset"; |
| 1578 | 1717 | return; |
| 1579 | 1718 | } |
| 1580 | 1719 | |
| 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 | + | |
| 1581 | 1733 | /* We still don't have any sort of hardware state readout for FBC, so |
| 1582 | 1734 | * deactivate it in case the BIOS activated it to make sure software |
| 1583 | 1735 | * 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); | |
| 1586 | 1738 | } |
| @@ -14,16 +14,19 @@ struct drm_i915_private; · 13 unmodified lines | ||
| 14 | 14 | struct intel_atomic_state; |
| 15 | 15 | struct intel_crtc; |
| 16 | 16 | struct intel_crtc_state; |
| 17 | +struct intel_fbc; | |
| 17 | 18 | struct intel_plane_state; |
| 18 | 19 | |
| 19 | 20 | void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, |
| 20 | 21 | 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); | |
| 22 | 24 | bool intel_fbc_pre_update(struct intel_atomic_state *state, |
| 23 | 25 | struct intel_crtc *crtc); |
| 24 | 26 | void intel_fbc_post_update(struct intel_atomic_state *state, |
| 25 | 27 | struct intel_crtc *crtc); |
| 26 | 28 | void intel_fbc_init(struct drm_i915_private *dev_priv); |
| 29 | +void intel_fbc_cleanup(struct drm_i915_private *dev_priv); | |
| 27 | 30 | void intel_fbc_update(struct intel_atomic_state *state, |
| 28 | 31 | struct intel_crtc *crtc); |
| 29 | 32 | 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 | ||
| 33 | 36 | enum fb_op_origin origin); |
| 34 | 37 | void intel_fbc_flush(struct drm_i915_private *dev_priv, |
| 35 | 38 | 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); | |
| 39 | 42 | |
| 40 | 43 | #endif /* __INTEL_FBC_H__ */ |
| @@ -8,7 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | #include "intel_de.h" |
| 9 | 9 | #include "intel_display_types.h" |
| 10 | 10 | #include "intel_fdi.h" |
| 11 | −#include "intel_sbi.h" | |
| 12 | 11 | |
| 13 | 12 | static void assert_fdi_tx(struct drm_i915_private *dev_priv, |
| 14 | 13 | enum pipe pipe, bool state) |
| @@ -887,6 +886,43 @@ void hsw_fdi_link_train(struct intel_encoder *encoder, · 872 unmodified lines | ||
| 887 | 886 | DP_TP_CTL_ENABLE); |
| 888 | 887 | } |
| 889 | 888 | |
| 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 | + | |
| 890 | 926 | void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state) |
| 891 | 927 | { |
| 892 | 928 | 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 | ||
| 1006 | 1042 | udelay(100); |
| 1007 | 1043 | } |
| 1008 | 1044 | |
| 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 | − | |
| 1107 | 1045 | static const struct intel_fdi_funcs ilk_funcs = { |
| 1108 | 1046 | .fdi_link_train = ilk_fdi_link_train, |
| 1109 | 1047 | }; |
| @@ -23,8 +23,8 @@ void ilk_fdi_pll_enable(const struct intel_crtc_state *crtc_state); · 22 unmodified lines | ||
| 23 | 23 | void intel_fdi_init_hook(struct drm_i915_private *dev_priv); |
| 24 | 24 | void hsw_fdi_link_train(struct intel_encoder *encoder, |
| 25 | 25 | const struct intel_crtc_state *crtc_state); |
| 26 | +void hsw_fdi_disable(struct intel_encoder *encoder); | |
| 26 | 27 | void intel_fdi_pll_freq_update(struct drm_i915_private *i915); |
| 27 | −void lpt_fdi_program_mphy(struct drm_i915_private *i915); | |
| 28 | 28 | |
| 29 | 29 | void intel_fdi_link_train(struct intel_crtc *crtc, |
| 30 | 30 | const struct intel_crtc_state *crtc_state); |
| @@ -434,7 +434,7 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, · 433 unmodified lines | ||
| 434 | 434 | drm_err(&dev_priv->drm, "CPU pipe %c FIFO underrun\n", pipe_name(pipe)); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | − intel_fbc_handle_fifo_underrun_irq(dev_priv); | |
| 437 | + intel_fbc_handle_fifo_underrun_irq(&dev_priv->fbc); | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /** |
| @@ -334,6 +334,15 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin) · 333 unmodified lines | ||
| 334 | 334 | algo->data = bus; |
| 335 | 335 | } |
| 336 | 336 | |
| 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 | + | |
| 337 | 346 | static int gmbus_wait(struct drm_i915_private *dev_priv, u32 status, u32 irq_en) |
| 338 | 347 | { |
| 339 | 348 | 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 | ||
| 344 | 353 | * we also need to check for NAKs besides the hw ready/idle signal, we |
| 345 | 354 | * need to wake up periodically and check that ourselves. |
| 346 | 355 | */ |
| 347 | − if (!HAS_GMBUS_IRQ(dev_priv)) | |
| 356 | + if (!has_gmbus_irq(dev_priv)) | |
| 348 | 357 | irq_en = 0; |
| 349 | 358 | |
| 350 | 359 | 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 | ||
| 375 | 384 | |
| 376 | 385 | /* Important: The hw handles only the first bit, so set only one! */ |
| 377 | 386 | irq_enable = 0; |
| 378 | − if (HAS_GMBUS_IRQ(dev_priv)) | |
| 387 | + if (has_gmbus_irq(dev_priv)) | |
| 379 | 388 | irq_enable = GMBUS_IDLE_EN; |
| 380 | 389 | |
| 381 | 390 | add_wait_queue(&dev_priv->gmbus_wait_queue, &wait); |
| @@ -1800,6 +1800,11 @@ static bool intel_has_hdmi_sink(struct intel_hdmi *hdmi, · 1799 unmodified lines | ||
| 1800 | 1800 | READ_ONCE(to_intel_digital_connector_state(conn_state)->force_audio) != HDMI_AUDIO_OFF_DVI; |
| 1801 | 1801 | } |
| 1802 | 1802 | |
| 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 | + | |
| 1803 | 1808 | static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, |
| 1804 | 1809 | bool respect_downstream_limits, |
| 1805 | 1810 | bool has_hdmi_sink) |
| @@ -1864,8 +1869,12 @@ hdmi_port_clock_valid(struct intel_hdmi *hdmi, · 58 unmodified lines | ||
| 1864 | 1869 | return MODE_OK; |
| 1865 | 1870 | } |
| 1866 | 1871 | |
| 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) | |
| 1868 | 1873 | { |
| 1874 | + /* YCBCR420 TMDS rate requirement is half the pixel clock */ | |
| 1875 | + if (ycbcr420_output) | |
| 1876 | + clock /= 2; | |
| 1877 | + | |
| 1869 | 1878 | /* |
| 1870 | 1879 | * Need to adjust the port link by: |
| 1871 | 1880 | * 1.5x for 12bpc |
| @@ -1874,18 +1883,29 @@ static int intel_hdmi_port_clock(int clock, int bpc) · 2 unmodified lines | ||
| 1874 | 1883 | return clock * bpc / 8; |
| 1875 | 1884 | } |
| 1876 | 1885 | |
| 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) | |
| 1879 | 1903 | { |
| 1880 | − struct drm_i915_private *i915 = to_i915(connector->dev); | |
| 1881 | 1904 | const struct drm_display_info *info = &connector->display_info; |
| 1882 | 1905 | const struct drm_hdmi_info *hdmi = &info->hdmi; |
| 1883 | 1906 | |
| 1884 | 1907 | switch (bpc) { |
| 1885 | 1908 | case 12: |
| 1886 | − if (HAS_GMCH(i915)) | |
| 1887 | − return false; | |
| 1888 | − | |
| 1889 | 1909 | if (!has_hdmi_sink) |
| 1890 | 1910 | return false; |
| 1891 | 1911 | |
| @@ -1894,9 +1914,6 @@ static bool intel_hdmi_bpc_possible(struct drm_connector *connector, · 2 unmodified lines | ||
| 1894 | 1914 | else |
| 1895 | 1915 | return info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_36; |
| 1896 | 1916 | case 10: |
| 1897 | − if (DISPLAY_VER(i915) < 11) | |
| 1898 | − return false; | |
| 1899 | − | |
| 1900 | 1917 | if (!has_hdmi_sink) |
| 1901 | 1918 | return false; |
| 1902 | 1919 | |
| @@ -1916,26 +1933,26 @@ static enum drm_mode_status · 13 unmodified lines | ||
| 1916 | 1933 | intel_hdmi_mode_clock_valid(struct drm_connector *connector, int clock, |
| 1917 | 1934 | bool has_hdmi_sink, bool ycbcr420_output) |
| 1918 | 1935 | { |
| 1936 | + struct drm_i915_private *i915 = to_i915(connector->dev); | |
| 1919 | 1937 | struct intel_hdmi *hdmi = intel_attached_hdmi(to_intel_connector(connector)); |
| 1920 | 1938 | enum drm_mode_status status; |
| 1921 | 1939 | |
| 1922 | − if (ycbcr420_output) | |
| 1923 | − clock /= 2; | |
| 1924 | − | |
| 1925 | 1940 | /* 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), | |
| 1927 | 1942 | true, has_hdmi_sink); |
| 1928 | 1943 | |
| 1929 | 1944 | /* if we can't do 8bpc we may still be able to do 12bpc */ |
| 1930 | 1945 | 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), | |
| 1933 | 1949 | true, has_hdmi_sink); |
| 1934 | 1950 | |
| 1935 | 1951 | /* if we can't do 8,12bpc we may still be able to do 10bpc */ |
| 1936 | 1952 | 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), | |
| 1939 | 1956 | true, has_hdmi_sink); |
| 1940 | 1957 | |
| 1941 | 1958 | return status; |
| @@ -2000,7 +2017,7 @@ bool intel_hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 58 unmodified lines | ||
| 2000 | 2017 | if (connector_state->crtc != crtc_state->uapi.crtc) |
| 2001 | 2018 | continue; |
| 2002 | 2019 | |
| 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)) | |
| 2004 | 2021 | return false; |
| 2005 | 2022 | } |
| 2006 | 2023 | |
| @@ -2015,6 +2032,9 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, · 8 unmodified lines | ||
| 2015 | 2032 | const struct drm_display_mode *adjusted_mode = |
| 2016 | 2033 | &crtc_state->hw.adjusted_mode; |
| 2017 | 2034 | |
| 2035 | + if (!intel_hdmi_source_bpc_possible(dev_priv, bpc)) | |
| 2036 | + return false; | |
| 2037 | + | |
| 2018 | 2038 | /* |
| 2019 | 2039 | * HDMI deep color affects the clocks, so it's only possible |
| 2020 | 2040 | * 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 | ||
| 2023 | 2043 | return false; |
| 2024 | 2044 | |
| 2025 | 2045 | /* Display Wa_1405510057:icl,ehl */ |
| 2026 | − if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 && | |
| 2046 | + if (intel_hdmi_is_ycbcr420(crtc_state) && | |
| 2027 | 2047 | bpc == 10 && DISPLAY_VER(dev_priv) == 11 && |
| 2028 | 2048 | (adjusted_mode->crtc_hblank_end - |
| 2029 | 2049 | 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 | ||
| 2031 | 2051 | |
| 2032 | 2052 | return intel_hdmi_deep_color_possible(crtc_state, bpc, |
| 2033 | 2053 | crtc_state->has_hdmi_sink, |
| 2034 | − crtc_state->output_format == | |
| 2035 | − INTEL_OUTPUT_FORMAT_YCBCR420); | |
| 2054 | + intel_hdmi_is_ycbcr420(crtc_state)); | |
| 2036 | 2055 | } |
| 2037 | 2056 | |
| 2038 | 2057 | 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 | ||
| 2040 | 2059 | int clock) |
| 2041 | 2060 | { |
| 2042 | 2061 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
| 2062 | + bool ycbcr420_output = intel_hdmi_is_ycbcr420(crtc_state); | |
| 2043 | 2063 | int bpc; |
| 2044 | 2064 | |
| 2045 | 2065 | for (bpc = 12; bpc >= 10; bpc -= 2) { |
| 2046 | 2066 | if (hdmi_deep_color_possible(crtc_state, bpc) && |
| 2047 | 2067 | hdmi_port_clock_valid(intel_hdmi, |
| 2048 | − intel_hdmi_port_clock(clock, bpc), | |
| 2068 | + intel_hdmi_tmds_clock(clock, bpc, ycbcr420_output), | |
| 2049 | 2069 | true, crtc_state->has_hdmi_sink) == MODE_OK) |
| 2050 | 2070 | return bpc; |
| 2051 | 2071 | } |
| @@ -2065,13 +2085,10 @@ static int intel_hdmi_compute_clock(struct intel_encoder *encoder, · 13 unmodified lines | ||
| 2065 | 2085 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) |
| 2066 | 2086 | clock *= 2; |
| 2067 | 2087 | |
| 2068 | − /* YCBCR420 TMDS rate requirement is half the pixel clock */ | |
| 2069 | − if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) | |
| 2070 | − clock /= 2; | |
| 2071 | − | |
| 2072 | 2088 | bpc = intel_hdmi_compute_bpc(encoder, crtc_state, clock); |
| 2073 | 2089 | |
| 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)); | |
| 2075 | 2092 | |
| 2076 | 2093 | /* |
| 2077 | 2094 | * 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 | ||
| 2141 | 2158 | return intel_conn_state->force_audio == HDMI_AUDIO_ON; |
| 2142 | 2159 | } |
| 2143 | 2160 | |
| 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 | + | |
| 2144 | 2171 | static int intel_hdmi_compute_output_format(struct intel_encoder *encoder, |
| 2145 | 2172 | struct intel_crtc_state *crtc_state, |
| 2146 | 2173 | const struct drm_connector_state *conn_state) |
| 2147 | 2174 | { |
| 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); | |
| 2150 | 2176 | 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); | |
| 2151 | 2180 | int ret; |
| 2152 | − bool ycbcr_420_only; | |
| 2153 | 2181 | |
| 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"); | |
| 2161 | 2187 | crtc_state->output_format = INTEL_OUTPUT_FORMAT_RGB; |
| 2162 | 2188 | } |
| 2163 | 2189 | |
| 2164 | 2190 | ret = intel_hdmi_compute_clock(encoder, crtc_state); |
| 2165 | 2191 | 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); | |
| 2172 | 2199 | } |
| 2173 | 2200 | |
| 2174 | 2201 | return ret; |
| @@ -2208,7 +2235,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder, · 33 unmodified lines | ||
| 2208 | 2235 | if (ret) |
| 2209 | 2236 | return ret; |
| 2210 | 2237 | |
| 2211 | − if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { | |
| 2238 | + if (intel_hdmi_is_ycbcr420(pipe_config)) { | |
| 2212 | 2239 | ret = intel_panel_fitting(pipe_config, conn_state); |
| 2213 | 2240 | if (ret) |
| 2214 | 2241 | return ret; |
| @@ -74,7 +74,7 @@ · 73 unmodified lines | ||
| 74 | 74 | #include "intel_de.h" |
| 75 | 75 | #include "intel_lpe_audio.h" |
| 76 | 76 | |
| 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) | |
| 78 | 78 | |
| 79 | 79 | static struct platform_device * |
| 80 | 80 | 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 | ||
| 96 | 96 | return ERR_PTR(-ENOMEM); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | − rsc[0].start = rsc[0].end = dev_priv->lpe_audio.irq; | |
| 99 | + rsc[0].start = rsc[0].end = dev_priv->audio.lpe.irq; | |
| 100 | 100 | rsc[0].flags = IORESOURCE_IRQ; |
| 101 | 101 | rsc[0].name = "hdmi-lpe-audio-irq"; |
| 102 | 102 | |
| @@ -148,7 +148,7 @@ static void lpe_audio_platdev_destroy(struct drm_i915_private *dev_priv) · 45 unmodified lines | ||
| 148 | 148 | * than us fiddle with its internals. |
| 149 | 149 | */ |
| 150 | 150 | |
| 151 | − platform_device_unregister(dev_priv->lpe_audio.platdev); | |
| 151 | + platform_device_unregister(dev_priv->audio.lpe.platdev); | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | static void lpe_audio_irq_unmask(struct irq_data *d) |
| @@ -167,7 +167,7 @@ static struct irq_chip lpe_audio_irqchip = { · 12 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | static int lpe_audio_irq_init(struct drm_i915_private *dev_priv) |
| 169 | 169 | { |
| 170 | − int irq = dev_priv->lpe_audio.irq; | |
| 170 | + int irq = dev_priv->audio.lpe.irq; | |
| 171 | 171 | |
| 172 | 172 | drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv)); |
| 173 | 173 | 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 | ||
| 204 | 204 | { |
| 205 | 205 | int ret; |
| 206 | 206 | |
| 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) { | |
| 209 | 209 | 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; | |
| 212 | 212 | goto err; |
| 213 | 213 | } |
| 214 | 214 | |
| 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); | |
| 216 | 216 | |
| 217 | 217 | ret = lpe_audio_irq_init(dev_priv); |
| 218 | 218 | |
| @@ -223,10 +223,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv) · 4 unmodified lines | ||
| 223 | 223 | goto err_free_irq; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | − dev_priv->lpe_audio.platdev = lpe_audio_platdev_create(dev_priv); | |
| 226 | + dev_priv->audio.lpe.platdev = lpe_audio_platdev_create(dev_priv); | |
| 227 | 227 | |
| 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); | |
| 230 | 230 | drm_err(&dev_priv->drm, |
| 231 | 231 | "Failed to create lpe audio platform device: %d\n", |
| 232 | 232 | ret); |
| @@ -241,10 +241,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv) · 8 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | return 0; |
| 243 | 243 | err_free_irq: |
| 244 | − irq_free_desc(dev_priv->lpe_audio.irq); | |
| 244 | + irq_free_desc(dev_priv->audio.lpe.irq); | |
| 245 | 245 | 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; | |
| 248 | 248 | return ret; |
| 249 | 249 | } |
| 250 | 250 | |
| @@ -262,7 +262,7 @@ void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv) · 11 unmodified lines | ||
| 262 | 262 | if (!HAS_LPE_AUDIO(dev_priv)) |
| 263 | 263 | return; |
| 264 | 264 | |
| 265 | − ret = generic_handle_irq(dev_priv->lpe_audio.irq); | |
| 265 | + ret = generic_handle_irq(dev_priv->audio.lpe.irq); | |
| 266 | 266 | if (ret) |
| 267 | 267 | drm_err_ratelimited(&dev_priv->drm, |
| 268 | 268 | "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 | ||
| 303 | 303 | |
| 304 | 304 | lpe_audio_platdev_destroy(dev_priv); |
| 305 | 305 | |
| 306 | − irq_free_desc(dev_priv->lpe_audio.irq); | |
| 306 | + irq_free_desc(dev_priv->audio.lpe.irq); | |
| 307 | 307 | |
| 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; | |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
| @@ -333,7 +333,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, · 20 unmodified lines | ||
| 333 | 333 | if (!HAS_LPE_AUDIO(dev_priv)) |
| 334 | 334 | return; |
| 335 | 335 | |
| 336 | − pdata = dev_get_platdata(&dev_priv->lpe_audio.platdev->dev); | |
| 336 | + pdata = dev_get_platdata(&dev_priv->audio.lpe.platdev->dev); | |
| 337 | 337 | ppdata = &pdata->port[port - PORT_B]; |
| 338 | 338 | |
| 339 | 339 | 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 | ||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | 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); | |
| 365 | 365 | |
| 366 | 366 | spin_unlock_irqrestore(&pdata->lpe_audio_slock, irqflags); |
| 367 | 367 | } |
| @@ -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 | +} | |
| @@ -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 | |
| @@ -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 | +} | |
| @@ -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 | |
| @@ -28,13 +28,13 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include "i915_drv.h" |
| 30 | 30 | #include "intel_atomic.h" |
| 31 | +#include "intel_crtc.h" | |
| 31 | 32 | #include "intel_de.h" |
| 32 | 33 | #include "intel_display_types.h" |
| 33 | 34 | #include "intel_dp_aux.h" |
| 34 | 35 | #include "intel_hdmi.h" |
| 35 | 36 | #include "intel_psr.h" |
| 36 | 37 | #include "intel_snps_phy.h" |
| 37 | −#include "intel_sprite.h" | |
| 38 | 38 | #include "skl_universal_plane.h" |
| 39 | 39 | |
| 40 | 40 | /** |
| @@ -588,7 +588,9 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp) · 547 unmodified lines | ||
| 588 | 588 | static bool |
| 589 | 589 | transcoder_has_psr2(struct drm_i915_private *dev_priv, enum transcoder trans) |
| 590 | 590 | { |
| 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) | |
| 592 | 594 | return trans == TRANSCODER_A; |
| 593 | 595 | else |
| 594 | 596 | return trans == TRANSCODER_EDP; |
| @@ -1346,6 +1348,7 @@ void intel_psr_disable(struct intel_dp *intel_dp, · 751 unmodified lines | ||
| 1346 | 1348 | */ |
| 1347 | 1349 | void intel_psr_pause(struct intel_dp *intel_dp) |
| 1348 | 1350 | { |
| 1351 | + struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); | |
| 1349 | 1352 | struct intel_psr *psr = &intel_dp->psr; |
| 1350 | 1353 | |
| 1351 | 1354 | if (!CAN_PSR(intel_dp)) |
| @@ -1358,6 +1361,9 @@ void intel_psr_pause(struct intel_dp *intel_dp) · 6 unmodified lines | ||
| 1358 | 1361 | return; |
| 1359 | 1362 | } |
| 1360 | 1363 | |
| 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 | + | |
| 1361 | 1367 | intel_psr_exit(intel_dp); |
| 1362 | 1368 | intel_psr_wait_exit_locked(intel_dp); |
| 1363 | 1369 | psr->paused = true; |
| @@ -1463,10 +1469,19 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane, · 99 unmodified lines | ||
| 1463 | 1469 | val |= plane_state->uapi.dst.x1; |
| 1464 | 1470 | intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_POS(pipe, plane->id), val); |
| 1465 | 1471 | |
| 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 | + | |
| 1469 | 1483 | val = y << 16 | x; |
| 1484 | + | |
| 1470 | 1485 | intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_OFFSET(pipe, plane->id), |
| 1471 | 1486 | val); |
| 1472 | 1487 | |
| @@ -1558,9 +1573,6 @@ static void intel_psr2_sel_fetch_pipe_alignment(const struct intel_crtc_state *c · 85 unmodified lines | ||
| 1558 | 1573 | * also planes are not updated if they have a negative X |
| 1559 | 1574 | * position so for now doing a full update in this cases |
| 1560 | 1575 | * |
| 1561 | − * TODO: We are missing multi-planar formats handling, until it is | |
| 1562 | − * implemented it will send full frame updates. | |
| 1563 | − * | |
| 1564 | 1576 | * Plane scaling and rotation is not supported by selective fetch and both |
| 1565 | 1577 | * properties can change without a modeset, so need to be check at every |
| 1566 | 1578 | * atomic commmit. |
| @@ -1570,7 +1582,6 @@ static bool psr2_sel_fetch_plane_state_supported(const struct intel_plane_state · 3 unmodified lines | ||
| 1570 | 1582 | if (plane_state->uapi.dst.y1 < 0 || |
| 1571 | 1583 | plane_state->uapi.dst.x1 < 0 || |
| 1572 | 1584 | plane_state->scaler_id >= 0 || |
| 1573 | − plane_state->hw.fb->format->num_planes > 1 || | |
| 1574 | 1585 | plane_state->uapi.rotation != DRM_MODE_ROTATE_0) |
| 1575 | 1586 | return false; |
| 1576 | 1587 | |
| @@ -1696,6 +1707,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · 119 unmodified lines | ||
| 1696 | 1707 | for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state, |
| 1697 | 1708 | new_plane_state, i) { |
| 1698 | 1709 | struct drm_rect *sel_fetch_area, inter; |
| 1710 | + struct intel_plane *linked = new_plane_state->planar_linked_plane; | |
| 1699 | 1711 | |
| 1700 | 1712 | if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc || |
| 1701 | 1713 | !new_plane_state->uapi.visible) |
| @@ -1714,6 +1726,24 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, · 12 unmodified lines | ||
| 1714 | 1726 | sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; |
| 1715 | 1727 | sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1; |
| 1716 | 1728 | 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 | + } | |
| 1717 | 1747 | } |
| 1718 | 1748 | |
| 1719 | 1749 | skip_sel_fetch_set_loop: |
| @@ -1721,11 +1751,17 @@ skip_sel_fetch_set_loop: · 1 unmodified line | ||
| 1721 | 1751 | return 0; |
| 1722 | 1752 | } |
| 1723 | 1753 | |
| 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) | |
| 1726 | 1756 | { |
| 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); | |
| 1727 | 1760 | struct intel_encoder *encoder; |
| 1728 | 1761 | |
| 1762 | + if (!HAS_PSR(i915)) | |
| 1763 | + return; | |
| 1764 | + | |
| 1729 | 1765 | for_each_intel_encoder_mask_with_psr(state->base.dev, encoder, |
| 1730 | 1766 | crtc_state->uapi.encoder_mask) { |
| 1731 | 1767 | 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 | ||
| 1740 | 1776 | * - All planes will go inactive |
| 1741 | 1777 | * - Changing between PSR versions |
| 1742 | 1778 | */ |
| 1779 | + needs_to_disable |= intel_crtc_needs_modeset(crtc_state); | |
| 1743 | 1780 | needs_to_disable |= !crtc_state->has_psr; |
| 1744 | 1781 | needs_to_disable |= !crtc_state->active_planes; |
| 1745 | 1782 | 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 | ||
| 1751 | 1788 | } |
| 1752 | 1789 | } |
| 1753 | 1790 | |
| 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 | − | |
| 1768 | 1791 | static void _intel_psr_post_plane_update(const struct intel_atomic_state *state, |
| 1769 | 1792 | const struct intel_crtc_state *crtc_state) |
| 1770 | 1793 | { |
| @@ -1809,15 +1832,21 @@ void intel_psr_post_plane_update(const struct intel_atomic_state *state) · 38 unmodified lines | ||
| 1809 | 1832 | _intel_psr_post_plane_update(state, crtc_state); |
| 1810 | 1833 | } |
| 1811 | 1834 | |
| 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) | |
| 1821 | 1850 | { |
| 1822 | 1851 | struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); |
| 1823 | 1852 | |
| @@ -1827,15 +1856,13 @@ static int psr_wait_for_idle(struct intel_dp *intel_dp, u32 *out_value) · 3 unmodified lines | ||
| 1827 | 1856 | * exit training time + 1.5 ms of aux channel handshake. 50 ms is |
| 1828 | 1857 | * defensive enough to cover everything. |
| 1829 | 1858 | */ |
| 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); | |
| 1835 | 1862 | } |
| 1836 | 1863 | |
| 1837 | 1864 | /** |
| 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 | |
| 1839 | 1866 | * @new_crtc_state: new CRTC state |
| 1840 | 1867 | * |
| 1841 | 1868 | * 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 | ||
| 1852 | 1879 | for_each_intel_encoder_mask_with_psr(&dev_priv->drm, encoder, |
| 1853 | 1880 | new_crtc_state->uapi.encoder_mask) { |
| 1854 | 1881 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
| 1855 | − u32 psr_status; | |
| 1882 | + int ret; | |
| 1856 | 1883 | |
| 1857 | 1884 | mutex_lock(&intel_dp->psr.lock); |
| 1858 | − if (!intel_dp->psr.enabled || intel_dp->psr.psr2_enabled) { | |
| 1885 | + | |
| 1886 | + if (!intel_dp->psr.enabled) { | |
| 1859 | 1887 | mutex_unlock(&intel_dp->psr.lock); |
| 1860 | 1888 | continue; |
| 1861 | 1889 | } |
| 1862 | 1890 | |
| 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 | + | |
| 1868 | 1899 | mutex_unlock(&intel_dp->psr.lock); |
| 1869 | 1900 | } |
| 1870 | 1901 | } |
| @@ -20,7 +20,8 @@ struct intel_plane; · 19 unmodified lines | ||
| 20 | 20 | struct intel_encoder; |
| 21 | 21 | |
| 22 | 22 | 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); | |
| 24 | 25 | void intel_psr_post_plane_update(const struct intel_atomic_state *state); |
| 25 | 26 | void intel_psr_disable(struct intel_dp *intel_dp, |
| 26 | 27 | const struct intel_crtc_state *old_crtc_state); |
| @@ -58,7 +58,6 @@ void intel_snps_phy_set_signal_levels(struct intel_encoder *encoder, · 57 unmodified lines | ||
| 58 | 58 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 59 | 59 | const struct intel_ddi_buf_trans *trans; |
| 60 | 60 | enum phy phy = intel_port_to_phy(dev_priv, encoder->port); |
| 61 | − int level = intel_ddi_level(encoder, crtc_state, 0); | |
| 62 | 61 | int n_entries, ln; |
| 63 | 62 | |
| 64 | 63 | 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 | ||
| 66 | 65 | return; |
| 67 | 66 | |
| 68 | 67 | for (ln = 0; ln < 4; ln++) { |
| 68 | + int level = intel_ddi_level(encoder, crtc_state, ln); | |
| 69 | 69 | u32 val = 0; |
| 70 | 70 | |
| 71 | 71 | val |= REG_FIELD_PREP(SNPS_PHY_TX_EQ_MAIN, trans->entries[level].snps.vswing); |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #include "intel_atomic_plane.h" |
| 46 | 46 | #include "intel_de.h" |
| 47 | 47 | #include "intel_display_types.h" |
| 48 | +#include "intel_fb.h" | |
| 48 | 49 | #include "intel_frontbuffer.h" |
| 49 | 50 | #include "intel_sprite.h" |
| 50 | 51 | #include "i9xx_plane.h" |
| @@ -118,7 +119,7 @@ static void i9xx_plane_linear_gamma(u16 gamma[8]) · 67 unmodified lines | ||
| 118 | 119 | } |
| 119 | 120 | |
| 120 | 121 | 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) | |
| 122 | 123 | { |
| 123 | 124 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 124 | 125 | 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 | ||
| 190 | 191 | #define COS_0 1 |
| 191 | 192 | |
| 192 | 193 | 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) | |
| 194 | 195 | { |
| 195 | 196 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 196 | 197 | 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 | ||
| 393 | 394 | return sprctl; |
| 394 | 395 | } |
| 395 | 396 | |
| 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) | |
| 397 | 398 | { |
| 398 | 399 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 399 | 400 | 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 | ||
| 417 | 418 | } |
| 418 | 419 | |
| 419 | 420 | 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) | |
| 423 | 424 | { |
| 424 | 425 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 425 | 426 | enum pipe pipe = plane->pipe; |
| 426 | 427 | 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; | |
| 430 | 428 | int crtc_x = plane_state->uapi.dst.x1; |
| 431 | 429 | int crtc_y = plane_state->uapi.dst.y1; |
| 432 | 430 | u32 crtc_w = drm_rect_width(&plane_state->uapi.dst); |
| 433 | 431 | 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; | |
| 436 | 432 | unsigned long irqflags; |
| 437 | − u32 sprctl; | |
| 438 | − | |
| 439 | − sprctl = plane_state->ctl | vlv_sprite_ctl_crtc(crtc_state); | |
| 440 | 433 | |
| 441 | 434 | /* Sizes are 0 based */ |
| 442 | 435 | crtc_w--; |
| 443 | 436 | crtc_h--; |
| 444 | 437 | |
| 445 | − linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | |
| 446 | − | |
| 447 | 438 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
| 448 | 439 | |
| 449 | 440 | 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); | |
| 451 | 442 | intel_de_write_fw(dev_priv, SPPOS(pipe, plane_id), |
| 452 | 443 | (crtc_y << 16) | crtc_x); |
| 453 | 444 | intel_de_write_fw(dev_priv, SPSIZE(pipe, plane_id), |
| 454 | 445 | (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); | |
| 456 | 470 | |
| 457 | 471 | if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) |
| 458 | − chv_update_csc(plane_state); | |
| 472 | + chv_sprite_update_csc(plane_state); | |
| 459 | 473 | |
| 460 | 474 | if (key->flags) { |
| 461 | 475 | intel_de_write_fw(dev_priv, SPKEYMINVAL(pipe, plane_id), |
| @@ -466,6 +480,8 @@ vlv_update_plane(struct intel_plane *plane, · 4 unmodified lines | ||
| 466 | 480 | key->max_value); |
| 467 | 481 | } |
| 468 | 482 | |
| 483 | + intel_de_write_fw(dev_priv, SPCONSTALPHA(pipe, plane_id), 0); | |
| 484 | + | |
| 469 | 485 | intel_de_write_fw(dev_priv, SPLINOFF(pipe, plane_id), linear_offset); |
| 470 | 486 | intel_de_write_fw(dev_priv, SPTILEOFF(pipe, plane_id), (y << 16) | x); |
| 471 | 487 | |
| @@ -478,15 +494,15 @@ vlv_update_plane(struct intel_plane *plane, · 6 unmodified lines | ||
| 478 | 494 | intel_de_write_fw(dev_priv, SPSURF(pipe, plane_id), |
| 479 | 495 | intel_plane_ggtt_offset(plane_state) + sprsurf_offset); |
| 480 | 496 | |
| 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); | |
| 483 | 499 | |
| 484 | 500 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 485 | 501 | } |
| 486 | 502 | |
| 487 | 503 | 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) | |
| 490 | 506 | { |
| 491 | 507 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 492 | 508 | enum pipe pipe = plane->pipe; |
| @@ -502,8 +518,8 @@ vlv_disable_plane(struct intel_plane *plane, · 9 unmodified lines | ||
| 502 | 518 | } |
| 503 | 519 | |
| 504 | 520 | 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) | |
| 507 | 523 | { |
| 508 | 524 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 509 | 525 | 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 | ||
| 805 | 821 | i++; |
| 806 | 822 | } |
| 807 | 823 | |
| 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) | |
| 809 | 825 | { |
| 810 | 826 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 811 | 827 | 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 | ||
| 835 | 851 | } |
| 836 | 852 | |
| 837 | 853 | 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) | |
| 841 | 857 | { |
| 842 | 858 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 843 | 859 | 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; | |
| 847 | 860 | int crtc_x = plane_state->uapi.dst.x1; |
| 848 | 861 | int crtc_y = plane_state->uapi.dst.y1; |
| 849 | 862 | u32 crtc_w = drm_rect_width(&plane_state->uapi.dst); |
| 850 | 863 | 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; | |
| 853 | 864 | u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16; |
| 854 | 865 | u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16; |
| 855 | − u32 sprctl, sprscale = 0; | |
| 866 | + u32 sprscale = 0; | |
| 856 | 867 | unsigned long irqflags; |
| 857 | 868 | |
| 858 | − sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state); | |
| 859 | − | |
| 860 | 869 | /* Sizes are 0 based */ |
| 861 | 870 | src_w--; |
| 862 | 871 | src_h--; |
| @@ -866,17 +875,38 @@ ivb_update_plane(struct intel_plane *plane, · 3 unmodified lines | ||
| 866 | 875 | if (crtc_w != src_w || crtc_h != src_h) |
| 867 | 876 | sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; |
| 868 | 877 | |
| 869 | − linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | |
| 870 | − | |
| 871 | 878 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
| 872 | 879 | |
| 873 | 880 | 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); | |
| 875 | 882 | intel_de_write_fw(dev_priv, SPRPOS(pipe), (crtc_y << 16) | crtc_x); |
| 876 | 883 | intel_de_write_fw(dev_priv, SPRSIZE(pipe), (crtc_h << 16) | crtc_w); |
| 877 | 884 | if (IS_IVYBRIDGE(dev_priv)) |
| 878 | 885 | intel_de_write_fw(dev_priv, SPRSCALE(pipe), sprscale); |
| 879 | 886 | |
| 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 | + | |
| 880 | 910 | if (key->flags) { |
| 881 | 911 | intel_de_write_fw(dev_priv, SPRKEYVAL(pipe), key->min_value); |
| 882 | 912 | intel_de_write_fw(dev_priv, SPRKEYMSK(pipe), |
| @@ -902,14 +932,14 @@ ivb_update_plane(struct intel_plane *plane, · 19 unmodified lines | ||
| 902 | 932 | intel_de_write_fw(dev_priv, SPRSURF(pipe), |
| 903 | 933 | intel_plane_ggtt_offset(plane_state) + sprsurf_offset); |
| 904 | 934 | |
| 905 | − ivb_update_gamma(plane_state); | |
| 935 | + ivb_sprite_update_gamma(plane_state); | |
| 906 | 936 | |
| 907 | 937 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 908 | 938 | } |
| 909 | 939 | |
| 910 | 940 | 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) | |
| 913 | 943 | { |
| 914 | 944 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 915 | 945 | enum pipe pipe = plane->pipe; |
| @@ -927,8 +957,8 @@ ivb_disable_plane(struct intel_plane *plane, · 11 unmodified lines | ||
| 927 | 957 | } |
| 928 | 958 | |
| 929 | 959 | 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) | |
| 932 | 962 | { |
| 933 | 963 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 934 | 964 | 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 | ||
| 1106 | 1136 | return dvscntr; |
| 1107 | 1137 | } |
| 1108 | 1138 | |
| 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) | |
| 1110 | 1140 | { |
| 1111 | 1141 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 1112 | 1142 | 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 | ||
| 1136 | 1166 | gamma[i] = (i << 10) / 16; |
| 1137 | 1167 | } |
| 1138 | 1168 | |
| 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) | |
| 1140 | 1170 | { |
| 1141 | 1171 | struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane); |
| 1142 | 1172 | 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 | ||
| 1163 | 1193 | } |
| 1164 | 1194 | |
| 1165 | 1195 | 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) | |
| 1169 | 1199 | { |
| 1170 | 1200 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 1171 | 1201 | 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; | |
| 1175 | 1202 | int crtc_x = plane_state->uapi.dst.x1; |
| 1176 | 1203 | int crtc_y = plane_state->uapi.dst.y1; |
| 1177 | 1204 | u32 crtc_w = drm_rect_width(&plane_state->uapi.dst); |
| 1178 | 1205 | 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; | |
| 1181 | 1206 | u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16; |
| 1182 | 1207 | u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16; |
| 1183 | − u32 dvscntr, dvsscale = 0; | |
| 1208 | + u32 dvsscale = 0; | |
| 1184 | 1209 | unsigned long irqflags; |
| 1185 | 1210 | |
| 1186 | − dvscntr = plane_state->ctl | g4x_sprite_ctl_crtc(crtc_state); | |
| 1187 | − | |
| 1188 | 1211 | /* Sizes are 0 based */ |
| 1189 | 1212 | src_w--; |
| 1190 | 1213 | src_h--; |
| @@ -1194,16 +1217,37 @@ g4x_update_plane(struct intel_plane *plane, · 3 unmodified lines | ||
| 1194 | 1217 | if (crtc_w != src_w || crtc_h != src_h) |
| 1195 | 1218 | dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h; |
| 1196 | 1219 | |
| 1197 | − linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | |
| 1198 | − | |
| 1199 | 1220 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
| 1200 | 1221 | |
| 1201 | 1222 | 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); | |
| 1203 | 1224 | intel_de_write_fw(dev_priv, DVSPOS(pipe), (crtc_y << 16) | crtc_x); |
| 1204 | 1225 | intel_de_write_fw(dev_priv, DVSSIZE(pipe), (crtc_h << 16) | crtc_w); |
| 1205 | 1226 | intel_de_write_fw(dev_priv, DVSSCALE(pipe), dvsscale); |
| 1206 | 1227 | |
| 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 | + | |
| 1207 | 1251 | if (key->flags) { |
| 1208 | 1252 | intel_de_write_fw(dev_priv, DVSKEYVAL(pipe), key->min_value); |
| 1209 | 1253 | intel_de_write_fw(dev_priv, DVSKEYMSK(pipe), |
| @@ -1224,16 +1268,16 @@ g4x_update_plane(struct intel_plane *plane, · 14 unmodified lines | ||
| 1224 | 1268 | intel_plane_ggtt_offset(plane_state) + dvssurf_offset); |
| 1225 | 1269 | |
| 1226 | 1270 | if (IS_G4X(dev_priv)) |
| 1227 | − g4x_update_gamma(plane_state); | |
| 1271 | + g4x_sprite_update_gamma(plane_state); | |
| 1228 | 1272 | else |
| 1229 | − ilk_update_gamma(plane_state); | |
| 1273 | + ilk_sprite_update_gamma(plane_state); | |
| 1230 | 1274 | |
| 1231 | 1275 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 1232 | 1276 | } |
| 1233 | 1277 | |
| 1234 | 1278 | 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) | |
| 1237 | 1281 | { |
| 1238 | 1282 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 1239 | 1283 | enum pipe pipe = plane->pipe; |
| @@ -1250,8 +1294,8 @@ g4x_disable_plane(struct intel_plane *plane, · 10 unmodified lines | ||
| 1250 | 1294 | } |
| 1251 | 1295 | |
| 1252 | 1296 | 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) | |
| 1255 | 1299 | { |
| 1256 | 1300 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 1257 | 1301 | enum intel_display_power_domain power_domain; |
| @@ -1299,7 +1343,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 41 unmodified lines | ||
| 1299 | 1343 | int src_x, src_w, src_h, crtc_w, crtc_h; |
| 1300 | 1344 | const struct drm_display_mode *adjusted_mode = |
| 1301 | 1345 | &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; | |
| 1303 | 1347 | unsigned int cpp = fb->format->cpp[0]; |
| 1304 | 1348 | unsigned int width_bytes; |
| 1305 | 1349 | int min_width, min_height; |
| @@ -1567,7 +1611,7 @@ out: · 261 unmodified lines | ||
| 1567 | 1611 | return ret; |
| 1568 | 1612 | } |
| 1569 | 1613 | |
| 1570 | −static const u32 g4x_plane_formats[] = { | |
| 1614 | +static const u32 g4x_sprite_formats[] = { | |
| 1571 | 1615 | DRM_FORMAT_XRGB8888, |
| 1572 | 1616 | DRM_FORMAT_YUYV, |
| 1573 | 1617 | DRM_FORMAT_YVYU, |
| @@ -1575,13 +1619,7 @@ static const u32 g4x_plane_formats[] = { · 1 unmodified line | ||
| 1575 | 1619 | DRM_FORMAT_VYUY, |
| 1576 | 1620 | }; |
| 1577 | 1621 | |
| 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[] = { | |
| 1585 | 1623 | DRM_FORMAT_XRGB8888, |
| 1586 | 1624 | DRM_FORMAT_XBGR8888, |
| 1587 | 1625 | DRM_FORMAT_XRGB2101010, |
| @@ -1594,7 +1632,7 @@ static const u32 snb_plane_formats[] = { · 6 unmodified lines | ||
| 1594 | 1632 | DRM_FORMAT_VYUY, |
| 1595 | 1633 | }; |
| 1596 | 1634 | |
| 1597 | −static const u32 vlv_plane_formats[] = { | |
| 1635 | +static const u32 vlv_sprite_formats[] = { | |
| 1598 | 1636 | DRM_FORMAT_C8, |
| 1599 | 1637 | DRM_FORMAT_RGB565, |
| 1600 | 1638 | DRM_FORMAT_XRGB8888, |
| @@ -1629,13 +1667,8 @@ static const u32 chv_pipe_b_sprite_formats[] = { · 28 unmodified lines | ||
| 1629 | 1667 | static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane, |
| 1630 | 1668 | u32 format, u64 modifier) |
| 1631 | 1669 | { |
| 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)) | |
| 1637 | 1671 | return false; |
| 1638 | − } | |
| 1639 | 1672 | |
| 1640 | 1673 | switch (format) { |
| 1641 | 1674 | case DRM_FORMAT_XRGB8888: |
| @@ -1655,13 +1688,8 @@ static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane, · 13 unmodified lines | ||
| 1655 | 1688 | static bool snb_sprite_format_mod_supported(struct drm_plane *_plane, |
| 1656 | 1689 | u32 format, u64 modifier) |
| 1657 | 1690 | { |
| 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)) | |
| 1663 | 1692 | return false; |
| 1664 | − } | |
| 1665 | 1693 | |
| 1666 | 1694 | switch (format) { |
| 1667 | 1695 | case DRM_FORMAT_XRGB8888: |
| @@ -1686,13 +1714,8 @@ static bool snb_sprite_format_mod_supported(struct drm_plane *_plane, · 18 unmodified lines | ||
| 1686 | 1714 | static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane, |
| 1687 | 1715 | u32 format, u64 modifier) |
| 1688 | 1716 | { |
| 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)) | |
| 1694 | 1718 | return false; |
| 1695 | − } | |
| 1696 | 1719 | |
| 1697 | 1720 | switch (format) { |
| 1698 | 1721 | case DRM_FORMAT_C8: |
| @@ -1762,9 +1785,10 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 63 unmodified lines | ||
| 1762 | 1785 | return plane; |
| 1763 | 1786 | |
| 1764 | 1787 | 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; | |
| 1768 | 1792 | plane->check_plane = vlv_sprite_check; |
| 1769 | 1793 | plane->max_stride = i965_plane_max_stride; |
| 1770 | 1794 | plane->min_cdclk = vlv_plane_min_cdclk; |
| @@ -1773,16 +1797,16 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 2 unmodified lines | ||
| 1773 | 1797 | formats = chv_pipe_b_sprite_formats; |
| 1774 | 1798 | num_formats = ARRAY_SIZE(chv_pipe_b_sprite_formats); |
| 1775 | 1799 | } 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); | |
| 1778 | 1802 | } |
| 1779 | − modifiers = i9xx_plane_format_modifiers; | |
| 1780 | 1803 | |
| 1781 | 1804 | plane_funcs = &vlv_sprite_funcs; |
| 1782 | 1805 | } 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; | |
| 1786 | 1810 | plane->check_plane = g4x_sprite_check; |
| 1787 | 1811 | |
| 1788 | 1812 | 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 | ||
| 1793 | 1817 | plane->min_cdclk = ivb_sprite_min_cdclk; |
| 1794 | 1818 | } |
| 1795 | 1819 | |
| 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); | |
| 1799 | 1822 | |
| 1800 | 1823 | plane_funcs = &snb_sprite_funcs; |
| 1801 | 1824 | } 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; | |
| 1805 | 1829 | plane->check_plane = g4x_sprite_check; |
| 1806 | 1830 | plane->max_stride = g4x_sprite_max_stride; |
| 1807 | 1831 | plane->min_cdclk = g4x_sprite_min_cdclk; |
| 1808 | 1832 | |
| 1809 | − modifiers = i9xx_plane_format_modifiers; | |
| 1810 | 1833 | 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); | |
| 1813 | 1836 | |
| 1814 | 1837 | plane_funcs = &snb_sprite_funcs; |
| 1815 | 1838 | } 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); | |
| 1818 | 1841 | |
| 1819 | 1842 | plane_funcs = &g4x_sprite_funcs; |
| 1820 | 1843 | } |
| @@ -1833,11 +1856,15 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv, · 12 unmodified lines | ||
| 1833 | 1856 | plane->id = PLANE_SPRITE0 + sprite; |
| 1834 | 1857 | plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id); |
| 1835 | 1858 | |
| 1859 | + modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_TILING_X); | |
| 1860 | + | |
| 1836 | 1861 | ret = drm_universal_plane_init(&dev_priv->drm, &plane->base, |
| 1837 | 1862 | 0, plane_funcs, |
| 1838 | 1863 | formats, num_formats, modifiers, |
| 1839 | 1864 | DRM_PLANE_TYPE_OVERLAY, |
| 1840 | 1865 | "sprite %c", sprite_name(pipe, sprite)); |
| 1866 | + kfree(modifiers); | |
| 1867 | + | |
| 1841 | 1868 | if (ret) |
| 1842 | 1869 | goto fail; |
| 1843 | 1870 | |
| @@ -27,14 +27,10 @@ struct intel_plane_state; · 26 unmodified lines | ||
| 27 | 27 | #define VBLANK_EVASION_TIME_US 100 |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | −int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, | |
| 31 | − int usecs); | |
| 32 | 30 | struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv, |
| 33 | 31 | enum pipe pipe, int plane); |
| 34 | 32 | int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data, |
| 35 | 33 | 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); | |
| 38 | 34 | int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state); |
| 39 | 35 | int chv_plane_check_rotation(const struct intel_plane_state *plane_state); |
| 40 | 36 | |
| @@ -442,10 +442,10 @@ calculate_rc_params(struct rc_parameters *rc, · 441 unmodified lines | ||
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
| 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) | |
| 447 | 446 | { |
| 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); | |
| 449 | 449 | struct drm_dsc_config *vdsc_cfg = &pipe_config->dsc.config; |
| 450 | 450 | u16 compressed_bpp = pipe_config->dsc.compressed_bpp; |
| 451 | 451 | 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 | ||
| 598 | 598 | pps_val |= DSC_422_ENABLE; |
| 599 | 599 | if (vdsc_cfg->vbr_enable) |
| 600 | 600 | 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); | |
| 602 | 602 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 603 | 603 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_0, |
| 604 | 604 | pps_val); |
| @@ -622,7 +622,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 17 unmodified lines | ||
| 622 | 622 | /* Populate PICTURE_PARAMETER_SET_1 registers */ |
| 623 | 623 | pps_val = 0; |
| 624 | 624 | 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); | |
| 626 | 626 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 627 | 627 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_1, |
| 628 | 628 | pps_val); |
| @@ -647,7 +647,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 647 | 647 | pps_val = 0; |
| 648 | 648 | pps_val |= DSC_PIC_HEIGHT(vdsc_cfg->pic_height) | |
| 649 | 649 | 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); | |
| 651 | 651 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 652 | 652 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_2, |
| 653 | 653 | pps_val); |
| @@ -672,7 +672,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 672 | 672 | pps_val = 0; |
| 673 | 673 | pps_val |= DSC_SLICE_HEIGHT(vdsc_cfg->slice_height) | |
| 674 | 674 | 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); | |
| 676 | 676 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 677 | 677 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_3, |
| 678 | 678 | pps_val); |
| @@ -697,7 +697,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 697 | 697 | pps_val = 0; |
| 698 | 698 | pps_val |= DSC_INITIAL_XMIT_DELAY(vdsc_cfg->initial_xmit_delay) | |
| 699 | 699 | 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); | |
| 701 | 701 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 702 | 702 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_4, |
| 703 | 703 | pps_val); |
| @@ -722,7 +722,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 722 | 722 | pps_val = 0; |
| 723 | 723 | pps_val |= DSC_SCALE_INC_INT(vdsc_cfg->scale_increment_interval) | |
| 724 | 724 | 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); | |
| 726 | 726 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 727 | 727 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_5, |
| 728 | 728 | pps_val); |
| @@ -749,7 +749,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines | ||
| 749 | 749 | DSC_FIRST_LINE_BPG_OFFSET(vdsc_cfg->first_line_bpg_offset) | |
| 750 | 750 | DSC_FLATNESS_MIN_QP(vdsc_cfg->flatness_min_qp) | |
| 751 | 751 | 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); | |
| 753 | 753 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 754 | 754 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_6, |
| 755 | 755 | pps_val); |
| @@ -774,7 +774,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 774 | 774 | pps_val = 0; |
| 775 | 775 | pps_val |= DSC_SLICE_BPG_OFFSET(vdsc_cfg->slice_bpg_offset) | |
| 776 | 776 | 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); | |
| 778 | 778 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 779 | 779 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_7, |
| 780 | 780 | pps_val); |
| @@ -799,7 +799,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 799 | 799 | pps_val = 0; |
| 800 | 800 | pps_val |= DSC_FINAL_OFFSET(vdsc_cfg->final_offset) | |
| 801 | 801 | 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); | |
| 803 | 803 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 804 | 804 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_8, |
| 805 | 805 | pps_val); |
| @@ -824,7 +824,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 18 unmodified lines | ||
| 824 | 824 | pps_val = 0; |
| 825 | 825 | pps_val |= DSC_RC_MODEL_SIZE(vdsc_cfg->rc_model_size) | |
| 826 | 826 | 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); | |
| 828 | 828 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 829 | 829 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_9, |
| 830 | 830 | pps_val); |
| @@ -851,7 +851,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines | ||
| 851 | 851 | DSC_RC_QUANT_INC_LIMIT1(vdsc_cfg->rc_quant_incr_limit1) | |
| 852 | 852 | DSC_RC_TARGET_OFF_HIGH(DSC_RC_TGT_OFFSET_HI_CONST) | |
| 853 | 853 | 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); | |
| 855 | 855 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 856 | 856 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_10, |
| 857 | 857 | pps_val); |
| @@ -879,7 +879,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 21 unmodified lines | ||
| 879 | 879 | vdsc_cfg->slice_width) | |
| 880 | 880 | DSC_SLICE_ROW_PER_FRAME(vdsc_cfg->pic_height / |
| 881 | 881 | 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); | |
| 883 | 883 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 884 | 884 | intel_de_write(dev_priv, DSCA_PICTURE_PARAMETER_SET_16, |
| 885 | 885 | pps_val); |
| @@ -906,8 +906,8 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) · 20 unmodified lines | ||
| 906 | 906 | rc_buf_thresh_dword[i / 4] |= |
| 907 | 907 | (u32)(vdsc_cfg->rc_buf_thresh[i] << |
| 908 | 908 | 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]); | |
| 911 | 911 | } |
| 912 | 912 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 913 | 913 | 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 | ||
| 963 | 963 | RC_MAX_QP_SHIFT) | |
| 964 | 964 | (vdsc_cfg->rc_range_params[i].range_min_qp << |
| 965 | 965 | 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]); | |
| 968 | 968 | } |
| 969 | 969 | if (!is_pipe_dsc(crtc, cpu_transcoder)) { |
| 970 | 970 | 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 | ||
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 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) | |
| 1060 | 1060 | { |
| 1061 | 1061 | const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; |
| 1062 | 1062 | 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 | ||
| 1064 | 1064 | struct drm_dsc_picture_parameter_set pps; |
| 1065 | 1065 | enum port port; |
| 1066 | 1066 | |
| 1067 | + if (!crtc_state->dsc.compression_enable) | |
| 1068 | + return; | |
| 1069 | + | |
| 1067 | 1070 | drm_dsc_pps_payload_pack(&pps, vdsc_cfg); |
| 1068 | 1071 | |
| 1069 | 1072 | 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 | ||
| 1074 | 1077 | } |
| 1075 | 1078 | } |
| 1076 | 1079 | |
| 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) | |
| 1079 | 1082 | { |
| 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); | |
| 1082 | 1084 | const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; |
| 1083 | 1085 | struct drm_dsc_pps_infoframe dp_dsc_pps_sdp; |
| 1084 | 1086 | |
| 1087 | + if (!crtc_state->dsc.compression_enable) | |
| 1088 | + return; | |
| 1089 | + | |
| 1085 | 1090 | /* Prepare DP SDP PPS header as per DP 1.4 spec, Table 2-123 */ |
| 1086 | 1091 | drm_dsc_dp_pps_header_init(&dp_dsc_pps_sdp.pps_header); |
| 1087 | 1092 | |
| @@ -1142,8 +1147,7 @@ void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state) · 54 unmodified lines | ||
| 1142 | 1147 | } |
| 1143 | 1148 | } |
| 1144 | 1149 | |
| 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) | |
| 1147 | 1151 | { |
| 1148 | 1152 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); |
| 1149 | 1153 | 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 | ||
| 1155 | 1159 | |
| 1156 | 1160 | intel_dsc_pps_configure(crtc_state); |
| 1157 | 1161 | |
| 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 | − | |
| 1165 | 1162 | dss_ctl2_val |= LEFT_BRANCH_VDSC_ENABLE; |
| 1166 | 1163 | if (crtc_state->dsc.dsc_split) { |
| 1167 | 1164 | dss_ctl2_val |= RIGHT_BRANCH_VDSC_ENABLE; |
| @@ -15,15 +15,17 @@ struct intel_encoder; · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state); |
| 17 | 17 | 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); | |
| 20 | 19 | 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); | |
| 23 | 21 | void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state); |
| 24 | 22 | void intel_dsc_get_config(struct intel_crtc_state *crtc_state); |
| 25 | 23 | enum intel_display_power_domain |
| 26 | 24 | intel_dsc_power_domain(struct intel_crtc *crtc, enum transcoder cpu_transcoder); |
| 27 | 25 | 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); | |
| 28 | 30 | |
| 29 | 31 | #endif /* __INTEL_VDSC_H__ */ |
| @@ -60,7 +60,7 @@ intel_vrr_check_modeset(struct intel_atomic_state *state) · 59 unmodified lines | ||
| 60 | 60 | * Between those two points the vblank exit starts (and hence registers get |
| 61 | 61 | * latched) ASAP after a push is sent. |
| 62 | 62 | * |
| 63 | − * framestart_delay is programmable 0-3. | |
| 63 | + * framestart_delay is programmable 1-4. | |
| 64 | 64 | */ |
| 65 | 65 | static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_state) |
| 66 | 66 | { |
| @@ -138,13 +138,13 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state, · 71 unmodified lines | ||
| 138 | 138 | i915->window2_delay; |
| 139 | 139 | else |
| 140 | 140 | /* |
| 141 | − * FIXME: s/4/framestart_delay+1/ to get consistent | |
| 141 | + * FIXME: s/4/framestart_delay/ to get consistent | |
| 142 | 142 | * earliest/latest points for register latching regardless |
| 143 | 143 | * of the framestart_delay used? |
| 144 | 144 | * |
| 145 | 145 | * FIXME: this really needs the extra scanline to provide consistent |
| 146 | 146 | * 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 | |
| 148 | 148 | * one extra line. |
| 149 | 149 | */ |
| 150 | 150 | crtc_state->vrr.pipeline_full = |
| @@ -193,6 +193,18 @@ void intel_vrr_send_push(const struct intel_crtc_state *crtc_state) · 42 unmodified lines | ||
| 193 | 193 | TRANS_PUSH_EN | TRANS_PUSH_SEND); |
| 194 | 194 | } |
| 195 | 195 | |
| 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 | + | |
| 196 | 208 | void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state) |
| 197 | 209 | { |
| 198 | 210 | struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); |
| @@ -23,6 +23,7 @@ void intel_vrr_compute_config(struct intel_crtc_state *crtc_state, · 22 unmodified lines | ||
| 23 | 23 | void intel_vrr_enable(struct intel_encoder *encoder, |
| 24 | 24 | const struct intel_crtc_state *crtc_state); |
| 25 | 25 | 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); | |
| 26 | 27 | void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state); |
| 27 | 28 | void intel_vrr_get_config(struct intel_crtc *crtc, |
| 28 | 29 | struct intel_crtc_state *crtc_state); |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | #include "intel_de.h" |
| 6 | 6 | #include "intel_display_types.h" |
| 7 | +#include "intel_fb.h" | |
| 7 | 8 | #include "skl_scaler.h" |
| 8 | 9 | #include "skl_universal_plane.h" |
| 9 | 10 | |
| @@ -163,50 +163,6 @@ static const u32 icl_hdr_plane_formats[] = { · 162 unmodified lines | ||
| 163 | 163 | DRM_FORMAT_XVYU16161616, |
| 164 | 164 | }; |
| 165 | 165 | |
| 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 | − | |
| 210 | 166 | int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) |
| 211 | 167 | { |
| 212 | 168 | switch (format) { |
| @@ -633,7 +589,7 @@ static u32 skl_plane_stride(const struct intel_plane_state *plane_state, · 420 unmodified lines | ||
| 633 | 589 | { |
| 634 | 590 | const struct drm_framebuffer *fb = plane_state->hw.fb; |
| 635 | 591 | 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; | |
| 637 | 593 | |
| 638 | 594 | if (color_plane >= fb->format->num_planes) |
| 639 | 595 | return 0; |
| @@ -642,8 +598,8 @@ static u32 skl_plane_stride(const struct intel_plane_state *plane_state, · 2 unmodified lines | ||
| 642 | 598 | } |
| 643 | 599 | |
| 644 | 600 | 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) | |
| 647 | 603 | { |
| 648 | 604 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 649 | 605 | 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 | ||
| 985 | 941 | plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE; |
| 986 | 942 | } |
| 987 | 943 | |
| 944 | + if (plane_state->force_black) | |
| 945 | + plane_color_ctl |= PLANE_COLOR_PLANE_CSC_ENABLE; | |
| 946 | + | |
| 988 | 947 | return plane_color_ctl; |
| 989 | 948 | } |
| 990 | 949 | |
| @@ -1008,115 +967,145 @@ static u32 skl_surf_address(const struct intel_plane_state *plane_state, · 17 unmodified lines | ||
| 1008 | 967 | } |
| 1009 | 968 | } |
| 1010 | 969 | |
| 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) | |
| 1012 | 972 | { |
| 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; | |
| 1017 | 974 | |
| 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); | |
| 1022 | 977 | |
| 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; | |
| 1025 | 980 | |
| 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 | +} | |
| 1028 | 983 | |
| 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); | |
| 1032 | 1002 | |
| 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); | |
| 1036 | 1006 | } |
| 1037 | 1007 | |
| 1038 | 1008 | 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) | |
| 1043 | 1013 | { |
| 1044 | 1014 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
| 1045 | 1015 | enum plane_id plane_id = plane->id; |
| 1046 | 1016 | 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); | |
| 1049 | 1017 | u32 stride = skl_plane_stride(plane_state, color_plane); |
| 1050 | 1018 | const struct drm_framebuffer *fb = plane_state->hw.fb; |
| 1051 | − int aux_plane = skl_main_to_aux_plane(fb, color_plane); | |
| 1052 | 1019 | int crtc_x = plane_state->uapi.dst.x1; |
| 1053 | 1020 | 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; | |
| 1056 | 1021 | u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16; |
| 1057 | 1022 | 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; | |
| 1060 | 1023 | 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); | |
| 1069 | 1024 | |
| 1070 | 1025 | /* Sizes are 0 based */ |
| 1071 | 1026 | src_w--; |
| 1072 | 1027 | src_h--; |
| 1073 | 1028 | |
| 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 | − | |
| 1080 | 1029 | /* The scaler will handle the output position */ |
| 1081 | 1030 | if (plane_state->scaler_id >= 0) { |
| 1082 | 1031 | crtc_x = 0; |
| 1083 | 1032 | crtc_y = 0; |
| 1084 | 1033 | } |
| 1085 | 1034 | |
| 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 | − | |
| 1093 | 1035 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
| 1094 | 1036 | |
| 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 | + | |
| 1095 | 1044 | intel_de_write_fw(dev_priv, PLANE_STRIDE(pipe, plane_id), stride); |
| 1096 | 1045 | intel_de_write_fw(dev_priv, PLANE_POS(pipe, plane_id), |
| 1097 | 1046 | (crtc_y << 16) | crtc_x); |
| 1098 | 1047 | intel_de_write_fw(dev_priv, PLANE_SIZE(pipe, plane_id), |
| 1099 | 1048 | (src_h << 16) | src_w); |
| 1100 | 1049 | |
| 1101 | − intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist); | |
| 1102 | − | |
| 1103 | 1050 | if (icl_is_hdr_plane(dev_priv, plane_id)) |
| 1104 | 1051 | intel_de_write_fw(dev_priv, PLANE_CUS_CTL(pipe, plane_id), |
| 1105 | 1052 | plane_state->cus_ctl); |
| 1106 | 1053 | |
| 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 | − | |
| 1111 | 1054 | if (fb->format->is_yuv && icl_is_hdr_plane(dev_priv, plane_id)) |
| 1112 | 1055 | icl_program_input_csc(plane, crtc_state, plane_state); |
| 1113 | 1056 | |
| 1114 | − if (fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC) | |
| 1057 | + if (intel_fb_is_rc_ccs_cc_modifier(fb->modifier)) | |
| 1115 | 1058 | intel_uncore_write64_fw(&dev_priv->uncore, |
| 1116 | 1059 | PLANE_CC_VAL(pipe, plane_id), plane_state->ccval); |
| 1117 | 1060 | |
| 1118 | 1061 | skl_write_plane_wm(plane, crtc_state); |
| 1119 | 1062 | |
| 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 | + | |
| 1120 | 1109 | intel_de_write_fw(dev_priv, PLANE_KEYVAL(pipe, plane_id), |
| 1121 | 1110 | key->min_value); |
| 1122 | 1111 | 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 | ||
| 1125 | 1114 | intel_de_write_fw(dev_priv, PLANE_OFFSET(pipe, plane_id), |
| 1126 | 1115 | (y << 16) | x); |
| 1127 | 1116 | |
| 1117 | + intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist); | |
| 1118 | + | |
| 1128 | 1119 | if (DISPLAY_VER(dev_priv) < 11) |
| 1129 | 1120 | intel_de_write_fw(dev_priv, PLANE_AUX_OFFSET(pipe, plane_id), |
| 1130 | 1121 | (plane_state->view.color_plane[1].y << 16) | |
| 1131 | 1122 | plane_state->view.color_plane[1].x); |
| 1132 | 1123 | |
| 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); | |
| 1134 | 1126 | |
| 1135 | 1127 | /* |
| 1136 | 1128 | * Enable the scaler before the plane so that we don't |
| 1137 | 1129 | * get a catastrophic underrun even if the two operations |
| 1138 | 1130 | * end up happening in two different frames. |
| 1131 | + * | |
| 1132 | + * TODO: split into noarm+arm pair | |
| 1139 | 1133 | */ |
| 1140 | 1134 | if (plane_state->scaler_id >= 0) |
| 1141 | 1135 | skl_program_plane_scaler(plane, crtc_state, plane_state); |
| @@ -1146,23 +1140,8 @@ skl_program_plane(struct intel_plane *plane, · 4 unmodified lines | ||
| 1146 | 1140 | * the control register just before the surface register. |
| 1147 | 1141 | */ |
| 1148 | 1142 | 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)); | |
| 1166 | 1145 | |
| 1167 | 1146 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 1168 | 1147 | } |
| @@ -1177,7 +1156,6 @@ skl_plane_async_flip(struct intel_plane *plane, · 8 unmodified lines | ||
| 1177 | 1156 | unsigned long irqflags; |
| 1178 | 1157 | enum plane_id plane_id = plane->id; |
| 1179 | 1158 | enum pipe pipe = plane->pipe; |
| 1180 | − u32 surf_addr = plane_state->view.color_plane[0].offset; | |
| 1181 | 1159 | u32 plane_ctl = plane_state->ctl; |
| 1182 | 1160 | |
| 1183 | 1161 | plane_ctl |= skl_plane_ctl_crtc(crtc_state); |
| @@ -1189,15 +1167,15 @@ skl_plane_async_flip(struct intel_plane *plane, · 5 unmodified lines | ||
| 1189 | 1167 | |
| 1190 | 1168 | intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl); |
| 1191 | 1169 | 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)); | |
| 1193 | 1171 | |
| 1194 | 1172 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 1195 | 1173 | } |
| 1196 | 1174 | |
| 1197 | 1175 | 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) | |
| 1201 | 1179 | { |
| 1202 | 1180 | int color_plane = 0; |
| 1203 | 1181 | |
| @@ -1205,7 +1183,21 @@ skl_update_plane(struct intel_plane *plane, · 1 unmodified line | ||
| 1205 | 1183 | /* Program the UV plane on planar master */ |
| 1206 | 1184 | color_plane = 1; |
| 1207 | 1185 | |
| 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); | |
| 1209 | 1201 | } |
| 1210 | 1202 | |
| 1211 | 1203 | 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 | ||
| 1232 | 1224 | return 0; |
| 1233 | 1225 | |
| 1234 | 1226 | if (rotation & ~(DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180) && |
| 1235 | − is_ccs_modifier(fb->modifier)) { | |
| 1227 | + intel_fb_is_ccs_modifier(fb->modifier)) { | |
| 1236 | 1228 | drm_dbg_kms(&dev_priv->drm, |
| 1237 | 1229 | "RC support only with 0/180 degree rotation (%x)\n", |
| 1238 | 1230 | rotation); |
| @@ -1284,13 +1276,8 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state, · 45 unmodified lines | ||
| 1284 | 1276 | /* Y-tiling is not supported in IF-ID Interlace mode */ |
| 1285 | 1277 | if (crtc_state->hw.enable && |
| 1286 | 1278 | 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) { | |
| 1294 | 1281 | drm_dbg_kms(&dev_priv->drm, |
| 1295 | 1282 | "Y/Yf tiling not supported in IF-ID mode\n"); |
| 1296 | 1283 | return -EINVAL; |
| @@ -1487,7 +1474,7 @@ int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state, · 190 unmodified lines | ||
| 1487 | 1474 | if (fb->modifier == I915_FORMAT_MOD_X_TILED) { |
| 1488 | 1475 | int cpp = fb->format->cpp[0]; |
| 1489 | 1476 | |
| 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) { | |
| 1491 | 1478 | if (*offset == 0) { |
| 1492 | 1479 | drm_dbg_kms(&dev_priv->drm, |
| 1493 | 1480 | "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 | ||
| 1536 | 1523 | * CCS AUX surface doesn't have its own x/y offsets, we must make sure |
| 1537 | 1524 | * they match with the main surface x/y offsets. |
| 1538 | 1525 | */ |
| 1539 | − if (is_ccs_modifier(fb->modifier)) { | |
| 1526 | + if (intel_fb_is_ccs_modifier(fb->modifier)) { | |
| 1540 | 1527 | while (!skl_check_main_ccs_coordinates(plane_state, x, y, |
| 1541 | 1528 | offset, aux_plane)) { |
| 1542 | 1529 | if (offset == 0) |
| @@ -1600,7 +1587,7 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state) · 57 unmodified lines | ||
| 1600 | 1587 | offset = intel_plane_compute_aligned_offset(&x, &y, |
| 1601 | 1588 | plane_state, uv_plane); |
| 1602 | 1589 | |
| 1603 | − if (is_ccs_modifier(fb->modifier)) { | |
| 1590 | + if (intel_fb_is_ccs_modifier(fb->modifier)) { | |
| 1604 | 1591 | int ccs_plane = main_to_ccs_plane(fb, uv_plane); |
| 1605 | 1592 | u32 aux_offset = plane_state->view.color_plane[ccs_plane].offset; |
| 1606 | 1593 | 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 | ||
| 1656 | 1643 | int hsub, vsub; |
| 1657 | 1644 | int x, y; |
| 1658 | 1645 | |
| 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)) | |
| 1661 | 1647 | continue; |
| 1662 | 1648 | |
| 1663 | 1649 | 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 | ||
| 1699 | 1685 | * Handle the AUX surface first since the main surface setup depends on |
| 1700 | 1686 | * it. |
| 1701 | 1687 | */ |
| 1702 | − if (is_ccs_modifier(fb->modifier)) { | |
| 1688 | + if (intel_fb_is_ccs_modifier(fb->modifier)) { | |
| 1703 | 1689 | ret = skl_check_ccs_aux_surface(plane_state); |
| 1704 | 1690 | if (ret) |
| 1705 | 1691 | return ret; |
| @@ -1737,6 +1723,18 @@ static bool skl_fb_scalable(const struct drm_framebuffer *fb) · 31 unmodified lines | ||
| 1737 | 1723 | } |
| 1738 | 1724 | } |
| 1739 | 1725 | |
| 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 | + | |
| 1740 | 1738 | static int skl_plane_check(struct intel_crtc_state *crtc_state, |
| 1741 | 1739 | struct intel_plane_state *plane_state) |
| 1742 | 1740 | { |
| @@ -1781,6 +1779,11 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state, · 38 unmodified lines | ||
| 1781 | 1779 | if (ret) |
| 1782 | 1780 | return ret; |
| 1783 | 1781 | |
| 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 | + | |
| 1784 | 1787 | /* HW only has 8 bits pixel precision, disable plane if invisible */ |
| 1785 | 1788 | if (!(plane_state->hw.alpha >> 8)) |
| 1786 | 1789 | 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 | ||
| 1870 | 1873 | } |
| 1871 | 1874 | } |
| 1872 | 1875 | |
| 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 | − | |
| 1890 | 1876 | static bool skl_plane_format_mod_supported(struct drm_plane *_plane, |
| 1891 | 1877 | u32 format, u64 modifier) |
| 1892 | 1878 | { |
| 1893 | 1879 | struct intel_plane *plane = to_intel_plane(_plane); |
| 1894 | 1880 | |
| 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)) | |
| 1907 | 1882 | return false; |
| 1908 | − } | |
| 1909 | 1883 | |
| 1910 | 1884 | switch (format) { |
| 1911 | 1885 | case DRM_FORMAT_XRGB8888: |
| 1912 | 1886 | case DRM_FORMAT_XBGR8888: |
| 1913 | 1887 | case DRM_FORMAT_ARGB8888: |
| 1914 | 1888 | case DRM_FORMAT_ABGR8888: |
| 1915 | − if (is_ccs_modifier(modifier)) | |
| 1889 | + if (intel_fb_is_ccs_modifier(modifier)) | |
| 1916 | 1890 | return true; |
| 1917 | 1891 | fallthrough; |
| 1918 | 1892 | case DRM_FORMAT_RGB565: |
| @@ -1953,52 +1927,20 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane, · 34 unmodified lines | ||
| 1953 | 1927 | } |
| 1954 | 1928 | } |
| 1955 | 1929 | |
| 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 | − | |
| 1971 | 1930 | static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, |
| 1972 | 1931 | u32 format, u64 modifier) |
| 1973 | 1932 | { |
| 1974 | − struct drm_i915_private *dev_priv = to_i915(_plane->dev); | |
| 1975 | 1933 | struct intel_plane *plane = to_intel_plane(_plane); |
| 1976 | 1934 | |
| 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)) | |
| 1993 | 1936 | return false; |
| 1994 | − } | |
| 1995 | 1937 | |
| 1996 | 1938 | switch (format) { |
| 1997 | 1939 | case DRM_FORMAT_XRGB8888: |
| 1998 | 1940 | case DRM_FORMAT_XBGR8888: |
| 1999 | 1941 | case DRM_FORMAT_ARGB8888: |
| 2000 | 1942 | case DRM_FORMAT_ABGR8888: |
| 2001 | − if (is_ccs_modifier(modifier)) | |
| 1943 | + if (intel_fb_is_ccs_modifier(modifier)) | |
| 2002 | 1944 | return true; |
| 2003 | 1945 | fallthrough; |
| 2004 | 1946 | case DRM_FORMAT_YUYV: |
| @@ -2010,7 +1952,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, · 5 unmodified lines | ||
| 2010 | 1952 | case DRM_FORMAT_P010: |
| 2011 | 1953 | case DRM_FORMAT_P012: |
| 2012 | 1954 | case DRM_FORMAT_P016: |
| 2013 | − if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS) | |
| 1955 | + if (intel_fb_is_mc_ccs_modifier(modifier)) | |
| 2014 | 1956 | return true; |
| 2015 | 1957 | fallthrough; |
| 2016 | 1958 | case DRM_FORMAT_RGB565: |
| @@ -2039,18 +1981,6 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, · 22 unmodified lines | ||
| 2039 | 1981 | } |
| 2040 | 1982 | } |
| 2041 | 1983 | |
| 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 | − | |
| 2054 | 1984 | static const struct drm_plane_funcs skl_plane_funcs = { |
| 2055 | 1985 | .update_plane = drm_atomic_helper_update_plane, |
| 2056 | 1986 | .disable_plane = drm_atomic_helper_disable_plane, |
| @@ -2091,6 +2021,64 @@ skl_plane_disable_flip_done(struct intel_plane *plane) · 34 unmodified lines | ||
| 2091 | 2021 | spin_unlock_irq(&i915->irq_lock); |
| 2092 | 2022 | } |
| 2093 | 2023 | |
| 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 | + | |
| 2094 | 2082 | struct intel_plane * |
| 2095 | 2083 | skl_universal_plane_create(struct drm_i915_private *dev_priv, |
| 2096 | 2084 | 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 | ||
| 2113 | 2101 | plane->id = plane_id; |
| 2114 | 2102 | plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane_id); |
| 2115 | 2103 | |
| 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; | |
| 2122 | 2108 | |
| 2123 | 2109 | if (DISPLAY_VER(dev_priv) >= 11) { |
| 2124 | 2110 | plane->min_width = icl_plane_min_width; |
| @@ -2136,8 +2122,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 11 unmodified lines | ||
| 2136 | 2122 | } |
| 2137 | 2123 | |
| 2138 | 2124 | 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; | |
| 2141 | 2128 | plane->get_hw_state = skl_plane_get_hw_state; |
| 2142 | 2129 | plane->check_plane = skl_plane_check; |
| 2143 | 2130 | |
| @@ -2159,29 +2146,28 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 15 unmodified lines | ||
| 2159 | 2146 | formats = skl_get_plane_formats(dev_priv, pipe, |
| 2160 | 2147 | plane_id, &num_formats); |
| 2161 | 2148 | |
| 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) | |
| 2165 | 2150 | 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 | |
| 2171 | 2152 | plane_funcs = &skl_plane_funcs; |
| 2172 | − } | |
| 2173 | 2153 | |
| 2174 | 2154 | if (plane_id == PLANE_PRIMARY) |
| 2175 | 2155 | plane_type = DRM_PLANE_TYPE_PRIMARY; |
| 2176 | 2156 | else |
| 2177 | 2157 | plane_type = DRM_PLANE_TYPE_OVERLAY; |
| 2178 | 2158 | |
| 2159 | + modifiers = intel_fb_plane_get_modifiers(dev_priv, | |
| 2160 | + skl_get_plane_caps(dev_priv, pipe, plane_id)); | |
| 2161 | + | |
| 2179 | 2162 | ret = drm_universal_plane_init(&dev_priv->drm, &plane->base, |
| 2180 | 2163 | 0, plane_funcs, |
| 2181 | 2164 | formats, num_formats, modifiers, |
| 2182 | 2165 | plane_type, |
| 2183 | 2166 | "plane %d%c", plane_id + 1, |
| 2184 | 2167 | pipe_name(pipe)); |
| 2168 | + | |
| 2169 | + kfree(modifiers); | |
| 2170 | + | |
| 2185 | 2171 | if (ret) |
| 2186 | 2172 | goto fail; |
| 2187 | 2173 | |
| @@ -38,9 +38,12 @@ · 37 unmodified lines | ||
| 38 | 38 | #include "intel_de.h" |
| 39 | 39 | #include "intel_display_types.h" |
| 40 | 40 | #include "intel_dsi.h" |
| 41 | +#include "intel_dsi_vbt.h" | |
| 41 | 42 | #include "intel_fifo_underrun.h" |
| 42 | 43 | #include "intel_panel.h" |
| 43 | 44 | #include "skl_scaler.h" |
| 45 | +#include "vlv_dsi.h" | |
| 46 | +#include "vlv_dsi_pll.h" | |
| 44 | 47 | #include "vlv_sideband.h" |
| 45 | 48 | |
| 46 | 49 | /* return pixels in terms of txbyteclkhs */ |
| @@ -1258,7 +1261,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder, · 1211 unmodified lines | ||
| 1258 | 1261 | struct intel_crtc_state *pipe_config) |
| 1259 | 1262 | { |
| 1260 | 1263 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1264 | + struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); | |
| 1261 | 1265 | u32 pclk; |
| 1266 | + | |
| 1262 | 1267 | drm_dbg_kms(&dev_priv->drm, "\n"); |
| 1263 | 1268 | |
| 1264 | 1269 | 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 | ||
| 1270 | 1275 | pclk = vlv_dsi_get_pclk(encoder, pipe_config); |
| 1271 | 1276 | } |
| 1272 | 1277 | |
| 1278 | + if (intel_dsi->dual_link) | |
| 1279 | + pclk *= 2; | |
| 1280 | + | |
| 1273 | 1281 | if (pclk) { |
| 1274 | 1282 | pipe_config->hw.adjusted_mode.crtc_clock = pclk; |
| 1275 | 1283 | pipe_config->port_clock = pclk; |
| @@ -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__ */ | |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #include "intel_de.h" |
| 32 | 32 | #include "intel_display_types.h" |
| 33 | 33 | #include "intel_dsi.h" |
| 34 | +#include "vlv_dsi_pll.h" | |
| 34 | 35 | #include "vlv_sideband.h" |
| 35 | 36 | |
| 36 | 37 | static const u16 lfsr_converts[] = { |
| @@ -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__ */ | |
| @@ -479,7 +479,7 @@ set_proto_ctx_engines_bond(struct i915_user_extension __user *base, void *data) · 478 unmodified lines | ||
| 479 | 479 | if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915) && |
| 480 | 480 | !IS_ROCKETLAKE(i915) && !IS_ALDERLAKE_S(i915)) { |
| 481 | 481 | 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"); | |
| 483 | 483 | return -ENODEV; |
| 484 | 484 | } |
| 485 | 485 | |
| @@ -3,12 +3,14 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright © 2020 Intel Corporation |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#include <linux/agp_backend.h> | |
| 6 | 7 | #include <linux/stop_machine.h> |
| 7 | 8 | |
| 8 | 9 | #include <asm/set_memory.h> |
| 9 | 10 | #include <asm/smp.h> |
| 10 | 11 | |
| 11 | 12 | #include <drm/i915_drm.h> |
| 13 | +#include <drm/intel-gtt.h> | |
| 12 | 14 | |
| 13 | 15 | #include "gem/i915_gem_lmem.h" |
| 14 | 16 | |
| @@ -116,17 +118,26 @@ static bool needs_idle_maps(struct drm_i915_private *i915) · 101 unmodified lines | ||
| 116 | 118 | return false; |
| 117 | 119 | } |
| 118 | 120 | |
| 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) | |
| 120 | 129 | { |
| 121 | 130 | struct i915_vma *vma, *vn; |
| 122 | 131 | int open; |
| 123 | 132 | |
| 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); | |
| 125 | 136 | |
| 126 | 137 | /* Skip rewriting PTE on VMA unbind. */ |
| 127 | − open = atomic_xchg(&ggtt->vm.open, 0); | |
| 138 | + open = atomic_xchg(&vm->open, 0); | |
| 128 | 139 | |
| 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) { | |
| 130 | 141 | GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); |
| 131 | 142 | i915_vma_wait_for_bind(vma); |
| 132 | 143 | |
| @@ -139,11 +150,17 @@ void i915_ggtt_suspend(struct i915_ggtt *ggtt) · 6 unmodified lines | ||
| 139 | 150 | } |
| 140 | 151 | } |
| 141 | 152 | |
| 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); | |
| 145 | 154 | |
| 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); | |
| 147 | 164 | |
| 148 | 165 | intel_gt_check_and_clear_faults(ggtt->vm.gt); |
| 149 | 166 | } |
| @@ -1253,37 +1270,59 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt) · 1103 unmodified lines | ||
| 1253 | 1270 | ggtt->invalidate(ggtt); |
| 1254 | 1271 | } |
| 1255 | 1272 | |
| 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) | |
| 1257 | 1284 | { |
| 1258 | 1285 | struct i915_vma *vma; |
| 1259 | − bool flush = false; | |
| 1286 | + bool write_domain_objs = false; | |
| 1260 | 1287 | int open; |
| 1261 | 1288 | |
| 1262 | − intel_gt_check_and_clear_faults(ggtt->vm.gt); | |
| 1289 | + drm_WARN_ON(&vm->i915->drm, !vm->is_ggtt && !vm->is_dpt); | |
| 1263 | 1290 | |
| 1264 | 1291 | /* 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); | |
| 1266 | 1293 | |
| 1267 | 1294 | /* Skip rewriting PTE on VMA unbind. */ |
| 1268 | − open = atomic_xchg(&ggtt->vm.open, 0); | |
| 1295 | + open = atomic_xchg(&vm->open, 0); | |
| 1269 | 1296 | |
| 1270 | 1297 | /* 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) { | |
| 1272 | 1299 | struct drm_i915_gem_object *obj = vma->obj; |
| 1273 | 1300 | unsigned int was_bound = |
| 1274 | 1301 | atomic_read(&vma->flags) & I915_VMA_BIND_MASK; |
| 1275 | 1302 | |
| 1276 | 1303 | GEM_BUG_ON(!was_bound); |
| 1277 | − vma->ops->bind_vma(&ggtt->vm, NULL, vma, | |
| 1304 | + vma->ops->bind_vma(vm, NULL, vma, | |
| 1278 | 1305 | obj ? obj->cache_level : 0, |
| 1279 | 1306 | was_bound); |
| 1280 | 1307 | 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); | |
| 1282 | 1309 | obj->read_domains |= I915_GEM_DOMAIN_GTT; |
| 1283 | 1310 | } |
| 1284 | 1311 | } |
| 1285 | 1312 | |
| 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 | + | |
| 1287 | 1326 | ggtt->invalidate(ggtt); |
| 1288 | 1327 | |
| 1289 | 1328 | if (flush) |
| @@ -1388,30 +1427,39 @@ err_st_alloc: · 98 unmodified lines | ||
| 1388 | 1427 | } |
| 1389 | 1428 | |
| 1390 | 1429 | 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) | |
| 1396 | 1455 | { |
| 1397 | 1456 | unsigned int row; |
| 1398 | 1457 | |
| 1399 | 1458 | if (!width || !height) |
| 1400 | 1459 | return sg; |
| 1401 | 1460 | |
| 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); | |
| 1415 | 1463 | |
| 1416 | 1464 | for (row = 0; row < height; row++) { |
| 1417 | 1465 | unsigned int left = width * I915_GTT_PAGE_SIZE; |
| @@ -1448,18 +1496,98 @@ remap_pages(struct drm_i915_gem_object *obj, · 30 unmodified lines | ||
| 1448 | 1496 | if (!left) |
| 1449 | 1497 | continue; |
| 1450 | 1498 | |
| 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 | + | |
| 1451 | 1529 | st->nents++; |
| 1530 | + count -= len >> PAGE_SHIFT; | |
| 1531 | + if (count == 0) | |
| 1532 | + return sg; | |
| 1452 | 1533 | |
| 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); | |
| 1463 | 1591 | |
| 1464 | 1592 | return sg; |
| 1465 | 1593 | } |
| @@ -1488,21 +1616,8 @@ intel_remap_pages(struct intel_remapped_info *rem_info, · 22 unmodified lines | ||
| 1488 | 1616 | st->nents = 0; |
| 1489 | 1617 | sg = st->sgl; |
| 1490 | 1618 | |
| 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, >t_offset); | |
| 1506 | 1621 | |
| 1507 | 1622 | i915_sg_trim(st); |
| 1508 | 1623 | |
| @@ -1524,9 +1639,8 @@ intel_partial_pages(const struct i915_ggtt_view *view, · 15 unmodified lines | ||
| 1524 | 1639 | struct drm_i915_gem_object *obj) |
| 1525 | 1640 | { |
| 1526 | 1641 | struct sg_table *st; |
| 1527 | − struct scatterlist *sg, *iter; | |
| 1642 | + struct scatterlist *sg; | |
| 1528 | 1643 | unsigned int count = view->partial.size; |
| 1529 | − unsigned int offset; | |
| 1530 | 1644 | int ret = -ENOMEM; |
| 1531 | 1645 | |
| 1532 | 1646 | st = kmalloc(sizeof(*st), GFP_KERNEL); |
| @@ -1537,34 +1651,14 @@ intel_partial_pages(const struct i915_ggtt_view *view, · 4 unmodified lines | ||
| 1537 | 1651 | if (ret) |
| 1538 | 1652 | goto err_sg_alloc; |
| 1539 | 1653 | |
| 1540 | − iter = i915_gem_object_get_sg_dma(obj, view->partial.offset, &offset); | |
| 1541 | − GEM_BUG_ON(!iter); | |
| 1542 | − | |
| 1543 | − sg = st->sgl; | |
| 1544 | 1654 | st->nents = 0; |
| 1545 | − do { | |
| 1546 | − unsigned int len; | |
| 1547 | 1655 | |
| 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); | |
| 1554 | 1657 | |
| 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. */ | |
| 1560 | 1660 | |
| 1561 | − return st; | |
| 1562 | − } | |
| 1563 | − | |
| 1564 | − sg = __sg_next(sg); | |
| 1565 | − iter = __sg_next(iter); | |
| 1566 | − offset = 0; | |
| 1567 | − } while (1); | |
| 1661 | + return st; | |
| 1568 | 1662 | |
| 1569 | 1663 | err_sg_alloc: |
| 1570 | 1664 | kfree(st); |
| @@ -3,6 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright © 2019 Intel Corporation |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +#include <drm/intel-gtt.h> | |
| 7 | + | |
| 6 | 8 | #include "intel_gt_debugfs.h" |
| 7 | 9 | |
| 8 | 10 | #include "gem/i915_gem_lmem.h" |
| @@ -544,6 +544,8 @@ int i915_ppgtt_init_hw(struct intel_gt *gt); · 543 unmodified lines | ||
| 544 | 544 | struct i915_ppgtt *i915_ppgtt_create(struct intel_gt *gt, |
| 545 | 545 | unsigned long lmem_pt_obj_flags); |
| 546 | 546 | |
| 547 | +void i915_ggtt_suspend_vm(struct i915_address_space *vm); | |
| 548 | +bool i915_ggtt_resume_vm(struct i915_address_space *vm); | |
| 547 | 549 | void i915_ggtt_suspend(struct i915_ggtt *gtt); |
| 548 | 550 | void i915_ggtt_resume(struct i915_ggtt *ggtt); |
| 549 | 551 | |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #include <linux/acpi.h> |
| 31 | 31 | #include <linux/device.h> |
| 32 | −#include <linux/oom.h> | |
| 33 | 32 | #include <linux/module.h> |
| 33 | +#include <linux/oom.h> | |
| 34 | 34 | #include <linux/pci.h> |
| 35 | 35 | #include <linux/pm.h> |
| 36 | 36 | #include <linux/pm_runtime.h> |
| @@ -48,12 +48,14 @@ · 11 unmodified lines | ||
| 48 | 48 | #include "display/intel_acpi.h" |
| 49 | 49 | #include "display/intel_bw.h" |
| 50 | 50 | #include "display/intel_cdclk.h" |
| 51 | −#include "display/intel_dmc.h" | |
| 52 | 51 | #include "display/intel_display_types.h" |
| 52 | +#include "display/intel_dmc.h" | |
| 53 | 53 | #include "display/intel_dp.h" |
| 54 | +#include "display/intel_dpt.h" | |
| 54 | 55 | #include "display/intel_fbdev.h" |
| 55 | 56 | #include "display/intel_hotplug.h" |
| 56 | 57 | #include "display/intel_overlay.h" |
| 58 | +#include "display/intel_pch_refclk.h" | |
| 57 | 59 | #include "display/intel_pipe_crc.h" |
| 58 | 60 | #include "display/intel_pps.h" |
| 59 | 61 | #include "display/intel_sprite.h" |
| @@ -70,6 +72,7 @@ · 10 unmodified lines | ||
| 70 | 72 | #include "pxp/intel_pxp_pm.h" |
| 71 | 73 | |
| 72 | 74 | #include "i915_debugfs.h" |
| 75 | +#include "i915_driver.h" | |
| 73 | 76 | #include "i915_drv.h" |
| 74 | 77 | #include "i915_ioc32.h" |
| 75 | 78 | #include "i915_irq.h" |
| @@ -89,7 +92,7 @@ · 13 unmodified lines | ||
| 89 | 92 | #include "intel_region_ttm.h" |
| 90 | 93 | #include "vlv_suspend.h" |
| 91 | 94 | |
| 92 | −static const struct drm_driver driver; | |
| 95 | +static const struct drm_driver i915_drm_driver; | |
| 93 | 96 | |
| 94 | 97 | static int i915_get_bridge_dev(struct drm_i915_private *dev_priv) |
| 95 | 98 | { |
| @@ -322,7 +325,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv) · 226 unmodified lines | ||
| 322 | 325 | mutex_init(&dev_priv->sb_lock); |
| 323 | 326 | cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE); |
| 324 | 327 | |
| 325 | − mutex_init(&dev_priv->av_mutex); | |
| 328 | + mutex_init(&dev_priv->audio.mutex); | |
| 326 | 329 | mutex_init(&dev_priv->wm.wm_mutex); |
| 327 | 330 | mutex_init(&dev_priv->pps_mutex); |
| 328 | 331 | 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 | ||
| 766 | 769 | struct intel_device_info *device_info; |
| 767 | 770 | struct drm_i915_private *i915; |
| 768 | 771 | |
| 769 | − i915 = devm_drm_dev_alloc(&pdev->dev, &driver, | |
| 772 | + i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver, | |
| 770 | 773 | struct drm_i915_private, drm); |
| 771 | 774 | if (IS_ERR(i915)) |
| 772 | 775 | return i915; |
| @@ -1127,6 +1130,8 @@ static int i915_drm_suspend(struct drm_device *dev) · 354 unmodified lines | ||
| 1127 | 1130 | |
| 1128 | 1131 | intel_suspend_hw(dev_priv); |
| 1129 | 1132 | |
| 1133 | + /* Must be called before GGTT is suspended. */ | |
| 1134 | + intel_dpt_suspend(dev_priv); | |
| 1130 | 1135 | i915_ggtt_suspend(&dev_priv->ggtt); |
| 1131 | 1136 | |
| 1132 | 1137 | i915_save_display(dev_priv); |
| @@ -1183,6 +1188,14 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation) · 50 unmodified lines | ||
| 1183 | 1188 | goto out; |
| 1184 | 1189 | } |
| 1185 | 1190 | |
| 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 | + | |
| 1186 | 1199 | pci_disable_device(pdev); |
| 1187 | 1200 | /* |
| 1188 | 1201 | * During hibernation on some platforms the BIOS may try to access |
| @@ -1207,7 +1220,8 @@ out: · 18 unmodified lines | ||
| 1207 | 1220 | return ret; |
| 1208 | 1221 | } |
| 1209 | 1222 | |
| 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) | |
| 1211 | 1225 | { |
| 1212 | 1226 | int error; |
| 1213 | 1227 | |
| @@ -1243,6 +1257,8 @@ static int i915_drm_resume(struct drm_device *dev) · 29 unmodified lines | ||
| 1243 | 1257 | drm_err(&dev_priv->drm, "failed to re-enable GGTT\n"); |
| 1244 | 1258 | |
| 1245 | 1259 | i915_ggtt_resume(&dev_priv->ggtt); |
| 1260 | + /* Must be called after GGTT is resumed. */ | |
| 1261 | + intel_dpt_resume(dev_priv); | |
| 1246 | 1262 | |
| 1247 | 1263 | intel_dmc_ucode_resume(dev_priv); |
| 1248 | 1264 | |
| @@ -1344,6 +1360,8 @@ static int i915_drm_resume_early(struct drm_device *dev) · 95 unmodified lines | ||
| 1344 | 1360 | |
| 1345 | 1361 | pci_set_master(pdev); |
| 1346 | 1362 | |
| 1363 | + pci_d3cold_enable(pdev); | |
| 1364 | + | |
| 1347 | 1365 | disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); |
| 1348 | 1366 | |
| 1349 | 1367 | ret = vlv_resume_prepare(dev_priv, false); |
| @@ -1364,7 +1382,7 @@ static int i915_drm_resume_early(struct drm_device *dev) · 14 unmodified lines | ||
| 1364 | 1382 | return ret; |
| 1365 | 1383 | } |
| 1366 | 1384 | |
| 1367 | −int i915_resume_switcheroo(struct drm_i915_private *i915) | |
| 1385 | +int i915_driver_resume_switcheroo(struct drm_i915_private *i915) | |
| 1368 | 1386 | { |
| 1369 | 1387 | int ret; |
| 1370 | 1388 | |
| @@ -1520,6 +1538,7 @@ static int intel_runtime_suspend(struct device *kdev) · 149 unmodified lines | ||
| 1520 | 1538 | { |
| 1521 | 1539 | struct drm_i915_private *dev_priv = kdev_to_i915(kdev); |
| 1522 | 1540 | struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; |
| 1541 | + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); | |
| 1523 | 1542 | int ret; |
| 1524 | 1543 | |
| 1525 | 1544 | 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 | ||
| 1565 | 1584 | drm_err(&dev_priv->drm, |
| 1566 | 1585 | "Unclaimed access detected prior to suspending\n"); |
| 1567 | 1586 | |
| 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); | |
| 1568 | 1593 | rpm->suspended = true; |
| 1569 | 1594 | |
| 1570 | 1595 | /* |
| @@ -1603,6 +1628,7 @@ static int intel_runtime_resume(struct device *kdev) · 32 unmodified lines | ||
| 1603 | 1628 | { |
| 1604 | 1629 | struct drm_i915_private *dev_priv = kdev_to_i915(kdev); |
| 1605 | 1630 | struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; |
| 1631 | + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); | |
| 1606 | 1632 | int ret; |
| 1607 | 1633 | |
| 1608 | 1634 | 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 | ||
| 1615 | 1641 | |
| 1616 | 1642 | intel_opregion_notify_adapter(dev_priv, PCI_D0); |
| 1617 | 1643 | rpm->suspended = false; |
| 1644 | + pci_d3cold_enable(pdev); | |
| 1618 | 1645 | if (intel_uncore_unclaimed_mmio(&dev_priv->uncore)) |
| 1619 | 1646 | drm_dbg(&dev_priv->drm, |
| 1620 | 1647 | "Unclaimed access during suspend, bios?\n"); |
| @@ -1777,7 +1804,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = { · 156 unmodified lines | ||
| 1777 | 1804 | DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW), |
| 1778 | 1805 | }; |
| 1779 | 1806 | |
| 1780 | −static const struct drm_driver driver = { | |
| 1807 | +static const struct drm_driver i915_drm_driver = { | |
| 1781 | 1808 | /* Don't use MTRRs here; the Xserver or userspace app should |
| 1782 | 1809 | * deal with them for Intel hardware. |
| 1783 | 1810 | */ |
| @@ -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__ */ | |
| @@ -50,7 +50,6 @@ · 49 unmodified lines | ||
| 50 | 50 | #include <linux/stackdepot.h> |
| 51 | 51 | #include <linux/xarray.h> |
| 52 | 52 | |
| 53 | −#include <drm/intel-gtt.h> | |
| 54 | 53 | #include <drm/drm_gem.h> |
| 55 | 54 | #include <drm/drm_auth.h> |
| 56 | 55 | #include <drm/drm_cache.h> |
| @@ -364,15 +363,6 @@ struct intel_color_funcs { · 307 unmodified lines | ||
| 364 | 363 | void (*read_luts)(struct intel_crtc_state *crtc_state); |
| 365 | 364 | }; |
| 366 | 365 | |
| 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 | − | |
| 376 | 366 | struct intel_cdclk_funcs { |
| 377 | 367 | void (*get_cdclk)(struct drm_i915_private *dev_priv, |
| 378 | 368 | struct intel_cdclk_config *cdclk_config); |
| @@ -411,10 +401,14 @@ struct drm_i915_display_funcs { · 32 unmodified lines | ||
| 411 | 401 | void (*commit_modeset_enables)(struct intel_atomic_state *state); |
| 412 | 402 | }; |
| 413 | 403 | |
| 404 | +struct intel_fbc_funcs; | |
| 414 | 405 | |
| 415 | 406 | #define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */ |
| 416 | 407 | |
| 417 | 408 | struct intel_fbc { |
| 409 | + struct drm_i915_private *i915; | |
| 410 | + const struct intel_fbc_funcs *funcs; | |
| 411 | + | |
| 418 | 412 | /* This is always the inner lock when overlapping with struct_mutex and |
| 419 | 413 | * it's the outer lock when overlapping with stolen_lock. */ |
| 420 | 414 | struct mutex lock; |
| @@ -828,6 +822,30 @@ struct i915_selftest_stash { · 407 unmodified lines | ||
| 828 | 822 | struct ida mock_region_instances; |
| 829 | 823 | }; |
| 830 | 824 | |
| 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 | + | |
| 831 | 849 | struct drm_i915_private { |
| 832 | 850 | struct drm_device drm; |
| 833 | 851 | |
| @@ -995,9 +1013,6 @@ struct drm_i915_private { · 161 unmodified lines | ||
| 995 | 1013 | /* Display internal color functions */ |
| 996 | 1014 | const struct intel_color_funcs *color_funcs; |
| 997 | 1015 | |
| 998 | − /* Display internal audio functions */ | |
| 999 | − const struct intel_audio_funcs *audio_funcs; | |
| 1000 | − | |
| 1001 | 1016 | /* Display CDCLK functions */ |
| 1002 | 1017 | const struct intel_cdclk_funcs *cdclk_funcs; |
| 1003 | 1018 | |
| @@ -1084,17 +1099,6 @@ struct drm_i915_private { · 80 unmodified lines | ||
| 1084 | 1099 | struct drm_property *broadcast_rgb_property; |
| 1085 | 1100 | struct drm_property *force_audio_property; |
| 1086 | 1101 | |
| 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 | − | |
| 1098 | 1102 | u32 fdi_rx_config; |
| 1099 | 1103 | |
| 1100 | 1104 | /* Shadow for DISPLAY_PHY_CONTROL which can't be safely read */ |
| @@ -1227,14 +1231,7 @@ struct drm_i915_private { · 126 unmodified lines | ||
| 1227 | 1231 | |
| 1228 | 1232 | bool ipc_enabled; |
| 1229 | 1233 | |
| 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; | |
| 1238 | 1235 | |
| 1239 | 1236 | struct i915_pmu pmu; |
| 1240 | 1237 | |
| @@ -1455,7 +1452,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 214 unmodified lines | ||
| 1455 | 1452 | #define IS_GEMINILAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_GEMINILAKE) |
| 1456 | 1453 | #define IS_COFFEELAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_COFFEELAKE) |
| 1457 | 1454 | #define IS_COMETLAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_COMETLAKE) |
| 1458 | −#define IS_CANNONLAKE(dev_priv) 0 | |
| 1459 | 1455 | #define IS_ICELAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_ICELAKE) |
| 1460 | 1456 | #define IS_JSL_EHL(dev_priv) (IS_PLATFORM(dev_priv, INTEL_JASPERLAKE) || \ |
| 1461 | 1457 | IS_PLATFORM(dev_priv, INTEL_ELKHARTLAKE)) |
| @@ -1745,7 +1741,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 283 unmodified lines | ||
| 1745 | 1741 | |
| 1746 | 1742 | #define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->pipe_mask != 0) |
| 1747 | 1743 | |
| 1748 | −#define HAS_VRR(i915) (GRAPHICS_VER(i915) >= 12) | |
| 1744 | +#define HAS_VRR(i915) (GRAPHICS_VER(i915) >= 11) | |
| 1749 | 1745 | |
| 1750 | 1746 | #define HAS_ASYNC_FLIPS(i915) (DISPLAY_VER(i915) >= 5) |
| 1751 | 1747 | |
| @@ -1789,16 +1785,7 @@ intel_vm_no_concurrent_access_wa(struct drm_i915_private *i915) · 37 unmodified lines | ||
| 1789 | 1785 | return IS_CHERRYVIEW(i915) || intel_ggtt_update_needs_vtd_wa(i915); |
| 1790 | 1786 | } |
| 1791 | 1787 | |
| 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 */ | |
| 1802 | 1789 | int i915_getparam_ioctl(struct drm_device *dev, void *data, |
| 1803 | 1790 | struct drm_file *file_priv); |
| 1804 | 1791 | |
| @@ -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__ */ | |
| @@ -3016,7 +3016,7 @@ static void vlv_display_irq_reset(struct drm_i915_private *dev_priv) · 3015 unmodified lines | ||
| 3016 | 3016 | if (IS_CHERRYVIEW(dev_priv)) |
| 3017 | 3017 | intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK_CHV); |
| 3018 | 3018 | else |
| 3019 | − intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK); | |
| 3019 | + intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK_VLV); | |
| 3020 | 3020 | |
| 3021 | 3021 | i915_hotplug_interrupt_update_locked(dev_priv, 0xffffffff, 0); |
| 3022 | 3022 | intel_uncore_write(uncore, PORT_HOTPLUG_STAT, intel_uncore_read(&dev_priv->uncore, PORT_HOTPLUG_STAT)); |
| @@ -24,8 +24,8 @@ static int i915_check_nomodeset(void) · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | /* |
| 26 | 26 | * 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. | |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | if (i915_modparams.modeset == 0) |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <drm/drm_drv.h> |
| 28 | 28 | #include <drm/i915_pciids.h> |
| 29 | 29 | |
| 30 | +#include "i915_driver.h" | |
| 30 | 31 | #include "i915_drv.h" |
| 31 | 32 | #include "i915_pci.h" |
| 32 | 33 | |
| @@ -145,6 +146,12 @@ · 112 unmodified lines | ||
| 145 | 146 | .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \ |
| 146 | 147 | DRM_COLOR_LUT_EQUAL_CHANNELS, \ |
| 147 | 148 | } |
| 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 | + } | |
| 148 | 155 | |
| 149 | 156 | /* Keep in gen based order, and chronological order within a gen */ |
| 150 | 157 | |
| @@ -811,7 +818,7 @@ static const struct intel_device_info cml_gt2_info = { · 660 unmodified lines | ||
| 811 | 818 | [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \ |
| 812 | 819 | }, \ |
| 813 | 820 | GEN(11), \ |
| 814 | − .color = { .degamma_lut_size = 33, .gamma_lut_size = 262145 }, \ | |
| 821 | + ICL_COLORS, \ | |
| 815 | 822 | .dbuf.size = 2048, \ |
| 816 | 823 | .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2), \ |
| 817 | 824 | .display.has_dsc = 1, \ |
| @@ -866,7 +873,7 @@ static const struct intel_device_info jsl_info = { · 48 unmodified lines | ||
| 866 | 873 | TGL_CURSOR_OFFSETS, \ |
| 867 | 874 | .has_global_mocs = 1, \ |
| 868 | 875 | .has_pxp = 1, \ |
| 869 | − .display.has_dsb = 1 | |
| 876 | + .display.has_dsb = 0 /* FIXME: LUT load is broken with DSB */ | |
| 870 | 877 | |
| 871 | 878 | static const struct intel_device_info tgl_info = { |
| 872 | 879 | GEN12_FEATURES, |
| @@ -932,8 +939,6 @@ static const struct intel_device_info adl_s_info = { · 59 unmodified lines | ||
| 932 | 939 | #define XE_LPD_FEATURES \ |
| 933 | 940 | .abox_mask = GENMASK(1, 0), \ |
| 934 | 941 | .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), \ | |
| 937 | 942 | .dbuf.size = 4096, \ |
| 938 | 943 | .dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2) | BIT(DBUF_S3) | \ |
| 939 | 944 | BIT(DBUF_S4), \ |
| @@ -955,12 +960,16 @@ static const struct intel_device_info adl_s_info = { · 15 unmodified lines | ||
| 955 | 960 | [TRANSCODER_B] = PIPE_B_OFFSET, \ |
| 956 | 961 | [TRANSCODER_C] = PIPE_C_OFFSET, \ |
| 957 | 962 | [TRANSCODER_D] = PIPE_D_OFFSET, \ |
| 963 | + [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \ | |
| 964 | + [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \ | |
| 958 | 965 | }, \ |
| 959 | 966 | .trans_offsets = { \ |
| 960 | 967 | [TRANSCODER_A] = TRANSCODER_A_OFFSET, \ |
| 961 | 968 | [TRANSCODER_B] = TRANSCODER_B_OFFSET, \ |
| 962 | 969 | [TRANSCODER_C] = TRANSCODER_C_OFFSET, \ |
| 963 | 970 | [TRANSCODER_D] = TRANSCODER_D_OFFSET, \ |
| 971 | + [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \ | |
| 972 | + [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \ | |
| 964 | 973 | }, \ |
| 965 | 974 | XE_LPD_CURSOR_OFFSETS |
| 966 | 975 | |
| @@ -969,6 +978,9 @@ static const struct intel_device_info adl_p_info = { · 2 unmodified lines | ||
| 969 | 978 | XE_LPD_FEATURES, |
| 970 | 979 | PLATFORM(INTEL_ALDERLAKE_P), |
| 971 | 980 | .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), | |
| 972 | 984 | .display.has_cdclk_crawl = 1, |
| 973 | 985 | .display.has_modular_fia = 1, |
| 974 | 986 | .display.has_psr_hw_tracking = 0, |
| @@ -1038,6 +1050,8 @@ static const struct intel_device_info dg2_info = { · 63 unmodified lines | ||
| 1038 | 1050 | BIT(VECS0) | BIT(VECS1) | |
| 1039 | 1051 | BIT(VCS0) | BIT(VCS2), |
| 1040 | 1052 | .require_force_probe = 1, |
| 1053 | + .cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | | |
| 1054 | + BIT(TRANSCODER_C) | BIT(TRANSCODER_D), | |
| 1041 | 1055 | }; |
| 1042 | 1056 | |
| 1043 | 1057 | #undef PLATFORM |
| @@ -371,6 +371,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 370 unmodified lines | ||
| 371 | 371 | #define VLV_G3DCTL _MMIO(0x9024) |
| 372 | 372 | #define VLV_GSCKGCTL _MMIO(0x9028) |
| 373 | 373 | |
| 374 | +#define FBC_LLC_READ_CTRL _MMIO(0x9044) | |
| 375 | +#define FBC_LLC_FULLY_OPEN REG_BIT(30) | |
| 376 | + | |
| 374 | 377 | #define GEN6_MBCTL _MMIO(0x0907c) |
| 375 | 378 | #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4) |
| 376 | 379 | #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 | ||
| 2795 | 2798 | #define GEN12_AUX_ERR_DBG _MMIO(0x43f4) |
| 2796 | 2799 | |
| 2797 | 2800 | #define FPGA_DBG _MMIO(0x42300) |
| 2798 | −#define FPGA_DBG_RM_NOCLAIM (1 << 31) | |
| 2801 | +#define FPGA_DBG_RM_NOCLAIM REG_BIT(31) | |
| 2799 | 2802 | |
| 2800 | 2803 | #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) | |
| 2804 | 2807 | |
| 2805 | 2808 | #define DERRMR _MMIO(0x44050) |
| 2806 | 2809 | /* 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 | ||
| 3307 | 3310 | #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */ |
| 3308 | 3311 | #define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */ |
| 3309 | 3312 | #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)) | |
| 3321 | 3324 | #define FBC_COMMAND _MMIO(0x320c) |
| 3322 | −#define FBC_CMD_COMPRESS (1 << 0) | |
| 3325 | +#define FBC_CMD_COMPRESS REG_BIT(0) | |
| 3323 | 3326 | #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) | |
| 3338 | 3351 | |
| 3339 | 3352 | #define FBC_LL_SIZE (1536) |
| 3340 | 3353 | |
| 3341 | −#define FBC_LLC_READ_CTRL _MMIO(0x9044) | |
| 3342 | −#define FBC_LLC_FULLY_OPEN (1 << 30) | |
| 3343 | − | |
| 3344 | 3354 | /* Framebuffer compression for GM45+ */ |
| 3345 | 3355 | #define DPFC_CB_BASE _MMIO(0x3200) |
| 3356 | +#define ILK_DPFC_CB_BASE _MMIO(0x43200) | |
| 3346 | 3357 | #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)) | |
| 3357 | 3376 | #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) | |
| 3363 | 3381 | #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) | |
| 3368 | 3385 | #define DPFC_STATUS2 _MMIO(0x3214) |
| 3386 | +#define ILK_DPFC_STATUS2 _MMIO(0x43214) | |
| 3387 | +#define DPFC_COMP_SEG_MASK_IVB REG_GENMASK(11, 0) | |
| 3369 | 3388 | #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 | |
| 3385 | 3389 | #define ILK_DPFC_FENCE_YOFF _MMIO(0x43218) |
| 3390 | +#define DPFC_CHICKEN _MMIO(0x3224) | |
| 3386 | 3391 | #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 | + | |
| 3390 | 3397 | #define GLK_FBC_STRIDE _MMIO(0x43228) |
| 3391 | 3398 | #define FBC_STRIDE_OVERRIDE REG_BIT(15) |
| 3392 | 3399 | #define FBC_STRIDE_MASK REG_GENMASK(14, 0) |
| 3393 | 3400 | #define FBC_STRIDE(x) REG_FIELD_PREP(FBC_STRIDE_MASK, (x)) |
| 3401 | + | |
| 3394 | 3402 | #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) | |
| 3397 | 3405 | |
| 3398 | 3406 | #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000) |
| 3399 | 3407 | #define ILK_FBCQ_DIS (1 << 22) |
| @@ -3417,8 +3425,10 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 17 unmodified lines | ||
| 3417 | 3425 | * The following two registers are of type GTTMMADR |
| 3418 | 3426 | */ |
| 3419 | 3427 | #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) | |
| 3422 | 3432 | |
| 3423 | 3433 | /* Framebuffer compression for Ivybridge */ |
| 3424 | 3434 | #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 | ||
| 3428 | 3438 | #define IPS_ENABLE (1 << 31) |
| 3429 | 3439 | |
| 3430 | 3440 | #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) | |
| 3433 | 3443 | |
| 3434 | 3444 | /* |
| 3435 | 3445 | * GPIO regs |
| @@ -4309,47 +4319,52 @@ enum { · 873 unmodified lines | ||
| 4309 | 4319 | |
| 4310 | 4320 | /* Pipe A CRC regs */ |
| 4311 | 4321 | #define _PIPE_CRC_CTL_A 0x60050 |
| 4312 | −#define PIPE_CRC_ENABLE (1 << 31) | |
| 4322 | +#define PIPE_CRC_ENABLE REG_BIT(31) | |
| 4313 | 4323 | /* 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) | |
| 4322 | 4333 | /* 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) | |
| 4326 | 4338 | /* 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) | |
| 4333 | 4346 | /* 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) | |
| 4337 | 4351 | /* 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) | |
| 4341 | 4355 | /* 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) | |
| 4345 | 4360 | /* 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) | |
| 4351 | 4366 | /* 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) | |
| 4353 | 4368 | |
| 4354 | 4369 | #define _PIPE_CRC_RES_1_A_IVB 0x60064 |
| 4355 | 4370 | #define _PIPE_CRC_RES_2_A_IVB 0x60068 |
| @@ -4698,11 +4713,11 @@ enum { · 342 unmodified lines | ||
| 4698 | 4713 | #define PSR_EVENT_LPSP_MODE_EXIT (1 << 1) |
| 4699 | 4714 | #define PSR_EVENT_PSR_DISABLE (1 << 0) |
| 4700 | 4715 | |
| 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) | |
| 4706 | 4721 | |
| 4707 | 4722 | #define _PSR2_SU_STATUS_A 0x60914 |
| 4708 | 4723 | #define _PSR2_SU_STATUS_EDP 0x6f914 |
| @@ -4999,9 +5014,9 @@ enum { · 290 unmodified lines | ||
| 4999 | 5014 | #define PORT_DFT2_G4X _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61154) |
| 5000 | 5015 | #define DC_BALANCE_RESET_VLV (1 << 31) |
| 5001 | 5016 | #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) | |
| 5005 | 5020 | |
| 5006 | 5021 | /* Gen 3 SDVO bits: */ |
| 5007 | 5022 | #define SDVO_ENABLE (1 << 31) |
| @@ -6266,55 +6281,55 @@ enum { · 1258 unmodified lines | ||
| 6266 | 6281 | #define PIPE_STATUS_PORT_UNDERRUN_XELPD REG_BIT(26) |
| 6267 | 6282 | |
| 6268 | 6283 | #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) | |
| 6288 | 6303 | |
| 6289 | 6304 | #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) | |
| 6318 | 6333 | |
| 6319 | 6334 | #define DSPARB _MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70030) |
| 6320 | 6335 | #define DSPARB_CSTART_MASK (0x7f << 7) |
| @@ -8263,7 +8278,7 @@ enum { · 1942 unmodified lines | ||
| 8263 | 8278 | |
| 8264 | 8279 | /* |
| 8265 | 8280 | * 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 | |
| 8267 | 8282 | * (although the addresses stay the same so new S0 = old S1, new S1 = old S2). |
| 8268 | 8283 | * We'll just use the 0-based numbering here for all platforms since it's the |
| 8269 | 8284 | * way things will be named by the hardware team going forward, plus it's more |
| @@ -8308,9 +8323,10 @@ enum { · 38 unmodified lines | ||
| 8308 | 8323 | #define RESET_PCH_HANDSHAKE_ENABLE (1 << 4) |
| 8309 | 8324 | |
| 8310 | 8325 | #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) | |
| 8314 | 8330 | |
| 8315 | 8331 | #define GEN11_CHICKEN_DCPR_2 _MMIO(0x46434) |
| 8316 | 8332 | #define DCPR_MASK_MAXLATENCY_MEMUP_CLR REG_BIT(27) |
| @@ -9781,6 +9797,10 @@ enum { · 1464 unmodified lines | ||
| 9781 | 9797 | #define AUD_PIN_BUF_CTL _MMIO(0x48414) |
| 9782 | 9798 | #define AUD_PIN_BUF_ENABLE REG_BIT(31) |
| 9783 | 9799 | |
| 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 | + | |
| 9784 | 9804 | /* Display Audio Config Reg */ |
| 9785 | 9805 | #define AUD_CONFIG_BE _MMIO(0x65ef0) |
| 9786 | 9806 | #define HBLANK_EARLY_ENABLE_ICL(pipe) (0x1 << (20 - (pipe))) |
| @@ -10212,8 +10232,6 @@ enum skl_power_gate { · 425 unmodified lines | ||
| 10212 | 10232 | #define TGL_TRANS_DDI_PORT_MASK (0xf << TGL_TRANS_DDI_PORT_SHIFT) |
| 10213 | 10233 | #define TRANS_DDI_SELECT_PORT(x) ((x) << TRANS_DDI_PORT_SHIFT) |
| 10214 | 10234 | #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) | |
| 10217 | 10235 | #define TRANS_DDI_MODE_SELECT_MASK (7 << 24) |
| 10218 | 10236 | #define TRANS_DDI_MODE_SELECT_HDMI (0 << 24) |
| 10219 | 10237 | #define TRANS_DDI_MODE_SELECT_DVI (1 << 24) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include <linux/vga_switcheroo.h> |
| 7 | 7 | |
| 8 | +#include "i915_driver.h" | |
| 8 | 9 | #include "i915_drv.h" |
| 9 | 10 | #include "i915_switcheroo.h" |
| 10 | 11 | |
| @@ -24,12 +25,12 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, · 13 unmodified lines | ||
| 24 | 25 | i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING; |
| 25 | 26 | /* i915 resume handler doesn't set to D0 */ |
| 26 | 27 | pci_set_power_state(pdev, PCI_D0); |
| 27 | − i915_resume_switcheroo(i915); | |
| 28 | + i915_driver_resume_switcheroo(i915); | |
| 28 | 29 | i915->drm.switch_power_state = DRM_SWITCH_POWER_ON; |
| 29 | 30 | } else { |
| 30 | 31 | drm_info(&i915->drm, "switched off\n"); |
| 31 | 32 | i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING; |
| 32 | − i915_suspend_switcheroo(i915, pmm); | |
| 33 | + i915_driver_suspend_switcheroo(i915, pmm); | |
| 33 | 34 | i915->drm.switch_power_state = DRM_SWITCH_POWER_OFF; |
| 34 | 35 | } |
| 35 | 36 | } |
| @@ -288,7 +288,7 @@ TRACE_EVENT(vlv_fifo_size, · 287 unmodified lines | ||
| 288 | 288 | |
| 289 | 289 | /* plane updates */ |
| 290 | 290 | |
| 291 | −TRACE_EVENT(intel_update_plane, | |
| 291 | +TRACE_EVENT(intel_plane_update_noarm, | |
| 292 | 292 | TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), |
| 293 | 293 | TP_ARGS(plane, crtc), |
| 294 | 294 | |
| @@ -317,7 +317,36 @@ TRACE_EVENT(intel_update_plane, · 22 unmodified lines | ||
| 317 | 317 | DRM_RECT_ARG((const struct drm_rect *)__entry->dst)) |
| 318 | 318 | ); |
| 319 | 319 | |
| 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, | |
| 321 | 350 | TP_PROTO(struct drm_plane *plane, struct intel_crtc *crtc), |
| 322 | 351 | TP_ARGS(plane, crtc), |
| 323 | 352 | |
| @@ -404,6 +433,48 @@ TRACE_EVENT(intel_fbc_nuke, · 80 unmodified lines | ||
| 404 | 433 | |
| 405 | 434 | /* pipe updates */ |
| 406 | 435 | |
| 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 | + | |
| 407 | 478 | TRACE_EVENT(intel_pipe_update_start, |
| 408 | 479 | TP_PROTO(struct intel_crtc *crtc), |
| 409 | 480 | TP_ARGS(crtc), |
| @@ -97,11 +97,20 @@ enum i915_cache_level; · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | struct intel_remapped_plane_info { |
| 99 | 99 | /* 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 | + }; | |
| 105 | 114 | } __packed; |
| 106 | 115 | |
| 107 | 116 | struct intel_remapped_info { |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | #include "display/intel_bw.h" |
| 38 | 38 | #include "display/intel_de.h" |
| 39 | 39 | #include "display/intel_display_types.h" |
| 40 | +#include "display/intel_fb.h" | |
| 40 | 41 | #include "display/intel_fbc.h" |
| 41 | 42 | #include "display/intel_sprite.h" |
| 42 | 43 | #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 | ||
| 160 | 161 | * Display WA #0883: bxt |
| 161 | 162 | */ |
| 162 | 163 | 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); | |
| 164 | 165 | } |
| 165 | 166 | |
| 166 | 167 | 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 | ||
| 3062 | 3063 | * The BIOS provided WM memory latency values are often |
| 3063 | 3064 | * inadequate for high resolution displays. Adjust them. |
| 3064 | 3065 | */ |
| 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); | |
| 3068 | 3069 | |
| 3069 | 3070 | if (!changed) |
| 3070 | 3071 | return; |
| @@ -3374,7 +3375,7 @@ static void ilk_wm_merge(struct drm_i915_private *dev_priv, · 303 unmodified lines | ||
| 3374 | 3375 | * enabled sometime later. |
| 3375 | 3376 | */ |
| 3376 | 3377 | 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)) { | |
| 3378 | 3379 | for (level = 2; level <= max_level; level++) { |
| 3379 | 3380 | struct intel_wm_level *wm = &merged->wm[level]; |
| 3380 | 3381 | |
| @@ -5094,6 +5095,18 @@ skl_check_nv12_wm_level(struct skl_wm_level *wm, struct skl_wm_level *uv_wm, · 1713 unmodified lines | ||
| 5094 | 5095 | } |
| 5095 | 5096 | } |
| 5096 | 5097 | |
| 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 | + | |
| 5097 | 5110 | static int |
| 5098 | 5111 | skl_allocate_plane_ddb(struct intel_atomic_state *state, |
| 5099 | 5112 | struct intel_crtc *crtc) |
| @@ -5264,11 +5277,7 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state, · 164 unmodified lines | ||
| 5264 | 5277 | skl_check_nv12_wm_level(&wm->wm[level], &wm->uv_wm[level], |
| 5265 | 5278 | total[plane_id], uv_total[plane_id]); |
| 5266 | 5279 | |
| 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) && | |
| 5272 | 5281 | level == 1 && wm->wm[0].enable) { |
| 5273 | 5282 | wm->wm[level].blocks = wm->wm[0].blocks; |
| 5274 | 5283 | 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 | ||
| 7434 | 7443 | { |
| 7435 | 7444 | /* Wa_1409120013:icl,ehl */ |
| 7436 | 7445 | intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, |
| 7437 | − ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL); | |
| 7446 | + DPFC_CHICKEN_COMP_DUMMY_PIXEL); | |
| 7438 | 7447 | |
| 7439 | 7448 | /*Wa_14010594013:icl, ehl */ |
| 7440 | 7449 | 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 | ||
| 7447 | 7456 | if (IS_TIGERLAKE(dev_priv) || IS_ROCKETLAKE(dev_priv) || |
| 7448 | 7457 | IS_ALDERLAKE_S(dev_priv) || IS_DG1(dev_priv)) |
| 7449 | 7458 | intel_uncore_write(&dev_priv->uncore, ILK_DPFC_CHICKEN, |
| 7450 | − ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL); | |
| 7459 | + DPFC_CHICKEN_COMP_DUMMY_PIXEL); | |
| 7451 | 7460 | |
| 7452 | 7461 | /* Wa_1409825376:tgl (pre-prod)*/ |
| 7453 | 7462 | 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 | ||
| 7509 | 7518 | * Display WA #0873: cfl |
| 7510 | 7519 | */ |
| 7511 | 7520 | 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); | |
| 7513 | 7522 | } |
| 7514 | 7523 | |
| 7515 | 7524 | 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 | ||
| 7542 | 7551 | * Display WA #0873: kbl |
| 7543 | 7552 | */ |
| 7544 | 7553 | 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); | |
| 7546 | 7555 | } |
| 7547 | 7556 | |
| 7548 | 7557 | 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 | ||
| 7569 | 7578 | * Display WA #0873: skl |
| 7570 | 7579 | */ |
| 7571 | 7580 | 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); | |
| 7573 | 7582 | |
| 7574 | 7583 | /* |
| 7575 | 7584 | * WaFbcHighMemBwCorruptionAvoidance:skl |
| 7576 | 7585 | * Display WA #0883: skl |
| 7577 | 7586 | */ |
| 7578 | 7587 | 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); | |
| 7580 | 7589 | } |
| 7581 | 7590 | |
| 7582 | 7591 | static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) |
| @@ -590,6 +590,9 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm) · 589 unmodified lines | ||
| 590 | 590 | pm_runtime_use_autosuspend(kdev); |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | + /* Enable by default */ | |
| 594 | + pm_runtime_allow(kdev); | |
| 595 | + | |
| 593 | 596 | /* |
| 594 | 597 | * The core calls the driver load handler with an RPM reference held. |
| 595 | 598 | * We drop that here and will reacquire it during unloading in |
| @@ -22,11 +22,11 @@ · 21 unmodified lines | ||
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | #include <linux/pm_runtime.h> |
| 25 | −#include <asm/iosf_mbi.h> | |
| 26 | 25 | |
| 27 | 26 | #include "gt/intel_lrc_reg.h" /* for shadow reg list */ |
| 28 | 27 | |
| 29 | 28 | #include "i915_drv.h" |
| 29 | +#include "i915_iosf_mbi.h" | |
| 30 | 30 | #include "i915_trace.h" |
| 31 | 31 | #include "i915_vgpu.h" |
| 32 | 32 | #include "intel_pm.h" |
| @@ -3,7 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright(c) 2020, Intel Corporation. All rights reserved. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | −#include "drm/i915_drm.h" | |
| 6 | +#include <drm/i915_drm.h> | |
| 7 | + | |
| 7 | 8 | #include "i915_drv.h" |
| 8 | 9 | |
| 9 | 10 | #include "intel_pxp.h" |
| @@ -4,8 +4,10 @@ · 3 unmodified lines | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #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 | + | |
| 9 | 11 | #include "i915_drv.h" |
| 10 | 12 | #include "intel_pxp.h" |
| 11 | 13 | #include "intel_pxp_session.h" |
| @@ -3,9 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright © 2013-2021 Intel Corporation |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | −#include <asm/iosf_mbi.h> | |
| 7 | − | |
| 8 | 6 | #include "i915_drv.h" |
| 7 | +#include "i915_iosf_mbi.h" | |
| 9 | 8 | #include "vlv_sideband.h" |
| 10 | 9 | |
| 11 | 10 | /* |
| @@ -4,9 +4,11 @@ · 3 unmodified lines | ||
| 4 | 4 | #ifndef _DRM_INTEL_GTT_H |
| 5 | 5 | #define _DRM_INTEL_GTT_H |
| 6 | 6 | |
| 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; | |
| 10 | 12 | |
| 11 | 13 | void intel_gtt_get(u64 *gtt_total, |
| 12 | 14 | phys_addr_t *mappable_base, |