From patchwork Fri Dec 7 15:54:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10718403 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 45E3515A6 for ; Fri, 7 Dec 2018 15:54:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B3092DADC for ; Fri, 7 Dec 2018 15:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C7912DF43; Fri, 7 Dec 2018 15:54:57 +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 354FB2DADC for ; Fri, 7 Dec 2018 15:54:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 74F926E7C4; Fri, 7 Dec 2018 15:54:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-eopbgr800059.outbound.protection.outlook.com [40.107.80.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id 22C816E7C4; Fri, 7 Dec 2018 15:54:55 +0000 (UTC) Received: from DM5PR12CA0052.namprd12.prod.outlook.com (2603:10b6:3:103::14) by CY1PR12MB0059.namprd12.prod.outlook.com (2a01:111:e400:4c2a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Fri, 7 Dec 2018 15:54:53 +0000 Received: from BY2NAM03FT004.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::201) by DM5PR12CA0052.outlook.office365.com (2603:10b6:3:103::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.19 via Frontend Transport; Fri, 7 Dec 2018 15:54:53 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT004.mail.protection.outlook.com (10.152.84.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.17 via Frontend Transport; Fri, 7 Dec 2018 15:54:52 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Fri, 7 Dec 2018 09:54:51 -0600 From: Chunming Zhou To: , , , Date: Fri, 7 Dec 2018 23:54:15 +0800 Message-ID: <20181207155422.15967-3-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181207155422.15967-1-david1.zhou@amd.com> References: <20181207155422.15967-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)(376002)(39860400002)(396003)(136003)(346002)(2980300002)(428003)(189003)(199004)(4326008)(47776003)(316002)(2870700001)(77096007)(575784001)(86362001)(50226002)(5820100001)(68736007)(305945005)(76176011)(14444005)(6666004)(8936002)(104016004)(53416004)(486006)(2201001)(5660300001)(81166006)(126002)(106466001)(54906003)(110136005)(81156014)(39060400002)(2906002)(356004)(426003)(2616005)(336012)(50466002)(11346002)(186003)(23676004)(36756003)(446003)(8676002)(7696005)(26005)(478600001)(476003)(105586002)(1076002)(72206003)(97736004)(53936002)(66574011); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0059; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT004; 1:VWK3vQ2aB/iX/gwnPNpD+kgKP7ku/jGVggnm/0Kav0NKH6kq1rjs4rG4jnAutNJMATTvYTMi5QttPODmIgqC6KKCIKt3J7TIAx+d0xyDU5OFwwLFJNEwD6SIpDqmn+0h X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8499edc9-bff4-4f03-23ed-08d65c5c538d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0059; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0059; 3:JMAdYL70q0Locrbz7rYD0x2fjqYf6clnYcRkWapYI1q/dR4BstJ8b9GyYeASS+GYLI0/a9ETWaNvPDk2CR3DpeqfNaq6gnycmeQbLga7+kVQcOOp/XfqDGzQ5FMFsDzAn42nbZTTrJ9h7sDDHEvPFcM2/7DYYfuyqHHaUbMnsBdnL1GuDp3CaKm1CmGtBwv0osZgCvsS3nO+/WJp9qZQXG1QcA0Bh6VxocIbdJZ1IF77/f2Ko+bCcfTNp2W6M8UJ9MBCyvGdW5zwR8jzuHz5MtdPlNgsBq6PH53kCsyi0Zrq6n3tCrlKm6/icl14Y3dF+emNxIHQ+1xCE+JdEVofmdEDyrow5SJa6dqXXTD6ARk=; 25:mpvh8ktCLBdeJEzuTKbq1VXbb8Dr3zf980wqoHkK5Ko0Wq0bNqDlde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igKmNW4FM5RZt4cHpD2IO2umexXOqW 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)(3002001)(93006095)(93003095)(3231455)(999002)(944501520)(52105112)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:CY1PR12MB0059; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0059; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0059; 4:9Kwih0QigLIcU/NE15OHtvPXUZViXZfw6jDSS7gOrfb5+AtPpv7ZunWCjf3G1qEJl+lAIPPvKRiq6HNLJFB0hp8Xno5q0n5JATwjnp6OBJABFpl9hFWZpsptEIS7xMvsj/+78fHkYNpq7pB8AeNUOl+dPsz8ZGLRJALwo2thZrvFB7wHKhpz0jpjwFHtYyQj99JiYTlAytpBJpB60An1GQrtKvLP55dV6+niKIw5T/zHHp/QOWs9pCdSJcxdnwGD1e2MzFYn1u4YV/JBd/Gi9w== X-Forefront-PRVS: 0879599414 X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY1PR12MB0059=3B23=3AZ75qZKA?= =?utf-8?q?3XzgwX+DtvOMFTv5RXArXcFCOC+0GAT+lol0rm3CA52prSpG4HYmjfef0q13RD9TM?= =?utf-8?q?X8lcOOFAvSeSMjkyl44BoFcbQ4GC8bMa4QDo1atjXSFrZJX4w88OCqQUWJw36Fp8E?= =?utf-8?q?1BUqrKw2aln0Tgcp1PsEg6jn7KwMK2oYIebFDa9Hgjm9x15gLrihW4W6+hidRUPub?= =?utf-8?q?3SJufFwe58TxQ93KvjCl6jEtpIOf86GV5gmVjZyW8rF8KZrPeewWWSB8Yg4YeUuw5?= =?utf-8?q?Ffcou4lW+0+OJessvOOaoxbm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TgwWK4/QDUXsgIaxnZgUSeSwNvarJCBsU6Ut/fl8VEKuRXGjf5bTRHMrKO+FGMkYviMhgE7f06ZbubxmpYgimqzuDE6H2OiMQruo5mxqOXmCRvYDLsAxF7UUg0I=; 7:VZ5Mjh6MgzKzM4EklQzZEr1gZNJioaG0K7Tydvq9CXoMZgvtz4VrctVACwLgzPS7Y/q5bcScHOGhbQsQGRFdpYukLwl6rAb8k0XUL7eIXmlMChAASX+xuFzPs7xlMTXHlSlzRECrswjv2RyRo1uJvA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0059; 20:zu1spxA09cSXNEuSxKNm8GWPTHF55ea2bP/i9WC8738Lb0cyIZC3ZFnpyZqgCyTNm34bV2s8iZ2m5iVIlF4TT/jeFJQ0D/ItAfg29gsZuJnpgsiONC1jMDx10uTiY9dLhZ2zWkk0q2vUtbCWrad/9EhVlH2Y2SZbZaFgwkXbTQaCfcD8W+yH93KUyv65UyBaoBdLGmYwRlgf3mVOgsOHKhItxniMJI9j9LbFTLwCF08NUE94cjwLkfm1S1mhl5mg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2018 15:54:52.5821 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8499edc9-bff4-4f03-23ed-08d65c5c538d 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0059 Subject: [Intel-gfx] [PATCH 03/10] drm/syncobj: add new drm_syncobj_add_point interface v2 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 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..51f798e2194f 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 = rcu_dereference_protected(syncobj->fence, + lockdep_is_held(&syncobj->lock)); + 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(prev, fence); +} +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,