From patchwork Thu Nov 14 08:37:31 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: 11243231 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 37393930 for ; Thu, 14 Nov 2019 08:37:48 +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 1ED4B20718 for ; Thu, 14 Nov 2019 08:37:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ED4B20718 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 486A36E402; Thu, 14 Nov 2019 08:37:47 +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-eopbgr60084.outbound.protection.outlook.com [40.107.6.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id BEDDF6E402 for ; Thu, 14 Nov 2019 08:37:45 +0000 (UTC) Received: from VI1PR08CA0226.eurprd08.prod.outlook.com (2603:10a6:802:15::35) by VI1PR0801MB2062.eurprd08.prod.outlook.com (2603:10a6:800:83::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Thu, 14 Nov 2019 08:37:42 +0000 Received: from AM5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by VI1PR08CA0226.outlook.office365.com (2603:10a6:802:15::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Thu, 14 Nov 2019 08:37:42 +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 AM5EUR03FT042.mail.protection.outlook.com (10.152.17.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Thu, 14 Nov 2019 08:37:42 +0000 Received: ("Tessian outbound 851a1162fca7:v33"); Thu, 14 Nov 2019 08:37:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f5177b4959325318 X-CR-MTA-TID: 64aa7808 Received: from 8070f748806f.2 (cr-mta-lb-1.cr-mta-net [104.47.10.54]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 406F1985-65D6-4018-92A5-055851AC78B8.1; Thu, 14 Nov 2019 08:37:35 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03lp2054.outbound.protection.outlook.com [104.47.10.54]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8070f748806f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Nov 2019 08:37:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AczfD67exZWKdOPNUrUwO4/oB92Y6mFzuUf43DzAquaKROmZL7VAHeHSJFDWZ2g4MDpYfCmgeY9q1ZqrSx8A/4GKYLV57Wx6k+AtRNWwNA/ZfKExjCBO0o21lcKgV6NWHImfdSmKg2UXKtYga76EhGrOqGEC5qa9evqEDhiV/RpPtMfmhrxc9jbWsufPIgeSMo3sSHi3dMZX97ZlaQ9ErBdtDCNJZ0a8vmSMkrQcPv9B5PNSend5mqp411Ydonl63J2of5ZiTad7DzUu37phOMAG7tOCDb3RhxHinqPycHUNTKhkP2HQwz1FJB2iaZOj32oVDuYzmY9Yzbc/fOMiag== 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=zXaZQA7UF04Za11ENfBrPY7rcZqwyDjhxx+VWI/tpIc=; b=gLfy6m8ymXoGkQAo//NNZw5Tvu13kZfeOUkFo30eJAgV3bfkoVr/YTz0/bYEP2NPVwOHMSeOZvLpOVUYFCVYJ8/h4bGoOaSvhbCbPKLG6eJbz5yHLcZ3f1ZWT1p3tzKUr0wcxPqhUJyskW6pHTUO2tWlR1jkrQ+KYKYezl2o7ADSSFjSOcqtcZieVDJ4W37XwUcxLEV7IAm1891ceHzQQ+pUlS5d4pnLT7Nk07wI2zZSL67Y1NEy107Nhgv/b3UYluByp3vCk7DyuQwuY11eBz2F0zGXfNF9os1SdduBaQYlwN7x7DkXpntRBU7xQCidKXesXzJNwWaJq7xVgCYvWA== 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 VE1PR08MB4768.eurprd08.prod.outlook.com (10.255.114.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.27; Thu, 14 Nov 2019 08:37:31 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::a809:417a:faf3:61a7%6]) with mapi id 15.20.2451.023; Thu, 14 Nov 2019 08:37:31 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" , Mihail Atanassov Subject: [PATCH v3 2/6] drm/komeda: Add side by side plane_state split Thread-Topic: [PATCH v3 2/6] drm/komeda: Add side by side plane_state split Thread-Index: AQHVmsbB0qq5bjF9AkuUGZwZ2Z2ZNw== Date: Thu, 14 Nov 2019 08:37:31 +0000 Message-ID: <20191114083658.27237-3-james.qian.wang@arm.com> References: <20191114083658.27237-1-james.qian.wang@arm.com> In-Reply-To: <20191114083658.27237-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: HK0PR01CA0038.apcprd01.prod.exchangelabs.com (2603:1096:203:3e::26) 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: e9db9e7c-c0b4-44d8-f52a-08d768ddea1f X-MS-TrafficTypeDiagnostic: VE1PR08MB4768:|VE1PR08MB4768:|VI1PR0801MB2062: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:4502;OLM:4502; x-forefront-prvs: 02213C82F8 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(979002)(4636009)(366004)(376002)(346002)(396003)(136003)(39850400004)(189003)(199004)(71200400001)(71190400001)(36756003)(305945005)(2906002)(7736002)(110136005)(54906003)(6116002)(316002)(3846002)(99286004)(103116003)(446003)(11346002)(30864003)(6486002)(8936002)(2616005)(476003)(6436002)(66476007)(66556008)(64756008)(66446008)(66946007)(478600001)(6512007)(50226002)(66066001)(486006)(14454004)(2501003)(5660300002)(76176011)(52116002)(256004)(386003)(55236004)(25786009)(6636002)(102836004)(6506007)(8676002)(4326008)(26005)(81156014)(81166006)(1076003)(186003)(2201001)(86362001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4768; 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: Z2UwdOGojHSTDCvTrwp1qcy7dVgiuMy2E5Xn4ei4byl7h5pqh3P96T1/FbWhc5QSbauUyamwJJrUdyTxWyyy0QmnCnweQZlRLl0KBv051s9dpel15frWxe3hiFuDuELNsOvcqGi95xvaNfAeCk9hk7l/kh24jbJpgZO2wPEN/M53WvTyzEr2FppakikI4CwgML1Xjuh1gdUq5EVbBmclqQ2C1k25q/jRVMIo+ofE+xTCnYgCrhfDZSseSExCrJco/w0QtxKyFDPxSixsABp3YkZ8XcUy0iAcUIFBkvkL0Q+MkKsVbgqk0sZ0FqSF+bfUSy5WUfBe/TEgI4+il7mxeY85ok7guN8DPmlEJ2XDZBqLLNNWRq4ZXnzeQdHblvZkivfCswSMf5iEiAx3B2l5lLvQP2wg8TzSl9QhJeCae/YPggjmd/l5nlo3PaBm3h8e MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4768 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT042.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)(979002)(4636009)(136003)(39850400004)(346002)(376002)(396003)(1110001)(339900001)(189003)(199004)(14454004)(26826003)(478600001)(105606002)(50466002)(2906002)(186003)(3846002)(2616005)(6116002)(446003)(486006)(11346002)(76176011)(26005)(126002)(476003)(336012)(386003)(6506007)(102836004)(2501003)(66066001)(4326008)(86362001)(2201001)(47776003)(356004)(30864003)(6486002)(1076003)(76130400001)(25786009)(70586007)(70206006)(5660300002)(6512007)(36756003)(22756006)(110136005)(8936002)(54906003)(8746002)(50226002)(99286004)(316002)(81166006)(7736002)(305945005)(36906005)(81156014)(23756003)(103116003)(6636002)(8676002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB2062; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Fail; 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: 914ebf95-08d9-4411-4c53-08d768dde3b7 NoDisclaimer: True X-Forefront-PRVS: 02213C82F8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wJLcMc2lw1n1gKIvGQZMfm+gvXb0baNUxUI9YW7G6WXHClc2jhh3puYVWXlbBtTH0J/b0yQHA1llyFj7oCEiwEa+Lb+RCBC2hOQzx09T8ROy5+2nQ3GmZkg7RQsAQPv3ERuoBxW5g00WUIIYgIkbrvPPgNNw+8M7plWeo6KFOQUZDbWUhJgfbSbo5ICR3lpYXOHMmEu4G6GcecA5fc20VBmKrTaPfu/aQJm0i4/Zrlg/sa7AYXThrw1RtpUa3OfMRUUa136FGA3RcWjYlpsSd5RqR3mSl6hRQrA6ybsYlNv0niYY8WdXrKJEyqOAxINJKINYY8EI/yVgYY3QWqbQSk0x+N04ufUBLD2bkZRQbElD0Rmu55bkgM6EOP1GlXzEyQEk8AGFBm27T9kwSBN+g5Fn2TbtzkctNtXSu1bnEGN4Ho0Wwi/j3/IKm09EtVaF X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2019 08:37:42.0377 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9db9e7c-c0b4-44d8-f52a-08d768ddea1f 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: VI1PR0801MB2062 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=zXaZQA7UF04Za11ENfBrPY7rcZqwyDjhxx+VWI/tpIc=; b=gYULTnweHQemebVjJv7hheJGrTqfS70mKuVwllTVv8e1Y8sJTkSdW02Va0GqhSHzZn6YUqjASQjuOpUUrndjpOWQz3K2Lk0V+v9fTOTToSR/Rk9yRPwM6mxJiq4H3TMw19o6tEDgVZgZZzNwtX6bNcVbfUzIypqkU/5gV8zAH60= 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=zXaZQA7UF04Za11ENfBrPY7rcZqwyDjhxx+VWI/tpIc=; b=gYULTnweHQemebVjJv7hheJGrTqfS70mKuVwllTVv8e1Y8sJTkSdW02Va0GqhSHzZn6YUqjASQjuOpUUrndjpOWQz3K2Lk0V+v9fTOTToSR/Rk9yRPwM6mxJiq4H3TMw19o6tEDgVZgZZzNwtX6bNcVbfUzIypqkU/5gV8zAH60= 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\)" , "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\)" , "james qian wang \(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" On side by side mode, The full display frame will be split into two parts (Left/Right), and each part will be handled by a single pipeline separately master pipeline for left part, slave for right. To simplify the usage and implementation, komeda use the following scheme to do the side by side split 1. The planes also have been grouped into two classes: master-planes and slave-planes. 2. The master plane can display its image on any location of the final/full display frame, komeda will help to split the plane configuration to two parts and fed them into master and slave pipelines. 3. The slave plane only can put its display rect on the right part of the final display frame, and its data is only can be fed into the slave pipeline. From the perspective of resource usage and assignment: The master plane can use the resources from the master pipeline and slave pipeline both, but slave plane only can use the slave pipeline resources. With such scheme, the usage of master planes are same as the none side_by_side mode. user can easily skip the slave planes and no need to consider side_by_side for them. Signed-off-by: James Qian Wang (Arm Technology China) --- .../drm/arm/display/komeda/komeda_pipeline.h | 33 ++- .../display/komeda/komeda_pipeline_state.c | 188 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_plane.c | 7 +- 3 files changed, 220 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 20a076cce635..4c0946fbaac1 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -521,6 +521,20 @@ komeda_component_pickup_output(struct komeda_component *c, u32 avail_comps) return komeda_pipeline_get_first_component(c->pipeline, avail_inputs); } +static inline const char * +komeda_data_flow_msg(struct komeda_data_flow_cfg *config) +{ + static char str[128]; + + snprintf(str, sizeof(str), + "rot: %x src[x/y:%d/%d, w/h:%d/%d] disp[x/y:%d/%d, w/h:%d/%d]", + config->rot, + config->in_x, config->in_y, config->in_w, config->in_h, + config->out_x, config->out_y, config->out_w, config->out_h); + + return str; +} + struct komeda_plane_state; struct komeda_crtc_state; struct komeda_crtc; @@ -532,22 +546,27 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer, struct komeda_plane_state *kplane_st, struct komeda_crtc_state *kcrtc_st, struct komeda_data_flow_cfg *dflow); -int komeda_build_wb_data_flow(struct komeda_layer *wb_layer, - struct drm_connector_state *conn_st, - struct komeda_crtc_state *kcrtc_st, - struct komeda_data_flow_cfg *dflow); -int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, - struct komeda_crtc_state *kcrtc_st); - int komeda_build_layer_split_data_flow(struct komeda_layer *left, struct komeda_plane_state *kplane_st, struct komeda_crtc_state *kcrtc_st, struct komeda_data_flow_cfg *dflow); +int komeda_build_layer_sbs_data_flow(struct komeda_layer *layer, + struct komeda_plane_state *kplane_st, + struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *dflow); + +int komeda_build_wb_data_flow(struct komeda_layer *wb_layer, + struct drm_connector_state *conn_st, + struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *dflow); int komeda_build_wb_split_data_flow(struct komeda_layer *wb_layer, struct drm_connector_state *conn_st, struct komeda_crtc_state *kcrtc_st, struct komeda_data_flow_cfg *dflow); +int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, + struct komeda_crtc_state *kcrtc_st); + int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, struct komeda_crtc_state *kcrtc_st); 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 0930234abb9d..5de0d231a1c3 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -1130,6 +1130,194 @@ int komeda_build_layer_split_data_flow(struct komeda_layer *left, return err; } +/* split func will split configuration of master plane to two layer data + * flows, which will be fed into master and slave pipeline then. + * NOTE: @m_dflow is first used as input argument to pass the configuration of + * master_plane. when the split is done, @*m_dflow @*s_dflow are the + * output data flow for pipeline. + */ +static int +komeda_split_sbs_master_data_flow(struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg **m_dflow, + struct komeda_data_flow_cfg **s_dflow) +{ + struct komeda_data_flow_cfg *master = *m_dflow; + struct komeda_data_flow_cfg *slave = *s_dflow; + u32 disp_end = master->out_x + master->out_w; + u16 boundary; + + pipeline_composition_size(kcrtc_st, &boundary, NULL); + + if (disp_end <= boundary) { + /* the master viewport only located in master side, no need + * slave anymore + */ + *s_dflow = NULL; + } else if ((master->out_x < boundary) && (disp_end > boundary)) { + /* the master viewport across two pipelines, split it */ + bool flip_h = has_flip_h(master->rot); + bool r90 = drm_rotation_90_or_270(master->rot); + u32 src_x = master->in_x; + u32 src_y = master->in_y; + u32 src_w = master->in_w; + u32 src_h = master->in_h; + + if (master->en_scaling || master->en_img_enhancement) { + DRM_DEBUG_ATOMIC("sbs doesn't support to split a scaling image.\n"); + return -EINVAL; + } + + memcpy(slave, master, sizeof(*master)); + + /* master for left part of display, slave for the right part */ + /* split the disp_rect */ + master->out_w = boundary - master->out_x; + slave->out_w = disp_end - boundary; + slave->out_x = 0; + + if (r90) { + master->in_h = master->out_w; + slave->in_h = slave->out_w; + + if (flip_h) + master->in_y = src_y + src_h - master->in_h; + else + slave->in_y = src_y + src_h - slave->in_h; + } else { + master->in_w = master->out_w; + slave->in_w = slave->out_w; + + /* on flip_h, the left display content from the right-source */ + if (flip_h) + master->in_x = src_w + src_x - master->in_w; + else + slave->in_x = src_w + src_x - slave->in_w; + } + } else if (master->out_x >= boundary) { + /* disp_rect only locate in right part, move the dflow to slave */ + master->out_x -= boundary; + *s_dflow = master; + *m_dflow = NULL; + } + + return 0; +} + +static int +komeda_split_sbs_slave_data_flow(struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *slave) +{ + u16 boundary; + + pipeline_composition_size(kcrtc_st, &boundary, NULL); + + if (slave->out_x < boundary) { + DRM_DEBUG_ATOMIC("SBS Slave plane is only allowed to configure the right part frame.\n"); + return -EINVAL; + } + + /* slave->disp_rect locate in the right part */ + slave->out_x -= boundary; + + return 0; +} + +/* On side by side mode, The full display frame will be split to two parts + * (Left/Right), and each part will be handled by a single pipeline separately, + * master pipeline for left part, slave for right. + * + * To simplify the usage and implementation, komeda use the following scheme + * to do the side by side split + * 1. The planes also have been grouped into two classes: + * master-planes and slave-planes. + * 2. The master plane can display its image on any location of the final/full + * display frame, komeda will help to split the plane configuration to two + * parts and fed them into master and slave pipelines. + * 3. The slave plane only can put its display rect on the right part of the + * final display frame, and its data is only can be fed into the slave + * pipeline. + * + * From the perspective of resource usage and assignment: + * The master plane can use the resources from the master pipeline and slave + * pipeline both, but slave plane only can use the slave pipeline resources. + * + * With such scheme, the usage of master planes are same as the none + * side_by_side mode. user can easily skip the slave planes and no need to + * consider side_by_side for them. + * + * NOTE: side_by_side split is occurred on pipeline level which split the plane + * data flow into pipelines, but the layer split is a pipeline + * internal split which splits the data flow into pipeline layers. + * So komeda still supports to apply a further layer split to the sbs + * split data flow. + */ +int komeda_build_layer_sbs_data_flow(struct komeda_layer *layer, + struct komeda_plane_state *kplane_st, + struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *dflow) +{ + struct komeda_crtc *kcrtc = to_kcrtc(kcrtc_st->base.crtc); + struct drm_plane *plane = kplane_st->base.plane; + struct komeda_data_flow_cfg temp, *master_dflow, *slave_dflow; + struct komeda_layer *master, *slave; + bool master_plane = layer->base.pipeline == kcrtc->master; + int err; + + DRM_DEBUG_ATOMIC("SBS prepare %s-[PLANE:%d:%s]: %s.\n", + master_plane ? "Master" : "Slave", + plane->base.id, plane->name, + komeda_data_flow_msg(dflow)); + + if (master_plane) { + master = layer; + slave = layer->sbs_slave; + master_dflow = dflow; + slave_dflow = &temp; + err = komeda_split_sbs_master_data_flow(kcrtc_st, + &master_dflow, &slave_dflow); + } else { + master = NULL; + slave = layer; + master_dflow = NULL; + slave_dflow = dflow; + err = komeda_split_sbs_slave_data_flow(kcrtc_st, slave_dflow); + } + + if (err) + return err; + + if (master_dflow) { + DRM_DEBUG_ATOMIC("SBS Master-%s assigned: %s\n", + master->base.name, komeda_data_flow_msg(master_dflow)); + + if (master_dflow->en_split) + err = komeda_build_layer_split_data_flow(master, + kplane_st, kcrtc_st, master_dflow); + else + err = komeda_build_layer_data_flow(master, + kplane_st, kcrtc_st, master_dflow); + + if (err) + return err; + } + + if (slave_dflow) { + DRM_DEBUG_ATOMIC("SBS Slave-%s assigned: %s\n", + slave->base.name, komeda_data_flow_msg(slave_dflow)); + + if (slave_dflow->en_split) + err = komeda_build_layer_split_data_flow(slave, + kplane_st, kcrtc_st, slave_dflow); + else + err = komeda_build_layer_data_flow(slave, + kplane_st, kcrtc_st, slave_dflow); + if (err) + return err; + } + + return 0; +} + /* writeback data path: compiz -> scaler -> wb_layer -> memory */ int komeda_build_wb_data_flow(struct komeda_layer *wb_layer, struct drm_connector_state *conn_st, diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index 98e915e325dd..2644f0727570 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -77,6 +77,7 @@ komeda_plane_atomic_check(struct drm_plane *plane, struct komeda_plane_state *kplane_st = to_kplane_st(state); struct komeda_layer *layer = kplane->layer; struct drm_crtc_state *crtc_st; + struct komeda_crtc *kcrtc; struct komeda_crtc_state *kcrtc_st; struct komeda_data_flow_cfg dflow; int err; @@ -94,13 +95,17 @@ komeda_plane_atomic_check(struct drm_plane *plane, if (!crtc_st->active) return 0; + kcrtc = to_kcrtc(crtc_st->crtc); kcrtc_st = to_kcrtc_st(crtc_st); err = komeda_plane_init_data_flow(state, kcrtc_st, &dflow); if (err) return err; - if (dflow.en_split) + if (kcrtc->side_by_side) + err = komeda_build_layer_sbs_data_flow(layer, + kplane_st, kcrtc_st, &dflow); + else if (dflow.en_split) err = komeda_build_layer_split_data_flow(layer, kplane_st, kcrtc_st, &dflow); else