From patchwork Thu Dec 5 08:35:46 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: 11274351 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 67C8A930 for ; Thu, 5 Dec 2019 08:36:03 +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 4E4B921823 for ; Thu, 5 Dec 2019 08:36:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E4B921823 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 9B4CD6F5E0; Thu, 5 Dec 2019 08:36:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80089.outbound.protection.outlook.com [40.107.8.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFFD66F5E0 for ; Thu, 5 Dec 2019 08:36:00 +0000 (UTC) Received: from AM6PR08CA0048.eurprd08.prod.outlook.com (2603:10a6:20b:c0::36) by VI1PR0802MB2239.eurprd08.prod.outlook.com (2603:10a6:800:a4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.12; Thu, 5 Dec 2019 08:35:58 +0000 Received: from AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by AM6PR08CA0048.outlook.office365.com (2603:10a6:20b:c0::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.13 via Frontend Transport; Thu, 5 Dec 2019 08:35:58 +0000 Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 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 AM5EUR03FT005.mail.protection.outlook.com (10.152.16.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.18 via Frontend Transport; Thu, 5 Dec 2019 08:35:57 +0000 Received: ("Tessian outbound 58ad627f3883:v37"); Thu, 05 Dec 2019 08:35:57 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c41360b18cef0d76 X-CR-MTA-TID: 64aa7808 Received: from bf5a46e4d812.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A5B37E9-B0A1-446B-96AF-988C67689BFD.1; Thu, 05 Dec 2019 08:35:52 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bf5a46e4d812.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 05 Dec 2019 08:35:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nhrLSmdnfEN75/OO2Ta1R4uciqBgyXqbGsrMUNRR/Igmdjg8Lt59uXZsO/zjIYOQqpxwZDO+4+UZzIrlWfD829q2MPLTeOfP7cBqmcteHEnBXHst0Zbnzx/H40ZM3x62dS8hYejOweCZDHxKAIhD1C0Y8WRgTvpWM1ZFtrrui/c1EbNjsuuSZtcTwuZ+FUn1yJh0Da+TTJSHrX7flWTIO9FaSgTHgiMSI4yPyV5OAAit9aLD9+wfUq49pgtGdSQeVy267+zMlI2mFZo0lI11Z3NMhegOlNmkJAyzw7/bbpFkl0/KcSwRK3HCmKg+vCbUg+ne8ItCszw0FlCODiRXBQ== 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=u/OhMdzAJRV+IRQdte4BkdgRPzZxlKwzEQRrhZRPdE0=; b=jYSjyDg+pq/y9YbK7gJ2cwdJ7OLeRVET+RhTb2UJucucNdBtx4K+4PH74dTB5SjFeST8lgCxbU83+pIclNRrNJKsEY3ft0ccQQE4EWbE0dpmy80aqASqbYf1h636YcKI5og4E2UJritxT8oH8xnYh2TSD+gzKASY2X56WZg797m82M+DOBQmIhlKoXUnXe7t46eK0RhunJSilYGPOySJVh+keIL5ykKfQ8s50BzF8ii4m3xtkfExk1E+jqGBEN+n5qHGAgovH64e4kBcqhVxTqZaitFfiNiajpySgfaKXfhU0ztVPR6VvPNol1XrIkwVfiX4GCVOzMSGvZxCVvdBSA== 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 AM0SPR01MB0026.eurprd08.prod.outlook.com (52.135.152.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.12; Thu, 5 Dec 2019 08:35:46 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::f984:b0c7:bce9:144e]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::f984:b0c7:bce9:144e%2]) with mapi id 15.20.2495.014; Thu, 5 Dec 2019 08:35:46 +0000 From: "james qian wang (Arm Technology China)" To: Mihail Atanassov Subject: [PATCH v5 2/5] drm/komeda: Add side by side plane_state split Thread-Topic: [PATCH v5 2/5] drm/komeda: Add side by side plane_state split Thread-Index: AQHVq0b9krcw3mF3h0STgmIBRWIhMA== Date: Thu, 5 Dec 2019 08:35:46 +0000 Message-ID: <20191205083436.11060-3-james.qian.wang@arm.com> References: <20191205083436.11060-1-james.qian.wang@arm.com> In-Reply-To: <20191205083436.11060-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: HK0PR03CA0105.apcprd03.prod.outlook.com (2603:1096:203:b0::21) 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: b3383e69-2857-47ed-b68e-08d7795e26ce X-MS-TrafficTypeDiagnostic: AM0SPR01MB0026:|AM0SPR01MB0026:|VI1PR0802MB2239: 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: 02426D11FE X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(346002)(376002)(39860400002)(136003)(396003)(366004)(199004)(189003)(8676002)(5660300002)(71200400001)(71190400001)(7736002)(86362001)(305945005)(2906002)(316002)(36756003)(103116003)(50226002)(1076003)(81156014)(81166006)(30864003)(6862004)(8936002)(55236004)(6636002)(4326008)(99286004)(186003)(478600001)(11346002)(2616005)(102836004)(26005)(25786009)(76176011)(52116002)(14454004)(6506007)(66446008)(6116002)(54906003)(66946007)(66476007)(66556008)(64756008)(3846002)(37006003)(6436002)(6486002)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0SPR01MB0026; H:VE1PR08MB5006.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: scfnTR/llEvGg/E97bCKYR6sSzXTuVhvOkZrIRIFgLWLA/QAtO4ZbZbof1riVYqQWZ6plFilSpOK3qvL90PZtRO/vEqhSvqxaP6KFJ2JDrSGqCKVpG8c4TeDU1uJrMndHoQey1WVhUPu+UbwPFnS2s+yX4wfm+xg7GSJ/LLp2Jqjd2S1WDJHbhjVvKTDgL518ZAJ9QslxI5IoNbnw1/UBAINGpXkAPGjOM+IO/FZI4h/sYABxfmF4/cHuixD11dz6LJgeSPzvCYaO6MGH5Lc9cdrzfpgVfLjsvmR2FbuuGtECmOjA02NihZBQgz4/Ya6qSv5af6lZLv1UZvLH2Lzk/oxxNj7Xj5fwJWSg8o7EgqlCV6Cd0v2iXo+LXKBIzpUYcJG3Ts0GPGNJA+UEes+fCmhzypVMnZfn9OCvMbuJsiQqS4ivizXkngRm1O0ljPi MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0SPR01MB0026 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT005.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)(376002)(346002)(136003)(396003)(39860400002)(189003)(199004)(186003)(26005)(478600001)(2616005)(102836004)(50466002)(99286004)(23756003)(6506007)(316002)(25786009)(54906003)(37006003)(76176011)(26826003)(36906005)(6862004)(76130400001)(3846002)(6116002)(70586007)(30864003)(14454004)(70206006)(5660300002)(2906002)(86362001)(336012)(1076003)(356004)(6636002)(81166006)(81156014)(11346002)(305945005)(8746002)(8936002)(103116003)(50226002)(22756006)(8676002)(4326008)(7736002)(36756003)(6512007)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2239; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:Pass; 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: 2e541917-d1df-449b-1ea4-08d7795e1fbc NoDisclaimer: True X-Forefront-PRVS: 02426D11FE X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4kJPJa/jlSvReehbm8ta0HdHlGj9Iv1SRMVS62IJl071J1Q4x26Jr2ue64PQ601R6OW/3r5X7eHIpYH7qaVfqA6HTNQaWlqwxiaqPgkebb+LJUvabsu/t7c7kH6wL/8vAp2q5UOi+uz+KH6G7KKXFz0nCaGPkIALiJLH0jOlC3Y+r2kL7tlPnteh5E1F6rLoDp4ZmOOjBFI+lX2kUR1eTNlHOGK/PcXvtd3okQwhj4mUBbS4s9z/3GBaBFKXIxwhZtVqGJDGxaHnrwDyMhLkqaebMbtb8qdgObzO6HZx4x3HW5fps7nDVLtesvZplcRNDR9brTeidp+JIVyDiv5CdNsBuTG71J9lOCsanstTqjo595RimX/rRGuiP1qJAmtzcBILK4qjQ5FHKH/hW7MVe2vebx+7SGD9c0mlSTDOsQg1CL5pCjiEv5TW76hpEj2W X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2019 08:35:57.9831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3383e69-2857-47ed-b68e-08d7795e26ce 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: VI1PR0802MB2239 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=u/OhMdzAJRV+IRQdte4BkdgRPzZxlKwzEQRrhZRPdE0=; b=9RHxkjtVm0+QHXVWCB3Y4fYEhuhU0qkmwVzaV/snOjrMhQvhVV5FwZBCsOwd8uFHWGyrKkXc/OeLRnQZiWvRRoZcNN0zCMDCQ42zKBBCgOMmyhlTP3p8VGSTuNwlxZhDvtNsyQd5KSjv30Iq6KZJk3wqGqfkSx/7OprvODOyqj0= 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=u/OhMdzAJRV+IRQdte4BkdgRPzZxlKwzEQRrhZRPdE0=; b=9RHxkjtVm0+QHXVWCB3Y4fYEhuhU0qkmwVzaV/snOjrMhQvhVV5FwZBCsOwd8uFHWGyrKkXc/OeLRnQZiWvRRoZcNN0zCMDCQ42zKBBCgOMmyhlTP3p8VGSTuNwlxZhDvtNsyQd5KSjv30Iq6KZJk3wqGqfkSx/7OprvODOyqj0= X-Mailman-Original-Authentication-Results: spf=pass (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=bestguesspass 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 , "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\)" , "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. v4: Address Mihail's review comments. 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..10a0dc9291b8 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_x + src_w - master->in_w; + else + slave->in_x = src_x + src_w - 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