aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-02-14 15:54:50 -0500
committerDave Airlie <airlied@redhat.com>2016-02-14 15:54:50 -0500
commitbdbe58e6c60e49930d9c33e7d2b9a7789ed8c1a9 (patch)
tree2839dc594a4e2384cf32d31fa3df0ae6d72f75b7
parentc92a428f408b23215d1a27f652742094bfc50577 (diff)
parented3f9fd1e865975ceefdb2a43b453e090b1fd787 (diff)
Merge tag 'drm-intel-fixes-2016-02-12' of git://anongit.freedesktop.org/drm-intel into drm-fixes
i915 display fixes mostly. * tag 'drm-intel-fixes-2016-02-12' of git://anongit.freedesktop.org/drm-intel: drm/i915: fix error path in intel_setup_gmbus() drm/i915/skl: Fix typo in DPLL_CFGCR1 definition drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select() drm/i915: Pretend cursor is always on for ILK-style WM calculations (v2) drm/i915/dp: reduce missing TPS3 support errors to debug logging drm/i915/dp: abstract training pattern selection drm/i915/dsi: skip gpio element execution when not supported drm/i915/dsi: don't pass arbitrary data to sideband drm/i915/dsi: defend gpio table against out of bounds access drm/i915/bxt: Don't save/restore eDP panel power during suspend (v3) drm/i915: Allow i915_gem_object_get_page() on userptr as well
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h4
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c3
-rw-r--r--drivers/gpu/drm/i915/i915_gem_userptr.c3
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h2
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c4
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c3
-rw-r--r--drivers/gpu/drm/i915/intel_dp_link_training.c45
-rw-r--r--drivers/gpu/drm/i915/intel_dsi_panel_vbt.c21
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c14
10 files changed, 75 insertions, 26 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f0f75d7c0d94..e7cd311e9fbb 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1988,6 +1988,9 @@ enum hdmi_force_audio {
1988#define I915_GTT_OFFSET_NONE ((u32)-1) 1988#define I915_GTT_OFFSET_NONE ((u32)-1)
1989 1989
1990struct drm_i915_gem_object_ops { 1990struct drm_i915_gem_object_ops {
1991 unsigned int flags;
1992#define I915_GEM_OBJECT_HAS_STRUCT_PAGE 0x1
1993
1991 /* Interface between the GEM object and its backing storage. 1994 /* Interface between the GEM object and its backing storage.
1992 * get_pages() is called once prior to the use of the associated set 1995 * get_pages() is called once prior to the use of the associated set
1993 * of pages before to binding them into the GTT, and put_pages() is 1996 * of pages before to binding them into the GTT, and put_pages() is
@@ -2003,6 +2006,7 @@ struct drm_i915_gem_object_ops {
2003 */ 2006 */
2004 int (*get_pages)(struct drm_i915_gem_object *); 2007 int (*get_pages)(struct drm_i915_gem_object *);
2005 void (*put_pages)(struct drm_i915_gem_object *); 2008 void (*put_pages)(struct drm_i915_gem_object *);
2009
2006 int (*dmabuf_export)(struct drm_i915_gem_object *); 2010 int (*dmabuf_export)(struct drm_i915_gem_object *);
2007 void (*release)(struct drm_i915_gem_object *); 2011 void (*release)(struct drm_i915_gem_object *);
2008}; 2012};
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ddc21d4b388d..bb44bad15403 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4425,6 +4425,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
4425} 4425}
4426 4426
4427static const struct drm_i915_gem_object_ops i915_gem_object_ops = { 4427static const struct drm_i915_gem_object_ops i915_gem_object_ops = {
4428 .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE,
4428 .get_pages = i915_gem_object_get_pages_gtt, 4429 .get_pages = i915_gem_object_get_pages_gtt,
4429 .put_pages = i915_gem_object_put_pages_gtt, 4430 .put_pages = i915_gem_object_put_pages_gtt,
4430}; 4431};
@@ -5261,7 +5262,7 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n)
5261 struct page *page; 5262 struct page *page;
5262 5263
5263 /* Only default objects have per-page dirty tracking */ 5264 /* Only default objects have per-page dirty tracking */
5264 if (WARN_ON(obj->ops != &i915_gem_object_ops)) 5265 if (WARN_ON((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0))
5265 return NULL; 5266 return NULL;
5266 5267
5267 page = i915_gem_object_get_page(obj, n); 5268 page = i915_gem_object_get_page(obj, n);
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 19fb0bddc1cd..59e45b3a6937 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -789,9 +789,10 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj)
789} 789}
790 790
791static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { 791static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = {
792 .dmabuf_export = i915_gem_userptr_dmabuf_export, 792 .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE,
793 .get_pages = i915_gem_userptr_get_pages, 793 .get_pages = i915_gem_userptr_get_pages,
794 .put_pages = i915_gem_userptr_put_pages, 794 .put_pages = i915_gem_userptr_put_pages,
795 .dmabuf_export = i915_gem_userptr_dmabuf_export,
795 .release = i915_gem_userptr_release, 796 .release = i915_gem_userptr_release,
796}; 797};
797 798
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 007ae83a4086..b9a564b76528 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7514,7 +7514,7 @@ enum skl_disp_power_wells {
7514#define DPLL_CFGCR2_PDIV_7 (4<<2) 7514#define DPLL_CFGCR2_PDIV_7 (4<<2)
7515#define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3) 7515#define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3)
7516 7516
7517#define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR2) 7517#define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1)
7518#define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2) 7518#define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2)
7519 7519
7520/* BXT display engine PLL */ 7520/* BXT display engine PLL */
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index a2aa09ce3202..a8af594fbd00 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -49,7 +49,7 @@ static void i915_save_display(struct drm_device *dev)
49 dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); 49 dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS);
50 dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); 50 dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS);
51 dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); 51 dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR);
52 } else if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { 52 } else if (INTEL_INFO(dev)->gen <= 4) {
53 dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL); 53 dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
54 dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); 54 dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS);
55 dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); 55 dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS);
@@ -84,7 +84,7 @@ static void i915_restore_display(struct drm_device *dev)
84 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); 84 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS);
85 I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); 85 I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR);
86 I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL); 86 I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL);
87 } else if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { 87 } else if (INTEL_INFO(dev)->gen <= 4) {
88 I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS); 88 I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS);
89 I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); 89 I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS);
90 I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); 90 I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR);
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index e6408e5583d7..54a165b9c92d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1589,7 +1589,8 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc,
1589 DPLL_CFGCR2_KDIV(wrpll_params.kdiv) | 1589 DPLL_CFGCR2_KDIV(wrpll_params.kdiv) |
1590 DPLL_CFGCR2_PDIV(wrpll_params.pdiv) | 1590 DPLL_CFGCR2_PDIV(wrpll_params.pdiv) |
1591 wrpll_params.central_freq; 1591 wrpll_params.central_freq;
1592 } else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) { 1592 } else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
1593 intel_encoder->type == INTEL_OUTPUT_DP_MST) {
1593 switch (crtc_state->port_clock / 2) { 1594 switch (crtc_state->port_clock / 2) {
1594 case 81000: 1595 case 81000:
1595 ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0); 1596 ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0);
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index 88887938e0bf..0b8eefc2acc5 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -215,27 +215,46 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
215 } 215 }
216} 216}
217 217
218static void 218/*
219intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) 219 * Pick training pattern for channel equalization. Training Pattern 3 for HBR2
220 * or 1.2 devices that support it, Training Pattern 2 otherwise.
221 */
222static u32 intel_dp_training_pattern(struct intel_dp *intel_dp)
220{ 223{
221 bool channel_eq = false; 224 u32 training_pattern = DP_TRAINING_PATTERN_2;
222 int tries, cr_tries; 225 bool source_tps3, sink_tps3;
223 uint32_t training_pattern = DP_TRAINING_PATTERN_2;
224 226
225 /* 227 /*
226 * Training Pattern 3 for HBR2 or 1.2 devices that support it.
227 *
228 * Intel platforms that support HBR2 also support TPS3. TPS3 support is 228 * Intel platforms that support HBR2 also support TPS3. TPS3 support is
229 * also mandatory for downstream devices that support HBR2. 229 * also mandatory for downstream devices that support HBR2. However, not
230 * all sinks follow the spec.
230 * 231 *
231 * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is 232 * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is
232 * supported but still not enabled. 233 * supported in source but still not enabled.
233 */ 234 */
234 if (intel_dp_source_supports_hbr2(intel_dp) && 235 source_tps3 = intel_dp_source_supports_hbr2(intel_dp);
235 drm_dp_tps3_supported(intel_dp->dpcd)) 236 sink_tps3 = drm_dp_tps3_supported(intel_dp->dpcd);
237
238 if (source_tps3 && sink_tps3) {
236 training_pattern = DP_TRAINING_PATTERN_3; 239 training_pattern = DP_TRAINING_PATTERN_3;
237 else if (intel_dp->link_rate == 540000) 240 } else if (intel_dp->link_rate == 540000) {
238 DRM_ERROR("5.4 Gbps link rate without HBR2/TPS3 support\n"); 241 if (!source_tps3)
242 DRM_DEBUG_KMS("5.4 Gbps link rate without source HBR2/TPS3 support\n");
243 if (!sink_tps3)
244 DRM_DEBUG_KMS("5.4 Gbps link rate without sink TPS3 support\n");
245 }
246
247 return training_pattern;
248}
249
250static void
251intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)
252{
253 bool channel_eq = false;
254 int tries, cr_tries;
255 u32 training_pattern;
256
257 training_pattern = intel_dp_training_pattern(intel_dp);
239 258
240 /* channel equalization */ 259 /* channel equalization */
241 if (!intel_dp_set_link_train(intel_dp, 260 if (!intel_dp_set_link_train(intel_dp,
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index a5e99ac305da..e8113ad65477 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -204,10 +204,28 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
204 struct drm_device *dev = intel_dsi->base.base.dev; 204 struct drm_device *dev = intel_dsi->base.base.dev;
205 struct drm_i915_private *dev_priv = dev->dev_private; 205 struct drm_i915_private *dev_priv = dev->dev_private;
206 206
207 if (dev_priv->vbt.dsi.seq_version >= 3)
208 data++;
209
207 gpio = *data++; 210 gpio = *data++;
208 211
209 /* pull up/down */ 212 /* pull up/down */
210 action = *data++; 213 action = *data++ & 1;
214
215 if (gpio >= ARRAY_SIZE(gtable)) {
216 DRM_DEBUG_KMS("unknown gpio %u\n", gpio);
217 goto out;
218 }
219
220 if (!IS_VALLEYVIEW(dev_priv)) {
221 DRM_DEBUG_KMS("GPIO element not supported on this platform\n");
222 goto out;
223 }
224
225 if (dev_priv->vbt.dsi.seq_version >= 3) {
226 DRM_DEBUG_KMS("GPIO element v3 not supported\n");
227 goto out;
228 }
211 229
212 function = gtable[gpio].function_reg; 230 function = gtable[gpio].function_reg;
213 pad = gtable[gpio].pad_reg; 231 pad = gtable[gpio].pad_reg;
@@ -226,6 +244,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
226 vlv_gpio_nc_write(dev_priv, pad, val); 244 vlv_gpio_nc_write(dev_priv, pad, val);
227 mutex_unlock(&dev_priv->sb_lock); 245 mutex_unlock(&dev_priv->sb_lock);
228 246
247out:
229 return data; 248 return data;
230} 249}
231 250
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 25254b5c1ac5..deb8282c26d8 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -683,7 +683,7 @@ int intel_setup_gmbus(struct drm_device *dev)
683 return 0; 683 return 0;
684 684
685err: 685err:
686 while (--pin) { 686 while (pin--) {
687 if (!intel_gmbus_is_valid_pin(dev_priv, pin)) 687 if (!intel_gmbus_is_valid_pin(dev_priv, pin))
688 continue; 688 continue;
689 689
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index eb5fa05cf476..a234687792f0 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1783,16 +1783,20 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
1783 const struct intel_plane_state *pstate, 1783 const struct intel_plane_state *pstate,
1784 uint32_t mem_value) 1784 uint32_t mem_value)
1785{ 1785{
1786 int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; 1786 /*
1787 * We treat the cursor plane as always-on for the purposes of watermark
1788 * calculation. Until we have two-stage watermark programming merged,
1789 * this is necessary to avoid flickering.
1790 */
1791 int cpp = 4;
1792 int width = pstate->visible ? pstate->base.crtc_w : 64;
1787 1793
1788 if (!cstate->base.active || !pstate->visible) 1794 if (!cstate->base.active)
1789 return 0; 1795 return 0;
1790 1796
1791 return ilk_wm_method2(ilk_pipe_pixel_rate(cstate), 1797 return ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
1792 cstate->base.adjusted_mode.crtc_htotal, 1798 cstate->base.adjusted_mode.crtc_htotal,
1793 drm_rect_width(&pstate->dst), 1799 width, cpp, mem_value);
1794 bpp,
1795 mem_value);
1796} 1800}
1797 1801
1798/* Only for WM_LP. */ 1802/* Only for WM_LP. */