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);