diff options
Diffstat (limited to 'drivers/gpu/drm/i915')
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem_tiling.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 95 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 37 |
5 files changed, 105 insertions, 59 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 22a32b9932c5..79a04fde69b5 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
| @@ -184,7 +184,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) | |||
| 184 | static bool | 184 | static bool |
| 185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | 185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) |
| 186 | { | 186 | { |
| 187 | int tile_width; | 187 | int tile_width, tile_height; |
| 188 | 188 | ||
| 189 | /* Linear is always fine */ | 189 | /* Linear is always fine */ |
| 190 | if (tiling_mode == I915_TILING_NONE) | 190 | if (tiling_mode == I915_TILING_NONE) |
| @@ -215,6 +215,20 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | if (IS_GEN2(dev) || | ||
| 219 | (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) | ||
| 220 | tile_height = 32; | ||
| 221 | else | ||
| 222 | tile_height = 8; | ||
| 223 | /* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even | ||
| 224 | * number of tile rows. */ | ||
| 225 | if (IS_GEN2(dev)) | ||
| 226 | tile_height *= 2; | ||
| 227 | |||
| 228 | /* Size needs to be aligned to a full tile row */ | ||
| 229 | if (size & (tile_height * stride - 1)) | ||
| 230 | return false; | ||
| 231 | |||
| 218 | /* 965+ just needs multiples of tile width */ | 232 | /* 965+ just needs multiples of tile width */ |
| 219 | if (INTEL_INFO(dev)->gen >= 4) { | 233 | if (INTEL_INFO(dev)->gen >= 4) { |
| 220 | if (stride & (tile_width - 1)) | 234 | if (stride & (tile_width - 1)) |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 97f946dcc1aa..8a9e08bf1cf7 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
| @@ -316,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
| 316 | struct drm_mode_config *mode_config = &dev->mode_config; | 316 | struct drm_mode_config *mode_config = &dev->mode_config; |
| 317 | struct intel_encoder *encoder; | 317 | struct intel_encoder *encoder; |
| 318 | 318 | ||
| 319 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | ||
| 320 | |||
| 319 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) | 321 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
| 320 | if (encoder->hot_plug) | 322 | if (encoder->hot_plug) |
| 321 | encoder->hot_plug(encoder); | 323 | encoder->hot_plug(encoder); |
| @@ -1649,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
| 1649 | } else { | 1651 | } else { |
| 1650 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | 1652 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
| 1651 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | 1653 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
| 1652 | hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; | 1654 | hotplug_mask |= SDE_AUX_MASK; |
| 1653 | I915_WRITE(FDI_RXA_IMR, 0); | ||
| 1654 | I915_WRITE(FDI_RXB_IMR, 0); | ||
| 1655 | } | 1655 | } |
| 1656 | 1656 | ||
| 1657 | dev_priv->pch_irq_mask = ~hotplug_mask; | 1657 | dev_priv->pch_irq_mask = ~hotplug_mask; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 15d94c63918c..729d4233b763 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -1553,17 +1553,7 @@ | |||
| 1553 | 1553 | ||
| 1554 | /* Backlight control */ | 1554 | /* Backlight control */ |
| 1555 | #define BLC_PWM_CTL 0x61254 | 1555 | #define BLC_PWM_CTL 0x61254 |
| 1556 | #define BACKLIGHT_MODULATION_FREQ_SHIFT (17) | ||
| 1557 | #define BLC_PWM_CTL2 0x61250 /* 965+ only */ | 1556 | #define BLC_PWM_CTL2 0x61250 /* 965+ only */ |
| 1558 | #define BLM_COMBINATION_MODE (1 << 30) | ||
| 1559 | /* | ||
| 1560 | * This is the most significant 15 bits of the number of backlight cycles in a | ||
| 1561 | * complete cycle of the modulated backlight control. | ||
| 1562 | * | ||
| 1563 | * The actual value is this field multiplied by two. | ||
| 1564 | */ | ||
| 1565 | #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17) | ||
| 1566 | #define BLM_LEGACY_MODE (1 << 16) | ||
| 1567 | /* | 1557 | /* |
| 1568 | * This is the number of cycles out of the backlight modulation cycle for which | 1558 | * This is the number of cycles out of the backlight modulation cycle for which |
| 1569 | * the backlight is on. | 1559 | * the backlight is on. |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b006536b3d2..e79b25bbee6c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | 1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; |
| 1631 | 1631 | ||
| 1632 | wait_event(dev_priv->pending_flip_queue, | 1632 | wait_event(dev_priv->pending_flip_queue, |
| 1633 | atomic_read(&dev_priv->mm.wedged) || | ||
| 1633 | atomic_read(&obj->pending_flip) == 0); | 1634 | atomic_read(&obj->pending_flip) == 0); |
| 1634 | 1635 | ||
| 1635 | /* Big Hammer, we also need to ensure that any pending | 1636 | /* Big Hammer, we also need to ensure that any pending |
| 1636 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | 1637 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the |
| 1637 | * current scanout is retired before unpinning the old | 1638 | * current scanout is retired before unpinning the old |
| 1638 | * framebuffer. | 1639 | * framebuffer. |
| 1640 | * | ||
| 1641 | * This should only fail upon a hung GPU, in which case we | ||
| 1642 | * can safely continue. | ||
| 1639 | */ | 1643 | */ |
| 1640 | ret = i915_gem_object_flush_gpu(obj, false); | 1644 | ret = i915_gem_object_flush_gpu(obj, false); |
| 1641 | if (ret) { | 1645 | (void) ret; |
| 1642 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
| 1643 | mutex_unlock(&dev->struct_mutex); | ||
| 1644 | return ret; | ||
| 1645 | } | ||
| 1646 | } | 1646 | } |
| 1647 | 1647 | ||
| 1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1648 | 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) | |||
| 2045 | atomic_read(&obj->pending_flip) == 0); | 2045 | atomic_read(&obj->pending_flip) == 0); |
| 2046 | } | 2046 | } |
| 2047 | 2047 | ||
| 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 | |||
| 2048 | static void ironlake_crtc_enable(struct drm_crtc *crtc) | 2073 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
| 2049 | { | 2074 | { |
| 2050 | struct drm_device *dev = crtc->dev; | 2075 | struct drm_device *dev = crtc->dev; |
| @@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
| 2053 | int pipe = intel_crtc->pipe; | 2078 | int pipe = intel_crtc->pipe; |
| 2054 | int plane = intel_crtc->plane; | 2079 | int plane = intel_crtc->plane; |
| 2055 | u32 reg, temp; | 2080 | u32 reg, temp; |
| 2081 | bool is_pch_port = false; | ||
| 2056 | 2082 | ||
| 2057 | if (intel_crtc->active) | 2083 | if (intel_crtc->active) |
| 2058 | return; | 2084 | return; |
| @@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
| 2066 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); | 2092 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); |
| 2067 | } | 2093 | } |
| 2068 | 2094 | ||
| 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 | } | ||
| 2070 | 2145 | ||
| 2071 | /* Enable panel fitting for LVDS */ | 2146 | /* Enable panel fitting for LVDS */ |
| 2072 | if (dev_priv->pch_pf_size && | 2147 | if (dev_priv->pch_pf_size && |
| @@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
| 2100 | intel_flush_display_plane(dev, plane); | 2175 | intel_flush_display_plane(dev, plane); |
| 2101 | } | 2176 | } |
| 2102 | 2177 | ||
| 2178 | /* Skip the PCH stuff if possible */ | ||
| 2179 | if (!is_pch_port) | ||
| 2180 | goto done; | ||
| 2181 | |||
| 2103 | /* For PCH output, training FDI link */ | 2182 | /* For PCH output, training FDI link */ |
| 2104 | if (IS_GEN6(dev)) | 2183 | if (IS_GEN6(dev)) |
| 2105 | gen6_fdi_link_train(crtc); | 2184 | gen6_fdi_link_train(crtc); |
| @@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
| 2184 | I915_WRITE(reg, temp | TRANS_ENABLE); | 2263 | I915_WRITE(reg, temp | TRANS_ENABLE); |
| 2185 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) | 2264 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) |
| 2186 | DRM_ERROR("failed to enable transcoder %d\n", pipe); | 2265 | DRM_ERROR("failed to enable transcoder %d\n", pipe); |
| 2187 | 2266 | done: | |
| 2188 | intel_crtc_load_lut(crtc); | 2267 | intel_crtc_load_lut(crtc); |
| 2189 | intel_update_fbc(dev); | 2268 | intel_update_fbc(dev); |
| 2190 | intel_crtc_update_cursor(crtc, true); | 2269 | intel_crtc_update_cursor(crtc, true); |
| @@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev) | |||
| 6496 | POSTING_READ(RSTDBYCTL); | 6575 | POSTING_READ(RSTDBYCTL); |
| 6497 | } | 6576 | } |
| 6498 | 6577 | ||
| 6499 | ironlake_disable_rc6(dev); | 6578 | ironlake_teardown_rc6(dev); |
| 6500 | } | 6579 | } |
| 6501 | 6580 | ||
| 6502 | static int ironlake_setup_rc6(struct drm_device *dev) | 6581 | static int ironlake_setup_rc6(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index c65992df458d..d860abeda70f 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -30,8 +30,6 @@ | |||
| 30 | 30 | ||
| 31 | #include "intel_drv.h" | 31 | #include "intel_drv.h" |
| 32 | 32 | ||
| 33 | #define PCI_LBPC 0xf4 /* legacy/combination backlight modes */ | ||
| 34 | |||
| 35 | void | 33 | void |
| 36 | intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, | 34 | intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, |
| 37 | struct drm_display_mode *adjusted_mode) | 35 | struct drm_display_mode *adjusted_mode) |
| @@ -112,19 +110,6 @@ done: | |||
| 112 | dev_priv->pch_pf_size = (width << 16) | height; | 110 | dev_priv->pch_pf_size = (width << 16) | height; |
| 113 | } | 111 | } |
| 114 | 112 | ||
| 115 | static int is_backlight_combination_mode(struct drm_device *dev) | ||
| 116 | { | ||
| 117 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 118 | |||
| 119 | if (INTEL_INFO(dev)->gen >= 4) | ||
| 120 | return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE; | ||
| 121 | |||
| 122 | if (IS_GEN2(dev)) | ||
| 123 | return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE; | ||
| 124 | |||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv) | 113 | static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv) |
| 129 | { | 114 | { |
| 130 | u32 val; | 115 | u32 val; |
| @@ -181,9 +166,6 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) | |||
| 181 | if (INTEL_INFO(dev)->gen < 4) | 166 | if (INTEL_INFO(dev)->gen < 4) |
| 182 | max &= ~1; | 167 | max &= ~1; |
| 183 | } | 168 | } |
| 184 | |||
| 185 | if (is_backlight_combination_mode(dev)) | ||
| 186 | max *= 0xff; | ||
| 187 | } | 169 | } |
| 188 | 170 | ||
| 189 | DRM_DEBUG_DRIVER("max backlight PWM = %d\n", max); | 171 | DRM_DEBUG_DRIVER("max backlight PWM = %d\n", max); |
| @@ -201,15 +183,6 @@ u32 intel_panel_get_backlight(struct drm_device *dev) | |||
| 201 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | 183 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; |
| 202 | if (IS_PINEVIEW(dev)) | 184 | if (IS_PINEVIEW(dev)) |
| 203 | val >>= 1; | 185 | val >>= 1; |
| 204 | |||
| 205 | if (is_backlight_combination_mode(dev)){ | ||
| 206 | u8 lbpc; | ||
| 207 | |||
| 208 | val &= ~1; | ||
| 209 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); | ||
| 210 | val *= lbpc; | ||
| 211 | val >>= 1; | ||
| 212 | } | ||
| 213 | } | 186 | } |
| 214 | 187 | ||
| 215 | DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val); | 188 | DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val); |
| @@ -232,16 +205,6 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level) | |||
| 232 | 205 | ||
| 233 | if (HAS_PCH_SPLIT(dev)) | 206 | if (HAS_PCH_SPLIT(dev)) |
| 234 | return intel_pch_panel_set_backlight(dev, level); | 207 | return intel_pch_panel_set_backlight(dev, level); |
| 235 | |||
| 236 | if (is_backlight_combination_mode(dev)){ | ||
| 237 | u32 max = intel_panel_get_max_backlight(dev); | ||
| 238 | u8 lpbc; | ||
| 239 | |||
| 240 | lpbc = level * 0xfe / max + 1; | ||
| 241 | level /= lpbc; | ||
| 242 | pci_write_config_byte(dev->pdev, PCI_LBPC, lpbc); | ||
| 243 | } | ||
| 244 | |||
| 245 | tmp = I915_READ(BLC_PWM_CTL); | 208 | tmp = I915_READ(BLC_PWM_CTL); |
| 246 | if (IS_PINEVIEW(dev)) { | 209 | if (IS_PINEVIEW(dev)) { |
| 247 | tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1); | 210 | tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1); |
