From patchwork Tue Oct 15 02:11:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 11189591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B0C21668 for ; Tue, 15 Oct 2019 02:11:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5129321835 for ; Tue, 15 Oct 2019 02:11:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5129321835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E0796E5DB; Tue, 15 Oct 2019 02:11:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60068.outbound.protection.outlook.com [40.107.6.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E29F6E5DB for ; Tue, 15 Oct 2019 02:11:21 +0000 (UTC) Received: from VI1PR08CA0094.eurprd08.prod.outlook.com (2603:10a6:800:d3::20) by AM5PR0802MB2579.eurprd08.prod.outlook.com (2603:10a6:203:98::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Tue, 15 Oct 2019 02:11:17 +0000 Received: from AM5EUR03FT021.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::209) by VI1PR08CA0094.outlook.office365.com (2603:10a6:800:d3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Tue, 15 Oct 2019 02:11:17 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT021.mail.protection.outlook.com (10.152.16.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 15 Oct 2019 02:11:15 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Tue, 15 Oct 2019 02:11:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1049427a500a475b X-CR-MTA-TID: 64aa7808 Received: from f09d0f69effc.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id A93CFC27-508E-44BE-967D-04F6648B714E.1; Tue, 15 Oct 2019 02:11:03 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2051.outbound.protection.outlook.com [104.47.9.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f09d0f69effc.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Tue, 15 Oct 2019 02:11:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GN20tlCqrkTxICy6dSiApX1k7KOQ9/oYTbBahFb2h/apFYzbvC8x9DVZCmj8cp0H6n0mBZ/eAXyahNWhgTbSeeZXAIK4K84xTVMoXIavGbMzc13hb5X78bSgQIz5MWlCBoU83BSEbyjU97Hqgt5Q8lYLUmJdGfC477MPtulW2vHDbOEPSCpBQfjbfuf7KKz0VRQWYDGdtOvEQATXgSfyEPmvp5poNuFsHnf3lQu7xEfSSYBaGOQDvCD0IYvyQ8ujre2a0P0s3oe7vEy8bgtyostn675f4g4Xn23xWqIENZCLjIyh5o/hTMsBwYyZ0DE9ufzCUYHTb6VKkYO9KxV6bw== 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-SenderADCheck; bh=zNGXLdi+Pb1SSmWtgl3GmMopU1EC0Z2mssefcs3oA9Y=; b=esiL8ON/K3FDnG+Ak77u6X9s3M23yOEwokXlplm5y5B5UIRUHvTHM/NQYcswJv3fkAjN1xf8PRPcR8bGBSZsR2bc4hiJj0wVYoXMDKIXHdIbZ3lR1OwwnkXuRb5z/SQWUfDvEUnJPTPg3oI66fH0Hwb3827A/jkzj6c89OFk7c9C/bbn8T0b9/gxfL19AJPYBrdNJtPUjVSlLSv02XYxZDO0uFoeonu+pgTNoLOFfgSvgi5Y0BENRji0UuhIIBo2ftCpewHJMgHxOMa59lv8ht2O+T/+YJ0ZwZOcoZ14nnESBFcuICVzz6jUVWRRQ2ITQf2t2yPlgT5TlkAv5Jmfsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB4799.eurprd08.prod.outlook.com (10.255.115.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Tue, 15 Oct 2019 02:11:01 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::40ed:7ed3:90cf:ece5]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::40ed:7ed3:90cf:ece5%3]) with mapi id 15.20.2347.023; Tue, 15 Oct 2019 02:11:01 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" , "imirkin@alum.mit.edu" Subject: [PATCH v4 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Topic: [PATCH v4 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Index: AQHVgv3K+gTD1TOgJkesN8hoYuRc/Q== Date: Tue, 15 Oct 2019 02:11:01 +0000 Message-ID: <20191015021016.327-4-james.qian.wang@arm.com> References: <20191015021016.327-1-james.qian.wang@arm.com> In-Reply-To: <20191015021016.327-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:203:3e::18) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 8dd81b59-cd8b-4bc5-dce7-08d75114f5ab X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VE1PR08MB4799:|VE1PR08MB4799:|AM5PR0802MB2579: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:3513;OLM:3513; x-forefront-prvs: 01917B1794 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(979002)(4636009)(136003)(39860400002)(366004)(346002)(376002)(396003)(189003)(199004)(66066001)(476003)(76176011)(110136005)(54906003)(66946007)(64756008)(66476007)(66446008)(71200400001)(66556008)(26005)(103116003)(2201001)(86362001)(6512007)(186003)(71190400001)(316002)(36756003)(6506007)(446003)(11346002)(386003)(2616005)(486006)(2906002)(256004)(52116002)(55236004)(102836004)(2171002)(8936002)(14454004)(478600001)(6486002)(81156014)(81166006)(305945005)(50226002)(2501003)(4326008)(8676002)(7736002)(5660300002)(1076003)(6116002)(3846002)(25786009)(99286004)(6436002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4799; H:VE1PR08MB5006.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: EEYDHKvmldHpZ9RTMKyOnlnd1odOSUE+q+Y598+4M13CugwtaRq/oBQmRuYjxK2T1sMqjijZ3fY/usKXkXFLn4243BnNLyUb3N1UXKOyx+7pKjEAdmpGOeDDsIoGg+WllmYg7tNei1GmP78Ce+QbM6hMimy5/oma0YjZJi+54oi6toWxn9St7rBOBO3X3zNWWvHwECnDseDgkLixpdNVF+3gP7bLzNr60f+NHk19swcWEwjBEnwRml+oOaHqrqFD2ZxVVWOIKpZwGchOdJljbXw3PQZw1U4M3BOT0b6Xoxx0U+3wlGvC8ut8L5mNyI56Ub6G0HC2RduVtesLJIOM5f8pxLUyLCaGVqxsgD7W/KwkFFpMKN3mHT5qsbtcpOWcWoDAEL0RXDOZvID97f5NLJvGbY2Sl4dC/Qf2I22cudM= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4799 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT021.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(4636009)(39860400002)(346002)(136003)(376002)(396003)(199004)(189003)(305945005)(7736002)(11346002)(336012)(2171002)(26005)(186003)(103116003)(6506007)(386003)(102836004)(6512007)(50226002)(26826003)(8936002)(2906002)(14454004)(63350400001)(2201001)(446003)(8746002)(86362001)(66066001)(70206006)(478600001)(70586007)(4326008)(50466002)(2616005)(76176011)(486006)(126002)(6486002)(23756003)(6116002)(99286004)(47776003)(476003)(3846002)(36756003)(1076003)(2501003)(81156014)(81166006)(8676002)(356004)(25786009)(36906005)(54906003)(316002)(110136005)(5660300002)(22756006)(76130400001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2579; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; A:1; MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: adb12df8-1c4e-40a3-abcd-08d75114eccf NoDisclaimer: True X-Forefront-PRVS: 01917B1794 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSQwCZQyQD9y7PpceXndGrkSpAmij1HT4ZJPE95DBmf8nC5yF8hGHiyKIV3XYDbqqfZxx/ItWY5+njRRdRNh7WlQ4SDWngmq9J7nseLjuQVXpGaAlycDlpJidEfynaDuK9oWJzThv2VYNSBZqm0J3FcscT7Yi4Ky/JSMmVgk0sEWAuhyh3fl3FDdGgqEAoaTRlUI+zsl31tv0gTZ/IHlBY9NcwAHJFWttM/cN8qmNPQWFBuADEriwJBzEwe0Z55pTJL8Wv+hKIZ1/pt8mOgKlWHUpZMvBXyERv+tIEVlrIAxd7DdNRpCzYQ9V5U2BL6hX1+d5dth1zEQW7CkQTSbxE1AlKnIfFoW+xDnthSu5sAv5GVeQOgfz92BuZ8bSqfg2KLOkyV3aryy6VPV6Aidtb2sj4LbvHNCMc3bU0bVKZY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2019 02:11:15.8530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dd81b59-cd8b-4bc5-dce7-08d75114f5ab X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2579 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zNGXLdi+Pb1SSmWtgl3GmMopU1EC0Z2mssefcs3oA9Y=; b=UeGGyF+roAj8bBhVeKxNTe6wM4DZZLIyU2RC48IJUnu5Pec8c0VNLEW/FZJ/QVey1x4hWco6zoS+qcjwNIKZaIm6aT/EleFyKQ3w5MxbdKNcgv5maPIiuTtu8QhZtP1N1VjGo/XylZKREnyJyokq3rJYAELZRLwcvZFR/xowxlw= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zNGXLdi+Pb1SSmWtgl3GmMopU1EC0Z2mssefcs3oA9Y=; b=UeGGyF+roAj8bBhVeKxNTe6wM4DZZLIyU2RC48IJUnu5Pec8c0VNLEW/FZJ/QVey1x4hWco6zoS+qcjwNIKZaIm6aT/EleFyKQ3w5MxbdKNcgv5maPIiuTtu8QhZtP1N1VjGo/XylZKREnyJyokq3rJYAELZRLwcvZFR/xowxlw= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=none action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd , Ayan Halder , "Oscar Zhang \(Arm Technology China\)" , "Tiannan Zhu \(Arm Technology China\)" , Mihail Atanassov , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "Channing Chen \(Arm Technology China\)" , "james qian wang \(Arm Technology China\)" , "Yiqi Kang \(Arm Technology China\)" , "Thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , Ben Davis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function is for converting drm_color_ctm matrix to komeda hardware required required Q2.12 2's complement CSC matrix. v2: Move the fixpoint conversion function s31_32_to_q2_12() to drm core as a shared helper. Signed-off-by: james qian wang (Arm Technology China) Reviewed-by: Mihail Atanassov --- .../gpu/drm/arm/display/komeda/komeda_color_mgmt.c | 14 ++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_color_mgmt.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c index c180ce70c26c..ad668accbdf4 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c @@ -117,3 +117,17 @@ void drm_lut_to_fgamma_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs) { drm_lut_to_coeffs(lut_blob, coeffs, sector_tbl, ARRAY_SIZE(sector_tbl)); } + +void drm_ctm_to_coeffs(struct drm_property_blob *ctm_blob, u32 *coeffs) +{ + struct drm_color_ctm *ctm; + u32 i; + + if (!ctm_blob) + return; + + ctm = ctm_blob->data; + + for (i = 0; i < KOMEDA_N_CTM_COEFFS; i++) + coeffs[i] = drm_color_ctm_s31_32_to_qm_n(ctm->matrix[i], 2, 12); +} diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h index 08ab69281648..2f4668466112 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h @@ -18,6 +18,7 @@ #define KOMEDA_N_CTM_COEFFS 9 void drm_lut_to_fgamma_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs); +void drm_ctm_to_coeffs(struct drm_property_blob *ctm_blob, u32 *coeffs); const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range);