Skip to content

Commit 659a182

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "Fixes for i915, amdgpu/radeon and imx. The IMX fix is for an autoloading regression found in Fedora. The radeon fixes, are the same fix to amdgpu/radeon to avoid a hardware lockup in some circumstances with a bad mode, and a double free bug I took a few hours chasing down the other morning. The i915 fixes are across the board, all stable material, and fixing some hangs and suspend/resume issues, along with a live status regressions" * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading drm/amdgpu: make sure vertical front porch is at least 1 drm/radeon: make sure vertical front porch is at least 1 drm/amdgpu: set metadata pointer to NULL after freeing. drm/i915: Make RPS EI/thresholds multiple of 25 on SNB-BDW drm/i915: Fake HDMI live status drm/i915: Fix eDP low vswing for Broadwell drm/i915/ddi: Fix eDP VDD handling during booting and suspend/resume drm/i915: Fix system resume if PCI device remained enabled drm/i915: Avoid stalling on pending flips for legacy cursor updates
2 parents 9caa7e7 + fca0971 commit 659a182

File tree

11 files changed

+84
-16
lines changed

11 files changed

+84
-16
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
541541
if (!metadata_size) {
542542
if (bo->metadata_size) {
543543
kfree(bo->metadata);
544+
bo->metadata = NULL;
544545
bo->metadata_size = 0;
545546
}
546547
return 0;

drivers/gpu/drm/amd/amdgpu/atombios_encoders.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder,
298298
&& (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
299299
adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
300300

301+
/* vertical FP must be at least 1 */
302+
if (mode->crtc_vsync_start == mode->crtc_vdisplay)
303+
adjusted_mode->crtc_vsync_start++;
304+
301305
/* get the native mode for scaling */
302306
if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
303307
amdgpu_panel_mode_fixup(encoder, adjusted_mode);

drivers/gpu/drm/i915/i915_drv.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static int i915_drm_resume(struct drm_device *dev)
792792
static int i915_drm_resume_early(struct drm_device *dev)
793793
{
794794
struct drm_i915_private *dev_priv = dev->dev_private;
795-
int ret = 0;
795+
int ret;
796796

797797
/*
798798
* We have a resume ordering issue with the snd-hda driver also
@@ -803,6 +803,36 @@ static int i915_drm_resume_early(struct drm_device *dev)
803803
* FIXME: This should be solved with a special hdmi sink device or
804804
* similar so that power domains can be employed.
805805
*/
806+
807+
/*
808+
* Note that we need to set the power state explicitly, since we
809+
* powered off the device during freeze and the PCI core won't power
810+
* it back up for us during thaw. Powering off the device during
811+
* freeze is not a hard requirement though, and during the
812+
* suspend/resume phases the PCI core makes sure we get here with the
813+
* device powered on. So in case we change our freeze logic and keep
814+
* the device powered we can also remove the following set power state
815+
* call.
816+
*/
817+
ret = pci_set_power_state(dev->pdev, PCI_D0);
818+
if (ret) {
819+
DRM_ERROR("failed to set PCI D0 power state (%d)\n", ret);
820+
goto out;
821+
}
822+
823+
/*
824+
* Note that pci_enable_device() first enables any parent bridge
825+
* device and only then sets the power state for this device. The
826+
* bridge enabling is a nop though, since bridge devices are resumed
827+
* first. The order of enabling power and enabling the device is
828+
* imposed by the PCI core as described above, so here we preserve the
829+
* same order for the freeze/thaw phases.
830+
*
831+
* TODO: eventually we should remove pci_disable_device() /
832+
* pci_enable_enable_device() from suspend/resume. Due to how they
833+
* depend on the device enable refcount we can't anyway depend on them
834+
* disabling/enabling the device.
835+
*/
806836
if (pci_enable_device(dev->pdev)) {
807837
ret = -EIO;
808838
goto out;

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2907,7 +2907,14 @@ enum skl_disp_power_wells {
29072907
#define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
29082908
#define BXT_RP_STATE_CAP _MMIO(0x138170)
29092909

2910-
#define INTERVAL_1_28_US(us) (((us) * 100) >> 7)
2910+
/*
2911+
* Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS
2912+
* 8300) freezing up around GPU hangs. Looks as if even
2913+
* scheduling/timer interrupts start misbehaving if the RPS
2914+
* EI/thresholds are "bad", leading to a very sluggish or even
2915+
* frozen machine.
2916+
*/
2917+
#define INTERVAL_1_28_US(us) roundup(((us) * 100) >> 7, 25)
29112918
#define INTERVAL_1_33_US(us) (((us) * 3) >> 2)
29122919
#define INTERVAL_0_833_US(us) (((us) * 6) / 5)
29132920
#define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \

drivers/gpu/drm/i915/intel_ddi.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,17 @@ void intel_prepare_ddi_buffer(struct intel_encoder *encoder)
443443
} else if (IS_BROADWELL(dev_priv)) {
444444
ddi_translations_fdi = bdw_ddi_translations_fdi;
445445
ddi_translations_dp = bdw_ddi_translations_dp;
446-
ddi_translations_edp = bdw_ddi_translations_edp;
446+
447+
if (dev_priv->edp_low_vswing) {
448+
ddi_translations_edp = bdw_ddi_translations_edp;
449+
n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp);
450+
} else {
451+
ddi_translations_edp = bdw_ddi_translations_dp;
452+
n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
453+
}
454+
447455
ddi_translations_hdmi = bdw_ddi_translations_hdmi;
448-
n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp);
456+
449457
n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
450458
n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
451459
hdmi_default_entry = 7;
@@ -3201,12 +3209,6 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
32013209
intel_ddi_clock_get(encoder, pipe_config);
32023210
}
32033211

3204-
static void intel_ddi_destroy(struct drm_encoder *encoder)
3205-
{
3206-
/* HDMI has nothing special to destroy, so we can go with this. */
3207-
intel_dp_encoder_destroy(encoder);
3208-
}
3209-
32103212
static bool intel_ddi_compute_config(struct intel_encoder *encoder,
32113213
struct intel_crtc_state *pipe_config)
32123214
{
@@ -3225,7 +3227,8 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
32253227
}
32263228

32273229
static const struct drm_encoder_funcs intel_ddi_funcs = {
3228-
.destroy = intel_ddi_destroy,
3230+
.reset = intel_dp_encoder_reset,
3231+
.destroy = intel_dp_encoder_destroy,
32293232
};
32303233

32313234
static struct intel_connector *
@@ -3324,6 +3327,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
33243327
intel_encoder->post_disable = intel_ddi_post_disable;
33253328
intel_encoder->get_hw_state = intel_ddi_get_hw_state;
33263329
intel_encoder->get_config = intel_ddi_get_config;
3330+
intel_encoder->suspend = intel_dp_encoder_suspend;
33273331

33283332
intel_dig_port->port = port;
33293333
intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &

drivers/gpu/drm/i915/intel_display.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13351,6 +13351,9 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
1335113351
}
1335213352

1335313353
for_each_crtc_in_state(state, crtc, crtc_state, i) {
13354+
if (state->legacy_cursor_update)
13355+
continue;
13356+
1335413357
ret = intel_crtc_wait_for_pending_flips(crtc);
1335513358
if (ret)
1335613359
return ret;

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4898,7 +4898,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
48984898
kfree(intel_dig_port);
48994899
}
49004900

4901-
static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
4901+
void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
49024902
{
49034903
struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
49044904

@@ -4940,7 +4940,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
49404940
edp_panel_vdd_schedule_off(intel_dp);
49414941
}
49424942

4943-
static void intel_dp_encoder_reset(struct drm_encoder *encoder)
4943+
void intel_dp_encoder_reset(struct drm_encoder *encoder)
49444944
{
49454945
struct intel_dp *intel_dp;
49464946

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,8 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
12381238
void intel_dp_start_link_train(struct intel_dp *intel_dp);
12391239
void intel_dp_stop_link_train(struct intel_dp *intel_dp);
12401240
void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
1241+
void intel_dp_encoder_reset(struct drm_encoder *encoder);
1242+
void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
12411243
void intel_dp_encoder_destroy(struct drm_encoder *encoder);
12421244
int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
12431245
bool intel_dp_compute_config(struct intel_encoder *encoder,

drivers/gpu/drm/i915/intel_hdmi.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,16 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
14151415
hdmi_to_dig_port(intel_hdmi));
14161416
}
14171417

1418-
if (!live_status)
1419-
DRM_DEBUG_KMS("Live status not up!");
1418+
if (!live_status) {
1419+
DRM_DEBUG_KMS("HDMI live status down\n");
1420+
/*
1421+
* Live status register is not reliable on all intel platforms.
1422+
* So consider live_status only for certain platforms, for
1423+
* others, read EDID to determine presence of sink.
1424+
*/
1425+
if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv))
1426+
live_status = true;
1427+
}
14201428

14211429
intel_hdmi_unset_edid(connector);
14221430

drivers/gpu/drm/radeon/atombios_encoders.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
310310
&& (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
311311
adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
312312

313+
/* vertical FP must be at least 1 */
314+
if (mode->crtc_vsync_start == mode->crtc_vdisplay)
315+
adjusted_mode->crtc_vsync_start++;
316+
313317
/* get the native mode for scaling */
314318
if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
315319
radeon_panel_mode_fixup(encoder, adjusted_mode);

drivers/gpu/ipu-v3/ipu-common.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
10681068
goto err_register;
10691069
}
10701070

1071-
pdev->dev.of_node = of_node;
10721071
pdev->dev.parent = dev;
10731072

10741073
ret = platform_device_add_data(pdev, &reg->pdata,
@@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
10791078
platform_device_put(pdev);
10801079
goto err_register;
10811080
}
1081+
1082+
/*
1083+
* Set of_node only after calling platform_device_add. Otherwise
1084+
* the platform:imx-ipuv3-crtc modalias won't be used.
1085+
*/
1086+
pdev->dev.of_node = of_node;
10821087
}
10831088

10841089
return 0;

0 commit comments

Comments
 (0)