From patchwork Tue Sep 27 16:59:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990985 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 22728C54EE9 for ; Tue, 27 Sep 2022 17:00:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 084C110E0A0; Tue, 27 Sep 2022 17:00:33 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 483FA10E05C; Tue, 27 Sep 2022 17:00: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=1664298014; x=1695834014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FhJMM87k0x5zG3sXLdlJ9nnD79G+3grLJBKMOo94wRA=; b=YrsNFxSlQvllGgp2ogys7VIhyX+pcfyZammA4zDPaKcFKkN2vYZColHk Ghnf0TED9dhx+X3RAWNYH63zSZc6v0tjb0WyWiT/bSjYa4M7+8Xt1zzwb LY6wj3u2QW5RNtfrFhv9d7kgI6DmBYH9vZZmpMMNd5VrkgdMfUUjvFHoK BGDHT3JfCjmYVI8Bf8FloFjJGk5NV3uf9lncsxOBYXjg4F+KAQIy9IFZq kjHV9cunAQJKWr/YtJc7IvZnw8XhSYKp+KfNEPKHHEEiNxjzZqDmtuP9k C2xTu3x0+9kW0c47Wng1byhPHiIhtUwkNq4K0DVXmvHbXFw9b7+5vX2vm Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="363208133" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="363208133" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821484" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="623821484" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:10 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:09 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/9] drm/edid: Clarify why we only accept the "range limits only" descriptor Date: Tue, 27 Sep 2022 19:59:58 +0300 Message-Id: <20220927170006.27855-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: Leo Li , intel-gfx@lists.freedesktop.org, Rodrigo Siqueira , amd-gfx@lists.freedesktop.org, Manasi Navare , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä The current comment fails to clarify why we only accept the "range limits only" variant of the range descriptor. Reword it to make some actual sense. Cc: Nicholas Kazlauskas Cc: Harry Wentland Cc: Leo Li Cc: Rodrigo Siqueira Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Manasi Navare Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 4005dab6147d..ac662495635c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6033,10 +6033,13 @@ void get_monitor_range(const struct detailed_timing *timing, void *c) return; /* - * Check for flag range limits only. If flag == 1 then - * no additional timing information provided. - * Default GTF, GTF Secondary curve and CVT are not - * supported + * These limits are used to determine the VRR refresh + * rate range. Only the "range limits only" variant + * of the range descriptor seems to guarantee that + * any and all timings are accepted by the sink, as + * opposed to just timings conforming to the indicated + * formula (GTF/GTF2/CVT). Thus other variants of the + * range descriptor are not accepted here. */ if (range->flags != DRM_EDID_RANGE_LIMITS_ONLY_FLAG) return; From patchwork Tue Sep 27 16:59:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990984 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 32BF0C07E9D for ; Tue, 27 Sep 2022 17:00:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EE2210E039; Tue, 27 Sep 2022 17:00:30 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 786DC10E090; Tue, 27 Sep 2022 17:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298017; x=1695834017; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lbd7iwv+W+UQ7+uxsm3XwZbEzCthnf1625cjyaR3X9s=; b=CKdG5/ZJHnjlkGD10hTRtOdehLLoEKYpwhPDGWQBV3GuVfFn3eaJEQXe QIeD5E994zkCCr3HinmvvMIXIBrc1NLeXQGOrnoMtK+HlPuMw3cURQl9m IwnxE1pjGIDUIQTFcMh61QPU1TK/PytTSQEThCbEB81GdavONZCIxQkg0 4Qzc6TuMvfufkMXAHK70HJcaNbRo/xxLjKI2DtZR+Z9FbcaDY72iTpfag 2WYV35UScyaksn1dBdjqHSIhhY5iOrmDX1xXgZt6V6FOLWjhlASPOROvS ARdn6YHxteu/+Z9rX6umOFs/bbQIQhybOB4I1GnLxUkcoHwb7tgysXIal g==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="363208145" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="363208145" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821519" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="623821519" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:14 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:14 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/9] drm/edid: Define more flags Date: Tue, 27 Sep 2022 19:59:59 +0300 Message-Id: <20220927170006.27855-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Replace a bunch of hex constants with proper definitions. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 18 +++++++++--------- include/drm/drm_edid.h | 14 +++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ac662495635c..76753c56d4f7 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2984,7 +2984,7 @@ is_rb(const struct detailed_timing *descriptor, void *data) BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15); if (descriptor->data.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG && - descriptor->data.other_data.data.range.formula.cvt.flags & 0x10) + descriptor->data.other_data.data.range.formula.cvt.flags & DRM_EDID_CVT_FLAGS_REDUCED_BLANKING) *res = true; } @@ -3012,7 +3012,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data) BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10); - if (descriptor->data.other_data.data.range.flags == 0x02) + if (descriptor->data.other_data.data.range.flags == DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG) *res = descriptor; } @@ -3415,7 +3415,7 @@ range_pixel_clock(const struct edid *edid, const u8 *t) return 0; /* 1.4 with CVT support gives us real precision, yay */ - if (edid->revision >= 4 && t[10] == 0x04) + if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG) return (t[9] * 10000) - ((t[12] >> 2) * 250); /* 1.3 is pathetic, so fuzz up a bit */ @@ -3441,7 +3441,7 @@ static bool mode_in_range(const struct drm_display_mode *mode, return false; /* 1.4 max horizontal check */ - if (edid->revision >= 4 && t[10] == 0x04) + if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG) if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3)))) return false; @@ -3581,13 +3581,13 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) return; /* GTF not defined yet */ switch (range->flags) { - case 0x02: /* secondary gtf, XXX could do more */ - case 0x00: /* default gtf */ + case DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG: /* XXX could do more */ + case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG: closure->modes += drm_gtf_modes_for_range(closure->connector, closure->drm_edid, timing); break; - case 0x04: /* cvt, only in 1.4+ */ + case DRM_EDID_CVT_SUPPORT_FLAG: if (!version_greater(closure->drm_edid, 1, 3)) break; @@ -3595,7 +3595,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) closure->drm_edid, timing); break; - case 0x01: /* just the ranges, no formula */ + case DRM_EDID_RANGE_LIMITS_ONLY_FLAG: default: break; } @@ -6393,7 +6393,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector, num_modes += add_cea_modes(connector, drm_edid); num_modes += add_alternate_cea_modes(connector, drm_edid); num_modes += add_displayid_detailed_modes(connector, drm_edid); - if (drm_edid->edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) + if (drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ) num_modes += add_inferred_modes(connector, drm_edid); if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 1ed61e2b30a4..429735b91f63 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -97,10 +97,13 @@ struct detailed_data_string { #define DRM_EDID_RANGE_OFFSET_MIN_HFREQ (1 << 2) /* 1.4 */ #define DRM_EDID_RANGE_OFFSET_MAX_HFREQ (1 << 3) /* 1.4 */ -#define DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG 0x00 -#define DRM_EDID_RANGE_LIMITS_ONLY_FLAG 0x01 -#define DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG 0x02 -#define DRM_EDID_CVT_SUPPORT_FLAG 0x04 +#define DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG 0x00 /* 1.3 */ +#define DRM_EDID_RANGE_LIMITS_ONLY_FLAG 0x01 /* 1.4 */ +#define DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG 0x02 /* 1.3 */ +#define DRM_EDID_CVT_SUPPORT_FLAG 0x04 /* 1.4 */ + +#define DRM_EDID_CVT_FLAGS_STANDARD_BLANKING (1 << 3) +#define DRM_EDID_CVT_FLAGS_REDUCED_BLANKING (1 << 4) struct detailed_data_monitor_range { u8 min_vfreq; @@ -206,7 +209,8 @@ struct detailed_timing { #define DRM_EDID_DIGITAL_TYPE_DP (5 << 0) /* 1.4 */ #define DRM_EDID_DIGITAL_DFP_1_X (1 << 0) /* 1.3 */ -#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) +#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) /* 1.2 */ +#define DRM_EDID_FEATURE_CONTINUOUS_FREQ (1 << 0) /* 1.4 */ #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) #define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2) /* If analog */ From patchwork Tue Sep 27 17:00:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990989 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 4D333C54EE9 for ; Tue, 27 Sep 2022 17:01:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07C5D10E13A; Tue, 27 Sep 2022 17:01:05 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1288310E0FA; Tue, 27 Sep 2022 17:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298043; x=1695834043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sSTmUKt/CaF+I5tJQCd7Qdsnjia+SAo2dGYwNbRf0fY=; b=CFk6tEE3W1wDmbIqBVwIJ49dkehKtV64Gz9vrkusiFuQnPbL3gS1O1hr Td9l/mjGemoYgM9hrp6Tg4RoKS3ajh23lBzN8XP05YoIy23yrr6pLZbZF N6wcuQfwz3rWz81OKFYYnS2Duje8PfHEqqCAxCAf82/MPbmZ3OWsk1Q+J qZ7SbcJvr9UgF2ZLuBnlKAdhaz198l1CRPyBT3thjMZ68JQ24oYQG51oT 3W5oBjrhsb3gXdTRjyAiTnMb9F6Xhepo+wO2uD3+tHU+F4MTSXGqkIdpd dSIYSniWhj5HJDzzL4Q4tLq7VF1wVBpNlUYgVKDn8Iv4/4Q8pIGhyJJMN w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="365414079" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="365414079" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821892" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="623821892" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:18 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:17 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/9] drm/edid: Only parse VRR range for continuous frequency displays Date: Tue, 27 Sep 2022 20:00:00 +0300 Message-Id: <20220927170006.27855-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: Leo Li , intel-gfx@lists.freedesktop.org, Rodrigo Siqueira , amd-gfx@lists.freedesktop.org, Manasi Navare , Jani Nikula , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Since we only use the parsed vrefresh range to determine if VRR should be supported we should only accept continuous frequency displays here. Cc: Manasi Navare Cc: Nicholas Kazlauskas Cc: Harry Wentland Cc: Leo Li Cc: Rodrigo Siqueira Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 76753c56d4f7..8c89d6a90390 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6064,7 +6064,10 @@ static void drm_get_monitor_range(struct drm_connector *connector, .drm_edid = drm_edid, }; - if (!version_greater(drm_edid, 1, 1)) + if (!version_greater(drm_edid, 1, 3)) + return; + + if (!(drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)) return; drm_for_each_detailed_block(drm_edid, get_monitor_range, &closure); From patchwork Tue Sep 27 17:00:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990987 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 99D8AC07E9D for ; Tue, 27 Sep 2022 17:01:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 851AF10E126; Tue, 27 Sep 2022 17:01:01 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 91E7E10E0C9; Tue, 27 Sep 2022 17:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298043; x=1695834043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QJwTe7jm42SPL/0A1AqCPfxgb5vgp/on4jj3KN93B8o=; b=naBNg7SkDi324k1ge+UNWYShkV5IxJSx6NzDJRdh+Vk9V52xhtKrW8lr LvycPyV3VO6F8oUQAG2RcJaD19x7DwUL35lhokPphZblsqhpg8afeArdc k2kpAfduU+rbtqooDuQppYAhFvWEAAMJmxNf1UIyKmsCHDx5pip+XsxsH P4HTHSnVDloFoRIJEws2P015vzPxzuak1wtVfGTPKpVQmjKbWeDt03qiG NQxdBL6ME/c5+ZJhxjRdKtu7umfh8iS55kuqyLDu3h86PCFT2tJxKo1Fa 8Owj3rdW5KwS28eWJLRYSt/VA1PRcHB8LmdfEb4oA+vSF7HJ/oHoM01Sd A==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="365414071" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="365414071" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821904" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="623821904" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:22 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:21 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 4/9] drm/edid: Extract drm_gtf2_mode() Date: Tue, 27 Sep 2022 20:00:01 +0300 Message-Id: <20220927170006.27855-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Extract the GTF vs. GTF2 logic into a separate function. We'll have a second user soon. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 47 ++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8c89d6a90390..c7dbd6bf7f80 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3113,6 +3113,35 @@ static int drm_mode_hsync(const struct drm_display_mode *mode) return DIV_ROUND_CLOSEST(mode->clock, mode->htotal); } +static struct drm_display_mode * +drm_gtf2_mode(struct drm_device *dev, + const struct drm_edid *drm_edid, + int hsize, int vsize, int vrefresh_rate) +{ + struct drm_display_mode *mode; + + /* + * This is potentially wrong if there's ever a monitor with + * more than one ranges section, each claiming a different + * secondary GTF curve. Please don't do that. + */ + mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); + if (!mode) + return NULL; + + if (drm_mode_hsync(mode) > drm_gtf2_hbreak(drm_edid)) { + drm_mode_destroy(dev, mode); + mode = drm_gtf_mode_complex(dev, hsize, vsize, + vrefresh_rate, 0, 0, + drm_gtf2_m(drm_edid), + drm_gtf2_2c(drm_edid), + drm_gtf2_k(drm_edid), + drm_gtf2_2j(drm_edid)); + } + + return mode; +} + /* * Take the standard timing params (in this case width, aspect, and refresh) * and convert them into a real mode using CVT/GTF/DMT. @@ -3201,23 +3230,7 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); break; case LEVEL_GTF2: - /* - * This is potentially wrong if there's ever a monitor with - * more than one ranges section, each claiming a different - * secondary GTF curve. Please don't do that. - */ - mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); - if (!mode) - return NULL; - if (drm_mode_hsync(mode) > drm_gtf2_hbreak(drm_edid)) { - drm_mode_destroy(dev, mode); - mode = drm_gtf_mode_complex(dev, hsize, vsize, - vrefresh_rate, 0, 0, - drm_gtf2_m(drm_edid), - drm_gtf2_2c(drm_edid), - drm_gtf2_k(drm_edid), - drm_gtf2_2j(drm_edid)); - } + mode = drm_gtf2_mode(dev, drm_edid, hsize, vsize, vrefresh_rate); break; case LEVEL_CVT: mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0, From patchwork Tue Sep 27 17:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990988 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 B8315C6FA83 for ; Tue, 27 Sep 2022 17:01:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B177310E12A; Tue, 27 Sep 2022 17:01:01 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB3DF10E0F4; Tue, 27 Sep 2022 17:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298043; x=1695834043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J+2ijVANxbRuGevqdil92LUSYcS8Yn6hnMQANjtBow0=; b=E2LRKqUDvXQM1uIVJ2Tp1Meys8jy8iqOKc+JHkHF9bFtoJGkqzALyYpB BGnLMAhsyqpGgJWOSDa9tHmCyjuqHy0UTjDHstJlYNEcIOQWoAlGDMP7q OA+8KcJVr9VeE3XHcOb/GZ5Nwq6a0xRMlA3mKGq9MEIq9xZHrwRRLMEm2 62C03ogXj3sJRuStQdTCAtU8B0F6rOQsUJHITNnEZV2EE2KQT/IVyjClQ a9q35eZOyZNle9fnRfZaAZyRVheiadx5l250cWu3XO3wIy4akZ5v7XJGz j7Lp4iKqypEDmT8TDDIuRFVSymFzZUQpFRsdfMLBiVnP2Ju4jw6CVkNmF w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="365414076" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="365414076" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821938" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="623821938" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:25 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:25 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 5/9] drm/edid: Use GTF2 for inferred modes Date: Tue, 27 Sep 2022 20:00:02 +0300 Message-Id: <20220927170006.27855-6-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä For some resaon we only use the secondary GTF curve for the standard timings. Use it for inferred modes as well. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c7dbd6bf7f80..efe8d5e76875 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3546,6 +3546,35 @@ static int drm_gtf_modes_for_range(struct drm_connector *connector, return modes; } +static int drm_gtf2_modes_for_range(struct drm_connector *connector, + const struct drm_edid *drm_edid, + const struct detailed_timing *timing) +{ + int i, modes = 0; + struct drm_display_mode *newmode; + struct drm_device *dev = connector->dev; + + for (i = 0; i < ARRAY_SIZE(extra_modes); i++) { + const struct minimode *m = &extra_modes[i]; + + newmode = drm_gtf2_mode(dev, drm_edid, m->w, m->h, m->r); + if (!newmode) + return modes; + + drm_mode_fixup_1366x768(newmode); + if (!mode_in_range(newmode, drm_edid, timing) || + !valid_inferred_mode(connector, newmode)) { + drm_mode_destroy(dev, newmode); + continue; + } + + drm_mode_probed_add(connector, newmode); + modes++; + } + + return modes; +} + static int drm_cvt_modes_for_range(struct drm_connector *connector, const struct drm_edid *drm_edid, const struct detailed_timing *timing) @@ -3594,7 +3623,11 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) return; /* GTF not defined yet */ switch (range->flags) { - case DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG: /* XXX could do more */ + case DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG: + closure->modes += drm_gtf2_modes_for_range(closure->connector, + closure->drm_edid, + timing); + break; case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG: closure->modes += drm_gtf_modes_for_range(closure->connector, closure->drm_edid, From patchwork Tue Sep 27 17:00:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990990 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 89344C54EE9 for ; Tue, 27 Sep 2022 17:01:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AEB5F10E13B; Tue, 27 Sep 2022 17:01:05 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F73E10E103; Tue, 27 Sep 2022 17:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298044; x=1695834044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CEF5uG1UF6TkFE3myQTivZYvAC9u4SQ0kVGKVCmJh1c=; b=FYzUnFZ24wVuqsRokq8tCB1JvwM+pse/zt0vPBaApNQG6LKAiUFlFDSr Hsj/0QA4qr9TJbbDxkibhZMR9sCxG8zPEQbVY+EtAqChlMK/4qjrli5Ip v8XU2Nd8tqrPwScW99AV9jahQu/cPGiJlMcwAB1Dv5l5aXqqBgxSHImEu G3vFbzMz4PRXrgd/84BNPkAJLPsfICE7BBBNar4WYiCrOXUe9QTc9oNcU VJY+OqiBtNz1+MQSpExtLrVe87CBLccwoa/gGOf8EJCJmi+BQM8vaMzU+ JuWUigWI6ArIYYrw3L+1pGfoUsP/ecPAq1MCPolAJq1g/T8mOQ2yhMPSO Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="387656867" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="387656867" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="623821963" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="623821963" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by fmsmga007.fm.intel.com with SMTP; 27 Sep 2022 10:00:29 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:28 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 6/9] drm/edid: Use the correct formula for standard timings Date: Tue, 27 Sep 2022 20:00:03 +0300 Message-Id: <20220927170006.27855-7-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Prefer the timing formula indicated by the range descriptor for generating the non-DMT standard timings. Previously we just used CVT for all EDID 1.4 continuous frequency displays without even checking if the range descriptor indicates otherwise. Now we check the range descriptor first, and fall back to CVT if nothing else was indicated. EDID 1.4 more or less deprecates GTF/GTF2 but there are still a lot of 1.4 EDIDs out there that don't advertise CVT support, so seems safer to use the formula the EDID actually reports as supported. For EDID 1.3 we use GTF2 if indicated (as before), and for EDID 1.2+ we now just use GTF without even checking the feature flag. There seem to be quite a few EDIDs out there that don't set the GTF feature flag but still include a GTF range descriptor and non-DMT standard timings. This to me seems to be roughly what appendix B of EDID 1.4 suggests should be done. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 49 +++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index efe8d5e76875..60e68d27371d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3077,20 +3077,53 @@ drm_gtf2_2j(const struct drm_edid *drm_edid) return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.j : 0; } +static void +get_timing_level(const struct detailed_timing *descriptor, void *data) +{ + int *res = data; + + if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE)) + return; + + BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10); + + switch (descriptor->data.other_data.data.range.flags) { + case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG: + *res = LEVEL_GTF; + break; + case DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG: + *res = LEVEL_GTF2; + break; + case DRM_EDID_CVT_SUPPORT_FLAG: + *res = LEVEL_CVT; + break; + default: + break; + } +} + /* Get standard timing level (CVT/GTF/DMT). */ static int standard_timing_level(const struct drm_edid *drm_edid) { const struct edid *edid = drm_edid->edid; - if (edid->revision >= 2) { - if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)) - return LEVEL_CVT; - if (drm_gtf2_hbreak(drm_edid)) - return LEVEL_GTF2; - if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) - return LEVEL_GTF; + if (edid->revision >= 4) { + /* + * If the range descriptor doesn't + * indicate otherwise default to CVT + */ + int ret = LEVEL_CVT; + + drm_for_each_detailed_block(drm_edid, get_timing_level, &ret); + + return ret; + } else if (edid->revision >= 3 && drm_gtf2_hbreak(drm_edid)) { + return LEVEL_GTF2; + } else if (edid->revision >= 2) { + return LEVEL_GTF; + } else { + return LEVEL_DMT; } - return LEVEL_DMT; } /* From patchwork Tue Sep 27 17:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990986 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 A081CC54EE9 for ; Tue, 27 Sep 2022 17:00:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D477310E0C9; Tue, 27 Sep 2022 17:00:45 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71F7910E0B7; Tue, 27 Sep 2022 17:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298038; x=1695834038; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EtDly6emnQPYq7BlEZfxFE2HikRoCeYaGYzlMIcZ02U=; b=WZoigkt1Jtthp2HsOQtY9UeKzjc1N6WU+Yn8t47ndmiORljI2wP+H5YX yz4O4UluJcCfiH6RZPu+C7ouhPQTi8K8LOq59APkK6czE7JWk5esSbPb2 lmwtQTgPqLWNuCfzKraHrSB8xLDUzzpuVTrMzM9gKNF/1/jmYrNLupCRa bV5x6LxnC13sA2/hzHCX960WQgKhoygxasdH6jxqwi3S3rtOfGsWw8VLU zfZb2bbkrr25uS/2g44DIFRLSYxA17wk5lP/P9nB3SRjg7AujVOgirahp vDh9lvlIKSVnDWJusWaY+SrqWXh2XIagj1ORS29oqE6hYj9NOHxlffK7F w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="387656805" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="387656805" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="621591727" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="621591727" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by orsmga002.jf.intel.com with SMTP; 27 Sep 2022 10:00:32 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:31 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 7/9] drm/edid: Unconfuse preferred timing stuff a bit Date: Tue, 27 Sep 2022 20:00:04 +0300 Message-Id: <20220927170006.27855-8-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä For EDID 1.4 the first detailed timing is always preferred, for older EDIDs there was a feature flag to indicate the same. While correct, the code setting that up is rather confusing. Restate it in a slightly more straightforward manner. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 60e68d27371d..1856560463a3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3952,13 +3952,14 @@ static int add_detailed_modes(struct drm_connector *connector, struct detailed_mode_closure closure = { .connector = connector, .drm_edid = drm_edid, - .preferred = true, .quirks = quirks, }; - if (closure.preferred && !version_greater(drm_edid, 1, 3)) + if (version_greater(drm_edid, 1, 3)) + closure.preferred = true; /* first detailed timing is always preferred */ + else closure.preferred = - (drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING); + drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING; drm_for_each_detailed_block(drm_edid, do_detailed_mode, &closure); From patchwork Tue Sep 27 17:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990991 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 3A4C7C54EE9 for ; Tue, 27 Sep 2022 17:01:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE0DE10E094; Tue, 27 Sep 2022 17:01:30 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 41ACD10E140; Tue, 27 Sep 2022 17:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298069; x=1695834069; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pqC6j109sK2WB16nJFiz/1ADuiwDt7MgDEZGU0W8LCE=; b=l04l9+y2Azcv1KWsGtx4AbAGv+t/QYuT4VNLU6je0z53FOjbwHvZy4BR HOUlJ5oRuLHxawIWtFBEXQqv5QRxJ7FjdmyLN4jFH23Egv0YIPmyH9Qha zv7IZOWXJqJxQnn7jqi6cb/7j7/vOx8d28d7OPJs0qVJBbb+yiMM3CZNq qqgnmTvpFcwTwiOU88N8oCZxihZOtZJ6Bcj3w8gisyssf7o3JF65oWvWj 3t2PXr+jjbuCSLfbNT7YLgXuS2tvid4DwV5b5USHAOET1hpkTtol2TCZg 0RSRze9/NjkHDa73ocJtY+ihq8cvzwV2En0EBYx5FuU2VaPQrTT2v7yny A==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="281089946" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="281089946" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="654797783" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="654797783" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by orsmga001.jf.intel.com with SMTP; 27 Sep 2022 10:00:36 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:35 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 8/9] drm/edid: Make version checks less convoluted Date: Tue, 27 Sep 2022 20:00:05 +0300 Message-Id: <20220927170006.27855-9-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Get rid of the confusing version_greater() stuff and simply compare edid->revision directly everwhere. Half the places already did it this way, and since we actually reject any EDID with edid->version!=1 it's a perfectly sane thing to do. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_edid.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1856560463a3..69485adcc80c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1572,15 +1572,6 @@ struct drm_edid { const struct edid *edid; }; -static bool version_greater(const struct drm_edid *drm_edid, - u8 version, u8 revision) -{ - const struct edid *edid = drm_edid->edid; - - return edid->version > version || - (edid->version == version && edid->revision > revision); -} - static int edid_hfeeodb_extension_block_count(const struct edid *edid); static int edid_hfeeodb_block_count(const struct edid *edid) @@ -3652,7 +3643,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) closure->drm_edid, timing); - if (!version_greater(closure->drm_edid, 1, 1)) + if (closure->drm_edid->edid->revision < 2) return; /* GTF not defined yet */ switch (range->flags) { @@ -3667,7 +3658,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c) timing); break; case DRM_EDID_CVT_SUPPORT_FLAG: - if (!version_greater(closure->drm_edid, 1, 3)) + if (closure->drm_edid->edid->revision < 4) break; closure->modes += drm_cvt_modes_for_range(closure->connector, @@ -3688,7 +3679,7 @@ static int add_inferred_modes(struct drm_connector *connector, .drm_edid = drm_edid, }; - if (version_greater(drm_edid, 1, 0)) + if (drm_edid->edid->revision >= 1) drm_for_each_detailed_block(drm_edid, do_inferred_modes, &closure); return closure.modes; @@ -3765,7 +3756,7 @@ static int add_established_modes(struct drm_connector *connector, } } - if (version_greater(drm_edid, 1, 0)) + if (edid->revision >= 1) drm_for_each_detailed_block(drm_edid, do_established_modes, &closure); @@ -3820,7 +3811,7 @@ static int add_standard_modes(struct drm_connector *connector, } } - if (version_greater(drm_edid, 1, 0)) + if (drm_edid->edid->revision >= 1) drm_for_each_detailed_block(drm_edid, do_standard_modes, &closure); @@ -3900,7 +3891,7 @@ add_cvt_modes(struct drm_connector *connector, const struct drm_edid *drm_edid) .drm_edid = drm_edid, }; - if (version_greater(drm_edid, 1, 2)) + if (drm_edid->edid->revision >= 3) drm_for_each_detailed_block(drm_edid, do_cvt_mode, &closure); /* XXX should also look for CVT codes in VTB blocks */ @@ -3955,7 +3946,7 @@ static int add_detailed_modes(struct drm_connector *connector, .quirks = quirks, }; - if (version_greater(drm_edid, 1, 3)) + if (drm_edid->edid->revision >= 4) closure.preferred = true; /* first detailed timing is always preferred */ else closure.preferred = @@ -6144,7 +6135,7 @@ static void drm_get_monitor_range(struct drm_connector *connector, .drm_edid = drm_edid, }; - if (!version_greater(drm_edid, 1, 3)) + if (drm_edid->edid->revision < 4) return; if (!(drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)) From patchwork Tue Sep 27 17:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12990992 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 F3B1EC07E9D for ; Tue, 27 Sep 2022 17:01:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41F9110E141; Tue, 27 Sep 2022 17:01:31 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4326B10E05C; Tue, 27 Sep 2022 17:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664298071; x=1695834071; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lFS8/f9F44/xH3BUSUJR3jixz9y3DPyHxICZqh+BIwo=; b=LGiPiN4gtw0XpYym1Hzs55Urr/crzqsT26aAwk38VPzfU7C1gCDkHRlu gjOGaL17YYd/5D8abwL9kqJaIKB6beLGGaQ9XnbrFgJPZ+P79T7mntzrl w/f1FTPddDtrLtTiwbxTBRhLbVYubq2HEFmpsq6VLWfzN7zFVGSxS4Efe 5HnYmbXjKOaDNXVGMtOGZ0sPAMdYAUbyWV9J2ni4cyQmrWllnVcUQ3xlm Uqb6EQs4S+AsNd2JWarqFzSohrjnTDctdOT5PGhhWQrrLCDtr+Y598A2D A8LRHSLOJOkNweLF3IlKjaTvjVhdQH4g7HJfxgiHWDBvWiM108NY6B2VK w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="281089984" X-IronPort-AV: E=Sophos;i="5.93,350,1654585200"; d="scan'208";a="281089984" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2022 10:00:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="654797804" X-IronPort-AV: E=Sophos;i="5.93,349,1654585200"; d="scan'208";a="654797804" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.191]) by orsmga001.jf.intel.com with SMTP; 27 Sep 2022 10:00:39 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Sep 2022 20:00:38 +0300 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 9/9] drm/edid: s/monitor_rage/vrr_range/ Date: Tue, 27 Sep 2022 20:00:06 +0300 Message-Id: <20220927170006.27855-10-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220927170006.27855-1-ville.syrjala@linux.intel.com> References: <20220927170006.27855-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 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: Leo Li , intel-gfx@lists.freedesktop.org, Rodrigo Siqueira , amd-gfx@lists.freedesktop.org, Manasi Navare , Jani Nikula , Nicholas Kazlauskas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Rename info->monitor_range to info->vrr_range to actually reflect its usage. Cc: Nicholas Kazlauskas Cc: Harry Wentland Cc: Leo Li Cc: Rodrigo Siqueira Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Manasi Navare Acked-by: Jani Nikula Signed-off-by: Ville Syrjälä --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 ++++----- drivers/gpu/drm/drm_debugfs.c | 4 +-- drivers/gpu/drm/drm_edid.c | 26 +++++++++---------- drivers/gpu/drm/i915/display/intel_vrr.c | 6 ++--- include/drm/drm_connector.h | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 4c73727e0b7d..88758e8c65c6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9943,8 +9943,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->min_vfreq = 0; amdgpu_dm_connector->max_vfreq = 0; amdgpu_dm_connector->pixel_clock_mhz = 0; - connector->display_info.monitor_range.min_vfreq = 0; - connector->display_info.monitor_range.max_vfreq = 0; + connector->display_info.vrr_range.min_vfreq = 0; + connector->display_info.vrr_range.max_vfreq = 0; freesync_capable = false; goto update; @@ -9991,8 +9991,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->pixel_clock_mhz = range->pixel_clock_mhz * 10; - connector->display_info.monitor_range.min_vfreq = range->min_vfreq; - connector->display_info.monitor_range.max_vfreq = range->max_vfreq; + connector->display_info.vrr_range.min_vfreq = range->min_vfreq; + connector->display_info.vrr_range.max_vfreq = range->max_vfreq; break; } @@ -10014,8 +10014,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) freesync_capable = true; - connector->display_info.monitor_range.min_vfreq = vsdb_info.min_refresh_rate_hz; - connector->display_info.monitor_range.max_vfreq = vsdb_info.max_refresh_rate_hz; + connector->display_info.vrr_range.min_vfreq = vsdb_info.min_refresh_rate_hz; + connector->display_info.vrr_range.max_vfreq = vsdb_info.max_refresh_rate_hz; } } diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 01ee3febb813..1437c798b122 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -377,8 +377,8 @@ static int vrr_range_show(struct seq_file *m, void *data) if (connector->status != connector_status_connected) return -ENODEV; - seq_printf(m, "Min: %u\n", connector->display_info.monitor_range.min_vfreq); - seq_printf(m, "Max: %u\n", connector->display_info.monitor_range.max_vfreq); + seq_printf(m, "Min: %u\n", connector->display_info.vrr_range.min_vfreq); + seq_printf(m, "Max: %u\n", connector->display_info.vrr_range.max_vfreq); return 0; } diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 69485adcc80c..e7f46260dfe7 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -6091,11 +6091,11 @@ static void drm_parse_cea_ext(struct drm_connector *connector, } static -void get_monitor_range(const struct detailed_timing *timing, void *c) +void get_vrr_range(const struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; struct drm_display_info *info = &closure->connector->display_info; - struct drm_monitor_range_info *monitor_range = &info->monitor_range; + struct drm_monitor_range_info *vrr_range = &info->vrr_range; const struct detailed_non_pixel *data = &timing->data.other_data; const struct detailed_data_monitor_range *range = &data->data.range; const struct edid *edid = closure->drm_edid->edid; @@ -6115,19 +6115,19 @@ void get_monitor_range(const struct detailed_timing *timing, void *c) if (range->flags != DRM_EDID_RANGE_LIMITS_ONLY_FLAG) return; - monitor_range->min_vfreq = range->min_vfreq; - monitor_range->max_vfreq = range->max_vfreq; + vrr_range->min_vfreq = range->min_vfreq; + vrr_range->max_vfreq = range->max_vfreq; if (edid->revision >= 4) { if (data->pad2 & DRM_EDID_RANGE_OFFSET_MIN_VFREQ) - monitor_range->min_vfreq += 255; + vrr_range->min_vfreq += 255; if (data->pad2 & DRM_EDID_RANGE_OFFSET_MAX_VFREQ) - monitor_range->max_vfreq += 255; + vrr_range->max_vfreq += 255; } } -static void drm_get_monitor_range(struct drm_connector *connector, - const struct drm_edid *drm_edid) +static void drm_get_vrr_range(struct drm_connector *connector, + const struct drm_edid *drm_edid) { const struct drm_display_info *info = &connector->display_info; struct detailed_mode_closure closure = { @@ -6141,11 +6141,11 @@ static void drm_get_monitor_range(struct drm_connector *connector, if (!(drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)) return; - drm_for_each_detailed_block(drm_edid, get_monitor_range, &closure); + drm_for_each_detailed_block(drm_edid, get_vrr_range, &closure); DRM_DEBUG_KMS("Supported Monitor Refresh rate range is %d Hz - %d Hz\n", - info->monitor_range.min_vfreq, - info->monitor_range.max_vfreq); + info->vrr_range.min_vfreq, + info->vrr_range.max_vfreq); } static void drm_parse_vesa_mso_data(struct drm_connector *connector, @@ -6238,7 +6238,7 @@ static void drm_reset_display_info(struct drm_connector *connector) info->edid_hdmi_ycbcr444_dc_modes = 0; info->non_desktop = 0; - memset(&info->monitor_range, 0, sizeof(info->monitor_range)); + memset(&info->vrr_range, 0, sizeof(info->vrr_range)); memset(&info->luminance_range, 0, sizeof(info->luminance_range)); info->mso_stream_count = 0; @@ -6258,7 +6258,7 @@ static u32 update_display_info(struct drm_connector *connector, info->width_mm = edid->width_cm * 10; info->height_mm = edid->height_cm * 10; - drm_get_monitor_range(connector, drm_edid); + drm_get_vrr_range(connector, drm_edid); if (edid->revision < 3) goto out; diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 5eac99021875..b3793403d450 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -38,7 +38,7 @@ bool intel_vrr_is_capable(struct intel_connector *connector) } return HAS_VRR(i915) && - info->monitor_range.max_vfreq - info->monitor_range.min_vfreq > 10; + info->vrr_range.max_vfreq - info->vrr_range.min_vfreq > 10; } void @@ -117,9 +117,9 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state, return; vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000, - adjusted_mode->crtc_htotal * info->monitor_range.max_vfreq); + adjusted_mode->crtc_htotal * info->vrr_range.max_vfreq); vmax = adjusted_mode->crtc_clock * 1000 / - (adjusted_mode->crtc_htotal * info->monitor_range.min_vfreq); + (adjusted_mode->crtc_htotal * info->vrr_range.min_vfreq); vmin = max_t(int, vmin, adjusted_mode->crtc_vtotal); vmax = max_t(int, vmax, adjusted_mode->crtc_vtotal); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 56aee949c6fa..7ae23d691cd6 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -636,9 +636,9 @@ struct drm_display_info { bool non_desktop; /** - * @monitor_range: Frequency range supported by monitor range descriptor + * @vrr_range: Refresh rate range supported by monitor for VRR */ - struct drm_monitor_range_info monitor_range; + struct drm_monitor_range_info vrr_range; /** * @luminance_range: Luminance range supported by panel