From patchwork Mon Apr 15 07:09:20 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: 10900163 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 A63CD922 for ; Mon, 15 Apr 2019 07:09:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C66C28812 for ; Mon, 15 Apr 2019 07:09:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80B0E2881A; Mon, 15 Apr 2019 07:09:27 +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 81DE528812 for ; Mon, 15 Apr 2019 07:09:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A18289194; Mon, 15 Apr 2019 07:09:25 +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-eopbgr30060.outbound.protection.outlook.com [40.107.3.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id B40F689194 for ; Mon, 15 Apr 2019 07:09:23 +0000 (UTC) Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB5151.eurprd08.prod.outlook.com (20.179.30.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.14; Mon, 15 Apr 2019 07:09:20 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::6ca6:1d85:8903:90d7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::6ca6:1d85:8903:90d7%5]) with mapi id 15.20.1792.018; Mon, 15 Apr 2019 07:09:20 +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 v1 4/6] drm/komeda: Add writeback scaling support Thread-Topic: [PATCH v1 4/6] drm/komeda: Add writeback scaling support Thread-Index: AQHU81olJofAIrFwekmd0yTMDMc2wg== Date: Mon, 15 Apr 2019 07:09:20 +0000 Message-ID: <20190415070828.24075-5-james.qian.wang@arm.com> References: <20190415070828.24075-1-james.qian.wang@arm.com> In-Reply-To: <20190415070828.24075-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: HK0P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::23) 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: 3e57e2ce-723f-45f2-6c1e-08d6c17147de x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600140)(711020)(4605104)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VE1PR08MB5151; x-ms-traffictypediagnostic: VE1PR08MB5151: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 000800954F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39850400004)(376002)(136003)(346002)(366004)(199004)(189003)(446003)(11346002)(486006)(2616005)(14454004)(476003)(6486002)(52116002)(86362001)(4326008)(97736004)(102836004)(8936002)(5660300002)(6506007)(6512007)(386003)(53936002)(76176011)(103116003)(2201001)(1076003)(6436002)(55236004)(26005)(186003)(478600001)(7736002)(110136005)(2906002)(14444005)(256004)(81156014)(105586002)(54906003)(81166006)(99286004)(316002)(3846002)(6116002)(106356001)(305945005)(8676002)(2501003)(66066001)(25786009)(71190400001)(71200400001)(50226002)(68736007)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB5151; 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: PXMBNyQd0KSgbSYP5pAJ+KOPujHfAE2/f2Iu4rV27gTjyIvWSYvb7RqdFHQUd7BRyIR6T54pr1O46Q0nYsOz/wnYtX4TJlVecd1RDsf67Y1Wy2oHrTVlQ2WGdbHCNW6k/YRShauIpB+arN/nDFFpOBOZ4SZT6c1Gf+sNjD3vHi0eDG2tOAdg0ecGMv9DgYtZmAmEGaM98ohCatJYlgd5SqFY3ivlFuCTvJpfxl+Y/BKBmYAMcVObi1FxqLMkTKmQOccCTV/RU6ew5GAZm6CDaOwpmq0fh7G1PHsrOPy0K70patyixOJfYmn9dU+fFcC8Z0afvH4/CATkKQHvYe3swZwUv7pYkM62menm4R1ajqfuenqQYuD0O9zJsLt89+vU+5RIUIyS5c7WwgUqmU846IufgGGFbub8o2ZnnXNnjKU= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e57e2ce-723f-45f2-6c1e-08d6c17147de X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2019 07:09:20.3399 (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-Transport-CrossTenantHeadersStamped: VE1PR08MB5151 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1RqbQwMGq3A5MRPgNd73J5r8QrV6/3IZCbO9mUUSRkw=; b=RWuxKXRUtSFr+VYMtPyxjuCVjDbjsBnwmxC9EXohexeOL09kXx8HIiAm/ajQQ3L8DVz0r94BL3gOhVr0JyhyYlY04857HiGpNeulkY/+V9JLwMd3QhgNgXMA4mejYFuyqFKE7zMp9zeGmrUJ+oMfIKaxy4HsVRWFhxLhCWO+usE= 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 , "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\)" , "james qian wang \(Arm Technology China\)" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" 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. 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 85d7ec341acc..bfad7d03f801 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 1dec321c727b..c6f19969fc10 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -388,6 +388,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; @@ -406,13 +407,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; @@ -612,6 +621,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->needs_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, @@ -639,16 +659,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 38c94e8f0ce2..5de462172151 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -15,7 +15,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)); @@ -36,12 +35,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->needs_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; }