From patchwork Fri Nov 1 06:54:10 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: 11222451 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 9B9C71515 for ; Fri, 1 Nov 2019 06:54:28 +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 8022421835 for ; Fri, 1 Nov 2019 06:54:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8022421835 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 D76F96F717; Fri, 1 Nov 2019 06:54:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150074.outbound.protection.outlook.com [40.107.15.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 727136F717 for ; Fri, 1 Nov 2019 06:54:25 +0000 (UTC) Received: from VI1PR0802CA0036.eurprd08.prod.outlook.com (2603:10a6:800:a9::22) by HE1PR0801MB1788.eurprd08.prod.outlook.com (2603:10a6:3:88::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Fri, 1 Nov 2019 06:54:21 +0000 Received: from VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::200) by VI1PR0802CA0036.outlook.office365.com (2603:10a6:800:a9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.19 via Frontend Transport; Fri, 1 Nov 2019 06:54:20 +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 VE1EUR03FT011.mail.protection.outlook.com (10.152.18.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:54:20 +0000 Received: ("Tessian outbound 081de437afc7:v33"); Fri, 01 Nov 2019 06:54:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 27ccc1771b6db4c7 X-CR-MTA-TID: 64aa7808 Received: from 342a855bf8bd.2 (cr-mta-lb-1.cr-mta-net [104.47.12.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 89644E4E-0FCB-43A1-92BA-E04135A9C2D9.1; Fri, 01 Nov 2019 06:54:13 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04lp2056.outbound.protection.outlook.com [104.47.12.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 342a855bf8bd.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 01 Nov 2019 06:54:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JSaHuYlcqiw1WhwdFABg0ouu6zfXknHmL3nCwwH8ShUgTwoKM1LBWaczD6ySZscWYrBvKtVTOUQaTkjUKnlJtjJ3IckrMbKxDMnM3w+bEwmsXnmvu+rK1QUqklGFqy5l16MVWNFJfgIGCu23MOE3Exo42wsF/xou6BFkT78UOBr9NG258JaygACueJFNwYG6Dbm0txQpNK1M8X6Trtxddic72fpMp5xEVnp/PfL2GHlxPPvuNxknSLiQHd9MN8fDozXVT1FgWDLbZM6iRdG2MkpNVB03nUVrVSSDWUUB07I8ZZJklgI1Hmso+aU8OgiASj5QBXm6D/I6Ow/PVRZuZA== 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=9TQq3bHNRrYQiNPP2nRVJpod47h6p3GxLvGsKKnTnHo=; b=cif8TLhpGae9vvoB/yRbA9Pf1Iowi4P78+/7lNc+xN5do6P8Bl2VTyHIk5ovhlXby9Fxn5r9EcfRl/y736/m7lZ9nY6yZs0NU/EoF+MtiEobS04PvQNk8t8/UGZm0GDji4qwbbmmikqD6vctb+3EOJxRxSrzfjhA7qvwVHHZrFVMo7SEEx+gsVpiqSKFFqg46qn8EsRVxOT7ZOs1FwMI2Ht/QJ05x4eIcoaiXAK274z7+3VRe2sDngD+lnrG7Bs4Seif/bWTSdS9L2StUmtWHgXgh+t30oL7X6K9BncN9qxMSBrl+BFZf9gmTZUEmJejiwhiD9cfBCKRvVhUO3tuew== 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 VE1SPR01MB0002.eurprd08.prod.outlook.com (20.179.193.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.17; Fri, 1 Nov 2019 06:54:11 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7%6]) with mapi id 15.20.2387.030; Fri, 1 Nov 2019 06:54:11 +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 v8 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Topic: [PATCH v8 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Index: AQHVkIEqK7frcEGc3kG9AqJwM+vaIw== Date: Fri, 1 Nov 2019 06:54:10 +0000 Message-ID: <20191101065319.29251-5-james.qian.wang@arm.com> References: <20191101065319.29251-1-james.qian.wang@arm.com> In-Reply-To: <20191101065319.29251-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: HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) 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-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c3e6a63b-12a1-4d38-c37d-08d75e98528b X-MS-TrafficTypeDiagnostic: VE1SPR01MB0002:|VE1SPR01MB0002:|HE1PR0801MB1788: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:2582;OLM:2582; x-forefront-prvs: 020877E0CB X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(199004)(189003)(66066001)(446003)(11346002)(2616005)(486006)(36756003)(8676002)(14454004)(5660300002)(476003)(103116003)(2501003)(2171002)(86362001)(3846002)(6116002)(305945005)(2201001)(25786009)(1076003)(6512007)(66476007)(52116002)(71200400001)(71190400001)(386003)(55236004)(6506007)(6436002)(102836004)(6486002)(7736002)(14444005)(186003)(99286004)(8936002)(110136005)(4326008)(54906003)(50226002)(478600001)(64756008)(2906002)(66446008)(81156014)(66556008)(316002)(66946007)(81166006)(76176011)(256004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1SPR01MB0002; H:VE1PR08MB5006.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: BNzzA4Kjin9yYjpGXKXnDDkrSkKd1qyeprWHxOBFS9bmohvVVDQUwWUX7hqhN4z7HScNODUPMrXRBy+EgV4T3zQzOlcEd62SJ8koRshI0VZrsvV/aW3OC7ma/OG8rCbpGmmIxfvtmc5N6mdFMHOOXKtux/2zBwO3SER83brFu8QA4bhmX7p4ofvYjrUXVh2piZS5y2BQeRk4hhEUaCq0gcdfoTqZT3QiqVTzCpn/hCVeN1tSKWrZAlhub60zO2N9i2TU6yU5xEigNRxhEhl0tUL6MCoFHYTarHBBRhYlj4frk2iKkMVvtTZz33PkgU4S+7BtgL1rjz65yAOzWyEZWqp9HB/HtZ8Qj9LXqJFcNMoJoq8yrz1jnB2b0tSEZdPDbV3yWM+u+ruF2X/lkJ+/JAS8Okm46D2/KxrlnR0MIHW668oTjTvtz6V2Hl7CwOmS MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1SPR01MB0002 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT011.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)(376002)(136003)(346002)(396003)(1110001)(339900001)(199004)(189003)(81156014)(26826003)(8676002)(81166006)(478600001)(105606002)(14454004)(6486002)(25786009)(50226002)(36906005)(26005)(54906003)(23756003)(8936002)(8746002)(99286004)(6512007)(70206006)(4326008)(70586007)(76176011)(110136005)(2171002)(316002)(76130400001)(386003)(36756003)(6506007)(102836004)(50466002)(186003)(1076003)(22756006)(7736002)(2906002)(66066001)(47776003)(2501003)(305945005)(86362001)(14444005)(2201001)(336012)(5660300002)(486006)(476003)(103116003)(126002)(3846002)(2616005)(6116002)(11346002)(446003)(356004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB1788; 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: 4c1abd58-5aa8-4e1a-e3a1-08d75e984c64 NoDisclaimer: True X-Forefront-PRVS: 020877E0CB X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LhcCqIQApXNZDLh89O3Kd6BX1alrfDsr+p22SMkFuUi6Cnb67h4hNiwa1bzQEs3w+XUgyAk202QqXA9DuEvXpxHu8pZ8w0Mky6ecOm3ZkubV5fM/b0h9WMwjzVkwZ7BfinFmbY+R1fesSmDU0nzgdJFQP/yGJlEh8VMabxXphfFBsXygnzm1V0hbVrvR9oHug4P3HzDtwxlKCPRfZjD5G2LtRGykQ+hMOwnadkzFC+moNYwBwnyL0wwyCMur8UTCEzMsT9g99nlRLc3Zdjx5r1PuhVdlXu1cg0ezTq75+aP0OpYTb6WRfLKnMCKjhGoNrJurVn5SBfg+t5mAscTRnHbDYYQDG+ACq15zESbCgpLcqGIaegRxgQB3eOYevIfW/CPfj2vDcxO1A9adDRca8Zg2S6qJVojQXMfH+sWIVShrldvoD4k0v4qqRPMjCr3E X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:54:20.8074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3e6a63b-12a1-4d38-c37d-08d75e98528b 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: HE1PR0801MB1788 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=9TQq3bHNRrYQiNPP2nRVJpod47h6p3GxLvGsKKnTnHo=; b=4XZkux5NumDAb2H8tdwo3YGExFmR5M8cPoEUTp5y6rDG9SrQBdFP93+qytUdQrGIiMaASVsz9L4H0hRQFd84porZY2rG9Fc4tack8klNVHH/Z1J+yDIUdpiWU4M654pOJvXwA/JsQGkYJjJ+DTOYF6qK9CicLDinw/dl+ENxG08= 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=9TQq3bHNRrYQiNPP2nRVJpod47h6p3GxLvGsKKnTnHo=; b=4XZkux5NumDAb2H8tdwo3YGExFmR5M8cPoEUTp5y6rDG9SrQBdFP93+qytUdQrGIiMaASVsz9L4H0hRQFd84porZY2rG9Fc4tack8klNVHH/Z1J+yDIUdpiWU4M654pOJvXwA/JsQGkYJjJ+DTOYF6qK9CicLDinw/dl+ENxG08= 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\)" , "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. v5: Rebase with drm-misc-next Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Mihail Atanassov --- .../arm/display/komeda/d71/d71_component.c | 20 +++++++++++++++++++ .../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, 31 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 f0ba26e282c3..b6517c46e670 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -1044,7 +1044,9 @@ 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, mask = 0, ctrl = 0; @@ -1055,6 +1057,24 @@ static void d71_improc_update(struct komeda_component *c, malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize)); malidp_write32(reg, IPS_DEPTH, st->color_depth); + 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 */ + } + } + mask |= IPS_CTRL_YUV | IPS_CTRL_CHD422 | IPS_CTRL_CHD420; /* config color format */ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 252015210fbc..1c452ea75999 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -617,6 +617,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 bd6ca7c87037..ac8725e24853 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 @@ -327,6 +328,8 @@ struct komeda_improc_state { struct komeda_component_state base; u8 color_format, color_depth; 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 42bdc63dcffa..0930234abb9d 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -802,6 +802,12 @@ komeda_improc_validate(struct komeda_improc *improc, st->color_format = BIT(__ffs(avail_formats)); } + 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);