From patchwork Tue Dec 11 10:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723433 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 625A01751 for ; Tue, 11 Dec 2018 10:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 520B92A0AA for ; Tue, 11 Dec 2018 10:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 469942A0DC; Tue, 11 Dec 2018 10:35:25 +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 AF3042A0AA for ; Tue, 11 Dec 2018 10:35:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B3DE6E08C; Tue, 11 Dec 2018 10:35:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04on0623.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4d::623]) by gabe.freedesktop.org (Postfix) with ESMTPS id B40FE6E08C; Tue, 11 Dec 2018 10:35:22 +0000 (UTC) Received: from BN6PR12CA0048.namprd12.prod.outlook.com (2603:10b6:405:70::34) by SN1PR12MB0847.namprd12.prod.outlook.com (2a01:111:e400:c45c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Tue, 11 Dec 2018 10:35:19 +0000 Received: from BY2NAM03FT021.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::202) by BN6PR12CA0048.outlook.office365.com (2603:10b6:405:70::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.19 via Frontend Transport; Tue, 11 Dec 2018 10:35:19 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT021.mail.protection.outlook.com (10.152.84.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.16 via Frontend Transport; Tue, 11 Dec 2018 10:35:18 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Tue, 11 Dec 2018 04:35:17 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:42 +0800 Message-ID: <20181211103449.25899-3-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211103449.25899-1-david1.zhou@amd.com> References: <20181211103449.25899-1-david1.zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(396003)(376002)(346002)(2980300002)(428003)(189003)(199004)(14444005)(68736007)(4326008)(26005)(6666004)(39060400002)(336012)(77096007)(186003)(36756003)(478600001)(476003)(2616005)(446003)(72206003)(486006)(11346002)(50466002)(426003)(110136005)(54906003)(5820100001)(1076002)(47776003)(7696005)(2870700001)(53936002)(81156014)(316002)(76176011)(2906002)(126002)(23676004)(8676002)(97736004)(305945005)(5660300001)(106466001)(50226002)(575784001)(8936002)(53416004)(2201001)(105586002)(66574011)(104016004)(86362001)(81166006)(356004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0847; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT021; 1:rg1qtZuQW6hyaLdg9DhYGd1nGGTupw4/RBH4RLJhhfhza/a5derVOpogFLsGrjoYIsE6bs5ItqHhI8iSpRQ7IwrmLpBBbmIjBoxj60u618CQnv4tIxXyVy9S6KJhe8AT X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a59c49c-30c2-418b-c094-08d65f5458cd X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:SN1PR12MB0847; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0847; 3:yJtW9GjF9rQ/1xgopBbQ0O5edwWhSrZI9DCMJjn+7R7KyF3XUTIzx1lrtYJgjLo0AV9oXtLtCclRKocu+cVTFQFptH+QblI+VYk0a5x7buFwkASyq6UL8BW60ADffQ3mLuMB11HK/Omp3X9oXDYERohta4NJGlCNCIUSe8Lw5fbktya7HQasepzeV0Zz/XAbUwmGnn4osIgrX/HhtYnsMZ0dnxijMINQEkXhzRS8zvS//rX6Rjr8xj3jWftsEhALvYm7l2pwzizzTTWd4+bqTuMupHK0J7sCIXcrGMyFFZ9kJytD9wmY352SzN1oWFZ0aL7SYQ+PMwZBQu0hiYm50gEmCwlZnVSTHxI4JA/ybOw=; 25:FZRMfYIwAFTY0YsLJVC2jwOZcLkk5oU3KSbLR8Y0awAfRiA+RHzg2OqLhss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8VZRB8sYZx3hktHyhrVNqW6TnrHan3kIZ3GKfb5 X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(10201501046)(3231455)(999002)(944501520)(52105112)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:SN1PR12MB0847; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0847; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0847; 4:QZum7GrPClxkWeJ/vBP4mh5cibGuQwGP2Nz/5UT4ZmeLGuRvTASXCcLpcNHLfkfhqxLCotkCj42VZZIqz/Q/F5j1VDq3KkYXNxhoAH0eTqFT857ZEz3GPv4gpYrWZT+Evm8tu6Ovj//0P2Y2q71sR9z8sg898grpcyTHJdUBSwNy5O+gyJpEsdzww+L13/668AHHxNs9fFAM0YP1N35dYvUATY2lZeWg9motPV1RmLyprMtwe1xu5H78OMDG0IwF6Y0FvWV0hrRxh5v/+Ni1Dw== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR12MB0847=3B23=3AvyUG+x8?= =?utf-8?q?53mnLUpSmEWoeW+7NSsD5qw62u2nDiG9Xh7T7ehgeDXz3TsfyT2SaHrmbDcyhMmYY?= =?utf-8?q?36Aj0YHkmR5CD20BCW4Ya0Zaa4q/lFT97tPfyNJLspZsy8100sJxgORmWpsKczwSz?= =?utf-8?q?ImNkXitEMRS1G2Wz1Fv/EsFaMwRVzrNzgdUXio3m4UWtdCGNvhahUUlkja30Fc32o?= =?utf-8?q?abRDSmNXsX8+OL86qyQfaOoC7B+T147e8iDnVcOL0LcP5d7R3ApsDljfKM0rskjSG?= =?utf-8?q?ldol9+tYE9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yXOwXlrSKS+WsfXwFAnlQQ2tI3RNdVmwOCqEwn1mK5A1XPCOuXn1LhzAe+Q/ZBnvHwTW3+eV71wQegvLWdm2k=; 7:BNUGUasS9AT+XX4jzinYLQdp8qL7nNSunGFRg/DcbNhJJifnR9LwJG7Ejl6PowaIG51krNKhO2h5XEnRybnot4Skj0m22hv0EXiuzjdi7pPT7U5WKTDKgZyUpd5NppCfOcMk11HI0TXMPtvtWK9fhg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0847; 20:7s3jWdk5Vf0Y8iXPXDvkEEMxeLFu0h9A2Dn3yywiM5hc0+AqhjjCBprlL4D5/7pvg5JoJyN5B+8Z111lPtv8ZOPu3Wn72oI6ErCMJBi1sJ1xXkonSJvPOf81f1lWDr5Jckcy3XqgE3oFu2WqC1O9cNQ24LbnwlY8uQGjt5HuEvnvMmOdGRtNn0SpvHBN+gAqRkUjJw+MGU/wlrJ3uUyCyFgmr5o1427qjSvd8Hl82hvU26QqQ1H9XMndKfYI3oZ9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:18.9243 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a59c49c-30c2-418b-c094-08d65f5458cd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0847 Subject: [Intel-gfx] [PATCH 03/10] drm/syncobj: add new drm_syncobj_add_point interface v3 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König Use the dma_fence_chain object to create a timeline of fence objects instead of just replacing the existing fence. v2: rebase and cleanup v3: fix garbage collection parameters Signed-off-by: Christian König --- drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index e19525af0cce..2b8a744fbbb6 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -122,6 +122,43 @@ static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj, spin_unlock(&syncobj->lock); } +/** + * drm_syncobj_add_point - add new timeline point to the syncobj + * @syncobj: sync object to add timeline point do + * @chain: chain node to use to add the point + * @fence: fence to encapsulate in the chain node + * @point: sequence number to use for the point + * + * Add the chain node as new timeline point to the syncobj. + */ +void drm_syncobj_add_point(struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + dma_fence_chain_init(chain, prev, fence, point); + rcu_assign_pointer(syncobj->fence, &chain->base); + + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL(drm_syncobj_add_point); + /** * drm_syncobj_replace_fence - replace fence in a sync object. * @syncobj: Sync object to replace fence in diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 7c6ed845c70d..8acb4ae4f311 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include "linux/dma-fence.h" +#include "linux/dma-fence-chain.h" /** * struct drm_syncobj - sync object. @@ -110,6 +111,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj) struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, u32 handle); +void drm_syncobj_add_point(struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point); void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence); int drm_syncobj_find_fence(struct drm_file *file_private,