From patchwork Thu Jan 9 19:47:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 3463011 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 959119F374 for ; Thu, 9 Jan 2014 19:44:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAEB8201DE for ; Thu, 9 Jan 2014 19:44:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 984E02012F for ; Thu, 9 Jan 2014 19:44:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77BA4FC12D for ; Thu, 9 Jan 2014 11:44:17 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f43.google.com (mail-qe0-f43.google.com [209.85.128.43]) by gabe.freedesktop.org (Postfix) with ESMTP id DF21AFA322; Thu, 9 Jan 2014 11:44:00 -0800 (PST) Received: by mail-qe0-f43.google.com with SMTP id jy17so3504347qeb.2 for ; Thu, 09 Jan 2014 11:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5LZVWedncjPilG4k98mcTDoy/snxIINUI0E+g8iIavQ=; b=KwDebLQjGgYMf2n8Ra1YpnudJMTPXKHv/I/Aj3zkwbckV3YXn3+mVh9x4Yj/hYFE8f 5+D1WNvilvZ1EudfeFB1pzuY1mTCBBJT/Kw97uIaxmQZSOZ6Ab20QG34kR7uIwoU34AI TaNyIllkqW1L87U3fW0QSwc09yri8DJofxHjb5POTESOmxLgSDOmZkcaiTOKsW/mHKfi DnekY12mq73xEftppPrLjG7TruGRhbOMlCLKaM4H1ECdMPc3Ro5pVNb49AUNcJduDibR QCB+gHp8SzWpvYfDiGybeUjruez4Q7MOAD1Qe1nE4PTd61fy7CKtAG7XMUmhSY3M9TmY veNA== X-Received: by 10.224.51.196 with SMTP id e4mr174208qag.16.1389296640349; Thu, 09 Jan 2014 11:44:00 -0800 (PST) Received: from localhost.localdomain ([189.40.74.165]) by mx.google.com with ESMTPSA id m8sm7036530qel.17.2014.01.09.11.43.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2014 11:43:59 -0800 (PST) From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Subject: [PATCH] drm/i915: debugfs: Add support for probing DP sink CRC. Date: Thu, 9 Jan 2014 17:47:10 -0200 Message-Id: <1389296830-3480-1-git-send-email-rodrigo.vivi@gmail.com> X-Mailer: git-send-email 1.8.3.1 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This debugfs interface will allow intel-gpu-tools test case to verify if screen has been updated properly on cases like PSR. Since the current target is PSR we will provide only the CRC check for eDP panels. We can latter extend it to all available DP panels. --- drivers/gpu/drm/i915/i915_debugfs.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++++++ include/drm/drm_dp_helper.h | 10 ++++++++++ 4 files changed, 74 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 75a489e..0facff1 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1876,6 +1876,29 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) return 0; } +static int i915_sink_crc(struct seq_file *m, void *data) +{ + struct drm_info_node *node = m->private; + struct drm_device *dev = node->minor->dev; + struct intel_encoder *encoder; + struct intel_dp *intel_dp = NULL; + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) + if (encoder->type == INTEL_OUTPUT_EDP) { + intel_dp = enc_to_intel_dp(&encoder->base); + + intel_dp_sink_crc(intel_dp); + seq_printf(m, "%02hx%02hx%02hx%02hx%02hx%02hx\n", + intel_dp->sink_crc.r_cr[0], + intel_dp->sink_crc.r_cr[1], + intel_dp->sink_crc.g_y[0], + intel_dp->sink_crc.g_y[1], + intel_dp->sink_crc.b_cb[0], + intel_dp->sink_crc.b_cb[1]); + } + return 0; +} + static int i915_energy_uJ(struct seq_file *m, void *data) { struct drm_info_node *node = m->private; @@ -3232,6 +3255,7 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_dpio", i915_dpio_info, 0}, {"i915_llc", i915_llc, 0}, {"i915_edp_psr_status", i915_edp_psr_status, 0}, + {"i915_sink_crc", i915_sink_crc, 0}, {"i915_energy_uJ", i915_energy_uJ, 0}, {"i915_pc8_status", i915_pc8_status, 0}, {"i915_power_domain_info", i915_power_domain_info, 0}, diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 7df5085..9933327 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2786,6 +2786,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) struct drm_i915_private *dev_priv = dev->dev_private; char dpcd_hex_dump[sizeof(intel_dp->dpcd) * 3]; + u8 buf[1]; if (intel_dp_aux_native_read_retry(intel_dp, 0x000, intel_dp->dpcd, sizeof(intel_dp->dpcd)) == 0) @@ -2810,6 +2811,9 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) } } + intel_dp_aux_native_read_retry(intel_dp, DP_TEST_SINK_MISC, buf, 1); + intel_dp->sink_crc.supported = buf[0] & DP_TEST_CRC_SUPPORTED; + if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT)) return true; /* native DP sink */ @@ -2846,6 +2850,33 @@ intel_dp_probe_oui(struct intel_dp *intel_dp) ironlake_edp_panel_vdd_off(intel_dp, false); } +void intel_dp_sink_crc(struct intel_dp *intel_dp) +{ + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); + struct drm_device *dev = intel_dig_port->base.base.dev; + struct intel_crtc *intel_crtc = + to_intel_crtc(intel_dig_port->base.base.crtc); + + if (!intel_dp->sink_crc.supported) + return; + + intel_dp_aux_native_write_1(intel_dp, DP_TEST_SINK, DP_TEST_SINK_START); + + /* Wait 2 vblanks to be sure we will have the correct CRC value */ + intel_wait_for_vblank(dev, intel_crtc->pipe); + intel_wait_for_vblank(dev, intel_crtc->pipe); + + intel_dp_aux_native_read_retry(intel_dp, DP_TEST_CRC_R_CR, + intel_dp->sink_crc.r_cr, 2); + intel_dp_aux_native_read_retry(intel_dp, DP_TEST_CRC_G_Y, + intel_dp->sink_crc.g_y, 2); + intel_dp_aux_native_read_retry(intel_dp, DP_TEST_CRC_B_CB, + intel_dp->sink_crc.b_cb, 2); + + intel_dp_aux_native_write_1(intel_dp, DP_TEST_SINK, + ~DP_TEST_SINK_START); +} + static bool intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 46aea6c..48533c0 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -462,6 +462,13 @@ struct intel_hdmi { #define DP_MAX_DOWNSTREAM_PORTS 0x10 +struct sink_crc { + bool supported; + u8 r_cr[2]; + u8 g_y[2]; + u8 b_cb[2]; +}; + struct intel_dp { uint32_t output_reg; uint32_t aux_ch_ctl_reg; @@ -487,6 +494,7 @@ struct intel_dp { bool want_panel_vdd; bool psr_setup_done; struct intel_connector *attached_connector; + struct sink_crc sink_crc; }; struct intel_digital_port { @@ -719,6 +727,7 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp); void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); void intel_dp_encoder_destroy(struct drm_encoder *encoder); void intel_dp_check_link_status(struct intel_dp *intel_dp); +void intel_dp_sink_crc(struct intel_dp *intel_dp); bool intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_config *pipe_config); bool intel_dp_is_edp(struct drm_device *dev, enum port port); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 1d09050..ba0b90d 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -279,11 +279,21 @@ #define DP_TEST_PATTERN 0x221 +#define DP_TEST_CRC_R_CR 0x240 +#define DP_TEST_CRC_G_Y 0x242 +#define DP_TEST_CRC_B_CB 0x244 + +#define DP_TEST_SINK_MISC 0x246 +#define DP_TEST_CRC_SUPPORTED (1 << 5) + #define DP_TEST_RESPONSE 0x260 # define DP_TEST_ACK (1 << 0) # define DP_TEST_NAK (1 << 1) # define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) +#define DP_TEST_SINK 0x270 +#define DP_TEST_SINK_START (1 << 0) + #define DP_SOURCE_OUI 0x300 #define DP_SINK_OUI 0x400 #define DP_BRANCH_OUI 0x500