From mboxrd@z Thu Jan 1 00:00:00 1970 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 47201FF886F for ; Tue, 28 Apr 2026 04:50:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6F3510E2C4; Tue, 28 Apr 2026 04:50:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kDxDVJp9"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id A553510E29C for ; Tue, 28 Apr 2026 04:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1777351632; x=1808887632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IubHtUmeSMSkUz0fD0MikpZ5j8HsYdola+PFMa3HgCk=; b=kDxDVJp9/cQYfWsvY9TwzOejQH4Smf0+/ONv25UmiojQ4VXBlNVQQ6ms cNPH2ikBrcfOlcn3+yf5qmvaM+MvhuG5/FIn1smiJiTfBv3tL8GqYPql5 YKvhyaXAQvHkemkM9UhU4xk4A5kJusGghRkQA4YP/1wxiO0cOr0Gp+lyR XCyroQYHn+JKfCt9ufQ9UK91RN2Kplz5adScKFnIUoolbiUuKi8RjkkMV 6vK3fSHVSz9s/D9lg3OtxAFqaPQYDXXHMzidcFwVjhkw47+88P1vPEgUV 8jHdtpTD7lrhkHB5oBbZsjxiAnibzWY+l2Rx1tzAJHWPq+2E7fR/NLs0B g==; X-CSE-ConnectionGUID: HCpCR3METlOET5s/jASX4g== X-CSE-MsgGUID: 5/YVxYIcTQmdiGKKBMcbLw== X-IronPort-AV: E=McAfee;i="6800,10657,11769"; a="78167799" X-IronPort-AV: E=Sophos;i="6.23,203,1770624000"; d="scan'208";a="78167799" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2026 21:47:12 -0700 X-CSE-ConnectionGUID: kuisrVhtTyOTFxD8xWs+OQ== X-CSE-MsgGUID: pkTkfo+NTeCtbffu6d1Gkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,203,1770624000"; d="scan'208";a="233706603" Received: from bilal-nuc7i7bnh.iind.intel.com ([10.190.239.45]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2026 21:47:11 -0700 From: Mohammed Bilal To: igt-dev@lists.freedesktop.org Cc: kunal1.joshi@intel.com, Louis Chauvet , Kory Maincent , Luca Ceresoli Subject: [PATCH i-g-t v1 07/25] lib/monitor_edids: Add helper to get an EDID by its name Date: Tue, 28 Apr 2026 10:16:16 +0530 Message-ID: <20260428044644.257001-8-mohammed.bilal@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260428044644.257001-1-mohammed.bilal@intel.com> References: <20260428044644.257001-1-mohammed.bilal@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" From: Louis Chauvet For testing specific EDID, it is useful to be able to retrieve an EDID by a verbose name. Reviewed-by: Kory Maincent Reviewed-by: Luca Ceresoli Signed-off-by: Louis Chauvet --- lib/monitor_edids/monitor_edids_helper.c | 30 ++++++++++++++++++++++++ lib/monitor_edids/monitor_edids_helper.h | 1 + 2 files changed, 31 insertions(+) diff --git a/lib/monitor_edids/monitor_edids_helper.c b/lib/monitor_edids/monitor_edids_helper.c index 6043e7a08..01feb34a5 100644 --- a/lib/monitor_edids/monitor_edids_helper.c +++ b/lib/monitor_edids/monitor_edids_helper.c @@ -20,6 +20,16 @@ #include "drmtest.h" #include "hdmi_edids.h" +struct { + struct monitor_edid *edid_list; + int list_size; +} ALL_EDIDS[] = { + {DP_EDIDS_NON_4K, DP_EDIDS_NON_4K_COUNT}, + {DP_EDIDS_4K, DP_EDIDS_4K_COUNT}, + {HDMI_EDIDS_NON_4K, HDMI_EDIDS_NON_4K_COUNT}, + {HDMI_EDIDS_4K, HDMI_EDIDS_4K_COUNT}, +}; + static uint8_t convert_hex_char_to_byte(char c) { if (c >= '0' && c <= '9') @@ -170,3 +180,23 @@ struct monitor_edid *get_edids_for_connector_type(uint32_t type, size_t *count, } } } + +/** + * get_edid_by_name: + * @name: Name to search in available EDIDs + * + * Return the struct edid associated with a specific name. As with edid_from_monitor_edid, the + * caller must ensure to free the EDID after use. If no EDID with the exact name is found, returns + * NULL. + */ +struct edid *get_edid_by_name(const char *name) +{ + for (int i = 0; i < ARRAY_SIZE(ALL_EDIDS); i++) { + for (int j = 0; j < ALL_EDIDS[i].list_size; j++) { + if (strcmp(ALL_EDIDS[i].edid_list[j].name, name) == 0) + return edid_from_monitor_edid(&ALL_EDIDS[i].edid_list[j]); + } + } + + return NULL; +} diff --git a/lib/monitor_edids/monitor_edids_helper.h b/lib/monitor_edids/monitor_edids_helper.h index e50698686..6d9e3fc89 100644 --- a/lib/monitor_edids/monitor_edids_helper.h +++ b/lib/monitor_edids/monitor_edids_helper.h @@ -34,5 +34,6 @@ void free_chamelium_edid_from_monitor_edid(struct chamelium_edid *edid); struct edid *edid_from_monitor_edid(const monitor_edid *monitor_edid); struct monitor_edid *get_edids_for_connector_type(uint32_t type, size_t *count, bool four_k); +struct edid *get_edid_by_name(const char *name); #endif /* TESTS_CHAMELIUM_MONITOR_EDIDS_MONITOR_EDIDS_HELPER_H_ */ -- 2.48.1