From patchwork Fri Mar 11 01:22:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lee, Shawn C" X-Patchwork-Id: 12777208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DFA0C433EF for ; Fri, 11 Mar 2022 01:09:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A13010E5E8; Fri, 11 Mar 2022 01:09:04 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DDAF10E5D9; Fri, 11 Mar 2022 01:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646960942; x=1678496942; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=YM24K64FxZP/l08TDu22wSGEkoulDGFfFeQhpXnb0Zo=; b=b/gZD2tD5zgUWp9w5k4KCbjIb+etHriNAXKH4GMQL1rwYcp+bFiz+tcu dxaDuTCebOutTTpoEFyWTTAaEIrFUAIc4fzFo5Q7dU6nH+bu3hXY6TJAU CGyKsF+ncaxB1o+fULyduy+dIbTB8d9LXtt0GhgrD79ntWM0TDwsSp0H1 yAA3+h9Q+kxz27yT8DQG8O+5MJwBGes8TDr/QzolMu89u+F/1rfnlt1W+ osCnL4/LcPgw+6US0dzJKQpzi2mtSTEN/GhL7x4mYnvi1z/Y5f3EoBLqT yUhPvqwuYy1Scd4vHG3uN01YUf/yrnF3JIy+uWbnREQnVkZBxFioxmQxt g==; X-IronPort-AV: E=McAfee;i="6200,9189,10282"; a="255196084" X-IronPort-AV: E=Sophos;i="5.90,172,1643702400"; d="scan'208";a="255196084" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2022 17:08:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,172,1643702400"; d="scan'208";a="781701043" Received: from shawnle1-build-machine.itwn.intel.com ([10.5.253.78]) by fmsmga006.fm.intel.com with ESMTP; 10 Mar 2022 17:08:36 -0800 From: Lee Shawn C To: dri-devel@lists.freedesktop.org Date: Fri, 11 Mar 2022 09:22:15 +0800 Message-Id: <20220311012218.19025-3-shawn.c.lee@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220311012218.19025-1-shawn.c.lee@intel.com> References: <20220311012218.19025-1-shawn.c.lee@intel.com> Subject: [Intel-gfx] [v6 2/5] drm/edid: parse multiple CEA extension block X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cooper.chiou@intel.com, william.tseng@intel.com, jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Try to find and parse more CEA ext blocks if edid->extensions is greater than one. v2: split prvious patch to two. And do CEA block parsing in this one. v3: simplify this patch based on previous change. v4: refine patch v3. Cc: Jani Nikula Cc: Ville Syrjala Cc: Ankit Nautiyal Cc: intel-gfx Signed-off-by: Lee Shawn C --- drivers/gpu/drm/drm_edid.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index e267d31d5c87..7717bf86c07d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4320,16 +4320,22 @@ static void drm_parse_y420cmdb_bitmap(struct drm_connector *connector, static int add_cea_modes(struct drm_connector *connector, struct edid *edid) { - const u8 *cea, *db, *hdmi = NULL, *video = NULL; - u8 dbl, hdmi_len, video_len = 0; int modes = 0, ext_index = 0; - cea = drm_find_cea_extension(edid, &ext_index); - if (cea && cea_revision(cea) >= 3) { + for (;;) { + const u8 *cea, *db, *hdmi = NULL, *video = NULL; + u8 dbl, hdmi_len = 0, video_len = 0; int i, start, end; + cea = drm_find_cea_extension(edid, &ext_index); + if (!cea) + break; + + if (cea_revision(cea) < 3) + continue; + if (cea_db_offsets(cea, &start, &end)) - return 0; + continue; for_each_cea_db(cea, i, start, end) { db = &cea[i]; @@ -4351,15 +4357,15 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid) dbl - 1); } } - } - /* - * We parse the HDMI VSDB after having added the cea modes as we will - * be patching their flags when the sink supports stereo 3D. - */ - if (hdmi) - modes += do_hdmi_vsdb_modes(connector, hdmi, hdmi_len, video, - video_len); + /* + * We parse the HDMI VSDB after having added the cea modes as we will + * be patching their flags when the sink supports stereo 3D. + */ + if (hdmi) + modes += do_hdmi_vsdb_modes(connector, hdmi, hdmi_len, video, + video_len); + } return modes; }