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

Merge tag 'drm-intel-next-fixes-2018-10-18' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

- Fix GPU hang on MacBook2,1 when booting in EFI mode (Bugzilla #105637)
- Fix garbled console on Y tiled BIOS framebuffer configs (Bugzilla #108264)
- Fix black screen on certain eDP panels eg. Dell XPS 9350 (Bugzilla #107489 and #105338)
- MST fixes that Rodrigo dropped from drm-intel-fixes and bunch of Icelake fixes
- Then assorted proactive code fixes caught by CI or developers

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181018165725.GA2281@jlahtine-desk.ger.corp.intel.com

+227 -104
+1 -1
drivers/gpu/drm/i915/i915_debugfs.c
··· 4189 4189 I915_WAIT_LOCKED, 4190 4190 MAX_SCHEDULE_TIMEOUT); 4191 4191 4192 - if (val & DROP_RESET_SEQNO) { 4192 + if (ret == 0 && val & DROP_RESET_SEQNO) { 4193 4193 intel_runtime_pm_get(i915); 4194 4194 ret = i915_gem_set_global_seqno(&i915->drm, 1); 4195 4195 intel_runtime_pm_put(i915);
+2 -10
drivers/gpu/drm/i915/i915_gem.c
··· 1127 1127 offset = offset_in_page(args->offset); 1128 1128 for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { 1129 1129 struct page *page = i915_gem_object_get_page(obj, idx); 1130 - int length; 1131 - 1132 - length = remain; 1133 - if (offset + length > PAGE_SIZE) 1134 - length = PAGE_SIZE - offset; 1130 + unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); 1135 1131 1136 1132 ret = shmem_pread(page, offset, length, user_data, 1137 1133 page_to_phys(page) & obj_do_bit17_swizzling, ··· 1571 1575 offset = offset_in_page(args->offset); 1572 1576 for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { 1573 1577 struct page *page = i915_gem_object_get_page(obj, idx); 1574 - int length; 1575 - 1576 - length = remain; 1577 - if (offset + length > PAGE_SIZE) 1578 - length = PAGE_SIZE - offset; 1578 + unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); 1579 1579 1580 1580 ret = shmem_pwrite(page, offset, length, user_data, 1581 1581 page_to_phys(page) & obj_do_bit17_swizzling,
+3
drivers/gpu/drm/i915/i915_reg.h
··· 9339 9339 #define DPCLKA_CFGCR0_ICL _MMIO(0x164280) 9340 9340 #define DPCLKA_CFGCR0_DDI_CLK_OFF(port) (1 << ((port) == PORT_F ? 23 : \ 9341 9341 (port) + 10)) 9342 + #define ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(port) (1 << ((port) + 10)) 9343 + #define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) == PORT_TC4 ? \ 9344 + 21 : (tc_port) + 12)) 9342 9345 #define DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port) ((port) == PORT_F ? 21 : \ 9343 9346 (port) * 2) 9344 9347 #define DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port) (3 << DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port))
+1
drivers/gpu/drm/i915/intel_csr.c
··· 35 35 */ 36 36 37 37 #define I915_CSR_ICL "i915/icl_dmc_ver1_07.bin" 38 + MODULE_FIRMWARE(I915_CSR_ICL); 38 39 #define ICL_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) 39 40 40 41 #define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin"
+26 -10
drivers/gpu/drm/i915/intel_ddi.c
··· 916 916 level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift; 917 917 918 918 if (IS_ICELAKE(dev_priv)) { 919 - if (port == PORT_A || port == PORT_B) 919 + if (intel_port_is_combophy(dev_priv, port)) 920 920 icl_get_combo_buf_trans(dev_priv, port, 921 921 INTEL_OUTPUT_HDMI, &n_entries); 922 922 else ··· 1535 1535 uint32_t pll_id; 1536 1536 1537 1537 pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll); 1538 - if (port == PORT_A || port == PORT_B) { 1538 + if (intel_port_is_combophy(dev_priv, port)) { 1539 1539 if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI)) 1540 1540 link_clock = cnl_calc_wrpll_link(dev_priv, pll_id); 1541 1541 else ··· 2235 2235 int n_entries; 2236 2236 2237 2237 if (IS_ICELAKE(dev_priv)) { 2238 - if (port == PORT_A || port == PORT_B) 2238 + if (intel_port_is_combophy(dev_priv, port)) 2239 2239 icl_get_combo_buf_trans(dev_priv, port, encoder->type, 2240 2240 &n_entries); 2241 2241 else ··· 2669 2669 u32 level, 2670 2670 enum intel_output_type type) 2671 2671 { 2672 + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 2672 2673 enum port port = encoder->port; 2673 2674 2674 - if (port == PORT_A || port == PORT_B) 2675 + if (intel_port_is_combophy(dev_priv, port)) 2675 2676 icl_combo_phy_ddi_vswing_sequence(encoder, level, type); 2676 2677 else 2677 2678 icl_mg_phy_ddi_vswing_sequence(encoder, link_clock, level); ··· 2733 2732 return DDI_BUF_TRANS_SELECT(level); 2734 2733 } 2735 2734 2735 + static inline 2736 + uint32_t icl_dpclka_cfgcr0_clk_off(struct drm_i915_private *dev_priv, 2737 + enum port port) 2738 + { 2739 + if (intel_port_is_combophy(dev_priv, port)) { 2740 + return ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(port); 2741 + } else if (intel_port_is_tc(dev_priv, port)) { 2742 + enum tc_port tc_port = intel_port_to_tc(dev_priv, port); 2743 + 2744 + return ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port); 2745 + } 2746 + 2747 + return 0; 2748 + } 2749 + 2736 2750 void icl_map_plls_to_ports(struct drm_crtc *crtc, 2737 2751 struct intel_crtc_state *crtc_state, 2738 2752 struct drm_atomic_state *old_state) ··· 2771 2755 mutex_lock(&dev_priv->dpll_lock); 2772 2756 2773 2757 val = I915_READ(DPCLKA_CFGCR0_ICL); 2774 - WARN_ON((val & DPCLKA_CFGCR0_DDI_CLK_OFF(port)) == 0); 2758 + WARN_ON((val & icl_dpclka_cfgcr0_clk_off(dev_priv, port)) == 0); 2775 2759 2776 - if (port == PORT_A || port == PORT_B) { 2760 + if (intel_port_is_combophy(dev_priv, port)) { 2777 2761 val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port); 2778 2762 val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port); 2779 2763 I915_WRITE(DPCLKA_CFGCR0_ICL, val); 2780 2764 POSTING_READ(DPCLKA_CFGCR0_ICL); 2781 2765 } 2782 2766 2783 - val &= ~DPCLKA_CFGCR0_DDI_CLK_OFF(port); 2767 + val &= ~icl_dpclka_cfgcr0_clk_off(dev_priv, port); 2784 2768 I915_WRITE(DPCLKA_CFGCR0_ICL, val); 2785 2769 2786 2770 mutex_unlock(&dev_priv->dpll_lock); ··· 2808 2792 mutex_lock(&dev_priv->dpll_lock); 2809 2793 I915_WRITE(DPCLKA_CFGCR0_ICL, 2810 2794 I915_READ(DPCLKA_CFGCR0_ICL) | 2811 - DPCLKA_CFGCR0_DDI_CLK_OFF(port)); 2795 + icl_dpclka_cfgcr0_clk_off(dev_priv, port)); 2812 2796 mutex_unlock(&dev_priv->dpll_lock); 2813 2797 } 2814 2798 } ··· 2826 2810 mutex_lock(&dev_priv->dpll_lock); 2827 2811 2828 2812 if (IS_ICELAKE(dev_priv)) { 2829 - if (port >= PORT_C) 2813 + if (!intel_port_is_combophy(dev_priv, port)) 2830 2814 I915_WRITE(DDI_CLK_SEL(port), 2831 2815 icl_pll_to_ddi_pll_sel(encoder, pll)); 2832 2816 } else if (IS_CANNONLAKE(dev_priv)) { ··· 2868 2852 enum port port = encoder->port; 2869 2853 2870 2854 if (IS_ICELAKE(dev_priv)) { 2871 - if (port >= PORT_C) 2855 + if (!intel_port_is_combophy(dev_priv, port)) 2872 2856 I915_WRITE(DDI_CLK_SEL(port), DDI_CLK_SEL_NONE); 2873 2857 } else if (IS_CANNONLAKE(dev_priv)) { 2874 2858 I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
+107 -44
drivers/gpu/drm/i915/intel_display.c
··· 2722 2722 if (size_aligned * 2 > dev_priv->stolen_usable_size) 2723 2723 return false; 2724 2724 2725 + switch (fb->modifier) { 2726 + case DRM_FORMAT_MOD_LINEAR: 2727 + case I915_FORMAT_MOD_X_TILED: 2728 + case I915_FORMAT_MOD_Y_TILED: 2729 + break; 2730 + default: 2731 + DRM_DEBUG_DRIVER("Unsupported modifier for initial FB: 0x%llx\n", 2732 + fb->modifier); 2733 + return false; 2734 + } 2735 + 2725 2736 mutex_lock(&dev->struct_mutex); 2726 2737 obj = i915_gem_object_create_stolen_for_preallocated(dev_priv, 2727 2738 base_aligned, ··· 2742 2731 if (!obj) 2743 2732 return false; 2744 2733 2745 - if (plane_config->tiling == I915_TILING_X) 2746 - obj->tiling_and_stride = fb->pitches[0] | I915_TILING_X; 2734 + switch (plane_config->tiling) { 2735 + case I915_TILING_NONE: 2736 + break; 2737 + case I915_TILING_X: 2738 + case I915_TILING_Y: 2739 + obj->tiling_and_stride = fb->pitches[0] | plane_config->tiling; 2740 + break; 2741 + default: 2742 + MISSING_CASE(plane_config->tiling); 2743 + return false; 2744 + } 2747 2745 2748 2746 mode_cmd.pixel_format = fb->format->format; 2749 2747 mode_cmd.width = fb->width; ··· 2784 2764 2785 2765 plane_state->base.visible = visible; 2786 2766 2787 - /* FIXME pre-g4x don't work like this */ 2788 - if (visible) { 2767 + if (visible) 2789 2768 crtc_state->base.plane_mask |= drm_plane_mask(&plane->base); 2790 - crtc_state->active_planes |= BIT(plane->id); 2791 - } else { 2769 + else 2792 2770 crtc_state->base.plane_mask &= ~drm_plane_mask(&plane->base); 2793 - crtc_state->active_planes &= ~BIT(plane->id); 2794 - } 2795 2771 2796 2772 DRM_DEBUG_KMS("%s active planes 0x%x\n", 2797 2773 crtc_state->base.crtc->name, 2798 2774 crtc_state->active_planes); 2775 + } 2776 + 2777 + static void fixup_active_planes(struct intel_crtc_state *crtc_state) 2778 + { 2779 + struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); 2780 + struct drm_plane *plane; 2781 + 2782 + /* 2783 + * Active_planes aliases if multiple "primary" or cursor planes 2784 + * have been used on the same (or wrong) pipe. plane_mask uses 2785 + * unique ids, hence we can use that to reconstruct active_planes. 2786 + */ 2787 + crtc_state->active_planes = 0; 2788 + 2789 + drm_for_each_plane_mask(plane, &dev_priv->drm, 2790 + crtc_state->base.plane_mask) 2791 + crtc_state->active_planes |= BIT(to_intel_plane(plane)->id); 2799 2792 } 2800 2793 2801 2794 static void intel_plane_disable_noatomic(struct intel_crtc *crtc, ··· 2820 2787 to_intel_plane_state(plane->base.state); 2821 2788 2822 2789 intel_set_plane_visible(crtc_state, plane_state, false); 2790 + fixup_active_planes(crtc_state); 2823 2791 2824 2792 if (plane->id == PLANE_PRIMARY) 2825 2793 intel_pre_disable_primary_noatomic(&crtc->base); ··· 2839 2805 struct drm_i915_gem_object *obj; 2840 2806 struct drm_plane *primary = intel_crtc->base.primary; 2841 2807 struct drm_plane_state *plane_state = primary->state; 2842 - struct drm_crtc_state *crtc_state = intel_crtc->base.state; 2843 2808 struct intel_plane *intel_plane = to_intel_plane(primary); 2844 2809 struct intel_plane_state *intel_state = 2845 2810 to_intel_plane_state(plane_state); ··· 2932 2899 2933 2900 plane_state->fb = fb; 2934 2901 plane_state->crtc = &intel_crtc->base; 2935 - 2936 - intel_set_plane_visible(to_intel_crtc_state(crtc_state), 2937 - to_intel_plane_state(plane_state), 2938 - true); 2939 2902 2940 2903 atomic_or(to_intel_plane(primary)->frontbuffer_bit, 2941 2904 &obj->frontbuffer_bits); ··· 3180 3151 plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation); 3181 3152 plane_state->color_plane[1].stride = intel_fb_pitch(fb, 1, rotation); 3182 3153 3154 + ret = intel_plane_check_stride(plane_state); 3155 + if (ret) 3156 + return ret; 3157 + 3183 3158 if (!plane_state->base.visible) 3184 3159 return 0; 3185 3160 ··· 3319 3286 int src_x = plane_state->base.src.x1 >> 16; 3320 3287 int src_y = plane_state->base.src.y1 >> 16; 3321 3288 u32 offset; 3289 + int ret; 3322 3290 3323 3291 intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation); 3324 3292 plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation); 3293 + 3294 + ret = intel_plane_check_stride(plane_state); 3295 + if (ret) 3296 + return ret; 3325 3297 3326 3298 intel_add_fb_offsets(&src_x, &src_y, plane_state, 0); 3327 3299 ··· 5959 5921 /* Border color in case we don't scale up to the full screen. Black by 5960 5922 * default, change to something else for debugging. */ 5961 5923 I915_WRITE(BCLRPAT(crtc->pipe), 0); 5924 + } 5925 + 5926 + bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port) 5927 + { 5928 + if (port == PORT_NONE) 5929 + return false; 5930 + 5931 + if (IS_ICELAKE(dev_priv)) 5932 + return port <= PORT_B; 5933 + 5934 + return false; 5962 5935 } 5963 5936 5964 5937 bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port) ··· 8896 8847 fb->modifier = I915_FORMAT_MOD_X_TILED; 8897 8848 break; 8898 8849 case PLANE_CTL_TILED_Y: 8850 + plane_config->tiling = I915_TILING_Y; 8899 8851 if (val & PLANE_CTL_RENDER_DECOMPRESSION_ENABLE) 8900 8852 fb->modifier = I915_FORMAT_MOD_Y_TILED_CCS; 8901 8853 else ··· 9733 9683 unsigned int rotation = plane_state->base.rotation; 9734 9684 int src_x, src_y; 9735 9685 u32 offset; 9686 + int ret; 9736 9687 9737 9688 intel_fill_fb_ggtt_view(&plane_state->view, fb, rotation); 9738 9689 plane_state->color_plane[0].stride = intel_fb_pitch(fb, 0, rotation); 9690 + 9691 + ret = intel_plane_check_stride(plane_state); 9692 + if (ret) 9693 + return ret; 9739 9694 9740 9695 src_x = plane_state->base.src_x >> 16; 9741 9696 src_y = plane_state->base.src_y >> 16; ··· 15491 15436 POSTING_READ(DPLL(pipe)); 15492 15437 } 15493 15438 15494 - static bool intel_plane_mapping_ok(struct intel_crtc *crtc, 15495 - struct intel_plane *plane) 15496 - { 15497 - enum pipe pipe; 15498 - 15499 - if (!plane->get_hw_state(plane, &pipe)) 15500 - return true; 15501 - 15502 - return pipe == crtc->pipe; 15503 - } 15504 - 15505 15439 static void 15506 15440 intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv) 15507 15441 { ··· 15502 15458 for_each_intel_crtc(&dev_priv->drm, crtc) { 15503 15459 struct intel_plane *plane = 15504 15460 to_intel_plane(crtc->base.primary); 15461 + struct intel_crtc *plane_crtc; 15462 + enum pipe pipe; 15505 15463 15506 - if (intel_plane_mapping_ok(crtc, plane)) 15464 + if (!plane->get_hw_state(plane, &pipe)) 15465 + continue; 15466 + 15467 + if (pipe == crtc->pipe) 15507 15468 continue; 15508 15469 15509 15470 DRM_DEBUG_KMS("%s attached to the wrong pipe, disabling plane\n", 15510 15471 plane->base.name); 15511 - intel_plane_disable_noatomic(crtc, plane); 15472 + 15473 + plane_crtc = intel_get_crtc_for_pipe(dev_priv, pipe); 15474 + intel_plane_disable_noatomic(plane_crtc, plane); 15512 15475 } 15513 15476 } 15514 15477 ··· 15563 15512 I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); 15564 15513 } 15565 15514 15566 - /* restore vblank interrupts to correct state */ 15567 - drm_crtc_vblank_reset(&crtc->base); 15568 15515 if (crtc->active) { 15569 15516 struct intel_plane *plane; 15570 - 15571 - drm_crtc_vblank_on(&crtc->base); 15572 15517 15573 15518 /* Disable everything but the primary plane */ 15574 15519 for_each_intel_plane_on_crtc(dev, crtc, plane) { ··· 15683 15636 } 15684 15637 15685 15638 /* FIXME read out full plane state for all planes */ 15686 - static void readout_plane_state(struct intel_crtc *crtc) 15639 + static void readout_plane_state(struct drm_i915_private *dev_priv) 15687 15640 { 15688 - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 15689 - struct intel_crtc_state *crtc_state = 15690 - to_intel_crtc_state(crtc->base.state); 15691 15641 struct intel_plane *plane; 15642 + struct intel_crtc *crtc; 15692 15643 15693 - for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) { 15644 + for_each_intel_plane(&dev_priv->drm, plane) { 15694 15645 struct intel_plane_state *plane_state = 15695 15646 to_intel_plane_state(plane->base.state); 15696 - enum pipe pipe; 15647 + struct intel_crtc_state *crtc_state; 15648 + enum pipe pipe = PIPE_A; 15697 15649 bool visible; 15698 15650 15699 15651 visible = plane->get_hw_state(plane, &pipe); 15700 15652 15653 + crtc = intel_get_crtc_for_pipe(dev_priv, pipe); 15654 + crtc_state = to_intel_crtc_state(crtc->base.state); 15655 + 15701 15656 intel_set_plane_visible(crtc_state, plane_state, visible); 15657 + } 15658 + 15659 + for_each_intel_crtc(&dev_priv->drm, crtc) { 15660 + struct intel_crtc_state *crtc_state = 15661 + to_intel_crtc_state(crtc->base.state); 15662 + 15663 + fixup_active_planes(crtc_state); 15702 15664 } 15703 15665 } 15704 15666 ··· 15740 15684 if (crtc_state->base.active) 15741 15685 dev_priv->active_crtcs |= 1 << crtc->pipe; 15742 15686 15743 - readout_plane_state(crtc); 15744 - 15745 15687 DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n", 15746 15688 crtc->base.base.id, crtc->base.name, 15747 15689 enableddisabled(crtc_state->base.active)); 15748 15690 } 15691 + 15692 + readout_plane_state(dev_priv); 15749 15693 15750 15694 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 15751 15695 struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; ··· 15916 15860 struct drm_modeset_acquire_ctx *ctx) 15917 15861 { 15918 15862 struct drm_i915_private *dev_priv = to_i915(dev); 15919 - enum pipe pipe; 15920 15863 struct intel_crtc *crtc; 15921 15864 struct intel_encoder *encoder; 15922 15865 int i; ··· 15928 15873 /* HW state is read out, now we need to sanitize this mess. */ 15929 15874 get_encoder_power_domains(dev_priv); 15930 15875 15931 - intel_sanitize_plane_mapping(dev_priv); 15876 + /* 15877 + * intel_sanitize_plane_mapping() may need to do vblank 15878 + * waits, so we need vblank interrupts restored beforehand. 15879 + */ 15880 + for_each_intel_crtc(&dev_priv->drm, crtc) { 15881 + drm_crtc_vblank_reset(&crtc->base); 15932 15882 15933 - for_each_intel_encoder(dev, encoder) { 15934 - intel_sanitize_encoder(encoder); 15883 + if (crtc->active) 15884 + drm_crtc_vblank_on(&crtc->base); 15935 15885 } 15936 15886 15937 - for_each_pipe(dev_priv, pipe) { 15938 - crtc = intel_get_crtc_for_pipe(dev_priv, pipe); 15887 + intel_sanitize_plane_mapping(dev_priv); 15939 15888 15889 + for_each_intel_encoder(dev, encoder) 15890 + intel_sanitize_encoder(encoder); 15891 + 15892 + for_each_intel_crtc(&dev_priv->drm, crtc) { 15940 15893 intel_sanitize_crtc(crtc, ctx); 15941 15894 intel_dump_pipe_config(crtc, crtc->config, 15942 15895 "[setup_hw_state]");
+31 -1
drivers/gpu/drm/i915/intel_dp.c
··· 557 557 return true; 558 558 } 559 559 560 + static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp, 561 + int link_rate, 562 + uint8_t lane_count) 563 + { 564 + const struct drm_display_mode *fixed_mode = 565 + intel_dp->attached_connector->panel.fixed_mode; 566 + int mode_rate, max_rate; 567 + 568 + mode_rate = intel_dp_link_required(fixed_mode->clock, 18); 569 + max_rate = intel_dp_max_data_rate(link_rate, lane_count); 570 + if (mode_rate > max_rate) 571 + return false; 572 + 573 + return true; 574 + } 575 + 560 576 int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, 561 577 int link_rate, uint8_t lane_count) 562 578 { ··· 582 566 intel_dp->num_common_rates, 583 567 link_rate); 584 568 if (index > 0) { 569 + if (intel_dp_is_edp(intel_dp) && 570 + !intel_dp_can_link_train_fallback_for_edp(intel_dp, 571 + intel_dp->common_rates[index - 1], 572 + lane_count)) { 573 + DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); 574 + return 0; 575 + } 585 576 intel_dp->max_link_rate = intel_dp->common_rates[index - 1]; 586 577 intel_dp->max_link_lane_count = lane_count; 587 578 } else if (lane_count > 1) { 579 + if (intel_dp_is_edp(intel_dp) && 580 + !intel_dp_can_link_train_fallback_for_edp(intel_dp, 581 + intel_dp_max_common_rate(intel_dp), 582 + lane_count >> 1)) { 583 + DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); 584 + return 0; 585 + } 588 586 intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); 589 587 intel_dp->max_link_lane_count = lane_count >> 1; 590 588 } else { ··· 3734 3704 uint32_t signal_levels, mask = 0; 3735 3705 uint8_t train_set = intel_dp->train_set[0]; 3736 3706 3737 - if (IS_GEN9_LP(dev_priv) || IS_CANNONLAKE(dev_priv)) { 3707 + if (IS_GEN9_LP(dev_priv) || INTEL_GEN(dev_priv) >= 10) { 3738 3708 signal_levels = bxt_signal_levels(intel_dp); 3739 3709 } else if (HAS_DDI(dev_priv)) { 3740 3710 signal_levels = ddi_signal_levels(intel_dp);
+20 -21
drivers/gpu/drm/i915/intel_dp_mst.c
··· 38 38 struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base); 39 39 struct intel_digital_port *intel_dig_port = intel_mst->primary; 40 40 struct intel_dp *intel_dp = &intel_dig_port->dp; 41 - struct intel_connector *connector = 42 - to_intel_connector(conn_state->connector); 41 + struct drm_connector *connector = conn_state->connector; 42 + void *port = to_intel_connector(connector)->port; 43 43 struct drm_atomic_state *state = pipe_config->base.state; 44 44 int bpp; 45 - int lane_count, slots; 45 + int lane_count, slots = 0; 46 46 const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; 47 47 int mst_pbn; 48 48 bool constant_n = drm_dp_has_quirk(&intel_dp->desc, ··· 70 70 71 71 pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); 72 72 73 - if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) 73 + if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, port)) 74 74 pipe_config->has_audio = true; 75 75 76 76 mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); 77 77 pipe_config->pbn = mst_pbn; 78 78 79 - slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, 80 - connector->port, mst_pbn); 81 - if (slots < 0) { 82 - DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); 83 - return false; 79 + /* Zombie connectors can't have VCPI slots */ 80 + if (READ_ONCE(connector->registered)) { 81 + slots = drm_dp_atomic_find_vcpi_slots(state, 82 + &intel_dp->mst_mgr, 83 + port, 84 + mst_pbn); 85 + if (slots < 0) { 86 + DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", 87 + slots); 88 + return false; 89 + } 84 90 } 85 91 86 92 intel_link_compute_m_n(bpp, lane_count, ··· 313 307 struct edid *edid; 314 308 int ret; 315 309 316 - if (!intel_dp) { 310 + if (!READ_ONCE(connector->registered)) 317 311 return intel_connector_update_modes(connector, NULL); 318 - } 319 312 320 313 edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); 321 314 ret = intel_connector_update_modes(connector, edid); ··· 329 324 struct intel_connector *intel_connector = to_intel_connector(connector); 330 325 struct intel_dp *intel_dp = intel_connector->mst_port; 331 326 332 - if (!intel_dp) 327 + if (!READ_ONCE(connector->registered)) 333 328 return connector_status_disconnected; 334 - return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port); 329 + return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, 330 + intel_connector->port); 335 331 } 336 332 337 333 static void ··· 372 366 int bpp = 24; /* MST uses fixed bpp */ 373 367 int max_rate, mode_rate, max_lanes, max_link_clock; 374 368 375 - if (!intel_dp) 369 + if (!READ_ONCE(connector->registered)) 376 370 return MODE_ERROR; 377 371 378 372 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) ··· 404 398 struct intel_dp *intel_dp = intel_connector->mst_port; 405 399 struct intel_crtc *crtc = to_intel_crtc(state->crtc); 406 400 407 - if (!intel_dp) 408 - return NULL; 409 401 return &intel_dp->mst_encoders[crtc->pipe]->base.base; 410 402 } 411 403 ··· 503 499 static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, 504 500 struct drm_connector *connector) 505 501 { 506 - struct intel_connector *intel_connector = to_intel_connector(connector); 507 502 struct drm_i915_private *dev_priv = to_i915(connector->dev); 508 503 509 504 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); ··· 511 508 if (dev_priv->fbdev) 512 509 drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, 513 510 connector); 514 - /* prevent race with the check in ->detect */ 515 - drm_modeset_lock(&connector->dev->mode_config.connection_mutex, NULL); 516 - intel_connector->mst_port = NULL; 517 - drm_modeset_unlock(&connector->dev->mode_config.connection_mutex); 518 511 519 512 drm_connector_put(connector); 520 513 }
+2
drivers/gpu/drm/i915/intel_drv.h
··· 1517 1517 struct intel_encoder *encoder); 1518 1518 struct drm_display_mode * 1519 1519 intel_encoder_current_mode(struct intel_encoder *encoder); 1520 + bool intel_port_is_combophy(struct drm_i915_private *dev_priv, enum port port); 1520 1521 bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port); 1521 1522 enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, 1522 1523 enum port port); ··· 2141 2140 unsigned int rotation); 2142 2141 int skl_plane_check(struct intel_crtc_state *crtc_state, 2143 2142 struct intel_plane_state *plane_state); 2143 + int intel_plane_check_stride(const struct intel_plane_state *plane_state); 2144 2144 int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state); 2145 2145 int chv_plane_check_rotation(const struct intel_plane_state *plane_state); 2146 2146
+22
drivers/gpu/drm/i915/intel_sprite.c
··· 230 230 #endif 231 231 } 232 232 233 + int intel_plane_check_stride(const struct intel_plane_state *plane_state) 234 + { 235 + struct intel_plane *plane = to_intel_plane(plane_state->base.plane); 236 + const struct drm_framebuffer *fb = plane_state->base.fb; 237 + unsigned int rotation = plane_state->base.rotation; 238 + u32 stride, max_stride; 239 + 240 + /* FIXME other color planes? */ 241 + stride = plane_state->color_plane[0].stride; 242 + max_stride = plane->max_stride(plane, fb->format->format, 243 + fb->modifier, rotation); 244 + 245 + if (stride > max_stride) { 246 + DRM_DEBUG_KMS("[FB:%d] stride (%d) exceeds [PLANE:%d:%s] max stride (%d)\n", 247 + fb->base.id, stride, 248 + plane->base.base.id, plane->base.name, max_stride); 249 + return -EINVAL; 250 + } 251 + 252 + return 0; 253 + } 254 + 233 255 int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state) 234 256 { 235 257 const struct drm_framebuffer *fb = plane_state->base.fb;
+3
drivers/gpu/drm/i915/selftests/i915_gem_object.c
··· 501 501 502 502 static void disable_retire_worker(struct drm_i915_private *i915) 503 503 { 504 + i915_gem_shrinker_unregister(i915); 505 + 504 506 mutex_lock(&i915->drm.struct_mutex); 505 507 if (!i915->gt.active_requests++) { 506 508 intel_runtime_pm_get(i915); ··· 615 613 else 616 614 queue_delayed_work(i915->wq, &i915->gt.idle_work, 0); 617 615 mutex_unlock(&i915->drm.struct_mutex); 616 + i915_gem_shrinker_register(i915); 618 617 return err; 619 618 err_obj: 620 619 i915_gem_object_put(obj);