From patchwork Sun Mar 13 13:46:59 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: 12779260 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 8B123C433F5 for ; Sun, 13 Mar 2022 13:33:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C58B410E14B; Sun, 13 Mar 2022 13:33:17 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 95FE810E059; Sun, 13 Mar 2022 13:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647178394; x=1678714394; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=QtrMHmhLQqP+pMkwm0xYjvpOXRA6MQSJeB1LfeQgu+M=; b=D20F+Gs2wugq2DYj4XAi0XTTPHQcL5CMcoYnqgwok6DFxD9tRliK2vI+ suNUUHy8Dx2ebtTNKK/LodzDV/lh6HKjBs4uZIpmGqIZXl86ZlJb5q+xy 00fwRg/NhtU2gJGyHmG2s9qLJpJAcjwQhqnZ59iSuQ2P2J85r0wLEbNvx 0+LRwJ2YqDfLkjTyTcpy+lLojXZ5enznkSQBRXhQmEjKxYdW/ouMkYEKt gmz37g0wD9okUIZSe3E0EUbt2LCpFM5C8kPZS0EL4mcMpiHsHuUZSjITI b2njTHlKRctNGVr3Wn2lCyR36SytHU+C0Qg9sT+aU7pL+NF0RAcSxO1Vj g==; X-IronPort-AV: E=McAfee;i="6200,9189,10284"; a="255600693" X-IronPort-AV: E=Sophos;i="5.90,178,1643702400"; d="scan'208";a="255600693" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 06:33:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,178,1643702400"; d="scan'208";a="515101472" Received: from shawnle1-build-machine.itwn.intel.com ([10.5.253.78]) by orsmga006.jf.intel.com with ESMTP; 13 Mar 2022 06:33:12 -0700 From: Lee Shawn C To: dri-devel@lists.freedesktop.org Date: Sun, 13 Mar 2022 21:46:59 +0800 Message-Id: <20220313134702.24175-3-shawn.c.lee@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220313134702.24175-1-shawn.c.lee@intel.com> References: <20220313134702.24175-1-shawn.c.lee@intel.com> Subject: [Intel-gfx] [v7 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: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org, Drew Davenport 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: Drew Davenport 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 78c415aa6889..9fa84881fbba 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, cea_ext_index = 0, displayid_ext_index = 0; - cea = drm_find_cea_extension(edid, &cea_ext_index, &displayid_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, &cea_ext_index, &displayid_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; }