From patchwork Tue Dec 27 16:21:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 9489637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9B49760838 for ; Tue, 27 Dec 2016 16:22:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DEE11FF8F for ; Tue, 27 Dec 2016 16:22:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 817AC201BC; Tue, 27 Dec 2016 16:22:41 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable 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 4EF591FF8F for ; Tue, 27 Dec 2016 16:22:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 832728922F; Tue, 27 Dec 2016 16:22:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2B0E89B9F; Tue, 27 Dec 2016 16:22:12 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 27 Dec 2016 08:22:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,417,1477983600"; d="scan'208";a="802708409" Received: from ppiec-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.32.165]) by FMSMGA003.fm.intel.com with ESMTP; 27 Dec 2016 08:22:10 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [RFC PATCH 3/7] drm: abstract override and firmware edid Date: Tue, 27 Dec 2016 18:21:50 +0200 Message-Id: <4fc38a4b6e4362f98aa6982c2bf42b880c6771b5.1482854862.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: jani.nikula@intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The functional change is that if firmware edid is present, it'll still bypass get_modes even if number of modes is 0. This is in line with override edid handling. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_probe_helper.c | 44 ++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index fe65af8f48b9..431349673846 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -163,6 +163,32 @@ drm_connector_detect(struct drm_connector *connector, bool force) connector_status_connected; } +static bool bypass_edid(struct drm_connector *connector, int *count) +{ + struct edid *edid; + + if (connector->override_edid) { + edid = (struct edid *) connector->edid_blob_ptr->data; + + *count = drm_add_edid_modes(connector, edid); + drm_edid_to_eld(connector, edid); + + return true; + } + + edid = drm_load_edid_firmware(connector); + if (!IS_ERR_OR_NULL(edid)) { + drm_mode_connector_update_edid_property(connector, edid); + *count = drm_add_edid_modes(connector, edid); + drm_edid_to_eld(connector, edid); + kfree(edid); + + return true; + } + + return false; +} + /** * drm_helper_probe_single_connector_modes - get complete set of display modes * @connector: connector to probe @@ -292,22 +318,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, goto prune; } - if (connector->override_edid) { - struct edid *edid = (struct edid *) connector->edid_blob_ptr->data; - - count = drm_add_edid_modes(connector, edid); - drm_edid_to_eld(connector, edid); - } else { - struct edid *edid = drm_load_edid_firmware(connector); - if (!IS_ERR_OR_NULL(edid)) { - drm_mode_connector_update_edid_property(connector, edid); - count = drm_add_edid_modes(connector, edid); - drm_edid_to_eld(connector, edid); - kfree(edid); - } - if (count == 0) - count = (*connector_funcs->get_modes)(connector); - } + if (!bypass_edid(connector, &count)) + count = (*connector_funcs->get_modes)(connector); if (count == 0 && connector->status == connector_status_connected) count = drm_add_modes_noedid(connector, 1024, 768);