From patchwork Wed Oct 23 06: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: 11205757 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 39DF9139A for ; Wed, 23 Oct 2019 06:43:33 +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 1CAD221906 for ; Wed, 23 Oct 2019 06:43:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CAD221906 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 18C386E963; Wed, 23 Oct 2019 06:43:32 +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-he1eur02on0621.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::621]) by gabe.freedesktop.org (Postfix) with ESMTPS id D060D6E963 for ; Wed, 23 Oct 2019 06:43:30 +0000 (UTC) Received: from DB7PR08CA0017.eurprd08.prod.outlook.com (2603:10a6:5:16::30) by VE1PR08MB4895.eurprd08.prod.outlook.com (2603:10a6:802:ac::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Wed, 23 Oct 2019 06:43:27 +0000 Received: from VE1EUR03FT023.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::209) by DB7PR08CA0017.outlook.office365.com (2603:10a6:5:16::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.24 via Frontend Transport; Wed, 23 Oct 2019 06:43:27 +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 VE1EUR03FT023.mail.protection.outlook.com (10.152.18.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.23 via Frontend Transport; Wed, 23 Oct 2019 06:43:26 +0000 Received: ("Tessian outbound 6481c7fa5a3c:v33"); Wed, 23 Oct 2019 06:43:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 694ce0f428c59884 X-CR-MTA-TID: 64aa7808 Received: from 7a56dd4b3f30.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.8.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id D311E4CE-2C2D-4326-9E18-76F81C9B48E4.1; Wed, 23 Oct 2019 06:43:18 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03lp2051.outbound.protection.outlook.com [104.47.8.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7a56dd4b3f30.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 23 Oct 2019 06:43:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rh6O9JCL0bFJYusmLKOQntTNngI2cXSQUmBnoAHcKa3Al2j28pRAhmOQZ2UzntBGnHszU2mUUtx5xBrNA/J8qh1vWiTL/TZnUPxBf0Xo3ZOm5bG/USSbX4Ib7V6LrwVHzwK6E1IQDD0KXVMqRYIttuyxO2K3+SQbyCbrBgG2WRMwPtwQzIAceDu7Za0vZD03TwR/IG/3jylwKgNL2/zAsFBCoRIyKOpBrquYbTyheRFl5KNZuTtl0DnA5G2MXkI/BsX15tF5DXeINUz4L1WE/cez0QQywmI9VO+DYriW2DYt7aBrmRU7v3Awvjc6xmIEA2dz/mIg8O/BQn5ieutJ9g== 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=MG8PsjMd2TzJntkTevOXT36eUd0sHiyS5NnrKmhY1R1EErMKtEIF3Hct2blolrZm884Z+8n+A5QY/wXRLNURoRtDDDjeCthEdhA0aTMNFdJVlK+7n3JuN2DYm7Xpws6T2H5X2Nz+rTzVpTXFULG8Hl/s9amP9CGbWQrXAu9RH4bXBkJwgc44rWh2QXGaWEXfP/boxHWkp6blSQ/LF8+7etB5YQrDlUi4z8qc8Z8fIOAmjfHeAstpQn0gqB9XqssdFzo85GQ3/FkTSaq/Ni5v14INPnBvIPxw40tPO0uwYrys/dsNcxcOQjkGdHMfvGrAlb6+mn8GuNRZ//d3Fwke1A== 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 VE1PR08MB4672.eurprd08.prod.outlook.com (10.255.112.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.22; Wed, 23 Oct 2019 06:43:17 +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.2367.022; Wed, 23 Oct 2019 06:43:17 +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 v7 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Topic: [PATCH v7 4/4] drm/komeda: Adds gamma and color-transform support for DOU-IPS Thread-Index: AQHViW0mF05EqmyI+keSzxdB9PsPEA== Date: Wed, 23 Oct 2019 06:43:16 +0000 Message-ID: <20191023064226.10969-5-james.qian.wang@arm.com> References: <20191023064226.10969-1-james.qian.wang@arm.com> In-Reply-To: <20191023064226.10969-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: HK2PR02CA0184.apcprd02.prod.outlook.com (2603:1096:201:21::20) 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: a4d36d65-dad0-472e-f57a-08d757844f02 X-MS-TrafficTypeDiagnostic: VE1PR08MB4672:|VE1PR08MB4672:|VE1PR08MB4895: 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: 019919A9E4 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(39860400002)(366004)(376002)(346002)(189003)(199004)(7736002)(25786009)(2906002)(386003)(71200400001)(4326008)(36756003)(305945005)(6506007)(66066001)(2201001)(71190400001)(102836004)(5660300002)(26005)(478600001)(52116002)(14444005)(55236004)(316002)(86362001)(186003)(6116002)(76176011)(3846002)(256004)(2171002)(66446008)(66946007)(103116003)(64756008)(6512007)(1076003)(66556008)(50226002)(66476007)(476003)(6436002)(8936002)(446003)(2501003)(11346002)(2616005)(6486002)(14454004)(486006)(54906003)(99286004)(81166006)(8676002)(81156014)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4672; 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: fr4sq5cyeDTqUyanruBlqcfjFbzp+rl5EPRQIcJtfKkD3L9k8Jy2fHsHAvN36ut3U8Nhf2SDhbDOTJCpqHOkkuY4u7exGsNS/J6zbGfUMXZfM/XNxrzP2eUBy+4QcyvaznW6IgFFJcNU3pAGQqZZsy4QwBl09gqML31+eeroGQQDDsNabuzQhFYpN09fT6i+GdI0LtS6VagiAUcx8mnx7Goaa/qdS9Zrb5w3N5WkQrmAxSYIwRm+BjouO55tZXYRBPxUInY3hSmjg1FDQg3Ilx2FYV145I7ulaP0kOBbyvURA68EdN7MDIpKpYnavuz18eUcTWHOKgHOuVxBWRqF1DZjh2Qbke/mXhuWAK8UWYKdMlXiO/qdpCP4uvfqUOB42ZGnLbZAjhPrCY7RNpgkwdM9NEmxUfo3bFT317LUvE4= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4672 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT023.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)(376002)(346002)(39860400002)(1110001)(339900001)(199004)(189003)(66066001)(8676002)(25786009)(47776003)(3846002)(2501003)(110136005)(316002)(356004)(50226002)(81166006)(6116002)(36756003)(5660300002)(81156014)(8936002)(8746002)(2906002)(2171002)(14444005)(22756006)(1076003)(26005)(186003)(105606002)(70206006)(103116003)(476003)(86362001)(102836004)(2201001)(76130400001)(26826003)(7736002)(4326008)(76176011)(336012)(386003)(70586007)(486006)(6512007)(23756003)(36906005)(14454004)(6506007)(54906003)(305945005)(478600001)(99286004)(126002)(2616005)(11346002)(446003)(50466002)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4895; 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: fdc9e2a7-bc07-41eb-ac1c-08d7578448e9 NoDisclaimer: True X-Forefront-PRVS: 019919A9E4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LBLoUpDTiaabnc7dUFYWDcRQHf1B6SXe6DZgCmXn5SpvWTZ8UqwmLlDblj9PY0YI53t+DztQwJ6shI/FQdEY6yAdBCMXmRUULJfBMYDQya34yULX7ntWSQarkvDX7BRSDwROpzdSwc/XPtlQWEe2wSjXEJN6NsOD0n7CA2EZL3zm2xBzaG9TEh+6eW1bp6zzLQ+LGchdjFRnbPna5loNJiHvvvtQLnzN2hDIVQ1buK7uQPQG2aDQyF952hZ3WPzXwXFw2Dmq7/MCjVxqGDlPutpebpkzWkExNsCxuUCx4qD5NWA7UUG1YDfUdAxq21PpAdHisoDI2G2vANBTWqXj9dXXkWxZbAQEoFGzIm9fGU7LfxxIPrvI64pbAlxUJa8jWs0laKOxKjm8IL7/EGOpWU+D3ggZyNTKYiz45wV6l/MRRxzqIK82BO0pQgsstP3t X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2019 06:43:26.8027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4d36d65-dad0-472e-f57a-08d757844f02 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: VE1PR08MB4895 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=u0Vxxxn19sEdzZ575YT13vQ6Fo+s4PIqdft6DWrL65FMiFFGAG+SnGMPqcByiQIvuobVl63i9HDFfDpy/BVMdG/d8L5Oz9L2v/GnvHAR/YX0xV7yLfadxr/P3/CxKLmBM7yq1IfmF6JxUfhlXVVKPIR+WV/rRBwBjf5+RVCL8v8= 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=u0Vxxxn19sEdzZ575YT13vQ6Fo+s4PIqdft6DWrL65FMiFFGAG+SnGMPqcByiQIvuobVl63i9HDFfDpy/BVMdG/d8L5Oz9L2v/GnvHAR/YX0xV7yLfadxr/P3/CxKLmBM7yq1IfmF6JxUfhlXVVKPIR+WV/rRBwBjf5+RVCL8v8= 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\)" , 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. 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);