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

Merge tag 'drm-intel-fixes-2014-08-08' of git://anongit.freedesktop.org/drm-intel

Pull intel drm fixes from Daniel Vetter:
"So I heard that proper pull requests have a revert on top ;-) So here
we go with my usual mid-merge-window pile of fixes.

[ Ed. This revert thing had better not become the "in" thing ]

Big fix is the duct-tape for ring init on g4x platforms, we seem to
have found the magic again to make those machines as happy as before
(not perfect though unfortunately, but that was never the case).

Otherwise fixes all over:
- tune down some overzealous debug output
- VDD power sequencing fix after resume
- bunch of dsi fixes for baytrail among them hw state checker
de-noising
- bunch of error state capture fixes for bdw
- misc tiny fixes/workarounds for various platforms

Last minute rebase was to kick out two patches that shouldn't have
been in here - they're for the state checker, so 0 functional code
affected.

Jani's back from vacation, so he'll take over -fixes from here"

* tag 'drm-intel-fixes-2014-08-08' of git://anongit.freedesktop.org/drm-intel: (21 commits)
Revert "drm/i915: Enable semaphores on BDW"
drm/i915: read HEAD register back in init_ring_common() to enforce ordering
drm/i915: Fix crash when failing to parse MIPI VBT
drm/i915: Bring GPU Freq to min while suspending.
drm/i915: Fix DEIER and GTIER collecting for BDW.
drm/i915: Don't accumulate hangcheck score on forward progress
drm/i915: Add the WaCsStallBeforeStateCacheInvalidate:bdw workaround.
drm/i915: Refactor Broadwell PIPE_CONTROL emission into a helper.
drm/i915: Fix threshold for choosing 32 vs. 64 precisions for VLV DDL values
drm/i915: Fix drain latency precision multipler for VLV
drm/i915: Collect gtier properly on HSW.
drm/i915: Tune down MCH_SSKPD values warning
drm/i915: Tune done rc6 enabling output
drm/i915: Don't require dev->struct_mutex in psr_match_conditions
drm/i915: Fix error state collecting
drm/i915: fix VDD state tracking after system resume
drm/i915: Add correct hw/sw config check for DSI encoder
drm/i915: factor out intel_edp_panel_vdd_sanitize
drm/i915: wait for all DSI FIFOs to be empty
drm/i915: work around warning in i915_gem_gtt
...

+310 -102
+4
drivers/gpu/drm/i915/i915_drv.c
··· 481 481 if (i915.semaphores >= 0) 482 482 return i915.semaphores; 483 483 484 + /* Until we get further testing... */ 485 + if (IS_GEN8(dev)) 486 + return false; 487 + 484 488 #ifdef CONFIG_INTEL_IOMMU 485 489 /* Enable semaphores on SNB when IO remapping is off */ 486 490 if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped)
+2 -1
drivers/gpu/drm/i915/i915_drv.h
··· 53 53 54 54 #define DRIVER_NAME "i915" 55 55 #define DRIVER_DESC "Intel Graphics" 56 - #define DRIVER_DATE "20140620" 56 + #define DRIVER_DATE "20140725" 57 57 58 58 enum pipe { 59 59 INVALID_PIPE = -1, ··· 314 314 u32 eir; 315 315 u32 pgtbl_er; 316 316 u32 ier; 317 + u32 gtier[4]; 317 318 u32 ccid; 318 319 u32 derrmr; 319 320 u32 forcewake;
+1 -1
drivers/gpu/drm/i915/i915_gem.c
··· 4545 4545 4546 4546 del_timer_sync(&dev_priv->gpu_error.hangcheck_timer); 4547 4547 cancel_delayed_work_sync(&dev_priv->mm.retire_work); 4548 - cancel_delayed_work_sync(&dev_priv->mm.idle_work); 4548 + flush_delayed_work(&dev_priv->mm.idle_work); 4549 4549 4550 4550 return 0; 4551 4551
+6 -5
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 1415 1415 (gen8_gtt_pte_t __iomem *)dev_priv->gtt.gsm + first_entry; 1416 1416 int i = 0; 1417 1417 struct sg_page_iter sg_iter; 1418 - dma_addr_t addr = 0; 1418 + dma_addr_t addr = 0; /* shut up gcc */ 1419 1419 1420 1420 for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) { 1421 1421 addr = sg_dma_address(sg_iter.sg) + ··· 1461 1461 (gen6_gtt_pte_t __iomem *)dev_priv->gtt.gsm + first_entry; 1462 1462 int i = 0; 1463 1463 struct sg_page_iter sg_iter; 1464 - dma_addr_t addr; 1464 + dma_addr_t addr = 0; 1465 1465 1466 1466 for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) { 1467 1467 addr = sg_page_iter_dma_address(&sg_iter); ··· 1475 1475 * of NUMA access patterns. Therefore, even with the way we assume 1476 1476 * hardware should work, we must keep this posting read for paranoia. 1477 1477 */ 1478 - if (i != 0) 1479 - WARN_ON(readl(&gtt_entries[i-1]) != 1480 - vm->pte_encode(addr, level, true, flags)); 1478 + if (i != 0) { 1479 + unsigned long gtt = readl(&gtt_entries[i-1]); 1480 + WARN_ON(gtt != vm->pte_encode(addr, level, true, flags)); 1481 + } 1481 1482 1482 1483 /* This next bit makes the above posting read even more important. We 1483 1484 * want to flush the TLBs only after we're certain all the PTE updates
+24 -11
drivers/gpu/drm/i915/i915_gpu_error.c
··· 229 229 return "wait"; 230 230 case HANGCHECK_ACTIVE: 231 231 return "active"; 232 + case HANGCHECK_ACTIVE_LOOP: 233 + return "active (loop)"; 232 234 case HANGCHECK_KICK: 233 235 return "kick"; 234 236 case HANGCHECK_HUNG: ··· 361 359 err_printf(m, "PCI ID: 0x%04x\n", dev->pdev->device); 362 360 err_printf(m, "EIR: 0x%08x\n", error->eir); 363 361 err_printf(m, "IER: 0x%08x\n", error->ier); 362 + if (INTEL_INFO(dev)->gen >= 8) { 363 + for (i = 0; i < 4; i++) 364 + err_printf(m, "GTIER gt %d: 0x%08x\n", i, 365 + error->gtier[i]); 366 + } else if (HAS_PCH_SPLIT(dev) || IS_VALLEYVIEW(dev)) 367 + err_printf(m, "GTIER: 0x%08x\n", error->gtier[0]); 364 368 err_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er); 365 369 err_printf(m, "FORCEWAKE: 0x%08x\n", error->forcewake); 366 370 err_printf(m, "DERRMR: 0x%08x\n", error->derrmr); ··· 792 784 if (ring == to) 793 785 continue; 794 786 795 - signal_offset = (GEN8_SIGNAL_OFFSET(ring, i) & PAGE_MASK) / 4; 787 + signal_offset = (GEN8_SIGNAL_OFFSET(ring, i) & (PAGE_SIZE - 1)) 788 + / 4; 796 789 tmp = error->semaphore_obj->pages[0]; 797 790 idx = intel_ring_sync_index(ring, to); 798 791 ··· 1100 1091 struct drm_i915_error_state *error) 1101 1092 { 1102 1093 struct drm_device *dev = dev_priv->dev; 1094 + int i; 1103 1095 1104 1096 /* General organization 1105 1097 * 1. Registers specific to a single generation ··· 1112 1102 1113 1103 /* 1: Registers specific to a single generation */ 1114 1104 if (IS_VALLEYVIEW(dev)) { 1115 - error->ier = I915_READ(GTIER) | I915_READ(VLV_IER); 1105 + error->gtier[0] = I915_READ(GTIER); 1106 + error->ier = I915_READ(VLV_IER); 1116 1107 error->forcewake = I915_READ(FORCEWAKE_VLV); 1117 1108 } 1118 1109 ··· 1146 1135 if (HAS_HW_CONTEXTS(dev)) 1147 1136 error->ccid = I915_READ(CCID); 1148 1137 1149 - if (HAS_PCH_SPLIT(dev)) 1150 - error->ier = I915_READ(DEIER) | I915_READ(GTIER); 1151 - else { 1152 - if (IS_GEN2(dev)) 1153 - error->ier = I915_READ16(IER); 1154 - else 1155 - error->ier = I915_READ(IER); 1138 + if (INTEL_INFO(dev)->gen >= 8) { 1139 + error->ier = I915_READ(GEN8_DE_MISC_IER); 1140 + for (i = 0; i < 4; i++) 1141 + error->gtier[i] = I915_READ(GEN8_GT_IER(i)); 1142 + } else if (HAS_PCH_SPLIT(dev)) { 1143 + error->ier = I915_READ(DEIER); 1144 + error->gtier[0] = I915_READ(GTIER); 1145 + } else if (IS_GEN2(dev)) { 1146 + error->ier = I915_READ16(IER); 1147 + } else if (!IS_VALLEYVIEW(dev)) { 1148 + error->ier = I915_READ(IER); 1156 1149 } 1157 - 1158 - /* 4: Everything else */ 1159 1150 error->eir = I915_READ(EIR); 1160 1151 error->pgtbl_er = I915_READ(PGTBL_ER); 1161 1152
+12 -3
drivers/gpu/drm/i915/i915_irq.c
··· 3189 3189 struct drm_i915_private *dev_priv = dev->dev_private; 3190 3190 u32 tmp; 3191 3191 3192 - if (ring->hangcheck.acthd != acthd) 3193 - return HANGCHECK_ACTIVE; 3192 + if (acthd != ring->hangcheck.acthd) { 3193 + if (acthd > ring->hangcheck.max_acthd) { 3194 + ring->hangcheck.max_acthd = acthd; 3195 + return HANGCHECK_ACTIVE; 3196 + } 3197 + 3198 + return HANGCHECK_ACTIVE_LOOP; 3199 + } 3194 3200 3195 3201 if (IS_GEN2(dev)) 3196 3202 return HANGCHECK_HUNG; ··· 3307 3301 switch (ring->hangcheck.action) { 3308 3302 case HANGCHECK_IDLE: 3309 3303 case HANGCHECK_WAIT: 3310 - break; 3311 3304 case HANGCHECK_ACTIVE: 3305 + break; 3306 + case HANGCHECK_ACTIVE_LOOP: 3312 3307 ring->hangcheck.score += BUSY; 3313 3308 break; 3314 3309 case HANGCHECK_KICK: ··· 3329 3322 */ 3330 3323 if (ring->hangcheck.score > 0) 3331 3324 ring->hangcheck.score--; 3325 + 3326 + ring->hangcheck.acthd = ring->hangcheck.max_acthd = 0; 3332 3327 } 3333 3328 3334 3329 ring->hangcheck.seqno = seqno;
+25 -25
drivers/gpu/drm/i915/i915_reg.h
··· 3863 3863 3864 3864 /* drain latency register values*/ 3865 3865 #define DRAIN_LATENCY_PRECISION_32 32 3866 - #define DRAIN_LATENCY_PRECISION_16 16 3866 + #define DRAIN_LATENCY_PRECISION_64 64 3867 3867 #define VLV_DDL1 (VLV_DISPLAY_BASE + 0x70050) 3868 - #define DDL_CURSORA_PRECISION_32 (1<<31) 3869 - #define DDL_CURSORA_PRECISION_16 (0<<31) 3868 + #define DDL_CURSORA_PRECISION_64 (1<<31) 3869 + #define DDL_CURSORA_PRECISION_32 (0<<31) 3870 3870 #define DDL_CURSORA_SHIFT 24 3871 - #define DDL_SPRITEB_PRECISION_32 (1<<23) 3872 - #define DDL_SPRITEB_PRECISION_16 (0<<23) 3871 + #define DDL_SPRITEB_PRECISION_64 (1<<23) 3872 + #define DDL_SPRITEB_PRECISION_32 (0<<23) 3873 3873 #define DDL_SPRITEB_SHIFT 16 3874 - #define DDL_SPRITEA_PRECISION_32 (1<<15) 3875 - #define DDL_SPRITEA_PRECISION_16 (0<<15) 3874 + #define DDL_SPRITEA_PRECISION_64 (1<<15) 3875 + #define DDL_SPRITEA_PRECISION_32 (0<<15) 3876 3876 #define DDL_SPRITEA_SHIFT 8 3877 - #define DDL_PLANEA_PRECISION_32 (1<<7) 3878 - #define DDL_PLANEA_PRECISION_16 (0<<7) 3877 + #define DDL_PLANEA_PRECISION_64 (1<<7) 3878 + #define DDL_PLANEA_PRECISION_32 (0<<7) 3879 3879 #define DDL_PLANEA_SHIFT 0 3880 3880 3881 3881 #define VLV_DDL2 (VLV_DISPLAY_BASE + 0x70054) 3882 - #define DDL_CURSORB_PRECISION_32 (1<<31) 3883 - #define DDL_CURSORB_PRECISION_16 (0<<31) 3882 + #define DDL_CURSORB_PRECISION_64 (1<<31) 3883 + #define DDL_CURSORB_PRECISION_32 (0<<31) 3884 3884 #define DDL_CURSORB_SHIFT 24 3885 - #define DDL_SPRITED_PRECISION_32 (1<<23) 3886 - #define DDL_SPRITED_PRECISION_16 (0<<23) 3885 + #define DDL_SPRITED_PRECISION_64 (1<<23) 3886 + #define DDL_SPRITED_PRECISION_32 (0<<23) 3887 3887 #define DDL_SPRITED_SHIFT 16 3888 - #define DDL_SPRITEC_PRECISION_32 (1<<15) 3889 - #define DDL_SPRITEC_PRECISION_16 (0<<15) 3888 + #define DDL_SPRITEC_PRECISION_64 (1<<15) 3889 + #define DDL_SPRITEC_PRECISION_32 (0<<15) 3890 3890 #define DDL_SPRITEC_SHIFT 8 3891 - #define DDL_PLANEB_PRECISION_32 (1<<7) 3892 - #define DDL_PLANEB_PRECISION_16 (0<<7) 3891 + #define DDL_PLANEB_PRECISION_64 (1<<7) 3892 + #define DDL_PLANEB_PRECISION_32 (0<<7) 3893 3893 #define DDL_PLANEB_SHIFT 0 3894 3894 3895 3895 #define VLV_DDL3 (VLV_DISPLAY_BASE + 0x70058) 3896 - #define DDL_CURSORC_PRECISION_32 (1<<31) 3897 - #define DDL_CURSORC_PRECISION_16 (0<<31) 3896 + #define DDL_CURSORC_PRECISION_64 (1<<31) 3897 + #define DDL_CURSORC_PRECISION_32 (0<<31) 3898 3898 #define DDL_CURSORC_SHIFT 24 3899 - #define DDL_SPRITEF_PRECISION_32 (1<<23) 3900 - #define DDL_SPRITEF_PRECISION_16 (0<<23) 3899 + #define DDL_SPRITEF_PRECISION_64 (1<<23) 3900 + #define DDL_SPRITEF_PRECISION_32 (0<<23) 3901 3901 #define DDL_SPRITEF_SHIFT 16 3902 - #define DDL_SPRITEE_PRECISION_32 (1<<15) 3903 - #define DDL_SPRITEE_PRECISION_16 (0<<15) 3902 + #define DDL_SPRITEE_PRECISION_64 (1<<15) 3903 + #define DDL_SPRITEE_PRECISION_32 (0<<15) 3904 3904 #define DDL_SPRITEE_SHIFT 8 3905 - #define DDL_PLANEC_PRECISION_32 (1<<7) 3906 - #define DDL_PLANEC_PRECISION_16 (0<<7) 3905 + #define DDL_PLANEC_PRECISION_64 (1<<7) 3906 + #define DDL_PLANEC_PRECISION_32 (0<<7) 3907 3907 #define DDL_PLANEC_SHIFT 0 3908 3908 3909 3909 /* FIFO watermark sizes etc */
+1 -1
drivers/gpu/drm/i915/intel_bios.c
··· 878 878 879 879 /* error during parsing so set all pointers to null 880 880 * because of partial parsing */ 881 - memset(dev_priv->vbt.dsi.sequence, 0, MIPI_SEQ_MAX); 881 + memset(dev_priv->vbt.dsi.sequence, 0, sizeof(dev_priv->vbt.dsi.sequence)); 882 882 } 883 883 884 884 static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
+4
drivers/gpu/drm/i915/intel_display.c
··· 6161 6161 u32 mdiv; 6162 6162 int refclk = 100000; 6163 6163 6164 + /* In case of MIPI DPLL will not even be used */ 6165 + if (!(pipe_config->dpll_hw_state.dpll & DPLL_VCO_ENABLE)) 6166 + return; 6167 + 6164 6168 mutex_lock(&dev_priv->dpio_lock); 6165 6169 mdiv = vlv_dpio_read(dev_priv, pipe, VLV_PLL_DW3(pipe)); 6166 6170 mutex_unlock(&dev_priv->dpio_lock);
+49 -18
drivers/gpu/drm/i915/intel_dp.c
··· 1285 1285 drm_modeset_unlock(&dev->mode_config.connection_mutex); 1286 1286 } 1287 1287 1288 + static void edp_panel_vdd_schedule_off(struct intel_dp *intel_dp) 1289 + { 1290 + unsigned long delay; 1291 + 1292 + /* 1293 + * Queue the timer to fire a long time from now (relative to the power 1294 + * down delay) to keep the panel power up across a sequence of 1295 + * operations. 1296 + */ 1297 + delay = msecs_to_jiffies(intel_dp->panel_power_cycle_delay * 5); 1298 + schedule_delayed_work(&intel_dp->panel_vdd_work, delay); 1299 + } 1300 + 1288 1301 static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) 1289 1302 { 1290 1303 if (!is_edp(intel_dp)) ··· 1307 1294 1308 1295 intel_dp->want_panel_vdd = false; 1309 1296 1310 - if (sync) { 1297 + if (sync) 1311 1298 edp_panel_vdd_off_sync(intel_dp); 1312 - } else { 1313 - /* 1314 - * Queue the timer to fire a long 1315 - * time from now (relative to the power down delay) 1316 - * to keep the panel power up across a sequence of operations 1317 - */ 1318 - schedule_delayed_work(&intel_dp->panel_vdd_work, 1319 - msecs_to_jiffies(intel_dp->panel_power_cycle_delay * 5)); 1320 - } 1299 + else 1300 + edp_panel_vdd_schedule_off(intel_dp); 1321 1301 } 1322 1302 1323 1303 void intel_edp_panel_on(struct intel_dp *intel_dp) ··· 1806 1800 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1807 1801 1808 1802 lockdep_assert_held(&dev_priv->psr.lock); 1809 - lockdep_assert_held(&dev->struct_mutex); 1810 1803 WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); 1811 1804 WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); 1812 1805 ··· 4003 3998 kfree(intel_dig_port); 4004 3999 } 4005 4000 4001 + static void intel_dp_encoder_reset(struct drm_encoder *encoder) 4002 + { 4003 + intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); 4004 + } 4005 + 4006 4006 static const struct drm_connector_funcs intel_dp_connector_funcs = { 4007 4007 .dpms = intel_connector_dpms, 4008 4008 .detect = intel_dp_detect, ··· 4023 4013 }; 4024 4014 4025 4015 static const struct drm_encoder_funcs intel_dp_enc_funcs = { 4016 + .reset = intel_dp_encoder_reset, 4026 4017 .destroy = intel_dp_encoder_destroy, 4027 4018 }; 4028 4019 ··· 4456 4445 return downclock_mode; 4457 4446 } 4458 4447 4448 + void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder) 4449 + { 4450 + struct drm_device *dev = intel_encoder->base.dev; 4451 + struct drm_i915_private *dev_priv = dev->dev_private; 4452 + struct intel_dp *intel_dp; 4453 + enum intel_display_power_domain power_domain; 4454 + 4455 + if (intel_encoder->type != INTEL_OUTPUT_EDP) 4456 + return; 4457 + 4458 + intel_dp = enc_to_intel_dp(&intel_encoder->base); 4459 + if (!edp_have_panel_vdd(intel_dp)) 4460 + return; 4461 + /* 4462 + * The VDD bit needs a power domain reference, so if the bit is 4463 + * already enabled when we boot or resume, grab this reference and 4464 + * schedule a vdd off, so we don't hold on to the reference 4465 + * indefinitely. 4466 + */ 4467 + DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); 4468 + power_domain = intel_display_port_power_domain(intel_encoder); 4469 + intel_display_power_get(dev_priv, power_domain); 4470 + 4471 + edp_panel_vdd_schedule_off(intel_dp); 4472 + } 4473 + 4459 4474 static bool intel_edp_init_connector(struct intel_dp *intel_dp, 4460 4475 struct intel_connector *intel_connector, 4461 4476 struct edp_power_seq *power_seq) ··· 4502 4465 if (!is_edp(intel_dp)) 4503 4466 return true; 4504 4467 4505 - /* The VDD bit needs a power domain reference, so if the bit is already 4506 - * enabled when we boot, grab this reference. */ 4507 - if (edp_have_panel_vdd(intel_dp)) { 4508 - enum intel_display_power_domain power_domain; 4509 - power_domain = intel_display_port_power_domain(intel_encoder); 4510 - intel_display_power_get(dev_priv, power_domain); 4511 - } 4468 + intel_edp_panel_vdd_sanitize(intel_encoder); 4512 4469 4513 4470 /* Cache DPCD and EDID for edp. */ 4514 4471 intel_edp_panel_vdd_on(intel_dp);
+1
drivers/gpu/drm/i915/intel_drv.h
··· 912 912 void intel_edp_backlight_on(struct intel_dp *intel_dp); 913 913 void intel_edp_backlight_off(struct intel_dp *intel_dp); 914 914 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); 915 + void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder); 915 916 void intel_edp_panel_on(struct intel_dp *intel_dp); 916 917 void intel_edp_panel_off(struct intel_dp *intel_dp); 917 918 void intel_edp_psr_enable(struct intel_dp *intel_dp);
+28 -1
drivers/gpu/drm/i915/intel_dsi.c
··· 92 92 if (fixed_mode) 93 93 intel_fixed_panel_mode(fixed_mode, adjusted_mode); 94 94 95 + /* DSI uses short packets for sync events, so clear mode flags for DSI */ 96 + adjusted_mode->flags = 0; 97 + 95 98 if (intel_dsi->dev.dev_ops->mode_fixup) 96 99 return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev, 97 100 mode, adjusted_mode); ··· 155 152 if (intel_dsi->dev.dev_ops->enable) 156 153 intel_dsi->dev.dev_ops->enable(&intel_dsi->dev); 157 154 155 + wait_for_dsi_fifo_empty(intel_dsi); 156 + 158 157 /* assert ip_tg_enable signal */ 159 158 temp = I915_READ(MIPI_PORT_CTRL(pipe)) & ~LANE_CONFIGURATION_MASK; 160 159 temp = temp | intel_dsi->port_bits; ··· 182 177 tmp |= DPLL_REFA_CLK_ENABLE_VLV; 183 178 I915_WRITE(DPLL(pipe), tmp); 184 179 180 + /* update the hw state for DPLL */ 181 + intel_crtc->config.dpll_hw_state.dpll = DPLL_INTEGRATED_CLOCK_VLV | 182 + DPLL_REFA_CLK_ENABLE_VLV; 183 + 185 184 tmp = I915_READ(DSPCLK_GATE_D); 186 185 tmp |= DPOUNIT_CLOCK_GATE_DISABLE; 187 186 I915_WRITE(DSPCLK_GATE_D, tmp); ··· 200 191 201 192 if (intel_dsi->dev.dev_ops->send_otp_cmds) 202 193 intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev); 194 + 195 + wait_for_dsi_fifo_empty(intel_dsi); 203 196 204 197 /* Enable port in pre-enable phase itself because as per hw team 205 198 * recommendation, port should be enabled befor plane & pipe */ ··· 243 232 DRM_DEBUG_KMS("\n"); 244 233 245 234 if (is_vid_mode(intel_dsi)) { 235 + wait_for_dsi_fifo_empty(intel_dsi); 236 + 246 237 /* de-assert ip_tg_enable signal */ 247 238 temp = I915_READ(MIPI_PORT_CTRL(pipe)); 248 239 I915_WRITE(MIPI_PORT_CTRL(pipe), temp & ~DPI_ENABLE); ··· 274 261 * some next enable sequence send turn on packet error is observed */ 275 262 if (intel_dsi->dev.dev_ops->disable) 276 263 intel_dsi->dev.dev_ops->disable(&intel_dsi->dev); 264 + 265 + wait_for_dsi_fifo_empty(intel_dsi); 277 266 } 278 267 279 268 static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) ··· 366 351 static void intel_dsi_get_config(struct intel_encoder *encoder, 367 352 struct intel_crtc_config *pipe_config) 368 353 { 354 + u32 pclk; 369 355 DRM_DEBUG_KMS("\n"); 370 356 371 - /* XXX: read flags, set to adjusted_mode */ 357 + /* 358 + * DPLL_MD is not used in case of DSI, reading will get some default value 359 + * set dpll_md = 0 360 + */ 361 + pipe_config->dpll_hw_state.dpll_md = 0; 362 + 363 + pclk = vlv_get_dsi_pclk(encoder, pipe_config->pipe_bpp); 364 + if (!pclk) 365 + return; 366 + 367 + pipe_config->adjusted_mode.crtc_clock = pclk; 368 + pipe_config->port_clock = pclk; 372 369 } 373 370 374 371 static enum drm_mode_status
+1
drivers/gpu/drm/i915/intel_dsi.h
··· 132 132 133 133 extern void vlv_enable_dsi_pll(struct intel_encoder *encoder); 134 134 extern void vlv_disable_dsi_pll(struct intel_encoder *encoder); 135 + extern u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp); 135 136 136 137 extern struct intel_dsi_dev_ops vbt_generic_dsi_display_ops; 137 138
+16
drivers/gpu/drm/i915/intel_dsi_cmd.c
··· 419 419 420 420 return 0; 421 421 } 422 + 423 + void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi) 424 + { 425 + struct drm_encoder *encoder = &intel_dsi->base.base; 426 + struct drm_device *dev = encoder->dev; 427 + struct drm_i915_private *dev_priv = dev->dev_private; 428 + struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); 429 + enum pipe pipe = intel_crtc->pipe; 430 + u32 mask; 431 + 432 + mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY | 433 + LP_DATA_FIFO_EMPTY | HS_DATA_FIFO_EMPTY; 434 + 435 + if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 100)) 436 + DRM_ERROR("DPI FIFOs are not empty\n"); 437 + }
+1
drivers/gpu/drm/i915/intel_dsi_cmd.h
··· 51 51 u8 *reqdata, int reqlen, u8 *buf, int buflen); 52 52 53 53 int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs); 54 + void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi); 54 55 55 56 /* XXX: questionable write helpers */ 56 57 static inline int dsi_vc_dcs_write_0(struct intel_dsi *intel_dsi,
+81
drivers/gpu/drm/i915/intel_dsi_pll.c
··· 298 298 299 299 mutex_unlock(&dev_priv->dpio_lock); 300 300 } 301 + 302 + static void assert_bpp_mismatch(int pixel_format, int pipe_bpp) 303 + { 304 + int bpp; 305 + 306 + switch (pixel_format) { 307 + default: 308 + case VID_MODE_FORMAT_RGB888: 309 + case VID_MODE_FORMAT_RGB666_LOOSE: 310 + bpp = 24; 311 + break; 312 + case VID_MODE_FORMAT_RGB666: 313 + bpp = 18; 314 + break; 315 + case VID_MODE_FORMAT_RGB565: 316 + bpp = 16; 317 + break; 318 + } 319 + 320 + WARN(bpp != pipe_bpp, 321 + "bpp match assertion failure (expected %d, current %d)\n", 322 + bpp, pipe_bpp); 323 + } 324 + 325 + u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp) 326 + { 327 + struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; 328 + struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); 329 + u32 dsi_clock, pclk; 330 + u32 pll_ctl, pll_div; 331 + u32 m = 0, p = 0; 332 + int refclk = 25000; 333 + int i; 334 + 335 + DRM_DEBUG_KMS("\n"); 336 + 337 + mutex_lock(&dev_priv->dpio_lock); 338 + pll_ctl = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL); 339 + pll_div = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_DIVIDER); 340 + mutex_unlock(&dev_priv->dpio_lock); 341 + 342 + /* mask out other bits and extract the P1 divisor */ 343 + pll_ctl &= DSI_PLL_P1_POST_DIV_MASK; 344 + pll_ctl = pll_ctl >> (DSI_PLL_P1_POST_DIV_SHIFT - 2); 345 + 346 + /* mask out the other bits and extract the M1 divisor */ 347 + pll_div &= DSI_PLL_M1_DIV_MASK; 348 + pll_div = pll_div >> DSI_PLL_M1_DIV_SHIFT; 349 + 350 + while (pll_ctl) { 351 + pll_ctl = pll_ctl >> 1; 352 + p++; 353 + } 354 + p--; 355 + 356 + if (!p) { 357 + DRM_ERROR("wrong P1 divisor\n"); 358 + return 0; 359 + } 360 + 361 + for (i = 0; i < ARRAY_SIZE(lfsr_converts); i++) { 362 + if (lfsr_converts[i] == pll_div) 363 + break; 364 + } 365 + 366 + if (i == ARRAY_SIZE(lfsr_converts)) { 367 + DRM_ERROR("wrong m_seed programmed\n"); 368 + return 0; 369 + } 370 + 371 + m = i + 62; 372 + 373 + dsi_clock = (m * refclk) / p; 374 + 375 + /* pixel_format and pipe_bpp should agree */ 376 + assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp); 377 + 378 + pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp); 379 + 380 + return pclk; 381 + }
+19 -22
drivers/gpu/drm/i915/intel_pm.c
··· 1287 1287 pixel_size = crtc->primary->fb->bits_per_pixel / 8; /* BPP */ 1288 1288 1289 1289 entries = (clock / 1000) * pixel_size; 1290 - *plane_prec_mult = (entries > 256) ? 1291 - DRAIN_LATENCY_PRECISION_32 : DRAIN_LATENCY_PRECISION_16; 1292 - *plane_dl = (64 * (*plane_prec_mult) * 4) / ((clock / 1000) * 1293 - pixel_size); 1290 + *plane_prec_mult = (entries > 128) ? 1291 + DRAIN_LATENCY_PRECISION_64 : DRAIN_LATENCY_PRECISION_32; 1292 + *plane_dl = (64 * (*plane_prec_mult) * 4) / entries; 1294 1293 1295 1294 entries = (clock / 1000) * 4; /* BPP is always 4 for cursor */ 1296 - *cursor_prec_mult = (entries > 256) ? 1297 - DRAIN_LATENCY_PRECISION_32 : DRAIN_LATENCY_PRECISION_16; 1298 - *cursor_dl = (64 * (*cursor_prec_mult) * 4) / ((clock / 1000) * 4); 1295 + *cursor_prec_mult = (entries > 128) ? 1296 + DRAIN_LATENCY_PRECISION_64 : DRAIN_LATENCY_PRECISION_32; 1297 + *cursor_dl = (64 * (*cursor_prec_mult) * 4) / entries; 1299 1298 1300 1299 return true; 1301 1300 } ··· 1319 1320 if (vlv_compute_drain_latency(dev, 0, &plane_prec_mult, &planea_dl, 1320 1321 &cursor_prec_mult, &cursora_dl)) { 1321 1322 cursora_prec = (cursor_prec_mult == DRAIN_LATENCY_PRECISION_32) ? 1322 - DDL_CURSORA_PRECISION_32 : DDL_CURSORA_PRECISION_16; 1323 + DDL_CURSORA_PRECISION_32 : DDL_CURSORA_PRECISION_64; 1323 1324 planea_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_32) ? 1324 - DDL_PLANEA_PRECISION_32 : DDL_PLANEA_PRECISION_16; 1325 + DDL_PLANEA_PRECISION_32 : DDL_PLANEA_PRECISION_64; 1325 1326 1326 1327 I915_WRITE(VLV_DDL1, cursora_prec | 1327 1328 (cursora_dl << DDL_CURSORA_SHIFT) | ··· 1332 1333 if (vlv_compute_drain_latency(dev, 1, &plane_prec_mult, &planeb_dl, 1333 1334 &cursor_prec_mult, &cursorb_dl)) { 1334 1335 cursorb_prec = (cursor_prec_mult == DRAIN_LATENCY_PRECISION_32) ? 1335 - DDL_CURSORB_PRECISION_32 : DDL_CURSORB_PRECISION_16; 1336 + DDL_CURSORB_PRECISION_32 : DDL_CURSORB_PRECISION_64; 1336 1337 planeb_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_32) ? 1337 - DDL_PLANEB_PRECISION_32 : DDL_PLANEB_PRECISION_16; 1338 + DDL_PLANEB_PRECISION_32 : DDL_PLANEB_PRECISION_64; 1338 1339 1339 1340 I915_WRITE(VLV_DDL2, cursorb_prec | 1340 1341 (cursorb_dl << DDL_CURSORB_SHIFT) | ··· 3419 3420 else 3420 3421 mode = 0; 3421 3422 } 3422 - DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", 3423 - (mode & GEN6_RC_CTL_RC6_ENABLE) ? "on" : "off", 3424 - (mode & GEN6_RC_CTL_RC6p_ENABLE) ? "on" : "off", 3425 - (mode & GEN6_RC_CTL_RC6pp_ENABLE) ? "on" : "off"); 3423 + DRM_DEBUG_KMS("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", 3424 + (mode & GEN6_RC_CTL_RC6_ENABLE) ? "on" : "off", 3425 + (mode & GEN6_RC_CTL_RC6p_ENABLE) ? "on" : "off", 3426 + (mode & GEN6_RC_CTL_RC6pp_ENABLE) ? "on" : "off"); 3426 3427 } 3427 3428 3428 3429 static int sanitize_rc6_option(const struct drm_device *dev, int enable_rc6) ··· 3446 3447 mask = INTEL_RC6_ENABLE; 3447 3448 3448 3449 if ((enable_rc6 & mask) != enable_rc6) 3449 - DRM_INFO("Adjusting RC6 mask to %d (requested %d, valid %d)\n", 3450 - enable_rc6 & mask, enable_rc6, mask); 3450 + DRM_DEBUG_KMS("Adjusting RC6 mask to %d (requested %d, valid %d)\n", 3451 + enable_rc6 & mask, enable_rc6, mask); 3451 3452 3452 3453 return enable_rc6 & mask; 3453 3454 } ··· 5227 5228 uint32_t tmp; 5228 5229 5229 5230 tmp = I915_READ(MCH_SSKPD); 5230 - if ((tmp & MCH_SSKPD_WM0_MASK) != MCH_SSKPD_WM0_VAL) { 5231 - DRM_INFO("Wrong MCH_SSKPD value: 0x%08x\n", tmp); 5232 - DRM_INFO("This can cause pipe underruns and display issues.\n"); 5233 - DRM_INFO("Please upgrade your BIOS to fix this.\n"); 5234 - } 5231 + if ((tmp & MCH_SSKPD_WM0_MASK) != MCH_SSKPD_WM0_VAL) 5232 + DRM_DEBUG_KMS("Wrong MCH_SSKPD value: 0x%08x This can cause underruns.\n", 5233 + tmp); 5235 5234 } 5236 5235 5237 5236 static void gen6_init_clock_gating(struct drm_device *dev)
+33 -14
drivers/gpu/drm/i915/intel_ringbuffer.c
··· 380 380 } 381 381 382 382 static int 383 + gen8_emit_pipe_control(struct intel_engine_cs *ring, 384 + u32 flags, u32 scratch_addr) 385 + { 386 + int ret; 387 + 388 + ret = intel_ring_begin(ring, 6); 389 + if (ret) 390 + return ret; 391 + 392 + intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(6)); 393 + intel_ring_emit(ring, flags); 394 + intel_ring_emit(ring, scratch_addr); 395 + intel_ring_emit(ring, 0); 396 + intel_ring_emit(ring, 0); 397 + intel_ring_emit(ring, 0); 398 + intel_ring_advance(ring); 399 + 400 + return 0; 401 + } 402 + 403 + static int 383 404 gen8_render_ring_flush(struct intel_engine_cs *ring, 384 405 u32 invalidate_domains, u32 flush_domains) 385 406 { ··· 423 402 flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE; 424 403 flags |= PIPE_CONTROL_QW_WRITE; 425 404 flags |= PIPE_CONTROL_GLOBAL_GTT_IVB; 405 + 406 + /* WaCsStallBeforeStateCacheInvalidate:bdw,chv */ 407 + ret = gen8_emit_pipe_control(ring, 408 + PIPE_CONTROL_CS_STALL | 409 + PIPE_CONTROL_STALL_AT_SCOREBOARD, 410 + 0); 411 + if (ret) 412 + return ret; 426 413 } 427 414 428 - ret = intel_ring_begin(ring, 6); 429 - if (ret) 430 - return ret; 431 - 432 - intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(6)); 433 - intel_ring_emit(ring, flags); 434 - intel_ring_emit(ring, scratch_addr); 435 - intel_ring_emit(ring, 0); 436 - intel_ring_emit(ring, 0); 437 - intel_ring_emit(ring, 0); 438 - intel_ring_advance(ring); 439 - 440 - return 0; 441 - 415 + return gen8_emit_pipe_control(ring, flags, scratch_addr); 442 416 } 443 417 444 418 static void ring_write_tail(struct intel_engine_cs *ring, ··· 531 515 intel_ring_setup_status_page(ring); 532 516 else 533 517 ring_setup_phys_status_page(ring); 518 + 519 + /* Enforce ordering by reading HEAD register back */ 520 + I915_READ_HEAD(ring); 534 521 535 522 /* Initialize the ring. This must happen _after_ we've cleared the ring 536 523 * registers with the above sequence (the readback of the HEAD registers
+2
drivers/gpu/drm/i915/intel_ringbuffer.h
··· 70 70 HANGCHECK_IDLE = 0, 71 71 HANGCHECK_WAIT, 72 72 HANGCHECK_ACTIVE, 73 + HANGCHECK_ACTIVE_LOOP, 73 74 HANGCHECK_KICK, 74 75 HANGCHECK_HUNG, 75 76 }; ··· 79 78 80 79 struct intel_ring_hangcheck { 81 80 u64 acthd; 81 + u64 max_acthd; 82 82 u32 seqno; 83 83 int score; 84 84 enum intel_ring_hangcheck_action action;