From patchwork Thu Sep 6 20:28:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwan-gyeong Mun X-Patchwork-Id: 10591017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83C525A4 for ; Thu, 6 Sep 2018 20:29:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DE362B0BF for ; Thu, 6 Sep 2018 20:29:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 620632B0C7; Thu, 6 Sep 2018 20:29:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6EBD2B0BF for ; Thu, 6 Sep 2018 20:29:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF98D6E73A; Thu, 6 Sep 2018 20:29:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 756D66E144; Thu, 6 Sep 2018 20:29:04 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 13:29:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,339,1531810800"; d="scan'208";a="71175236" Received: from helsinki.fi.intel.com ([10.237.66.48]) by orsmga008.jf.intel.com with ESMTP; 06 Sep 2018 13:28:59 -0700 From: Gwan-gyeong Mun To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 1/2] drm: move a detected edid member to drm_connector from intel_connector Date: Thu, 6 Sep 2018 23:28:57 +0300 Message-Id: <20180906202858.10497-1-gwan-gyeong.mun@intel.com> X-Mailer: git-send-email 2.18.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, intel-gfx@lists.freedesktop.org, stanislav.lisovskiy@intel.com, mika.kahola@intel.com, sean@poorly.run MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In order to use a detected edid on drm helper functions, it moves a detected edid member to drm_connector structure from intel_connector structure. Signed-off-by: Gwan-gyeong Mun --- drivers/gpu/drm/i915/intel_dp.c | 18 +++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_hdmi.c | 10 +++++----- include/drm/drm_connector.h | 7 +++++++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 436c22de33b6..c117f552f7d2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -4157,7 +4157,7 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) struct intel_connector *intel_connector = intel_dp->attached_connector; struct drm_connector *connector = &intel_connector->base; - if (intel_connector->detect_edid == NULL || + if (connector->detect_edid == NULL || connector->edid_corrupt || intel_dp->aux.i2c_defer_count > 6) { /* Check EDID read for NACKs, DEFERs and corruption @@ -4174,12 +4174,12 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) intel_dp->aux.i2c_defer_count); intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_FAILSAFE; } else { - struct edid *block = intel_connector->detect_edid; + struct edid *block = connector->detect_edid; /* We have to write the checksum * of the last block read */ - block += intel_connector->detect_edid->extensions; + block += connector->detect_edid->extensions; if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, block->checksum) <= 0) @@ -4993,7 +4993,7 @@ intel_dp_set_edid(struct intel_dp *intel_dp) intel_dp_unset_edid(intel_dp); edid = intel_dp_get_edid(intel_dp); - intel_connector->detect_edid = edid; + intel_connector->base.detect_edid = edid; intel_dp->has_audio = drm_detect_monitor_audio(edid); drm_dp_cec_set_edid(&intel_dp->aux, edid); @@ -5005,8 +5005,8 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) struct intel_connector *intel_connector = intel_dp->attached_connector; drm_dp_cec_unset_edid(&intel_dp->aux); - kfree(intel_connector->detect_edid); - intel_connector->detect_edid = NULL; + kfree(intel_connector->base.detect_edid); + intel_connector->base.detect_edid = NULL; intel_dp->has_audio = false; } @@ -5099,7 +5099,7 @@ intel_dp_long_pulse(struct intel_connector *connector, intel_dp->aux.i2c_defer_count = 0; intel_dp_set_edid(intel_dp); - if (intel_dp_is_edp(intel_dp) || connector->detect_edid) + if (intel_dp_is_edp(intel_dp) || connector->base.detect_edid) status = connector_status_connected; intel_dp->detect_done = true; @@ -5183,7 +5183,7 @@ static int intel_dp_get_modes(struct drm_connector *connector) struct intel_connector *intel_connector = to_intel_connector(connector); struct edid *edid; - edid = intel_connector->detect_edid; + edid = connector->detect_edid; if (edid) { int ret = intel_connector_update_modes(connector, edid); if (ret) @@ -5245,7 +5245,7 @@ intel_dp_connector_destroy(struct drm_connector *connector) { struct intel_connector *intel_connector = to_intel_connector(connector); - kfree(intel_connector->detect_edid); + kfree(connector->detect_edid); if (!IS_ERR_OR_NULL(intel_connector->edid)) kfree(intel_connector->edid); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index f5731215210a..19edd7ec4138 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -400,7 +400,6 @@ struct intel_connector { /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */ struct edid *edid; - struct edid *detect_edid; /* since POLL and HPD connectors may use the same HPD line keep the native state of connector->polled in case hotplug storm detection changes it */ diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index a2dab0b6bde6..0bedfc0ade49 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1815,8 +1815,8 @@ intel_hdmi_unset_edid(struct drm_connector *connector) intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE; intel_hdmi->dp_dual_mode.max_tmds_clock = 0; - kfree(to_intel_connector(connector)->detect_edid); - to_intel_connector(connector)->detect_edid = NULL; + kfree(connector->detect_edid); + connector->detect_edid = NULL; } static void @@ -1892,7 +1892,7 @@ intel_hdmi_set_edid(struct drm_connector *connector) intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); - to_intel_connector(connector)->detect_edid = edid; + connector->detect_edid = edid; if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) { intel_hdmi->rgb_quant_range_selectable = drm_rgb_quant_range_selectable(edid); @@ -1957,7 +1957,7 @@ static int intel_hdmi_get_modes(struct drm_connector *connector) { struct edid *edid; - edid = to_intel_connector(connector)->detect_edid; + edid = connector->detect_edid; if (edid == NULL) return 0; @@ -2078,7 +2078,7 @@ static void intel_hdmi_destroy(struct drm_connector *connector) { if (intel_attached_hdmi(connector)->cec_notifier) cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier); - kfree(to_intel_connector(connector)->detect_edid); + kfree(connector->detect_edid); drm_connector_cleanup(connector); kfree(connector); } diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 97ea41dc678f..8c32bf7cb470 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1014,6 +1014,13 @@ struct drm_connector { */ bool edid_corrupt; + /** + * @detect_edid: indicates a cached EDID for a detection cycle + * As we may query the edid multiple times following a detect, record + * the EDID found during output discovery and reuse it. + */ + struct edid *detect_edid; + /** @debugfs_entry: debugfs directory for this connector */ struct dentry *debugfs_entry;