From patchwork Fri Oct 11 05:43:09 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: 11184829 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 E8CCE112B for ; Fri, 11 Oct 2019 05:43:37 +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 CF1F92196E for ; Fri, 11 Oct 2019 05:43:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF1F92196E 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 3C8E76E3FE; Fri, 11 Oct 2019 05:43:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10056.outbound.protection.outlook.com [40.107.1.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77E3F6E3FE for ; Fri, 11 Oct 2019 05:43:29 +0000 (UTC) Received: from VI1PR0802CA0047.eurprd08.prod.outlook.com (2603:10a6:800:a9::33) by AM5PR0801MB1635.eurprd08.prod.outlook.com (2603:10a6:203:3b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:24 +0000 Received: from AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by VI1PR0802CA0047.outlook.office365.com (2603:10a6:800:a9::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Fri, 11 Oct 2019 05:43:24 +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 AM5EUR03FT058.mail.protection.outlook.com (10.152.17.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15 via Frontend Transport; Fri, 11 Oct 2019 05:43:23 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Fri, 11 Oct 2019 05:43:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4416ce3dc06705bf X-CR-MTA-TID: 64aa7808 Received: from 409fc30ad3a0.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.6.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7B73E81B-7DA7-4424-BCAD-AE93652C5A61.1; Fri, 11 Oct 2019 05:43:11 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02lp2058.outbound.protection.outlook.com [104.47.6.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 409fc30ad3a0.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 11 Oct 2019 05:43:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GhsAP9maEmuMzkLff2QVmr4nGIrkxlwyBfMlGBvQQIeZCIfrJeLsDkCqozT9DBk3M0U6gQJUB7bFHIi28AMCwp9qRqjn85quThue068vqUQZKpMd6kpyGLcPGxsnji+BEX8Gm3uqMg2lv63LDIur0qOr2GP2qbFjkd7RkVBA4VlqYkPkLzg5zDVqg+DNsnX4mQNPNjoFJwnDOcgK0PX6mfpXqhXh+Q63E4JCensIDJP+nx81tC5VVi+NIRAP7EimNKR32839Gt/Bdx/P6M970MeoUafQ44HTgB2qfyZJiG6JZmiDbif72zuAzNfrYjMXKpogjv1FNqlMt3lR1Wwx4g== 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=MROpJRQlAYcnH6kxPcSNEQcaOoQ01vB9i7fkB8VnXF4=; b=oczJEaFE2H9FHUkdiGc9gwaASoIj5/XuetAP16zSRy49cD29glguKxrYLq3FkGU4JejF8cpKK/E2LY+toJaQ4ODqd6di0Xkd7hcBZUbeVNl8jb4yKYq+BNCphwlwX0mwRJ/VXbd5Ntj728vg8G4K5u63H6SGgxvsBP0Sf0zDe4pgG8dPLD5BHBTGdJ0wpjUPZdvmIYPuhm/iQPf75MFcqe1FfunHa4BLt74lDg03I+/0/Gmv4E5KET9Stesur7RIpD8vaYtfY+nFXIJSCnBl4Je2HcAytT4lgS21Zmmcj19JLHAoy2p+MWs+r0OsHtJoV0O7dijpggXU4VO9C5SyIA== 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 VE1PR08MB5134.eurprd08.prod.outlook.com (10.255.158.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:09 +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.021; Fri, 11 Oct 2019 05:43:09 +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 v2 1/4] drm/komeda: Add a new helper drm_color_ctm_s31_32_to_qm_n() Thread-Topic: [PATCH v2 1/4] drm/komeda: Add a new helper drm_color_ctm_s31_32_to_qm_n() Thread-Index: AQHVf/bDNAzoDxuLVU+by7UkFix6lA== Date: Fri, 11 Oct 2019 05:43:09 +0000 Message-ID: <20191011054240.17782-2-james.qian.wang@arm.com> References: <20191011054240.17782-1-james.qian.wang@arm.com> In-Reply-To: <20191011054240.17782-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: HK2P15301CA0005.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::15) 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: 66974046-fb4b-4040-c8de-08d74e0dee16 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VE1PR08MB5134:|VE1PR08MB5134:|AM5PR0801MB1635: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4125;OLM:4125; x-forefront-prvs: 0187F3EA14 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(189003)(199004)(66066001)(486006)(386003)(6506007)(64756008)(99286004)(50226002)(52116002)(81156014)(6486002)(8936002)(81166006)(66946007)(102836004)(8676002)(305945005)(55236004)(26005)(66476007)(71200400001)(6116002)(3846002)(66556008)(6436002)(71190400001)(7736002)(76176011)(36756003)(186003)(2906002)(256004)(476003)(6512007)(2616005)(66446008)(446003)(11346002)(54906003)(25786009)(14454004)(2501003)(103116003)(110136005)(316002)(4326008)(5660300002)(86362001)(478600001)(2201001)(1076003)(2171002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5134; 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: ndGrfEnsw4RRr1scCRcgej+L0luzMHm1bQa33tlKL9+Dz/sZOFD47eFSSpN6OnHsYKa5urJrJz5z7G88LJAEnoEsPna6sLyOKxoVjOdKJDy8pmx4+Of26YEuNZtKZMS+V4Zfooy9PzANEUaeMx75FaMvuJCfodljj1qgWPMoUtHYYkOaDEFI882+pj1DHVuZ7K73Mz4ODIbyuPouvRWgTqiiS/yIrKnPOANCbeS6kFW8rzudRkkMkGx8Eh0Kaxp7VY0cqrTgoOIAzDAUik0mtV9bxuNYeu2+Id08sIef7HYpRxLuqP2l/V0C/QL9ATSBIU/Y1D4UJmGEekCUVQmrp3A+1wKlTH3HPUyKi4Qb0PonxtYp8REXeg9XiCZ/UMvcKECMM5nTrM/ZwqNvE24QQouoGx5hgy/X1Pdfctn7PNc= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5134 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT058.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)(396003)(136003)(346002)(376002)(39860400002)(189003)(199004)(86362001)(305945005)(103116003)(102836004)(23756003)(11346002)(36756003)(14454004)(6486002)(2171002)(47776003)(6116002)(2616005)(3846002)(22756006)(478600001)(7736002)(5660300002)(6512007)(50226002)(76176011)(4326008)(26826003)(99286004)(36906005)(66066001)(446003)(8746002)(316002)(25786009)(26005)(70586007)(8936002)(63350400001)(126002)(70206006)(2906002)(76130400001)(110136005)(54906003)(6506007)(476003)(1076003)(81156014)(81166006)(386003)(8676002)(336012)(186003)(50466002)(486006)(356004)(2501003)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB1635; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0573589d-19dc-4e45-9d87-08d74e0de57e NoDisclaimer: True X-Forefront-PRVS: 0187F3EA14 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ob+TPcY5qFHQvWz+YPXsSaEsKeXOaySwAsS8HuuWMo3bZETE8QsUiRNxvO5MsD33bH1FbWJVyVnp74XrONRR//d29u/fUb+GxeHCZSKieoopK3d/hsJuWJ9Q/jV6cqmNekbnWvuZb7GDQVXF6gBIbAO/Row95g3O0rWcJn7xK76bMzJP6kV2EsIkfQ/KFJMhngtuNPGe8DzLzwRa7XGg+GDqitCftZEjY8tkTxAdBCNaUAHYx9KNhH8O10zOgVT6crghgd0qHhPhgmHB7bKiP4dbYQvnBfi0VcAKqGWZwKX6uWueg0v27WOm8cxix/UUXXwk+yjf3O3SwcYLtWPIUvss82T2JDiZdCNB1gyS9HOtH7gIILLOXfdLy6SLdklG24kCq3m6f/EZ8bMPNVxlh+sDzgdAEuXRrR0RhkBTvfk= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2019 05:43:23.1666 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66974046-fb4b-4040-c8de-08d74e0dee16 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: AM5PR0801MB1635 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=MROpJRQlAYcnH6kxPcSNEQcaOoQ01vB9i7fkB8VnXF4=; b=Lvk7ZBam/+KrJiBvhFlW/yzp3KzI2Choq0oJsjV98JstYqM9xP6lFePXjDwYq/1Z0/AC2fTQlNMSEpN8HVGm5xvzExTO+sTAnUl05pKNWK0AuD2WpfWTG1J2jI1/nenk8aFiBGkBkl9fHtk4Vhat4NupyP9l90GNkJz4zVzcJ9U= 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=MROpJRQlAYcnH6kxPcSNEQcaOoQ01vB9i7fkB8VnXF4=; b=Lvk7ZBam/+KrJiBvhFlW/yzp3KzI2Choq0oJsjV98JstYqM9xP6lFePXjDwYq/1Z0/AC2fTQlNMSEpN8HVGm5xvzExTO+sTAnUl05pKNWK0AuD2WpfWTG1J2jI1/nenk8aFiBGkBkl9fHtk4Vhat4NupyP9l90GNkJz4zVzcJ9U= 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" Add a new helper function drm_color_ctm_s31_32_to_qm_n() for driver to convert S31.32 sign-magnitude to Qm.n 2's complement that supported by hardware. Signed-off-by: james qian wang (Arm Technology China) Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_color_mgmt.c | 23 +++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 4ce5c6d8de99..3d533d0b45af 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -132,6 +132,29 @@ uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision) } EXPORT_SYMBOL(drm_color_lut_extract); +/** + * drm_color_ctm_s31_32_to_qm_n + * + * @user_input: input value + * @m: number of integer bits + * @n: number of fractinal bits + * + * Convert and clamp S31.32 sign-magnitude to Qm.n 2's complement. + */ +uint64_t drm_color_ctm_s31_32_to_qm_n(uint64_t user_input, + uint32_t m, uint32_t n) +{ + u64 mag = (user_input & ~BIT_ULL(63)) >> (32 - n); + bool negative = !!(user_input & BIT_ULL(63)); + s64 val; + + /* the range of signed 2s complement is [-2^n+m, 2^n+m - 1] */ + val = clamp_val(mag, 0, negative ? BIT(n + m) : BIT(n + m) - 1); + + return negative ? 0ll - val : val; +} +EXPORT_SYMBOL(drm_color_ctm_s31_32_to_qm_n); + /** * drm_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index d1c662d92ab7..60fea5501886 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -30,6 +30,8 @@ struct drm_crtc; struct drm_plane; uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision); +uint64_t drm_color_ctm_s31_32_to_qm_n(uint64_t user_input, + uint32_t m, uint32_t n); void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, From patchwork Fri Oct 11 05:43:16 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: 11184833 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 DAA7E112B for ; Fri, 11 Oct 2019 05:43:48 +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 C24672196E for ; Fri, 11 Oct 2019 05:43:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C24672196E 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 96B506EA2E; Fri, 11 Oct 2019 05:43:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80080.outbound.protection.outlook.com [40.107.8.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 492096E9C2 for ; Fri, 11 Oct 2019 05:43:39 +0000 (UTC) Received: from AM4PR08CA0067.eurprd08.prod.outlook.com (2603:10a6:205:2::38) by AM0PR08MB4194.eurprd08.prod.outlook.com (2603:10a6:208:130::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.23; Fri, 11 Oct 2019 05:43:35 +0000 Received: from VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by AM4PR08CA0067.outlook.office365.com (2603:10a6:205:2::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.16 via Frontend Transport; Fri, 11 Oct 2019 05:43:35 +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 VE1EUR03FT003.mail.protection.outlook.com (10.152.18.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Fri, 11 Oct 2019 05:43:33 +0000 Received: ("Tessian outbound 3fba803f6da3:v33"); Fri, 11 Oct 2019 05:43:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0408181c2184aa88 X-CR-MTA-TID: 64aa7808 Received: from def52121f048.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.0.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3536CFD4-E67A-4F19-802B-2882B752D560.1; Fri, 11 Oct 2019 05:43:19 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2057.outbound.protection.outlook.com [104.47.0.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id def52121f048.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 11 Oct 2019 05:43:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OIX8KfvK1PC9Hjxr4VOhiihXXqOGTL4eZ0GnjphyqTjA+zRTNLX1cQS/mWrRi8dYkCVVnV4zcCRGbCqiPvowKFGwGD0Xj/hBYDZ0nszkDyEodEbd7moob8vv7klrqKC8vGi3u9pNmhWHPb7++b57LT8r26HmNFTH+1WO1s5eA97ppj9Duu8mPsymQ+sZdZGQJB5DwGOVsY+RA+wIAfPTwQfuldc7oJqofcowEQ0AIyj/TqPI/HnAGOrcGKp7XuTaNhdP3CMB8IxgXlg9FjY/MD99Hbbw44FgC3v/q11z/AwIfyu4ipr1XONkKfzBZsvsgD7EQnkFf3/+n3iSQbACUg== 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=fUBbQ6jci7ZZBrBwHMNuLpOgBHySGEUsJ89UPIG5ETg=; b=SKkZo7Nq3yN0o2wAxO7W1HENmMymzf6Jpvtkth1oHdt/Wk7iOd4yAs0kZPiMUOQwrpzQF7ZwCq/aS3QY+53f0G6EZe31pLB6kse2ccpgwEuHJvbkbDEpN+FFRsjkzb+mF0eobn/Ee9OzlLjvmefRrOO+lWwi8rZbDpjQhYlqIlUGgEeQqKLmaw/uQPiNwGXDdIeeiwff7rItJfvY2vArJtdUCzaLEv921vkZjtjidr//03AaRnMqmaqmVtd311JftF77GF9WtqhLOrJD/262HWhmxKyMVvJEMN0h/V0pJ8VNZrIYfOh2HOHcCVDugoJWMUoDBVHAgkMxXWDaLTUC5Q== 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 VE1PR08MB5134.eurprd08.prod.outlook.com (10.255.158.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:16 +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.021; Fri, 11 Oct 2019 05:43:16 +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 v2 2/4] drm/komeda: Add drm_lut_to_fgamma_coeffs() Thread-Topic: [PATCH v2 2/4] drm/komeda: Add drm_lut_to_fgamma_coeffs() Thread-Index: AQHVf/bHoOHFMdio50qJmyeMboFsfA== Date: Fri, 11 Oct 2019 05:43:16 +0000 Message-ID: <20191011054240.17782-3-james.qian.wang@arm.com> References: <20191011054240.17782-1-james.qian.wang@arm.com> In-Reply-To: <20191011054240.17782-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: HK2P15301CA0005.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::15) 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: abbbb220-1470-49a1-60b5-08d74e0df426 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VE1PR08MB5134:|VE1PR08MB5134:|AM0PR08MB4194: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:2043;OLM:2043; x-forefront-prvs: 0187F3EA14 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(189003)(199004)(66066001)(486006)(386003)(6506007)(64756008)(99286004)(50226002)(52116002)(81156014)(6486002)(8936002)(81166006)(66946007)(102836004)(8676002)(305945005)(55236004)(26005)(66476007)(71200400001)(6116002)(3846002)(66556008)(6436002)(71190400001)(7736002)(76176011)(36756003)(186003)(2906002)(256004)(476003)(6512007)(2616005)(14444005)(66446008)(446003)(11346002)(54906003)(25786009)(14454004)(2501003)(103116003)(110136005)(316002)(4326008)(5660300002)(86362001)(478600001)(2201001)(1076003)(2171002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5134; 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: amr7MgCh3e3rl1SrN65nY/ld+kZSeuJuQFfarRGf1E6lxg9tSJFtf49njxvNROJA6VAtujI5PiKAixykM03LQ/jlBs80ae2aruaZJUigT/+T1dJuBliv6hnqk+PgBu8tCLI7QFUOpkQIcNeOa77Jux2Xs7e7m185eKkU9/GsnL7AKP1B+sd3A4gcWqpWfjCfkb5iJaScmZDlCBdp4LRCwLImsj+Jw2iXCu50KbRDg7jBMpsojvBJ4JhMPZkMwwNR5PgfhrhYdBUJ77BwPHIWRBRTI13h2kU81HjkP1x/SJo5p4NDr5EHsjyzaciAGKfb8IXYolYopEbfLRdCGCQoE+qrmF76Yex2s1xfr9ApXIUR6m4WJRsJizxZAL0SGAZTOXdB2Nk5ziSI3tMOdqYxvyHH3qB7jhViIXogowL/iPg= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5134 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT003.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)(136003)(346002)(376002)(39860400002)(396003)(189003)(199004)(63350400001)(7736002)(26826003)(81166006)(8746002)(103116003)(6512007)(81156014)(186003)(2616005)(11346002)(446003)(26005)(476003)(4326008)(126002)(486006)(25786009)(66066001)(8676002)(2171002)(336012)(76176011)(5660300002)(6506007)(386003)(478600001)(99286004)(2201001)(86362001)(14454004)(6486002)(305945005)(3846002)(36756003)(1076003)(50466002)(102836004)(6116002)(50226002)(110136005)(14444005)(76130400001)(8936002)(22756006)(36906005)(54906003)(23756003)(316002)(47776003)(70586007)(2501003)(70206006)(2906002)(356004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB4194; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 3b2cbfa1-1358-412c-b44e-08d74e0de9e9 NoDisclaimer: True X-Forefront-PRVS: 0187F3EA14 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yVmdaF4WE9sI64DgANsiaQEd1fyXU5qRyWxyF5IyZmfgiU+r2z47f+fdypCBLjX/rfyE4TtDWH1zLODARWIr9pZ2ytkWkeYyhffJT70ZS2j8g1lHcNvddKIsSyHPFJXhNJdbE7zSpEW0WAcn6pnsufkAORdphJ9PODpFM0pKkbtHM1q4tTi74AVTMGUA2goIkCWLilCuDwMM3VJnpuOmTehL7T/J6v+Jaajkz7E7VVVI2WKdI/v3aRLsRzEUl/OakpmOWox7+G8P1TY3ERLvVqDf0bIExwl+ngdOwo/rf58/qkTWEs18swOTxcIPJktrfcyVacpDpjqZg+NwvUBRYwD0RE6dZuYnVEq9ehnGr7npHYNRiNWuxqR78OGB51sPmWH+wjCkF2dnm3cNSeOL7s4pikYa63YSKm8CtRnxBvU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2019 05:43:33.2870 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abbbb220-1470-49a1-60b5-08d74e0df426 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: AM0PR08MB4194 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=fUBbQ6jci7ZZBrBwHMNuLpOgBHySGEUsJ89UPIG5ETg=; b=gXKdIrIoYDlyk23wfjeGXfSe1JLu1JCIUw+hX48B9sUi4QXal1abWQeOiP2+NjopUPHiGDkgeKEJlZ8fLX2DqA51lk45V2EJdRo0PXeEL9TT6BddzAo0t15Hi1OnCN1KQPqblgKxZStip/unBu8zQjU7qR/RQrHTFGxi7eEh6XM= 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=fUBbQ6jci7ZZBrBwHMNuLpOgBHySGEUsJ89UPIG5ETg=; b=gXKdIrIoYDlyk23wfjeGXfSe1JLu1JCIUw+hX48B9sUi4QXal1abWQeOiP2+NjopUPHiGDkgeKEJlZ8fLX2DqA51lk45V2EJdRo0PXeEL9TT6BddzAo0t15Hi1OnCN1KQPqblgKxZStip/unBu8zQjU7qR/RQrHTFGxi7eEh6XM= 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 used to convert drm 3dlut to komeda HW required 1d curve coeffs values. Signed-off-by: james qian wang (Arm Technology China) --- .../arm/display/komeda/komeda_color_mgmt.c | 52 +++++++++++++++++++ .../arm/display/komeda/komeda_color_mgmt.h | 9 +++- 2 files changed, 60 insertions(+), 1 deletion(-) 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 9d14a92dbb17..c180ce70c26c 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.c @@ -65,3 +65,55 @@ const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range) return coeffs; } + +struct gamma_curve_sector { + u32 boundary_start; + u32 num_of_segments; + u32 segment_width; +}; + +struct gamma_curve_segment { + u32 start; + u32 end; +}; + +static struct gamma_curve_sector sector_tbl[] = { + { 0, 4, 4 }, + { 16, 4, 4 }, + { 32, 4, 8 }, + { 64, 4, 16 }, + { 128, 4, 32 }, + { 256, 4, 64 }, + { 512, 16, 32 }, + { 1024, 24, 128 }, +}; + +static void +drm_lut_to_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs, + struct gamma_curve_sector *sector_tbl, u32 num_sectors) +{ + struct drm_color_lut *lut; + u32 i, j, in, num = 0; + + if (!lut_blob) + return; + + lut = lut_blob->data; + + for (i = 0; i < num_sectors; i++) { + for (j = 0; j < sector_tbl[i].num_of_segments; j++) { + in = sector_tbl[i].boundary_start + + j * sector_tbl[i].segment_width; + + coeffs[num++] = drm_color_lut_extract(lut[in].red, + KOMEDA_COLOR_PRECISION); + } + } + + coeffs[num] = BIT(KOMEDA_COLOR_PRECISION); +} + +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)); +} 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 a2df218f58e7..08ab69281648 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_color_mgmt.h @@ -11,7 +11,14 @@ #include #define KOMEDA_N_YUV2RGB_COEFFS 12 +#define KOMEDA_N_RGB2YUV_COEFFS 12 +#define KOMEDA_COLOR_PRECISION 12 +#define KOMEDA_N_GAMMA_COEFFS 65 +#define KOMEDA_COLOR_LUT_SIZE BIT(KOMEDA_COLOR_PRECISION) +#define KOMEDA_N_CTM_COEFFS 9 + +void drm_lut_to_fgamma_coeffs(struct drm_property_blob *lut_blob, u32 *coeffs); const s32 *komeda_select_yuv2rgb_coeffs(u32 color_encoding, u32 color_range); -#endif +#endif /*_KOMEDA_COLOR_MGMT_H_*/ From patchwork Fri Oct 11 05:43:23 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: 11184835 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 B5F4415AB for ; Fri, 11 Oct 2019 05:43:56 +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 9B87921D6C for ; Fri, 11 Oct 2019 05:43:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B87921D6C 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 A6D566E9C2; Fri, 11 Oct 2019 05:43:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80082.outbound.protection.outlook.com [40.107.8.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 551E96E9C2 for ; Fri, 11 Oct 2019 05:43:47 +0000 (UTC) Received: from VI1PR0802CA0001.eurprd08.prod.outlook.com (2603:10a6:800:aa::11) by AM6PR08MB4999.eurprd08.prod.outlook.com (2603:10a6:20b:e7::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:43 +0000 Received: from AM5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by VI1PR0802CA0001.outlook.office365.com (2603:10a6:800:aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.16 via Frontend Transport; Fri, 11 Oct 2019 05:43:43 +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 AM5EUR03FT037.mail.protection.outlook.com (10.152.17.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Fri, 11 Oct 2019 05:43:41 +0000 Received: ("Tessian outbound 3fba803f6da3:v33"); Fri, 11 Oct 2019 05:43:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 38a8f3ea0075de2c X-CR-MTA-TID: 64aa7808 Received: from a6bf254ba81f.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.0.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id A2C02209-4D5F-415B-9689-BDE2A69C4FAE.1; Fri, 11 Oct 2019 05:43:27 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2053.outbound.protection.outlook.com [104.47.0.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a6bf254ba81f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 11 Oct 2019 05:43:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJ3STHbc5tZUBv+Kba2WQ30cFt4QmpNO4XXkgfK36Tw7woiKe5/FZ6T6fnNVQ2k1WhSzbZOYIzg3TPMjIUcMJg/UehwnehokGqukoG6g/CPLaOXYLNabBA0ySMVrWI7G6nu9abKS/P95r2i29LXv/3rSil2uOWK3kseKPLetBt56RYpi8pFu4XXU8nysPsdM+N6nRPIvl7Pjkez9VysJJOysFrde4IFcI46LijW1lDqtt4tpuIB+B+M71BmUxCcM3LyF+48Oo4SC2Fpxx4eE6W8U90Ppzo7wFf1MnZum3rYZFwtXBpumSUBUzbQNaPt1FVamZabakNAQlg1NJsT5+w== 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=GwjboglvKAq6uiIJDn2YUD84pCdj+UuHqWJb/1SqjLc=; b=XWeZzTv+LjceiGyOtK37RKQDnMyfL2W4Z1Rkab8NBA6j+cDbzx6qdki6tTmlJ2eZ6nmwsWYAz4rrKMXNGucULMDgXD88r/ht0zNcB0UXxLvwSIeSjDfa/Xla8x3pbvYoE6Pp5FuxniYnzaJEojtSQ5JxKSDD8RpArKSomyLsC2AObZKe5VTyhzW9CIdV9+jLy2Jvc0HmZ6ZV4ENrkxOvJbbRzSdvcHdwVU5G3pEgQzN9Mf5uL0+oo9WGglerLReLSJd6LsKjDWVaNpwmGqTcUEChYy9aYdmaOaIDpE5JQQFt3O7aeZs7GQL8SEU2b34WTBF/ZqlYBTtHaE5lStFW2A== 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 VE1PR08MB5134.eurprd08.prod.outlook.com (10.255.158.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:23 +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.021; Fri, 11 Oct 2019 05:43:23 +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 v2 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Topic: [PATCH v2 3/4] drm/komeda: Add drm_ctm_to_coeffs() Thread-Index: AQHVf/bLcMR8w2F0B0+It1k1COYv8Q== Date: Fri, 11 Oct 2019 05:43:23 +0000 Message-ID: <20191011054240.17782-4-james.qian.wang@arm.com> References: <20191011054240.17782-1-james.qian.wang@arm.com> In-Reply-To: <20191011054240.17782-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: HK2P15301CA0005.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::15) 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: ce175f51-af8c-4f34-bdb5-08d74e0df8da X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VE1PR08MB5134:|VE1PR08MB5134:|AM6PR08MB4999: 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: 0187F3EA14 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(189003)(199004)(66066001)(486006)(386003)(6506007)(64756008)(99286004)(50226002)(52116002)(81156014)(6486002)(8936002)(81166006)(66946007)(102836004)(8676002)(305945005)(55236004)(26005)(66476007)(71200400001)(6116002)(3846002)(66556008)(6436002)(71190400001)(7736002)(76176011)(36756003)(186003)(2906002)(256004)(476003)(6512007)(2616005)(66446008)(446003)(11346002)(54906003)(25786009)(14454004)(2501003)(103116003)(110136005)(316002)(4326008)(5660300002)(86362001)(478600001)(2201001)(1076003)(2171002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5134; 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: JkZ/G8Hi75jgNaZzV2Wi1x311SjgBaNPNvFUGMP9hBk/mOdNCR3R9BMx7qStzRT2fbLE5nBFylhX4gw9AJ4zTeatqO6FG7LG+1HAF/oZKbuFp0EqLqkGL/r4XE7cx7xx4zCKXOjcK9iBj6hWNkHJaxbQGrU2UGHu6+Q4Bc0uv2FSI6aOTPk6YvjoKBOrdDs5acd0a+GqvgEWlw0v9jEf6DeGkVil2CzON+bDsGeT4LU8nIzqIhMULT+DetZji0OliewPQ4NlmlZq6cxIeHa4MUcoB2YnHNyimaWDEIE3t4s/CxHObKcT3xGJ+6Z67iIUnbycK4zYvxiKpAdLTV0+GAEt17R0ky4L9mIjIixUdBRYkdVp/n/Stmc/f7hejKbntfyQKaR/1qU+h3ei1pLyuC7jMOj+QADKswwpQ66C8AY= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5134 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT037.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)(396003)(346002)(136003)(376002)(39860400002)(189003)(199004)(356004)(102836004)(76130400001)(2171002)(1076003)(76176011)(5660300002)(4326008)(7736002)(26826003)(478600001)(25786009)(70206006)(81166006)(99286004)(70586007)(186003)(26005)(81156014)(8936002)(8746002)(8676002)(50226002)(3846002)(6116002)(36906005)(386003)(6506007)(2906002)(36756003)(103116003)(22756006)(23756003)(110136005)(50466002)(54906003)(305945005)(126002)(316002)(14454004)(63350400001)(6512007)(446003)(47776003)(336012)(66066001)(486006)(11346002)(2616005)(476003)(86362001)(2501003)(6486002)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB4999; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: e6fe4a50-761d-4487-2052-08d74e0dee2f NoDisclaimer: True X-Forefront-PRVS: 0187F3EA14 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3J9QGcSjdwotWOxQQSI2X4mDdG2LevrI0EzdmqyTnGP2EPfTu9R8euvYaz6li9ECch+CBsrB8SXBPL6IquBFL9/PZSrhdnFuqW6CSSKA44/TGZlMIdSZ7uMchxpXIWMAQ7/GiRcjwT0Ialsvd0RMvEoRYyMghk0OU/mPp0P3UWFRL43fA+aKPNsdFdNtggW0hGkhdQ11ahr/zhkh5L4+kl0koK993YOUgYLSAShz2ub3p8RJqjCzZV2Pl205WCRlIxBpqspA0ciVhnKD3u22z5go0qb2dJ0QHomvtnFgrenJd+dDq2VvfCEoLE/uVH3NIBne5Nlft+hklK4oCouE0JXIFuK2kPy9qiEmwxL9bzpfRZyMk1yBarwlRxVxOISgfahMqI+fZrltNVnrQ/DZXM6ukHLiNvPoN+hSvaDrttU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2019 05:43:41.2300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce175f51-af8c-4f34-bdb5-08d74e0df8da 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: AM6PR08MB4999 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=GwjboglvKAq6uiIJDn2YUD84pCdj+UuHqWJb/1SqjLc=; b=in6AxU8ACzOUEDCj04ROWClmtYWC9G/qA0bErD8NSzd7BazPS5sp3wixIOk9RILJhjAexJm7AEpDEMPcuxdmCb8m4e7bzgm98Kqebk3M9tdwbwYptWzhGRPEu2+I0MmZSPyBMIKzxayZehzCFspAy2WBGws+vZq4iuSMYJVdjpo= 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=GwjboglvKAq6uiIJDn2YUD84pCdj+UuHqWJb/1SqjLc=; b=in6AxU8ACzOUEDCj04ROWClmtYWC9G/qA0bErD8NSzd7BazPS5sp3wixIOk9RILJhjAexJm7AEpDEMPcuxdmCb8m4e7bzgm98Kqebk3M9tdwbwYptWzhGRPEu2+I0MmZSPyBMIKzxayZehzCFspAy2WBGws+vZq4iuSMYJVdjpo= 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) --- .../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); From patchwork Fri Oct 11 05:43:30 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: 11184837 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 D266815AB for ; Fri, 11 Oct 2019 05:43:58 +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 B9BDE2196E for ; Fri, 11 Oct 2019 05:43:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9BDE2196E 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 68B506EB99; Fri, 11 Oct 2019 05:43:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30073.outbound.protection.outlook.com [40.107.3.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id B48106EB99 for ; Fri, 11 Oct 2019 05:43:48 +0000 (UTC) Received: from DB6PR0801CA0057.eurprd08.prod.outlook.com (2603:10a6:4:2b::25) by VI1PR0802MB2142.eurprd08.prod.outlook.com (2603:10a6:800:9b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:39 +0000 Received: from VE1EUR03FT020.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::201) by DB6PR0801CA0057.outlook.office365.com (2603:10a6:4:2b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.16 via Frontend Transport; Fri, 11 Oct 2019 05:43:39 +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 VE1EUR03FT020.mail.protection.outlook.com (10.152.18.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Fri, 11 Oct 2019 05:43:37 +0000 Received: ("Tessian outbound 081de437afc7:v33"); Fri, 11 Oct 2019 05:43:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ee808d8164c2722d X-CR-MTA-TID: 64aa7808 Received: from fd5ed3b62776.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.6.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 85D9C0D8-A6AC-4F39-B690-BF3B8484CAA7.1; Fri, 11 Oct 2019 05:43:32 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02lp2059.outbound.protection.outlook.com [104.47.6.59]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd5ed3b62776.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 11 Oct 2019 05:43:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WQSVksWfi2JHOMnjim9q4tKncJYJoXJI0DSogRbWMxu0bDHghaRZ8f0ECvra9IQVkK1195GL9fAq8AeiblQkzhEeiEjT2O6VyFCAFHpxVYhgEqJ55q3EuZ20z6wVFF5EZjZd2aw4dzFFmlnEGL1Sr3FXu8mcoQOVEyo3zmeUZUBeFCxqFgp+bxWZSdCDKq2j2CSqxKq+QtzcDQNmnf+1eqjza/twgUu1mqTwr1hFlXEdh6jDmHzLNu72JiyUIuqNFx9nE0slLAXCoy7NH3uDsl6PnHDCxDPxgID5PT9GjgHLMUQrVtRd8bNQOoMb9rAqgz5pgc1apMSMzdJBDRgrxA== 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=fIUGSIoTFS+rG3rkaZCUgjh5FrULV5M3gll9vYVFpDA=; b=Ch58dwjpx9SKzbln/LfMGrzzd0obdXcpr1BT4Ho2aNxmmgCrgFFehURz6CiWurm/uLBVpJSCKhPoJrW6GCwb+Vd+kmzJS0nipj8FpoNc0664RRILHUDN5oEt0cNMQQdBC0BV8eCqU3QIjGIUzrX/RNxjOBiBaY2p5rdAHO0t4SMyRQ9eZHPJsCe49N+dWziflfzjAALbQYDtC058Qk2+Ysr48vMpU5A6MnFO8k9jcZwCjmLB4virhINYRNc+yjvnBEF+t/qn2v+ZNMj5Eb3X8mepkpsOxuofr/+FpnSmgPuFBxY5jStMF2eUDhPVuSQcglmDM+tpIcwDDK/02w8igg== 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 VE1PR08MB5134.eurprd08.prod.outlook.com (10.255.158.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:43:30 +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.021; Fri, 11 Oct 2019 05:43:30 +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 v2 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Topic: [PATCH v2 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Index: AQHVf/bQ8wvdbeg7lUSqVOfgqlbTpA== Date: Fri, 11 Oct 2019 05:43:30 +0000 Message-ID: <20191011054240.17782-5-james.qian.wang@arm.com> References: <20191011054240.17782-1-james.qian.wang@arm.com> In-Reply-To: <20191011054240.17782-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: HK2P15301CA0005.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::15) 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: a6d5c2f0-1049-43c4-c0fd-08d74e0df6db X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VE1PR08MB5134:|VE1PR08MB5134:|VI1PR0802MB2142: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:2958;OLM:2958; x-forefront-prvs: 0187F3EA14 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(189003)(199004)(66066001)(486006)(386003)(6506007)(64756008)(99286004)(50226002)(52116002)(81156014)(6486002)(8936002)(81166006)(66946007)(102836004)(8676002)(305945005)(55236004)(26005)(66476007)(71200400001)(6116002)(3846002)(66556008)(6436002)(71190400001)(7736002)(76176011)(36756003)(186003)(2906002)(256004)(476003)(6512007)(2616005)(14444005)(66446008)(446003)(11346002)(54906003)(25786009)(14454004)(2501003)(103116003)(110136005)(316002)(4326008)(5660300002)(86362001)(478600001)(2201001)(1076003)(2171002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5134; 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: 9PNdl4Zbz5TBG3FnTm+9TJrSG3EWK4iMTxGY97c3vAhN7iFLvVmEhtUtqjbyfdRJvzrqg+2Jz7nYJWeyg1f8WC8unT6wOKFjGlKPJw2OGnCAKseIC6rjCRxe2UUE+CvYwWWIm8l08zYzUOTdMQmmXvbS9vCZu4zqEcNmx2xKqo+R0KT2IJsImef3NPgvJNAbi9hXvkI9ZTMx5EqPDUp4coLNtMb9OMkag46p+6P4cOQtbx6AVf+Hrs+OooYc8ypGF0LUcg897wTAoQpfz5HxtcMRdLHcdP1a6PsvYEiaHWNLoArACadq3hnyFLAqTruyv6U9z/scVRt+jH5g/QJcipp7twQMrgkCJTaeTFZj1QnE0OEau5Z1IMNth+2dBuITB2imvKZi36rJruA20YqHLJXkofUurSbPAwS/RLd76UA= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5134 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT020.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)(39860400002)(136003)(396003)(376002)(346002)(189003)(199004)(103116003)(476003)(36906005)(110136005)(126002)(486006)(2171002)(47776003)(8676002)(54906003)(23756003)(316002)(2906002)(50226002)(22756006)(102836004)(86362001)(14444005)(386003)(305945005)(2201001)(76176011)(36756003)(6506007)(7736002)(99286004)(1076003)(63350400001)(2501003)(6486002)(478600001)(5660300002)(11346002)(26826003)(25786009)(2616005)(26005)(186003)(14454004)(356004)(81156014)(50466002)(6512007)(3846002)(81166006)(8746002)(446003)(70206006)(70586007)(4326008)(336012)(76130400001)(8936002)(6116002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2142; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 2a6ceaf6-f21c-4bac-99d7-08d74e0df26e NoDisclaimer: True X-Forefront-PRVS: 0187F3EA14 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wu0CezrEFUlVc4VPMtfsscpN7KertZwCp7bFMb/kJzroiuZZVspRZGppk8S60aZhyElE414fuuW16h8MmpWLRcQLP+HYHmel43ijlQhaR/jLVdrwFws0OPUzh2x1sOin1l5Igbz+y2S66G588zof1f3VsHm9mhaOtxz6g3Jlov7EsT5/ZKmIrmDsfzl7tIIMSINiKZy741uWlsGoLGmQrMpZjVGJOOpNrV3XmYQ0F+kWrT4uFdNZoUTE7VWX+b1YQ8uYYRLO0yZjj7MQXOfjUf+wpssjMp0shqi/dYz571f5d0EPJ+l9X3GhKT4PAFjAVO7ycSGi5w+KwAMj4Whg+LYPNW+Y7sMIhieW5HYus26JsD6KueOiuc/I1Sd1oqQXpv0tendOJG4kLfZ5QI0G9Y1M1OReCVc/2VR/ZWi+keg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2019 05:43:37.8311 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6d5c2f0-1049-43c4-c0fd-08d74e0df6db 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: VI1PR0802MB2142 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=fIUGSIoTFS+rG3rkaZCUgjh5FrULV5M3gll9vYVFpDA=; b=05N3VmuW+BombtrDyRihPLhEnlvcAczbMfb1pYkQl8FtawDe5qt6y2jMWDJpy2OqMOkMEAufwzaIj4qTniauVD3kSXoF4iOJDGEPxckohcoXDbl8/Kq9oXzhvyh1y2odxpWJ7LG/+9ClNQJUtYgqldCgtgUGOE6E3iA+b3F22es= 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=fIUGSIoTFS+rG3rkaZCUgjh5FrULV5M3gll9vYVFpDA=; b=05N3VmuW+BombtrDyRihPLhEnlvcAczbMfb1pYkQl8FtawDe5qt6y2jMWDJpy2OqMOkMEAufwzaIj4qTniauVD3kSXoF4iOJDGEPxckohcoXDbl8/Kq9oXzhvyh1y2odxpWJ7LG/+9ClNQJUtYgqldCgtgUGOE6E3iA+b3F22es= 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\)" , "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" From: "Lowry Li (Arm Technology China)" Adds gamma and color-transform support for DOU-IPS. Adds two caps members fgamma_coeffs and ctm_coeffs to komeda_improc_state. If color management changed, set gamma and color-transform accordingly. Signed-off-by: Lowry Li (Arm Technology China) --- .../arm/display/komeda/d71/d71_component.c | 24 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 2 ++ .../drm/arm/display/komeda/komeda_pipeline.h | 3 +++ .../display/komeda/komeda_pipeline_state.c | 6 +++++ 4 files changed, 35 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c index c3d29c0b051b..e7e5a8e4430e 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -942,15 +942,39 @@ static int d71_merger_init(struct d71_dev *d71, static void d71_improc_update(struct komeda_component *c, struct komeda_component_state *state) { + struct drm_crtc_state *crtc_st = state->crtc->state; struct komeda_improc_state *st = to_improc_st(state); + struct d71_pipeline *pipe = to_d71_pipeline(c->pipeline); u32 __iomem *reg = c->reg; u32 index; + u32 mask = 0, ctrl = 0; for_each_changed_input(state, index) malidp_write32(reg, BLK_INPUT_ID0 + index * 4, to_d71_input_id(state, index)); malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize)); + + if (crtc_st->color_mgmt_changed) { + mask |= IPS_CTRL_FT | IPS_CTRL_RGB; + + if (crtc_st->gamma_lut) { + malidp_write_group(pipe->dou_ft_coeff_addr, FT_COEFF0, + KOMEDA_N_GAMMA_COEFFS, + st->fgamma_coeffs); + ctrl |= IPS_CTRL_FT; /* enable gamma */ + } + + if (crtc_st->ctm) { + malidp_write_group(reg, IPS_RGB_RGB_COEFF0, + KOMEDA_N_CTM_COEFFS, + st->ctm_coeffs); + ctrl |= IPS_CTRL_RGB; /* enable gamut */ + } + } + + if (mask) + malidp_write32_mask(reg, BLK_CONTROL, mask, ctrl); } static void d71_improc_dump(struct komeda_component *c, struct seq_file *sf) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 9beeda04818b..406b9d0ca058 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -590,6 +590,8 @@ static int komeda_crtc_add(struct komeda_kms_dev *kms, crtc->port = kcrtc->master->of_output_port; + drm_crtc_enable_color_mgmt(crtc, 0, true, KOMEDA_COLOR_LUT_SIZE); + return err; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index b322f52ba8f2..c5ab8096c85d 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -11,6 +11,7 @@ #include #include #include "malidp_utils.h" +#include "komeda_color_mgmt.h" #define KOMEDA_MAX_PIPELINES 2 #define KOMEDA_PIPELINE_MAX_LAYERS 4 @@ -324,6 +325,8 @@ struct komeda_improc { struct komeda_improc_state { struct komeda_component_state base; u16 hsize, vsize; + u32 fgamma_coeffs[KOMEDA_N_GAMMA_COEFFS]; + u32 ctm_coeffs[KOMEDA_N_CTM_COEFFS]; }; /* display timing controller */ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index 0ba9c6aa3708..4a40b37eb1a6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -756,6 +756,12 @@ komeda_improc_validate(struct komeda_improc *improc, st->hsize = dflow->in_w; st->vsize = dflow->in_h; + if (kcrtc_st->base.color_mgmt_changed) { + drm_lut_to_fgamma_coeffs(kcrtc_st->base.gamma_lut, + st->fgamma_coeffs); + drm_ctm_to_coeffs(kcrtc_st->base.ctm, st->ctm_coeffs); + } + komeda_component_add_input(&st->base, &dflow->input, 0); komeda_component_set_output(&dflow->input, &improc->base, 0);