From patchwork Tue Nov 12 11:10:18 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: 11239097 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 A81151747 for ; Tue, 12 Nov 2019 11:10:41 +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 8F8A1214E0 for ; Tue, 12 Nov 2019 11:10:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F8A1214E0 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 74B516EB0D; Tue, 12 Nov 2019 11:10:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20081.outbound.protection.outlook.com [40.107.2.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD0986EB12 for ; Tue, 12 Nov 2019 11:10:36 +0000 (UTC) Received: from VI1PR08CA0131.eurprd08.prod.outlook.com (2603:10a6:800:d4::33) by HE1PR08MB2698.eurprd08.prod.outlook.com (2603:10a6:7:34::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Tue, 12 Nov 2019 11:10:31 +0000 Received: from VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::203) by VI1PR08CA0131.outlook.office365.com (2603:10a6:800:d4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Tue, 12 Nov 2019 11:10:31 +0000 Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT050.mail.protection.outlook.com (10.152.19.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.21 via Frontend Transport; Tue, 12 Nov 2019 11:10:30 +0000 Received: ("Tessian outbound 6481c7fa5a3c:v33"); Tue, 12 Nov 2019 11:10:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 027fd423d32f3d12 X-CR-MTA-TID: 64aa7808 Received: from ce5f38f6e7fd.2 (cr-mta-lb-1.cr-mta-net [104.47.4.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8501F687-5FC8-47C7-A37C-12BEA18BA52A.1; Tue, 12 Nov 2019 11:10:20 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2059.outbound.protection.outlook.com [104.47.4.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ce5f38f6e7fd.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 Nov 2019 11:10:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOTYJxHtNEpwd83fJdyDyzwRCL5q1RDb7OCtxvsJCFBhqv27GIFv5IcZcKlniNmu3+aIA3/cprLp1B2RcgUmQ7+Fq9QMgDUIREK9rcdpusWY/Z6nl12U2Z9o2LPWDTDqdNT494ZCn33hJQiPYNtCzcaXwB6GI1VGGibQY/aiKfO2//ZnCfHRp2a7q6pXtzfPa+uAcYutugQdmmcP0D8NehTyg/YlfTyNjUu2E4Ioq6APoXX5vAVM+6ALAwgZxyj2QCUbtgAFVLpv3KhtvPpVavTqL3jKxCQcmUJUKixiDQFyKUgOzAyqrh+66FjjNyTyzZ9WDoanO6i/O6aL+hxd3w== 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=UvaLJ9iCW/GukE6Q6/g2aWg+NqCkBH1FlUg88c+A1ko=; b=LGQfxE9Lk28dFr/MvuBomSM8MqYAeN29QgcjW5SyQ3JrfW2CbCvs5qdiLpcBQywr6H0kHTW5D6PE8w5W2de0f9Z707r3X6sLNRFi9UmI6wHII2Tow5hC9hrbxEgw2JLCoeBPH5ux9dNuAGUsIzA9wD7Z2AjCb1Q/dV4tRZA5PPoaD3RUhZIAe552fDbzdpn4J2guBPvCRFbiIggq6GYr5FMJ2kEANhjk3VoqRFI0BPjPQzgBAfrYMpucFVBvNKBarsi5cfRFRbwCCXC48bb8iohdOJrS+8HnaxJImYvrHWaEFXtLzRBrlsBtOsUpCSCyGdqtOG8rT2s4aqvRii28bQ== 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 AM0PR08MB4995.eurprd08.prod.outlook.com (10.255.30.207) by AM0PR08MB3636.eurprd08.prod.outlook.com (20.177.43.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Tue, 12 Nov 2019 11:10:18 +0000 Received: from AM0PR08MB4995.eurprd08.prod.outlook.com ([fe80::3c0c:3112:ccbf:13d0]) by AM0PR08MB4995.eurprd08.prod.outlook.com ([fe80::3c0c:3112:ccbf:13d0%6]) with mapi id 15.20.2430.027; Tue, 12 Nov 2019 11:10:18 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" , Mihail Atanassov , "imirkin@alum.mit.edu" Subject: [PATCH v10 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Topic: [PATCH v10 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Index: AQHVmUnEN7Mkw/Fd7UqlRzpEzWbLAw== Date: Tue, 12 Nov 2019 11:10:18 +0000 Message-ID: <20191112110927.20931-4-james.qian.wang@arm.com> References: <20191112110927.20931-1-james.qian.wang@arm.com> In-Reply-To: <20191112110927.20931-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: HK0PR03CA0106.apcprd03.prod.outlook.com (2603:1096:203:b0::22) To AM0PR08MB4995.eurprd08.prod.outlook.com (2603:10a6:208:162::15) 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-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9d8ac2f0-5991-4108-3e1b-08d76760ee42 X-MS-TrafficTypeDiagnostic: AM0PR08MB3636:|AM0PR08MB3636:|HE1PR08MB2698: 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: 021975AE46 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(396003)(39860400002)(376002)(366004)(199004)(189003)(2906002)(99286004)(446003)(2616005)(476003)(7736002)(66066001)(6512007)(6436002)(6486002)(11346002)(54906003)(256004)(305945005)(103116003)(110136005)(316002)(2201001)(14454004)(6116002)(2501003)(86362001)(3846002)(486006)(71200400001)(71190400001)(186003)(386003)(36756003)(1076003)(6506007)(5660300002)(81166006)(8676002)(4326008)(50226002)(26005)(76176011)(66946007)(2171002)(52116002)(81156014)(66446008)(102836004)(66476007)(64756008)(8936002)(66556008)(25786009)(55236004)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3636; H:AM0PR08MB4995.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: v6S7xoxEQ6a4ktTxsZZslhXSYoGeQFJLRixLZSXbgYToQTolzVKSVn6CNY3QKzFEgTnXvpqyvr4IEG41DgqcfvpcSk7qH3uRH1DzWPXhZPf/yHI6kMCXENbHL2a65OkclUHiHvSLi+KapOGbfCyjS9nl3FzKIU8DDLN1I4nyy9X3UNzrs5ZTcbLJb0TG7virp1Kj7uckyNANTyAntTzBx7MZ/u2v9Y+JCSaeyix+OHcE22OqDBPxpAeXvAgvA4XUxchw8TIHVDfClm8bRgZb491/Bg2+r2cEFEya6kzvsFSCXthK3UIkCpn8PsUFl6AkgdrUvWXNswtUenDbFzo45p7Vr/aaM+ntDD0eQgDG+aM68cG8katPic6RyGtD801n99GrTNUXF9Grwpu3ZiNWT8q314W9IMiyqMZ2FWS33fHAiGmPIwGjRh6vSbrDR3sf MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3636 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT050.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)(4636009)(376002)(39860400002)(346002)(136003)(396003)(1110001)(339900001)(199004)(189003)(3846002)(86362001)(6116002)(22756006)(4326008)(66066001)(70586007)(70206006)(1076003)(5660300002)(478600001)(2171002)(7736002)(26826003)(50466002)(316002)(47776003)(76130400001)(305945005)(2201001)(6486002)(25786009)(356004)(336012)(99286004)(110136005)(102836004)(2906002)(486006)(6506007)(386003)(6512007)(126002)(11346002)(50226002)(23756003)(105606002)(76176011)(14454004)(2501003)(8746002)(103116003)(186003)(8676002)(81156014)(54906003)(81166006)(36756003)(2616005)(8936002)(26005)(446003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB2698; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Fail; 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: 305e0879-1316-4f33-2c7b-08d76760e6c4 NoDisclaimer: True X-Forefront-PRVS: 021975AE46 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: buMSyz7TNLjoeXYluCTrcAIcP69/ALh9lIRQapr1XV8aYY+mtEYdMEpZo+kCrXINugeRSPb/bkX5vPEDLtRPBExxhlJaKw8S0nT6t5N39FefRdUC4CNONkvq3mCX9W/l0AywF3FN53VOMyelSjS5dyoaAGdf5n5KgqnFTLGPjqIJx3rcCEmuZQk1+DRJyDPRTRgAJ/azjcSsW45yaLDUFDvALxQYcxPCVBzuuVH7m9R/zhuUDVIUaLOwx6/V48XowYiVyhgWdsvaWWGDIiET+3L0L0l+WRG3FNwyY2UYZwad13Bbxc0WicROOnuImvEBaI6iis9XRAdGo0ltuuqydqlWURDcMfBMvCkvYTjHxBcpzRPTdlyyrv6X1iXVO1f1xnmvhSqrtwFgL7QAkXSjrenn7W7aRBUOq/PA2KlVE8mwPAnMzFsf3vLbi7Ta/U2b X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2019 11:10:30.6913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d8ac2f0-5991-4108-3e1b-08d76760ee42 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: HE1PR08MB2698 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=UvaLJ9iCW/GukE6Q6/g2aWg+NqCkBH1FlUg88c+A1ko=; b=h8GeG11ulgLAUBiVbkVEaFhHzw1PMP086RvWRq5WnCtcbvF1HyhTGW6qWm30dBcYIMfJAdiwy8ZU1z385UNJnO9Lc0YswqeGYv10hWovJ9BWifYc92fXUj8op9uKb3SUFI3vukdWNeeRMVKnKkGZNXQ9OlWfV2vUnvEGc/Mu/qE= 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=UvaLJ9iCW/GukE6Q6/g2aWg+NqCkBH1FlUg88c+A1ko=; b=h8GeG11ulgLAUBiVbkVEaFhHzw1PMP086RvWRq5WnCtcbvF1HyhTGW6qWm30dBcYIMfJAdiwy8ZU1z385UNJnO9Lc0YswqeGYv10hWovJ9BWifYc92fXUj8op9uKb3SUFI3vukdWNeeRMVKnKkGZNXQ9OlWfV2vUnvEGc/Mu/qE= X-Mailman-Original-Authentication-Results: spf=fail (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\)" , "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..d8e449e6ebda 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], 3, 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);