From patchwork Sat Oct 12 06:26:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11186681 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 E7F7F912 for ; Sat, 12 Oct 2019 06:26:45 +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 CE51E20673 for ; Sat, 12 Oct 2019 06:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE51E20673 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 BEA216E452; Sat, 12 Oct 2019 06:26:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60051.outbound.protection.outlook.com [40.107.6.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3524C6E452 for ; Sat, 12 Oct 2019 06:26:41 +0000 (UTC) Received: from VE1PR08CA0035.eurprd08.prod.outlook.com (2603:10a6:803:104::48) by VI1PR0801MB1693.eurprd08.prod.outlook.com (2603:10a6:800:4e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Sat, 12 Oct 2019 06:26:34 +0000 Received: from DB5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by VE1PR08CA0035.outlook.office365.com (2603:10a6:803:104::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.18 via Frontend Transport; Sat, 12 Oct 2019 06:26:34 +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 DB5EUR03FT011.mail.protection.outlook.com (10.152.20.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Sat, 12 Oct 2019 06:26:33 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Sat, 12 Oct 2019 06:26:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a185b82287f8635d X-CR-MTA-TID: 64aa7808 Received: from 5c701183a6d3.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.14.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6F80B5D7-E877-42E1-BD8E-1130365308D1.1; Sat, 12 Oct 2019 06:26:23 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2050.outbound.protection.outlook.com [104.47.14.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5c701183a6d3.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 12 Oct 2019 06:26:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CU34M8uZ2iHw/SaOi1KjLR/98cM8uXShe0NsQ7eet9xgahivvelYIHbrmS72/ll7ER2x69kpWRXJGYbPB0JdEuGUTXvEm9KdFhyY0ObJzlcyh+GVtpOyEEkbkyiM1nN3thsx7W0XrEtv/HDtnbkEakeB6yOkZKprY8m8KDh2O3oR7bOIMuaBltsyl1q9Q8cB3JMbCoHq3V9LzTbqwncDvzrBXn0MZnSsApwPGsxLSQYFJ3YM+f+AYT43j8JC3OQh6dskfZWVmL/BwCf4gfllKDb0EzhUvdzTv5bvA7cFKxyh2C1lZiGvquVdTIOT82tcTTOnapBuiwZ5QQTlQv/LNw== 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=qD/tzP/t5qqkBpL7C5G83qv6cL0cAmnLqDZ9yZP/cPc=; b=BGooKosJCu83a9+WJa89FKdl7AmoAlczadWFaY+XPLDUdqC33yZd/d8dnwuiF/+VQ9aO/mnktMpFutd2zOeNct4S1YrsLwQjhtrLRupn8rk6fGAuarCtyqGFW/SMOQyEsimpUr2SZks128ksSupN9vYVTEtYDMBECOw/GB7Tvq7pfuUb6uW0/phWG8tJVo4fBG7wTiZtEAn+AihBhRjdv72N4Pjce0x41ndmz7/L+7fBiTVzQBG2N4MWCywi6mMlGwAJAOJaRNihIUKzjK3t2jKy3JcHZUM3d4xK1Wa82sW6afjLhw9EeP72DPXro+Qrzt3UmEoNzJQ042CwIFFO6w== 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 VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB4191.eurprd08.prod.outlook.com (20.178.204.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Sat, 12 Oct 2019 06:26:20 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::e52a:a540:75ae:ced9]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::e52a:a540:75ae:ced9%4]) with mapi id 15.20.2347.016; Sat, 12 Oct 2019 06:26:20 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey , Mihail Atanassov Subject: [PATCH] drm/komeda: Set output color depth for output Thread-Topic: [PATCH] drm/komeda: Set output color depth for output Thread-Index: AQHVgMX1QcaKushXkkSa5yEyPB0t2w== Date: Sat, 12 Oct 2019 06:26:20 +0000 Message-ID: <20191012062603.25258-1-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK2PR02CA0162.apcprd02.prod.outlook.com (2603:1096:201:1f::22) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 9d9235a1-b57f-4bf9-a795-08d74edd2055 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB4191:|VI1PR08MB4191:|VI1PR0801MB1693: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:418;OLM:418; x-forefront-prvs: 0188D66E61 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(396003)(376002)(346002)(39860400002)(199004)(189003)(3846002)(6116002)(7736002)(26005)(81156014)(102836004)(2201001)(305945005)(186003)(2906002)(6436002)(316002)(81166006)(256004)(50226002)(14454004)(71190400001)(486006)(14444005)(71200400001)(86362001)(8936002)(476003)(6486002)(54906003)(110136005)(6512007)(1076003)(99286004)(25786009)(2616005)(66446008)(52116002)(66946007)(5660300002)(64756008)(66556008)(6636002)(36756003)(66476007)(6506007)(386003)(4326008)(66066001)(2501003)(55236004)(8676002)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4191; H:VI1PR08MB5488.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: lMLoGUsL+CdIFMoAWPcwV+pwWW4Kd1Jtb9XGKY3QOqmq9zL68K4vRhYdxFYN/DFsOF+OoZWdfouAtFlJVM137Km4KUUGs5qs8XLQmBZh7XBFe2kMYLkw+JGLPwJNVofa5mXi1BZCSf/IzkzQIUGhP4mcKyYAYgAYhUSlW3p+sqKR9kHuEmafKs+BnSZ+3K6tKoEbkqULhnSMsHnsHGV/9zRtG/4h0seE6qy9KBFQBbVJEJINx01T9FuluZuf+RFUtpboCcgS69stM0MeOZ0AaMJYeEZTGqSbt9q4koTbSCdnxiiSEd7T4qSpMLWdHL2wTiDyRVLWc8YCYYsx6D7hqi8O3dzRmmyE8/qrZ2gnWDHw7FW63tEfiRGWVQbdfInVgECHODvt/3tB13mjDHsxlnZpp+qli29udXyaASNSbHY= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4191 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT011.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)(346002)(376002)(396003)(39860400002)(136003)(189003)(199004)(14444005)(3846002)(22756006)(6116002)(4326008)(6486002)(8676002)(356004)(50226002)(6512007)(8746002)(81156014)(1076003)(81166006)(8936002)(76130400001)(66066001)(2201001)(476003)(126002)(486006)(86362001)(2616005)(70206006)(70586007)(63350400001)(50466002)(336012)(25786009)(47776003)(26826003)(478600001)(23756003)(14454004)(316002)(99286004)(6636002)(5660300002)(54906003)(110136005)(386003)(2501003)(102836004)(6506007)(36756003)(26005)(305945005)(186003)(7736002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB1693; 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: de6ab840-5988-424c-2a46-08d74edd1850 NoDisclaimer: True X-Forefront-PRVS: 0188D66E61 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5qGjIcx9Hsfc4O90jCK94OMo369NPPQguGzAb1+HinrODND8mbMhSI7A/S9j/cBROy/R5U/Ym75a4FS90HU5oMHQVxZUjdlKHLU0ZwBTgjbvwm89UFwnIu4WCM4WQnHp4BxzvAgPxjRBDEEefoMv3XDADbO3KhuFvCG4ImM0V+kKaoXQsIjNfHG352sa5jggInQXS8pUKGds78N3I8dbwGAyIrSgnXGQhpV63dnQ2CiXacUXXd1FCPJN1EUIKCFF1FiAfZa/vje9bman2YBhDgiDshRNytjg26UP4c4PZ1cyDxeVcukZGRukNluADalzkHf2PPAYM0LtuJqYC84Pg52Ohi7zoaJTZGPoj7dUO1aRBERninzGbmOILsdC4y0WVb+rD+XQc+yEHiciuPlcO5WRzdU4ftrBQc/WxuQ8FSg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2019 06:26:33.2927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d9235a1-b57f-4bf9-a795-08d74edd2055 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: VI1PR0801MB1693 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=qD/tzP/t5qqkBpL7C5G83qv6cL0cAmnLqDZ9yZP/cPc=; b=pU5lSgeK/wwtu2VDTdLf0oRgdJFL5VhhamKQA3rZkkcYwppsv20w5a6LImH3aADjb3Y+kb+8Pp8b2OmtbQzWC2j5PnBrkrO+AFyiyTxbQXKrK0L2uZ909RrPNeYxzOKfNZsEhpHzDVp40JqSwbtSqzjvUaOXhQHj8SzRrxcjSWE= 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=qD/tzP/t5qqkBpL7C5G83qv6cL0cAmnLqDZ9yZP/cPc=; b=pU5lSgeK/wwtu2VDTdLf0oRgdJFL5VhhamKQA3rZkkcYwppsv20w5a6LImH3aADjb3Y+kb+8Pp8b2OmtbQzWC2j5PnBrkrO+AFyiyTxbQXKrK0L2uZ909RrPNeYxzOKfNZsEhpHzDVp40JqSwbtSqzjvUaOXhQHj8SzRrxcjSWE= 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: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Set color_depth according to connector->bpc. Changes since v1: - Fixed min_bpc is effectively set but not used in komeda_crtc_get_color_config(). Signed-off-by: Lowry Li (Arm Technology China) --- .../arm/display/komeda/d71/d71_component.c | 1 + .../gpu/drm/arm/display/komeda/komeda_crtc.c | 20 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_kms.h | 2 ++ .../drm/arm/display/komeda/komeda_pipeline.h | 1 + .../display/komeda/komeda_pipeline_state.c | 19 ++++++++++++++++++ .../arm/display/komeda/komeda_wb_connector.c | 4 ++++ 6 files changed, 47 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..27cdb03573c1 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c @@ -951,6 +951,7 @@ static void d71_improc_update(struct komeda_component *c, to_d71_input_id(state, index)); malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize)); + malidp_write32(reg, IPS_DEPTH, st->color_depth); } 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 75263d8cd0bd..fe295c4fca71 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -17,6 +17,26 @@ #include "komeda_dev.h" #include "komeda_kms.h" +void komeda_crtc_get_color_config(struct drm_crtc_state *crtc_st, + u32 *color_depths) +{ + struct drm_connector *conn; + struct drm_connector_state *conn_st; + int i, min_bpc = 31, conn_bpc = 0; + + for_each_new_connector_in_state(crtc_st->state, conn, conn_st, i) { + if (conn_st->crtc != crtc_st->crtc) + continue; + + conn_bpc = conn->display_info.bpc ? conn->display_info.bpc : 8; + + if (conn_bpc < min_bpc) + min_bpc = conn_bpc; + } + + *color_depths = GENMASK(min_bpc, 0); +} + static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st) { u64 pxlclk, aclk; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index 45c498e15e7a..a42503451b5d 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -166,6 +166,8 @@ static inline bool has_flip_h(u32 rot) return !!(rotation & DRM_MODE_REFLECT_X); } +void komeda_crtc_get_color_config(struct drm_crtc_state *crtc_st, + u32 *color_depths); unsigned long komeda_crtc_get_aclk(struct komeda_crtc_state *kcrtc_st); int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index b322f52ba8f2..7653f134a8eb 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -323,6 +323,7 @@ struct komeda_improc { struct komeda_improc_state { struct komeda_component_state base; + u8 color_depth; u16 hsize, vsize; }; 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..e68e8f85ab27 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -743,6 +743,7 @@ komeda_improc_validate(struct komeda_improc *improc, struct komeda_data_flow_cfg *dflow) { struct drm_crtc *crtc = kcrtc_st->base.crtc; + struct drm_crtc_state *crtc_st = &kcrtc_st->base; struct komeda_component_state *c_st; struct komeda_improc_state *st; @@ -756,6 +757,24 @@ komeda_improc_validate(struct komeda_improc *improc, st->hsize = dflow->in_w; st->vsize = dflow->in_h; + if (drm_atomic_crtc_needs_modeset(crtc_st)) { + u32 output_depths; + u32 avail_depths; + + komeda_crtc_get_color_config(crtc_st, + &output_depths); + + avail_depths = output_depths & improc->supported_color_depths; + if (avail_depths == 0) { + DRM_DEBUG_ATOMIC("No available color depths, conn depths: 0x%x & display: 0x%x\n", + output_depths, + improc->supported_color_depths); + return -EINVAL; + } + + st->color_depth = __fls(avail_depths); + } + komeda_component_add_input(&st->base, &dflow->input, 0); komeda_component_set_output(&dflow->input, &improc->base, 0); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c index 2851cac94d86..740a81250630 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c @@ -142,6 +142,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, struct komeda_dev *mdev = kms->base.dev_private; struct komeda_wb_connector *kwb_conn; struct drm_writeback_connector *wb_conn; + struct drm_display_info *info; u32 *formats, n_formats = 0; int err; @@ -171,6 +172,9 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs); + info = &kwb_conn->base.base.display_info; + info->bpc = __fls(kcrtc->master->improc->supported_color_depths); + kcrtc->wb_conn = kwb_conn; return 0;