@@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
16301630 struct drm_i915_gem_object * obj = to_intel_framebuffer (old_fb )-> obj ;
16311631
16321632 wait_event (dev_priv -> pending_flip_queue ,
1633+ atomic_read (& dev_priv -> mm .wedged ) ||
16331634 atomic_read (& obj -> pending_flip ) == 0 );
16341635
16351636 /* Big Hammer, we also need to ensure that any pending
16361637 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
16371638 * current scanout is retired before unpinning the old
16381639 * framebuffer.
1640+ *
1641+ * This should only fail upon a hung GPU, in which case we
1642+ * can safely continue.
16391643 */
16401644 ret = i915_gem_object_flush_gpu (obj , false);
1641- if (ret ) {
1642- i915_gem_object_unpin (to_intel_framebuffer (crtc -> fb )-> obj );
1643- mutex_unlock (& dev -> struct_mutex );
1644- return ret ;
1645- }
1645+ (void ) ret ;
16461646 }
16471647
16481648 ret = intel_pipe_set_base_atomic (crtc , crtc -> fb , x , y ,
@@ -2045,6 +2045,31 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
20452045 atomic_read (& obj -> pending_flip ) == 0 );
20462046}
20472047
2048+ static bool intel_crtc_driving_pch (struct drm_crtc * crtc )
2049+ {
2050+ struct drm_device * dev = crtc -> dev ;
2051+ struct drm_mode_config * mode_config = & dev -> mode_config ;
2052+ struct intel_encoder * encoder ;
2053+
2054+ /*
2055+ * If there's a non-PCH eDP on this crtc, it must be DP_A, and that
2056+ * must be driven by its own crtc; no sharing is possible.
2057+ */
2058+ list_for_each_entry (encoder , & mode_config -> encoder_list , base .head ) {
2059+ if (encoder -> base .crtc != crtc )
2060+ continue ;
2061+
2062+ switch (encoder -> type ) {
2063+ case INTEL_OUTPUT_EDP :
2064+ if (!intel_encoder_is_pch_edp (& encoder -> base ))
2065+ return false;
2066+ continue ;
2067+ }
2068+ }
2069+
2070+ return true;
2071+ }
2072+
20482073static void ironlake_crtc_enable (struct drm_crtc * crtc )
20492074{
20502075 struct drm_device * dev = crtc -> dev ;
@@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
20532078 int pipe = intel_crtc -> pipe ;
20542079 int plane = intel_crtc -> plane ;
20552080 u32 reg , temp ;
2081+ bool is_pch_port = false;
20562082
20572083 if (intel_crtc -> active )
20582084 return ;
@@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
20662092 I915_WRITE (PCH_LVDS , temp | LVDS_PORT_EN );
20672093 }
20682094
2069- ironlake_fdi_enable (crtc );
2095+ is_pch_port = intel_crtc_driving_pch (crtc );
2096+
2097+ if (is_pch_port )
2098+ ironlake_fdi_enable (crtc );
2099+ else {
2100+ /* disable CPU FDI tx and PCH FDI rx */
2101+ reg = FDI_TX_CTL (pipe );
2102+ temp = I915_READ (reg );
2103+ I915_WRITE (reg , temp & ~FDI_TX_ENABLE );
2104+ POSTING_READ (reg );
2105+
2106+ reg = FDI_RX_CTL (pipe );
2107+ temp = I915_READ (reg );
2108+ temp &= ~(0x7 << 16 );
2109+ temp |= (I915_READ (PIPECONF (pipe )) & PIPE_BPC_MASK ) << 11 ;
2110+ I915_WRITE (reg , temp & ~FDI_RX_ENABLE );
2111+
2112+ POSTING_READ (reg );
2113+ udelay (100 );
2114+
2115+ /* Ironlake workaround, disable clock pointer after downing FDI */
2116+ if (HAS_PCH_IBX (dev ))
2117+ I915_WRITE (FDI_RX_CHICKEN (pipe ),
2118+ I915_READ (FDI_RX_CHICKEN (pipe ) &
2119+ ~FDI_RX_PHASE_SYNC_POINTER_ENABLE ));
2120+
2121+ /* still set train pattern 1 */
2122+ reg = FDI_TX_CTL (pipe );
2123+ temp = I915_READ (reg );
2124+ temp &= ~FDI_LINK_TRAIN_NONE ;
2125+ temp |= FDI_LINK_TRAIN_PATTERN_1 ;
2126+ I915_WRITE (reg , temp );
2127+
2128+ reg = FDI_RX_CTL (pipe );
2129+ temp = I915_READ (reg );
2130+ if (HAS_PCH_CPT (dev )) {
2131+ temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT ;
2132+ temp |= FDI_LINK_TRAIN_PATTERN_1_CPT ;
2133+ } else {
2134+ temp &= ~FDI_LINK_TRAIN_NONE ;
2135+ temp |= FDI_LINK_TRAIN_PATTERN_1 ;
2136+ }
2137+ /* BPC in FDI rx is consistent with that in PIPECONF */
2138+ temp &= ~(0x07 << 16 );
2139+ temp |= (I915_READ (PIPECONF (pipe )) & PIPE_BPC_MASK ) << 11 ;
2140+ I915_WRITE (reg , temp );
2141+
2142+ POSTING_READ (reg );
2143+ udelay (100 );
2144+ }
20702145
20712146 /* Enable panel fitting for LVDS */
20722147 if (dev_priv -> pch_pf_size &&
@@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
21002175 intel_flush_display_plane (dev , plane );
21012176 }
21022177
2178+ /* Skip the PCH stuff if possible */
2179+ if (!is_pch_port )
2180+ goto done ;
2181+
21032182 /* For PCH output, training FDI link */
21042183 if (IS_GEN6 (dev ))
21052184 gen6_fdi_link_train (crtc );
@@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
21842263 I915_WRITE (reg , temp | TRANS_ENABLE );
21852264 if (wait_for (I915_READ (reg ) & TRANS_STATE_ENABLE , 100 ))
21862265 DRM_ERROR ("failed to enable transcoder %d\n" , pipe );
2187-
2266+ done :
21882267 intel_crtc_load_lut (crtc );
21892268 intel_update_fbc (dev );
21902269 intel_crtc_update_cursor (crtc , true);
@@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev)
64966575 POSTING_READ (RSTDBYCTL );
64976576 }
64986577
6499- ironlake_disable_rc6 (dev );
6578+ ironlake_teardown_rc6 (dev );
65006579}
65016580
65026581static int ironlake_setup_rc6 (struct drm_device * dev )
0 commit comments