From patchwork Thu May 23 11:10:15 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: 10957435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C8AB112C for ; Thu, 23 May 2019 11:10:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11D1C28478 for ; Thu, 23 May 2019 11:10:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 057BA28479; Thu, 23 May 2019 11:10:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 828C928475 for ; Thu, 23 May 2019 11:10:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6A2989DC0; Thu, 23 May 2019 11:10:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::624]) by gabe.freedesktop.org (Postfix) with ESMTPS id 116B789DC0 for ; Thu, 23 May 2019 11:10:18 +0000 (UTC) Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB5166.eurprd08.prod.outlook.com (20.179.30.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.18; Thu, 23 May 2019 11:10:15 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358%7]) with mapi id 15.20.1922.017; Thu, 23 May 2019 11:10:15 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" Subject: [PATCH v2 4/6] drm/komeda: Add writeback scaling support Thread-Topic: [PATCH v2 4/6] drm/komeda: Add writeback scaling support Thread-Index: AQHVEVgZBMehxAL8ckO0VU373wdL4Q== Date: Thu, 23 May 2019 11:10:15 +0000 Message-ID: <20190523110933.10742-5-james.qian.wang@arm.com> References: <20190523110933.10742-1-james.qian.wang@arm.com> In-Reply-To: <20190523110933.10742-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: HK2PR02CA0191.apcprd02.prod.outlook.com (2603:1096:201:21::27) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8f45f281-5107-4f9b-f89a-08d6df6f3b64 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:VE1PR08MB5166; x-ms-traffictypediagnostic: VE1PR08MB5166: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 00462943DE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(376002)(346002)(136003)(39860400002)(199004)(189003)(6512007)(25786009)(50226002)(53936002)(476003)(256004)(14444005)(6436002)(103116003)(446003)(2616005)(11346002)(99286004)(486006)(4326008)(6486002)(81156014)(26005)(81166006)(36756003)(66066001)(54906003)(110136005)(8676002)(2906002)(316002)(8936002)(73956011)(66946007)(2501003)(305945005)(68736007)(7736002)(64756008)(186003)(66556008)(1076003)(76176011)(55236004)(66446008)(66476007)(86362001)(6506007)(386003)(71200400001)(71190400001)(478600001)(3846002)(52116002)(6116002)(2201001)(102836004)(14454004)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5166; 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-message-info: zMohkRaguvkZk5e/s8CwYmN6wVuZrOl/99WHTNMhcfrKomDblqeGOiOFNNkuM26oBCzQTtTn4ZNDH0pQgiIdlH9yC+o2vh2jfQwOc2BfgpQtRttyaCE4RHPMdkA2I67j8PaFDWJJUGyiU0hxS+rGoXclyIbIZ9X0eFW5nAW++HNL+Sgj64cAFAdZlTFEw3VXo0nM/cyEVgITNAnef614dWoOVT1TPL/cLc9yZDQKLYYnGct1sGZg8t3oDEUfOqZsgnIH1ROuSyK/UFURKxP6o1saH3XYWVUzCq2uNrIc9CoWbx7FmxsyHrmBqzfUj28BozbJiAwOAeJKlDi9+baKPhNqlrc2Z/Zv191YEfADu4p3M3KHaU8iT/d380n1HSu+4bn8WhiPkVMLwQMXl4p7YYSs7m7ZZPCJRbGzDUX22jU= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f45f281-5107-4f9b-f89a-08d6df6f3b64 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2019 11:10:15.3708 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: james.qian.wang@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5166 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=EhHT3DG2lBc5atcjhuMBmHYziZaLKThrWBieaD1vqiA=; b=mOlNtxmXMcmab6CERvE+dQekv7pRr2ObUCVzbhmR6Vnk9OhKKoblpLRxLtAvtT2UhARt2jGHF3AdUlMBaFpXXDVxQlM9m/vFJ0vzFgeTkuBEgipUaGLrW424Xb+/I2wdf3N5yfNaHRhyYAO9uhpouU9GegUEX5CWd62lSNFSQiY= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@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" X-Virus-Scanned: ClamAV using ClamSMTP 1. Add scaler to writeback pipeline to enable the writeback scaling support 2. Display HW can not do upscaling for writeback, check it when validate. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../drm/arm/display/komeda/komeda_pipeline.h | 2 ++ .../display/komeda/komeda_pipeline_state.c | 36 +++++++++++++++---- .../gpu/drm/arm/display/komeda/komeda_plane.c | 8 +---- .../arm/display/komeda/komeda_wb_connector.c | 2 ++ 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 400af217ed86..9ffe11c9f386 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -470,4 +470,6 @@ void komeda_pipeline_disable(struct komeda_pipeline *pipe, void komeda_pipeline_update(struct komeda_pipeline *pipe, struct drm_atomic_state *old_state); +void komeda_complete_data_flow_cfg(struct komeda_data_flow_cfg *dflow); + #endif /* _KOMEDA_PIPELINE_H_*/ 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 a5300ef92eb7..9f07ef65008f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -390,6 +390,7 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler, struct komeda_data_flow_cfg *dflow) { u32 hsize_in, vsize_in, hsize_out, vsize_out; + u32 max_upscaling; hsize_in = dflow->in_w; vsize_in = dflow->in_h; @@ -408,13 +409,21 @@ komeda_scaler_check_cfg(struct komeda_scaler *scaler, return -EINVAL; } - if (!scaling_ratio_valid(hsize_in, hsize_out, scaler->max_upscaling, + /* If input comes from compiz that means the scaling is for writeback + * and scaler can not do upscaling for writeback + */ + if (has_bit(dflow->input.component->id, KOMEDA_PIPELINE_COMPIZS)) + max_upscaling = 1; + else + max_upscaling = scaler->max_upscaling; + + if (!scaling_ratio_valid(hsize_in, hsize_out, max_upscaling, scaler->max_downscaling)) { DRM_DEBUG_ATOMIC("Invalid horizontal scaling ratio"); return -EINVAL; } - if (!scaling_ratio_valid(vsize_in, vsize_out, scaler->max_upscaling, + if (!scaling_ratio_valid(vsize_in, vsize_out, max_upscaling, scaler->max_downscaling)) { DRM_DEBUG_ATOMIC("Invalid vertical scaling ratio"); return -EINVAL; @@ -614,6 +623,17 @@ komeda_timing_ctrlr_validate(struct komeda_timing_ctrlr *ctrlr, return 0; } +void komeda_complete_data_flow_cfg(struct komeda_data_flow_cfg *dflow) +{ + u32 w = dflow->in_w; + u32 h = dflow->in_h; + + if (drm_rotation_90_or_270(dflow->rot)) + swap(w, h); + + dflow->en_scaling = (w != dflow->out_w) || (h != dflow->out_h); +} + int komeda_build_layer_data_flow(struct komeda_layer *layer, struct komeda_plane_state *kplane_st, struct komeda_crtc_state *kcrtc_st, @@ -641,16 +661,18 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer, return err; } +/* 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, struct komeda_crtc_state *kcrtc_st, struct komeda_data_flow_cfg *dflow) { - if ((dflow->in_w != dflow->out_w) || - (dflow->in_h != dflow->out_h)) { - DRM_DEBUG_ATOMIC("current do not support scaling writeback.\n"); - return -EINVAL; - } + struct drm_connector *conn = conn_st->connector; + int err; + + err = komeda_scaler_validate(conn, kcrtc_st, dflow); + if (err) + return err; return komeda_wb_layer_validate(wb_layer, conn_st, dflow); } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index cd3a7172a756..97d8adb6cd2b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -16,7 +16,6 @@ komeda_plane_init_data_flow(struct drm_plane_state *st, struct komeda_data_flow_cfg *dflow) { struct drm_framebuffer *fb = st->fb; - u32 w, h; memset(dflow, 0, sizeof(*dflow)); @@ -37,12 +36,7 @@ komeda_plane_init_data_flow(struct drm_plane_state *st, dflow->in_w = st->src_w >> 16; dflow->in_h = st->src_h >> 16; - w = dflow->in_w; - h = dflow->in_h; - if (drm_rotation_90_or_270(dflow->rot)) - swap(w, h); - - dflow->en_scaling = (w != dflow->out_w) || (h != dflow->out_h); + komeda_complete_data_flow_cfg(dflow); return 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 0c1a4220c280..eed521218ef3 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c @@ -31,6 +31,8 @@ komeda_wb_init_data_flow(struct komeda_layer *wb_layer, dflow->pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE; dflow->rot = DRM_MODE_ROTATE_0; + komeda_complete_data_flow_cfg(dflow); + return 0; }