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 58E08CEACFB for ; Sat, 15 Nov 2025 00:09:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF55610EC0E; Sat, 15 Nov 2025 00:09:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="LOY3WyGa"; dkim-atps=neutral Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11010060.outbound.protection.outlook.com [52.101.85.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37DB910EC38; Sat, 15 Nov 2025 00:09:08 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tp2cL6+6eehur2kMFJMD4CTlp1TBq9mCKgR0KlzZWXy91JNBHPVcX8P2wwOjhqamxyBWJgoswzQ2eAFL1UtKXtvytqRBfgocJ3vtssHPAnJHsAGuD1a/9pp7s9kOfVjjPUhIeplrcc50PaBPWnARZ2rSHVePU2rLa5ryYHwKJbNAXLA5EeROCusNZPigE1B7NslvVuTbv7ZEdiqFxwCff9NGy3TF4gCeI005aZtNwou2u1+t7JBPgTafMbz0FMNPfSglZ4W9vx3UZaEG2X1MGvfLGWW4uI+6F9wB4jOYrWXc2Oq099l6zOLIKBVuI8w/f2kD7AgzAM1++5um4kkSxQ== 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=6lNDN7LfF/qjjeEXgozfjjJ2C85ZwC6uml4f1CQnoo0=; b=zW6aSiRRKzPDxMI2uK7Ou7yxr4B2iWf1Uc0054RtFZZvpvMKQiFluecOzQ8ofIjSEgmaVe848uSDXuONziu5mgrSJcPLKG+eZzDWlhlyqfFfV+XKkvP0dmDRp+iEoiDg7i3WczmGhN7udLjpxCxgvY+ErA3j+7UKzwUFwkk+/ot4Jc4YrVHnU89sZaKeWp3RtDKPGKSa8xi2hvCtqGwj34FLFF3Zgf8GBV/ARQPd80Uj0ddRl8uFEt81/rDOjb8j+dHJc9Pfsm2T1ETmjZLbuJ+VBkMrhHCNlK5ifnyb1sKcztuuEsyFhfHJ7llxAdYWiApMZ6IDGeLZGNe7fRVFHA== 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=6lNDN7LfF/qjjeEXgozfjjJ2C85ZwC6uml4f1CQnoo0=; b=LOY3WyGam07m7FUfuHAAL/C5aZM/0kxUSG8ty3RKzJ5MgxOEON5dkPrRM50EdQRtZ0MQ9hXWdiSLT54xrPdwKA1nIaZRpXNEdZOXABYcPp85gNXct3PW/+xMUGH1/M2zqzuxcdVNNyftJLesj/3lH4HL6+lRfIsGjlHJVqV/2sY= Received: from CYZPR05CA0031.namprd05.prod.outlook.com (2603:10b6:930:a3::15) by IA1PR12MB6066.namprd12.prod.outlook.com (2603:10b6:208:3ee::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.18; Sat, 15 Nov 2025 00:09:03 +0000 Received: from CY4PEPF0000EE30.namprd05.prod.outlook.com (2603:10b6:930:a3:cafe::b6) by CYZPR05CA0031.outlook.office365.com (2603:10b6:930:a3::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9343.8 via Frontend Transport; Sat, 15 Nov 2025 00:09:03 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CY4PEPF0000EE30.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.13 via Frontend Transport; Sat, 15 Nov 2025 00:09:02 +0000 Received: from kylin.lan (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.17; Fri, 14 Nov 2025 16:08:58 -0800 From: Alex Hung To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Daniel Stone Subject: [PATCH V13 22/51] drm/vkms: Add tests for CTM handling Date: Fri, 14 Nov 2025 17:01:47 -0700 Message-ID: <20251115000237.3561250-23-alex.hung@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251115000237.3561250-1-alex.hung@amd.com> References: <20251115000237.3561250-1-alex.hung@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] 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: CY4PEPF0000EE30:EE_|IA1PR12MB6066:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c2413fd-87a2-4d6a-040d-08de23db2f38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|7416014|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?eujjanZpfBP+NT8B26sUAAkGcVpu25m6OrgAfknB3KcTmAAhQ0uy204gfbeO?= =?us-ascii?Q?vBTWDaiwtBVH74h6K8LnGbwmR5u4y2n274vLIRyNdOe4IZ2wJgcKKN1TCZkZ?= =?us-ascii?Q?H+OkVN/k5uiOhHaAz65bZOzNn8x7ZmXYNLltdtQKwaQV6xf3khq7xF8rIgsr?= =?us-ascii?Q?FPzgscLKQ7/gIb0WsE99cnfa9C2c6W5Q7yoQatTed86nzTUlUerenTf0NiGc?= =?us-ascii?Q?kzYy9wcfzaIWGOx5pnuTpwN3NwRfkYvTT3AcJ+sw5gcym1RGzWykBI51ysp6?= =?us-ascii?Q?dV1R3M/x3bf+/Qmg+Aj4hM9TT4TxlyipQv9z6F4WeA9k+GfxTo9DCCz55f7b?= =?us-ascii?Q?HJfbEazLO6rlhpNUn4BZ0lMPPKukM0MhEtqUbE98Q/UjzclGZO3/avuOgxhn?= =?us-ascii?Q?clDjVqY08f2tD+WQ0MJCwnFB4kmhrtyvFdjeiZLRbfXDgbTdcyPf1BBtqjMs?= =?us-ascii?Q?NWQV6QESGooVeHlCzM+DlOtjyJJdMaxKT8ilumf2hyXNXIKjNf4Z0M+uH68j?= =?us-ascii?Q?SmHOjPLxALa2fNOYVVS6wZGMsGeUDo3x++3tuF8QpiNnYx20y9x1fRHwOBAG?= =?us-ascii?Q?YxOMNehybpKGroNjjhFa3MefESEZi7CwRu2pnsogKh2EJc3roG2uZyH8Z5kb?= =?us-ascii?Q?SYB6ouoY5QcsEqnl+Eb4S27v++36dUT8Z4/pt6VcpQc/r+eyt/k2y5oEMkX5?= =?us-ascii?Q?jYJuvi8CCn7ECVy4OM8k9S9GBTyRRwMR3F90GIQRqtqdhySMcenvb2qEbH6B?= =?us-ascii?Q?o3luENBX7qubNhG+KkO5AK+0f3/9K5xV90g1BZ22rSdasHKSiAVqYXeNVXBZ?= =?us-ascii?Q?c+7E3vVsq9kO1Fj5O/Jis4y23LqTixj7h47cxG4ejx2K+/24uVymzucEootX?= =?us-ascii?Q?C2Vph6wl0vNM+IgdCinde65AagF/gu5ffebKsJxiIJnEVThF4TWqB/8h9daA?= =?us-ascii?Q?yUuotIFmW16Nz3IGlrCq8C/9TVwR3KsxHWk2lkquWUBappwRb+xBjThLFAL5?= =?us-ascii?Q?P7zl/aQvYnaP2ruGpNw9fYgLDpHdnkGFTCRxpj2aFz9Gnlou4BQCOMkMBHeG?= =?us-ascii?Q?8ppsfPbQ5ilRUQr4FH7K/gGy98+Yp1fhVNtd9Upk74lmWNr2eTPpy1QEeqC4?= =?us-ascii?Q?NQQU681yRB6aAf4O5WaAXzkRxkilVeu53+LWRPBIW9Fhdi1hdlq8LpN/L0HM?= =?us-ascii?Q?zSnPsGF8gTzcgld1rIt3pTaCsqjL3s7FjOnEgJ7cpK58UiLLpeEuTGaNm40x?= =?us-ascii?Q?EpcMO8vgN+7Yqqz44oiGc2sGU2rr4qLshXf+/vPUlaFSC0hYezt8CcbdEZw5?= =?us-ascii?Q?/qtFdwyhCCjLEMnExms/xMbGobno/HLanGQHrS+PtV2CiZBYvyscy4crK5sg?= =?us-ascii?Q?LDVwlbtn0MvuLL6ofWPwGsipPZTjMH78GcjD4hHBrnAoMMpv6uNZ5be5+HeU?= =?us-ascii?Q?i3IGEMPa7km5AFPkapjIwoBDDDORlCkXCvjZXeRrNPZmSaVQRCXYgds9KTTx?= =?us-ascii?Q?pr1GKgCEz2HS5e7RAyHl8F+UlKskkrxwnSgk+y8Tb6ZJwcu0fcWp1OYTgmSU?= =?us-ascii?Q?u6u+shhNaY64qEaHvA0=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(7416014)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2025 00:09:02.9285 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c2413fd-87a2-4d6a-040d-08de23db2f38 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: CY4PEPF0000EE30.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6066 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Harry Wentland A whole slew of tests for CTM handling that greatly helped in debugging the CTM code. The extent of tests might seem a bit silly but they're fast and might someday help save someone else's day when debugging this. Reviewed-by: Louis Chauvet Signed-off-by: Alex Hung Signed-off-by: Harry Wentland Reviewed-by: Daniel Stone --- v7: - Fix a checkpatch a long-line warning (Louis Chauvet) v6: - update reference values since we're now rounding v5: - Make apply_3x4_matrix static v4: - Comment on origin of bt709_enc matrix (Pekka) - Use full opaque alpha (Pekka) - Add additional check for Y < 0xffff (Pekka) - Remove unused code (Pekka) drivers/gpu/drm/vkms/tests/vkms_color_test.c | 250 +++++++++++++++++++ drivers/gpu/drm/vkms/vkms_composer.c | 4 +- drivers/gpu/drm/vkms/vkms_composer.h | 1 + 3 files changed, 254 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/drm/vkms/tests/vkms_color_test.c index 8ede657e8e34..56e96a5659d9 100644 --- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c +++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c @@ -148,11 +148,261 @@ static void vkms_color_srgb_inv_srgb(struct kunit *test) } } +#define FIXPT_HALF (DRM_FIXED_ONE >> 1) +#define FIXPT_QUARTER (DRM_FIXED_ONE >> 2) + +static const struct drm_color_ctm_3x4 test_matrix_3x4_50_desat = { { + FIXPT_HALF, FIXPT_QUARTER, FIXPT_QUARTER, 0, + FIXPT_QUARTER, FIXPT_HALF, FIXPT_QUARTER, 0, + FIXPT_QUARTER, FIXPT_QUARTER, FIXPT_HALF, 0 +} }; + +static void vkms_color_ctm_3x4_50_desat(struct kunit *test) +{ + struct pixel_argb_s32 ref, out; + + /* full white */ + ref.a = 0xffff; + ref.r = 0xffff; + ref.g = 0xffff; + ref.b = 0xffff; + + memcpy(&out, &ref, sizeof(out)); + apply_3x4_matrix(&out, &test_matrix_3x4_50_desat); + + KUNIT_EXPECT_MEMEQ(test, &ref, &out, sizeof(out)); + + /* full black */ + ref.a = 0xffff; + ref.r = 0x0; + ref.g = 0x0; + ref.b = 0x0; + + memcpy(&out, &ref, sizeof(out)); + apply_3x4_matrix(&out, &test_matrix_3x4_50_desat); + + KUNIT_EXPECT_MEMEQ(test, &ref, &out, sizeof(out)); + + /* 50% grey */ + ref.a = 0xffff; + ref.r = 0x8000; + ref.g = 0x8000; + ref.b = 0x8000; + + memcpy(&out, &ref, sizeof(out)); + apply_3x4_matrix(&out, &test_matrix_3x4_50_desat); + + KUNIT_EXPECT_MEMEQ(test, &ref, &out, sizeof(out)); + + /* full red to 50% desat */ + ref.a = 0xffff; + ref.r = 0x8000; + ref.g = 0x4000; + ref.b = 0x4000; + + out.a = 0xffff; + out.r = 0xffff; + out.g = 0x0; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_50_desat); + + KUNIT_EXPECT_MEMEQ(test, &ref, &out, sizeof(out)); +} + +/* + * BT.709 encoding matrix + * + * Values printed from within IGT when converting + * igt_matrix_3x4_bt709_enc to the fixed-point format expected + * by DRM/KMS. + */ +static const struct drm_color_ctm_3x4 test_matrix_3x4_bt709_enc = { { + 0x00000000366cf400ull, 0x00000000b7175900ull, 0x0000000127bb300ull, 0, + 0x800000001993b3a0ull, 0x800000005609fe80ull, 0x000000006f9db200ull, 0, + 0x000000009d70a400ull, 0x800000008f011100ull, 0x800000000e6f9330ull, 0 +} }; + +static void vkms_color_ctm_3x4_bt709(struct kunit *test) +{ + struct pixel_argb_s32 out; + + /* full white to bt709 */ + out.a = 0xffff; + out.r = 0xffff; + out.g = 0xffff; + out.b = 0xffff; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 255 */ + KUNIT_EXPECT_GT(test, out.r, 0xfe00); + KUNIT_EXPECT_LT(test, out.r, 0x10000); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x0100); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x0100); + + /* full black to bt709 */ + out.a = 0xffff; + out.r = 0x0; + out.g = 0x0; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 0 */ + KUNIT_EXPECT_LT(test, out.r, 0x100); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x0100); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x0100); + + /* gray to bt709 */ + out.a = 0xffff; + out.r = 0x7fff; + out.g = 0x7fff; + out.b = 0x7fff; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 127 */ + KUNIT_EXPECT_GT(test, out.r, 0x7e00); + KUNIT_EXPECT_LT(test, out.r, 0x8000); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x0100); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x0100); + + /* == red 255 - bt709 enc == */ + out.a = 0xffff; + out.r = 0xffff; + out.g = 0x0; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 54 */ + KUNIT_EXPECT_GT(test, out.r, 0x3500); + KUNIT_EXPECT_LT(test, out.r, 0x3700); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x0100); + + /* V 157 */ + KUNIT_EXPECT_GT(test, out.b, 0x9C00); + KUNIT_EXPECT_LT(test, out.b, 0x9E00); + + + /* == green 255 - bt709 enc == */ + out.a = 0xffff; + out.r = 0x0; + out.g = 0xffff; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 182 */ + KUNIT_EXPECT_GT(test, out.r, 0xB500); + KUNIT_EXPECT_LT(test, out.r, 0xB780); /* laxed by half*/ + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x0100); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x0100); + + /* == blue 255 - bt709 enc == */ + out.a = 0xffff; + out.r = 0x0; + out.g = 0x0; + out.b = 0xffff; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 18 */ + KUNIT_EXPECT_GT(test, out.r, 0x1100); + KUNIT_EXPECT_LT(test, out.r, 0x1300); + + /* U 111 */ + KUNIT_EXPECT_GT(test, out.g, 0x6E00); + KUNIT_EXPECT_LT(test, out.g, 0x7000); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x0100); + + /* == red 140 - bt709 enc == */ + out.a = 0xffff; + out.r = 0x8c8c; + out.g = 0x0; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 30 */ + KUNIT_EXPECT_GT(test, out.r, 0x1D00); + KUNIT_EXPECT_LT(test, out.r, 0x1F00); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x100); + + /* V 87 */ + KUNIT_EXPECT_GT(test, out.b, 0x5600); + KUNIT_EXPECT_LT(test, out.b, 0x5800); + + /* == green 140 - bt709 enc == */ + out.a = 0xffff; + out.r = 0x0; + out.g = 0x8c8c; + out.b = 0x0; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 30 */ + KUNIT_EXPECT_GT(test, out.r, 0x6400); + KUNIT_EXPECT_LT(test, out.r, 0x6600); + + /* U 0 */ + KUNIT_EXPECT_LT(test, out.g, 0x100); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x100); + + + /* == blue 140 - bt709 enc == */ + out.a = 0xffff; + out.r = 0x0; + out.g = 0x0; + out.b = 0x8c8c; + + apply_3x4_matrix(&out, &test_matrix_3x4_bt709_enc); + + /* Y 30 */ + KUNIT_EXPECT_GT(test, out.r, 0x900); + KUNIT_EXPECT_LT(test, out.r, 0xB00); + + /* U 61 */ + KUNIT_EXPECT_GT(test, out.g, 0x3C00); + KUNIT_EXPECT_LT(test, out.g, 0x3E00); + + /* V 0 */ + KUNIT_EXPECT_LT(test, out.b, 0x100); + +} + static struct kunit_case vkms_color_test_cases[] = { KUNIT_CASE(vkms_color_test_get_lut_index), KUNIT_CASE(vkms_color_test_lerp), KUNIT_CASE(vkms_color_test_linear), KUNIT_CASE(vkms_color_srgb_inv_srgb), + KUNIT_CASE(vkms_color_ctm_3x4_50_desat), + KUNIT_CASE(vkms_color_ctm_3x4_bt709), {} }; diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c index 2182063776f8..2bd6578780ea 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.c +++ b/drivers/gpu/drm/vkms/vkms_composer.c @@ -128,7 +128,8 @@ static void apply_lut(const struct vkms_crtc_state *crtc_state, struct line_buff } } -static void apply_3x4_matrix(struct pixel_argb_s32 *pixel, const struct drm_color_ctm_3x4 *matrix) +VISIBLE_IF_KUNIT void apply_3x4_matrix(struct pixel_argb_s32 *pixel, + const struct drm_color_ctm_3x4 *matrix) { s64 rf, gf, bf; s64 r, g, b; @@ -156,6 +157,7 @@ static void apply_3x4_matrix(struct pixel_argb_s32 *pixel, const struct drm_colo pixel->g = drm_fixp2int_round(gf); pixel->b = drm_fixp2int_round(bf); } +EXPORT_SYMBOL_IF_KUNIT(apply_3x4_matrix); static void apply_colorop(struct pixel_argb_s32 *pixel, struct drm_colorop *colorop) { diff --git a/drivers/gpu/drm/vkms/vkms_composer.h b/drivers/gpu/drm/vkms/vkms_composer.h index 4dba69f46092..04dd5646f672 100644 --- a/drivers/gpu/drm/vkms/vkms_composer.h +++ b/drivers/gpu/drm/vkms/vkms_composer.h @@ -22,6 +22,7 @@ u16 lerp_u16(u16 a, u16 b, s64 t); s64 get_lut_index(const struct vkms_color_lut *lut, u16 channel_value); u16 apply_lut_to_channel_value(const struct vkms_color_lut *lut, u16 channel_value, enum lut_channel channel); +void apply_3x4_matrix(struct pixel_argb_s32 *pixel, const struct drm_color_ctm_3x4 *matrix); #endif #endif /* _VKMS_COMPOSER_H_ */ -- 2.43.0