From patchwork Wed Mar 2 09:35:08 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: 12765685 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 96013C4332F for ; Wed, 2 Mar 2022 09:22:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FECD10F2AD; Wed, 2 Mar 2022 09:22:10 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8B2410F2AB for ; Wed, 2 Mar 2022 09:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646212928; x=1677748928; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=IUgxe6Y2FCO01tGZmQJiyGw77qc9o9OzXyyklEMyBqc=; b=Xx+w4vSYnlUgGrHMYoesjHQqN3qhiKgwqizmszhNo94f12rdyGZOSMZC FlmQBLv26yZ+LwKCfN3xilNJqwsg8nnGX2S9PUjm3NdBFISpRNqzxGKnZ ZvRrYzRdyTbnf9wAnG5e5kbXcmwHj2LBWAJCAraYSXQzE7Yd+n+oWAqqQ iEOxuqIfNYz0/fSY0N3f3F1EBI5jU6uvfpMG/wVdWl2OyIFmac/lQXmW8 zyV1JoQcCIAWtLJyG0DhXlMsVdCbKx/eaeHLjMrB+sDZvzGU6xpCTB3Ya dPmrp0o9EK5m1N4yUnyl5F8NWUiTzWigFDBTveufMXvO00hXNG3QJc9LQ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="252187716" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="252187716" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 01:22:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="807012107" Received: from shawnle1-build-machine.itwn.intel.com ([10.5.253.78]) by fmsmga005.fm.intel.com with ESMTP; 02 Mar 2022 01:22:06 -0800 From: Lee Shawn C To: dri-devel@lists.freedesktop.org Subject: [v4 2/5] drm/edid: parse multiple CEA extension block Date: Wed, 2 Mar 2022 17:35:08 +0800 Message-Id: <20220302093511.30299-3-shawn.c.lee@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220302093511.30299-1-shawn.c.lee@intel.com> References: <20220302093511.30299-1-shawn.c.lee@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, ankit.k.nautiyal@intel.com, Lee Shawn C Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Cc: Jani Nikula Cc: Ville Syrjala Cc: Ankit Nautiyal Signed-off-by: Lee Shawn C --- drivers/gpu/drm/drm_edid.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 375e70d9de86..c4a47465ba76 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4319,16 +4319,24 @@ 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; + const u8 *cea, *db; + u8 dbl, hdmi_len; int modes = 0, ext_index = 0; + int i, start, end; - cea = drm_find_cea_extension(edid, &ext_index); - if (cea && cea_revision(cea) >= 3) { - int i, start, end; + for (;;) { + const u8 *hdmi = NULL, *video = NULL; + u8 video_len = 0; + + 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]; @@ -4350,15 +4358,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; }