Rev 2340 | Rev 2344 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2340 | Rev 2342 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | //#include |
29 | //#include |
30 | #include |
30 | #include |
31 | #include |
31 | #include |
32 | #include |
32 | #include |
33 | //#include |
33 | //#include |
- | 34 | #include |
|
34 | #include "drmP.h" |
35 | #include "drmP.h" |
35 | #include "intel_drv.h" |
36 | #include "intel_drv.h" |
36 | #include "i915_drm.h" |
37 | #include "i915_drm.h" |
37 | #include "i915_drv.h" |
38 | #include "i915_drv.h" |
38 | //#include "i915_trace.h" |
39 | //#include "i915_trace.h" |
Line 831... | Line 832... | ||
831 | { |
832 | { |
832 | int reg; |
833 | int reg; |
833 | u32 val; |
834 | u32 val; |
834 | bool cur_state; |
835 | bool cur_state; |
Line -... | Line 836... | ||
- | 836 | ||
- | 837 | if (HAS_PCH_CPT(dev_priv->dev)) { |
|
- | 838 | u32 pch_dpll; |
|
- | 839 | ||
- | 840 | pch_dpll = I915_READ(PCH_DPLL_SEL); |
|
- | 841 | ||
- | 842 | /* Make sure the selected PLL is enabled to the transcoder */ |
|
- | 843 | WARN(!((pch_dpll >> (4 * pipe)) & 8), |
|
- | 844 | "transcoder %d PLL not enabled\n", pipe); |
|
- | 845 | ||
- | 846 | /* Convert the transcoder pipe number to a pll pipe number */ |
|
- | 847 | pipe = (pch_dpll >> (4 * pipe)) & 1; |
|
- | 848 | } |
|
835 | 849 | ||
836 | reg = PCH_DPLL(pipe); |
850 | reg = PCH_DPLL(pipe); |
837 | val = I915_READ(reg); |
851 | val = I915_READ(reg); |
838 | cur_state = !!(val & DPLL_VCO_ENABLE); |
852 | cur_state = !!(val & DPLL_VCO_ENABLE); |
839 | WARN(cur_state != state, |
853 | WARN(cur_state != state, |
Line 930... | Line 944... | ||
930 | WARN(panel_pipe == pipe && locked, |
944 | WARN(panel_pipe == pipe && locked, |
931 | "panel assertion failure, pipe %c regs locked\n", |
945 | "panel assertion failure, pipe %c regs locked\n", |
932 | pipe_name(pipe)); |
946 | pipe_name(pipe)); |
933 | } |
947 | } |
Line 934... | Line 948... | ||
934 | 948 | ||
935 | static void assert_pipe(struct drm_i915_private *dev_priv, |
949 | void assert_pipe(struct drm_i915_private *dev_priv, |
936 | enum pipe pipe, bool state) |
950 | enum pipe pipe, bool state) |
937 | { |
951 | { |
938 | int reg; |
952 | int reg; |
939 | u32 val; |
953 | u32 val; |
Line 944... | Line 958... | ||
944 | cur_state = !!(val & PIPECONF_ENABLE); |
958 | cur_state = !!(val & PIPECONF_ENABLE); |
945 | WARN(cur_state != state, |
959 | WARN(cur_state != state, |
946 | "pipe %c assertion failure (expected %s, current %s)\n", |
960 | "pipe %c assertion failure (expected %s, current %s)\n", |
947 | pipe_name(pipe), state_string(state), state_string(cur_state)); |
961 | pipe_name(pipe), state_string(state), state_string(cur_state)); |
948 | } |
962 | } |
949 | #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) |
- | |
950 | #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) |
- | |
Line 951... | Line 963... | ||
951 | 963 | ||
952 | static void assert_plane_enabled(struct drm_i915_private *dev_priv, |
964 | static void assert_plane_enabled(struct drm_i915_private *dev_priv, |
953 | enum plane plane) |
965 | enum plane plane) |
954 | { |
966 | { |
Line 1200... | Line 1212... | ||
1200 | enum pipe pipe) |
1212 | enum pipe pipe) |
1201 | { |
1213 | { |
1202 | int reg; |
1214 | int reg; |
1203 | u32 val; |
1215 | u32 val; |
Line -... | Line 1216... | ||
- | 1216 | ||
- | 1217 | if (pipe > 1) |
|
- | 1218 | return; |
|
1204 | 1219 | ||
1205 | /* PCH only available on ILK+ */ |
1220 | /* PCH only available on ILK+ */ |
Line 1206... | Line 1221... | ||
1206 | BUG_ON(dev_priv->info->gen < 5); |
1221 | BUG_ON(dev_priv->info->gen < 5); |
1207 | 1222 | ||
Line 1218... | Line 1233... | ||
1218 | 1233 | ||
1219 | static void intel_disable_pch_pll(struct drm_i915_private *dev_priv, |
1234 | static void intel_disable_pch_pll(struct drm_i915_private *dev_priv, |
1220 | enum pipe pipe) |
1235 | enum pipe pipe) |
1221 | { |
1236 | { |
- | 1237 | int reg; |
|
- | 1238 | u32 val, pll_mask = TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL, |
|
- | 1239 | pll_sel = TRANSC_DPLL_ENABLE; |
|
- | 1240 | ||
1222 | int reg; |
1241 | if (pipe > 1) |
Line 1223... | Line 1242... | ||
1223 | u32 val; |
1242 | return; |
1224 | 1243 | ||
Line 1225... | Line 1244... | ||
1225 | /* PCH only available on ILK+ */ |
1244 | /* PCH only available on ILK+ */ |
1226 | BUG_ON(dev_priv->info->gen < 5); |
1245 | BUG_ON(dev_priv->info->gen < 5); |
Line -... | Line 1246... | ||
- | 1246 | ||
- | 1247 | /* Make sure transcoder isn't still depending on us */ |
|
- | 1248 | assert_transcoder_disabled(dev_priv, pipe); |
|
- | 1249 | ||
- | 1250 | if (pipe == 0) |
|
- | 1251 | pll_sel |= TRANSC_DPLLA_SEL; |
|
- | 1252 | else if (pipe == 1) |
|
- | 1253 | pll_sel |= TRANSC_DPLLB_SEL; |
|
- | 1254 | ||
1227 | 1255 | ||
1228 | /* Make sure transcoder isn't still depending on us */ |
1256 | if ((I915_READ(PCH_DPLL_SEL) & pll_mask) == pll_sel) |
1229 | assert_transcoder_disabled(dev_priv, pipe); |
1257 | return; |
1230 | 1258 | ||
1231 | reg = PCH_DPLL(pipe); |
1259 | reg = PCH_DPLL(pipe); |
Line 1285... | Line 1313... | ||
1285 | val = I915_READ(reg); |
1313 | val = I915_READ(reg); |
1286 | val &= ~TRANS_ENABLE; |
1314 | val &= ~TRANS_ENABLE; |
1287 | I915_WRITE(reg, val); |
1315 | I915_WRITE(reg, val); |
1288 | /* wait for PCH transcoder off, transcoder state */ |
1316 | /* wait for PCH transcoder off, transcoder state */ |
1289 | if (wait_for((I915_READ(reg) & TRANS_STATE_ENABLE) == 0, 50)) |
1317 | if (wait_for((I915_READ(reg) & TRANS_STATE_ENABLE) == 0, 50)) |
1290 | DRM_ERROR("failed to disable transcoder\n"); |
1318 | DRM_ERROR("failed to disable transcoder %d\n", pipe); |
1291 | } |
1319 | } |
Line 1292... | Line 1320... | ||
1292 | 1320 | ||
1293 | /** |
1321 | /** |
1294 | * intel_enable_pipe - enable a pipe, asserting requirements |
1322 | * intel_enable_pipe - enable a pipe, asserting requirements |
Line 1520... | Line 1548... | ||
1520 | int cfb_pitch; |
1548 | int cfb_pitch; |
1521 | int plane, i; |
1549 | int plane, i; |
1522 | u32 fbc_ctl, fbc_ctl2; |
1550 | u32 fbc_ctl, fbc_ctl2; |
Line 1523... | Line 1551... | ||
1523 | 1551 | ||
1524 | cfb_pitch = dev_priv->cfb_size / FBC_LL_SIZE; |
1552 | cfb_pitch = dev_priv->cfb_size / FBC_LL_SIZE; |
1525 | if (fb->pitch < cfb_pitch) |
1553 | if (fb->pitches[0] < cfb_pitch) |
Line 1526... | Line 1554... | ||
1526 | cfb_pitch = fb->pitch; |
1554 | cfb_pitch = fb->pitches[0]; |
1527 | 1555 | ||
1528 | /* FBC_CTL wants 64B units */ |
1556 | /* FBC_CTL wants 64B units */ |
Line 1785... | Line 1813... | ||
1785 | struct drm_crtc *crtc = NULL, *tmp_crtc; |
1813 | struct drm_crtc *crtc = NULL, *tmp_crtc; |
1786 | struct intel_crtc *intel_crtc; |
1814 | struct intel_crtc *intel_crtc; |
1787 | struct drm_framebuffer *fb; |
1815 | struct drm_framebuffer *fb; |
1788 | struct intel_framebuffer *intel_fb; |
1816 | struct intel_framebuffer *intel_fb; |
1789 | struct drm_i915_gem_object *obj; |
1817 | struct drm_i915_gem_object *obj; |
- | 1818 | int enable_fbc; |
|
Line 1790... | Line 1819... | ||
1790 | 1819 | ||
Line 1791... | Line 1820... | ||
1791 | DRM_DEBUG_KMS("\n"); |
1820 | DRM_DEBUG_KMS("\n"); |
1792 | 1821 | ||
Line 1825... | Line 1854... | ||
1825 | intel_crtc = to_intel_crtc(crtc); |
1854 | intel_crtc = to_intel_crtc(crtc); |
1826 | fb = crtc->fb; |
1855 | fb = crtc->fb; |
1827 | intel_fb = to_intel_framebuffer(fb); |
1856 | intel_fb = to_intel_framebuffer(fb); |
1828 | obj = intel_fb->obj; |
1857 | obj = intel_fb->obj; |
Line -... | Line 1858... | ||
- | 1858 | ||
- | 1859 | enable_fbc = i915_enable_fbc; |
|
- | 1860 | if (enable_fbc < 0) { |
|
- | 1861 | DRM_DEBUG_KMS("fbc set to per-chip default\n"); |
|
- | 1862 | enable_fbc = 1; |
|
- | 1863 | if (INTEL_INFO(dev)->gen <= 5) |
|
- | 1864 | enable_fbc = 0; |
|
1829 | 1865 | } |
|
1830 | if (!i915_enable_fbc) { |
1866 | if (!enable_fbc) { |
1831 | DRM_DEBUG_KMS("fbc disabled per module param (default off)\n"); |
1867 | DRM_DEBUG_KMS("fbc disabled per module param\n"); |
1832 | dev_priv->no_fbc_reason = FBC_MODULE_PARAM; |
1868 | dev_priv->no_fbc_reason = FBC_MODULE_PARAM; |
1833 | goto out_disable; |
1869 | goto out_disable; |
1834 | } |
1870 | } |
1835 | if (intel_fb->obj->base.size > dev_priv->cfb_size) { |
1871 | if (intel_fb->obj->base.size > dev_priv->cfb_size) { |
Line 2031... | Line 2067... | ||
2031 | } |
2067 | } |
Line 2032... | Line 2068... | ||
2032 | 2068 | ||
Line 2033... | Line 2069... | ||
2033 | I915_WRITE(reg, dspcntr); |
2069 | I915_WRITE(reg, dspcntr); |
2034 | 2070 | ||
Line 2035... | Line 2071... | ||
2035 | Start = obj->gtt_offset; |
2071 | Start = obj->gtt_offset; |
2036 | Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8); |
2072 | Offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); |
2037 | 2073 | ||
2038 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
2074 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
2039 | Start, Offset, x, y, fb->pitch); |
2075 | Start, Offset, x, y, fb->pitches[0]); |
2040 | I915_WRITE(DSPSTRIDE(plane), fb->pitch); |
2076 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
2041 | if (INTEL_INFO(dev)->gen >= 4) { |
2077 | if (INTEL_INFO(dev)->gen >= 4) { |
2042 | I915_WRITE(DSPSURF(plane), Start); |
2078 | I915_WRITE(DSPSURF(plane), Start); |
Line 2063... | Line 2099... | ||
2063 | u32 reg; |
2099 | u32 reg; |
Line 2064... | Line 2100... | ||
2064 | 2100 | ||
2065 | switch (plane) { |
2101 | switch (plane) { |
2066 | case 0: |
2102 | case 0: |
- | 2103 | case 1: |
|
2067 | case 1: |
2104 | case 2: |
2068 | break; |
2105 | break; |
2069 | default: |
2106 | default: |
2070 | DRM_ERROR("Can't update plane %d in SAREA\n", plane); |
2107 | DRM_ERROR("Can't update plane %d in SAREA\n", plane); |
2071 | return -EINVAL; |
2108 | return -EINVAL; |
Line 2111... | Line 2148... | ||
2111 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
2148 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
Line 2112... | Line 2149... | ||
2112 | 2149 | ||
Line 2113... | Line 2150... | ||
2113 | I915_WRITE(reg, dspcntr); |
2150 | I915_WRITE(reg, dspcntr); |
2114 | 2151 | ||
Line 2115... | Line 2152... | ||
2115 | Start = obj->gtt_offset; |
2152 | Start = obj->gtt_offset; |
2116 | Offset = y * fb->pitch + x * (fb->bits_per_pixel / 8); |
2153 | Offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); |
2117 | 2154 | ||
2118 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
2155 | DRM_DEBUG_KMS("Writing base %08lX %08lX %d %d %d\n", |
2119 | Start, Offset, x, y, fb->pitch); |
2156 | Start, Offset, x, y, fb->pitches[0]); |
2120 | I915_WRITE(DSPSTRIDE(plane), fb->pitch); |
2157 | I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); |
2121 | I915_WRITE(DSPSURF(plane), Start); |
2158 | I915_WRITE(DSPSURF(plane), Start); |
Line 2156... | Line 2193... | ||
2156 | struct drm_framebuffer *old_fb) |
2193 | struct drm_framebuffer *old_fb) |
2157 | { |
2194 | { |
2158 | struct drm_device *dev = crtc->dev; |
2195 | struct drm_device *dev = crtc->dev; |
2159 | struct drm_i915_master_private *master_priv; |
2196 | struct drm_i915_master_private *master_priv; |
2160 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2197 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2161 | int ret = 0; |
2198 | int ret; |
Line 2162... | Line 2199... | ||
2162 | 2199 | ||
Line 2163... | Line 2200... | ||
2163 | ENTER(); |
2200 | ENTER(); |
2164 | 2201 | ||
Line 2170... | Line 2207... | ||
2170 | 2207 | ||
2171 | switch (intel_crtc->plane) { |
2208 | switch (intel_crtc->plane) { |
2172 | case 0: |
2209 | case 0: |
2173 | case 1: |
2210 | case 1: |
- | 2211 | break; |
|
- | 2212 | case 2: |
|
- | 2213 | if (IS_IVYBRIDGE(dev)) |
|
- | 2214 | break; |
|
2174 | break; |
2215 | /* fall through otherwise */ |
2175 | default: |
2216 | default: |
2176 | DRM_ERROR("no plane for crtc\n"); |
2217 | DRM_ERROR("no plane for crtc\n"); |
2177 | return -EINVAL; |
2218 | return -EINVAL; |
Line 2568... | Line 2609... | ||
2568 | temp |= (intel_crtc->fdi_lanes - 1) << 19; |
2609 | temp |= (intel_crtc->fdi_lanes - 1) << 19; |
2569 | temp &= ~(FDI_LINK_TRAIN_AUTO | FDI_LINK_TRAIN_NONE_IVB); |
2610 | temp &= ~(FDI_LINK_TRAIN_AUTO | FDI_LINK_TRAIN_NONE_IVB); |
2570 | temp |= FDI_LINK_TRAIN_PATTERN_1_IVB; |
2611 | temp |= FDI_LINK_TRAIN_PATTERN_1_IVB; |
2571 | temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; |
2612 | temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; |
2572 | temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B; |
2613 | temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B; |
- | 2614 | temp |= FDI_COMPOSITE_SYNC; |
|
2573 | I915_WRITE(reg, temp | FDI_TX_ENABLE); |
2615 | I915_WRITE(reg, temp | FDI_TX_ENABLE); |
Line 2574... | Line 2616... | ||
2574 | 2616 | ||
2575 | reg = FDI_RX_CTL(pipe); |
2617 | reg = FDI_RX_CTL(pipe); |
2576 | temp = I915_READ(reg); |
2618 | temp = I915_READ(reg); |
2577 | temp &= ~FDI_LINK_TRAIN_AUTO; |
2619 | temp &= ~FDI_LINK_TRAIN_AUTO; |
2578 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; |
2620 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; |
- | 2621 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; |
|
2579 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; |
2622 | temp |= FDI_COMPOSITE_SYNC; |
Line 2580... | Line 2623... | ||
2580 | I915_WRITE(reg, temp | FDI_RX_ENABLE); |
2623 | I915_WRITE(reg, temp | FDI_RX_ENABLE); |
2581 | 2624 | ||
Line 2834... | Line 2877... | ||
2834 | { |
2877 | { |
2835 | struct drm_device *dev = crtc->dev; |
2878 | struct drm_device *dev = crtc->dev; |
2836 | struct drm_i915_private *dev_priv = dev->dev_private; |
2879 | struct drm_i915_private *dev_priv = dev->dev_private; |
2837 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2880 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2838 | int pipe = intel_crtc->pipe; |
2881 | int pipe = intel_crtc->pipe; |
2839 | u32 reg, temp; |
2882 | u32 reg, temp, transc_sel; |
Line 2840... | Line 2883... | ||
2840 | 2883 | ||
2841 | /* For PCH output, training FDI link */ |
2884 | /* For PCH output, training FDI link */ |
Line 2842... | Line 2885... | ||
2842 | dev_priv->display.fdi_link_train(crtc); |
2885 | dev_priv->display.fdi_link_train(crtc); |
Line 2843... | Line 2886... | ||
2843 | 2886 | ||
- | 2887 | intel_enable_pch_pll(dev_priv, pipe); |
|
- | 2888 | ||
- | 2889 | if (HAS_PCH_CPT(dev)) { |
|
2844 | intel_enable_pch_pll(dev_priv, pipe); |
2890 | transc_sel = intel_crtc->use_pll_a ? TRANSC_DPLLA_SEL : |
2845 | 2891 | TRANSC_DPLLB_SEL; |
|
- | 2892 | ||
2846 | if (HAS_PCH_CPT(dev)) { |
2893 | /* Be sure PCH DPLL SEL is set */ |
2847 | /* Be sure PCH DPLL SEL is set */ |
2894 | temp = I915_READ(PCH_DPLL_SEL); |
- | 2895 | if (pipe == 0) { |
|
2848 | temp = I915_READ(PCH_DPLL_SEL); |
2896 | temp &= ~(TRANSA_DPLLB_SEL); |
2849 | if (pipe == 0 && (temp & TRANSA_DPLL_ENABLE) == 0) |
2897 | temp |= (TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL); |
- | 2898 | } else if (pipe == 1) { |
|
- | 2899 | temp &= ~(TRANSB_DPLLB_SEL); |
|
- | 2900 | temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL); |
|
- | 2901 | } else if (pipe == 2) { |
|
2850 | temp |= (TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL); |
2902 | temp &= ~(TRANSC_DPLLB_SEL); |
2851 | else if (pipe == 1 && (temp & TRANSB_DPLL_ENABLE) == 0) |
2903 | temp |= (TRANSC_DPLL_ENABLE | transc_sel); |
Line 2852... | Line 2904... | ||
2852 | temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL); |
2904 | } |
2853 | I915_WRITE(PCH_DPLL_SEL, temp); |
2905 | I915_WRITE(PCH_DPLL_SEL, temp); |
Line 2865... | Line 2917... | ||
2865 | 2917 | ||
Line 2866... | Line 2918... | ||
2866 | intel_fdi_normal_train(crtc); |
2918 | intel_fdi_normal_train(crtc); |
2867 | 2919 | ||
2868 | /* For PCH DP, enable TRANS_DP_CTL */ |
2920 | /* For PCH DP, enable TRANS_DP_CTL */ |
- | 2921 | if (HAS_PCH_CPT(dev) && |
|
2869 | if (HAS_PCH_CPT(dev) && |
2922 | (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || |
2870 | intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { |
2923 | intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { |
2871 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; |
2924 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5; |
2872 | reg = TRANS_DP_CTL(pipe); |
2925 | reg = TRANS_DP_CTL(pipe); |
2873 | temp = I915_READ(reg); |
2926 | temp = I915_READ(reg); |
Line 2903... | Line 2956... | ||
2903 | } |
2956 | } |
Line 2904... | Line 2957... | ||
2904 | 2957 | ||
2905 | intel_enable_transcoder(dev_priv, pipe); |
2958 | intel_enable_transcoder(dev_priv, pipe); |
Line -... | Line 2959... | ||
- | 2959 | } |
|
- | 2960 | ||
- | 2961 | void intel_cpt_verify_modeset(struct drm_device *dev, int pipe) |
|
- | 2962 | { |
|
- | 2963 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 2964 | int dslreg = PIPEDSL(pipe), tc2reg = TRANS_CHICKEN2(pipe); |
|
- | 2965 | u32 temp; |
|
- | 2966 | ||
- | 2967 | temp = I915_READ(dslreg); |
|
- | 2968 | udelay(500); |
|
- | 2969 | if (wait_for(I915_READ(dslreg) != temp, 5)) { |
|
- | 2970 | /* Without this, mode sets may fail silently on FDI */ |
|
- | 2971 | I915_WRITE(tc2reg, TRANS_AUTOTRAIN_GEN_STALL_DIS); |
|
- | 2972 | udelay(250); |
|
- | 2973 | I915_WRITE(tc2reg, 0); |
|
- | 2974 | if (wait_for(I915_READ(dslreg) != temp, 5)) |
|
- | 2975 | DRM_ERROR("mode set failed: pipe %d stuck\n", pipe); |
|
- | 2976 | } |
|
2906 | } |
2977 | } |
2907 | 2978 | ||
2908 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
2979 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
2909 | { |
2980 | { |
2910 | struct drm_device *dev = crtc->dev; |
2981 | struct drm_device *dev = crtc->dev; |
Line 3015... | Line 3086... | ||
3015 | 3086 | ||
3016 | /* disable DPLL_SEL */ |
3087 | /* disable DPLL_SEL */ |
3017 | temp = I915_READ(PCH_DPLL_SEL); |
3088 | temp = I915_READ(PCH_DPLL_SEL); |
3018 | switch (pipe) { |
3089 | switch (pipe) { |
3019 | case 0: |
3090 | case 0: |
3020 | temp &= ~(TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL); |
3091 | temp &= ~(TRANSA_DPLL_ENABLE | TRANSA_DPLLB_SEL); |
3021 | break; |
3092 | break; |
3022 | case 1: |
3093 | case 1: |
3023 | temp &= ~(TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL); |
3094 | temp &= ~(TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL); |
3024 | break; |
3095 | break; |
3025 | case 2: |
3096 | case 2: |
3026 | /* FIXME: manage transcoder PLLs? */ |
3097 | /* C shares PLL A or B */ |
3027 | temp &= ~(TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL); |
3098 | temp &= ~(TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL); |
3028 | break; |
3099 | break; |
3029 | default: |
3100 | default: |
3030 | BUG(); /* wtf */ |
3101 | BUG(); /* wtf */ |
3031 | } |
3102 | } |
3032 | I915_WRITE(PCH_DPLL_SEL, temp); |
3103 | I915_WRITE(PCH_DPLL_SEL, temp); |
Line 3033... | Line 3104... | ||
3033 | } |
3104 | } |
- | 3105 | ||
3034 | 3106 | /* disable PCH DPLL */ |
|
Line 3035... | Line 3107... | ||
3035 | /* disable PCH DPLL */ |
3107 | if (!intel_crtc->no_pll) |
3036 | intel_disable_pch_pll(dev_priv, pipe); |
3108 | intel_disable_pch_pll(dev_priv, pipe); |
3037 | 3109 | ||
Line 3279... | Line 3351... | ||
3279 | } |
3351 | } |
Line 3280... | Line 3352... | ||
3280 | 3352 | ||
3281 | void intel_encoder_commit (struct drm_encoder *encoder) |
3353 | void intel_encoder_commit(struct drm_encoder *encoder) |
3282 | { |
3354 | { |
- | 3355 | struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; |
|
- | 3356 | struct drm_device *dev = encoder->dev; |
|
- | 3357 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); |
|
- | 3358 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc); |
|
3283 | struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; |
3359 | |
3284 | /* lvds has its own version of commit see intel_lvds_commit */ |
3360 | /* lvds has its own version of commit see intel_lvds_commit */ |
- | 3361 | encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); |
|
- | 3362 | ||
- | 3363 | if (HAS_PCH_CPT(dev)) |
|
3285 | encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); |
3364 | intel_cpt_verify_modeset(dev, intel_crtc->pipe); |
Line 3286... | Line 3365... | ||
3286 | } |
3365 | } |
3287 | 3366 | ||
3288 | void intel_encoder_destroy(struct drm_encoder *encoder) |
3367 | void intel_encoder_destroy(struct drm_encoder *encoder) |
Line 4422... | Line 4501... | ||
4422 | * WM3 is unsupported on ILK, probably because we don't have latency |
4501 | * WM3 is unsupported on ILK, probably because we don't have latency |
4423 | * data for that power state |
4502 | * data for that power state |
4424 | */ |
4503 | */ |
4425 | } |
4504 | } |
Line 4426... | Line 4505... | ||
4426 | 4505 | ||
4427 | static void sandybridge_update_wm(struct drm_device *dev) |
4506 | void sandybridge_update_wm(struct drm_device *dev) |
4428 | { |
4507 | { |
4429 | struct drm_i915_private *dev_priv = dev->dev_private; |
4508 | struct drm_i915_private *dev_priv = dev->dev_private; |
4430 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ |
4509 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ |
4431 | int fbc_wm, plane_wm, cursor_wm; |
4510 | int fbc_wm, plane_wm, cursor_wm; |
Line 4456... | Line 4535... | ||
4456 | " plane %d, cursor: %d\n", |
4535 | " plane %d, cursor: %d\n", |
4457 | plane_wm, cursor_wm); |
4536 | plane_wm, cursor_wm); |
4458 | enabled |= 2; |
4537 | enabled |= 2; |
4459 | } |
4538 | } |
Line -... | Line 4539... | ||
- | 4539 | ||
- | 4540 | /* IVB has 3 pipes */ |
|
- | 4541 | if (IS_IVYBRIDGE(dev) && |
|
- | 4542 | g4x_compute_wm0(dev, 2, |
|
- | 4543 | &sandybridge_display_wm_info, latency, |
|
- | 4544 | &sandybridge_cursor_wm_info, latency, |
|
- | 4545 | &plane_wm, &cursor_wm)) { |
|
- | 4546 | I915_WRITE(WM0_PIPEC_IVB, |
|
- | 4547 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
|
- | 4548 | DRM_DEBUG_KMS("FIFO watermarks For pipe C -" |
|
- | 4549 | " plane %d, cursor: %d\n", |
|
- | 4550 | plane_wm, cursor_wm); |
|
- | 4551 | enabled |= 3; |
|
- | 4552 | } |
|
4460 | 4553 | ||
4461 | /* |
4554 | /* |
4462 | * Calculate and update the self-refresh watermark only when one |
4555 | * Calculate and update the self-refresh watermark only when one |
4463 | * display plane is used. |
4556 | * display plane is used. |
4464 | * |
4557 | * |
Line 4470... | Line 4563... | ||
4470 | */ |
4563 | */ |
4471 | I915_WRITE(WM3_LP_ILK, 0); |
4564 | I915_WRITE(WM3_LP_ILK, 0); |
4472 | I915_WRITE(WM2_LP_ILK, 0); |
4565 | I915_WRITE(WM2_LP_ILK, 0); |
4473 | I915_WRITE(WM1_LP_ILK, 0); |
4566 | I915_WRITE(WM1_LP_ILK, 0); |
Line 4474... | Line 4567... | ||
4474 | 4567 | ||
4475 | if (!single_plane_enabled(enabled)) |
- | |
4476 | { |
4568 | if (!single_plane_enabled(enabled) || |
4477 | LEAVE(); |
4569 | dev_priv->sprite_scaling_enabled) |
4478 | return; |
- | |
4479 | }; |
- | |
4480 | 4570 | return; |
|
Line 4481... | Line -... | ||
4481 | enabled = ffs(enabled) - 1; |
- | |
4482 | - | ||
4483 | dbgprintf("compute wm1\n"); |
4571 | enabled = ffs(enabled) - 1; |
4484 | 4572 | ||
4485 | /* WM1 */ |
4573 | /* WM1 */ |
4486 | if (!ironlake_compute_srwm(dev, 1, enabled, |
4574 | if (!ironlake_compute_srwm(dev, 1, enabled, |
4487 | SNB_READ_WM1_LATENCY() * 500, |
4575 | SNB_READ_WM1_LATENCY() * 500, |
Line 4495... | Line 4583... | ||
4495 | (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4583 | (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4496 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4584 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4497 | (plane_wm << WM1_LP_SR_SHIFT) | |
4585 | (plane_wm << WM1_LP_SR_SHIFT) | |
4498 | cursor_wm); |
4586 | cursor_wm); |
Line 4499... | Line -... | ||
4499 | - | ||
4500 | dbgprintf("compute wm2\n"); |
- | |
4501 | 4587 | ||
4502 | /* WM2 */ |
4588 | /* WM2 */ |
4503 | if (!ironlake_compute_srwm(dev, 2, enabled, |
4589 | if (!ironlake_compute_srwm(dev, 2, enabled, |
4504 | SNB_READ_WM2_LATENCY() * 500, |
4590 | SNB_READ_WM2_LATENCY() * 500, |
4505 | &sandybridge_display_srwm_info, |
4591 | &sandybridge_display_srwm_info, |
Line 4512... | Line 4598... | ||
4512 | (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4598 | (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4513 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4599 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4514 | (plane_wm << WM1_LP_SR_SHIFT) | |
4600 | (plane_wm << WM1_LP_SR_SHIFT) | |
4515 | cursor_wm); |
4601 | cursor_wm); |
Line 4516... | Line -... | ||
4516 | - | ||
4517 | dbgprintf("compute wm3\n"); |
- | |
4518 | 4602 | ||
4519 | /* WM3 */ |
4603 | /* WM3 */ |
4520 | if (!ironlake_compute_srwm(dev, 3, enabled, |
4604 | if (!ironlake_compute_srwm(dev, 3, enabled, |
4521 | SNB_READ_WM3_LATENCY() * 500, |
4605 | SNB_READ_WM3_LATENCY() * 500, |
4522 | &sandybridge_display_srwm_info, |
4606 | &sandybridge_display_srwm_info, |
Line 4528... | Line 4612... | ||
4528 | WM3_LP_EN | |
4612 | WM3_LP_EN | |
4529 | (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4613 | (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) | |
4530 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4614 | (fbc_wm << WM1_LP_FBC_SHIFT) | |
4531 | (plane_wm << WM1_LP_SR_SHIFT) | |
4615 | (plane_wm << WM1_LP_SR_SHIFT) | |
4532 | cursor_wm); |
4616 | cursor_wm); |
- | 4617 | } |
|
Line -... | Line 4618... | ||
- | 4618 | ||
- | 4619 | static bool |
|
- | 4620 | sandybridge_compute_sprite_wm(struct drm_device *dev, int plane, |
|
- | 4621 | uint32_t sprite_width, int pixel_size, |
|
- | 4622 | const struct intel_watermark_params *display, |
|
- | 4623 | int display_latency_ns, int *sprite_wm) |
|
- | 4624 | { |
|
- | 4625 | struct drm_crtc *crtc; |
|
- | 4626 | int clock; |
|
- | 4627 | int entries, tlb_miss; |
|
- | 4628 | ||
- | 4629 | crtc = intel_get_crtc_for_plane(dev, plane); |
|
- | 4630 | if (crtc->fb == NULL || !crtc->enabled) { |
|
- | 4631 | *sprite_wm = display->guard_size; |
|
- | 4632 | return false; |
|
- | 4633 | } |
|
- | 4634 | ||
- | 4635 | clock = crtc->mode.clock; |
|
- | 4636 | ||
- | 4637 | /* Use the small buffer method to calculate the sprite watermark */ |
|
- | 4638 | entries = ((clock * pixel_size / 1000) * display_latency_ns) / 1000; |
|
- | 4639 | tlb_miss = display->fifo_size*display->cacheline_size - |
|
- | 4640 | sprite_width * 8; |
|
- | 4641 | if (tlb_miss > 0) |
|
- | 4642 | entries += tlb_miss; |
|
- | 4643 | entries = DIV_ROUND_UP(entries, display->cacheline_size); |
|
- | 4644 | *sprite_wm = entries + display->guard_size; |
|
- | 4645 | if (*sprite_wm > (int)display->max_wm) |
|
- | 4646 | *sprite_wm = display->max_wm; |
|
- | 4647 | ||
- | 4648 | return true; |
|
- | 4649 | } |
|
- | 4650 | ||
- | 4651 | static bool |
|
- | 4652 | sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, |
|
- | 4653 | uint32_t sprite_width, int pixel_size, |
|
- | 4654 | const struct intel_watermark_params *display, |
|
- | 4655 | int latency_ns, int *sprite_wm) |
|
- | 4656 | { |
|
- | 4657 | struct drm_crtc *crtc; |
|
- | 4658 | unsigned long line_time_us; |
|
- | 4659 | int clock; |
|
- | 4660 | int line_count, line_size; |
|
4533 | 4661 | int small, large; |
|
- | 4662 | int entries; |
|
- | 4663 | ||
- | 4664 | if (!latency_ns) { |
|
- | 4665 | *sprite_wm = 0; |
|
- | 4666 | return false; |
|
- | 4667 | } |
|
- | 4668 | ||
- | 4669 | crtc = intel_get_crtc_for_plane(dev, plane); |
|
- | 4670 | clock = crtc->mode.clock; |
|
- | 4671 | ||
- | 4672 | line_time_us = (sprite_width * 1000) / clock; |
|
- | 4673 | line_count = (latency_ns / line_time_us + 1000) / 1000; |
|
Line -... | Line 4674... | ||
- | 4674 | line_size = sprite_width * pixel_size; |
|
- | 4675 | ||
- | 4676 | /* Use the minimum of the small and large buffer method for primary */ |
|
- | 4677 | small = ((clock * pixel_size / 1000) * latency_ns) / 1000; |
|
- | 4678 | large = line_count * line_size; |
|
- | 4679 | ||
- | 4680 | entries = DIV_ROUND_UP(min(small, large), display->cacheline_size); |
|
- | 4681 | *sprite_wm = entries + display->guard_size; |
|
- | 4682 | ||
- | 4683 | return *sprite_wm > 0x3ff ? false : true; |
|
- | 4684 | } |
|
- | 4685 | ||
- | 4686 | static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, |
|
- | 4687 | uint32_t sprite_width, int pixel_size) |
|
- | 4688 | { |
|
- | 4689 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 4690 | int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */ |
|
- | 4691 | int sprite_wm, reg; |
|
- | 4692 | int ret; |
|
- | 4693 | ||
- | 4694 | switch (pipe) { |
|
- | 4695 | case 0: |
|
- | 4696 | reg = WM0_PIPEA_ILK; |
|
- | 4697 | break; |
|
- | 4698 | case 1: |
|
- | 4699 | reg = WM0_PIPEB_ILK; |
|
- | 4700 | break; |
|
- | 4701 | case 2: |
|
- | 4702 | reg = WM0_PIPEC_IVB; |
|
- | 4703 | break; |
|
- | 4704 | default: |
|
- | 4705 | return; /* bad pipe */ |
|
- | 4706 | } |
|
- | 4707 | ||
- | 4708 | ret = sandybridge_compute_sprite_wm(dev, pipe, sprite_width, pixel_size, |
|
- | 4709 | &sandybridge_display_wm_info, |
|
- | 4710 | latency, &sprite_wm); |
|
- | 4711 | if (!ret) { |
|
- | 4712 | DRM_DEBUG_KMS("failed to compute sprite wm for pipe %d\n", |
|
- | 4713 | pipe); |
|
- | 4714 | return; |
|
- | 4715 | } |
|
- | 4716 | ||
- | 4717 | I915_WRITE(reg, I915_READ(reg) | (sprite_wm << WM0_PIPE_SPRITE_SHIFT)); |
|
- | 4718 | DRM_DEBUG_KMS("sprite watermarks For pipe %d - %d\n", pipe, sprite_wm); |
|
- | 4719 | ||
- | 4720 | ||
- | 4721 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
|
- | 4722 | pixel_size, |
|
- | 4723 | &sandybridge_display_srwm_info, |
|
- | 4724 | SNB_READ_WM1_LATENCY() * 500, |
|
- | 4725 | &sprite_wm); |
|
- | 4726 | if (!ret) { |
|
- | 4727 | DRM_DEBUG_KMS("failed to compute sprite lp1 wm on pipe %d\n", |
|
- | 4728 | pipe); |
|
- | 4729 | return; |
|
- | 4730 | } |
|
- | 4731 | I915_WRITE(WM1S_LP_ILK, sprite_wm); |
|
- | 4732 | ||
- | 4733 | /* Only IVB has two more LP watermarks for sprite */ |
|
- | 4734 | if (!IS_IVYBRIDGE(dev)) |
|
- | 4735 | return; |
|
- | 4736 | ||
- | 4737 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
|
- | 4738 | pixel_size, |
|
- | 4739 | &sandybridge_display_srwm_info, |
|
- | 4740 | SNB_READ_WM2_LATENCY() * 500, |
|
- | 4741 | &sprite_wm); |
|
- | 4742 | if (!ret) { |
|
- | 4743 | DRM_DEBUG_KMS("failed to compute sprite lp2 wm on pipe %d\n", |
|
- | 4744 | pipe); |
|
- | 4745 | return; |
|
- | 4746 | } |
|
- | 4747 | I915_WRITE(WM2S_LP_IVB, sprite_wm); |
|
- | 4748 | ||
- | 4749 | ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width, |
|
- | 4750 | pixel_size, |
|
- | 4751 | &sandybridge_display_srwm_info, |
|
- | 4752 | SNB_READ_WM3_LATENCY() * 500, |
|
- | 4753 | &sprite_wm); |
|
- | 4754 | if (!ret) { |
|
- | 4755 | DRM_DEBUG_KMS("failed to compute sprite lp3 wm on pipe %d\n", |
|
- | 4756 | pipe); |
|
- | 4757 | return; |
|
4534 | LEAVE(); |
4758 | } |
Line 4535... | Line 4759... | ||
4535 | 4759 | I915_WRITE(WM3S_LP_IVB, sprite_wm); |
|
4536 | } |
4760 | } |
4537 | 4761 | ||
Line 4574... | Line 4798... | ||
4574 | if (dev_priv->display.update_wm) |
4798 | if (dev_priv->display.update_wm) |
4575 | dev_priv->display.update_wm(dev); |
4799 | dev_priv->display.update_wm(dev); |
4576 | LEAVE(); |
4800 | LEAVE(); |
4577 | } |
4801 | } |
Line -... | Line 4802... | ||
- | 4802 | ||
- | 4803 | void intel_update_sprite_watermarks(struct drm_device *dev, int pipe, |
|
- | 4804 | uint32_t sprite_width, int pixel_size) |
|
- | 4805 | { |
|
- | 4806 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 4807 | ||
- | 4808 | if (dev_priv->display.update_sprite_wm) |
|
- | 4809 | dev_priv->display.update_sprite_wm(dev, pipe, sprite_width, |
|
- | 4810 | pixel_size); |
|
- | 4811 | } |
|
4578 | 4812 | ||
4579 | static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) |
4813 | static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) |
- | 4814 | { |
|
- | 4815 | if (i915_panel_use_ssc >= 0) |
|
4580 | { |
4816 | return i915_panel_use_ssc != 0; |
4581 | return dev_priv->lvds_use_ssc && i915_panel_use_ssc |
4817 | return dev_priv->lvds_use_ssc |
4582 | && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE); |
4818 | && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE); |
Line 4583... | Line 4819... | ||
4583 | } |
4819 | } |
4584 | 4820 | ||
4585 | /** |
4821 | /** |
- | 4822 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send |
|
4586 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send |
4823 | * @crtc: CRTC structure |
4587 | * @crtc: CRTC structure |
4824 | * @mode: requested mode |
4588 | * |
4825 | * |
4589 | * A pipe may be connected to one or more outputs. Based on the depth of the |
4826 | * A pipe may be connected to one or more outputs. Based on the depth of the |
4590 | * attached framebuffer, choose a good color depth to use on the pipe. |
4827 | * attached framebuffer, choose a good color depth to use on the pipe. |
Line 4594... | Line 4831... | ||
4594 | * set of depths. Resolve that here: |
4831 | * set of depths. Resolve that here: |
4595 | * LVDS typically supports only 6bpc, so clamp down in that case |
4832 | * LVDS typically supports only 6bpc, so clamp down in that case |
4596 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc |
4833 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc |
4597 | * Displays may support a restricted set as well, check EDID and clamp as |
4834 | * Displays may support a restricted set as well, check EDID and clamp as |
4598 | * appropriate. |
4835 | * appropriate. |
- | 4836 | * DP may want to dither down to 6bpc to fit larger modes |
|
4599 | * |
4837 | * |
4600 | * RETURNS: |
4838 | * RETURNS: |
4601 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, |
4839 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, |
4602 | * true if they don't match). |
4840 | * true if they don't match). |
4603 | */ |
4841 | */ |
4604 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, |
4842 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, |
4605 | unsigned int *pipe_bpp) |
4843 | unsigned int *pipe_bpp, |
- | 4844 | struct drm_display_mode *mode) |
|
4606 | { |
4845 | { |
4607 | struct drm_device *dev = crtc->dev; |
4846 | struct drm_device *dev = crtc->dev; |
4608 | struct drm_i915_private *dev_priv = dev->dev_private; |
4847 | struct drm_i915_private *dev_priv = dev->dev_private; |
4609 | struct drm_encoder *encoder; |
4848 | struct drm_encoder *encoder; |
4610 | struct drm_connector *connector; |
4849 | struct drm_connector *connector; |
Line 4625... | Line 4864... | ||
4625 | lvds_bpc = 8; |
4864 | lvds_bpc = 8; |
4626 | else |
4865 | else |
4627 | lvds_bpc = 6; |
4866 | lvds_bpc = 6; |
Line 4628... | Line 4867... | ||
4628 | 4867 | ||
4629 | if (lvds_bpc < display_bpc) { |
4868 | if (lvds_bpc < display_bpc) { |
4630 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to LVDS (%d)\n", display_bpc, lvds_bpc); |
4869 | DRM_DEBUG_KMS("clamping display bpc (was %d) to LVDS (%d)\n", display_bpc, lvds_bpc); |
4631 | display_bpc = lvds_bpc; |
4870 | display_bpc = lvds_bpc; |
4632 | } |
4871 | } |
4633 | continue; |
4872 | continue; |
Line 4634... | Line 4873... | ||
4634 | } |
4873 | } |
4635 | 4874 | ||
4636 | if (intel_encoder->type == INTEL_OUTPUT_EDP) { |
4875 | if (intel_encoder->type == INTEL_OUTPUT_EDP) { |
Line 4637... | Line 4876... | ||
4637 | /* Use VBT settings if we have an eDP panel */ |
4876 | /* Use VBT settings if we have an eDP panel */ |
4638 | unsigned int edp_bpc = dev_priv->edp.bpp / 3; |
4877 | unsigned int edp_bpc = dev_priv->edp.bpp / 3; |
4639 | 4878 | ||
4640 | if (edp_bpc < display_bpc) { |
4879 | if (edp_bpc < display_bpc) { |
4641 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc); |
4880 | DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc); |
4642 | display_bpc = edp_bpc; |
4881 | display_bpc = edp_bpc; |
Line 4651... | Line 4890... | ||
4651 | continue; |
4890 | continue; |
Line 4652... | Line 4891... | ||
4652 | 4891 | ||
4653 | /* Don't use an invalid EDID bpc value */ |
4892 | /* Don't use an invalid EDID bpc value */ |
4654 | if (connector->display_info.bpc && |
4893 | if (connector->display_info.bpc && |
4655 | connector->display_info.bpc < display_bpc) { |
4894 | connector->display_info.bpc < display_bpc) { |
4656 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); |
4895 | DRM_DEBUG_KMS("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); |
4657 | display_bpc = connector->display_info.bpc; |
4896 | display_bpc = connector->display_info.bpc; |
4658 | } |
4897 | } |
Line 4659... | Line 4898... | ||
4659 | } |
4898 | } |
4660 | 4899 | ||
4661 | /* |
4900 | /* |
4662 | * HDMI is either 12 or 8, so if the display lets 10bpc sneak |
4901 | * HDMI is either 12 or 8, so if the display lets 10bpc sneak |
4663 | * through, clamp it down. (Note: >12bpc will be caught below.) |
4902 | * through, clamp it down. (Note: >12bpc will be caught below.) |
4664 | */ |
4903 | */ |
4665 | if (intel_encoder->type == INTEL_OUTPUT_HDMI) { |
4904 | if (intel_encoder->type == INTEL_OUTPUT_HDMI) { |
4666 | if (display_bpc > 8 && display_bpc < 12) { |
4905 | if (display_bpc > 8 && display_bpc < 12) { |
4667 | DRM_DEBUG_DRIVER("forcing bpc to 12 for HDMI\n"); |
4906 | DRM_DEBUG_KMS("forcing bpc to 12 for HDMI\n"); |
4668 | display_bpc = 12; |
4907 | display_bpc = 12; |
4669 | } else { |
4908 | } else { |
4670 | DRM_DEBUG_DRIVER("forcing bpc to 8 for HDMI\n"); |
4909 | DRM_DEBUG_KMS("forcing bpc to 8 for HDMI\n"); |
4671 | display_bpc = 8; |
4910 | display_bpc = 8; |
4672 | } |
4911 | } |
Line -... | Line 4912... | ||
- | 4912 | } |
|
- | 4913 | } |
|
- | 4914 | ||
- | 4915 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { |
|
- | 4916 | DRM_DEBUG_KMS("Dithering DP to 6bpc\n"); |
|
4673 | } |
4917 | display_bpc = 6; |
4674 | } |
4918 | } |
4675 | 4919 | ||
4676 | /* |
4920 | /* |
4677 | * We could just drive the pipe at the highest bpc all the time and |
4921 | * We could just drive the pipe at the highest bpc all the time and |
Line 4687... | Line 4931... | ||
4687 | case 15: |
4931 | case 15: |
4688 | case 16: |
4932 | case 16: |
4689 | bpc = 6; /* min is 18bpp */ |
4933 | bpc = 6; /* min is 18bpp */ |
4690 | break; |
4934 | break; |
4691 | case 24: |
4935 | case 24: |
4692 | bpc = min((unsigned int)8, display_bpc); |
4936 | bpc = 8; |
4693 | break; |
4937 | break; |
4694 | case 30: |
4938 | case 30: |
4695 | bpc = min((unsigned int)10, display_bpc); |
4939 | bpc = 10; |
4696 | break; |
4940 | break; |
4697 | case 48: |
4941 | case 48: |
4698 | bpc = min((unsigned int)12, display_bpc); |
4942 | bpc = 12; |
4699 | break; |
4943 | break; |
4700 | default: |
4944 | default: |
4701 | DRM_DEBUG("unsupported depth, assuming 24 bits\n"); |
4945 | DRM_DEBUG("unsupported depth, assuming 24 bits\n"); |
4702 | bpc = min((unsigned int)8, display_bpc); |
4946 | bpc = min((unsigned int)8, display_bpc); |
4703 | break; |
4947 | break; |
4704 | } |
4948 | } |
Line -... | Line 4949... | ||
- | 4949 | ||
- | 4950 | display_bpc = min(display_bpc, bpc); |
|
4705 | 4951 | ||
4706 | DRM_DEBUG_DRIVER("setting pipe bpc to %d (max display bpc %d)\n", |
4952 | DRM_DEBUG_KMS("setting pipe bpc to %d (max display bpc %d)\n", |
Line 4707... | Line 4953... | ||
4707 | bpc, display_bpc); |
4953 | bpc, display_bpc); |
Line 4708... | Line 4954... | ||
4708 | 4954 | ||
4709 | *pipe_bpp = bpc * 3; |
4955 | *pipe_bpp = display_bpc * 3; |
Line 4710... | Line 4956... | ||
4710 | 4956 | ||
Line 4930... | Line 5176... | ||
4930 | pipeconf |= PIPECONF_DOUBLE_WIDE; |
5176 | pipeconf |= PIPECONF_DOUBLE_WIDE; |
4931 | else |
5177 | else |
4932 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; |
5178 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; |
4933 | } |
5179 | } |
Line -... | Line 5180... | ||
- | 5180 | ||
- | 5181 | /* default to 8bpc */ |
|
- | 5182 | pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN); |
|
- | 5183 | if (is_dp) { |
|
- | 5184 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { |
|
- | 5185 | pipeconf |= PIPECONF_BPP_6 | |
|
- | 5186 | PIPECONF_DITHER_EN | |
|
- | 5187 | PIPECONF_DITHER_TYPE_SP; |
|
- | 5188 | } |
|
- | 5189 | } |
|
4934 | 5190 | ||
Line 4935... | Line 5191... | ||
4935 | dpll |= DPLL_VCO_ENABLE; |
5191 | dpll |= DPLL_VCO_ENABLE; |
4936 | 5192 | ||
Line 5048... | Line 5304... | ||
5048 | adjusted_mode->crtc_vblank_start -= 1; |
5304 | adjusted_mode->crtc_vblank_start -= 1; |
5049 | adjusted_mode->crtc_vblank_end -= 1; |
5305 | adjusted_mode->crtc_vblank_end -= 1; |
5050 | adjusted_mode->crtc_vsync_end -= 1; |
5306 | adjusted_mode->crtc_vsync_end -= 1; |
5051 | adjusted_mode->crtc_vsync_start -= 1; |
5307 | adjusted_mode->crtc_vsync_start -= 1; |
5052 | } else |
5308 | } else |
5053 | pipeconf &= ~PIPECONF_INTERLACE_W_FIELD_INDICATION; /* progressive */ |
5309 | pipeconf &= ~PIPECONF_INTERLACE_MASK; /* progressive */ |
Line 5054... | Line 5310... | ||
5054 | 5310 | ||
5055 | I915_WRITE(HTOTAL(pipe), |
5311 | I915_WRITE(HTOTAL(pipe), |
5056 | (adjusted_mode->crtc_hdisplay - 1) | |
5312 | (adjusted_mode->crtc_hdisplay - 1) | |
5057 | ((adjusted_mode->crtc_htotal - 1) << 16)); |
5313 | ((adjusted_mode->crtc_htotal - 1) << 16)); |
Line 5097... | Line 5353... | ||
5097 | intel_update_watermarks(dev); |
5353 | intel_update_watermarks(dev); |
Line 5098... | Line 5354... | ||
5098 | 5354 | ||
5099 | return ret; |
5355 | return ret; |
Line -... | Line 5356... | ||
- | 5356 | } |
|
- | 5357 | ||
- | 5358 | /* |
|
5100 | } |
5359 | * Initialize reference clocks when the driver loads |
5101 | 5360 | */ |
|
5102 | static void ironlake_update_pch_refclk(struct drm_device *dev) |
5361 | void ironlake_init_pch_refclk(struct drm_device *dev) |
5103 | { |
5362 | { |
5104 | struct drm_i915_private *dev_priv = dev->dev_private; |
- | |
5105 | struct drm_mode_config *mode_config = &dev->mode_config; |
5363 | struct drm_i915_private *dev_priv = dev->dev_private; |
5106 | struct drm_crtc *crtc; |
- | |
5107 | struct intel_encoder *encoder; |
5364 | struct drm_mode_config *mode_config = &dev->mode_config; |
5108 | struct intel_encoder *has_edp_encoder = NULL; |
5365 | struct intel_encoder *encoder; |
- | 5366 | u32 temp; |
|
- | 5367 | bool has_lvds = false; |
|
- | 5368 | bool has_cpu_edp = false; |
|
- | 5369 | bool has_pch_edp = false; |
|
- | 5370 | bool has_panel = false; |
|
Line 5109... | Line 5371... | ||
5109 | u32 temp; |
5371 | bool has_ck505 = false; |
5110 | bool has_lvds = false; |
- | |
5111 | - | ||
5112 | /* We need to take the global config into account */ |
- | |
5113 | list_for_each_entry(crtc, &mode_config->crtc_list, head) { |
- | |
5114 | if (!crtc->enabled) |
5372 | bool can_ssc = false; |
5115 | continue; |
5373 | |
5116 | - | ||
5117 | list_for_each_entry(encoder, &mode_config->encoder_list, |
- | |
5118 | base.head) { |
- | |
5119 | if (encoder->base.crtc != crtc) |
5374 | /* We need to take the global config into account */ |
5120 | continue; |
5375 | list_for_each_entry(encoder, &mode_config->encoder_list, |
- | 5376 | base.head) { |
|
5121 | 5377 | switch (encoder->type) { |
|
- | 5378 | case INTEL_OUTPUT_LVDS: |
|
5122 | switch (encoder->type) { |
5379 | has_panel = true; |
- | 5380 | has_lvds = true; |
|
- | 5381 | break; |
|
5123 | case INTEL_OUTPUT_LVDS: |
5382 | case INTEL_OUTPUT_EDP: |
- | 5383 | has_panel = true; |
|
- | 5384 | if (intel_encoder_is_pch_edp(&encoder->base)) |
|
5124 | has_lvds = true; |
5385 | has_pch_edp = true; |
5125 | case INTEL_OUTPUT_EDP: |
5386 | else |
5126 | has_edp_encoder = encoder; |
5387 | has_cpu_edp = true; |
- | 5388 | break; |
|
- | 5389 | } |
|
- | 5390 | } |
|
- | 5391 | ||
- | 5392 | if (HAS_PCH_IBX(dev)) { |
|
- | 5393 | has_ck505 = dev_priv->display_clock_mode; |
|
- | 5394 | can_ssc = has_ck505; |
|
5127 | break; |
5395 | } else { |
Line -... | Line 5396... | ||
- | 5396 | has_ck505 = false; |
|
- | 5397 | can_ssc = true; |
|
- | 5398 | } |
|
- | 5399 | ||
5128 | } |
5400 | DRM_DEBUG_KMS("has_panel %d has_lvds %d has_pch_edp %d has_cpu_edp %d has_ck505 %d\n", |
5129 | } |
5401 | has_panel, has_lvds, has_pch_edp, has_cpu_edp, |
5130 | } |
5402 | has_ck505); |
5131 | 5403 | ||
5132 | /* Ironlake: try to setup display ref clock before DPLL |
5404 | /* Ironlake: try to setup display ref clock before DPLL |
5133 | * enabling. This is only under driver's control after |
5405 | * enabling. This is only under driver's control after |
5134 | * PCH B stepping, previous chipset stepping should be |
5406 | * PCH B stepping, previous chipset stepping should be |
5135 | * ignoring this setting. |
5407 | * ignoring this setting. |
- | 5408 | */ |
|
- | 5409 | temp = I915_READ(PCH_DREF_CONTROL); |
|
- | 5410 | /* Always enable nonspread source */ |
|
- | 5411 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; |
|
5136 | */ |
5412 | |
- | 5413 | if (has_ck505) |
|
- | 5414 | temp |= DREF_NONSPREAD_CK505_ENABLE; |
|
5137 | temp = I915_READ(PCH_DREF_CONTROL); |
5415 | else |
5138 | /* Always enable nonspread source */ |
5416 | temp |= DREF_NONSPREAD_SOURCE_ENABLE; |
5139 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; |
- | |
5140 | temp |= DREF_NONSPREAD_SOURCE_ENABLE; |
- | |
5141 | temp &= ~DREF_SSC_SOURCE_MASK; |
- | |
5142 | temp |= DREF_SSC_SOURCE_ENABLE; |
- | |
Line 5143... | Line 5417... | ||
5143 | I915_WRITE(PCH_DREF_CONTROL, temp); |
5417 | |
5144 | 5418 | if (has_panel) { |
|
- | 5419 | temp &= ~DREF_SSC_SOURCE_MASK; |
|
5145 | POSTING_READ(PCH_DREF_CONTROL); |
5420 | temp |= DREF_SSC_SOURCE_ENABLE; |
5146 | udelay(200); |
- | |
- | 5421 | ||
Line -... | Line 5422... | ||
- | 5422 | /* SSC must be turned on before enabling the CPU output */ |
|
- | 5423 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { |
|
5147 | 5424 | DRM_DEBUG_KMS("Using SSC on panel\n"); |
|
5148 | if (has_edp_encoder) { |
5425 | temp |= DREF_SSC1_ENABLE; |
5149 | if (intel_panel_use_ssc(dev_priv)) { |
5426 | } |
5150 | temp |= DREF_SSC1_ENABLE; |
5427 | |
Line 5151... | Line 5428... | ||
5151 | I915_WRITE(PCH_DREF_CONTROL, temp); |
5428 | /* Get SSC going before enabling the outputs */ |
5152 | 5429 | I915_WRITE(PCH_DREF_CONTROL, temp); |
|
5153 | POSTING_READ(PCH_DREF_CONTROL); |
5430 | POSTING_READ(PCH_DREF_CONTROL); |
- | 5431 | udelay(200); |
|
5154 | udelay(200); |
5432 | |
- | 5433 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
|
5155 | } |
5434 | |
5156 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
5435 | /* Enable CPU source on CPU attached eDP */ |
- | 5436 | if (has_cpu_edp) { |
|
- | 5437 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { |
|
- | 5438 | DRM_DEBUG_KMS("Using SSC on eDP\n"); |
|
- | 5439 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; |
|
- | 5440 | } |
|
- | 5441 | else |
|
5157 | 5442 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
|
- | 5443 | } else |
|
- | 5444 | temp |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
|
- | 5445 | ||
- | 5446 | I915_WRITE(PCH_DREF_CONTROL, temp); |
|
5158 | /* Enable CPU source on CPU attached eDP */ |
5447 | POSTING_READ(PCH_DREF_CONTROL); |
5159 | if (!intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5448 | udelay(200); |
- | 5449 | } else { |
|
5160 | if (intel_panel_use_ssc(dev_priv)) |
5450 | DRM_DEBUG_KMS("Disabling SSC entirely\n"); |
- | 5451 | ||
- | 5452 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; |
|
- | 5453 | ||
- | 5454 | /* Turn off CPU output */ |
|
- | 5455 | temp |= DREF_CPU_SOURCE_OUTPUT_DISABLE; |
|
5161 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; |
5456 | |
5162 | else |
5457 | I915_WRITE(PCH_DREF_CONTROL, temp); |
- | 5458 | POSTING_READ(PCH_DREF_CONTROL); |
|
- | 5459 | udelay(200); |
|
5163 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
5460 | |
5164 | } else { |
5461 | /* Turn off the SSC source */ |
5165 | /* Enable SSC on PCH eDP if needed */ |
5462 | temp &= ~DREF_SSC_SOURCE_MASK; |
5166 | if (intel_panel_use_ssc(dev_priv)) { |
5463 | temp |= DREF_SSC_SOURCE_DISABLE; |
5167 | DRM_ERROR("enabling SSC on PCH\n"); |
5464 | |
5168 | temp |= DREF_SUPERSPREAD_SOURCE_ENABLE; |
5465 | /* Turn off SSC1 */ |
Line -... | Line 5466... | ||
- | 5466 | temp &= ~ DREF_SSC1_ENABLE; |
|
- | 5467 | ||
- | 5468 | I915_WRITE(PCH_DREF_CONTROL, temp); |
|
- | 5469 | POSTING_READ(PCH_DREF_CONTROL); |
|
- | 5470 | udelay(200); |
|
- | 5471 | } |
|
- | 5472 | } |
|
- | 5473 | ||
- | 5474 | static int ironlake_get_refclk(struct drm_crtc *crtc) |
|
- | 5475 | { |
|
- | 5476 | struct drm_device *dev = crtc->dev; |
|
- | 5477 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 5478 | struct intel_encoder *encoder; |
|
- | 5479 | struct drm_mode_config *mode_config = &dev->mode_config; |
|
- | 5480 | struct intel_encoder *edp_encoder = NULL; |
|
- | 5481 | int num_connectors = 0; |
|
- | 5482 | bool is_lvds = false; |
|
- | 5483 | ||
- | 5484 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { |
|
- | 5485 | if (encoder->base.crtc != crtc) |
|
- | 5486 | continue; |
|
- | 5487 | ||
- | 5488 | switch (encoder->type) { |
|
- | 5489 | case INTEL_OUTPUT_LVDS: |
|
- | 5490 | is_lvds = true; |
|
- | 5491 | break; |
|
- | 5492 | case INTEL_OUTPUT_EDP: |
|
- | 5493 | edp_encoder = encoder; |
|
- | 5494 | break; |
|
- | 5495 | } |
|
- | 5496 | num_connectors++; |
|
- | 5497 | } |
|
- | 5498 | ||
- | 5499 | if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) { |
|
5169 | } |
5500 | DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", |
5170 | } |
5501 | dev_priv->lvds_ssc_freq); |
5171 | I915_WRITE(PCH_DREF_CONTROL, temp); |
5502 | return dev_priv->lvds_ssc_freq * 1000; |
5172 | POSTING_READ(PCH_DREF_CONTROL); |
5503 | } |
5173 | udelay(200); |
5504 | |
Line 5233... | Line 5564... | ||
5233 | } |
5564 | } |
Line 5234... | Line 5565... | ||
5234 | 5565 | ||
5235 | num_connectors++; |
5566 | num_connectors++; |
Line 5236... | Line -... | ||
5236 | } |
- | |
5237 | - | ||
5238 | if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) { |
- | |
5239 | refclk = dev_priv->lvds_ssc_freq * 1000; |
5567 | } |
5240 | DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", |
- | |
5241 | refclk / 1000); |
- | |
5242 | } else { |
- | |
5243 | refclk = 96000; |
- | |
5244 | if (!has_edp_encoder || |
- | |
5245 | intel_encoder_is_pch_edp(&has_edp_encoder->base)) |
- | |
Line 5246... | Line 5568... | ||
5246 | refclk = 120000; /* 120Mhz refclk */ |
5568 | |
5247 | } |
5569 | refclk = ironlake_get_refclk(crtc); |
5248 | 5570 | ||
5249 | /* |
5571 | /* |
Line 5327... | Line 5649... | ||
5327 | } |
5649 | } |
Line 5328... | Line 5650... | ||
5328 | 5650 | ||
5329 | /* determine panel color depth */ |
5651 | /* determine panel color depth */ |
5330 | temp = I915_READ(PIPECONF(pipe)); |
5652 | temp = I915_READ(PIPECONF(pipe)); |
5331 | temp &= ~PIPE_BPC_MASK; |
5653 | temp &= ~PIPE_BPC_MASK; |
5332 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp); |
5654 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, mode); |
5333 | switch (pipe_bpp) { |
5655 | switch (pipe_bpp) { |
5334 | case 18: |
5656 | case 18: |
5335 | temp |= PIPE_6BPC; |
5657 | temp |= PIPE_6BPC; |
5336 | break; |
5658 | break; |
Line 5369... | Line 5691... | ||
5369 | if (pixel_multiplier > 1) |
5691 | if (pixel_multiplier > 1) |
5370 | link_bw *= pixel_multiplier; |
5692 | link_bw *= pixel_multiplier; |
5371 | ironlake_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw, |
5693 | ironlake_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw, |
5372 | &m_n); |
5694 | &m_n); |
Line 5373... | Line -... | ||
5373 | - | ||
5374 | ironlake_update_pch_refclk(dev); |
- | |
5375 | 5695 | ||
5376 | fp = clock.n << 16 | clock.m1 << 8 | clock.m2; |
5696 | fp = clock.n << 16 | clock.m1 << 8 | clock.m2; |
5377 | if (has_reduced_clock) |
5697 | if (has_reduced_clock) |
5378 | fp2 = reduced_clock.n << 16 | reduced_clock.m1 << 8 | |
5698 | fp2 = reduced_clock.n << 16 | reduced_clock.m1 << 8 | |
Line 5442... | Line 5762... | ||
5442 | pipeconf = I915_READ(PIPECONF(pipe)); |
5762 | pipeconf = I915_READ(PIPECONF(pipe)); |
Line 5443... | Line 5763... | ||
5443 | 5763 | ||
5444 | /* Set up the display plane register */ |
5764 | /* Set up the display plane register */ |
Line 5445... | Line 5765... | ||
5445 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
5765 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
5446 | 5766 | ||
Line 5447... | Line 5767... | ||
5447 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); |
5767 | DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe); |
- | 5768 | drm_mode_debug_printmodeline(mode); |
|
- | 5769 | ||
5448 | drm_mode_debug_printmodeline(mode); |
5770 | /* PCH eDP needs FDI, but CPU eDP does not */ |
5449 | 5771 | if (!intel_crtc->no_pll) { |
|
5450 | /* PCH eDP needs FDI, but CPU eDP does not */ |
5772 | if (!has_edp_encoder || |
Line 5451... | Line 5773... | ||
5451 | if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5773 | intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5452 | I915_WRITE(PCH_FP0(pipe), fp); |
5774 | I915_WRITE(PCH_FP0(pipe), fp); |
5453 | I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE); |
5775 | I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE); |
5454 | - | ||
5455 | POSTING_READ(PCH_DPLL(pipe)); |
5776 | |
5456 | udelay(150); |
5777 | POSTING_READ(PCH_DPLL(pipe)); |
5457 | } |
5778 | udelay(150); |
5458 | 5779 | } |
|
5459 | /* enable transcoder DPLL */ |
5780 | } else { |
5460 | if (HAS_PCH_CPT(dev)) { |
5781 | if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) && |
5461 | temp = I915_READ(PCH_DPLL_SEL); |
5782 | fp == I915_READ(PCH_FP0(0))) { |
5462 | switch (pipe) { |
5783 | intel_crtc->use_pll_a = true; |
5463 | case 0: |
5784 | DRM_DEBUG_KMS("using pipe a dpll\n"); |
5464 | temp |= TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL; |
- | |
5465 | break; |
5785 | } else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) && |
5466 | case 1: |
- | |
5467 | temp |= TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL; |
5786 | fp == I915_READ(PCH_FP0(1))) { |
5468 | break; |
- | |
5469 | case 2: |
- | |
5470 | /* FIXME: manage transcoder PLLs? */ |
5787 | intel_crtc->use_pll_a = false; |
5471 | temp |= TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL; |
5788 | DRM_DEBUG_KMS("using pipe b dpll\n"); |
5472 | break; |
- | |
5473 | default: |
- | |
5474 | BUG(); |
- | |
5475 | } |
- | |
5476 | I915_WRITE(PCH_DPLL_SEL, temp); |
5789 | } else { |
Line 5477... | Line 5790... | ||
5477 | 5790 | DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n"); |
|
5478 | POSTING_READ(PCH_DPLL_SEL); |
5791 | return -EINVAL; |
5479 | udelay(150); |
5792 | } |
5480 | } |
5793 | } |
5481 | 5794 | ||
5482 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. |
5795 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. |
5483 | * This is an exception to the general rule that mode_set doesn't turn |
5796 | * This is an exception to the general rule that mode_set doesn't turn |
5484 | * things on. |
- | |
5485 | */ |
5797 | * things on. |
5486 | if (is_lvds) { |
- | |
5487 | temp = I915_READ(PCH_LVDS); |
- | |
5488 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; |
- | |
5489 | if (pipe == 1) { |
- | |
5490 | if (HAS_PCH_CPT(dev)) |
- | |
5491 | temp |= PORT_TRANS_B_SEL_CPT; |
5798 | */ |
- | 5799 | if (is_lvds) { |
|
- | 5800 | temp = I915_READ(PCH_LVDS); |
|
- | 5801 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; |
|
- | 5802 | if (HAS_PCH_CPT(dev)) { |
|
5492 | else |
5803 | temp &= ~PORT_TRANS_SEL_MASK; |
5493 | temp |= LVDS_PIPEB_SELECT; |
5804 | temp |= PORT_TRANS_SEL_CPT(pipe); |
5494 | } else { |
5805 | } else { |
- | 5806 | if (pipe == 1) |
|
5495 | if (HAS_PCH_CPT(dev)) |
5807 | temp |= LVDS_PIPEB_SELECT; |
5496 | temp &= ~PORT_TRANS_SEL_MASK; |
5808 | else |
5497 | else |
5809 | temp &= ~LVDS_PIPEB_SELECT; |
5498 | temp &= ~LVDS_PIPEB_SELECT; |
5810 | } |
5499 | } |
5811 | |
Line 5532... | Line 5844... | ||
5532 | 5844 | ||
5533 | pipeconf &= ~PIPECONF_DITHER_EN; |
5845 | pipeconf &= ~PIPECONF_DITHER_EN; |
5534 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; |
5846 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; |
5535 | if ((is_lvds && dev_priv->lvds_dither) || dither) { |
5847 | if ((is_lvds && dev_priv->lvds_dither) || dither) { |
5536 | pipeconf |= PIPECONF_DITHER_EN; |
5848 | pipeconf |= PIPECONF_DITHER_EN; |
5537 | pipeconf |= PIPECONF_DITHER_TYPE_ST1; |
5849 | pipeconf |= PIPECONF_DITHER_TYPE_SP; |
5538 | } |
5850 | } |
5539 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5851 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5540 | intel_dp_set_m_n(crtc, mode, adjusted_mode); |
5852 | intel_dp_set_m_n(crtc, mode, adjusted_mode); |
5541 | } else { |
5853 | } else { |
Line 5544... | Line 5856... | ||
5544 | I915_WRITE(TRANSDATA_N1(pipe), 0); |
5856 | I915_WRITE(TRANSDATA_N1(pipe), 0); |
5545 | I915_WRITE(TRANSDPLINK_M1(pipe), 0); |
5857 | I915_WRITE(TRANSDPLINK_M1(pipe), 0); |
5546 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); |
5858 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); |
5547 | } |
5859 | } |
Line -... | Line 5860... | ||
- | 5860 | ||
5548 | 5861 | if (!intel_crtc->no_pll && |
|
5549 | if (!has_edp_encoder || |
5862 | (!has_edp_encoder || |
5550 | intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5863 | intel_encoder_is_pch_edp(&has_edp_encoder->base))) { |
Line 5551... | Line 5864... | ||
5551 | I915_WRITE(PCH_DPLL(pipe), dpll); |
5864 | I915_WRITE(PCH_DPLL(pipe), dpll); |
5552 | 5865 | ||
5553 | /* Wait for the clocks to stabilize. */ |
5866 | /* Wait for the clocks to stabilize. */ |
Line 5561... | Line 5874... | ||
5561 | */ |
5874 | */ |
5562 | I915_WRITE(PCH_DPLL(pipe), dpll); |
5875 | I915_WRITE(PCH_DPLL(pipe), dpll); |
5563 | } |
5876 | } |
Line 5564... | Line 5877... | ||
5564 | 5877 | ||
- | 5878 | intel_crtc->lowfreq_avail = false; |
|
5565 | intel_crtc->lowfreq_avail = false; |
5879 | if (!intel_crtc->no_pll) { |
5566 | if (is_lvds && has_reduced_clock && i915_powersave) { |
5880 | if (is_lvds && has_reduced_clock && i915_powersave) { |
5567 | I915_WRITE(PCH_FP1(pipe), fp2); |
5881 | I915_WRITE(PCH_FP1(pipe), fp2); |
5568 | intel_crtc->lowfreq_avail = true; |
5882 | intel_crtc->lowfreq_avail = true; |
5569 | if (HAS_PIPE_CXSR(dev)) { |
5883 | if (HAS_PIPE_CXSR(dev)) { |
Line 5575... | Line 5889... | ||
5575 | if (HAS_PIPE_CXSR(dev)) { |
5889 | if (HAS_PIPE_CXSR(dev)) { |
5576 | DRM_DEBUG_KMS("disabling CxSR downclocking\n"); |
5890 | DRM_DEBUG_KMS("disabling CxSR downclocking\n"); |
5577 | pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK; |
5891 | pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK; |
5578 | } |
5892 | } |
5579 | } |
5893 | } |
- | 5894 | } |
|
Line 5580... | Line 5895... | ||
5580 | 5895 | ||
5581 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
5896 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
5582 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
5897 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
5583 | /* the chip adds 2 halflines automatically */ |
5898 | /* the chip adds 2 halflines automatically */ |
Line 5675... | Line 5990... | ||
5675 | LEAVE(); |
5990 | LEAVE(); |
Line 5676... | Line 5991... | ||
5676 | 5991 | ||
5677 | return ret; |
5992 | return ret; |
Line -... | Line 5993... | ||
- | 5993 | } |
|
- | 5994 | ||
- | 5995 | static bool intel_eld_uptodate(struct drm_connector *connector, |
|
- | 5996 | int reg_eldv, uint32_t bits_eldv, |
|
- | 5997 | int reg_elda, uint32_t bits_elda, |
|
- | 5998 | int reg_edid) |
|
- | 5999 | { |
|
- | 6000 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
|
- | 6001 | uint8_t *eld = connector->eld; |
|
- | 6002 | uint32_t i; |
|
- | 6003 | ||
- | 6004 | i = I915_READ(reg_eldv); |
|
- | 6005 | i &= bits_eldv; |
|
- | 6006 | ||
- | 6007 | if (!eld[0]) |
|
- | 6008 | return !i; |
|
- | 6009 | ||
- | 6010 | if (!i) |
|
- | 6011 | return false; |
|
- | 6012 | ||
- | 6013 | i = I915_READ(reg_elda); |
|
- | 6014 | i &= ~bits_elda; |
|
- | 6015 | I915_WRITE(reg_elda, i); |
|
- | 6016 | ||
- | 6017 | for (i = 0; i < eld[2]; i++) |
|
- | 6018 | if (I915_READ(reg_edid) != *((uint32_t *)eld + i)) |
|
- | 6019 | return false; |
|
- | 6020 | ||
- | 6021 | return true; |
|
- | 6022 | } |
|
- | 6023 | ||
- | 6024 | static void g4x_write_eld(struct drm_connector *connector, |
|
- | 6025 | struct drm_crtc *crtc) |
|
- | 6026 | { |
|
- | 6027 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
|
- | 6028 | uint8_t *eld = connector->eld; |
|
- | 6029 | uint32_t eldv; |
|
- | 6030 | uint32_t len; |
|
- | 6031 | uint32_t i; |
|
- | 6032 | ||
- | 6033 | i = I915_READ(G4X_AUD_VID_DID); |
|
- | 6034 | ||
- | 6035 | if (i == INTEL_AUDIO_DEVBLC || i == INTEL_AUDIO_DEVCL) |
|
- | 6036 | eldv = G4X_ELDV_DEVCL_DEVBLC; |
|
- | 6037 | else |
|
- | 6038 | eldv = G4X_ELDV_DEVCTG; |
|
- | 6039 | ||
- | 6040 | if (intel_eld_uptodate(connector, |
|
- | 6041 | G4X_AUD_CNTL_ST, eldv, |
|
- | 6042 | G4X_AUD_CNTL_ST, G4X_ELD_ADDR, |
|
- | 6043 | G4X_HDMIW_HDMIEDID)) |
|
- | 6044 | return; |
|
- | 6045 | ||
- | 6046 | i = I915_READ(G4X_AUD_CNTL_ST); |
|
- | 6047 | i &= ~(eldv | G4X_ELD_ADDR); |
|
- | 6048 | len = (i >> 9) & 0x1f; /* ELD buffer size */ |
|
- | 6049 | I915_WRITE(G4X_AUD_CNTL_ST, i); |
|
- | 6050 | ||
- | 6051 | if (!eld[0]) |
|
- | 6052 | return; |
|
- | 6053 | ||
- | 6054 | len = min_t(uint8_t, eld[2], len); |
|
- | 6055 | DRM_DEBUG_DRIVER("ELD size %d\n", len); |
|
- | 6056 | for (i = 0; i < len; i++) |
|
- | 6057 | I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); |
|
- | 6058 | ||
- | 6059 | i = I915_READ(G4X_AUD_CNTL_ST); |
|
- | 6060 | i |= eldv; |
|
- | 6061 | I915_WRITE(G4X_AUD_CNTL_ST, i); |
|
- | 6062 | } |
|
- | 6063 | ||
- | 6064 | static void ironlake_write_eld(struct drm_connector *connector, |
|
- | 6065 | struct drm_crtc *crtc) |
|
- | 6066 | { |
|
- | 6067 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
|
- | 6068 | uint8_t *eld = connector->eld; |
|
- | 6069 | uint32_t eldv; |
|
- | 6070 | uint32_t i; |
|
- | 6071 | int len; |
|
- | 6072 | int hdmiw_hdmiedid; |
|
- | 6073 | int aud_cntl_st; |
|
- | 6074 | int aud_cntrl_st2; |
|
- | 6075 | ||
- | 6076 | if (HAS_PCH_IBX(connector->dev)) { |
|
- | 6077 | hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID_A; |
|
- | 6078 | aud_cntl_st = IBX_AUD_CNTL_ST_A; |
|
- | 6079 | aud_cntrl_st2 = IBX_AUD_CNTL_ST2; |
|
- | 6080 | } else { |
|
- | 6081 | hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID_A; |
|
- | 6082 | aud_cntl_st = CPT_AUD_CNTL_ST_A; |
|
- | 6083 | aud_cntrl_st2 = CPT_AUD_CNTRL_ST2; |
|
- | 6084 | } |
|
- | 6085 | ||
- | 6086 | i = to_intel_crtc(crtc)->pipe; |
|
- | 6087 | hdmiw_hdmiedid += i * 0x100; |
|
- | 6088 | aud_cntl_st += i * 0x100; |
|
- | 6089 | ||
- | 6090 | DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(i)); |
|
- | 6091 | ||
- | 6092 | i = I915_READ(aud_cntl_st); |
|
- | 6093 | i = (i >> 29) & 0x3; /* DIP_Port_Select, 0x1 = PortB */ |
|
- | 6094 | if (!i) { |
|
- | 6095 | DRM_DEBUG_DRIVER("Audio directed to unknown port\n"); |
|
- | 6096 | /* operate blindly on all ports */ |
|
- | 6097 | eldv = IBX_ELD_VALIDB; |
|
- | 6098 | eldv |= IBX_ELD_VALIDB << 4; |
|
- | 6099 | eldv |= IBX_ELD_VALIDB << 8; |
|
- | 6100 | } else { |
|
- | 6101 | DRM_DEBUG_DRIVER("ELD on port %c\n", 'A' + i); |
|
- | 6102 | eldv = IBX_ELD_VALIDB << ((i - 1) * 4); |
|
- | 6103 | } |
|
- | 6104 | ||
- | 6105 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { |
|
- | 6106 | DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); |
|
- | 6107 | eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ |
|
- | 6108 | } |
|
- | 6109 | ||
- | 6110 | if (intel_eld_uptodate(connector, |
|
- | 6111 | aud_cntrl_st2, eldv, |
|
- | 6112 | aud_cntl_st, IBX_ELD_ADDRESS, |
|
- | 6113 | hdmiw_hdmiedid)) |
|
- | 6114 | return; |
|
- | 6115 | ||
- | 6116 | i = I915_READ(aud_cntrl_st2); |
|
- | 6117 | i &= ~eldv; |
|
- | 6118 | I915_WRITE(aud_cntrl_st2, i); |
|
- | 6119 | ||
- | 6120 | if (!eld[0]) |
|
- | 6121 | return; |
|
- | 6122 | ||
- | 6123 | i = I915_READ(aud_cntl_st); |
|
- | 6124 | i &= ~IBX_ELD_ADDRESS; |
|
- | 6125 | I915_WRITE(aud_cntl_st, i); |
|
- | 6126 | ||
- | 6127 | len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */ |
|
- | 6128 | DRM_DEBUG_DRIVER("ELD size %d\n", len); |
|
- | 6129 | for (i = 0; i < len; i++) |
|
- | 6130 | I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); |
|
- | 6131 | ||
- | 6132 | i = I915_READ(aud_cntrl_st2); |
|
- | 6133 | i |= eldv; |
|
- | 6134 | I915_WRITE(aud_cntrl_st2, i); |
|
- | 6135 | } |
|
- | 6136 | ||
- | 6137 | void intel_write_eld(struct drm_encoder *encoder, |
|
- | 6138 | struct drm_display_mode *mode) |
|
- | 6139 | { |
|
- | 6140 | struct drm_crtc *crtc = encoder->crtc; |
|
- | 6141 | struct drm_connector *connector; |
|
- | 6142 | struct drm_device *dev = encoder->dev; |
|
- | 6143 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 6144 | ||
- | 6145 | connector = drm_select_eld(encoder, mode); |
|
- | 6146 | if (!connector) |
|
- | 6147 | return; |
|
- | 6148 | ||
- | 6149 | DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", |
|
- | 6150 | connector->base.id, |
|
- | 6151 | drm_get_connector_name(connector), |
|
- | 6152 | connector->encoder->base.id, |
|
- | 6153 | drm_get_encoder_name(connector->encoder)); |
|
- | 6154 | ||
- | 6155 | connector->eld[6] = drm_av_sync_delay(connector, mode) / 2; |
|
- | 6156 | ||
- | 6157 | if (dev_priv->display.write_eld) |
|
- | 6158 | dev_priv->display.write_eld(connector, crtc); |
|
5678 | } |
6159 | } |
5679 | 6160 | ||
5680 | /** Loads the palette/gamma unit for the CRTC with the prepared values */ |
6161 | /** Loads the palette/gamma unit for the CRTC with the prepared values */ |
5681 | void intel_crtc_load_lut(struct drm_crtc *crtc) |
6162 | void intel_crtc_load_lut(struct drm_crtc *crtc) |
5682 | { |
6163 | { |
Line 6396... | Line 6877... | ||
6396 | intel_crtc_reset(&intel_crtc->base); |
6877 | intel_crtc_reset(&intel_crtc->base); |
6397 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ |
6878 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ |
6398 | intel_crtc->bpp = 24; /* default for pre-Ironlake */ |
6879 | intel_crtc->bpp = 24; /* default for pre-Ironlake */ |
Line 6399... | Line 6880... | ||
6399 | 6880 | ||
- | 6881 | if (HAS_PCH_SPLIT(dev)) { |
|
- | 6882 | if (pipe == 2 && IS_IVYBRIDGE(dev)) |
|
6400 | if (HAS_PCH_SPLIT(dev)) { |
6883 | intel_crtc->no_pll = true; |
6401 | intel_helper_funcs.prepare = ironlake_crtc_prepare; |
6884 | intel_helper_funcs.prepare = ironlake_crtc_prepare; |
6402 | intel_helper_funcs.commit = ironlake_crtc_commit; |
6885 | intel_helper_funcs.commit = ironlake_crtc_commit; |
6403 | } else { |
6886 | } else { |
6404 | intel_helper_funcs.prepare = i9xx_crtc_prepare; |
6887 | intel_helper_funcs.prepare = i9xx_crtc_prepare; |
Line 6557... | Line 7040... | ||
6557 | } |
7040 | } |
Line 6558... | Line 7041... | ||
6558 | 7041 | ||
6559 | /* disable all the possible outputs/crtcs before entering KMS mode */ |
7042 | /* disable all the possible outputs/crtcs before entering KMS mode */ |
Line -... | Line 7043... | ||
- | 7043 | // drm_helper_disable_unused_functions(dev); |
|
- | 7044 | ||
- | 7045 | if (HAS_PCH_SPLIT(dev)) |
|
6560 | // drm_helper_disable_unused_functions(dev); |
7046 | ironlake_init_pch_refclk(dev); |
6561 | 7047 | ||
Line 6571... | Line 7057... | ||
6571 | }; |
7057 | }; |
Line 6572... | Line -... | ||
6572 | - | ||
6573 | - | ||
6574 | - | ||
6575 | - | ||
6576 | - | ||
6577 | - | ||
6578 | - | ||
6579 | - | ||
6580 | - | ||
6581 | 7058 | ||
6582 | 7059 | ||
6583 | 7060 | ||
6584 | 7061 | ||
Line 6585... | Line 7062... | ||
6585 | static const struct drm_framebuffer_funcs intel_fb_funcs = { |
7062 | static const struct drm_framebuffer_funcs intel_fb_funcs = { |
6586 | // .destroy = intel_user_framebuffer_destroy, |
7063 | // .destroy = intel_user_framebuffer_destroy, |
6587 | // .create_handle = intel_user_framebuffer_create_handle, |
7064 | // .create_handle = intel_user_framebuffer_create_handle, |
6588 | }; |
7065 | }; |
6589 | 7066 | ||
6590 | int intel_framebuffer_init(struct drm_device *dev, |
7067 | int intel_framebuffer_init(struct drm_device *dev, |
Line 6591... | Line 7068... | ||
6591 | struct intel_framebuffer *intel_fb, |
7068 | struct intel_framebuffer *intel_fb, |
6592 | struct drm_mode_fb_cmd *mode_cmd, |
7069 | struct drm_mode_fb_cmd2 *mode_cmd, |
Line 6593... | Line 7070... | ||
6593 | struct drm_i915_gem_object *obj) |
7070 | struct drm_i915_gem_object *obj) |
6594 | { |
- | |
6595 | int ret; |
- | |
6596 | - | ||
6597 | if (obj->tiling_mode == I915_TILING_Y) |
- | |
6598 | return -EINVAL; |
- | |
6599 | - | ||
6600 | if (mode_cmd->pitch & 63) |
- | |
6601 | return -EINVAL; |
7071 | { |
6602 | - | ||
Line -... | Line 7072... | ||
- | 7072 | int ret; |
|
- | 7073 | ||
- | 7074 | if (obj->tiling_mode == I915_TILING_Y) |
|
- | 7075 | return -EINVAL; |
|
- | 7076 | ||
- | 7077 | if (mode_cmd->pitches[0] & 63) |
|
- | 7078 | return -EINVAL; |
|
- | 7079 | ||
6603 | switch (mode_cmd->bpp) { |
7080 | switch (mode_cmd->pixel_format) { |
- | 7081 | case DRM_FORMAT_RGB332: |
|
- | 7082 | case DRM_FORMAT_RGB565: |
|
- | 7083 | case DRM_FORMAT_XRGB8888: |
|
6604 | case 8: |
7084 | case DRM_FORMAT_ARGB8888: |
6605 | case 16: |
7085 | case DRM_FORMAT_XRGB2101010: |
6606 | /* Only pre-ILK can handle 5:5:5 */ |
7086 | case DRM_FORMAT_ARGB2101010: |
- | 7087 | /* RGB formats are common across chipsets */ |
|
6607 | if (mode_cmd->depth == 15 && !HAS_PCH_SPLIT(dev)) |
7088 | break; |
6608 | return -EINVAL; |
7089 | case DRM_FORMAT_YUYV: |
Line 6609... | Line 7090... | ||
6609 | break; |
7090 | case DRM_FORMAT_UYVY: |
6610 | 7091 | case DRM_FORMAT_YVYU: |
|
Line 6818... | Line 7299... | ||
6818 | lcfuse = I915_READ(LCFUSE02); |
7299 | lcfuse = I915_READ(LCFUSE02); |
Line 6819... | Line 7300... | ||
6819 | 7300 | ||
6820 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
7301 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
Line -... | Line 7302... | ||
- | 7302 | } |
|
- | 7303 | ||
- | 7304 | static bool intel_enable_rc6(struct drm_device *dev) |
|
- | 7305 | { |
|
- | 7306 | /* |
|
- | 7307 | * Respect the kernel parameter if it is set |
|
- | 7308 | */ |
|
- | 7309 | if (i915_enable_rc6 >= 0) |
|
- | 7310 | return i915_enable_rc6; |
|
- | 7311 | ||
- | 7312 | /* |
|
- | 7313 | * Disable RC6 on Ironlake |
|
- | 7314 | */ |
|
- | 7315 | if (INTEL_INFO(dev)->gen == 5) |
|
- | 7316 | return 0; |
|
- | 7317 | ||
- | 7318 | /* |
|
- | 7319 | * Disable rc6 on Sandybridge |
|
- | 7320 | */ |
|
- | 7321 | if (INTEL_INFO(dev)->gen == 6) { |
|
- | 7322 | DRM_DEBUG_DRIVER("Sandybridge: RC6 disabled\n"); |
|
- | 7323 | return 0; |
|
- | 7324 | } |
|
- | 7325 | DRM_DEBUG_DRIVER("RC6 enabled\n"); |
|
- | 7326 | return 1; |
|
6821 | } |
7327 | } |
6822 | 7328 | ||
6823 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
7329 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
6824 | { |
7330 | { |
6825 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
7331 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
Line 6854... | Line 7360... | ||
6854 | I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); |
7360 | I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); |
6855 | I915_WRITE(GEN6_RC6_THRESHOLD, 50000); |
7361 | I915_WRITE(GEN6_RC6_THRESHOLD, 50000); |
6856 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
7362 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
6857 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
7363 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
Line 6858... | Line 7364... | ||
6858 | 7364 | ||
6859 | if (i915_enable_rc6) |
7365 | if (intel_enable_rc6(dev_priv->dev)) |
6860 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | |
7366 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | |
Line 6861... | Line 7367... | ||
6861 | GEN6_RC_CTL_RC6_ENABLE; |
7367 | GEN6_RC_CTL_RC6_ENABLE; |
6862 | 7368 | ||
Line 6881... | Line 7387... | ||
6881 | I915_WRITE(GEN6_RP_UP_EI, 100000); |
7387 | I915_WRITE(GEN6_RP_UP_EI, 100000); |
6882 | I915_WRITE(GEN6_RP_DOWN_EI, 5000000); |
7388 | I915_WRITE(GEN6_RP_DOWN_EI, 5000000); |
6883 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); |
7389 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); |
6884 | I915_WRITE(GEN6_RP_CONTROL, |
7390 | I915_WRITE(GEN6_RP_CONTROL, |
6885 | GEN6_RP_MEDIA_TURBO | |
7391 | GEN6_RP_MEDIA_TURBO | |
6886 | GEN6_RP_USE_NORMAL_FREQ | |
7392 | GEN6_RP_MEDIA_HW_MODE | |
6887 | GEN6_RP_MEDIA_IS_GFX | |
7393 | GEN6_RP_MEDIA_IS_GFX | |
6888 | GEN6_RP_ENABLE | |
7394 | GEN6_RP_ENABLE | |
6889 | GEN6_RP_UP_BUSY_AVG | |
7395 | GEN6_RP_UP_BUSY_AVG | |
6890 | GEN6_RP_DOWN_IDLE_CONT); |
7396 | GEN6_RP_DOWN_IDLE_CONT); |
Line 7080... | Line 7586... | ||
7080 | 7586 | ||
7081 | I915_WRITE(WM3_LP_ILK, 0); |
7587 | I915_WRITE(WM3_LP_ILK, 0); |
7082 | I915_WRITE(WM2_LP_ILK, 0); |
7588 | I915_WRITE(WM2_LP_ILK, 0); |
Line -... | Line 7589... | ||
- | 7589 | I915_WRITE(WM1_LP_ILK, 0); |
|
- | 7590 | ||
- | 7591 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock |
|
- | 7592 | * gating disable must be set. Failure to set it results in |
|
- | 7593 | * flickering pixels due to Z write ordering failures after |
|
- | 7594 | * some amount of runtime in the Mesa "fire" demo, and Unigine |
|
- | 7595 | * Sanctuary and Tropics, and apparently anything else with |
|
- | 7596 | * alpha test or pixel discard. |
|
- | 7597 | * |
|
- | 7598 | * According to the spec, bit 11 (RCCUNIT) must also be set, |
|
- | 7599 | * but we didn't debug actual testcases to find it out. |
|
- | 7600 | */ |
|
- | 7601 | I915_WRITE(GEN6_UCGCTL2, |
|
- | 7602 | GEN6_RCPBUNIT_CLOCK_GATE_DISABLE | |
|
7083 | I915_WRITE(WM1_LP_ILK, 0); |
7603 | GEN6_RCCUNIT_CLOCK_GATE_DISABLE); |
7084 | 7604 | ||
7085 | /* |
7605 | /* |
7086 | * According to the spec the following bits should be |
7606 | * According to the spec the following bits should be |
7087 | * set in order to enable memory self-refresh and fbc: |
7607 | * set in order to enable memory self-refresh and fbc: |
Line 7122... | Line 7642... | ||
7122 | I915_WRITE(WM2_LP_ILK, 0); |
7642 | I915_WRITE(WM2_LP_ILK, 0); |
7123 | I915_WRITE(WM1_LP_ILK, 0); |
7643 | I915_WRITE(WM1_LP_ILK, 0); |
Line 7124... | Line 7644... | ||
7124 | 7644 | ||
Line -... | Line 7645... | ||
- | 7645 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); |
|
- | 7646 | ||
- | 7647 | I915_WRITE(IVB_CHICKEN3, |
|
- | 7648 | CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
|
7125 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); |
7649 | CHICKEN3_DGMG_DONE_FIX_DISABLE); |
7126 | 7650 | ||
7127 | for_each_pipe(pipe) { |
7651 | for_each_pipe(pipe) { |
7128 | I915_WRITE(DSPCNTR(pipe), |
7652 | I915_WRITE(DSPCNTR(pipe), |
7129 | I915_READ(DSPCNTR(pipe)) | |
7653 | I915_READ(DSPCNTR(pipe)) | |
Line 7289... | Line 7813... | ||
7289 | int ret; |
7813 | int ret; |
Line 7290... | Line 7814... | ||
7290 | 7814 | ||
7291 | /* rc6 disabled by default due to repeated reports of hanging during |
7815 | /* rc6 disabled by default due to repeated reports of hanging during |
7292 | * boot and resume. |
7816 | * boot and resume. |
7293 | */ |
7817 | */ |
7294 | if (!i915_enable_rc6) |
7818 | if (!intel_enable_rc6(dev)) |
Line 7295... | Line 7819... | ||
7295 | return; |
7819 | return; |
7296 | 7820 | ||
7297 | mutex_lock(&dev->struct_mutex); |
7821 | mutex_lock(&dev->struct_mutex); |
Line 7410... | Line 7934... | ||
7410 | dev_priv->display.get_display_clock_speed = |
7934 | dev_priv->display.get_display_clock_speed = |
7411 | i830_get_display_clock_speed; |
7935 | i830_get_display_clock_speed; |
Line 7412... | Line 7936... | ||
7412 | 7936 | ||
7413 | /* For FIFO watermark updates */ |
7937 | /* For FIFO watermark updates */ |
- | 7938 | if (HAS_PCH_SPLIT(dev)) { |
|
- | 7939 | dev_priv->display.force_wake_get = __gen6_gt_force_wake_get; |
|
- | 7940 | dev_priv->display.force_wake_put = __gen6_gt_force_wake_put; |
|
- | 7941 | ||
- | 7942 | /* IVB configs may use multi-threaded forcewake */ |
|
- | 7943 | if (IS_IVYBRIDGE(dev)) { |
|
- | 7944 | u32 ecobus; |
|
- | 7945 | ||
- | 7946 | /* A small trick here - if the bios hasn't configured MT forcewake, |
|
- | 7947 | * and if the device is in RC6, then force_wake_mt_get will not wake |
|
- | 7948 | * the device and the ECOBUS read will return zero. Which will be |
|
- | 7949 | * (correctly) interpreted by the test below as MT forcewake being |
|
- | 7950 | * disabled. |
|
- | 7951 | */ |
|
- | 7952 | mutex_lock(&dev->struct_mutex); |
|
- | 7953 | __gen6_gt_force_wake_mt_get(dev_priv); |
|
- | 7954 | ecobus = I915_READ_NOTRACE(ECOBUS); |
|
- | 7955 | __gen6_gt_force_wake_mt_put(dev_priv); |
|
- | 7956 | mutex_unlock(&dev->struct_mutex); |
|
- | 7957 | ||
- | 7958 | if (ecobus & FORCEWAKE_MT_ENABLE) { |
|
- | 7959 | DRM_DEBUG_KMS("Using MT version of forcewake\n"); |
|
- | 7960 | dev_priv->display.force_wake_get = |
|
- | 7961 | __gen6_gt_force_wake_mt_get; |
|
- | 7962 | dev_priv->display.force_wake_put = |
|
- | 7963 | __gen6_gt_force_wake_mt_put; |
|
- | 7964 | } |
|
- | 7965 | } |
|
7414 | if (HAS_PCH_SPLIT(dev)) { |
7966 | |
7415 | if (HAS_PCH_IBX(dev)) |
7967 | if (HAS_PCH_IBX(dev)) |
7416 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; |
7968 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; |
7417 | else if (HAS_PCH_CPT(dev)) |
7969 | else if (HAS_PCH_CPT(dev)) |
Line 7425... | Line 7977... | ||
7425 | "Disable CxSR\n"); |
7977 | "Disable CxSR\n"); |
7426 | dev_priv->display.update_wm = NULL; |
7978 | dev_priv->display.update_wm = NULL; |
7427 | } |
7979 | } |
7428 | dev_priv->display.fdi_link_train = ironlake_fdi_link_train; |
7980 | dev_priv->display.fdi_link_train = ironlake_fdi_link_train; |
7429 | dev_priv->display.init_clock_gating = ironlake_init_clock_gating; |
7981 | dev_priv->display.init_clock_gating = ironlake_init_clock_gating; |
- | 7982 | dev_priv->display.write_eld = ironlake_write_eld; |
|
7430 | } else if (IS_GEN6(dev)) { |
7983 | } else if (IS_GEN6(dev)) { |
7431 | if (SNB_READ_WM0_LATENCY()) { |
7984 | if (SNB_READ_WM0_LATENCY()) { |
7432 | dev_priv->display.update_wm = sandybridge_update_wm; |
7985 | dev_priv->display.update_wm = sandybridge_update_wm; |
- | 7986 | dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; |
|
7433 | } else { |
7987 | } else { |
7434 | DRM_DEBUG_KMS("Failed to read display plane latency. " |
7988 | DRM_DEBUG_KMS("Failed to read display plane latency. " |
7435 | "Disable CxSR\n"); |
7989 | "Disable CxSR\n"); |
7436 | dev_priv->display.update_wm = NULL; |
7990 | dev_priv->display.update_wm = NULL; |
7437 | } |
7991 | } |
7438 | dev_priv->display.fdi_link_train = gen6_fdi_link_train; |
7992 | dev_priv->display.fdi_link_train = gen6_fdi_link_train; |
7439 | dev_priv->display.init_clock_gating = gen6_init_clock_gating; |
7993 | dev_priv->display.init_clock_gating = gen6_init_clock_gating; |
- | 7994 | dev_priv->display.write_eld = ironlake_write_eld; |
|
7440 | } else if (IS_IVYBRIDGE(dev)) { |
7995 | } else if (IS_IVYBRIDGE(dev)) { |
7441 | /* FIXME: detect B0+ stepping and use auto training */ |
7996 | /* FIXME: detect B0+ stepping and use auto training */ |
7442 | dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train; |
7997 | dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train; |
7443 | if (SNB_READ_WM0_LATENCY()) { |
7998 | if (SNB_READ_WM0_LATENCY()) { |
7444 | dev_priv->display.update_wm = sandybridge_update_wm; |
7999 | dev_priv->display.update_wm = sandybridge_update_wm; |
- | 8000 | dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; |
|
7445 | } else { |
8001 | } else { |
7446 | DRM_DEBUG_KMS("Failed to read display plane latency. " |
8002 | DRM_DEBUG_KMS("Failed to read display plane latency. " |
7447 | "Disable CxSR\n"); |
8003 | "Disable CxSR\n"); |
7448 | dev_priv->display.update_wm = NULL; |
8004 | dev_priv->display.update_wm = NULL; |
7449 | } |
8005 | } |
7450 | dev_priv->display.init_clock_gating = ivybridge_init_clock_gating; |
8006 | dev_priv->display.init_clock_gating = ivybridge_init_clock_gating; |
7451 | - | ||
- | 8007 | dev_priv->display.write_eld = ironlake_write_eld; |
|
7452 | } else |
8008 | } else |
7453 | dev_priv->display.update_wm = NULL; |
8009 | dev_priv->display.update_wm = NULL; |
7454 | } else if (IS_PINEVIEW(dev)) { |
8010 | } else if (IS_PINEVIEW(dev)) { |
7455 | if (!intel_get_cxsr_latency(IS_PINEVIEW_G(dev), |
8011 | if (!intel_get_cxsr_latency(IS_PINEVIEW_G(dev), |
7456 | dev_priv->is_ddr3, |
8012 | dev_priv->is_ddr3, |
Line 7466... | Line 8022... | ||
7466 | dev_priv->display.update_wm = NULL; |
8022 | dev_priv->display.update_wm = NULL; |
7467 | } else |
8023 | } else |
7468 | dev_priv->display.update_wm = pineview_update_wm; |
8024 | dev_priv->display.update_wm = pineview_update_wm; |
7469 | dev_priv->display.init_clock_gating = gen3_init_clock_gating; |
8025 | dev_priv->display.init_clock_gating = gen3_init_clock_gating; |
7470 | } else if (IS_G4X(dev)) { |
8026 | } else if (IS_G4X(dev)) { |
- | 8027 | dev_priv->display.write_eld = g4x_write_eld; |
|
7471 | dev_priv->display.update_wm = g4x_update_wm; |
8028 | dev_priv->display.update_wm = g4x_update_wm; |
7472 | dev_priv->display.init_clock_gating = g4x_init_clock_gating; |
8029 | dev_priv->display.init_clock_gating = g4x_init_clock_gating; |
7473 | } else if (IS_GEN4(dev)) { |
8030 | } else if (IS_GEN4(dev)) { |
7474 | dev_priv->display.update_wm = i965_update_wm; |
8031 | dev_priv->display.update_wm = i965_update_wm; |
7475 | if (IS_CRESTLINE(dev)) |
8032 | if (IS_CRESTLINE(dev)) |
Line 7624... | Line 8181... | ||
7624 | } |
8181 | } |
Line 7625... | Line 8182... | ||
7625 | 8182 | ||
7626 | void intel_modeset_init(struct drm_device *dev) |
8183 | void intel_modeset_init(struct drm_device *dev) |
7627 | { |
8184 | { |
7628 | struct drm_i915_private *dev_priv = dev->dev_private; |
8185 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 7629... | Line 8186... | ||
7629 | int i; |
8186 | int i, ret; |
Line 7630... | Line 8187... | ||
7630 | 8187 | ||
7631 | drm_mode_config_init(dev); |
8188 | drm_mode_config_init(dev); |
Line 7654... | Line 8211... | ||
7654 | DRM_DEBUG_KMS("%d display pipe%s available.\n", |
8211 | DRM_DEBUG_KMS("%d display pipe%s available.\n", |
7655 | dev_priv->num_pipe, dev_priv->num_pipe > 1 ? "s" : ""); |
8212 | dev_priv->num_pipe, dev_priv->num_pipe > 1 ? "s" : ""); |
Line 7656... | Line 8213... | ||
7656 | 8213 | ||
7657 | for (i = 0; i < dev_priv->num_pipe; i++) { |
8214 | for (i = 0; i < dev_priv->num_pipe; i++) { |
- | 8215 | intel_crtc_init(dev, i); |
|
- | 8216 | ret = intel_plane_init(dev, i); |
|
- | 8217 | if (ret) |
|
7658 | intel_crtc_init(dev, i); |
8218 | DRM_DEBUG_KMS("plane %d init failed: %d\n", i, ret); |
Line 7659... | Line 8219... | ||
7659 | } |
8219 | } |
7660 | 8220 | ||
7661 | /* Just disable it once at startup */ |
8221 | /* Just disable it once at startup */ |