From patchwork Wed Jul 31 11:04:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11067501 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 548CE746 for ; Wed, 31 Jul 2019 11:05:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38E7A209CE for ; Wed, 31 Jul 2019 11:05:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B614288EF; Wed, 31 Jul 2019 11:05:05 +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 9D22C209CE for ; Wed, 31 Jul 2019 11:05:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E18189AC6; Wed, 31 Jul 2019 11:05:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03on061c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe09::61c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5ABB789AC6 for ; Wed, 31 Jul 2019 11:05:01 +0000 (UTC) Received: from VI1PR08CA0185.eurprd08.prod.outlook.com (2603:10a6:800:d2::15) by AM0PR08MB4948.eurprd08.prod.outlook.com (2603:10a6:208:163::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.14; Wed, 31 Jul 2019 11:04:57 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::202) by VI1PR08CA0185.outlook.office365.com (2603:10a6:800:d2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2136.12 via Frontend Transport; Wed, 31 Jul 2019 11:04:57 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Wed, 31 Jul 2019 11:04:55 +0000 Received: ("Tessian outbound 71602e13cd49:v26"); Wed, 31 Jul 2019 11:04:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bde33b5ab3e1aaf6 X-CR-MTA-TID: 64aa7808 Received: from bb723fe09053.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 605E3197-38F3-4DFA-9B7F-B076A514BC2D.1; Wed, 31 Jul 2019 11:04:42 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2051.outbound.protection.outlook.com [104.47.9.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bb723fe09053.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Wed, 31 Jul 2019 11:04:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CIWkv8KxOPf/yJ12N1e+YoRx0wAVkEwXLBptYvPNcJds9gZ3caQVb7+PC4dRD0w0IAwFuB2VGmjfvuKwz5ZLXJ4ABOTTP2Vfh/ADg8ip3qATe39PSKLM+Fkimrj5lKsGE/aGOzB3vJhgwphOYr7jMjqSwt5vjmrZiOxn6wy0zEHEjqSYQs4vmkUtSwXrMqJ9MHFJLVnnGwfr++kWk5vKdhrq+nJpvfWMFOIQb9ZUIY9N2/j+8z5bNPZw7SEwBen/Fxt9W8HhdWaRct5ZTyLz0IfDcxqYej1PQqJc7mklul5w/r8dSo926xwlA/MXCrEtwn4p3ovqGkPc7XKVS1AGlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=04/pGjJWhVQqP9E2zDDWKifzlhklY7KxiJnZhr7cGTA=; b=AWQaQDdmP4LqACa8LCJa9kjk4PEqcHT9AbRtl4pc3ff6wwhMbZe1NUy6w7WU9NyAhfEkr0DoAg9/PTB16RXN3lufrVQDxxnRgFRcWJaCPrQ8xhUTrF1bdUkn3FSYSid/DVtgTXJzUria2VIwHtRqJ7JJ06SirJw9rOk7NE38GtN/TQsoPqVUfN7AFDNdgCrydLvjKptEFNHYYMeSvM3rdFVqt7AYHAf07wwXMIbKDgqTXQDVQo4DwJhdzxwSbkAzm+4XYw9P7cljgClyUQSvawbruTfs1z7WE8ZZuMzW/3dL6JBh6N2UlZBRaThKt/y5b0Mt5s4hS2nFM4JpYnNgrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB3277.eurprd08.prod.outlook.com (52.134.30.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.15; Wed, 31 Jul 2019 11:04:39 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236%2]) with mapi id 15.20.2115.005; Wed, 31 Jul 2019 11:04:39 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , "daniel@ffwll.ch" , Brian Starkey Subject: [PATCH v1 1/2] drm: Free the writeback_job when it with an empty fb Thread-Topic: [PATCH v1 1/2] drm: Free the writeback_job when it with an empty fb Thread-Index: AQHVR4++ZQXRcCwwSUeRbKZ2hesp5g== Date: Wed, 31 Jul 2019 11:04:38 +0000 Message-ID: <1564571048-15029-2-git-send-email-lowry.li@arm.com> References: <1564571048-15029-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1564571048-15029-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: bf7c62e6-c832-4a2d-0b08-08d715a6eba6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3277; X-MS-TrafficTypeDiagnostic: VI1PR08MB3277:|AM0PR08MB4948: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:51;OLM:51; x-forefront-prvs: 011579F31F X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(346002)(376002)(366004)(396003)(199004)(189003)(66066001)(6506007)(386003)(102836004)(256004)(99286004)(7416002)(55236004)(5660300002)(71200400001)(71190400001)(52116002)(478600001)(446003)(25786009)(53936002)(6512007)(2501003)(486006)(86362001)(3846002)(2906002)(476003)(4326008)(11346002)(2616005)(6116002)(81156014)(81166006)(68736007)(8676002)(6486002)(50226002)(7736002)(305945005)(64756008)(66446008)(66556008)(66476007)(66946007)(76176011)(14454004)(2201001)(36756003)(316002)(54906003)(110136005)(26005)(6436002)(6636002)(8936002)(186003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3277; H:VI1PR08MB5488.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-Original: 9GAulN+Mfv3Bpdr9b2MuGoz5KCMe6el24Mp1s+W8k8hr7TyjLJZtd/MDbq2tKxQB33px8GgoHBIE6dOUO/Vr6LmCgMY2ILB+TuC79wnMEd4MGZW5Wl93ibUTl6lcubQ9osUm2ckkwo2eLq1xAHzG+54bUz6+xKkVDvrgyreqyDZZvpN8zKYnEZKhVIUCqT67S/HQN1XiMdE/Pm9A0EAwgpkDKUsR0Crbq2UNiq+jTbp9jM9RO6HHhUFPXJHqAB3RT6SWBAJy+XAx1vQm6lMR3DWgBf3ECZnxTTbfyb12hP8F+p4g7ZqStgdrHH4f+dAomL34kgxCuIW/tiklSf2oFMlf484hu7K38uArAfk9iQh9V5PTrX9dorhbubn7sfueyZtgBqNUibTfxEqrrMOvTM08XHAWpTVjNDKiU4pIjLI= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3277 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(346002)(39860400002)(2980300002)(189003)(199004)(476003)(70206006)(6512007)(8676002)(26826003)(86362001)(478600001)(36756003)(6636002)(356004)(5660300002)(126002)(50466002)(70586007)(6486002)(76130400001)(486006)(2201001)(23756003)(446003)(2501003)(316002)(99286004)(2616005)(336012)(14454004)(11346002)(26005)(63350400001)(63370400001)(305945005)(102836004)(7736002)(6116002)(3846002)(25786009)(76176011)(2906002)(81156014)(81166006)(110136005)(386003)(6506007)(186003)(8936002)(8746002)(4326008)(54906003)(22756006)(66066001)(50226002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB4948; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: cffc6c92-4413-4819-1729-08d715a6e10c X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM0PR08MB4948; NoDisclaimer: True X-Forefront-PRVS: 011579F31F X-Microsoft-Antispam-Message-Info: CZooz7TFLlRzy4/eSTpvfaX3Nn60wB5J6hErsBk5JpcsfqI87Ks2v8qTNJ5JYgcDGMRbQWVvVx2ObST0k1mWgn7zfYMi1LdrgBi96VBY/YDXyfsm21JwIUofY2KpieH2+irWNZI5NLcdMWc7ofxUR+IHcQ7AdmLHmnIRIeGHBvOZCUZNGhEtOqNN23f884cZIyrWlVDmtXH+gB1V2LygbetCKceEIeP23PRJY10Y+ZFxtOBudKXSttImg/5R3s00sXula3KtQ+0yGEcELLdoA9RSC5CB5OoYfeEOBjDTJ/Vv7N0Vk1WNM4IJPgMPjwa5oAQX5y+Lmq18quHn1DNROuq0hWB78hk8dX3gfbtNV6/UreNPl0+C35M5XRkzGC4ooIoIwkO+e9xv0EDMrX8aEv3kRwyNH8KMwLHPF+aYbt0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2019 11:04:55.7956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf7c62e6-c832-4a2d-0b08-08d715a6eba6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4948 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=04/pGjJWhVQqP9E2zDDWKifzlhklY7KxiJnZhr7cGTA=; b=E7ebuFvkbTjAUaKPJgPRhwxtibO/xalGiFHtFCaDAoc8lhXQ8VGQgmb5a7QTnAU2bE31mMXDyzS7/Ft0iMUnMf2V2CdQPWuJqijoWsSy+uW6zs4Ef0lMuo/riQqbmQfXKcysecQDgLjpURjMWmt/9K9/EtCE/hMPd27VHd4ohq8= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=04/pGjJWhVQqP9E2zDDWKifzlhklY7KxiJnZhr7cGTA=; b=E7ebuFvkbTjAUaKPJgPRhwxtibO/xalGiFHtFCaDAoc8lhXQ8VGQgmb5a7QTnAU2bE31mMXDyzS7/Ft0iMUnMf2V2CdQPWuJqijoWsSy+uW6zs4Ef0lMuo/riQqbmQfXKcysecQDgLjpURjMWmt/9K9/EtCE/hMPd27VHd4ohq8= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-renesas-soc@vger.kernel.org" , nd , "maxime.ripard@bootlin.com" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "kieran.bingham+renesas@ideasonboard.com" , "laurent.pinchart@ideasonboard.com" , Ayan Halder , "sean@poorly.run" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Lowry Li (Arm Technology China)" Adds the check if the writeback_job with an empty fb, then it should be freed in atomic_check phase. With this change, the driver users will not check empty fb case any more. So refined accordingly. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Liviu Dudau Reviewed-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | 3 +-- drivers/gpu/drm/arm/malidp_mw.c | 4 ++-- drivers/gpu/drm/drm_atomic.c | 13 +++++++++---- drivers/gpu/drm/rcar-du/rcar_du_writeback.c | 4 ++-- drivers/gpu/drm/vc4/vc4_txp.c | 5 ++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c index 617e1f7..d6103dd 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c @@ -43,9 +43,8 @@ struct komeda_data_flow_cfg dflow; int err; - if (!writeback_job || !writeback_job->fb) { + if (!writeback_job) return 0; - } if (!crtc_st->active) { DRM_DEBUG_ATOMIC("Cannot write the composition result out on a inactive CRTC.\n"); diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index 2e81252..a59227b 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -130,7 +130,7 @@ static void malidp_mw_connector_destroy(struct drm_connector *connector) struct drm_framebuffer *fb; int i, n_planes; - if (!conn_state->writeback_job || !conn_state->writeback_job->fb) + if (!conn_state->writeback_job) return 0; fb = conn_state->writeback_job->fb; @@ -247,7 +247,7 @@ void malidp_mw_atomic_commit(struct drm_device *drm, mw_state = to_mw_state(conn_state); - if (conn_state->writeback_job && conn_state->writeback_job->fb) { + if (conn_state->writeback_job) { struct drm_framebuffer *fb = conn_state->writeback_job->fb; DRM_DEV_DEBUG_DRIVER(drm->dev, diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 419381a..14aeaf7 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -430,10 +430,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector, return -EINVAL; } - if (writeback_job->out_fence && !writeback_job->fb) { - DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", - connector->base.id, connector->name); - return -EINVAL; + if (!writeback_job->fb) { + if (writeback_job->out_fence) { + DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", + connector->base.id, connector->name); + return -EINVAL; + } + + drm_writeback_cleanup_job(writeback_job); + state->writeback_job = NULL; } return 0; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c index ae07290..04efa78d 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_writeback.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_writeback.c @@ -147,7 +147,7 @@ static int rcar_du_wb_enc_atomic_check(struct drm_encoder *encoder, struct drm_device *dev = encoder->dev; struct drm_framebuffer *fb; - if (!conn_state->writeback_job || !conn_state->writeback_job->fb) + if (!conn_state->writeback_job) return 0; fb = conn_state->writeback_job->fb; @@ -221,7 +221,7 @@ void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc, unsigned int i; state = rcrtc->writeback.base.state; - if (!state || !state->writeback_job || !state->writeback_job->fb) + if (!state || !state->writeback_job) return; fb = state->writeback_job->fb; diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index 96f91c1..e92fa12 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -229,7 +229,7 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn, int i; conn_state = drm_atomic_get_new_connector_state(state, conn); - if (!conn_state->writeback_job || !conn_state->writeback_job->fb) + if (!conn_state->writeback_job) return 0; crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); @@ -269,8 +269,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn, u32 ctrl; int i; - if (WARN_ON(!conn_state->writeback_job || - !conn_state->writeback_job->fb)) + if (WARN_ON(!conn_state->writeback_job)) return; mode = &conn_state->crtc->state->adjusted_mode; From patchwork Wed Jul 31 11:04:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 11067503 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 040C9746 for ; Wed, 31 Jul 2019 11:05:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1477209CE for ; Wed, 31 Jul 2019 11:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D54E8288EF; Wed, 31 Jul 2019 11:05:10 +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 57507209CE for ; Wed, 31 Jul 2019 11:05:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A214D89CA1; Wed, 31 Jul 2019 11:05:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on062e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::62e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71D8889CA1 for ; Wed, 31 Jul 2019 11:05:08 +0000 (UTC) Received: from AM4PR08CA0071.eurprd08.prod.outlook.com (2603:10a6:205:2::42) by AM5PR0801MB1843.eurprd08.prod.outlook.com (2603:10a6:203:3a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Wed, 31 Jul 2019 11:05:04 +0000 Received: from AM5EUR03FT019.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by AM4PR08CA0071.outlook.office365.com (2603:10a6:205:2::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.15 via Frontend Transport; Wed, 31 Jul 2019 11:05:04 +0000 Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT019.mail.protection.outlook.com (10.152.16.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18 via Frontend Transport; Wed, 31 Jul 2019 11:05:02 +0000 Received: ("Tessian outbound 40a263b748b4:v26"); Wed, 31 Jul 2019 11:04:54 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8a8608357a0b1067 X-CR-MTA-TID: 64aa7808 Received: from 9c97919290da.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.9.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 63DA46EF-32F2-486B-ABFD-399FFB8C0405.1; Wed, 31 Jul 2019 11:04:49 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2057.outbound.protection.outlook.com [104.47.9.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9c97919290da.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Wed, 31 Jul 2019 11:04:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ly9bw8+PoyxEMVCZideNgyBWMsNV0d7jDXx7wDYJkbwZ64bfoTavp63Jbi2hwZ/fagof2oCxBApO+DtyTM7Cvoy5hGo2JhG4rFXsAZMJ978pWYVq2Rw/bZ0Psk7cf1Wf8jpTqAFymEtoNSaE7ptrYnxnxSYkzLW7yrKZXdBNHIHA4r3w6L4gfkmlhx52guPNDOVnGk9dnqZlNVD1LVnACmAPcQvD9/uH5dF8yaRCUZL1Fl/zYsYy7Gda06VLWdFJmhkcTCTDlwR7cRYa1vw2bUx/8Q4LZMr9wCB5wz1PdDeK/QuN0sDbQYFRX+YhNp48xwtt4XsUtLBvtznoqB0jEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCF/l5FgpgxkKlm4BN4LzygTov7mP1C51bKkYdE5yEg=; b=KE10ntXsIELeWem4U5mPYUKK/io3cEt7AAgMwc2un6/99Yx5VnQKRWZ5aYzJBXTT7z+67ndVEGuyU8o25fndPCMxomDEdsqP+McNoRMg6cKFK26esMWUhNDR5DRtmxm/TqPs7BVok4SPHUz8xN2FeYdZLtowfHlvLzQfpNR4lytWh3G9xVgzCPVBnMkjIsMp1Jd30fkXUYNlBlHFRMlXyN5dDBc/Fgiigj8b/2UiA3gH1HCky0WrWnm0rtO3MwNDHhhdGNacDkwSl6vrb9jzO73MlBt/UJKr0WiCykQKKe+VBhtpa5E3ENWCeQH9e0a+Ghbw8KaNQILOg/aAFXe/jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=arm.com;dmarc=pass action=none header.from=arm.com;dkim=pass header.d=arm.com;arc=none Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB3277.eurprd08.prod.outlook.com (52.134.30.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.15; Wed, 31 Jul 2019 11:04:45 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::c091:c28c:bb1a:5236%2]) with mapi id 15.20.2115.005; Wed, 31 Jul 2019 11:04:45 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , "daniel@ffwll.ch" , Brian Starkey Subject: [PATCH v1 2/2] drm: Clear the fence pointer when writeback job signaled Thread-Topic: [PATCH v1 2/2] drm: Clear the fence pointer when writeback job signaled Thread-Index: AQHVR4/CyrPm3jrEukClo/Nxj8QL5w== Date: Wed, 31 Jul 2019 11:04:45 +0000 Message-ID: <1564571048-15029-3-git-send-email-lowry.li@arm.com> References: <1564571048-15029-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1564571048-15029-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: SG2PR03CA0127.apcprd03.prod.outlook.com (2603:1096:4:91::31) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 21477bb5-9cc2-44dc-2a23-08d715a6efd0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR08MB3277; X-MS-TrafficTypeDiagnostic: VI1PR08MB3277:|AM5PR0801MB1843: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:3968;OLM:3968; x-forefront-prvs: 011579F31F X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(346002)(39860400002)(136003)(376002)(189003)(199004)(7736002)(305945005)(50226002)(64756008)(66946007)(66476007)(66556008)(66446008)(8676002)(81156014)(81166006)(68736007)(6486002)(6436002)(26005)(8936002)(186003)(6636002)(36756003)(2201001)(76176011)(14454004)(316002)(110136005)(54906003)(7416002)(256004)(14444005)(99286004)(71200400001)(52116002)(71190400001)(55236004)(5660300002)(478600001)(66066001)(102836004)(386003)(6506007)(2906002)(476003)(11346002)(2616005)(6116002)(3846002)(4326008)(6512007)(25786009)(446003)(53936002)(86362001)(486006)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB3277; H:VI1PR08MB5488.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-Original: WXmqDohCEA/7fkuqz1RlAaKhUO2FNDYypqCPHSPtxeKhQORsDfncdEfO19B634W/mx5bssmCdeeCg7UUn6yjLbjjRHx/hDJgg408/FvSPzGPgipPADzSOyst3x+H+Bw2FvgV56M1eKqVo7ZcztsYp2FW7vcMPUP9cl6KgBLgeT6Pc22bacP24soXxfFXihhzqsKc1q9XWrFqsntRf33qDuKtUIsD8b3uz0yEbseUuOqFYu4UvU+YPVwwFZn0riQv4Nq2Maki+28yzGHZUCxuWtY+L18TyC5PsBGpuDam1CHp0mculguYH/vn4JSMpNGOLBrXA79X/g5uMZPqzFTUWJkr+jV8x5X1l3luOvYTFiyDLw92EThQRV5VIkObmpdTkIqEq/O6c76tmowEe9wnhvC9jYvQtF4UIWMXQG7q4oI= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3277 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT019.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; IPV:CAL; SCL:-1; CTRY:IE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(396003)(376002)(346002)(2980300002)(189003)(199004)(3846002)(70586007)(36756003)(386003)(6116002)(6506007)(99286004)(126002)(102836004)(70206006)(11346002)(2616005)(110136005)(478600001)(6486002)(76130400001)(47776003)(50466002)(5660300002)(316002)(8746002)(76176011)(54906003)(63370400001)(63350400001)(446003)(36906005)(336012)(50226002)(486006)(186003)(86362001)(8936002)(476003)(2501003)(26005)(66066001)(2201001)(2906002)(14454004)(23756003)(7736002)(14444005)(22756006)(26826003)(356004)(6512007)(4326008)(81156014)(81166006)(6636002)(8676002)(305945005)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0801MB1843; H:64aa7808-outbound-1.mta.getcheckrecipient.com; FPR:; SPF:TempError; LANG:en; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; MX:1; A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: b45b6f3b-2ebb-41b7-1031-08d715a6e52a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:AM5PR0801MB1843; NoDisclaimer: True X-Forefront-PRVS: 011579F31F X-Microsoft-Antispam-Message-Info: VkmdnpS495q27WAE+ro1N/PNX67kTjoaUCntIOPGX5f/AdIgkFu4OJ6q1XZ1fG8Lki4iHRL+nB9wRYnOS/GnyPeocipdRvt0l/SCZRvDzjQk3DIk7Fz+tyg1pbUP9rNwH6xqhT49Lz8m+pSNwqEVM1r9T0GImIsBDRp77EToE4U/rDny6K8UppuGLN2jO+Ts9sO0uf3D0k4/Ha4vNVWvKikVC+ddgCMyRvEOu1J5Ted9rwxqiYj58qV7gtXMQKloJPCvQHM3qsYamReOpgB/nhQB3jqvZBI90EmzWkhMGYjceE21j0UhTdLkdQZ/txVPaDqURwiefKPqshQyu9QBywNwUfZoREjakZ3PAmrkXK5lmQdHLxi2ch/+FAmwUXbP+mmtYW4pWxTOLIGjkKPQpH0nkwg6l3qYeP1F3DsCpyI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2019 11:05:02.7615 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21477bb5-9cc2-44dc-2a23-08d715a6efd0 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1843 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCF/l5FgpgxkKlm4BN4LzygTov7mP1C51bKkYdE5yEg=; b=91A3RoJk96bpl7g//6O2VxMd1wj5EZtgGEX/wfhXEaQ72izJWr967s5rd5NkdfJt8opNxMMbE1j5Zjyeq6XrGpsKZjswPDJ35ki7220MloByiE86xei3PA6naiQ5uS9aQRGSbgcQkxE+cV/vull+VPBWih03AfRSINeCulbjU/8= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCF/l5FgpgxkKlm4BN4LzygTov7mP1C51bKkYdE5yEg=; b=91A3RoJk96bpl7g//6O2VxMd1wj5EZtgGEX/wfhXEaQ72izJWr967s5rd5NkdfJt8opNxMMbE1j5Zjyeq6XrGpsKZjswPDJ35ki7220MloByiE86xei3PA6naiQ5uS9aQRGSbgcQkxE+cV/vull+VPBWih03AfRSINeCulbjU/8= X-Mailman-Original-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.freedesktop.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.freedesktop.org; dmarc=temperror action=none header.from=arm.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-renesas-soc@vger.kernel.org" , nd , "maxime.ripard@bootlin.com" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "kieran.bingham+renesas@ideasonboard.com" , "laurent.pinchart@ideasonboard.com" , Ayan Halder , "sean@poorly.run" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP During it signals the completion of a writeback job, after releasing the out_fence, we'd clear the pointer. Check if fence left over in drm_writeback_cleanup_job(), release it. Signed-off-by: Lowry Li (Arm Technology China) Reviewed-by: Brian Starkey Reviewed-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/drm_writeback.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c index ff138b6..43d9e3b 100644 --- a/drivers/gpu/drm/drm_writeback.c +++ b/drivers/gpu/drm/drm_writeback.c @@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job) if (job->fb) drm_framebuffer_put(job->fb); + if (job->out_fence) + dma_fence_put(job->out_fence); + kfree(job); } EXPORT_SYMBOL(drm_writeback_cleanup_job); @@ -366,25 +369,29 @@ static void cleanup_work(struct work_struct *work) { unsigned long flags; struct drm_writeback_job *job; + struct dma_fence *out_fence; spin_lock_irqsave(&wb_connector->job_lock, flags); job = list_first_entry_or_null(&wb_connector->job_queue, struct drm_writeback_job, list_entry); - if (job) { + if (job) list_del(&job->list_entry); - if (job->out_fence) { - if (status) - dma_fence_set_error(job->out_fence, status); - dma_fence_signal(job->out_fence); - dma_fence_put(job->out_fence); - } - } + spin_unlock_irqrestore(&wb_connector->job_lock, flags); if (WARN_ON(!job)) return; + out_fence = job->out_fence; + if (out_fence) { + if (status) + dma_fence_set_error(out_fence, status); + dma_fence_signal(out_fence); + dma_fence_put(out_fence); + job->out_fence = NULL; + } + INIT_WORK(&job->cleanup_work, cleanup_work); queue_work(system_long_wq, &job->cleanup_work); }