Skip to content

Commit 5fd9df6

Browse files
committed
drm/i915: Kill sink_crc for good
It was originally introduced following the VESA spec in order to validate PSR. However we found so many issues around sink_crc that instead of helping PSR development it only brought another layer of trouble to the table. So, sink_crc has been a black whole for us in question of time, effort and hope. First of the problems is that HW statement is clear: "Do not attempt to use aux communication with PSR enabled". So the main reason behind sink_crc is already compromised. For a while we had hope on the aux-mutex could workaround this problem on SKL+ platforms, but that mutex was not reliable, not tested, and we shouldn't use according to HW engineers. Also, nor source, nor sink designed and implemented the sink_crc to be used like we are trying to use here. Well, the sink side of things is also apparently not prepared for this case. Each panel that we tried seemed to have a different behavior with same code and same source. So, for all the time we lost on trying to ducktape all these different issues I believe it is now time to move PSR to a more reliable validation. Maybe not a perfect one as we dreamed for this sink_crc, but at least more reliable. Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180705192528.30515-1-rodrigo.vivi@intel.com
1 parent 01f8f33 commit 5fd9df6

File tree

3 files changed

+0
-206
lines changed

3 files changed

+0
-206
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,86 +2767,6 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_edp_psr_debug_fops,
27672767
i915_edp_psr_debug_get, i915_edp_psr_debug_set,
27682768
"%llu\n");
27692769

2770-
static int i915_sink_crc(struct seq_file *m, void *data)
2771-
{
2772-
struct drm_i915_private *dev_priv = node_to_i915(m->private);
2773-
struct drm_device *dev = &dev_priv->drm;
2774-
struct intel_connector *connector;
2775-
struct drm_connector_list_iter conn_iter;
2776-
struct intel_dp *intel_dp = NULL;
2777-
struct drm_modeset_acquire_ctx ctx;
2778-
int ret;
2779-
u8 crc[6];
2780-
2781-
drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
2782-
2783-
drm_connector_list_iter_begin(dev, &conn_iter);
2784-
2785-
for_each_intel_connector_iter(connector, &conn_iter) {
2786-
struct drm_crtc *crtc;
2787-
struct drm_connector_state *state;
2788-
struct intel_crtc_state *crtc_state;
2789-
2790-
if (connector->base.connector_type != DRM_MODE_CONNECTOR_eDP)
2791-
continue;
2792-
2793-
retry:
2794-
ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
2795-
if (ret)
2796-
goto err;
2797-
2798-
state = connector->base.state;
2799-
if (!state->best_encoder)
2800-
continue;
2801-
2802-
crtc = state->crtc;
2803-
ret = drm_modeset_lock(&crtc->mutex, &ctx);
2804-
if (ret)
2805-
goto err;
2806-
2807-
crtc_state = to_intel_crtc_state(crtc->state);
2808-
if (!crtc_state->base.active)
2809-
continue;
2810-
2811-
/*
2812-
* We need to wait for all crtc updates to complete, to make
2813-
* sure any pending modesets and plane updates are completed.
2814-
*/
2815-
if (crtc_state->base.commit) {
2816-
ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
2817-
2818-
if (ret)
2819-
goto err;
2820-
}
2821-
2822-
intel_dp = enc_to_intel_dp(state->best_encoder);
2823-
2824-
ret = intel_dp_sink_crc(intel_dp, crtc_state, crc);
2825-
if (ret)
2826-
goto err;
2827-
2828-
seq_printf(m, "%02x%02x%02x%02x%02x%02x\n",
2829-
crc[0], crc[1], crc[2],
2830-
crc[3], crc[4], crc[5]);
2831-
goto out;
2832-
2833-
err:
2834-
if (ret == -EDEADLK) {
2835-
ret = drm_modeset_backoff(&ctx);
2836-
if (!ret)
2837-
goto retry;
2838-
}
2839-
goto out;
2840-
}
2841-
ret = -ENODEV;
2842-
out:
2843-
drm_connector_list_iter_end(&conn_iter);
2844-
drm_modeset_drop_locks(&ctx);
2845-
drm_modeset_acquire_fini(&ctx);
2846-
2847-
return ret;
2848-
}
2849-
28502770
static int i915_energy_uJ(struct seq_file *m, void *data)
28512771
{
28522772
struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -4792,7 +4712,6 @@ static const struct drm_info_list i915_debugfs_list[] = {
47924712
{"i915_ppgtt_info", i915_ppgtt_info, 0},
47934713
{"i915_llc", i915_llc, 0},
47944714
{"i915_edp_psr_status", i915_edp_psr_status, 0},
4795-
{"i915_sink_crc_eDP1", i915_sink_crc, 0},
47964715
{"i915_energy_uJ", i915_energy_uJ, 0},
47974716
{"i915_runtime_pm_status", i915_runtime_pm_status, 0},
47984717
{"i915_power_domain_info", i915_power_domain_info, 0},

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -3874,129 +3874,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
38743874
intel_dp->is_mst);
38753875
}
38763876

3877-
static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp,
3878-
struct intel_crtc_state *crtc_state, bool disable_wa)
3879-
{
3880-
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3881-
struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
3882-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
3883-
u8 buf;
3884-
int ret = 0;
3885-
int count = 0;
3886-
int attempts = 10;
3887-
3888-
if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
3889-
DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
3890-
ret = -EIO;
3891-
goto out;
3892-
}
3893-
3894-
if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
3895-
buf & ~DP_TEST_SINK_START) < 0) {
3896-
DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
3897-
ret = -EIO;
3898-
goto out;
3899-
}
3900-
3901-
do {
3902-
intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
3903-
3904-
if (drm_dp_dpcd_readb(&intel_dp->aux,
3905-
DP_TEST_SINK_MISC, &buf) < 0) {
3906-
ret = -EIO;
3907-
goto out;
3908-
}
3909-
count = buf & DP_TEST_COUNT_MASK;
3910-
} while (--attempts && count);
3911-
3912-
if (attempts == 0) {
3913-
DRM_DEBUG_KMS("TIMEOUT: Sink CRC counter is not zeroed after calculation is stopped\n");
3914-
ret = -ETIMEDOUT;
3915-
}
3916-
3917-
out:
3918-
if (disable_wa)
3919-
hsw_enable_ips(crtc_state);
3920-
return ret;
3921-
}
3922-
3923-
static int intel_dp_sink_crc_start(struct intel_dp *intel_dp,
3924-
struct intel_crtc_state *crtc_state)
3925-
{
3926-
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3927-
struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
3928-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
3929-
u8 buf;
3930-
int ret;
3931-
3932-
if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
3933-
return -EIO;
3934-
3935-
if (!(buf & DP_TEST_CRC_SUPPORTED))
3936-
return -ENOTTY;
3937-
3938-
if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
3939-
return -EIO;
3940-
3941-
if (buf & DP_TEST_SINK_START) {
3942-
ret = intel_dp_sink_crc_stop(intel_dp, crtc_state, false);
3943-
if (ret)
3944-
return ret;
3945-
}
3946-
3947-
hsw_disable_ips(crtc_state);
3948-
3949-
if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
3950-
buf | DP_TEST_SINK_START) < 0) {
3951-
hsw_enable_ips(crtc_state);
3952-
return -EIO;
3953-
}
3954-
3955-
intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
3956-
return 0;
3957-
}
3958-
3959-
int intel_dp_sink_crc(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, u8 *crc)
3960-
{
3961-
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3962-
struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
3963-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
3964-
u8 buf;
3965-
int count, ret;
3966-
int attempts = 6;
3967-
3968-
ret = intel_dp_sink_crc_start(intel_dp, crtc_state);
3969-
if (ret)
3970-
return ret;
3971-
3972-
do {
3973-
intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
3974-
3975-
if (drm_dp_dpcd_readb(&intel_dp->aux,
3976-
DP_TEST_SINK_MISC, &buf) < 0) {
3977-
ret = -EIO;
3978-
goto stop;
3979-
}
3980-
count = buf & DP_TEST_COUNT_MASK;
3981-
3982-
} while (--attempts && count == 0);
3983-
3984-
if (attempts == 0) {
3985-
DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
3986-
ret = -ETIMEDOUT;
3987-
goto stop;
3988-
}
3989-
3990-
if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) {
3991-
ret = -EIO;
3992-
goto stop;
3993-
}
3994-
3995-
stop:
3996-
intel_dp_sink_crc_stop(intel_dp, crtc_state, true);
3997-
return ret;
3998-
}
3999-
40003877
static bool
40013878
intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
40023879
{

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,8 +1682,6 @@ void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
16821682
void intel_dp_encoder_reset(struct drm_encoder *encoder);
16831683
void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
16841684
void intel_dp_encoder_destroy(struct drm_encoder *encoder);
1685-
int intel_dp_sink_crc(struct intel_dp *intel_dp,
1686-
struct intel_crtc_state *crtc_state, u8 *crc);
16871685
bool intel_dp_compute_config(struct intel_encoder *encoder,
16881686
struct intel_crtc_state *pipe_config,
16891687
struct drm_connector_state *conn_state);

0 commit comments

Comments
 (0)