Message ID | 20231101210037.130494-1-hamza.mahfooz@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp707108vqx; Wed, 1 Nov 2023 14:02:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnojsBadRrJi+KSrffXi5QtVqmldd4E8RV6XPWv8LuhZIL/p/+xiAdy9TvQOCTvcRSA7m6 X-Received: by 2002:a05:6870:1217:b0:1e9:cb91:1b05 with SMTP id 23-20020a056870121700b001e9cb911b05mr17623328oan.53.1698872553184; Wed, 01 Nov 2023 14:02:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698872553; cv=pass; d=google.com; s=arc-20160816; b=TTL/0bpVcghfWTwCQrwlTKGzau06XC+dRp7NlZaz9Z9BZ1fdm8Bb8pUdJokKKGMW2P QDWS9itEkDO8kkF9KUXuPZQkb7/txWR5ap/OU9bryZCsCnp0xSo6htM3mIyTOT8uE11w SVSQ4dKKwAa5374Hz8yow5QLhUcwN5A4S+RgCc79zionwAJJfFulGoMMVxIc0PZAJU0I OVj+uX2bhl2esO2v5cOfPj5WURFBRwqBEN4ByApbCA/JlUiabZFG8QVFvfwZIzLCin18 TAL43j1eIQt/oRLCkDlc4iWdgTQNQcqay2K0bE1W7m5O2NgFxNP6wAOf4S7RHzy13BJb f07g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MOyzGbHDjAo81CbEl0nNGY8kW++DK5earoXJANxvLUQ=; fh=eK1k4XGb84luPaFGAEihJ3Mw+7eUWnbe+FM2fVmvlvU=; b=yDJlGi9po6jEflSzQ9wYFLOdXhDaGGP3LXOAGKpyXkiUvJ/bcR3bvCVgttkEaHmgj5 Vx3xitqU8PojhLBg0Megy5iyaMifjhjw/LSp8B/HZWAH+ISPWyY1JZA0ScbT1dBENGNw 1dHdBOVjxP6V9xZB40odOb1flpD6p8pbFRAP+KNH5RWU06nUjiT2Wfe9Livcm24jILiV jeouGpFAT2rPErcoYQcLVvYDtQWYnv3C9zMoWX97FxgHwTD/2rJWhqk/6Yh720j+9Oq3 XzsghTFUfe+IDB6YZN9PA9IU9HNQkgD2UMqjYk3k+nzDzMNyxt7UqS/E9BTC7u8DGN8O +v4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=J02LGlOe; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fp9-20020a056870658900b001dd6429e3c5si801239oab.214.2023.11.01.14.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 14:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=J02LGlOe; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4C476806895F; Wed, 1 Nov 2023 14:01:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344483AbjKAVBW (ORCPT <rfc822;rbbytesnap@gmail.com> + 34 others); Wed, 1 Nov 2023 17:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235009AbjKAVBU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Nov 2023 17:01:20 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062.outbound.protection.outlook.com [40.107.93.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A050C10C; Wed, 1 Nov 2023 14:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ek9WBuHQARMYBAp/YIEothSNSirpdpDB5k2FN6mznj2gQYcXLiig1+js/5UjymzgCgmJV9YIgpB6Yovmyab6iA+THYglJcDoqN8TfDDdW5/F/aSlF/DbfWr+UUms9YTyQyWExAGc39BRnKfM12wGCZiOtb/VqmK572T9cXowxQQFD4hCYwd09Gukyzlq5sgJZ/z2pPpl10rjz5fk128+kDCyntT+z5bp46DeJalViK3rGrvsbMcSL4FYdn1cm6+uMlDiKGj3ddCLrcbSrNC6WsFu46oiLlNixedLfDd2yFeGZ4AOldTF5LfiGPvYUCl4SSBQTuMszpt2FGfqsQTWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MOyzGbHDjAo81CbEl0nNGY8kW++DK5earoXJANxvLUQ=; b=ipH8w4FKx3vQ6VU3LLJ7mYFgdQrQMj9wGpXJqctKvBEDUhcUL61vl6DbDTG+6bxUNJg3IBYuXvAemCrNW6iWBdsoQXDfkU4ABe5F5wqmwxeJVXuGUvkQ9TwSLeqra2Xq51IHNp051aGh8o8wLmJhegORli57QyycAyg/2e1bNJLIklMWlmTgjF/19wNeHe18G/XrCMnvDKxjEuJt2TDAXZqJi9bruUYJKeP2U5YG73bnrlHG7Zs9lrXR2Ez8Hqjx/w2IrCIXPeOIAhnbEW4/khH9tFC7rLTL7P0dZd8BcVqayYi+SCQ25MAkfl3ZkZN1pL/opF16WCg4aFUZ4iif7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MOyzGbHDjAo81CbEl0nNGY8kW++DK5earoXJANxvLUQ=; b=J02LGlOekVCQzB36amLRogcMwpf/SwQuJktkGzdSQIHDmEPewEWy+zv6nwQ9C4IVoQ6IOAIZB8KJLjYV5yiuTEtVIiH5kKYcn6kqfCwicbvnXvwHlwLSYQSObHyu7uoyid8Yf/lYfIKpQdrDBvcIVViYSlb0EqFl0TecgeNOLkg= Received: from DS7PR03CA0214.namprd03.prod.outlook.com (2603:10b6:5:3ba::9) by PH7PR12MB8156.namprd12.prod.outlook.com (2603:10b6:510:2b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Wed, 1 Nov 2023 21:01:11 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::71) by DS7PR03CA0214.outlook.office365.com (2603:10b6:5:3ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Wed, 1 Nov 2023 21:01:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Wed, 1 Nov 2023 21:01:11 +0000 Received: from hamza-pc.localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 1 Nov 2023 16:01:08 -0500 From: Hamza Mahfooz <hamza.mahfooz@amd.com> To: <dri-devel@lists.freedesktop.org> CC: <amd-gfx@lists.freedesktop.org>, Alex Deucher <alexander.deucher@amd.com>, Aurabindo Pillai <aurabindo.pillai@amd.com>, Jerry Zuo <jerry.zuo@amd.com>, Hamza Mahfooz <hamza.mahfooz@amd.com>, <stable@vger.kernel.org>, "Harry Wentland" <harry.wentland@amd.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, <linux-kernel@vger.kernel.org> Subject: [PATCH] drm/edid: add a quirk for two 240Hz Samsung monitors Date: Wed, 1 Nov 2023 17:00:36 -0400 Message-ID: <20231101210037.130494-1-hamza.mahfooz@amd.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|PH7PR12MB8156:EE_ X-MS-Office365-Filtering-Correlation-Id: 189e38c9-b1a5-403a-9e29-08dbdb1dadb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E6KCRVNKFgL/ghEwvHDTsZPv6wY8K+LJ02XlzUEs1VGeCDRs+pedUyUP+xMd9ETO3O5teMayBUswpITYe25BwYucVUxZX1mwznTT2jF9sj2MLz9LN0Is3Sy6i5KMqcE1NnqoqqQ7/AG3A4KJgLsd8K1IYKegnokNh+hW7r8abBxI8WhClUdJBbH+1SeDhyTpxcAXApU9Gkum1iALuGWEdIneW0CN/6e7vXghDdSW7i9hzjL39v1MCpOSrrviKg0rD+aoVNv/clNQb9zY2sFk6jHbxBSaE6R3cojoVp1gpIxktx5dBfjM2y6wIs7l/8GMMhuf0AnOcTTL5phM1RnH+6kA95G5GXQy2yatdqEjKO5iN+9PvJjZPbkwj1MYmwpeRp8V1vlAvivV6i7smjp+mHIaEoXe/0gndQIyxqmgkJfleQDQ2ps966Ym5H1bMaAofSGXqD9pr3vOpWZBuLiiKxMtIczErDfb1+SWYcc+jkyWKVonOsVN2zL4a5gM9dptY2J3gttrMx6ooipe0N4/7irabRUru5rQJLdqO5PbGq1rJzTUJkBPxwEQnth6vPxOtosNnnnA8XlfTkJDtzBPIrjMnGiJy/6/zkBYDwxm7DCol+MuqnFyYVN3H3QvdQ94hemsiJ+X6vjymYbx/vFdKauxf/VnS1QmqdHHVyaoniIu4IWoT61edGvs/cllvHl0am89qFwuf3jgCVbghm8wTDrG5A2ZkBsEoA7bszyWKbpVAlbiQs6+0TKBZDJMwmgBJtx+JvOgBPchtIP5dd2LM+cNl98bEyA8Hcsin/6Siok= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(136003)(346002)(396003)(230922051799003)(451199024)(82310400011)(64100799003)(1800799009)(186009)(46966006)(36840700001)(40470700004)(426003)(54906003)(70586007)(316002)(70206006)(6916009)(336012)(478600001)(82740400003)(16526019)(1076003)(6666004)(2616005)(4326008)(26005)(40480700001)(44832011)(8936002)(83380400001)(8676002)(966005)(45080400002)(5660300002)(36756003)(47076005)(2906002)(40460700003)(81166007)(356005)(41300700001)(36860700001)(86362001)(16060500005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2023 21:01:11.4877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 189e38c9-b1a5-403a-9e29-08dbdb1dadb1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8156 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 14:01:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781396986372853940 X-GMAIL-MSGID: 1781396986372853940 |
Series |
drm/edid: add a quirk for two 240Hz Samsung monitors
|
|
Commit Message
Hamza Mahfooz
Nov. 1, 2023, 9 p.m. UTC
Without this fix the 5120x1440@240 timing of these monitors leads to screen flickering. Cc: stable@vger.kernel.org # 6.1+ Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1442 Co-developed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> --- drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-)
Comments
On Wed, Nov 1, 2023 at 5:01 PM Hamza Mahfooz <hamza.mahfooz@amd.com> wrote: > > Without this fix the 5120x1440@240 timing of these monitors > leads to screen flickering. > > Cc: stable@vger.kernel.org # 6.1+ > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1442 > Co-developed-by: Harry Wentland <harry.wentland@amd.com> > Signed-off-by: Harry Wentland <harry.wentland@amd.com> > Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> > --- > drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- > 1 file changed, 44 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index bca2af4fe1fc..3fdb8907f66b 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -89,6 +89,8 @@ static int oui(u8 first, u8 second, u8 third) > #define EDID_QUIRK_NON_DESKTOP (1 << 12) > /* Cap the DSC target bitrate to 15bpp */ > #define EDID_QUIRK_CAP_DSC_15BPP (1 << 13) > +/* Fix up a particular 5120x1440@240Hz timing */ > +#define EDID_QUIRK_FIXUP_5120_1440_240 (1 << 14) What is wrong with the original timing that needs to be fixed? Alex > > #define MICROSOFT_IEEE_OUI 0xca125c > > @@ -170,6 +172,12 @@ static const struct edid_quirk { > EDID_QUIRK('S', 'A', 'M', 596, EDID_QUIRK_PREFER_LARGE_60), > EDID_QUIRK('S', 'A', 'M', 638, EDID_QUIRK_PREFER_LARGE_60), > > + /* Samsung C49G95T */ > + EDID_QUIRK('S', 'A', 'M', 0x7053, EDID_QUIRK_FIXUP_5120_1440_240), > + > + /* Samsung S49AG95 */ > + EDID_QUIRK('S', 'A', 'M', 0x71ac, EDID_QUIRK_FIXUP_5120_1440_240), > + > /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ > EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), > > @@ -6586,7 +6594,37 @@ static void update_display_info(struct drm_connector *connector, > drm_edid_to_eld(connector, drm_edid); > } > > -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, > +static void drm_mode_displayid_detailed_edid_quirks(struct drm_connector *connector, > + struct drm_display_mode *mode) > +{ > + unsigned int hsync_width; > + unsigned int vsync_width; > + > + if (connector->display_info.quirks & EDID_QUIRK_FIXUP_5120_1440_240) { > + if (mode->hdisplay == 5120 && mode->vdisplay == 1440 && > + mode->clock == 1939490) { > + hsync_width = mode->hsync_end - mode->hsync_start; > + vsync_width = mode->vsync_end - mode->vsync_start; > + > + mode->clock = 2018490; > + mode->hdisplay = 5120; > + mode->hsync_start = 5120 + 8; > + mode->hsync_end = 5120 + 8 + hsync_width; > + mode->htotal = 5200; > + > + mode->vdisplay = 1440; > + mode->vsync_start = 1440 + 165; > + mode->vsync_end = 1440 + 165 + vsync_width; > + mode->vtotal = 1619; > + > + drm_dbg_kms(connector->dev, > + "[CONNECTOR:%d:%s] Samsung 240Hz mode quirk applied\n", > + connector->base.id, connector->name); > + } > + } > +} > + > +static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_connector *connector, > struct displayid_detailed_timings_1 *timings, > bool type_7) > { > @@ -6605,7 +6643,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; > bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; > > - mode = drm_mode_create(dev); > + mode = drm_mode_create(connector->dev); > if (!mode) > return NULL; > > @@ -6628,6 +6666,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > > if (timings->flags & 0x80) > mode->type |= DRM_MODE_TYPE_PREFERRED; > + > + drm_mode_displayid_detailed_edid_quirks(connector, mode); > + > drm_mode_set_name(mode); > > return mode; > @@ -6650,7 +6691,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, > for (i = 0; i < num_timings; i++) { > struct displayid_detailed_timings_1 *timings = &det->timings[i]; > > - newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); > + newmode = drm_mode_displayid_detailed(connector, timings, type_7); > if (!newmode) > continue; > > -- > 2.42.0 >
On Wed, 01 Nov 2023, Alex Deucher <alexdeucher@gmail.com> wrote: > On Wed, Nov 1, 2023 at 5:01 PM Hamza Mahfooz <hamza.mahfooz@amd.com> wrote: >> >> Without this fix the 5120x1440@240 timing of these monitors >> leads to screen flickering. >> >> Cc: stable@vger.kernel.org # 6.1+ >> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1442 >> Co-developed-by: Harry Wentland <harry.wentland@amd.com> >> Signed-off-by: Harry Wentland <harry.wentland@amd.com> >> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> >> --- >> drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- >> 1 file changed, 44 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c >> index bca2af4fe1fc..3fdb8907f66b 100644 >> --- a/drivers/gpu/drm/drm_edid.c >> +++ b/drivers/gpu/drm/drm_edid.c >> @@ -89,6 +89,8 @@ static int oui(u8 first, u8 second, u8 third) >> #define EDID_QUIRK_NON_DESKTOP (1 << 12) >> /* Cap the DSC target bitrate to 15bpp */ >> #define EDID_QUIRK_CAP_DSC_15BPP (1 << 13) >> +/* Fix up a particular 5120x1440@240Hz timing */ >> +#define EDID_QUIRK_FIXUP_5120_1440_240 (1 << 14) > > What is wrong with the original timing that needs to be fixed? Indeed. I'd be wary of applying this quirk as-is, because it'll impact all drivers and all connectors. The bug report does not have a single EDID from the affected displays attached. The quirk sets mode members that apparently do not need to be modified. Cc: Ville BR, Jani. > > Alex > > >> >> #define MICROSOFT_IEEE_OUI 0xca125c >> >> @@ -170,6 +172,12 @@ static const struct edid_quirk { >> EDID_QUIRK('S', 'A', 'M', 596, EDID_QUIRK_PREFER_LARGE_60), >> EDID_QUIRK('S', 'A', 'M', 638, EDID_QUIRK_PREFER_LARGE_60), >> >> + /* Samsung C49G95T */ >> + EDID_QUIRK('S', 'A', 'M', 0x7053, EDID_QUIRK_FIXUP_5120_1440_240), >> + >> + /* Samsung S49AG95 */ >> + EDID_QUIRK('S', 'A', 'M', 0x71ac, EDID_QUIRK_FIXUP_5120_1440_240), >> + >> /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ >> EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), >> >> @@ -6586,7 +6594,37 @@ static void update_display_info(struct drm_connector *connector, >> drm_edid_to_eld(connector, drm_edid); >> } >> >> -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, >> +static void drm_mode_displayid_detailed_edid_quirks(struct drm_connector *connector, >> + struct drm_display_mode *mode) >> +{ >> + unsigned int hsync_width; >> + unsigned int vsync_width; >> + >> + if (connector->display_info.quirks & EDID_QUIRK_FIXUP_5120_1440_240) { >> + if (mode->hdisplay == 5120 && mode->vdisplay == 1440 && >> + mode->clock == 1939490) { >> + hsync_width = mode->hsync_end - mode->hsync_start; >> + vsync_width = mode->vsync_end - mode->vsync_start; >> + >> + mode->clock = 2018490; >> + mode->hdisplay = 5120; >> + mode->hsync_start = 5120 + 8; >> + mode->hsync_end = 5120 + 8 + hsync_width; >> + mode->htotal = 5200; >> + >> + mode->vdisplay = 1440; >> + mode->vsync_start = 1440 + 165; >> + mode->vsync_end = 1440 + 165 + vsync_width; >> + mode->vtotal = 1619; >> + >> + drm_dbg_kms(connector->dev, >> + "[CONNECTOR:%d:%s] Samsung 240Hz mode quirk applied\n", >> + connector->base.id, connector->name); >> + } >> + } >> +} >> + >> +static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_connector *connector, >> struct displayid_detailed_timings_1 *timings, >> bool type_7) >> { >> @@ -6605,7 +6643,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d >> bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; >> bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; >> >> - mode = drm_mode_create(dev); >> + mode = drm_mode_create(connector->dev); >> if (!mode) >> return NULL; >> >> @@ -6628,6 +6666,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d >> >> if (timings->flags & 0x80) >> mode->type |= DRM_MODE_TYPE_PREFERRED; >> + >> + drm_mode_displayid_detailed_edid_quirks(connector, mode); >> + >> drm_mode_set_name(mode); >> >> return mode; >> @@ -6650,7 +6691,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, >> for (i = 0; i < num_timings; i++) { >> struct displayid_detailed_timings_1 *timings = &det->timings[i]; >> >> - newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); >> + newmode = drm_mode_displayid_detailed(connector, timings, type_7); >> if (!newmode) >> continue; >> >> -- >> 2.42.0 >>
On 11/1/23 17:36, Alex Deucher wrote: > On Wed, Nov 1, 2023 at 5:01 PM Hamza Mahfooz <hamza.mahfooz@amd.com> wrote: >> >> Without this fix the 5120x1440@240 timing of these monitors >> leads to screen flickering. >> >> Cc: stable@vger.kernel.org # 6.1+ >> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1442 >> Co-developed-by: Harry Wentland <harry.wentland@amd.com> >> Signed-off-by: Harry Wentland <harry.wentland@amd.com> >> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> >> --- >> drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- >> 1 file changed, 44 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c >> index bca2af4fe1fc..3fdb8907f66b 100644 >> --- a/drivers/gpu/drm/drm_edid.c >> +++ b/drivers/gpu/drm/drm_edid.c >> @@ -89,6 +89,8 @@ static int oui(u8 first, u8 second, u8 third) >> #define EDID_QUIRK_NON_DESKTOP (1 << 12) >> /* Cap the DSC target bitrate to 15bpp */ >> #define EDID_QUIRK_CAP_DSC_15BPP (1 << 13) >> +/* Fix up a particular 5120x1440@240Hz timing */ >> +#define EDID_QUIRK_FIXUP_5120_1440_240 (1 << 14) > > What is wrong with the original timing that needs to be fixed? Apparently, all of timing values for the 5120x1440@240 mode of these monitors aren't set correctly (they are all lower than they should be) in their EDIDs. For what it's worth, the windows driver has had a quirk similar the one proposed in this patch for ~2 years. > > Alex > > >> >> #define MICROSOFT_IEEE_OUI 0xca125c >> >> @@ -170,6 +172,12 @@ static const struct edid_quirk { >> EDID_QUIRK('S', 'A', 'M', 596, EDID_QUIRK_PREFER_LARGE_60), >> EDID_QUIRK('S', 'A', 'M', 638, EDID_QUIRK_PREFER_LARGE_60), >> >> + /* Samsung C49G95T */ >> + EDID_QUIRK('S', 'A', 'M', 0x7053, EDID_QUIRK_FIXUP_5120_1440_240), >> + >> + /* Samsung S49AG95 */ >> + EDID_QUIRK('S', 'A', 'M', 0x71ac, EDID_QUIRK_FIXUP_5120_1440_240), >> + >> /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ >> EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), >> >> @@ -6586,7 +6594,37 @@ static void update_display_info(struct drm_connector *connector, >> drm_edid_to_eld(connector, drm_edid); >> } >> >> -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, >> +static void drm_mode_displayid_detailed_edid_quirks(struct drm_connector *connector, >> + struct drm_display_mode *mode) >> +{ >> + unsigned int hsync_width; >> + unsigned int vsync_width; >> + >> + if (connector->display_info.quirks & EDID_QUIRK_FIXUP_5120_1440_240) { >> + if (mode->hdisplay == 5120 && mode->vdisplay == 1440 && >> + mode->clock == 1939490) { >> + hsync_width = mode->hsync_end - mode->hsync_start; >> + vsync_width = mode->vsync_end - mode->vsync_start; >> + >> + mode->clock = 2018490; >> + mode->hdisplay = 5120; >> + mode->hsync_start = 5120 + 8; >> + mode->hsync_end = 5120 + 8 + hsync_width; >> + mode->htotal = 5200; >> + >> + mode->vdisplay = 1440; >> + mode->vsync_start = 1440 + 165; >> + mode->vsync_end = 1440 + 165 + vsync_width; >> + mode->vtotal = 1619; >> + >> + drm_dbg_kms(connector->dev, >> + "[CONNECTOR:%d:%s] Samsung 240Hz mode quirk applied\n", >> + connector->base.id, connector->name); >> + } >> + } >> +} >> + >> +static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_connector *connector, >> struct displayid_detailed_timings_1 *timings, >> bool type_7) >> { >> @@ -6605,7 +6643,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d >> bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; >> bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; >> >> - mode = drm_mode_create(dev); >> + mode = drm_mode_create(connector->dev); >> if (!mode) >> return NULL; >> >> @@ -6628,6 +6666,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d >> >> if (timings->flags & 0x80) >> mode->type |= DRM_MODE_TYPE_PREFERRED; >> + >> + drm_mode_displayid_detailed_edid_quirks(connector, mode); >> + >> drm_mode_set_name(mode); >> >> return mode; >> @@ -6650,7 +6691,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, >> for (i = 0; i < num_timings; i++) { >> struct displayid_detailed_timings_1 *timings = &det->timings[i]; >> >> - newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); >> + newmode = drm_mode_displayid_detailed(connector, timings, type_7); >> if (!newmode) >> continue; >> >> -- >> 2.42.0 >>
On Thu, Nov 2, 2023 at 3:00 PM Hamza Mahfooz <hamza.mahfooz@amd.com> wrote: > > On 11/1/23 17:36, Alex Deucher wrote: > > On Wed, Nov 1, 2023 at 5:01 PM Hamza Mahfooz <hamza.mahfooz@amd.com> wrote: > >> > >> Without this fix the 5120x1440@240 timing of these monitors > >> leads to screen flickering. > >> > >> Cc: stable@vger.kernel.org # 6.1+ > >> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1442 > >> Co-developed-by: Harry Wentland <harry.wentland@amd.com> > >> Signed-off-by: Harry Wentland <harry.wentland@amd.com> > >> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> > >> --- > >> drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- > >> 1 file changed, 44 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > >> index bca2af4fe1fc..3fdb8907f66b 100644 > >> --- a/drivers/gpu/drm/drm_edid.c > >> +++ b/drivers/gpu/drm/drm_edid.c > >> @@ -89,6 +89,8 @@ static int oui(u8 first, u8 second, u8 third) > >> #define EDID_QUIRK_NON_DESKTOP (1 << 12) > >> /* Cap the DSC target bitrate to 15bpp */ > >> #define EDID_QUIRK_CAP_DSC_15BPP (1 << 13) > >> +/* Fix up a particular 5120x1440@240Hz timing */ > >> +#define EDID_QUIRK_FIXUP_5120_1440_240 (1 << 14) > > > > What is wrong with the original timing that needs to be fixed? > > Apparently, all of timing values for the 5120x1440@240 mode of these > monitors aren't set correctly (they are all lower than they should be) > in their EDIDs. For what it's worth, the windows driver has had a quirk > similar the one proposed in this patch for ~2 years. It would be good to at least include the original mode timings from the EDID and the new ones added by the quirk in the commit message and a description of why they are problematic and why the new ones work. Alex > > > > > Alex > > > > > >> > >> #define MICROSOFT_IEEE_OUI 0xca125c > >> > >> @@ -170,6 +172,12 @@ static const struct edid_quirk { > >> EDID_QUIRK('S', 'A', 'M', 596, EDID_QUIRK_PREFER_LARGE_60), > >> EDID_QUIRK('S', 'A', 'M', 638, EDID_QUIRK_PREFER_LARGE_60), > >> > >> + /* Samsung C49G95T */ > >> + EDID_QUIRK('S', 'A', 'M', 0x7053, EDID_QUIRK_FIXUP_5120_1440_240), > >> + > >> + /* Samsung S49AG95 */ > >> + EDID_QUIRK('S', 'A', 'M', 0x71ac, EDID_QUIRK_FIXUP_5120_1440_240), > >> + > >> /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ > >> EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), > >> > >> @@ -6586,7 +6594,37 @@ static void update_display_info(struct drm_connector *connector, > >> drm_edid_to_eld(connector, drm_edid); > >> } > >> > >> -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, > >> +static void drm_mode_displayid_detailed_edid_quirks(struct drm_connector *connector, > >> + struct drm_display_mode *mode) > >> +{ > >> + unsigned int hsync_width; > >> + unsigned int vsync_width; > >> + > >> + if (connector->display_info.quirks & EDID_QUIRK_FIXUP_5120_1440_240) { > >> + if (mode->hdisplay == 5120 && mode->vdisplay == 1440 && > >> + mode->clock == 1939490) { > >> + hsync_width = mode->hsync_end - mode->hsync_start; > >> + vsync_width = mode->vsync_end - mode->vsync_start; > >> + > >> + mode->clock = 2018490; > >> + mode->hdisplay = 5120; > >> + mode->hsync_start = 5120 + 8; > >> + mode->hsync_end = 5120 + 8 + hsync_width; > >> + mode->htotal = 5200; > >> + > >> + mode->vdisplay = 1440; > >> + mode->vsync_start = 1440 + 165; > >> + mode->vsync_end = 1440 + 165 + vsync_width; > >> + mode->vtotal = 1619; > >> + > >> + drm_dbg_kms(connector->dev, > >> + "[CONNECTOR:%d:%s] Samsung 240Hz mode quirk applied\n", > >> + connector->base.id, connector->name); > >> + } > >> + } > >> +} > >> + > >> +static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_connector *connector, > >> struct displayid_detailed_timings_1 *timings, > >> bool type_7) > >> { > >> @@ -6605,7 +6643,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > >> bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; > >> bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; > >> > >> - mode = drm_mode_create(dev); > >> + mode = drm_mode_create(connector->dev); > >> if (!mode) > >> return NULL; > >> > >> @@ -6628,6 +6666,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > >> > >> if (timings->flags & 0x80) > >> mode->type |= DRM_MODE_TYPE_PREFERRED; > >> + > >> + drm_mode_displayid_detailed_edid_quirks(connector, mode); > >> + > >> drm_mode_set_name(mode); > >> > >> return mode; > >> @@ -6650,7 +6691,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, > >> for (i = 0; i < num_timings; i++) { > >> struct displayid_detailed_timings_1 *timings = &det->timings[i]; > >> > >> - newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); > >> + newmode = drm_mode_displayid_detailed(connector, timings, type_7); > >> if (!newmode) > >> continue; > >> > >> -- > >> 2.42.0 > >> > -- > Hamza >
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index bca2af4fe1fc..3fdb8907f66b 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -89,6 +89,8 @@ static int oui(u8 first, u8 second, u8 third) #define EDID_QUIRK_NON_DESKTOP (1 << 12) /* Cap the DSC target bitrate to 15bpp */ #define EDID_QUIRK_CAP_DSC_15BPP (1 << 13) +/* Fix up a particular 5120x1440@240Hz timing */ +#define EDID_QUIRK_FIXUP_5120_1440_240 (1 << 14) #define MICROSOFT_IEEE_OUI 0xca125c @@ -170,6 +172,12 @@ static const struct edid_quirk { EDID_QUIRK('S', 'A', 'M', 596, EDID_QUIRK_PREFER_LARGE_60), EDID_QUIRK('S', 'A', 'M', 638, EDID_QUIRK_PREFER_LARGE_60), + /* Samsung C49G95T */ + EDID_QUIRK('S', 'A', 'M', 0x7053, EDID_QUIRK_FIXUP_5120_1440_240), + + /* Samsung S49AG95 */ + EDID_QUIRK('S', 'A', 'M', 0x71ac, EDID_QUIRK_FIXUP_5120_1440_240), + /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), @@ -6586,7 +6594,37 @@ static void update_display_info(struct drm_connector *connector, drm_edid_to_eld(connector, drm_edid); } -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, +static void drm_mode_displayid_detailed_edid_quirks(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + unsigned int hsync_width; + unsigned int vsync_width; + + if (connector->display_info.quirks & EDID_QUIRK_FIXUP_5120_1440_240) { + if (mode->hdisplay == 5120 && mode->vdisplay == 1440 && + mode->clock == 1939490) { + hsync_width = mode->hsync_end - mode->hsync_start; + vsync_width = mode->vsync_end - mode->vsync_start; + + mode->clock = 2018490; + mode->hdisplay = 5120; + mode->hsync_start = 5120 + 8; + mode->hsync_end = 5120 + 8 + hsync_width; + mode->htotal = 5200; + + mode->vdisplay = 1440; + mode->vsync_start = 1440 + 165; + mode->vsync_end = 1440 + 165 + vsync_width; + mode->vtotal = 1619; + + drm_dbg_kms(connector->dev, + "[CONNECTOR:%d:%s] Samsung 240Hz mode quirk applied\n", + connector->base.id, connector->name); + } + } +} + +static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_connector *connector, struct displayid_detailed_timings_1 *timings, bool type_7) { @@ -6605,7 +6643,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; - mode = drm_mode_create(dev); + mode = drm_mode_create(connector->dev); if (!mode) return NULL; @@ -6628,6 +6666,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d if (timings->flags & 0x80) mode->type |= DRM_MODE_TYPE_PREFERRED; + + drm_mode_displayid_detailed_edid_quirks(connector, mode); + drm_mode_set_name(mode); return mode; @@ -6650,7 +6691,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, for (i = 0; i < num_timings; i++) { struct displayid_detailed_timings_1 *timings = &det->timings[i]; - newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); + newmode = drm_mode_displayid_detailed(connector, timings, type_7); if (!newmode) continue;