From patchwork Tue Jan 22 11:10:30 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: 10775377 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 B017991E for ; Tue, 22 Jan 2019 11:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D78A2A1B7 for ; Tue, 22 Jan 2019 11:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9192E2A1E2; Tue, 22 Jan 2019 11:10:35 +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 2DF1A2A1B7 for ; Tue, 22 Jan 2019 11:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DDCE66EC8E; Tue, 22 Jan 2019 11:10:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20042.outbound.protection.outlook.com [40.107.2.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 82A5F6EC8E for ; Tue, 22 Jan 2019 11:10:32 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB2088.eurprd08.prod.outlook.com (10.168.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.28; Tue, 22 Jan 2019 11:10:30 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:10:30 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 01/11] drm/komeda: Add komeda_build_display_data_flow Thread-Topic: [PATCH v2 01/11] drm/komeda: Add komeda_build_display_data_flow Thread-Index: AQHUskMVYIlkrRHZF0SiTtKrhRQ0fA== Date: Tue, 22 Jan 2019 11:10:30 +0000 Message-ID: <20190122110932.5138-2-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB2088; 6:S7infNF6tk02fkCjQyLqJk5Ej+QBR/1zOFM+q02pgIZUPKe7F4U24bn8KK3QIlgB60mbY8zjbWmviDgcLcxWwGZ7xN9rV5yfN0J+gzLblXEcQI00dt/6V9PBHjRtedV+nhsMm9QgeS/ltcfmAn6DZZlBGo+RyV9inf6yXshShveK5yBDBSWqHO1hjl6EhN8aiB7xUCRjZdtGFY7hWp2izUJT9hd/liT0dmFSUUs6aGsW4CJMAZ1q3eaTtdx8RGxQoGe+Zr01DSUKGssBtZF+26MppQYRrusPD22qQRJUCp6zxkw1+MrZwi5433dS5m9pkc7m2YOtl0bRndU7rPEMVWOCdVSG9KPwbr3YXcMKq7JkR/hBr9/KFdHnWZUxy6yZ3CLUaCfkAL8cIKO+TV1cir1XifxwYBa7XUx613D74c9cP6LDFtXe0cNIHEPE/ASNpQvpHuF0ewseFswOT/IjrQ==; 5:54wEIkwAr1JZtkQjKxQxevYcV4X2XXJc0We9nFUhsCA6p07ECaNZnktsxMrPzOGiER4UCryvMgEqXyrVU4ztiS7OS5F+sipFeq1n5luwU7EG5qEqDi/6FotG8AsWmQ9jiGs4scAXfEngKliBSxG/QtnvJ0/RsQ+KtJQ+ITuEDEqMr39LeARFKw0ITz/1IGbw2bmvqorqpORh/gibWcwBnA==; 7:mgdO2BMgcisErujqs7RYnk1MZsVdUq0A9E4ozTDRRX3j2faifByaAgW4SYONLbC4h6dR6AOd7Yumf/02Q44uKhokfqLRBsI/6Qk3b+q8KQB5U0EiKX2o78W7SdgN8bXQ2y7VaERUTXxRM608oVPJwA== x-ms-office365-filtering-correlation-id: f23e699a-86af-4f16-3abd-08d6805a3805 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600109)(711020)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB2088; x-ms-traffictypediagnostic: DB6PR0801MB2088: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(136003)(346002)(39860400002)(376002)(189003)(199004)(7736002)(76176011)(2501003)(52116002)(256004)(478600001)(55236004)(14444005)(102836004)(6506007)(14454004)(4326008)(386003)(53936002)(186003)(8676002)(6636002)(103116003)(6512007)(26005)(6486002)(50226002)(6436002)(8936002)(6116002)(3846002)(81166006)(81156014)(316002)(106356001)(99286004)(71200400001)(97736004)(110136005)(54906003)(1076003)(2906002)(105586002)(25786009)(36756003)(71190400001)(11346002)(446003)(476003)(68736007)(2616005)(86362001)(486006)(66066001)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB2088; H:DB6PR0801MB1990.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-message-info: CgImJmT8LMFcxSoNDAxGMCPBZAQnJhGsMn15I1Tut9EN4RBaCglQd/RFoY/Lwd81tUtPUkVRiVx6YMnWYmOF6YlkJ3engquMN8YSDLnCdVGG6Z3QNoEavVpwHXQa8H8fizZC0YQk0IuUu/FycHoPtc3SKKTGUNzaAOX0qxn1+rsP7AhRn974CoRu3R+V/W9OCJHcWg9ixS6EPFZmYqQaTGuqI8edoqipkl1pj0vcBbidIRl2mOvjACWSYItba8/pK9lmcfoXYoKlggTEhb7uo5KBO5krAy8lBaoth1PdnQ7Oa8mlJcJFNwiLBOCrlkknWJO2eGrrbDwCRdRy39Nmz0YOooRxEKR4FaKAadYvHVzHtyGfebilHn6ULyw0ySI7gVw9CbFvlY87VX7zUCKz2OwyRpFsXocYObCAJZLm+nI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: f23e699a-86af-4f16-3abd-08d6805a3805 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:10:21.3688 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2088 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" This function builds a display output pipeline according to crtc_state. And this change only added single pipeline support, the dual pipeline with slave enabled data flow support will be added in the following change. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../drm/arm/display/komeda/komeda_pipeline.h | 3 + .../display/komeda/komeda_pipeline_state.c | 76 ++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 16d7ae891e81..22ad4dfc3e8d 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -400,10 +400,13 @@ void komeda_component_destroy(struct komeda_dev *mdev, struct komeda_plane_state; struct komeda_crtc_state; +struct komeda_crtc; 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_display_data_flow(struct komeda_crtc *kcrtc, + struct komeda_crtc_state *kcrtc_st); #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 74d25e542103..6a481508624f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -344,7 +344,7 @@ komeda_compiz_set_input(struct komeda_compiz *compiz, return 0; } -int +static int komeda_compiz_validate(struct komeda_compiz *compiz, struct komeda_crtc_state *state, struct komeda_data_flow_cfg *dflow) @@ -382,6 +382,53 @@ komeda_compiz_validate(struct komeda_compiz *compiz, return 0; } +static int +komeda_improc_validate(struct komeda_improc *improc, + struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *dflow) +{ + struct drm_crtc *crtc = kcrtc_st->base.crtc; + struct komeda_component_state *c_st; + struct komeda_improc_state *st; + + c_st = komeda_component_get_state_and_set_user(&improc->base, + kcrtc_st->base.state, crtc, crtc); + if (IS_ERR(c_st)) + return PTR_ERR(c_st); + + st = to_improc_st(c_st); + + st->hsize = dflow->in_w; + st->vsize = dflow->in_h; + + komeda_component_add_input(&st->base, &dflow->input, 0); + komeda_component_set_output(&dflow->input, &improc->base, 0); + + return 0; +} + +static int +komeda_timing_ctrlr_validate(struct komeda_timing_ctrlr *ctrlr, + struct komeda_crtc_state *kcrtc_st, + struct komeda_data_flow_cfg *dflow) +{ + struct drm_crtc *crtc = kcrtc_st->base.crtc; + struct komeda_timing_ctrlr_state *st; + struct komeda_component_state *c_st; + + c_st = komeda_component_get_state_and_set_user(&ctrlr->base, + kcrtc_st->base.state, crtc, crtc); + if (IS_ERR(c_st)) + return PTR_ERR(c_st); + + st = to_ctrlr_st(c_st); + + komeda_component_add_input(&st->base, &dflow->input, 0); + komeda_component_set_output(&dflow->input, &ctrlr->base, 0); + + return 0; +} + int komeda_build_layer_data_flow(struct komeda_layer *layer, struct komeda_plane_state *kplane_st, struct komeda_crtc_state *kcrtc_st, @@ -404,3 +451,30 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer, return err; } + +/* build display output data flow, the data path is: + * compiz -> improc -> timing_ctrlr + */ +int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, + struct komeda_crtc_state *kcrtc_st) +{ + struct komeda_pipeline *master = kcrtc->master; + struct komeda_data_flow_cfg m_dflow; /* master data flow */ + int err; + + memset(&m_dflow, 0, sizeof(m_dflow)); + + err = komeda_compiz_validate(master->compiz, kcrtc_st, &m_dflow); + if (err) + return err; + + err = komeda_improc_validate(master->improc, kcrtc_st, &m_dflow); + if (err) + return err; + + err = komeda_timing_ctrlr_validate(master->ctrlr, kcrtc_st, &m_dflow); + if (err) + return err; + + return 0; +} From patchwork Tue Jan 22 11:10:39 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: 10775379 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 E7C2317F0 for ; Tue, 22 Jan 2019 11:10:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4E7E2A1B7 for ; Tue, 22 Jan 2019 11:10:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C90292A1E2; Tue, 22 Jan 2019 11:10:46 +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 4FF862A1B7 for ; Tue, 22 Jan 2019 11:10:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 551C86EC8F; Tue, 22 Jan 2019 11:10:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::61d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A9B26EC8F for ; Tue, 22 Jan 2019 11:10:43 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1286.eurprd08.prod.outlook.com (10.168.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:10:39 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:10:39 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 02/11] drm/komeda: Add komeda_release_unclaimed_resources Thread-Topic: [PATCH v2 02/11] drm/komeda: Add komeda_release_unclaimed_resources Thread-Index: AQHUskMbvtrhfv1GbUCOatkB88XdEA== Date: Tue, 22 Jan 2019 11:10:39 +0000 Message-ID: <20190122110932.5138-3-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1286; 6:bCQ9CXeII+ROvAFxXo3qOA7WP4cszx1vVn3ULi0NPcanAgCMiUL7x6KZUD2lVkM5FxwVfMEHaRmpzmAGuq6KG+jog1jY+P66pTKxWefdROLfkoLqQObZeR6D2vQUprtKXbH9pWN7znCW3CM0gVymYMDeh9ZY4XEaL8ZcAuSxkob2LdHt3oi120DLyg7UaCT67E0+iOEfH9P3sF1VxxMzs/erHrdv3ufYZpZcVSY1i3fBuoiEoDeofa/YsLQDTbNS1SQfw22viJ3yV+AvH6moTbnDhZhJ9yPkQ+KmrPL3srshV7iSOgorEfw+rssLqBoGbErpWoJEsLFoT1umyJvzXBb4mddHZDFBosjqMj6jKr8XxoBoc6+x9mY/5Hc2nqORVNKcPoKXJJGQWogFkUwdc624AxCQL4KdSMxRpVG00WqNvP1/PLocU0aqLQoz5vICaZUHzueGHPRY0M6cK+WNzw==; 5:JPpLibJtvAYh5FjXR2EH3VzdEmD+VNt/hQejae+F6Dn12PAJIlU5Af3UJNCVHdij2LQl74GLObiCO4SaHFeHEkGTvQIyl9HxxE9b4+lZONGK+h6d1xR9FPAe9dxLYHQmYSamsugNlbMDOxOFaEL4usVuAX1m5kFXcGsbe0sSb1z4UyGBC2kDvjXRMCdOB1h/4PPwO2LAc4W7Aycfwastjg==; 7:Vf2EZfNJ7jHxLQkeTx30OqI/MhEyjcdwoLUdh/sXTQCgSJipZBabFhj40ecUDXKexWMm7peObbKMKIx8RfPGz2utX6eq5+rmNplBVN1u7AccQ/IkCKbtLZC4oBtOtjwxGBJZMVPNyfetwbOdlZN7uA== x-ms-office365-filtering-correlation-id: 84797dcd-1c1b-4154-f90f-08d6805a3dd4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1286; x-ms-traffictypediagnostic: DB6PR0801MB1286: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(6636002)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1286; H:DB6PR0801MB1990.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: Ol2K178GHRUpAOO29UnsmrdSioiDHUPBRcGQ5xt/65fIz8ZttONSScg6WzjTApsvsH7hpEe9hW+TN93bhAHHEKuEOzUGRVjiE/Qjz3MqRjIVuc7ZJmZK+XpKryOJYqME23IwsUakFffFgOcnxk2KYhoG8h4C0grSC/vOahc4LHv386216ej3z7pGcUmUXXnXkqEdYGxVLeDK0gocKVStIE6hjoF9bfdztXez3XSswpQVwvtAk1/NAkRVj4IwjauQESwSWaMY9dcohnwvEL+41A39J+IIxUSmzvwDL23VsQMeZlbS1MEE6Jha8Gkr+zuBHQb7ztIwJXveQS4hdwW18b0Vh2B8imdM0E3WusH230MKei+gM0+ETpdNNJGsA7bYD6R1Eh0MZ+OHplNXl36saYm6eHy2lGVxFUl9MTM8Who= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84797dcd-1c1b-4154-f90f-08d6805a3dd4 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:10:30.5095 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1286 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Komeda driver treats KMS-CRTC/PLANE as user which will acquire pipeline resources, but we still need to release the unclaimed resources. crtc_atomic_check is the final check stage, so beside build a display data pipeline according the crtc_state, but still needs to release/disable the unclaimed pipeline resources. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 27 +++++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 3 + .../display/komeda/komeda_pipeline_state.c | 58 +++++++++++++++++++ 3 files changed, 88 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 7ca9bc8ef725..a250ab824155 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -14,6 +14,32 @@ #include "komeda_dev.h" #include "komeda_kms.h" +/* crtc_atomic_check is the final check stage, so beside build a display data + * pipeline according the crtc_state, but still needs to release/disable the + * unclaimed pipeline resources. + */ +static int +komeda_crtc_atomic_check(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(state); + int err; + + if (state->active) { + err = komeda_build_display_data_flow(kcrtc, kcrtc_st); + if (err) + return err; + } + + /* release unclaimed pipeline resources */ + err = komeda_release_unclaimed_resources(kcrtc->master, kcrtc_st); + if (err) + return err; + + return 0; +} + void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_events *evts) { @@ -33,6 +59,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, } struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { + .atomic_check = komeda_crtc_atomic_check, }; static const struct drm_crtc_funcs komeda_crtc_funcs = { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 22ad4dfc3e8d..54b646128760 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -409,4 +409,7 @@ int komeda_build_layer_data_flow(struct komeda_layer *layer, 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); + #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 6a481508624f..6797be630529 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -31,6 +31,18 @@ komeda_pipeline_get_state(struct komeda_pipeline *pipe, return priv_to_pipe_st(priv_st); } +struct komeda_pipeline_state * +komeda_pipeline_get_new_state(struct komeda_pipeline *pipe, + struct drm_atomic_state *state) +{ + struct drm_private_state *priv_st; + + priv_st = drm_atomic_get_new_private_obj_state(state, &pipe->obj); + if (priv_st) + return priv_to_pipe_st(priv_st); + return NULL; +} + /* Assign pipeline for crtc */ struct komeda_pipeline_state * komeda_pipeline_get_state_and_set_crtc(struct komeda_pipeline *pipe, @@ -478,3 +490,49 @@ int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, return 0; } + +void komeda_pipeline_unbound_components(struct komeda_pipeline *pipe, + struct komeda_pipeline_state *new) +{ + struct drm_atomic_state *drm_st = new->obj.state; + struct komeda_pipeline_state *old = priv_to_pipe_st(pipe->obj.state); + struct komeda_component_state *c_st; + struct komeda_component *c; + u32 disabling_comps, id; + + WARN_ON(!old); + + disabling_comps = (~new->active_comps) & old->active_comps; + + /* unbound all disabling component */ + dp_for_each_set_bit(id, disabling_comps) { + c = komeda_pipeline_get_component(pipe, id); + c_st = komeda_component_get_state_and_set_user(c, + drm_st, NULL, new->crtc); + WARN_ON(IS_ERR(c_st)); + } +} + +/* release unclaimed pipeline resource */ +int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, + struct komeda_crtc_state *kcrtc_st) +{ + struct drm_atomic_state *drm_st = kcrtc_st->base.state; + struct komeda_pipeline_state *st; + + /* ignore the pipeline which is not affected */ + if (!pipe || !has_bit(pipe->id, kcrtc_st->affected_pipes)) + return 0; + + if (has_bit(pipe->id, kcrtc_st->active_pipes)) + st = komeda_pipeline_get_new_state(pipe, drm_st); + else + st = komeda_pipeline_get_state_and_set_crtc(pipe, drm_st, NULL); + + if (WARN_ON(IS_ERR_OR_NULL(st))) + return -EINVAL; + + komeda_pipeline_unbound_components(pipe, st); + + return 0; +} From patchwork Tue Jan 22 11:10:48 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: 10775381 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 9FDED17F0 for ; Tue, 22 Jan 2019 11:10:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2342A1B7 for ; Tue, 22 Jan 2019 11:10:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 808A42A1E2; Tue, 22 Jan 2019 11:10:55 +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 F2FAE2A1B7 for ; Tue, 22 Jan 2019 11:10:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6F106EC90; Tue, 22 Jan 2019 11:10:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0611.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::611]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2A726EC90 for ; Tue, 22 Jan 2019 11:10:51 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1286.eurprd08.prod.outlook.com (10.168.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:10:48 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:10:48 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 03/11] drm/komeda: Add komeda_crtc_atomic_flush Thread-Topic: [PATCH v2 03/11] drm/komeda: Add komeda_crtc_atomic_flush Thread-Index: AQHUskMgVWflZN1Mf0+iLzifEy0HzA== Date: Tue, 22 Jan 2019 11:10:48 +0000 Message-ID: <20190122110932.5138-4-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1286; 6:fQj+Qz7tjXCWepxoswmEGtTtgsJ1u4lfP/IzJIFKOBBWhCH37LAPsRFJEJl7W8m74QlNqU9zfFTc6u/QrHBW8BuTjBSiJV2azufPFQkdRkvRzwmIps1Ml3IlZNHR9k73hTHCgPYKA1al4rQEHEfYZTLQ/8wpMa2jCMr0wy4di2MnxOKl52CTPYOQzxsOik1HZedeCNVEYxbJkctxe9UgdW6+D+Rq7AeWgX35z3nBMVdkREBMEwsh4vPubnfbG0q2lfC+c5FM0m//s67upgXMjSHTh1EV7TcvPZzp2qcSETWIyLUgfKEJW5oyj76sPJg+JJypmPZUvXt30Cp4wNsPfL00vDTFbHX1CvQIGxEg1lIfF4QLigLNp2u3dJAjxy9UhTtRfZm0gyChGyrIgePwUjYFv7qpLlqrh8fpgwZ7+BimIeoVMBW+MqPe/z+LHRs0hTTZgt4q1ie2sbn6Lvsn1w==; 5:0eT3RhizjCpsZrWEtttduOYmluxjaTxtftUIfg5Os/luGcRGFAeR8K/QE3FTuAPKsA82QahLB+nkQk+yIxoXaYkqdrtgAP/ESaocE6FETN5B3CuNfFboCodZVc3JFRdTQLf+uvu99Jb9so4m3/9bZDCBdHVWvP2yPF8dfPpXEozVcOBf/yiPXP3KnutVwvWdimBTFrsnPQorDLdBGexp1Q==; 7:cu/QgxJ46XmAYpfUoQv9/12D2tnRJQlnTiJI2bm4Muwqgv27MVnsJ4m59xRMTy221gI0psPovGIaHiWhi7m3vwcLCMZF5AtGPMu94G3fOqmaizS/IFonqqR1aP2TNvSHZXdR9udIGqfl3dxKG0tPEw== x-ms-office365-filtering-correlation-id: ab6c4ae3-5bea-4bfb-0af5-08d6805a4337 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1286; x-ms-traffictypediagnostic: DB6PR0801MB1286: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(6636002)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(14444005)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1286; H:DB6PR0801MB1990.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: vGAoBd/XYBAw3AnmcM5JpMclIZIshfJTJmCCrU1cJAW7A7+JBDh6RMogClq1a6R7GU607ltkVDrJInh/hy5A5Pk5cV8QsyNB/W5aCBmbxDrwGRerfdloxhL9j/M+lEcrHFS75JROLUaEXcmcLovSUaWRZts2/e1fHlDRW8MSWjr4neyas4e/sFJTdJuxc8vgipdqbZDb2B+IE1x2DUDAwYa4eC57bu6z2kJNAwm/cW3hkPLyefnzt/vo9TkgiXtVgHeS0V7jIzdXr6xLy0PJRwCm68+Wjk74EKEqlsyPq6rI4M1xT+wLOtTFUfO6peCBoitQXwgT1uBcDFx3XUDw+q33x1E9QjO4FT/wmnj9jQFn7PTCpC4cGMh+TmR/1ZhTnroR2pS0AD7RDDpZfcyNSghW1S159ayuFtQBJUesoc4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab6c4ae3-5bea-4bfb-0af5-08d6805a4337 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:10:40.1814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1286 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" A komeda flush is comprised two steps: 1. update pipeline/component state to HW. 2. call dev_func->flush to notify HW to kickoff the update. Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 11 ++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 33 +++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 ++ .../drm/arm/display/komeda/komeda_pipeline.h | 5 +++ .../display/komeda/komeda_pipeline_state.c | 37 +++++++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index afc13d3b3afc..74aab4f23ea0 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -241,6 +241,16 @@ static int d71_disable_irq(struct komeda_dev *mdev) return 0; } +static void d71_flush(struct komeda_dev *mdev, + int master_pipe, u32 active_pipes) +{ + struct d71_dev *d71 = mdev->chip_data; + u32 reg_offset = (master_pipe == 0) ? + GCU_CONFIG_VALID0 : GCU_CONFIG_VALID1; + + malidp_write32(d71->gcu_addr, reg_offset, GCU_CONFIG_CVAL); +} + static int d71_reset(struct d71_dev *d71) { u32 __iomem *gcu = d71->gcu_addr; @@ -457,6 +467,7 @@ static struct komeda_dev_funcs d71_chip_funcs = { .irq_handler = d71_irq_handler, .enable_irq = d71_enable_irq, .disable_irq = d71_disable_irq, + .flush = d71_flush, }; struct komeda_dev_funcs * diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index a250ab824155..95d8f2bcd523 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -58,8 +58,41 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, DRM_DEBUG("FLIP Done.\n"); } +static void +komeda_crtc_do_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc->state); + struct komeda_dev *mdev = kcrtc->base.dev->dev_private; + struct komeda_pipeline *master = kcrtc->master; + + DRM_DEBUG_ATOMIC("CRTC%d_FLUSH: active_pipes: 0x%x, affected: 0x%x.\n", + drm_crtc_index(crtc), + kcrtc_st->active_pipes, kcrtc_st->affected_pipes); + + /* step 1: update the pipeline/component state to HW */ + if (has_bit(master->id, kcrtc_st->affected_pipes)) + komeda_pipeline_update(master, old->state); + + /* step 2: notify the HW to kickoff the update */ + mdev->funcs->flush(mdev, master->id, kcrtc_st->active_pipes); +} + +static void +komeda_crtc_atomic_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + /* commit with modeset will be handled in enable/disable */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) + return; + + komeda_crtc_do_flush(crtc, old); +} + struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .atomic_check = komeda_crtc_atomic_check, + .atomic_flush = komeda_crtc_atomic_flush, }; static const struct drm_crtc_funcs komeda_crtc_funcs = { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 8eae2620ce77..0bd38bdf0518 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -106,6 +106,9 @@ struct komeda_dev_funcs { /** @dump_register: Optional, dump registers to seq_file */ void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq); + /** @flush: Notify the HW to flush or kickoff the update */ + void (*flush)(struct komeda_dev *mdev, + int master_pipe, u32 active_pipes); }; /** diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 54b646128760..3d7a9ee550b2 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -412,4 +412,9 @@ int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, struct komeda_crtc_state *kcrtc_st); +void komeda_pipeline_disable(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state); +void komeda_pipeline_update(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state); + #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 6797be630529..87fd6493d202 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -31,6 +31,18 @@ komeda_pipeline_get_state(struct komeda_pipeline *pipe, return priv_to_pipe_st(priv_st); } +struct komeda_pipeline_state * +komeda_pipeline_get_old_state(struct komeda_pipeline *pipe, + struct drm_atomic_state *state) +{ + struct drm_private_state *priv_st; + + priv_st = drm_atomic_get_old_private_obj_state(state, &pipe->obj); + if (priv_st) + return priv_to_pipe_st(priv_st); + return NULL; +} + struct komeda_pipeline_state * komeda_pipeline_get_new_state(struct komeda_pipeline *pipe, struct drm_atomic_state *state) @@ -536,3 +548,28 @@ int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, return 0; } + +void komeda_pipeline_update(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state) +{ + struct komeda_pipeline_state *new = priv_to_pipe_st(pipe->obj.state); + struct komeda_pipeline_state *old; + struct komeda_component *c; + u32 id, changed_comps = 0; + + old = komeda_pipeline_get_old_state(pipe, old_state); + + changed_comps = new->active_comps | old->active_comps; + + DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, changed: 0x%x.\n", + pipe->id, new->active_comps, changed_comps); + + dp_for_each_set_bit(id, changed_comps) { + c = komeda_pipeline_get_component(pipe, id); + + if (new->active_comps & BIT(c->id)) + c->funcs->update(c, priv_to_comp_st(c->obj.state)); + else + c->funcs->disable(c); + } +} From patchwork Tue Jan 22 11:10:57 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: 10775383 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 11BA291E for ; Tue, 22 Jan 2019 11:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00F432A1B7 for ; Tue, 22 Jan 2019 11:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80232A1E2; Tue, 22 Jan 2019 11:11:02 +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 7CE682A1B7 for ; Tue, 22 Jan 2019 11:11:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F5426EC93; Tue, 22 Jan 2019 11:11:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40073.outbound.protection.outlook.com [40.107.4.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3E126EC93 for ; Tue, 22 Jan 2019 11:10:59 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1286.eurprd08.prod.outlook.com (10.168.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:10:57 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:10:57 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 04/11] drm/komeda: Add komeda_crtc_mode_valid/fixup Thread-Topic: [PATCH v2 04/11] drm/komeda: Add komeda_crtc_mode_valid/fixup Thread-Index: AQHUskMmWTg7S2cYP0a9LrR/RJ11Ug== Date: Tue, 22 Jan 2019 11:10:57 +0000 Message-ID: <20190122110932.5138-5-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1286; 6:yULRSjLGStma5ET2jziled8ERXH7tmeAjuQm2UzcUtNffM54c8e+Tm9S0lycuYdYe7OmbIra0Z2HsUCLww8iFmi5nfnU7eiqAtnhK6jx89bGbqWBjLzyQDii4iUAHQ7z2IFRb7ob85RTcyCiTE+PImqTmKrXbMED3/LdR0YvgHrv5HwAozr654wNwu+m89MBu4s1SGdsw0ufYmgqv6dC1S7sz8ZfjBP4HAarJSpy8LE+dOwY0stHELhUdZAJTvm2fgWmmmFCAC47yEtXFcUuSDWBUxLO9if797KLkQI6nuIH53/OvnF/kPCtW/tCcuWYmo4UTelMfg10SkvFV2wczibfLGJ2WXjfJkHq28dJBStKSiFTcfq9jlrCx2gW8gzyqTueKC6Zt8Zc02sLUuovberG9fJGaeQ6NNhviqKJ/8roMDC6xlmVeao6A+VHr/Bs8PlEjm4mmz1uedH42lYSFg==; 5:3M93RZ93lzJxW1ixq+H2RM0JHV2KNTBXdpGdBDVkH/7YRU6NP3ul02VF0rGXkIJ8L7xqbXU1p+b+C0MF59va5ujRvyXLkGeb8UV/K41mz8Us/RLd9fGAiTIlbtQ3GF8/1rxnRXRAi794Y7YNgTjSoPz4YeOlkdEMQ8n7VuDWuKiPkhovUQIYq/AO31VWsyKsWb4uFcpaY0caFuT1h//ZCQ==; 7:pbLzuCEnSW2MQ3BE5hY/huIJhjNNfOs0/7T4bxkFgG0su5yXFj0uVBRvfNw2V5qoN0Y36Ke695LbaAdcwmmeZRsWQQx2qBK5/qG/b08X5BFJN5jJFt8+8Mnx/MGxpX9RWspdXyuDAttan+idiV2rkw== x-ms-office365-filtering-correlation-id: f5dcabc7-f13e-4db2-9377-08d6805a488f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1286; x-ms-traffictypediagnostic: DB6PR0801MB1286: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(6636002)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1286; H:DB6PR0801MB1990.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: niViQqI5vYOF6chKBy4NI43hJnzKy9aoRzOlw4GUOAsfzOnHTH8/B6kH3VxBhLu18j2JMdWZXiRWE2OhiAUjmNsv5MxRpZJBvTBO1unzZHiQbICYHhO7p2Og6WL3CaowyiLMRFhksyMy9l/SiarucXz+RK5GFO1ANu8W+1tDimXrM8KkmxmpAspV/hgVfmYHbbiiAZJ0QKAvgTQ0sakcV3DlEilXFx5RIJK/sh1ZSNRL/9RXJynKfH7lOtHGYMJUdu2YmvWmdx+qXS8inecr21ur0ATjurOKLLjHd9lvXhCj062YG1W++GxGysb9ivGqhi8rGkqlyaHD3qHhDuGYlvKJfqb/KjtEcSTu2e/t4Q33Dw/eGaD8RNE6EBWo2jRQjczg3NPdFK6UNy5TBR6ZwSNyv3ToA8e93ws+cfG5i80= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5dcabc7-f13e-4db2-9377-08d6805a488f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:10:49.1346 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1286 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" komeda_crtc_mode_valid compares the input mode->clk with main engine clk and AXI clk, and reject the mode if the required pixel clk can not be satisfied by main engine clk and AXI-clk. Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 95d8f2bcd523..7e0bf78da733 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -90,9 +90,61 @@ komeda_crtc_atomic_flush(struct drm_crtc *crtc, komeda_crtc_do_flush(crtc, old); } +static enum drm_mode_status +komeda_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *m) +{ + struct komeda_dev *mdev = crtc->dev->dev_private; + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_pipeline *master = kcrtc->master; + long mode_clk, pxlclk; + + if (m->flags & DRM_MODE_FLAG_INTERLACE) + return MODE_NO_INTERLACE; + + /* main clock/AXI clk must be faster than pxlclk*/ + mode_clk = m->clock * 1000; + pxlclk = clk_round_rate(master->pxlclk, mode_clk); + if (pxlclk != mode_clk) { + DRM_DEBUG_ATOMIC("pxlclk doesn't support %ld Hz\n", mode_clk); + + return MODE_NOCLOCK; + } + + if (clk_round_rate(mdev->mclk, mode_clk) < pxlclk) { + DRM_DEBUG_ATOMIC("mclk can't satisfy the requirement of %s-clk: %ld.\n", + m->name, pxlclk); + + return MODE_CLOCK_HIGH; + } + + if (clk_round_rate(master->aclk, mode_clk) < pxlclk) { + DRM_DEBUG_ATOMIC("aclk can't satisfy the requirement of %s-clk: %ld.\n", + m->name, pxlclk); + + return MODE_CLOCK_HIGH; + } + + return MODE_OK; +} + +static bool komeda_crtc_mode_fixup(struct drm_crtc *crtc, + const struct drm_display_mode *m, + struct drm_display_mode *adjusted_mode) +{ + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_pipeline *master = kcrtc->master; + long mode_clk = m->clock * 1000; + + adjusted_mode->clock = clk_round_rate(master->pxlclk, mode_clk) / 1000; + + return true; +} + struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .atomic_check = komeda_crtc_atomic_check, .atomic_flush = komeda_crtc_atomic_flush, + .mode_valid = komeda_crtc_mode_valid, + .mode_fixup = komeda_crtc_mode_fixup, }; static const struct drm_crtc_funcs komeda_crtc_funcs = { From patchwork Tue Jan 22 11:11:07 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: 10775385 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 1EB1891E for ; Tue, 22 Jan 2019 11:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C7982A1B7 for ; Tue, 22 Jan 2019 11:11:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0090C2A1E2; Tue, 22 Jan 2019 11:11:13 +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 660F32A1B7 for ; Tue, 22 Jan 2019 11:11:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FDA26EC94; Tue, 22 Jan 2019 11:11:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on0603.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe07::603]) by gabe.freedesktop.org (Postfix) with ESMTPS id 917106EC94 for ; Tue, 22 Jan 2019 11:11:10 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1784.eurprd08.prod.outlook.com (10.169.227.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:11:07 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:07 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 05/11] drm/komeda: Add komeda_crtc_prepare/unprepare Thread-Topic: [PATCH v2 05/11] drm/komeda: Add komeda_crtc_prepare/unprepare Thread-Index: AQHUskMsibovwpzi6E6Ub38r7bWMsw== Date: Tue, 22 Jan 2019 11:11:07 +0000 Message-ID: <20190122110932.5138-6-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1784; 6:ooIapGyulhLaPagrEqbrccF63UlMgLzibQHaahwhHy1xSW/UCfSOzrhpr4QlaecfzTC8JgNtaRkaz4UrVJTixnJqRCL5v13zuMH5KICoWLMbxJwB+7vn5D8lrleSAGDvws2hFFNjRdLSfSbIgB6pB2ed4H/KkSJZh2d5FPLuSnfp2tVmhay2ZtWFp3yMven2N9Q7SMdXVlzH8LMWAL6Dnlbv2IE4bNUjnW7k8T7AYjb1UN8m695LJPm2BzOfhaB1ADDSCs/WXTHHQro6mNWzRPQ9u9o6iHF/ZZz9jctHtPF7E++hCgJi1ltsA8vQBfAEOpQd3OF5SGMImM/EGc3PV47YE6qETpazjPylET1BYPDND9IzQT9kXFE5ph3h6kj0fki/kXfUtGPfYndOIJBXkQQNgYzkBy0gOZ9VMpiNp1hpp4MIH2XfJcGVDnf0PEtQQgSuKiqCSsVPvDNp3MjIEA==; 5:qF2TT0ekMkht96yCMr6ZUUewja5oPTgLsylWyBS+tNAcBX98YeefYMK/VrdsCWojLBtvljlVmBVIEEdNS5hjdiGR8icoXBC7efYmvowzk84YrVHRtWYpApSThi7w3ZuCAxW9nOKNRiwjOENtT/dTZKTQVyiG4BNWlavK7Fd5Gzuw8toLADXAJClRw+aMLW5tcGEDhLDGQVtEZMSdktYjPQ==; 7:gpPOndxJKIbHOHKQae9JF1TC7twTzBZ/M/k44SISHu3RkkCxAxSaZIjlA83vA5Vq56DeKtElKK/y4XcdcTs0F1sMjB4I9URXQbJKSPI2mFUJDe6FDHdWaxiNlX6FGIZakUs02JRqBm8ojvQHBOeM/w== x-ms-office365-filtering-correlation-id: 40e348af-74b7-478f-b995-08d6805a4de5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1784; x-ms-traffictypediagnostic: DB6PR0801MB1784: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(376002)(39860400002)(346002)(189003)(199004)(446003)(2616005)(76176011)(11346002)(105586002)(14454004)(476003)(2501003)(14444005)(66066001)(6506007)(386003)(186003)(97736004)(26005)(68736007)(55236004)(102836004)(106356001)(478600001)(36756003)(52116002)(103116003)(6436002)(7736002)(6486002)(99286004)(81166006)(81156014)(8936002)(6116002)(3846002)(305945005)(50226002)(8676002)(71200400001)(71190400001)(25786009)(54906003)(6512007)(256004)(2906002)(486006)(110136005)(4326008)(6636002)(1076003)(53936002)(86362001)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1784; H:DB6PR0801MB1990.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-message-info: 7Q0VV0hv19ND75Zrk2GbqAX6um+m7vmx4ELG8bC50OUQBnFseCYhHSPK5EZUEl0WLY6pAI7O6gWbWDtZRnQYk6cbNsGkaMf3xGeDEVuzat7s7Fzu3fu9VfQ7AD64OZYwgrUccRdoxczZZVnW9ylM9+V+bFcYuPiRRas+06Bz3m+qd36GAmqKM769msT7mB67+TIm/73+qDBOKGn2qXQB0lNYga7vAJVb6UUIxOK69nrJI966L6LDAhL8d4aa2NGarGMPGr3SaKhmREz/68vg6nPe6a+Kvsa9p72VP7tbklJkTko8xjZxlTP414iMiSSdYLe+hl6hE9ipqhUj37mh4tIt6ips7kz8cgBSOxJ/Kp41tS4cOpveY5PE+oWX6sBhGkiH6L7Dzzrz2Qcm6HJCxlMyKfeY0EoWMoa/C8aB/tQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40e348af-74b7-478f-b995-08d6805a4de5 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:10:58.1034 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1784 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" These two function will be used by komeda_crtc_enable/disable to do some prepartion works when enable/disable a crtc. like enable a crtc: 1. Adjust display operation mode. 2. Enable/prepare needed clk. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 32 ++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 104 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.c | 2 + .../gpu/drm/arm/display/komeda/komeda_dev.h | 26 +++++ 4 files changed, 164 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 74aab4f23ea0..2fb29aea9f69 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -241,6 +241,37 @@ static int d71_disable_irq(struct komeda_dev *mdev) return 0; } +static int to_d71_opmode(int core_mode) +{ + switch (core_mode) { + case KOMEDA_MODE_DISP0: + return DO0_ACTIVE_MODE; + case KOMEDA_MODE_DISP1: + return DO1_ACTIVE_MODE; + case KOMEDA_MODE_DUAL_DISP: + return DO01_ACTIVE_MODE; + case KOMEDA_MODE_INACTIVE: + return INACTIVE_MODE; + default: + WARN(1, "Unknown operation mode"); + return INACTIVE_MODE; + } +} + +static int d71_change_opmode(struct komeda_dev *mdev, int new_mode) +{ + struct d71_dev *d71 = mdev->chip_data; + u32 opmode = to_d71_opmode(new_mode); + int ret; + + malidp_write32_mask(d71->gcu_addr, BLK_CONTROL, 0x7, opmode); + + ret = dp_wait_cond(((malidp_read32(d71->gcu_addr, BLK_CONTROL) & 0x7) == opmode), + 100, 1000, 10000); + + return ret > 0 ? 0 : -ETIMEDOUT; +} + static void d71_flush(struct komeda_dev *mdev, int master_pipe, u32 active_pipes) { @@ -467,6 +498,7 @@ static struct komeda_dev_funcs d71_chip_funcs = { .irq_handler = d71_irq_handler, .enable_irq = d71_enable_irq, .disable_irq = d71_disable_irq, + .change_opmode = d71_change_opmode, .flush = d71_flush, }; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 7e0bf78da733..ef4c3ee2a688 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -40,6 +40,110 @@ komeda_crtc_atomic_check(struct drm_crtc *crtc, return 0; } +u32 komeda_calc_mclk(struct komeda_crtc_state *kcrtc_st) +{ + unsigned long mclk = kcrtc_st->base.adjusted_mode.clock * 1000; + + return mclk; +} + +/* For active a crtc, mainly need two parts of preparation + * 1. adjust display operation mode. + * 2. enable needed clk + */ +int +komeda_crtc_prepare(struct komeda_crtc *kcrtc) +{ + struct komeda_dev *mdev = kcrtc->base.dev->dev_private; + struct komeda_pipeline *master = kcrtc->master; + struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(kcrtc->base.state); + unsigned long pxlclk_rate = kcrtc_st->base.adjusted_mode.clock * 1000; + u32 new_mode; + int err; + + mutex_lock(&mdev->lock); + + new_mode = mdev->dpmode | BIT(master->id); + if (WARN_ON(new_mode == mdev->dpmode)) { + err = 0; + goto unlock; + } + + err = mdev->funcs->change_opmode(mdev, new_mode); + if (err) { + DRM_ERROR("failed to change opmode: 0x%x -> 0x%x.\n,", + mdev->dpmode, new_mode); + goto unlock; + } + + mdev->dpmode = new_mode; + /* Only need to enable mclk on single display mode, but no need to + * enable mclk it on dual display mode, since the dual mode always + * switch from single display mode, the mclk already enabled, no need + * to enable it again. + */ + if (new_mode != KOMEDA_MODE_DUAL_DISP) { + err = clk_set_rate(mdev->mclk, komeda_calc_mclk(kcrtc_st)); + if (err) + DRM_ERROR("failed to set mclk.\n"); + err = clk_prepare_enable(mdev->mclk); + if (err) + DRM_ERROR("failed to enable mclk.\n"); + } + + err = clk_prepare_enable(master->aclk); + if (err) + DRM_ERROR("failed to enable axi clk for pipe%d.\n", master->id); + err = clk_set_rate(master->pxlclk, pxlclk_rate); + if (err) + DRM_ERROR("failed to set pxlclk for pipe%d\n", master->id); + err = clk_prepare_enable(master->pxlclk); + if (err) + DRM_ERROR("failed to enable pxl clk for pipe%d.\n", master->id); + +unlock: + mutex_unlock(&mdev->lock); + + return err; +} + +int +komeda_crtc_unprepare(struct komeda_crtc *kcrtc) +{ + struct komeda_dev *mdev = kcrtc->base.dev->dev_private; + struct komeda_pipeline *master = kcrtc->master; + u32 new_mode; + int err; + + mutex_lock(&mdev->lock); + + new_mode = mdev->dpmode & (~BIT(master->id)); + + if (WARN_ON(new_mode == mdev->dpmode)) { + err = 0; + goto unlock; + } + + err = mdev->funcs->change_opmode(mdev, new_mode); + if (err) { + DRM_ERROR("failed to change opmode: 0x%x -> 0x%x.\n,", + mdev->dpmode, new_mode); + goto unlock; + } + + mdev->dpmode = new_mode; + + clk_disable_unprepare(master->pxlclk); + clk_disable_unprepare(master->aclk); + if (new_mode == KOMEDA_MODE_INACTIVE) + clk_disable_unprepare(mdev->mclk); + +unlock: + mutex_unlock(&mdev->lock); + + return err; +} + void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_events *evts) { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index a012b3bbf53b..7152f2c08e01 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -145,6 +145,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev) if (!mdev) return ERR_PTR(-ENOMEM); + mutex_init(&mdev->lock); + mdev->dev = dev; mdev->reg_base = devm_ioremap_resource(dev, io_res); if (IS_ERR(mdev->reg_base)) { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 0bd38bdf0518..1ad1f6e49854 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -106,11 +106,34 @@ struct komeda_dev_funcs { /** @dump_register: Optional, dump registers to seq_file */ void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq); + /** + * @change_opmode: + * + * Notify HW to switch to a new display operation mode. + */ + int (*change_opmode)(struct komeda_dev *mdev, int new_mode); /** @flush: Notify the HW to flush or kickoff the update */ void (*flush)(struct komeda_dev *mdev, int master_pipe, u32 active_pipes); }; +/** + * DISPLAY_MODE describes how many display been enabled, and which will be + * passed to CHIP by &komeda_dev_funcs->change_opmode(), then CHIP can do the + * pipeline resources assignment according to this usage hint. + * - KOMEDA_MODE_DISP0: Only one display enabled, pipeline-0 work as master. + * - KOMEDA_MODE_DISP1: Only one display enabled, pipeline-0 work as master. + * - KOMEDA_MODE_DUAL_DISP: Dual display mode, both display has been enabled. + * And D71 supports assign two pipelines to one single display on mode + * KOMEDA_MODE_DISP0/DISP1 + */ +enum { + KOMEDA_MODE_INACTIVE = 0, + KOMEDA_MODE_DISP0 = BIT(0), + KOMEDA_MODE_DISP1 = BIT(1), + KOMEDA_MODE_DUAL_DISP = KOMEDA_MODE_DISP0 | KOMEDA_MODE_DISP1, +}; + /** * struct komeda_dev * @@ -133,6 +156,9 @@ struct komeda_dev { /** @irq: irq number */ int irq; + struct mutex lock; /* used to protect dpmode */ + u32 dpmode; /* current display mode */ + int n_pipelines; struct komeda_pipeline *pipelines[KOMEDA_MAX_PIPELINES]; From patchwork Tue Jan 22 11:11:16 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: 10775387 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 A20B417F0 for ; Tue, 22 Jan 2019 11:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90B232A1B7 for ; Tue, 22 Jan 2019 11:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F752A1E2; Tue, 22 Jan 2019 11:11: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 E64872A1B7 for ; Tue, 22 Jan 2019 11:11:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 086326EC8D; Tue, 22 Jan 2019 11:11:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00064.outbound.protection.outlook.com [40.107.0.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94C2C6EC95 for ; Tue, 22 Jan 2019 11:11:18 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1784.eurprd08.prod.outlook.com (10.169.227.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:11:16 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:16 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 06/11] drm/komeda: Add komeda_crtc_atomic_enable/disable Thread-Topic: [PATCH v2 06/11] drm/komeda: Add komeda_crtc_atomic_enable/disable Thread-Index: AQHUskMxu0VEuSfWC0GgPiORgM25bA== Date: Tue, 22 Jan 2019 11:11:16 +0000 Message-ID: <20190122110932.5138-7-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1784; 6:QHo9BeYdchfzdkYbOkVuMUva0DRBn40fKrKe/09qrC2iQ6Jz5Uf41HuOmgXBtqQZ6GRBMuKHMHD+qIpGKbHqRYrV3euN5GcrbSDXkrpcPYNXxwvQz9ySXOrafJUQTxDg1tRH77SOXr64KdIs+sEoLOpNr6izhhNhbpaDoR75FcwAzpw9pTn0Fc84BcTWy5+1OW8eCZrEtWJ2A8Qqo2nwiRvhK/m2gFanNG6PWiv1zOVppQC0I/TYl/1vgoOfpJSTM5VnTQEa+Wz+ITaukJtsv6FPjCGOr0j748KGyrV7y77xvuBmhZ8c+j0noY4qWD6YpzvJ3kIsK13awnorh451zFXDwDbqDJZOabO21QqiykeXIig5gLYaKt8kZQBXSRu7F/jtJWKdifSW/pA3UVU3TqAfCIqfrjRP+DYImwVrdUoLbFYF0pAXv9e0FsiX8cEUaS5E7r4tCuCG0qHaUF+XCg==; 5:biIedyQKLvyTmdR/V4HYuBg5+v5375KpesA1lH8RH3AhmLYOQ+JNc/tYOVDrtSJIlY8bweeaa8SnepbToVtGVfyWJvYEPxvRetqJZiPTidUNcucyEI4hsFMnDXyRS1eRw5Aoy5g5aIQwLy7xHwZXVPK7hXUo61KRiadlDgKgBOMB7Kt9rh6lzpt6C2M8Cy4ipvwhJvGl0BIgaBBntiRKig==; 7:/1r+58eLXY6lS+hd89NDywF/IWKn6DEcY5GHSXwh3Od3fG/dnQJnLzMjidbCzNQFEFsKWm/1T7yjZP/5+oNsNu/jXTp8cuKr+ljt/zV5sN6w76ChfCvYG1QdUjrFwGgv8JRCuwtktOsnpgq6XVAwAw== x-ms-office365-filtering-correlation-id: d1e9e9b0-f3ab-4db7-16e6-08d6805a5394 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1784; x-ms-traffictypediagnostic: DB6PR0801MB1784: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(376002)(39860400002)(346002)(189003)(199004)(446003)(2616005)(76176011)(11346002)(105586002)(14454004)(476003)(2501003)(14444005)(66066001)(6506007)(386003)(186003)(97736004)(26005)(68736007)(55236004)(102836004)(106356001)(478600001)(36756003)(52116002)(103116003)(6436002)(7736002)(6486002)(99286004)(81166006)(81156014)(8936002)(6116002)(3846002)(305945005)(50226002)(8676002)(71200400001)(71190400001)(25786009)(54906003)(6512007)(256004)(2906002)(486006)(110136005)(4326008)(6636002)(1076003)(53936002)(86362001)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1784; H:DB6PR0801MB1990.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-message-info: ulBZTLKXWBpV2nDGbM3otuvYtPmQnt1zV8PAP9dJlZtRU8x+53Ha7oKvgA3ccZKJHexyOaLwNvvPjGvUFKAZDYXNvhbD3lhhq8PJyT6hda2otNFv/dgODy7LhURmkq02lJmMebUDAEehIbhNRflgLCi499x7O0yRnYhEngt8vKjECDXNbHm63RutgD5x5gb+PD3K//goPaRFqUijmjy9tO3TM9KZQoQxlCh86cSMe/VtXTU/CYbr4JIXXifXogI7nmCtFLOgwOIIC1jOoI6bPHkkzmb9cTL/7eXJdZygp6jXn/m4Fg8JBJvzoGa+Q7qL2JG5A+jxLcoIpSEs5K4Y3ZBBodXKtoK5bP4Z5hkB+mmNbyENjOvrnY28g2VlQlEVTsTJ9TsymJkxsnv2CLTnq3KF22FOzXENOvjeUU5kVYs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1e9e9b0-f3ab-4db7-16e6-08d6805a5394 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:07.6191 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1784 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Pass enable/disable command to komeda and adjust komeda hardware for enable/disable a display instance. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 106 +++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 3 + .../drm/arm/display/komeda/komeda_pipeline.h | 3 + .../display/komeda/komeda_pipeline_state.c | 32 ++++++ 4 files changed, 139 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index ef4c3ee2a688..9b370e1232e2 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -51,7 +51,7 @@ u32 komeda_calc_mclk(struct komeda_crtc_state *kcrtc_st) * 1. adjust display operation mode. * 2. enable needed clk */ -int +static int komeda_crtc_prepare(struct komeda_crtc *kcrtc) { struct komeda_dev *mdev = kcrtc->base.dev->dev_private; @@ -107,7 +107,7 @@ komeda_crtc_prepare(struct komeda_crtc *kcrtc) return err; } -int +static int komeda_crtc_unprepare(struct komeda_crtc *kcrtc) { struct komeda_dev *mdev = kcrtc->base.dev->dev_private; @@ -157,9 +157,28 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, if (events & KOMEDA_EVENT_EOW) DRM_DEBUG("EOW.\n"); - /* will handle it with crtc->flush */ - if (events & KOMEDA_EVENT_FLIP) - DRM_DEBUG("FLIP Done.\n"); + if (events & KOMEDA_EVENT_FLIP) { + unsigned long flags; + struct drm_pending_vblank_event *event; + + spin_lock_irqsave(&crtc->dev->event_lock, flags); + if (kcrtc->disable_done) { + complete_all(kcrtc->disable_done); + kcrtc->disable_done = NULL; + } else if (crtc->state->event) { + event = crtc->state->event; + /* + * Consume event before notifying drm core that flip + * happened. + */ + crtc->state->event = NULL; + drm_crtc_send_vblank_event(crtc, event); + } else { + DRM_WARN("CRTC[%d]: FLIP happen but no pending commit.\n", + drm_crtc_index(&kcrtc->base)); + } + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + } } static void @@ -183,6 +202,81 @@ komeda_crtc_do_flush(struct drm_crtc *crtc, mdev->funcs->flush(mdev, master->id, kcrtc_st->active_pipes); } +static void +komeda_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + komeda_crtc_prepare(to_kcrtc(crtc)); + drm_crtc_vblank_on(crtc); + komeda_crtc_do_flush(crtc, old); +} + +static void +komeda_crtc_atomic_disable(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_crtc_state *old_st = to_kcrtc_st(old); + struct komeda_dev *mdev = crtc->dev->dev_private; + struct komeda_pipeline *master = kcrtc->master; + struct completion *disable_done = &crtc->state->commit->flip_done; + struct completion temp; + int timeout; + + DRM_DEBUG_ATOMIC("CRTC%d_DISABLE: active_pipes: 0x%x, affected: 0x%x.\n", + drm_crtc_index(crtc), + old_st->active_pipes, old_st->affected_pipes); + + if (has_bit(master->id, old_st->active_pipes)) + komeda_pipeline_disable(master, old->state); + + /* crtc_disable has two scenarios according to the state->active switch. + * 1. active -> inactive + * this commit is a disable commit. and the commit will be finished + * or done after the disable operation. on this case we can directly + * use the crtc->state->event to tracking the HW disable operation. + * 2. active -> active + * the crtc->commit is not for disable, but a modeset operation when + * crtc is active, such commit actually has been completed by 3 + * DRM operations: + * crtc_disable, update_planes(crtc_flush), crtc_enable + * so on this case the crtc->commit is for the whole process. + * we can not use it for tracing the disable, we need a temporary + * flip_done for tracing the disable. and crtc->state->event for + * the crtc_enable operation. + * That's also the reason why skip modeset commit in + * komeda_crtc_atomic_flush() + */ + if (crtc->state->active) { + struct komeda_pipeline_state *pipe_st; + /* clear the old active_comps to zero */ + pipe_st = komeda_pipeline_get_old_state(master, old->state); + pipe_st->active_comps = 0; + + init_completion(&temp); + kcrtc->disable_done = &temp; + disable_done = &temp; + } + + mdev->funcs->flush(mdev, master->id, 0); + + /* wait the disable take affect.*/ + timeout = wait_for_completion_timeout(disable_done, HZ); + if (timeout == 0) { + DRM_ERROR("disable pipeline%d timeout.\n", kcrtc->master->id); + if (crtc->state->active) { + unsigned long flags; + + spin_lock_irqsave(&crtc->dev->event_lock, flags); + kcrtc->disable_done = NULL; + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + } + } + + drm_crtc_vblank_off(crtc); + komeda_crtc_unprepare(kcrtc); +} + static void komeda_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old) @@ -247,6 +341,8 @@ static bool komeda_crtc_mode_fixup(struct drm_crtc *crtc, struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .atomic_check = komeda_crtc_atomic_check, .atomic_flush = komeda_crtc_atomic_flush, + .atomic_enable = komeda_crtc_atomic_enable, + .atomic_disable = komeda_crtc_atomic_disable, .mode_valid = komeda_crtc_mode_valid, .mode_fixup = komeda_crtc_mode_fixup, }; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index 06394716367b..990071352040 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -69,6 +69,9 @@ struct komeda_crtc { * merge into the master. */ struct komeda_pipeline *slave; + + /* this flip_done is for tracing the disable */ + struct completion *disable_done; }; /** struct komeda_crtc_state */ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 3d7a9ee550b2..233e512319e8 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -412,6 +412,9 @@ int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, struct komeda_crtc_state *kcrtc_st); +struct komeda_pipeline_state * +komeda_pipeline_get_old_state(struct komeda_pipeline *pipe, + struct drm_atomic_state *state); void komeda_pipeline_disable(struct komeda_pipeline *pipe, struct drm_atomic_state *old_state); void komeda_pipeline_update(struct komeda_pipeline *pipe, 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 87fd6493d202..69a622f06453 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -549,6 +549,38 @@ int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, return 0; } +void komeda_pipeline_disable(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state) +{ + struct komeda_pipeline_state *old; + struct komeda_component *c; + struct komeda_component_state *c_st; + u32 id, disabling_comps = 0; + + old = komeda_pipeline_get_old_state(pipe, old_state); + + disabling_comps = old->active_comps; + DRM_DEBUG_ATOMIC("PIPE%d: disabling_comps: 0x%x.\n", + pipe->id, disabling_comps); + + dp_for_each_set_bit(id, disabling_comps) { + c = komeda_pipeline_get_component(pipe, id); + c_st = priv_to_comp_st(c->obj.state); + + /* + * If we disabled a component then all active_inputs should be + * put in the list of changed_active_inputs, so they get + * re-enabled. + * This usually happens during a modeset when the pipeline is + * first disabled and then the actual state gets committed + * again. + */ + c_st->changed_active_inputs |= c_st->active_inputs; + + c->funcs->disable(c); + } +} + void komeda_pipeline_update(struct komeda_pipeline *pipe, struct drm_atomic_state *old_state) { From patchwork Tue Jan 22 11:11:25 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: 10775389 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 4E0CF91E for ; Tue, 22 Jan 2019 11:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CB802A1B7 for ; Tue, 22 Jan 2019 11:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F1C92A1E2; Tue, 22 Jan 2019 11:11:31 +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 C31B22A1B7 for ; Tue, 22 Jan 2019 11:11:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B33626EC95; Tue, 22 Jan 2019 11:11:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70082.outbound.protection.outlook.com [40.107.7.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 880D66EC95 for ; Tue, 22 Jan 2019 11:11:28 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1286.eurprd08.prod.outlook.com (10.168.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:11:25 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:25 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 07/11] drm/komeda: Add komeda_crtc_vblank_enable/disable Thread-Topic: [PATCH v2 07/11] drm/komeda: Add komeda_crtc_vblank_enable/disable Thread-Index: AQHUskM2Offx3k/8a0u5t7UUjoQMeg== Date: Tue, 22 Jan 2019 11:11:25 +0000 Message-ID: <20190122110932.5138-8-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1286; 6:Bm0NWMcuLxBv9+INUtBGMcytb3Bc9HX4B63keAFidizqME35oqLJ46JGDDPdgG0glfv6DVjr6AN0h2NzlQ+YRdsXWjqcze4l3jg+AoLgSpAM5xhRP1yu+ycikAYbz8Zi+r09FXgrKKddaUuD5jqNgmfDk6oyRWgyPnFB02FO4jXpN79gJ/JEbXy0ZZC1kQHi2tHk9onqxbbtDxV+4ppmuRY8hbClDWfc+K5dwGRGt+q5M9LTz+AgSGUAC9PlqYo3BC0U+wseakf6ToKfMzn9yvFfqdx/tU8j3Ub6bBxdy2H0dLTNOhPRpgFiX2IqNjn7ofmNZ/60nCkODtZa5khxDcBndWdqQ0iBNqIMw2cnx7ZX3/Ax0q3HGZcMob9jOyRRl0s4QIyGiB9ejtYT4D7fdCVJt+SsrZ4y+n+ap8LRzPGjYr1/6nwmK8pcA5zHW5kuCF7fln1F2oeq0jgScQf4Zg==; 5:+iIZ1R3TdL72OIUVvJxIFs/hWEx7DyIxct9T9FIPoW1FOpZRN2XNbRkVN+0TKzn89rPKHuNF3HwY++XQIU+041fpxP+76AQrqYloIW4A+ZO4Xku50aPxuGnVUcpOebBbW+edlltmi+/bhKgvniOBwK7w/LJ5ML0FWPwLUQQ9SrvjKfD7oDzSqPlQ0NjGHunayTUbiB7Ybz2DU1hrPo1pKw==; 7:noJt5FlEdL4i/7BW1YzrJ/ApAdgpV/TiXOVYU0dqKASPiegQHCyOmhaSLZFSlyKikoLhCXSaggRUI4O3gQumvrKPgNTyIEStFb2pfSbi65Fv9kykhvqIacQT4dKV2taXKrjH5RTNWLzlfqVKkQPkwA== x-ms-office365-filtering-correlation-id: ae322f7a-d31d-4227-785b-08d6805a58e5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1286; x-ms-traffictypediagnostic: DB6PR0801MB1286: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(6636002)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1286; H:DB6PR0801MB1990.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: oBEG/kp07WWIeWvZYDHiIXLd3biMnn10K+8v36LJr7YkdZLMKSGBwh36nUwkNPyIpZUOpV+wUTfOcIXJuF63XXOaV56Evwb8Fx0GW6zPywVkcdje4OQ0VVMWGzkVcTjHOQ4Q1JAgxCbR+d5ZcC0FxVNdFXQB79Oa0jmEXvIUjCKkFeW4kAvflCifBQA5sqzZztRz5tx5OoZ1lY9GUnBTcJrrQb1OruFtVWfDDTzbspwuXDVhziDu8ltxMLrUB3o+cI+GWgKda3ocuf73ErDUd2/9aoa7NR98sQmRxKDjbiLN84/dpKCq4IQzDa874zwG9iuAU0ezovsRLQnGCv5Y4/ik93Z96CZ91kV4jeSIZlXl2Uu1bo1KxcJ5a1faxe0XE6PZAJrRrxCdMXKH8leZozCPzggNT7XOwcitmNouViQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae322f7a-d31d-4227-785b-08d6805a58e5 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:16.5567 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1286 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Add a new komeda_dev_func->on_off_vblank to enable/disable HW vblank event Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 10 ++++++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 19 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 +++ 3 files changed, 32 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 2fb29aea9f69..f517ab0ceae9 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -241,6 +241,15 @@ static int d71_disable_irq(struct komeda_dev *mdev) return 0; } +static void d71_on_off_vblank(struct komeda_dev *mdev, int master_pipe, bool on) +{ + struct d71_dev *d71 = mdev->chip_data; + struct d71_pipeline *pipe = d71->pipes[master_pipe]; + + malidp_write32_mask(pipe->dou_addr, BLK_IRQ_MASK, + DOU_IRQ_PL0, on ? DOU_IRQ_PL0 : 0); +} + static int to_d71_opmode(int core_mode) { switch (core_mode) { @@ -498,6 +507,7 @@ static struct komeda_dev_funcs d71_chip_funcs = { .irq_handler = d71_irq_handler, .enable_irq = d71_enable_irq, .disable_irq = d71_disable_irq, + .on_off_vblank = d71_on_off_vblank, .change_opmode = d71_change_opmode, .flush = d71_flush, }; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 9b370e1232e2..e19ba9468d31 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -347,7 +347,26 @@ struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .mode_fixup = komeda_crtc_mode_fixup, }; +static int komeda_crtc_vblank_enable(struct drm_crtc *crtc) +{ + struct komeda_dev *mdev = crtc->dev->dev_private; + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + + mdev->funcs->on_off_vblank(mdev, kcrtc->master->id, true); + return 0; +} + +static void komeda_crtc_vblank_disable(struct drm_crtc *crtc) +{ + struct komeda_dev *mdev = crtc->dev->dev_private; + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + + mdev->funcs->on_off_vblank(mdev, kcrtc->master->id, false); +} + static const struct drm_crtc_funcs komeda_crtc_funcs = { + .enable_vblank = komeda_crtc_vblank_enable, + .disable_vblank = komeda_crtc_vblank_disable, }; int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms, diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 1ad1f6e49854..8acd25afb3e9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -103,6 +103,9 @@ struct komeda_dev_funcs { int (*enable_irq)(struct komeda_dev *mdev); /** @disable_irq: disable irq */ int (*disable_irq)(struct komeda_dev *mdev); + /** @on_off_vblank: notify HW to on/off vblank */ + void (*on_off_vblank)(struct komeda_dev *mdev, + int master_pipe, bool on); /** @dump_register: Optional, dump registers to seq_file */ void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq); From patchwork Tue Jan 22 11:11:35 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: 10775391 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 C181D91E for ; Tue, 22 Jan 2019 11:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE0D92A1B7 for ; Tue, 22 Jan 2019 11:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A20982A1E2; Tue, 22 Jan 2019 11:11:41 +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 4D58B2A1B7 for ; Tue, 22 Jan 2019 11:11:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 580C86EC9A; Tue, 22 Jan 2019 11:11:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on062a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::62a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A78A86EC97 for ; Tue, 22 Jan 2019 11:11:38 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB2085.eurprd08.prod.outlook.com (10.168.86.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.26; Tue, 22 Jan 2019 11:11:35 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:35 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 08/11] drm/komeda: Add komeda_crtc_funcs Thread-Topic: [PATCH v2 08/11] drm/komeda: Add komeda_crtc_funcs Thread-Index: AQHUskM8rTJckBFvX02tgR37OXQTZg== Date: Tue, 22 Jan 2019 11:11:35 +0000 Message-ID: <20190122110932.5138-9-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB2085; 6:oFZ1dUbJTXue6o3dgjYSQHBaIQu6HpA2miKDuV6cwepbPorGTtFXFJ2IMSLBnpStRWDlRgEOhN7Oq7VwQmE5Q1oTwZhrrbFf2Vvo+P87aEI5FXbBwVHORaLSkkr01i8Czd8aSLa8eh05ZMgsmWp913AyNwKwGoCUOhT27XaIjHeI2uG4tFaiNWL89iTlP49pKfOq4qeoyx6PfwoAK4TJIzaw6DmfZUsUNFKtKUDMoYqq5QNfWpYH2aKFpIFfWobcIWFW0XjmRwR+MvgEJAycOyzAWPsqIsRwAF4YEiTOTcaSxKIywldr9jNfbTmhRfWNGgiaAl+Ct/vl8LRpCjPnrDvvqMZsGXJT7qEV2KtBcxzGMmItHk8wi+4MQwExXlV5O201rY/yUxRThMcP1RnFmzh6TIe6fy+LvKR91Qv2eLXOeZi7Oxxw0IxKRAlf3BoggWxS0+qGn+hJMECiJVIXYg==; 5:R2e/OnwQjxhlmFu5R9CBs8G61UCW7zUkAaCtUCT6KJCGIHVKPNta3G5fVUTjyrHTlZPNVuxNqtOoeo0jIvmm0sbQkZ1G4XG5vERIMagaKoEoXPOi2AEpu3Kwc41O40mrrYhMbirUiBTlO3Q9b5SmRO2TodaEUCj7D7hUSQT6X+JnU9QMer+CbUNWA+j9QizZNm+c7vu8BAReRd/kHUeqBA==; 7:vAwUUJ0Nw3DDnBddePiUg3WYNl/X29tZJtaL78xLKmrVpWVH02z/DMISH6TeJnrOyqCwD3UP5K27kC5T5CVC2BWVsktjB+ejfVPT2ZEQkOjrrB/RRIkQYpFYOL3Mt7mNNlYzayBlR0H7imicVsUEAw== x-ms-office365-filtering-correlation-id: 96b0ed87-77db-4c9b-37fa-08d6805a5e96 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB2085; x-ms-traffictypediagnostic: DB6PR0801MB2085: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(366004)(396003)(136003)(189003)(199004)(316002)(110136005)(11346002)(71200400001)(99286004)(6512007)(53936002)(36756003)(2501003)(4326008)(25786009)(26005)(478600001)(71190400001)(446003)(476003)(2616005)(486006)(54906003)(186003)(1076003)(68736007)(86362001)(2906002)(6486002)(52116002)(6436002)(103116003)(6506007)(6116002)(97736004)(386003)(14454004)(102836004)(55236004)(105586002)(305945005)(7736002)(76176011)(106356001)(81156014)(81166006)(6636002)(66066001)(50226002)(8676002)(256004)(3846002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB2085; H:DB6PR0801MB1990.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-message-info: xYZF+AHm1PcjBHuH0w3VSuN0A3jT7C8UpLDcjN6jgPZ0PMdAVW+XhnxUkA/0AJcF3vkRH0udIbguXyTvp02CLg5dQt5JKRwAFTt3upPkEjmzysjdJgwOWtJqwb7EbzmJzXO/cX8MyeEvvdIYK210dfggXA5njyOfVUrAIpX4wDad4m/1TrDDYT07Vd9TKgKNXfkG/vujzDCuaQo46J3HmRGcFs0GxXAfBNMyORs0vF7+vrjrgVK2AZpj2duuAy15relTrYD75WZ+kRIjkqigTW9V3uUKWsahgn0AwgXMlA9QYjS+qyjJioBZpK4JH8gu9AP4UTSQsR4zgCVFHpp+9jqceuc7ABfYlLu8+J0FigluHKlolZlpLkM1xfnr/nNHwTP30jFJnYRqtcj2a5erm1TXO35E9oKFI5ArRT9U0Js= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96b0ed87-77db-4c9b-37fa-08d6805a5e96 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:25.9005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2085 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Added functions: - komeda_crtc_reset - komeda_crtc_vblank_enable - komeda_crtc_vblank_disable Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index e19ba9468d31..7adda663b956 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -347,6 +347,47 @@ struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { .mode_fixup = komeda_crtc_mode_fixup, }; +static void komeda_crtc_reset(struct drm_crtc *crtc) +{ + struct komeda_crtc_state *state; + + if (crtc->state) + __drm_atomic_helper_crtc_destroy_state(crtc->state); + + kfree(to_kcrtc_st(crtc->state)); + crtc->state = NULL; + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (state) { + crtc->state = &state->base; + crtc->state->crtc = crtc; + } +} + +static struct drm_crtc_state * +komeda_crtc_atomic_duplicate_state(struct drm_crtc *crtc) +{ + struct komeda_crtc_state *old = to_kcrtc_st(crtc->state); + struct komeda_crtc_state *new; + + new = kzalloc(sizeof(*new), GFP_KERNEL); + if (!new) + return NULL; + + __drm_atomic_helper_crtc_duplicate_state(crtc, &new->base); + + new->affected_pipes = old->active_pipes; + + return &new->base; +} + +static void komeda_crtc_atomic_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + __drm_atomic_helper_crtc_destroy_state(state); + kfree(to_kcrtc_st(state)); +} + static int komeda_crtc_vblank_enable(struct drm_crtc *crtc) { struct komeda_dev *mdev = crtc->dev->dev_private; @@ -365,6 +406,13 @@ static void komeda_crtc_vblank_disable(struct drm_crtc *crtc) } static const struct drm_crtc_funcs komeda_crtc_funcs = { + .gamma_set = drm_atomic_helper_legacy_gamma_set, + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .reset = komeda_crtc_reset, + .atomic_duplicate_state = komeda_crtc_atomic_duplicate_state, + .atomic_destroy_state = komeda_crtc_atomic_destroy_state, .enable_vblank = komeda_crtc_vblank_enable, .disable_vblank = komeda_crtc_vblank_disable, }; From patchwork Tue Jan 22 11:11:44 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: 10775393 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 6637117F0 for ; Tue, 22 Jan 2019 11:11:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54B582A1B7 for ; Tue, 22 Jan 2019 11:11:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 475E42A1E2; Tue, 22 Jan 2019 11:11:50 +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 2F4092A1B7 for ; Tue, 22 Jan 2019 11:11:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D5E66EC91; Tue, 22 Jan 2019 11:11:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDF636EC9F for ; Tue, 22 Jan 2019 11:11:46 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1286.eurprd08.prod.outlook.com (10.168.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:11:44 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:44 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 09/11] drm/komeda: Add komeda_kms_check Thread-Topic: [PATCH v2 09/11] drm/komeda: Add komeda_kms_check Thread-Index: AQHUskNCu8FeIJKzIEuJggezM8JI7g== Date: Tue, 22 Jan 2019 11:11:44 +0000 Message-ID: <20190122110932.5138-10-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1286; 6:qriucuHmFFLBjlPbX4sTxjyMp+wjN6NPXXyhe5Ugwl9zDh1Gh/MV2V3pTpTR+utmEWLAbkDwAAhkY3qrDChT7Pa329I1z1bvg/V8bgkEN9ZgjJm1MqrmEtJxD6BNt/faLo+w1f9UjSnpRd0AbqCB8El6C6KL1wMK53SxWHM+DInbpnJ7t0+VuQt2ANKvwBpx68+AnsSGzpTlb0OJA5lROoq+R+tqlfkE+VxbJxsHnTkCp811G64JDcALNedClqS0lJRUl8n3N1qFZXO/e7Y3CoGMuiMjzEl86Cl1H9FJdAcdZEpFj1x+YHhgCRxe5EfIuMBxqArkQg//A6TuEQBe6PY+nZO+AgjUhcGWv9+Jx/kCE71G/ET6jm4kHYy4BFbdYjVmRezprEqEfMqmipr2Q512hiojARhEXFn/dXMVaZMVvnUDbpG9GyRV9qTnEjBV5YerHmXWS6WaU3SQSgsd2g==; 5:CAe710MQRQo0uo1/VkyI11e6N0L7hzbpNvbzXYMfAZJ3M7NPAiUZvd4MAgBC+SQO3JVRRtyI3QbwAHAEEFUi2KJIKH34xLEVIGm91KaS7igBqfGvg/L+Da7WwGFyGPIPCmXyrui2PKgZgPF7DKT4hPWWoYHwzOrTu7JcXpu6oMkMSkAQy1VI3b2aBkXC1Ci8L2IxQyRr8S+S8vFj/RDO2A==; 7:JXHElrvdqB2voOc0h5QrFofcp9dIRkSnvXgI4FgEkWHShyx+h983CT60RTNFisgLU0X0OBiThxp0+Iahti2UGfgM1wzdN+8qXRZhVF3P0//cKxH7KtcW8GBto7oGraB05UwkLERN43wGWSzwRTgJtA== x-ms-office365-filtering-correlation-id: 4df326bb-4176-47e7-bb02-08d6805a646a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1286; x-ms-traffictypediagnostic: DB6PR0801MB1286: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(6636002)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(14444005)(256004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1286; H:DB6PR0801MB1990.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: goUE2/FR2OPzqzI7C/9alId14UPKNF2AQD1YDLJBGO89l7PmNl7P+cJL5Xl3ethTiZ6SXDnmK5MxK794MNO78sM70doxCVjHXkeS87XqSAdp7LM05+IaW1FzEsrmSwbM5lJ0STjOGSPUr81jcpkeJk/uknzE5M+eOUrTBD0s1QrvKUyiEfzBHXeqWv+W6PPcftwx3nGRCPa4pmICwIAOndA7Ox7ZFCxf2niRE8fqNCRQ+pPGGHikkrj4Aa7Pg29dhb2tzJosvQVJkHZJ/8IItS6sF8PiQjOyJiRwDycTejqrSiJe+R20L/y/FQiPJ2J6hD5NBHi50Pzjoo89p0AVonRtBLLIog2bmPsK6lRXYoZCxkgJkSZTYzwznL46rn0Ew8b4wohCqz3+0NZQolMDp1F9su9UrQWzNiLoRvckMV8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4df326bb-4176-47e7-bb02-08d6805a646a X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:35.8694 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1286 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Implement komeda_kms_check to add all affected_planes (even unchanged) to drm_atomic_state. since komeda need to re-calculate the resources assumption in every commit. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_kms.c | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 7d7fb5013464..337e6fddead0 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -95,9 +95,37 @@ static const struct drm_mode_config_helper_funcs komeda_mode_config_helpers = { .atomic_commit_tail = komeda_kms_commit_tail, }; +static int komeda_kms_check(struct drm_device *dev, + struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *old_crtc_st, *new_crtc_st; + int i, err; + + err = drm_atomic_helper_check_modeset(dev, state); + if (err) + return err; + + /* komeda need to re-calculate resource assumption in every commit + * so need to add all affected_planes (even unchanged) to + * drm_atomic_state. + */ + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_st, new_crtc_st, i) { + err = drm_atomic_add_affected_planes(state, crtc); + if (err) + return err; + } + + err = drm_atomic_helper_check_planes(dev, state); + if (err) + return err; + + return 0; +} + static const struct drm_mode_config_funcs komeda_mode_config_funcs = { .fb_create = komeda_fb_create, - .atomic_check = drm_atomic_helper_check, + .atomic_check = komeda_kms_check, .atomic_commit = drm_atomic_helper_commit, }; From patchwork Tue Jan 22 11:11:53 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: 10775395 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 0B45491E for ; Tue, 22 Jan 2019 11:12:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE8862A1BB for ; Tue, 22 Jan 2019 11:12:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E20342A1F7; Tue, 22 Jan 2019 11:12:00 +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 75C512A1BB for ; Tue, 22 Jan 2019 11:12:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5828C6EC98; Tue, 22 Jan 2019 11:11:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on062a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::62a]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6B1E6EC98 for ; Tue, 22 Jan 2019 11:11:57 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1352.eurprd08.prod.outlook.com (10.168.11.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:11:53 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:11:53 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 10/11] drm/komeda: Add sysfs attribute: core_id and config_id Thread-Topic: [PATCH v2 10/11] drm/komeda: Add sysfs attribute: core_id and config_id Thread-Index: AQHUskNHnZZz5PyQ/k2C8sILEn4p3w== Date: Tue, 22 Jan 2019 11:11:53 +0000 Message-ID: <20190122110932.5138-11-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1352; 6:s9kD5ACpBgEuhDAZAyMFC2i3SaiHrPH3HmYNeRwiKkxpGu0O8dMG5G214hLhoqz4zuf58nQo450dkbdOa8MBo12jPeOvN3BbXBZuxDTrZ7jJXStRQ5bFy7hDNvIkdbb1jbgSCUpYJPgiDZiMusRajuHSIvpMehnGebv8fcPi0X4J9kHr5CfEZQa1NQ9vhJDa6bz3LAs7eUpJSqQkq/vO1eJ8pUbgTuDvwEPPnjNJfjd+rbkQQBVrj5MwIsWzKxgxGKFzd+6OEROI9rBN/IY0T68SUw1f5QWyrhyH+UUVNk9Kw/HpVlAOVe/MY9Q0F3qNdljlxdmLkfrioFkABOTeboV+QzTf3sIlvUo3K725h8O+2NhfUsae0v5fXD1s+2PbQI9P1/VxvqAHkliZuLP4EczpzjflzQuTX/bRKGJVmB77cFwOwQMSMEx8MmqvQeyMfNI6/YMkK41omY9qSu4eYQ==; 5:uK1YuvDBM31C6m///u4zFBSiIoag4hmdXx2wCdsz0QODErVKTw4cDRlE8/LUrbhKSoFo3ld+RLcj9N1O2i1f8UaovtZ7C2r1RuWyU5FBNbzz33ygRtcBIa6cjZzRPBrYDwdlTH1vjomARvDp2VHQ3l5LmFONCWwBD1bRz4koX0OzdJ0hRSErJZGKLEo7TTmZabzY8kBa7u6X/C0JyDZkvw==; 7:Rt8HPA91k6a350ZKyRkwzHkpKbZZDcSHGJgJbtDgOfVU+ABlqC1PovXm4lqBIY6b0wQxr5nZX20/8VCtZYdk9PbwLRYUeSL2VDTLLxxayMXzc6rlPYA76NCrUonFxjwXKvhQncdcKEeBbc5BRRMyCg== x-ms-office365-filtering-correlation-id: 2dcfaa57-e7a6-4330-7d73-08d6805a69dd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1352; x-ms-traffictypediagnostic: DB6PR0801MB1352: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(136003)(39860400002)(366004)(199004)(189003)(446003)(26005)(76176011)(71200400001)(103116003)(2501003)(81156014)(81166006)(36756003)(6486002)(99286004)(97736004)(54906003)(110136005)(6506007)(386003)(6436002)(102836004)(3846002)(2906002)(6116002)(478600001)(305945005)(186003)(256004)(14454004)(71190400001)(316002)(1076003)(55236004)(11346002)(52116002)(53936002)(66066001)(25786009)(6512007)(486006)(8676002)(86362001)(7736002)(476003)(4326008)(2616005)(105586002)(106356001)(6636002)(8936002)(50226002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1352; H:DB6PR0801MB1990.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: R84cdJAJJrgUOHSs/LJ7KgLlm2V9kGlJEb/bBKrIL6yneust0tyYoH8mWLg67B4xTvizYY56EYbv+Q3ZJXgI89sU1GZHUQseNtD7AHCuC/ADIKDTBabiZG+38qzrTkFEMeENabiNRi0p6RX8cvIh0QuiZ7oIU5npY9lnXNz1b0TzfHasUzOgF5BRVZHgpi1jTICaieAJ6ll0QNyY54dNcEQIUGyUTYmMy7gy9C5RfKWos/9YjQKd6/fK9lZgiUoBru4a8vhcPw0dv9QRGuF6B1gESHMhVC1DJ0JjfE6OHGL7zC0pXHoCfjXYH/tp7/5VhTQ7cnZxHopCrW76URgYl1/A50hJGJ8tqk6RHyZjr1rhb99P07rLLdukSX/wTdKwXOAwMvt3xIPjnA9Lnr3UcKyECINbtk+Bwp/0vC5vPHI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2dcfaa57-e7a6-4330-7d73-08d6805a69dd X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:45.0100 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1352 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" Add two sysfs node: core_id, config_id, user can read them to fetch the HW product information. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../drm/arm/display/include/malidp_product.h | 12 +++++ .../gpu/drm/arm/display/komeda/komeda_dev.c | 48 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 2 + .../gpu/drm/arm/display/komeda/komeda_drv.c | 7 +++ 4 files changed, 69 insertions(+) diff --git a/drivers/gpu/drm/arm/display/include/malidp_product.h b/drivers/gpu/drm/arm/display/include/malidp_product.h index b35fc5db866b..1053b11352eb 100644 --- a/drivers/gpu/drm/arm/display/include/malidp_product.h +++ b/drivers/gpu/drm/arm/display/include/malidp_product.h @@ -20,4 +20,16 @@ /* Mali-display product IDs */ #define MALIDP_D71_PRODUCT_ID 0x0071 +union komeda_config_id { + struct { + __u32 max_line_sz:16, + n_pipelines:2, + n_scalers:2, /* number of scalers per pipeline */ + n_layers:3, /* number of layers per pipeline */ + n_richs:3, /* number of rich layers per pipeline */ + reserved_bits:6; + }; + __u32 value; +}; + #endif /* _MALIDP_PRODUCT_H_ */ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index 7152f2c08e01..9e017ce89d69 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -53,6 +53,46 @@ static void komeda_debugfs_init(struct komeda_dev *mdev) mdev, &komeda_register_fops); } +static ssize_t +core_id_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct komeda_dev *mdev = dev_to_mdev(dev); + + return snprintf(buf, PAGE_SIZE, "0x%08x\n", mdev->chip.core_id); +} +static DEVICE_ATTR_RO(core_id); + +static ssize_t +config_id_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct komeda_dev *mdev = dev_to_mdev(dev); + struct komeda_pipeline *pipe = mdev->pipelines[0]; + union komeda_config_id config_id = {0,}; + int i; + + config_id.max_line_sz = pipe->layers[0]->hsize_in.end; + config_id.n_pipelines = mdev->n_pipelines; + config_id.n_scalers = pipe->n_scalers; + config_id.n_layers = pipe->n_layers; + config_id.n_richs = 0; + for (i = 0; i < pipe->n_layers; i++) { + if (pipe->layers[i]->layer_type == KOMEDA_FMT_RICH_LAYER) + config_id.n_richs++; + } + return snprintf(buf, PAGE_SIZE, "0x%08x\n", config_id.value); +} +static DEVICE_ATTR_RO(config_id); + +static struct attribute *komeda_sysfs_entries[] = { + &dev_attr_core_id.attr, + &dev_attr_config_id.attr, + NULL, +}; + +static struct attribute_group komeda_sysfs_attr_group = { + .attrs = komeda_sysfs_entries, +}; + static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) { struct komeda_pipeline *pipe; @@ -201,6 +241,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev) goto err_cleanup; } + err = sysfs_create_group(&dev->kobj, &komeda_sysfs_attr_group); + if (err) { + DRM_ERROR("create sysfs group failed.\n"); + goto err_cleanup; + } + #ifdef CONFIG_DEBUG_FS komeda_debugfs_init(mdev); #endif @@ -218,6 +264,8 @@ void komeda_dev_destroy(struct komeda_dev *mdev) struct komeda_dev_funcs *funcs = mdev->funcs; int i; + sysfs_remove_group(&dev->kobj, &komeda_sysfs_attr_group); + #ifdef CONFIG_DEBUG_FS debugfs_remove_recursive(mdev->debugfs_root); #endif diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 8acd25afb3e9..0c3e32b596d9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -190,4 +190,6 @@ d71_identify(u32 __iomem *reg, struct komeda_chip_info *chip); struct komeda_dev *komeda_dev_create(struct device *dev); void komeda_dev_destroy(struct komeda_dev *mdev); +struct komeda_dev *dev_to_mdev(struct device *dev); + #endif /*_KOMEDA_DEV_H_*/ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index 2bdd189b041d..0285fd37a016 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -17,6 +17,13 @@ struct komeda_drv { struct komeda_kms_dev *kms; }; +struct komeda_dev *dev_to_mdev(struct device *dev) +{ + struct komeda_drv *mdrv = dev_get_drvdata(dev); + + return mdrv ? mdrv->mdev : NULL; +} + static void komeda_unbind(struct device *dev) { struct komeda_drv *mdrv = dev_get_drvdata(dev); From patchwork Tue Jan 22 11:12:02 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: 10775397 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 6B66017F0 for ; Tue, 22 Jan 2019 11:12:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B5002A1E2 for ; Tue, 22 Jan 2019 11:12:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C30B2A209; Tue, 22 Jan 2019 11:12:08 +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 F12E12A1E2 for ; Tue, 22 Jan 2019 11:12:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A99B6EC99; Tue, 22 Jan 2019 11:12:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::60d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A2AFE6EC99 for ; Tue, 22 Jan 2019 11:12:05 +0000 (UTC) Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB2085.eurprd08.prod.outlook.com (10.168.86.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.26; Tue, 22 Jan 2019 11:12:02 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:12:02 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v2 11/11] drm/komeda: Expose bus_width to Komeda-CORE Thread-Topic: [PATCH v2 11/11] drm/komeda: Expose bus_width to Komeda-CORE Thread-Index: AQHUskNN9SGO4YEklkqblbMQ2M6ApQ== Date: Tue, 22 Jan 2019 11:12:02 +0000 Message-ID: <20190122110932.5138-12-james.qian.wang@arm.com> References: <20190122110932.5138-1-james.qian.wang@arm.com> In-Reply-To: <20190122110932.5138-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: SYAPR01CA0034.ausprd01.prod.outlook.com (2603:10c6:1:1::22) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB2085; 6:nyGqCDmLRFqnR22fKXl8O03IMvJ8uscuD1khTfz8lmBP5KXsK2ojTNT1WABjF9Heq9uRFQpRFuhgOi/y1tuMJ45HhGs502f3IKp7yFXGc54vkDXsSJ0dCTg4QHu/d7E4BOpBiDzzfG1x0zOIpkH+YmTSyLmX00mEn8kvY7pLiTCB5qVfOmcpX9nxS42rJCYaK23yoQEdHeWIrs7IVFaO8XzNoZ5YAIuAIZbzPkwB2juAJWcERcnRlQTSI/DnBMEuQzz6aPn/EDZfbex9ZQD4BuaGidDRenfLnON/zZ14rnWMRPpTKkF0gDTpds5A5GGQbVDxctoASRjnGjrKKxJFdOym0aCZEd9DOw1jaRLf9FxN5RJ5qkBneCu50veu3QaC4Hmk6PV07aq7AqKtD9vVylfjUeX+YJBAejwvE83AbV1DSBqBMveYyb4XxBCjGe4wHO/ExupzepOy9jDefUibqA==; 5:triTfbrJMVV+AU/IujoRJqU1plsLu629d3MkOhlScX80cjsw5luhNGrOAqkFEi4On3TpOfywMOqW0Bipk2riBry59nQgmpsAAIcYm4VyXQx1GdfBusbE4OSAgWmX6KIeq2RIAHG2NtjQF5OZPHmC/Rp8XnVUPA6Ava0Nq1G5NicY2hgBRNlFTv+gR2enaTAofqm1s5V38eW2MAJR1t4WHA==; 7:79VvgADO/Qf9SAWMMrq+JMqo0ciS+TTdB4QTDyfQTo8pa/KOCMV3bd5OHq1v074qyVT0XaDBRGdPU5Sia/FVV77diVzIcR83gObhwGmWnwcidNe3tiYmQLp5Eo4BwYxGEDG3CH5tfQBLmHyDPZ+EhA== x-ms-office365-filtering-correlation-id: 98d6943d-0550-48b1-ca9f-08d6805a6f3a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB2085; x-ms-traffictypediagnostic: DB6PR0801MB2085: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(366004)(396003)(136003)(189003)(199004)(316002)(110136005)(11346002)(71200400001)(99286004)(6512007)(53936002)(36756003)(2501003)(4326008)(25786009)(26005)(478600001)(71190400001)(446003)(476003)(2616005)(486006)(54906003)(186003)(1076003)(68736007)(86362001)(2906002)(6486002)(52116002)(6436002)(103116003)(6506007)(6116002)(97736004)(386003)(14454004)(102836004)(55236004)(105586002)(305945005)(7736002)(76176011)(106356001)(81156014)(81166006)(6636002)(66066001)(50226002)(8676002)(256004)(3846002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB2085; H:DB6PR0801MB1990.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-message-info: rbkcqTcm7QVUych8fAWFntSRQLwk8a/p7fzmvk0J3ncQXK7TdY+4P/WdF3Vgo5champ45gZXVTSOIGyO8NehXztaRYvkJhLbqE6tXIzsd7+8RmXxPAGBF4htBmnE0S9WbDwzPdKCWvDgZHveiQYfW1rAgLUAgJ2FlanK/fo7lcGpy+H5vPO++oU+Z0hBAXsyte8aPi7AiFgA/W52ItrmdVVjnnF6IldBvpE/GbFGKC4oYo30lSAG/I9DlkfO1QbqpgrVjJc1TLWK1bgobZSGXGUBWph/yTwkalrE5fI85m0dL1biWYDf6cTQHYJ4Tmap+/HUyovAa9hty0s5bzCY07shIAsyO8noYYh8/JioDxJun7sLWI+qO3SJ4IVx0mUs3V/eiShVCqOkHxHrIerXIqokG6Pvsjb+VejFPoBqELY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98d6943d-0550-48b1-ca9f-08d6805a6f3a X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:11:54.0101 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2085 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\)" , "malidp@foss.arm.com" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Jin Gao \(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 From: "james qian wang (Arm Technology China)" CHIP set bus_width according to the HW configuration, and CORE will use it as buffer alignment. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 1 + drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index f517ab0ceae9..a6ca3ff16fef 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -518,6 +518,7 @@ d71_identify(u32 __iomem *reg_base, struct komeda_chip_info *chip) chip->arch_id = malidp_read32(reg_base, GLB_ARCH_ID); chip->core_id = malidp_read32(reg_base, GLB_CORE_ID); chip->core_info = malidp_read32(reg_base, GLB_CORE_INFO); + chip->bus_width = D71_BUS_WIDTH_16_BYTES; return &d71_chip_funcs; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 337e6fddead0..ed54beaee2f9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -21,10 +21,10 @@ static int komeda_gem_cma_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { - u32 alignment = 16; /* TODO get alignment from dev */ + struct komeda_dev *mdev = dev->dev_private; + u32 pitch = DIV_ROUND_UP(args->width * args->bpp, 8); - args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8), - alignment); + args->pitch = ALIGN(pitch, mdev->chip.bus_width); return drm_gem_cma_dumb_create_internal(file, dev, args); }