aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-11-02 20:18:20 -0400
committerDave Airlie <airlied@redhat.com>2016-11-02 20:18:20 -0400
commit7ec30fca2c966293c4593e20459861b106fd62e9 (patch)
treef69e57ab6cdc8bf603dba5e4f0f1c992614d61e3
parente676717a12ca8a7a7f9bf4a5ccde16eed308bcfd (diff)
parentc89d5454d48e3b6ecae1c9f8bb14b3fac64d9fc8 (diff)
Merge tag 'drm-intel-fixes-2016-11-01' of git://anongit.freedesktop.org/drm-intel into drm-fixes
batch of scattered i915 fixes. * tag 'drm-intel-fixes-2016-11-01' of git://anongit.freedesktop.org/drm-intel: drm/i915: Fix SKL+ 90/270 degree rotated plane coordinate computation drm/i915: Remove two invalid warns drm/i915: Rotated view does not need a fence drm/i915/fbc: fix CFB size calculation for gen8+ drm: i915: Wait for fences on new fb, not old drm/i915: Clean up DDI DDC/AUX CH sanitation drm/i915: Respect alternate_aux_channel for all DDI ports drm/i915/gen9: fix watermarks when using the pipe scaler drm/i915: Fix mismatched INIT power domain disabling during suspend drm/i915: fix a read size argument drm/i915: Use fence_write() from rpm resume drm/i915/gen9: fix DDB partitioning for multi-screen cases drm/i915: workaround sparse warning on variable length arrays drm/i915: keep declarations in i915_drv.h
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h5
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c10
-rw-r--r--drivers/gpu/drm/i915/i915_gem_fence.c21
-rw-r--r--drivers/gpu/drm/i915/i915_pci.c7
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c122
-rw-r--r--drivers/gpu/drm/i915/intel_device_info.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c5
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c75
-rw-r--r--drivers/gpu/drm/i915/intel_fbc.c4
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c24
11 files changed, 171 insertions, 108 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index bfb2efd8d4d4..18dfdd5c1b3b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1447,8 +1447,6 @@ static int i915_drm_suspend(struct drm_device *dev)
1447 1447
1448 dev_priv->suspend_count++; 1448 dev_priv->suspend_count++;
1449 1449
1450 intel_display_set_init_power(dev_priv, false);
1451
1452 intel_csr_ucode_suspend(dev_priv); 1450 intel_csr_ucode_suspend(dev_priv);
1453 1451
1454out: 1452out:
@@ -1466,6 +1464,8 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
1466 1464
1467 disable_rpm_wakeref_asserts(dev_priv); 1465 disable_rpm_wakeref_asserts(dev_priv);
1468 1466
1467 intel_display_set_init_power(dev_priv, false);
1468
1469 fw_csr = !IS_BROXTON(dev_priv) && 1469 fw_csr = !IS_BROXTON(dev_priv) &&
1470 suspend_to_idle(dev_priv) && dev_priv->csr.dmc_payload; 1470 suspend_to_idle(dev_priv) && dev_priv->csr.dmc_payload;
1471 /* 1471 /*
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8b9ee4e390c0..685e9e065287 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2883,6 +2883,11 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level,
2883extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, 2883extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
2884 unsigned long arg); 2884 unsigned long arg);
2885#endif 2885#endif
2886extern const struct dev_pm_ops i915_pm_ops;
2887
2888extern int i915_driver_load(struct pci_dev *pdev,
2889 const struct pci_device_id *ent);
2890extern void i915_driver_unload(struct drm_device *dev);
2886extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask); 2891extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask);
2887extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv); 2892extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv);
2888extern void i915_reset(struct drm_i915_private *dev_priv); 2893extern void i915_reset(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 947e82c2b175..23960de81b57 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3550,8 +3550,6 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
3550 3550
3551 vma->display_alignment = max_t(u64, vma->display_alignment, alignment); 3551 vma->display_alignment = max_t(u64, vma->display_alignment, alignment);
3552 3552
3553 WARN_ON(obj->pin_display > i915_vma_pin_count(vma));
3554
3555 i915_gem_object_flush_cpu_write_domain(obj); 3553 i915_gem_object_flush_cpu_write_domain(obj);
3556 3554
3557 old_write_domain = obj->base.write_domain; 3555 old_write_domain = obj->base.write_domain;
@@ -3588,7 +3586,6 @@ i915_gem_object_unpin_from_display_plane(struct i915_vma *vma)
3588 list_move_tail(&vma->vm_link, &vma->vm->inactive_list); 3586 list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
3589 3587
3590 i915_vma_unpin(vma); 3588 i915_vma_unpin(vma);
3591 WARN_ON(vma->obj->pin_display > i915_vma_pin_count(vma));
3592} 3589}
3593 3590
3594/** 3591/**
@@ -3745,7 +3742,12 @@ void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
3745 mappable = (vma->node.start + fence_size <= 3742 mappable = (vma->node.start + fence_size <=
3746 dev_priv->ggtt.mappable_end); 3743 dev_priv->ggtt.mappable_end);
3747 3744
3748 if (mappable && fenceable) 3745 /*
3746 * Explicitly disable for rotated VMA since the display does not
3747 * need the fence and the VMA is not accessible to other users.
3748 */
3749 if (mappable && fenceable &&
3750 vma->ggtt_view.type != I915_GGTT_VIEW_ROTATED)
3749 vma->flags |= I915_VMA_CAN_FENCE; 3751 vma->flags |= I915_VMA_CAN_FENCE;
3750 else 3752 else
3751 vma->flags &= ~I915_VMA_CAN_FENCE; 3753 vma->flags &= ~I915_VMA_CAN_FENCE;
diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
index 8df1fa7234e8..2c7ba0ee127c 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence.c
@@ -290,6 +290,8 @@ i915_vma_put_fence(struct i915_vma *vma)
290{ 290{
291 struct drm_i915_fence_reg *fence = vma->fence; 291 struct drm_i915_fence_reg *fence = vma->fence;
292 292
293 assert_rpm_wakelock_held(to_i915(vma->vm->dev));
294
293 if (!fence) 295 if (!fence)
294 return 0; 296 return 0;
295 297
@@ -341,6 +343,8 @@ i915_vma_get_fence(struct i915_vma *vma)
341 struct drm_i915_fence_reg *fence; 343 struct drm_i915_fence_reg *fence;
342 struct i915_vma *set = i915_gem_object_is_tiled(vma->obj) ? vma : NULL; 344 struct i915_vma *set = i915_gem_object_is_tiled(vma->obj) ? vma : NULL;
343 345
346 assert_rpm_wakelock_held(to_i915(vma->vm->dev));
347
344 /* Just update our place in the LRU if our fence is getting reused. */ 348 /* Just update our place in the LRU if our fence is getting reused. */
345 if (vma->fence) { 349 if (vma->fence) {
346 fence = vma->fence; 350 fence = vma->fence;
@@ -371,6 +375,12 @@ void i915_gem_restore_fences(struct drm_device *dev)
371 struct drm_i915_private *dev_priv = to_i915(dev); 375 struct drm_i915_private *dev_priv = to_i915(dev);
372 int i; 376 int i;
373 377
378 /* Note that this may be called outside of struct_mutex, by
379 * runtime suspend/resume. The barrier we require is enforced by
380 * rpm itself - all access to fences/GTT are only within an rpm
381 * wakeref, and to acquire that wakeref you must pass through here.
382 */
383
374 for (i = 0; i < dev_priv->num_fence_regs; i++) { 384 for (i = 0; i < dev_priv->num_fence_regs; i++) {
375 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; 385 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];
376 struct i915_vma *vma = reg->vma; 386 struct i915_vma *vma = reg->vma;
@@ -379,10 +389,17 @@ void i915_gem_restore_fences(struct drm_device *dev)
379 * Commit delayed tiling changes if we have an object still 389 * Commit delayed tiling changes if we have an object still
380 * attached to the fence, otherwise just clear the fence. 390 * attached to the fence, otherwise just clear the fence.
381 */ 391 */
382 if (vma && !i915_gem_object_is_tiled(vma->obj)) 392 if (vma && !i915_gem_object_is_tiled(vma->obj)) {
393 GEM_BUG_ON(!reg->dirty);
394 GEM_BUG_ON(vma->obj->fault_mappable);
395
396 list_move(&reg->link, &dev_priv->mm.fence_list);
397 vma->fence = NULL;
383 vma = NULL; 398 vma = NULL;
399 }
384 400
385 fence_update(reg, vma); 401 fence_write(reg, vma);
402 reg->vma = vma;
386 } 403 }
387} 404}
388 405
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 687c768833b3..31e6edd08dd0 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -431,9 +431,6 @@ static const struct pci_device_id pciidlist[] = {
431}; 431};
432MODULE_DEVICE_TABLE(pci, pciidlist); 432MODULE_DEVICE_TABLE(pci, pciidlist);
433 433
434extern int i915_driver_load(struct pci_dev *pdev,
435 const struct pci_device_id *ent);
436
437static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 434static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
438{ 435{
439 struct intel_device_info *intel_info = 436 struct intel_device_info *intel_info =
@@ -463,8 +460,6 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
463 return i915_driver_load(pdev, ent); 460 return i915_driver_load(pdev, ent);
464} 461}
465 462
466extern void i915_driver_unload(struct drm_device *dev);
467
468static void i915_pci_remove(struct pci_dev *pdev) 463static void i915_pci_remove(struct pci_dev *pdev)
469{ 464{
470 struct drm_device *dev = pci_get_drvdata(pdev); 465 struct drm_device *dev = pci_get_drvdata(pdev);
@@ -473,8 +468,6 @@ static void i915_pci_remove(struct pci_dev *pdev)
473 drm_dev_unref(dev); 468 drm_dev_unref(dev);
474} 469}
475 470
476extern const struct dev_pm_ops i915_pm_ops;
477
478static struct pci_driver i915_pci_driver = { 471static struct pci_driver i915_pci_driver = {
479 .name = DRIVER_NAME, 472 .name = DRIVER_NAME,
480 .id_table = pciidlist, 473 .id_table = pciidlist,
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c6e69e4cfa83..1f8af87c6294 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1031,6 +1031,77 @@ static u8 translate_iboost(u8 val)
1031 return mapping[val]; 1031 return mapping[val];
1032} 1032}
1033 1033
1034static void sanitize_ddc_pin(struct drm_i915_private *dev_priv,
1035 enum port port)
1036{
1037 const struct ddi_vbt_port_info *info =
1038 &dev_priv->vbt.ddi_port_info[port];
1039 enum port p;
1040
1041 if (!info->alternate_ddc_pin)
1042 return;
1043
1044 for_each_port_masked(p, (1 << port) - 1) {
1045 struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p];
1046
1047 if (info->alternate_ddc_pin != i->alternate_ddc_pin)
1048 continue;
1049
1050 DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, "
1051 "disabling port %c DVI/HDMI support\n",
1052 port_name(p), i->alternate_ddc_pin,
1053 port_name(port), port_name(p));
1054
1055 /*
1056 * If we have multiple ports supposedly sharing the
1057 * pin, then dvi/hdmi couldn't exist on the shared
1058 * port. Otherwise they share the same ddc bin and
1059 * system couldn't communicate with them separately.
1060 *
1061 * Due to parsing the ports in alphabetical order,
1062 * a higher port will always clobber a lower one.
1063 */
1064 i->supports_dvi = false;
1065 i->supports_hdmi = false;
1066 i->alternate_ddc_pin = 0;
1067 }
1068}
1069
1070static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
1071 enum port port)
1072{
1073 const struct ddi_vbt_port_info *info =
1074 &dev_priv->vbt.ddi_port_info[port];
1075 enum port p;
1076
1077 if (!info->alternate_aux_channel)
1078 return;
1079
1080 for_each_port_masked(p, (1 << port) - 1) {
1081 struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p];
1082
1083 if (info->alternate_aux_channel != i->alternate_aux_channel)
1084 continue;
1085
1086 DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, "
1087 "disabling port %c DP support\n",
1088 port_name(p), i->alternate_aux_channel,
1089 port_name(port), port_name(p));
1090
1091 /*
1092 * If we have multiple ports supposedlt sharing the
1093 * aux channel, then DP couldn't exist on the shared
1094 * port. Otherwise they share the same aux channel
1095 * and system couldn't communicate with them separately.
1096 *
1097 * Due to parsing the ports in alphabetical order,
1098 * a higher port will always clobber a lower one.
1099 */
1100 i->supports_dp = false;
1101 i->alternate_aux_channel = 0;
1102 }
1103}
1104
1034static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, 1105static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
1035 const struct bdb_header *bdb) 1106 const struct bdb_header *bdb)
1036{ 1107{
@@ -1105,54 +1176,15 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
1105 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port)); 1176 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
1106 1177
1107 if (is_dvi) { 1178 if (is_dvi) {
1108 if (port == PORT_E) { 1179 info->alternate_ddc_pin = ddc_pin;
1109 info->alternate_ddc_pin = ddc_pin; 1180
1110 /* if DDIE share ddc pin with other port, then 1181 sanitize_ddc_pin(dev_priv, port);
1111 * dvi/hdmi couldn't exist on the shared port.
1112 * Otherwise they share the same ddc bin and system
1113 * couldn't communicate with them seperately. */
1114 if (ddc_pin == DDC_PIN_B) {
1115 dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
1116 dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
1117 } else if (ddc_pin == DDC_PIN_C) {
1118 dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
1119 dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
1120 } else if (ddc_pin == DDC_PIN_D) {
1121 dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
1122 dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
1123 }
1124 } else if (ddc_pin == DDC_PIN_B && port != PORT_B)
1125 DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
1126 else if (ddc_pin == DDC_PIN_C && port != PORT_C)
1127 DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
1128 else if (ddc_pin == DDC_PIN_D && port != PORT_D)
1129 DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
1130 } 1182 }
1131 1183
1132 if (is_dp) { 1184 if (is_dp) {
1133 if (port == PORT_E) { 1185 info->alternate_aux_channel = aux_channel;
1134 info->alternate_aux_channel = aux_channel; 1186
1135 /* if DDIE share aux channel with other port, then 1187 sanitize_aux_ch(dev_priv, port);
1136 * DP couldn't exist on the shared port. Otherwise
1137 * they share the same aux channel and system
1138 * couldn't communicate with them seperately. */
1139 if (aux_channel == DP_AUX_A)
1140 dev_priv->vbt.ddi_port_info[PORT_A].supports_dp = 0;
1141 else if (aux_channel == DP_AUX_B)
1142 dev_priv->vbt.ddi_port_info[PORT_B].supports_dp = 0;
1143 else if (aux_channel == DP_AUX_C)
1144 dev_priv->vbt.ddi_port_info[PORT_C].supports_dp = 0;
1145 else if (aux_channel == DP_AUX_D)
1146 dev_priv->vbt.ddi_port_info[PORT_D].supports_dp = 0;
1147 }
1148 else if (aux_channel == DP_AUX_A && port != PORT_A)
1149 DRM_DEBUG_KMS("Unexpected AUX channel for port A\n");
1150 else if (aux_channel == DP_AUX_B && port != PORT_B)
1151 DRM_DEBUG_KMS("Unexpected AUX channel for port B\n");
1152 else if (aux_channel == DP_AUX_C && port != PORT_C)
1153 DRM_DEBUG_KMS("Unexpected AUX channel for port C\n");
1154 else if (aux_channel == DP_AUX_D && port != PORT_D)
1155 DRM_DEBUG_KMS("Unexpected AUX channel for port D\n");
1156 } 1188 }
1157 1189
1158 if (bdb->version >= 158) { 1190 if (bdb->version >= 158) {
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 73b6858600ac..1b20e160bc1f 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
192 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; 192 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
193 const int s_max = 3, ss_max = 3, eu_max = 8; 193 const int s_max = 3, ss_max = 3, eu_max = 8;
194 int s, ss; 194 int s, ss;
195 u32 fuse2, eu_disable[s_max]; 195 u32 fuse2, eu_disable[3]; /* s_max */
196 196
197 fuse2 = I915_READ(GEN8_FUSE2); 197 fuse2 = I915_READ(GEN8_FUSE2);
198 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT; 198 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fbcfed63a76e..0ad1879bfd9d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2978,7 +2978,8 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
2978 /* Rotate src coordinates to match rotated GTT view */ 2978 /* Rotate src coordinates to match rotated GTT view */
2979 if (intel_rotation_90_or_270(rotation)) 2979 if (intel_rotation_90_or_270(rotation))
2980 drm_rect_rotate(&plane_state->base.src, 2980 drm_rect_rotate(&plane_state->base.src,
2981 fb->width, fb->height, DRM_ROTATE_270); 2981 fb->width << 16, fb->height << 16,
2982 DRM_ROTATE_270);
2982 2983
2983 /* 2984 /*
2984 * Handle the AUX surface first since 2985 * Handle the AUX surface first since
@@ -14310,7 +14311,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
14310 14311
14311 for_each_plane_in_state(state, plane, plane_state, i) { 14312 for_each_plane_in_state(state, plane, plane_state, i) {
14312 struct intel_plane_state *intel_plane_state = 14313 struct intel_plane_state *intel_plane_state =
14313 to_intel_plane_state(plane_state); 14314 to_intel_plane_state(plane->state);
14314 14315
14315 if (!intel_plane_state->wait_req) 14316 if (!intel_plane_state->wait_req)
14316 continue; 14317 continue;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 14a3cf0b7213..3581b5a7f716 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1108,6 +1108,44 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
1108 return ret; 1108 return ret;
1109} 1109}
1110 1110
1111static enum port intel_aux_port(struct drm_i915_private *dev_priv,
1112 enum port port)
1113{
1114 const struct ddi_vbt_port_info *info =
1115 &dev_priv->vbt.ddi_port_info[port];
1116 enum port aux_port;
1117
1118 if (!info->alternate_aux_channel) {
1119 DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n",
1120 port_name(port), port_name(port));
1121 return port;
1122 }
1123
1124 switch (info->alternate_aux_channel) {
1125 case DP_AUX_A:
1126 aux_port = PORT_A;
1127 break;
1128 case DP_AUX_B:
1129 aux_port = PORT_B;
1130 break;
1131 case DP_AUX_C:
1132 aux_port = PORT_C;
1133 break;
1134 case DP_AUX_D:
1135 aux_port = PORT_D;
1136 break;
1137 default:
1138 MISSING_CASE(info->alternate_aux_channel);
1139 aux_port = PORT_A;
1140 break;
1141 }
1142
1143 DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n",
1144 port_name(aux_port), port_name(port));
1145
1146 return aux_port;
1147}
1148
1111static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv, 1149static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
1112 enum port port) 1150 enum port port)
1113{ 1151{
@@ -1168,36 +1206,9 @@ static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
1168 } 1206 }
1169} 1207}
1170 1208
1171/*
1172 * On SKL we don't have Aux for port E so we rely
1173 * on VBT to set a proper alternate aux channel.
1174 */
1175static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
1176{
1177 const struct ddi_vbt_port_info *info =
1178 &dev_priv->vbt.ddi_port_info[PORT_E];
1179
1180 switch (info->alternate_aux_channel) {
1181 case DP_AUX_A:
1182 return PORT_A;
1183 case DP_AUX_B:
1184 return PORT_B;
1185 case DP_AUX_C:
1186 return PORT_C;
1187 case DP_AUX_D:
1188 return PORT_D;
1189 default:
1190 MISSING_CASE(info->alternate_aux_channel);
1191 return PORT_A;
1192 }
1193}
1194
1195static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv, 1209static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1196 enum port port) 1210 enum port port)
1197{ 1211{
1198 if (port == PORT_E)
1199 port = skl_porte_aux_port(dev_priv);
1200
1201 switch (port) { 1212 switch (port) {
1202 case PORT_A: 1213 case PORT_A:
1203 case PORT_B: 1214 case PORT_B:
@@ -1213,9 +1224,6 @@ static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1213static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv, 1224static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
1214 enum port port, int index) 1225 enum port port, int index)
1215{ 1226{
1216 if (port == PORT_E)
1217 port = skl_porte_aux_port(dev_priv);
1218
1219 switch (port) { 1227 switch (port) {
1220 case PORT_A: 1228 case PORT_A:
1221 case PORT_B: 1229 case PORT_B:
@@ -1253,7 +1261,8 @@ static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
1253static void intel_aux_reg_init(struct intel_dp *intel_dp) 1261static void intel_aux_reg_init(struct intel_dp *intel_dp)
1254{ 1262{
1255 struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp)); 1263 struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
1256 enum port port = dp_to_dig_port(intel_dp)->port; 1264 enum port port = intel_aux_port(dev_priv,
1265 dp_to_dig_port(intel_dp)->port);
1257 int i; 1266 int i;
1258 1267
1259 intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port); 1268 intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port);
@@ -3551,8 +3560,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
3551 /* Read the eDP Display control capabilities registers */ 3560 /* Read the eDP Display control capabilities registers */
3552 if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && 3561 if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
3553 drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, 3562 drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
3554 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) == 3563 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
3555 sizeof(intel_dp->edp_dpcd))) 3564 sizeof(intel_dp->edp_dpcd))
3556 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd), 3565 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
3557 intel_dp->edp_dpcd); 3566 intel_dp->edp_dpcd);
3558 3567
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index faa67624e1ed..c43dd9abce79 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -104,8 +104,10 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
104 int lines; 104 int lines;
105 105
106 intel_fbc_get_plane_source_size(cache, NULL, &lines); 106 intel_fbc_get_plane_source_size(cache, NULL, &lines);
107 if (INTEL_INFO(dev_priv)->gen >= 7) 107 if (INTEL_GEN(dev_priv) == 7)
108 lines = min(lines, 2048); 108 lines = min(lines, 2048);
109 else if (INTEL_GEN(dev_priv) >= 8)
110 lines = min(lines, 2560);
109 111
110 /* Hardware needs the full buffer stride, not just the active area. */ 112 /* Hardware needs the full buffer stride, not just the active area. */
111 return lines * cache->fb.stride; 113 return lines * cache->fb.stride;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index a2f751cd187a..db24f898853c 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3362,13 +3362,15 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
3362 int num_active; 3362 int num_active;
3363 int id, i; 3363 int id, i;
3364 3364
3365 /* Clear the partitioning for disabled planes. */
3366 memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe]));
3367 memset(ddb->y_plane[pipe], 0, sizeof(ddb->y_plane[pipe]));
3368
3365 if (WARN_ON(!state)) 3369 if (WARN_ON(!state))
3366 return 0; 3370 return 0;
3367 3371
3368 if (!cstate->base.active) { 3372 if (!cstate->base.active) {
3369 ddb->pipe[pipe].start = ddb->pipe[pipe].end = 0; 3373 ddb->pipe[pipe].start = ddb->pipe[pipe].end = 0;
3370 memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe]));
3371 memset(ddb->y_plane[pipe], 0, sizeof(ddb->y_plane[pipe]));
3372 return 0; 3374 return 0;
3373 } 3375 }
3374 3376
@@ -3468,12 +3470,6 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
3468 return 0; 3470 return 0;
3469} 3471}
3470 3472
3471static uint32_t skl_pipe_pixel_rate(const struct intel_crtc_state *config)
3472{
3473 /* TODO: Take into account the scalers once we support them */
3474 return config->base.adjusted_mode.crtc_clock;
3475}
3476
3477/* 3473/*
3478 * The max latency should be 257 (max the punit can code is 255 and we add 2us 3474 * The max latency should be 257 (max the punit can code is 255 and we add 2us
3479 * for the read latency) and cpp should always be <= 8, so that 3475 * for the read latency) and cpp should always be <= 8, so that
@@ -3524,7 +3520,7 @@ static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cst
3524 * Adjusted plane pixel rate is just the pipe's adjusted pixel rate 3520 * Adjusted plane pixel rate is just the pipe's adjusted pixel rate
3525 * with additional adjustments for plane-specific scaling. 3521 * with additional adjustments for plane-specific scaling.
3526 */ 3522 */
3527 adjusted_pixel_rate = skl_pipe_pixel_rate(cstate); 3523 adjusted_pixel_rate = ilk_pipe_pixel_rate(cstate);
3528 downscale_amount = skl_plane_downscale_amount(pstate); 3524 downscale_amount = skl_plane_downscale_amount(pstate);
3529 3525
3530 pixel_rate = adjusted_pixel_rate * downscale_amount >> 16; 3526 pixel_rate = adjusted_pixel_rate * downscale_amount >> 16;
@@ -3736,11 +3732,11 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
3736 if (!cstate->base.active) 3732 if (!cstate->base.active)
3737 return 0; 3733 return 0;
3738 3734
3739 if (WARN_ON(skl_pipe_pixel_rate(cstate) == 0)) 3735 if (WARN_ON(ilk_pipe_pixel_rate(cstate) == 0))
3740 return 0; 3736 return 0;
3741 3737
3742 return DIV_ROUND_UP(8 * cstate->base.adjusted_mode.crtc_htotal * 1000, 3738 return DIV_ROUND_UP(8 * cstate->base.adjusted_mode.crtc_htotal * 1000,
3743 skl_pipe_pixel_rate(cstate)); 3739 ilk_pipe_pixel_rate(cstate));
3744} 3740}
3745 3741
3746static void skl_compute_transition_wm(struct intel_crtc_state *cstate, 3742static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
@@ -4050,6 +4046,12 @@ skl_compute_ddb(struct drm_atomic_state *state)
4050 intel_state->wm_results.dirty_pipes = ~0; 4046 intel_state->wm_results.dirty_pipes = ~0;
4051 } 4047 }
4052 4048
4049 /*
4050 * We're not recomputing for the pipes not included in the commit, so
4051 * make sure we start with the current state.
4052 */
4053 memcpy(ddb, &dev_priv->wm.skl_hw.ddb, sizeof(*ddb));
4054
4053 for_each_intel_crtc_mask(dev, intel_crtc, realloc_pipes) { 4055 for_each_intel_crtc_mask(dev, intel_crtc, realloc_pipes) {
4054 struct intel_crtc_state *cstate; 4056 struct intel_crtc_state *cstate;
4055 4057