Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 175F3606A31A for ; Tue, 1 Dec 2026 20:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=WSmLfcsX Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A671510FCE4; Tue, 1 Dec 2026 20:27:10 +0000 (UTC) Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010020.outbound.protection.outlook.com [40.93.198.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id C233710FCDD for ; Tue, 1 Dec 2026 20:26:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FZQvA6G2bOdtvVfYXpmoixHgndFYWWAh/KF8fg9N9yMp5pYGVof4srxfgVSPUBhsguXH0Wmyd4kEeFtqpHibpXj45tiCcACeCKrH28t/eDWwPHwlVruNmvPBEFvBmdHXWN2rkhmwI7WEb+12c8LOD2VOCyPOFlLndCZT2IbedCzWGKewiZ2l/qI3RwUnoxVBsEX7tj5LyOy6+M4vU/fUECJJH0HmZ2ng6BthZmuNNhlmp96K/NxMF0ijIq399h3crc2zVWTidn9gXJNLSwUFFZEY7rz2DhMko+1d3rKWZA6QMZzNEglQZo6Ptd38J8VIN5YNXdjQu7FOiDlDDpdlGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GpKzeatMSahjWJnP37CZqWtRARBUPiTr+lWXdeByP+0=; b=s57J1XohlVwtYNCpZTwS3VpfNbq8kzmOwT3Qx4USn9A+hqNLhvQICmUxDXtzXeM1TMJcnhQVl5OCLHuxiWOGQpVmwtjPv3nKeQRzUgkPuN7Dvn/4iPwpjfu0hnsW8xidQUddcAKCQ0TQiAES4wtqZ7lgVWqVOlL2ySR8BJPa2NudSd3pplkyi8WyFbpttRIKV4YvDAwOsD6Xtl6Myqdf2sTA0J2/hqCluTMLOteMulJLKsQ8eofCI5gfHu53Smja59jDtauA3JLuKUctWn18dWxcxShLdcx5mQ8VZ4KQRxdmlqkRPwLNFKCwAOF6IyYMRjujwiNwVj9MmfXZ6c/FJg== 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=GpKzeatMSahjWJnP37CZqWtRARBUPiTr+lWXdeByP+0=; b=WSmLfcsXaXavX4g9/fT9U/y6EXysk5QKUdQWIvs06RmaRTT8tYMIgrE3krvx3mWjvC3Un726LPl+XlqzOkhjZfGI91MUkGX7+OrXefpdwX2jaCpDBbHVMB6vRITJ+mKWnvzg015CfF8XH20nTFndeRA6DgFbAwsfm04297wPYac= Received: from DS1PR06CA0026.namprd06.prod.outlook.com (2603:10b6:8:23e::18) by SN7PR12MB8001.namprd12.prod.outlook.com (2603:10b6:806:340::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 20:26:35 +0000 Received: from CH7PEPF0000001C.namprd21.prod.outlook.com (2603:10b6:8:23e:cafe::1f) by DS1PR06CA0026.outlook.office365.com (2603:10b6:8:23e::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 20:26:35 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH7PEPF0000001C.mail.protection.outlook.com (10.167.244.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.0 via Frontend Transport; Tue, 1 Dec 2026 20:26:35 +0000 Received: from georzhanmkm.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 14:26:26 -0600 From: George Zhang To: CC: Harry Wentland , Leo Li , Aurabindo Pillai , Roman Li , Wayne Lin , Tom Chung , "Fangzhi Zuo" , Dan Wheeler , Ray Wu , Ivan Lipski , Alex Hung , James Lin , Chenyu Chen , deguo , Samson Tam , George Zhang Subject: [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds Date: Tue, 1 Dec 2026 15:22:43 -0500 Message-ID: <20261201202451.463794-11-george.zhang@amd.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201202451.463794-2-george.zhang@amd.com> References: <20261201202451.463794-2-george.zhang@amd.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH7PEPF0000001C:EE_|SN7PR12MB8001:EE_ X-MS-Office365-Filtering-Correlation-Id: 015c4f63-911a-4098-1f85-08df4fe9654f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700016|1800799024|23010399003|11063799006|261009223027099003|18002099003|22082099003|3023799007|10067099003|261028144727099003|56012099006|261026140227099003|261021121427099003|261021123027099003|261022075727099003|261102123227099003|261022105027099003; X-Microsoft-Antispam-Message-Info: G92xHx8JXanwLtAniobqU6x63KXqJoEykHwaa6l6mVq62xSk1Vv4WOOj+OY36xZAbgXEWKmfZXDrgpfd3lL6J4G+LMW7dSmEjHoi9ydc6c8sqx8LVKL4on4rPVPff4Fjc1tVJWr6LN96EPJMeQB07hoCXRpy1lD7PvzYG1nadqtTAc+BVSSdbRq5nqQW6X+KIYlJCWiydhw/cd4gm+xlRFLn1zCYt8NeRmeT3UQU6dXCeTMVMcTSzMctJYYEUb5tMOEC7+2xHrMTJojZD3CCSq/kdPT1FCRVQRUaJiMgX9Z0JgNzVrbI1UCqONu84XjzFO6ru05dlp/L9Wiie4HbUv+V9jZwr5KObg6PPtTTlKN8MgMuIsoRHXaiyW95iZBhwkwQzWYNknUzoE+psMJZxgGto99m9K8V4eLYIGQ9podorR9GHSYwladdEAGL0pEkhKpAZusqFRn/MDa3jHTJtSQsFSzziZrIw1cIgPULvlksKkcLr/AiyTuQLlaqMiWhjOMuItMRnE+zYyrfrHzNEEuMffuW/z5A1/JYpRR9idsKdmH+SSaI+S3igJY3TSAGUU3GT6S5ADNoG5DZ+iV4ViVz94XKUDrbc9I3xSyopP4JDN02H8b8KDfw244o7QtiobdHDMYd8ZHa9a4qU1Jkgdf751s+7QgCJ+/T4IaKcGc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700016)(1800799024)(23010399003)(11063799006)(261009223027099003)(18002099003)(22082099003)(3023799007)(10067099003)(261028144727099003)(56012099006)(261026140227099003)(261021121427099003)(261021123027099003)(261022075727099003)(261102123227099003)(261022105027099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: taggYVPfYy2YxeWbD8xFJDOo6wGH+v+7tE0M2SVxK8X/b6jivJ7rmuwxBRKAfJaAXLG6JEyld5cRqcNBl5Fmo9YcZ8Zo+pxGb8gMJjcx2Z6CDB6GO55aJ7dP/riYg4nLbckreTCZy8Zl+LFP5xztrD/cQT0lXfpsnjhuEnGaCByRj1h1fWg//ckiov65o3lXscwcW21XSB3Qsmk3X5tgPsXhaBptOQ1SqK0fG4dSWtDdFlcUBxyqynOdXgeQshAmkGikE3HdAx2sju49hq3LYGhtWnuIdX1agdvs1TnyscxUXcn1ro7kAr6a2bgPJVQa6TMcUSC1D8uz9QNXci09dlRmagJkoln9CFQMD+OncFHXhEWXNtAucQuVUWrUbr3M/LxFefKCK+wopDN3p+QsAyE5heDPUanwknbMsCnaEDm1eyoeJa/9+IaaEDC5tgL1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 20:26:35.5005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 015c4f63-911a-4098-1f85-08df4fe9654f 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH7PEPF0000001C.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8001 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: deguo [WHY] EASF register lookups and filter selection repeatedly convert constant scale-ratio thresholds to 31.32 fixed-point values at runtime. [HOW] Precompute the thresholds at compile time with the same rounding as spl_fixpt_from_fraction. Use them for register lookups and 3/4/6-tap coefficient selection in both S1.10 and S1.12 formats. Mark the lookup tables const. Name the macro parameters num and denom. Cc: Samson Tam Signed-off-by: Deshui Guo Signed-off-by: George Zhang --- .../display/dc/sspl/dc_spl_scl_easf_filters.c | 478 +++++++++--------- .../display/dc/sspl/dc_spl_scl_easf_filters.h | 3 +- 2 files changed, 241 insertions(+), 240 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c index ffc35041d901..c2aa2bbe0dc1 100644 --- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c +++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c @@ -2000,213 +2000,217 @@ static const uint16_t easf_filter_6tap_64p_ratio_1_00_s1_12[198] = { 0x0064, 0x3dd4, 0x09c8, 0x09c8, 0x3dd4, 0x0064, }; -static struct scale_ratio_to_reg_value_lookup easf_v_bf3_mode_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x0000}, - {9, 10, 0x0000}, - {1, 1, 0x0000}, - {-1, -1, 0x0002}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_h_bf3_mode_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x0000}, - {9, 10, 0x0000}, - {1, 1, 0x0000}, - {-1, -1, 0x0002}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_6tap_lookup[] = { - {3, 10, 0x4100}, - {4, 10, 0x4100}, - {5, 10, 0x4100}, - {6, 10, 0x4100}, - {7, 10, 0x4100}, - {8, 10, 0x4100}, - {9, 10, 0x4100}, - {1, 1, 0x4100}, - {-1, -1, 0x4100}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_6tap_lookup[] = { - {3, 10, 0x4000}, - {4, 10, 0x4000}, - {5, 10, 0x4000}, - {6, 10, 0x4000}, - {7, 10, 0x4000}, - {8, 10, 0x4000}, - {9, 10, 0x4000}, - {1, 1, 0x4000}, - {-1, -1, 0x4000}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_gain_ring6_6tap_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x251F}, - {5, 10, 0x291F}, - {6, 10, 0xA51F}, - {7, 10, 0xA51F}, - {8, 10, 0xAA66}, - {9, 10, 0xA51F}, - {1, 1, 0xA640}, - {-1, -1, 0xA640}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_gain_ring4_6tap_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x9600}, - {5, 10, 0xA460}, - {6, 10, 0xA8E0}, - {7, 10, 0xAC00}, - {8, 10, 0xAD20}, - {9, 10, 0xAFC0}, - {1, 1, 0xB058}, - {-1, -1, 0xB058}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_4tap_lookup[] = { - {3, 10, 0x4100}, - {4, 10, 0x4100}, - {5, 10, 0x4100}, - {6, 10, 0x4100}, - {7, 10, 0x4100}, - {8, 10, 0x4100}, - {9, 10, 0x4100}, - {1, 1, 0x4100}, - {-1, -1, 0x4100}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_4tap_lookup[] = { - {3, 10, 0x4000}, - {4, 10, 0x4000}, - {5, 10, 0x4000}, - {6, 10, 0x4000}, - {7, 10, 0x4000}, - {8, 10, 0x4000}, - {9, 10, 0x4000}, - {1, 1, 0x4000}, - {-1, -1, 0x4000}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_gain_ring6_4tap_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x0000}, - {9, 10, 0x0000}, - {1, 1, 0x0000}, - {-1, -1, 0x0000}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_gain_ring4_4tap_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x9900}, - {7, 10, 0xA100}, - {8, 10, 0xA8C0}, - {9, 10, 0xAB20}, - {1, 1, 0xAC00}, - {-1, -1, 0xAC00}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_uptilt_offset_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x4100}, - {9, 10, 0x9F00}, - {1, 1, 0xA4C0}, - {-1, -1, 0xA8D8}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt_maxval_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x4000}, - {9, 10, 0x24FE}, - {1, 1, 0x2D64}, - {-1, -1, 0x3ADB}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_slope_lookup[] = { - {3, 10, 0x3800}, - {4, 10, 0x3800}, - {5, 10, 0x3800}, - {6, 10, 0x3800}, - {7, 10, 0x3800}, - {8, 10, 0x3886}, - {9, 10, 0x3940}, - {1, 1, 0x3A4E}, - {-1, -1, 0x3B66}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt1_slope_lookup[] = { - {3, 10, 0x3800}, - {4, 10, 0x3800}, - {5, 10, 0x3800}, - {6, 10, 0x3800}, - {7, 10, 0x3800}, - {8, 10, 0x36F4}, - {9, 10, 0x359C}, - {1, 1, 0x3360}, - {-1, -1, 0x2F20}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_slope_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x0000}, - {9, 10, 0x359C}, - {1, 1, 0x31F0}, - {-1, -1, 0x1F00}, -}; - -static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_offset_lookup[] = { - {3, 10, 0x0000}, - {4, 10, 0x0000}, - {5, 10, 0x0000}, - {6, 10, 0x0000}, - {7, 10, 0x0000}, - {8, 10, 0x0000}, - {9, 10, 0x9F00}, - {1, 1, 0xA400}, - {-1, -1, 0x9E00}, +#define EASF_SCALE_RATIO(num, denom) \ + ((((long long)(num) << FIXED31_32_BITS_PER_FRACTIONAL_PART) + \ + (denom) / 2) / (denom)) + +static const struct scale_ratio_to_reg_value_lookup easf_v_bf3_mode_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x0000}, + {EASF_SCALE_RATIO(9, 10), 0x0000}, + {EASF_SCALE_RATIO(1, 1), 0x0000}, + {-1, 0x0002}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_h_bf3_mode_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x0000}, + {EASF_SCALE_RATIO(9, 10), 0x0000}, + {EASF_SCALE_RATIO(1, 1), 0x0000}, + {-1, 0x0002}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_6tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x4100}, + {EASF_SCALE_RATIO(4, 10), 0x4100}, + {EASF_SCALE_RATIO(5, 10), 0x4100}, + {EASF_SCALE_RATIO(6, 10), 0x4100}, + {EASF_SCALE_RATIO(7, 10), 0x4100}, + {EASF_SCALE_RATIO(8, 10), 0x4100}, + {EASF_SCALE_RATIO(9, 10), 0x4100}, + {EASF_SCALE_RATIO(1, 1), 0x4100}, + {-1, 0x4100}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_6tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x4000}, + {EASF_SCALE_RATIO(4, 10), 0x4000}, + {EASF_SCALE_RATIO(5, 10), 0x4000}, + {EASF_SCALE_RATIO(6, 10), 0x4000}, + {EASF_SCALE_RATIO(7, 10), 0x4000}, + {EASF_SCALE_RATIO(8, 10), 0x4000}, + {EASF_SCALE_RATIO(9, 10), 0x4000}, + {EASF_SCALE_RATIO(1, 1), 0x4000}, + {-1, 0x4000}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_gain_ring6_6tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x251F}, + {EASF_SCALE_RATIO(5, 10), 0x291F}, + {EASF_SCALE_RATIO(6, 10), 0xA51F}, + {EASF_SCALE_RATIO(7, 10), 0xA51F}, + {EASF_SCALE_RATIO(8, 10), 0xAA66}, + {EASF_SCALE_RATIO(9, 10), 0xA51F}, + {EASF_SCALE_RATIO(1, 1), 0xA640}, + {-1, 0xA640}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_gain_ring4_6tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x9600}, + {EASF_SCALE_RATIO(5, 10), 0xA460}, + {EASF_SCALE_RATIO(6, 10), 0xA8E0}, + {EASF_SCALE_RATIO(7, 10), 0xAC00}, + {EASF_SCALE_RATIO(8, 10), 0xAD20}, + {EASF_SCALE_RATIO(9, 10), 0xAFC0}, + {EASF_SCALE_RATIO(1, 1), 0xB058}, + {-1, 0xB058}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_4tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x4100}, + {EASF_SCALE_RATIO(4, 10), 0x4100}, + {EASF_SCALE_RATIO(5, 10), 0x4100}, + {EASF_SCALE_RATIO(6, 10), 0x4100}, + {EASF_SCALE_RATIO(7, 10), 0x4100}, + {EASF_SCALE_RATIO(8, 10), 0x4100}, + {EASF_SCALE_RATIO(9, 10), 0x4100}, + {EASF_SCALE_RATIO(1, 1), 0x4100}, + {-1, 0x4100}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_4tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x4000}, + {EASF_SCALE_RATIO(4, 10), 0x4000}, + {EASF_SCALE_RATIO(5, 10), 0x4000}, + {EASF_SCALE_RATIO(6, 10), 0x4000}, + {EASF_SCALE_RATIO(7, 10), 0x4000}, + {EASF_SCALE_RATIO(8, 10), 0x4000}, + {EASF_SCALE_RATIO(9, 10), 0x4000}, + {EASF_SCALE_RATIO(1, 1), 0x4000}, + {-1, 0x4000}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_gain_ring6_4tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x0000}, + {EASF_SCALE_RATIO(9, 10), 0x0000}, + {EASF_SCALE_RATIO(1, 1), 0x0000}, + {-1, 0x0000}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_gain_ring4_4tap_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x9900}, + {EASF_SCALE_RATIO(7, 10), 0xA100}, + {EASF_SCALE_RATIO(8, 10), 0xA8C0}, + {EASF_SCALE_RATIO(9, 10), 0xAB20}, + {EASF_SCALE_RATIO(1, 1), 0xAC00}, + {-1, 0xAC00}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_uptilt_offset_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x4100}, + {EASF_SCALE_RATIO(9, 10), 0x9F00}, + {EASF_SCALE_RATIO(1, 1), 0xA4C0}, + {-1, 0xA8D8}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt_maxval_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x4000}, + {EASF_SCALE_RATIO(9, 10), 0x24FE}, + {EASF_SCALE_RATIO(1, 1), 0x2D64}, + {-1, 0x3ADB}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_slope_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x3800}, + {EASF_SCALE_RATIO(4, 10), 0x3800}, + {EASF_SCALE_RATIO(5, 10), 0x3800}, + {EASF_SCALE_RATIO(6, 10), 0x3800}, + {EASF_SCALE_RATIO(7, 10), 0x3800}, + {EASF_SCALE_RATIO(8, 10), 0x3886}, + {EASF_SCALE_RATIO(9, 10), 0x3940}, + {EASF_SCALE_RATIO(1, 1), 0x3A4E}, + {-1, 0x3B66}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt1_slope_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x3800}, + {EASF_SCALE_RATIO(4, 10), 0x3800}, + {EASF_SCALE_RATIO(5, 10), 0x3800}, + {EASF_SCALE_RATIO(6, 10), 0x3800}, + {EASF_SCALE_RATIO(7, 10), 0x3800}, + {EASF_SCALE_RATIO(8, 10), 0x36F4}, + {EASF_SCALE_RATIO(9, 10), 0x359C}, + {EASF_SCALE_RATIO(1, 1), 0x3360}, + {-1, 0x2F20}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_slope_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x0000}, + {EASF_SCALE_RATIO(9, 10), 0x359C}, + {EASF_SCALE_RATIO(1, 1), 0x31F0}, + {-1, 0x1F00}, +}; + +static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_offset_lookup[] = { + {EASF_SCALE_RATIO(3, 10), 0x0000}, + {EASF_SCALE_RATIO(4, 10), 0x0000}, + {EASF_SCALE_RATIO(5, 10), 0x0000}, + {EASF_SCALE_RATIO(6, 10), 0x0000}, + {EASF_SCALE_RATIO(7, 10), 0x0000}, + {EASF_SCALE_RATIO(8, 10), 0x0000}, + {EASF_SCALE_RATIO(9, 10), 0x9F00}, + {EASF_SCALE_RATIO(1, 1), 0xA400}, + {-1, 0x9E00}, }; static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_3tap_64p_ratio_0_30_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_3tap_64p_ratio_0_40_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_3tap_64p_ratio_0_50_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_3tap_64p_ratio_0_60_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_3tap_64p_ratio_0_70_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_3tap_64p_ratio_0_80_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_3tap_64p_ratio_0_90_s1_12; else return easf_filter_3tap_64p_ratio_1_00_s1_12; @@ -2214,19 +2218,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio) static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_4tap_64p_ratio_0_30_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_4tap_64p_ratio_0_40_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_4tap_64p_ratio_0_50_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_4tap_64p_ratio_0_60_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_4tap_64p_ratio_0_70_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_4tap_64p_ratio_0_80_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_4tap_64p_ratio_0_90_s1_12; else return easf_filter_4tap_64p_ratio_1_00_s1_12; @@ -2234,19 +2238,19 @@ static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio) static const uint16_t *spl_get_easf_filter_6tap_64p(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_6tap_64p_ratio_0_30_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_6tap_64p_ratio_0_40_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_6tap_64p_ratio_0_50_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_6tap_64p_ratio_0_60_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_6tap_64p_ratio_0_70_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_6tap_64p_ratio_0_80_s1_12; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_6tap_64p_ratio_0_90_s1_12; else return easf_filter_6tap_64p_ratio_1_00_s1_12; @@ -2270,19 +2274,19 @@ const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p( static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_3tap_64p_ratio_0_30; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_3tap_64p_ratio_0_40; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_3tap_64p_ratio_0_50; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_3tap_64p_ratio_0_60; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_3tap_64p_ratio_0_70; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_3tap_64p_ratio_0_80; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_3tap_64p_ratio_0_90; else return easf_filter_3tap_64p_ratio_1_00; @@ -2290,19 +2294,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32 static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_4tap_64p_ratio_0_30; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_4tap_64p_ratio_0_40; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_4tap_64p_ratio_0_50; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_4tap_64p_ratio_0_60; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_4tap_64p_ratio_0_70; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_4tap_64p_ratio_0_80; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_4tap_64p_ratio_0_90; else return easf_filter_4tap_64p_ratio_1_00; @@ -2310,19 +2314,19 @@ static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32 static const uint16_t *spl_get_easf_filter_6tap_64p_s1_10(struct spl_fixed31_32 ratio) { - if (ratio.value < spl_fixpt_from_fraction(3, 10).value) + if (ratio.value < EASF_SCALE_RATIO(3, 10)) return easf_filter_6tap_64p_ratio_0_30; - else if (ratio.value < spl_fixpt_from_fraction(4, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(4, 10)) return easf_filter_6tap_64p_ratio_0_40; - else if (ratio.value < spl_fixpt_from_fraction(5, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(5, 10)) return easf_filter_6tap_64p_ratio_0_50; - else if (ratio.value < spl_fixpt_from_fraction(6, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(6, 10)) return easf_filter_6tap_64p_ratio_0_60; - else if (ratio.value < spl_fixpt_from_fraction(7, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(7, 10)) return easf_filter_6tap_64p_ratio_0_70; - else if (ratio.value < spl_fixpt_from_fraction(8, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(8, 10)) return easf_filter_6tap_64p_ratio_0_80; - else if (ratio.value < spl_fixpt_from_fraction(9, 10).value) + else if (ratio.value < EASF_SCALE_RATIO(9, 10)) return easf_filter_6tap_64p_ratio_0_90; else return easf_filter_6tap_64p_ratio_1_00; @@ -2381,12 +2385,12 @@ void SPL_NAMESPACE(spl_set_filters_data(struct dscl_prog_data *dscl_prog_data, } static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 ratio, - struct scale_ratio_to_reg_value_lookup *lookup_table_base_ptr, + const struct scale_ratio_to_reg_value_lookup *lookup_table_base_ptr, unsigned int num_entries) { unsigned int count = 0; uint32_t value = 0; - struct scale_ratio_to_reg_value_lookup *lookup_table_index_ptr; + const struct scale_ratio_to_reg_value_lookup *lookup_table_index_ptr; lookup_table_index_ptr = (lookup_table_base_ptr + num_entries - 1); value = lookup_table_index_ptr->reg_value; @@ -2394,12 +2398,10 @@ static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 rati while (count < num_entries) { lookup_table_index_ptr = (lookup_table_base_ptr + count); - if (lookup_table_index_ptr->numer < 0) + if (lookup_table_index_ptr->scale_ratio < 0) break; - if (ratio.value < spl_fixpt_from_fraction( - lookup_table_index_ptr->numer, - lookup_table_index_ptr->denom).value) { + if (ratio.value < lookup_table_index_ptr->scale_ratio) { value = lookup_table_index_ptr->reg_value; break; } diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h index ba1cdb8be417..49c30d53e1dd 100644 --- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h +++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h @@ -8,8 +8,7 @@ #include "dc_spl_types.h" struct scale_ratio_to_reg_value_lookup { - int numer; - int denom; + long long scale_ratio; const uint32_t reg_value; }; -- 2.56.1