From patchwork Mon Feb 26 21:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13572881 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 96FBFC48BF6 for ; Mon, 26 Feb 2024 21:13:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 82B7610F232; Mon, 26 Feb 2024 21:11:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="qQhijzVT"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id D818410F24B; Mon, 26 Feb 2024 21:11:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lQaNlHrwJDNuq0hhOVHR6ckyHpKS7DwcBU29LfPAs39ah6hhvg/7c1obmqLcJtzx2qXACVJBTL+fUuwmKfhi5nHX9oEAPatLlwnMR36xnHfrif8UDi+xOch8DTo83NtSbi4g6PDEpmCFTFuB8nyg6wzxurZjNK7qVFgYguR15bwR4VGIyKv30tTlKJPIGdVDe73OPtigmU4JrRiH15/F8goQMprDFlldq8GEyXCu6IugwTCpxbUvdQZZT4Vfwr0lnMc1E9FEw6Iw8ycJDAVq4LHXGT0/5n+JwpMu7wbwe35i6jZe0+tDhAPjghqMQ10PMZCGQ4hfYnDc3RAjIeY0ug== 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=lqiOL+mdpBmkCeCP3qk8Mji52bf9GGejJjbqPrxjzbs=; b=ZCtDXcR4yaqflwhCDdY3v2ZaHSzBR7H5W7UzVRs5UxvaJujsozYB2uA044tjHIj72uRvIyZQnpjuE/GAWgMAzdw6cT9Ttc+2UtRg03brZTBWW//bIWJj+pNI2LavdLtY/KHxl6M/mIxeh8Vt1n6hnDASUV6OwygrZ7reVY3x1JDBtuXlvw6SmkUKEo5x6KF69hZM646pQtc78R/63bILPGCkgEfzFKsTAaTsiOL9AuHA3qjAqX2hn94AVqJH0nanagdju2cYgbDfIYa9EI/KRgw6ReY4MlRh1x/5un/ESgjWFSGxY+eUdPj+BTDwRt5eUgOC2iyorSiJVVwYOOcKxg== 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=lqiOL+mdpBmkCeCP3qk8Mji52bf9GGejJjbqPrxjzbs=; b=qQhijzVTk0sCjZ84EUqUz7AD4Ix0PVdkibEaGGgdGBq8kFu6IFq9B4LDqB/DsKUk3MjJ7kToXGqXk2xJniWb9xvQfQ93FP++fuOXEd+lOzACmJkH32CDEjq8cNzBBjEVgHjCbN1DkI5z4NbvQWnNVF6oFAuVjrr8a0xdKOx/srU= Received: from CH0PR04CA0081.namprd04.prod.outlook.com (2603:10b6:610:74::26) by CY8PR12MB7730.namprd12.prod.outlook.com (2603:10b6:930:85::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Mon, 26 Feb 2024 21:11:35 +0000 Received: from DS2PEPF0000343D.namprd02.prod.outlook.com (2603:10b6:610:74:cafe::83) by CH0PR04CA0081.outlook.office365.com (2603:10b6:610:74::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 21:11:35 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DS2PEPF0000343D.mail.protection.outlook.com (10.167.18.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Mon, 26 Feb 2024 21:11:34 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 26 Feb 2024 15:11:32 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 26 Feb 2024 13:11:32 -0800 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 26 Feb 2024 15:11:32 -0600 From: Harry Wentland To: , CC: , Alex Hung Subject: [RFC PATCH v4 42/42] drm/amd/display: add multiplier colorop Date: Mon, 26 Feb 2024 16:10:56 -0500 Message-ID: <20240226211100.100108-43-harry.wentland@amd.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240226211100.100108-1-harry.wentland@amd.com> References: <20240226211100.100108-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343D:EE_|CY8PR12MB7730:EE_ X-MS-Office365-Filtering-Correlation-Id: c176bb27-0e15-4daa-1160-08dc370f8375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6E8VhAYbHvX6vdCjkv+w1E7wDqtPAHd4jw0xwsjc3xkny6FkvSn4la7BdUTgwC8bpUt3UPykt63tX44DAYIvOmfCpm0szghcpp0yGQSecyh5KHTLm2TXILtjMrHegGJifl1ZW8lgU+JaJqHG4Ho0y4cGZJt7f8EW76it8VX2fB318lYDZwcqKqjLOuiDxn1808hyNi7nnFBJLtwjUMcGLdrwlLWxpkjBmkNPiz2ogz/FyWQvRjk3bEfD8gdjxqLwTgmmNIpyh2ieMCwPS7v88qoLL3x22OD0fxD9n8fwx6LVPXXPqr0vnzVyvYOMQMDecKjhPLCVzA7uz/FPwc1xMCLHW9bbyhp008MPyErmCuUHJrvFqXMTWwCu+mUSmFYqBY+wKRJimzSO5BlOgwhKtlvNOeua13fSBijjI3rNUwvWxVl426a3sy2xvJfeSY7nGhvWl19i4NaMeyNxqzNtV23+AvGSc+01hSwbmwGvMWKCJY1xVjjwe0zXkbUlNmLlw4vp0JWTD+q27NvZxsB1v2nPJCmJcHQPvzhK0hGSYYHhy4o/3lkUz91LqKIos2N/+C/zrg83BojLBH2HQX/HH6ziAb/CeTQI07cV6sbD/j1EwY8JqBailY33sdRwW1vh/ntTHKZ8w0ZSMtcIdZqVurV0cqt5am9OJNolsARbVMDJIueZtf5eX2qrF0WijTaTjsI2HmBcElNWT0Cte+W0slwL0+ZqTXia3ghqq2NzCCRl9YEe4C7xdc/4CYSLgiz1 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 21:11:34.8511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c176bb27-0e15-4daa-1160-08dc370f8375 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7730 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Alex Hung This adds support for a multiplier. This multiplier is programmed via the HDR Multiplier in DCN. With this change the following IGT tests pass: kms_colorop --run plane-XR30-XR30-multiply_125 kms_colorop --run plane-XR30-XR30-multiply_inv_125 The color pipeline now consists of the following colorops: 1. 1D curve colorop 2. 3x4 CTM 3. Multiplier 4. 1D curve colorop 5. 1D LUT 6. 1D curve colorop 7. 1D LUT Signed-off-by: Alex Hung --- .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 40 +++++++++++++++++++ .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 15 +++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c index ef50640b362b..b05e4fea8a08 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c @@ -1251,6 +1251,35 @@ __set_dm_plane_colorop_3x4_matrix(struct drm_plane_state *plane_state, return 0; } +static int +__set_dm_plane_colorop_multiplier(struct drm_plane_state *plane_state, + struct dc_plane_state *dc_plane_state, + struct drm_colorop *colorop) +{ + struct drm_colorop *old_colorop; + struct drm_colorop_state *colorop_state = NULL, *new_colorop_state; + struct drm_atomic_state *state = plane_state->state; + const struct drm_device *dev = colorop->dev; + int i = 0; + + /* Multiplier */ + old_colorop = colorop; + for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) { + if (new_colorop_state->colorop == old_colorop && + new_colorop_state->colorop->type == DRM_COLOROP_MULTIPLIER) { + colorop_state = new_colorop_state; + break; + } + } + + if (colorop_state && !colorop_state->bypass && colorop->type == DRM_COLOROP_MULTIPLIER) { + drm_dbg(dev, "Multiplier colorop with ID: %d\n", colorop->base.id); + dc_plane_state->hdr_mult = amdgpu_dm_fixpt_from_s3132(colorop_state->multiplier); + } + + return 0; +} + static int __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state, struct dc_plane_state *dc_plane_state, @@ -1461,6 +1490,17 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state, if (ret) return ret; + /* Multiplier */ + colorop = colorop->next; + if (!colorop) { + drm_dbg(dev, "no multiplier colorop found\n"); + return -EINVAL; + } + + ret = __set_dm_plane_colorop_multiplier(plane_state, dc_plane_state, colorop); + if (ret) + return ret; + /* 1D Curve & LUT - SHAPER TF & LUT */ colorop = colorop->next; if (!colorop) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c index ba42f1f6b620..b739d6cb3e6b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c @@ -84,6 +84,21 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr prev_op = op; + /* Multiplier */ + op = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); + if (!op) { + DRM_ERROR("KMS: Failed to allocate colorop\n"); + return -ENOMEM; + } + + ret = drm_colorop_mult_init(dev, op, plane); + if (ret) + return ret; + + drm_colorop_set_next_property(prev_op, op); + + prev_op = op; + /* 1D curve - SHAPER TF */ op = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); if (!op) {