From patchwork Sat Oct 12 06:50:46 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: 11186683 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 3FC7076 for ; Sat, 12 Oct 2019 06:51:11 +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 14C842067B for ; Sat, 12 Oct 2019 06:51:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14C842067B 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 CCE366E578; Sat, 12 Oct 2019 06:51:08 +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-eopbgr30053.outbound.protection.outlook.com [40.107.3.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D7B46E578 for ; Sat, 12 Oct 2019 06:51:06 +0000 (UTC) Received: from DB6PR0801CA0043.eurprd08.prod.outlook.com (2603:10a6:4:2b::11) by AM6PR08MB3672.eurprd08.prod.outlook.com (2603:10a6:20b:4d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Sat, 12 Oct 2019 06:51:03 +0000 Received: from AM5EUR03FT030.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::207) by DB6PR0801CA0043.outlook.office365.com (2603:10a6:4:2b::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; Sat, 12 Oct 2019 06:51:02 +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 AM5EUR03FT030.mail.protection.outlook.com (10.152.16.117) 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:51:01 +0000 Received: ("Tessian outbound 927f2cdd66cc:v33"); Sat, 12 Oct 2019 06:50:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4224247899f995fa X-CR-MTA-TID: 64aa7808 Received: from 5fb4bfd047cb.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.0.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 186475AA-0EB0-42F4-9655-2BCE654C7C06.1; Sat, 12 Oct 2019 06:50:50 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2051.outbound.protection.outlook.com [104.47.0.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5fb4bfd047cb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 12 Oct 2019 06:50:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LozcLbUuWYfEYHJDdT+nDXRjQZT8Hs6T4iQn2TH6PRIzp6TwJKLmSM/rc2Yf8rQkXnIXtc+4oEPD+Nu1UbxMCt6alXby1IcQ5ajmehA2IpsNtcqAX7WWkTjGYs28tYkckRI6Vj2jvp3N/cNM9OdvHOYApwZUY8iuhXOUVgf6GvSI5ZPi7jeb4yD3pB+xhD854QnI8reaagUDEaPZz+KWui8Mf6UV5PQH1wEkErQUbD+mDRXdqMDw/TCoPMq18YyRNJN1PCNKNq1NuvnmrLg5YwShhgMvTaAHd79aM7db0n24QV0Itlr047ykrHMGeZkq+GQmZMNjd8Oz8t99weLC4w== 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=YiXdlszNeq8zE5ZFA1BjtPvDxy+u6gSNxo5w3PDwaT8=; b=bTzxzDGp4H1MGsyV3NDHmD3h+ysxeMt9s1MswZIAR7kDm6WGbHAYEKDrW7vvzU0lpTMyV5GiJ3IjshoM31/u+23Yt8wdv57CWPF8uajAmPPjhqYFTgDUQ4JKpW5iecyYQvUlcJrs02OtPlhB5fHGtdKavdPKY8xXWzOfQTs2u/7JANBrlWmSUwfvgaOgCMpMZSyK/YKKuldjaSQ2N4Wl6iFPr6T3/7Gf/HTz+NKoVnMet/wiim3gvSAnrqlxFRxQJGghgVVpgrXms1A+HN5DbSUZz1o3GrsXsN6I3rw4fHZ83ZkwtBpDIef3V3QQS+VdMKd5ir90ESMmtWGX7C2fuA== 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 VI1PR08MB3613.eurprd08.prod.outlook.com (20.177.61.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.17; Sat, 12 Oct 2019 06:50:47 +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:50:47 +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: AQHVgMlgRjNZSavPFUK1VMeh9loRYA== Date: Sat, 12 Oct 2019 06:50:46 +0000 Message-ID: <20191012065030.12691-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: HK0PR03CA0038.apcprd03.prod.outlook.com (2603:1096:203:2f::26) 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: f2756903-c0b9-4c38-2852-08d74ee08b60 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB3613:|VI1PR08MB3613:|AM6PR08MB3672: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:469;OLM:469; x-forefront-prvs: 0188D66E61 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(39860400002)(136003)(396003)(366004)(189003)(199004)(26005)(14444005)(66066001)(1076003)(25786009)(14454004)(6512007)(256004)(36756003)(52116002)(186003)(6506007)(55236004)(476003)(486006)(386003)(2616005)(5660300002)(86362001)(4326008)(102836004)(2201001)(71190400001)(71200400001)(2501003)(7736002)(305945005)(54906003)(110136005)(6436002)(6486002)(50226002)(6636002)(66946007)(81156014)(81166006)(66556008)(66476007)(8676002)(66446008)(64756008)(8936002)(316002)(478600001)(2906002)(6116002)(3846002)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3613; H:VI1PR08MB5488.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: EoC8Jfd1QCRuvseohmqPvjzMKmWxJPw8QQ0pLSbZk0MCjmXC2CcbTTDoRXmNt4WTiNFcngSt74jcsUcuCX2bU/Xe2RfsEW8CkoD5RyQhWpBm5c7Ox253MOUR8ZbATuHANM5/Q9YIebGSYD4u8s+zQw3s75dtf1A05QdZyfQRcrMf8XkeCtCjNMa5drGjtf97HeHlnfBdkImAZK3lxExRt29zHAVB8QuKOxlICLs+xqRQExqTlkQFLIvH37LiWlcMJ0982aGX94WPXYXS91ohViioFvS3y8cALOup3hlKP/rJPaMQ1hI+nDsdtENuKKNZk4atQycHObZYrHqrFN/BdIGsd0JGwSECU7bYfwQSPQHWghSpsyq/dV5jEaN8v0bVUepHG4mGpjx7ldHsXhNilUFEoIe6A577S2AxiX0moHY= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3613 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT030.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)(346002)(376002)(136003)(396003)(189003)(199004)(2201001)(14444005)(2906002)(70586007)(5660300002)(22756006)(70206006)(3846002)(63350400001)(336012)(6116002)(23756003)(486006)(476003)(126002)(1076003)(2616005)(99286004)(26005)(6506007)(102836004)(386003)(186003)(50466002)(2501003)(86362001)(6486002)(47776003)(356004)(4326008)(76130400001)(6636002)(6512007)(7736002)(66066001)(305945005)(81156014)(8746002)(36756003)(26826003)(110136005)(54906003)(478600001)(14454004)(36906005)(25786009)(8936002)(81166006)(8676002)(316002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3672; 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: ddaaaea3-3ba9-4066-74f8-08d74ee08291 NoDisclaimer: True X-Forefront-PRVS: 0188D66E61 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hPcyx2gUoyCxYJGxduLEsCdceZqUb7kXRtInf4iyLjLb4TDyRVPff50csWQx9mOG0LIlkqtClmQCc1GgA/xnu0C3+rIbNxWZUkFbFzUEkXF/5303y8Et3kZvTS45zKrzzf2pBEfZL8+CPEHSj8EkJSRSCx0sLZxUmeb7AeNFPVcmFqCJnHBvVMFcy5At8wRKLKTaR3ejbLyzcwuaD86oZ5JJsVBJp7n2cxha7LejOFqm0AGFbhcvwXVoRSBigNfiG45CfmBknFXUovltpqOAEIK+nbQXtBZ6plKHytchWMeGuyjt0PXhP/RBCucNKowHG+8hYXjzoYChhsYnVQXp88s2i1DOgvZTUnrN6vu3UWGqr22Au4EU3Os7V5cPjJ3pkXLSI5p9HtaHm78Z/Bxyed31joeS+Y4KQuTv6Dbi5AQ= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2019 06:51:01.3609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2756903-c0b9-4c38-2852-08d74ee08b60 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: AM6PR08MB3672 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=YiXdlszNeq8zE5ZFA1BjtPvDxy+u6gSNxo5w3PDwaT8=; b=F29ohiygwgWSYkFtA7aE/iia2U9KI3MIXTfXAkYTLE2uWo2yQmi+9Ei32w6zsgmORxw1xIh/nKWoRmpvJQ8LwSA4I1rytRzDkrIHsvnRdcmsLzlnMQLaL4Wy++yTxJleB4Hr+5ppouKJXX6O0HeKP31vEkXtFuXCvg0anyeZ6Gk= 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=YiXdlszNeq8zE5ZFA1BjtPvDxy+u6gSNxo5w3PDwaT8=; b=F29ohiygwgWSYkFtA7aE/iia2U9KI3MIXTfXAkYTLE2uWo2yQmi+9Ei32w6zsgmORxw1xIh/nKWoRmpvJQ8LwSA4I1rytRzDkrIHsvnRdcmsLzlnMQLaL4Wy++yTxJleB4Hr+5ppouKJXX6O0HeKP31vEkXtFuXCvg0anyeZ6Gk= 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(). Changes since v2: - Align the code. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Mihail Atanassov Reviewed-by: James Qian Wang (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 | 18 +++++++++++++++++ .../arm/display/komeda/komeda_wb_connector.c | 4 ++++ 6 files changed, 46 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..e64bfeaa06c7 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,23 @@ 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;