From patchwork Tue Oct 8 09:17:52 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: 11179229 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 3BF551747 for ; Tue, 8 Oct 2019 09:18:18 +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 1EC0120673 for ; Tue, 8 Oct 2019 09:18:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EC0120673 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 170A26E0D3; Tue, 8 Oct 2019 09:18:16 +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-eopbgr60067.outbound.protection.outlook.com [40.107.6.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 755826E0D3 for ; Tue, 8 Oct 2019 09:18:14 +0000 (UTC) Received: from VI1PR08CA0153.eurprd08.prod.outlook.com (2603:10a6:800:d5::31) by VI1PR08MB5357.eurprd08.prod.outlook.com (2603:10a6:803:12e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Tue, 8 Oct 2019 09:18:10 +0000 Received: from AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by VI1PR08CA0153.outlook.office365.com (2603:10a6:800:d5::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2327.24 via Frontend Transport; Tue, 8 Oct 2019 09:18:10 +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 AM5EUR03FT023.mail.protection.outlook.com (10.152.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Tue, 8 Oct 2019 09:18:08 +0000 Received: ("Tessian outbound e4042aced47b:v33"); Tue, 08 Oct 2019 09:18:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c4a88726849cbcbb X-CR-MTA-TID: 64aa7808 Received: from faf6d678d58a.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.12.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 47CF5C05-BED8-4367-8CD4-83D474D9F35A.1; Tue, 08 Oct 2019 09:17:55 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04lp2051.outbound.protection.outlook.com [104.47.12.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id faf6d678d58a.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Tue, 08 Oct 2019 09:17:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FskyOVXmne9iHFQ1X79nCTlHTQYwBz6Fe7Q1fI7KSGdBdIQVSC1e94lY7tm4hh3DW/WGE/LVNqQT+ZA+WeTnYLBI5r7zeFn4Ng4+D3QD/O1BzPhzoyEGtiI4ADOEPZnO9TiBQ0KSX2UqKuZ8PbFkYJuj6k1jjUNEVAlXCi0mslMKavDV6Ze/Y+WvPgCarL6bcuIPmomYSZoqyiIpZqX1inuVnslKY/0l3JyciLtWdrzjoxs1IkY2mFnvnnTVUUIAUstfolzxFRwicyF1zO3SWeQvSGJHSVjIiuGBduIA/mOci8Db/cxb7TiqOIRD/DHUVBw9vGF0u5Ge7zot4gdnyg== 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=M/LPRXia6sgkEMw4kcIUVdxLcgOsgR63Gx1IE1Ts/as=; b=SiQ9NB5pnIiJaYNO3IeRF5AMpAhUqT6wmLB9vhA6mAemHApiUbZKL8HhRhea/GLCCZ3sHgsQbuQue03iWszyMbbHjdls54RVn4y1ONcQ/1XWfFn2msPkXC6PVssNGHXZ0tagVXVvMDJFnPOYOEybA4BDOjWbNXJ1DTjZ9NwPUFzxnM/eNgj/0ymtIgAmHUj5AVbjsSRPrxz2ujSLr+CAxhE0SGIuVtnZlQCuf88jsejARtdoZws+9N8XuSagm25bM6ExC7eheBxVXfpbwaad1x5cUMT0Lh6kYdLV9MwTlRPbMp2ZofYE26x0NG9H4xMRJeRyL9mIF/41JcxRrjifpw== 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 VI1PR08MB3294.eurprd08.prod.outlook.com (52.134.31.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Tue, 8 Oct 2019 09:17:53 +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.2327.026; Tue, 8 Oct 2019 09:17:52 +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: AQHVfblD7I+ubO1huUCp0qQz7Z0Q4Q== Date: Tue, 8 Oct 2019 09:17:52 +0000 Message-ID: <20191008091734.19509-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: HK0P153CA0009.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::21) 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: d268a4fd-37ac-4ac5-ef4d-08d74bd06f0a X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB3294:|VI1PR08MB3294:|VI1PR08MB5357: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:171;OLM:171; x-forefront-prvs: 01842C458A X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(39860400002)(346002)(366004)(136003)(189003)(199004)(71190400001)(50226002)(64756008)(66476007)(66556008)(256004)(14444005)(3846002)(66446008)(8936002)(6436002)(6116002)(25786009)(102836004)(52116002)(4326008)(6512007)(305945005)(14454004)(478600001)(386003)(110136005)(55236004)(8676002)(81166006)(81156014)(66946007)(99286004)(6506007)(54906003)(36756003)(316002)(7736002)(26005)(66066001)(86362001)(186003)(2906002)(6486002)(476003)(71200400001)(2201001)(1076003)(2616005)(2501003)(486006)(6636002)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3294; 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: A9hxokkjt2wI5fN9hvXVNO7RKBq0HFVdNNHiTwHGz71e9eZLj31Xq6OuyJepAYKE5kKF0yorPwO/2fcx7VP6U9xpsm+OKyFaRMJ0j+kaXibDy2DK8wtjMY9FtZcaCdHq76rpe5/+yNjGMPTDTXb4o1UxqkuDRgK8N+NVAY/VNwlHy8x394PN2kri3UQOPn+DMes3SrXmKKCClS9Tv1kKqmni0V4Cv0mltqE52SIrqtRRCMjOChNjDRW0e2VXTWrpgmFg6kNFqzsdVjEKyrtQ0Ke7BW+048XAnPrKxlacmo/tF+2QaN+2tfhVGxogfKTEy1YSWYrNhjD/cZeWBwk4K+m6nhXVaR9xEKHSDbINv/lRRiYHGqYdJnrgXxHs9zH0dKjTlfcuIqdQdCDsxvg/6tAFwvOd1QAeKEIe8SI7WoQ= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3294 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT023.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)(39860400002)(346002)(376002)(199004)(189003)(47776003)(102836004)(1076003)(305945005)(2501003)(50466002)(86362001)(99286004)(2201001)(6636002)(66066001)(7736002)(5660300002)(356004)(126002)(486006)(81156014)(25786009)(8746002)(8936002)(50226002)(81166006)(478600001)(26826003)(8676002)(22756006)(26005)(6506007)(386003)(476003)(2616005)(14444005)(3846002)(63350400001)(336012)(186003)(6116002)(6486002)(6512007)(14454004)(316002)(36756003)(76130400001)(23756003)(2906002)(4326008)(36906005)(54906003)(70586007)(70206006)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB5357; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; 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: 86a1dbbc-cf2a-4003-cfb4-08d74bd06560 NoDisclaimer: True X-Forefront-PRVS: 01842C458A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UAOTGr8C8l6C+Cqc+ISXZVXNfK6pDixMXtDgbggRoJfFVb1S27JGAKaYpB1YMfzDfIOVwPmHV+wrmB1owA20IakMQBmRFukxVSItFkFHtB/byuUYPw9FcKQMd9A0CvakBqsSP1QlwdUi/iWY6LvvXoISkqrCH8RtfyngdFNtaSjkYK8mZmT6Zyvf+nTJHmMQnE/p9BiU46/2oK5mDpbcPlg8Q70L+oRNhxZAC0tJhYvXOOjnjWBW71Xuvav9/CFkLH95kBxD3S7shzmTRvyvQYA+30tOxC5sfih9gWX8DUfM+HkVu4OpuGXJCfjsuJZo/fZHZQ6XX4hGoqv5QO66t7av/4Yf+1tIdb5chvtl6EW+y6I5nppohC4538eQxVW8zgr+N5M7xZAYEW1xY8YfSbq45WMUVuIKCD2raWrDLG0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2019 09:18:08.3101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d268a4fd-37ac-4ac5-ef4d-08d74bd06f0a 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: VI1PR08MB5357 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=M/LPRXia6sgkEMw4kcIUVdxLcgOsgR63Gx1IE1Ts/as=; b=sF4cXpAipWlHj2Tj8zMNA3GzOHDCG/hsUUEIfeHZRTQL3MhGS7PO7p9JQqowDTQDZOoTOL+sZ2ow25AqHHAimwaawkSFpwGEQbjL0bYCsrgY91MXulNMq3I4ENmpR1gsNOvUl8jm4Rchinj7mNsxBUtlSMgLOSScxYviy3F8gwE= 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=M/LPRXia6sgkEMw4kcIUVdxLcgOsgR63Gx1IE1Ts/as=; b=sF4cXpAipWlHj2Tj8zMNA3GzOHDCG/hsUUEIfeHZRTQL3MhGS7PO7p9JQqowDTQDZOoTOL+sZ2ow25AqHHAimwaawkSFpwGEQbjL0bYCsrgY91MXulNMq3I4ENmpR1gsNOvUl8jm4Rchinj7mNsxBUtlSMgLOSScxYviy3F8gwE= 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. 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..baa986b70876 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(conn_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;