From patchwork Tue Dec 11 10:34:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723425 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 293321751 for ; Tue, 11 Dec 2018 10:35:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1740B2A0AA for ; Tue, 11 Dec 2018 10:35:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A66C2A0D7; Tue, 11 Dec 2018 10:35: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 0D4622A1C5 for ; Tue, 11 Dec 2018 10:35:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC0EC89CF7; Tue, 11 Dec 2018 10:35:07 +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-eopbgr690052.outbound.protection.outlook.com [40.107.69.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id B582589CAD; Tue, 11 Dec 2018 10:35:06 +0000 (UTC) Received: from MWHPR1201CA0011.namprd12.prod.outlook.com (2603:10b6:301:4a::21) by SN6PR12MB2640.namprd12.prod.outlook.com (2603:10b6:805:6f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.21; Tue, 11 Dec 2018 10:35:04 +0000 Received: from BY2NAM03FT037.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::208) by MWHPR1201CA0011.outlook.office365.com (2603:10b6:301:4a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.18 via Frontend Transport; Tue, 11 Dec 2018 10:35:04 +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 BY2NAM03FT037.mail.protection.outlook.com (10.152.84.188) 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:03 +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:00 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:40 +0800 Message-ID: <20181211103449.25899-1-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 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)(346002)(136003)(39860400002)(396003)(376002)(2980300002)(428003)(199004)(189003)(66574011)(5660300001)(336012)(26005)(186003)(72206003)(1076002)(77096007)(426003)(50466002)(478600001)(53416004)(36756003)(105586002)(14444005)(68736007)(53936002)(106466001)(54906003)(316002)(6666004)(97736004)(39060400002)(5820100001)(4744004)(305945005)(356004)(110136005)(2616005)(86362001)(4326008)(2201001)(23676004)(50226002)(8676002)(81156014)(81166006)(2906002)(7696005)(2870700001)(126002)(486006)(476003)(104016004)(47776003)(8936002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR12MB2640; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT037; 1:XF4nwbDbvzN1VVGdQPXIxf7PnhdzWZ5PyWTpb2eVZMZh+kQ2vfXXfY/bXadS/JB/bid1nOVfnkz4POF5l8IjOEBemFgF24a18VsbhXU025I14PZhyZOlz6H8Zsxmq7/S X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aefa2424-88d9-4c8c-f327-08d65f544fcb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:SN6PR12MB2640; X-Microsoft-Exchange-Diagnostics: 1; SN6PR12MB2640; 3:ZsIEHxpsXPMzYWnbe7lkLT0BcTEt+sj3dr1/Ljpxu+ngCvNIAkBTlC4hmf4rwyY00TunxOB49x99x+S4giBIdSIVpVAv9fB7s1U5b4JurmZYrYCvJwdP3GWPHK43wLY15o6/ugeXQL0rNYYqYklwou7m0mTiGtigkMQF0EAt0BH+bo2oH45zTz+AKdUaQOw63KAbSTi53EG6pQdBi9l+Ldt+3GN8k72xriGKjlJmCptF1h9voWQqImKgpMjfiY4s534xwacpGwse8gmPIb8tVitR3o5gh4T8c1y6KrYsJJviBplJc1gsI4W9hdvcc/wyWfFodRoOcdoOUsSkQZy7j/2K+sDYMjG52M62C4CI97k=; 25:JsxwpPDc+d4XoF6w12bMS7GyohJhYtgnJTkTxxT25MZhTRLvNrvcIZ6l/m2pH0dBACrc71AASix8XmZ6VALp4Nm51PGRTkjN1wNH3lNXkrklMbD9O1M/U+r61B32AEcU6AQWBjaOjdlyR9cdaqb+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-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231455)(999002)(944501520)(52105112)(3002001)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:SN6PR12MB2640; BCL:0; PCL:0; RULEID:; SRVR:SN6PR12MB2640; X-Microsoft-Exchange-Diagnostics: 1; SN6PR12MB2640; 4:yzEpjJgd2NoWgW712rRo7X570h+6LD2QHIg5ddfevZHIOQneB8IdgkXFakmG2lG8xJuYCsQtqH6d82gOmoxBwFg/VtjtWvLuqHml04F/CkyTreMDK5vkiWYyG5HnScrNiwK34tKLCB448Bt6tHNsm/SoADz3bJq1JnTlv1tMEoErGa9m3YMfT874G0ayOkeB34D29emWIZMn+/uSu5I1vY40cFhRehx1v1VkdD5fQkgDY9L4KGCr4Pon8+Ka6mRREMfR/pDE+Yvyk3P/WvCSVA== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN6PR12MB2640=3B23=3A+S15+Fe?= =?utf-8?q?S40REHTU522yS3K0snu0qkgEf3xU3xJLyTnWdlauUBq6MhyumSv/ShVAtLY00pZmr?= =?utf-8?q?hZs7HvjOrJ6g2VacY4PKKNDH+vl6vPyN5UVF5e0tH/r0uO/NPR1sBZwjzeZxkZr2H?= =?utf-8?q?aYWrtCsZ0i0G4W6KBNZPV5CREXagIBkvQXlCB7GurNS6gw2Y6BIx6yZfzI2t4UzPv?= =?utf-8?q?oR+J4gWkSTp/gi1/XBOS5YhwTAKTew55y0vtgPI/ZFGjJFdMZxM7x5hYtI1PTH4DZ?= =?utf-8?q?GMCiHc2d7TK36aLDq2seBioiesurGWjOnSn3MMF2s94RcR4npWEP1lD/H2r6biTn+?= =?utf-8?q?NjYKKTf7AR7KCuZ8BaGrIoQzzreo+rkvk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qIwBGuoDfrClO18pizGV96JJO+Y5H8UlVCaY3c29+Ekjy0bPG2dR+PnZDt0lFfv5VjF9NzSmeYfTkD8S3+2JoPEbE0JwOxJaBJO7r7w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR12MB2640; 20:LfoWanmwSqKlD595r6IKVHUikG4ydI2ELAjKALXdRhK6vKHtKjTfvMiskvxmq+pFNhyJdrhmj76+HDoqhnLBfV4/Rp2GxgxF2tQx8c/oA4GCMseWa/UHaaeVqJxchyZ/xJSpbby/h7QS4c+cGSGg5XO6rDKByM/xmXq/1+i65KgC/rxH1VNoioyj41DPE8jXAJvIO5L+98uwZjCxzmRVW9AC57d2DhHF8nEfLyOsgpYdLsD9PRTdHN1zmcgK1W8G X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:03.7974 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aefa2424-88d9-4c8c-f327-08d65f544fcb 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: SN6PR12MB2640 Subject: [Intel-gfx] [PATCH 01/10] dma-buf: add new dma_fence_chain container v4 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 Lockless container implementation similar to a dma_fence_array, but with only two elements per node and automatic garbage collection. v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno, drop prev reference during garbage collection if it's not a chain fence. v3: use head and iterator for dma_fence_chain_for_each v4: fix reference count in dma_fence_chain_enable_signaling Signed-off-by: Christian König --- drivers/dma-buf/Makefile | 3 +- drivers/dma-buf/dma-fence-chain.c | 241 ++++++++++++++++++++++++++++++ include/linux/dma-fence-chain.h | 81 ++++++++++ 3 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 drivers/dma-buf/dma-fence-chain.c create mode 100644 include/linux/dma-fence-chain.h diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile index 0913a6ccab5a..1f006e083eb9 100644 --- a/drivers/dma-buf/Makefile +++ b/drivers/dma-buf/Makefile @@ -1,4 +1,5 @@ -obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o +obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \ + reservation.o seqno-fence.o obj-$(CONFIG_SYNC_FILE) += sync_file.o obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o obj-$(CONFIG_UDMABUF) += udmabuf.o diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c new file mode 100644 index 000000000000..0c5e3c902fa0 --- /dev/null +++ b/drivers/dma-buf/dma-fence-chain.c @@ -0,0 +1,241 @@ +/* + * fence-chain: chain fences together in a timeline + * + * Copyright (C) 2018 Advanced Micro Devices, Inc. + * Authors: + * Christian König + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +static bool dma_fence_chain_enable_signaling(struct dma_fence *fence); + +/** + * dma_fence_chain_get_prev - use RCU to get a reference to the previous fence + * @chain: chain node to get the previous node from + * + * Use dma_fence_get_rcu_safe to get a reference to the previous fence of the + * chain node. + */ +static struct dma_fence *dma_fence_chain_get_prev(struct dma_fence_chain *chain) +{ + struct dma_fence *prev; + + rcu_read_lock(); + prev = dma_fence_get_rcu_safe(&chain->prev); + rcu_read_unlock(); + return prev; +} + +/** + * dma_fence_chain_walk - chain walking function + * @fence: current chain node + * + * Walk the chain to the next node. Returns the next fence or NULL if we are at + * the end of the chain. Garbage collects chain nodes which are already + * signaled. + */ +struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence) +{ + struct dma_fence_chain *chain, *prev_chain; + struct dma_fence *prev, *replacement, *tmp; + + chain = to_dma_fence_chain(fence); + if (!chain) { + dma_fence_put(fence); + return NULL; + } + + while ((prev = dma_fence_chain_get_prev(chain))) { + + prev_chain = to_dma_fence_chain(prev); + if (prev_chain) { + if (!dma_fence_is_signaled(prev_chain->fence)) + break; + + replacement = dma_fence_chain_get_prev(prev_chain); + } else { + if (!dma_fence_is_signaled(prev)) + break; + + replacement = NULL; + } + + tmp = cmpxchg(&chain->prev, prev, replacement); + if (tmp == prev) + dma_fence_put(tmp); + else + dma_fence_put(replacement); + dma_fence_put(prev); + } + + dma_fence_put(fence); + return prev; +} +EXPORT_SYMBOL(dma_fence_chain_walk); + +/** + * dma_fence_chain_find_seqno - find fence chain node by seqno + * @pfence: pointer to the chain node where to start + * @seqno: the sequence number to search for + * + * Advance the fence pointer to the chain node which will signal this sequence + * number. If no sequence number is provided then this is a no-op. + * + * Returns EINVAL if the fence is not a chain node or the sequence number has + * not yet advanced far enough. + */ +int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t seqno) +{ + struct dma_fence_chain *chain; + + if (!seqno) + return 0; + + chain = to_dma_fence_chain(*pfence); + if (!chain || chain->base.seqno < seqno) + return -EINVAL; + + dma_fence_chain_for_each(*pfence, &chain->base) { + if ((*pfence)->context != chain->base.context || + to_dma_fence_chain(*pfence)->prev_seqno < seqno) + break; + } + dma_fence_put(&chain->base); + + return 0; +} +EXPORT_SYMBOL(dma_fence_chain_find_seqno); + +static const char *dma_fence_chain_get_driver_name(struct dma_fence *fence) +{ + return "dma_fence_chain"; +} + +static const char *dma_fence_chain_get_timeline_name(struct dma_fence *fence) +{ + return "unbound"; +} + +static void dma_fence_chain_irq_work(struct irq_work *work) +{ + struct dma_fence_chain *chain; + + chain = container_of(work, typeof(*chain), work); + + /* Try to rearm the callback */ + if (!dma_fence_chain_enable_signaling(&chain->base)) + /* Ok, we are done. No more unsignaled fences left */ + dma_fence_signal(&chain->base); + dma_fence_put(&chain->base); +} + +static void dma_fence_chain_cb(struct dma_fence *f, struct dma_fence_cb *cb) +{ + struct dma_fence_chain *chain; + + chain = container_of(cb, typeof(*chain), cb); + irq_work_queue(&chain->work); + dma_fence_put(f); +} + +static bool dma_fence_chain_enable_signaling(struct dma_fence *fence) +{ + struct dma_fence_chain *head = to_dma_fence_chain(fence); + + dma_fence_get(&head->base); + dma_fence_chain_for_each(fence, &head->base) { + struct dma_fence_chain *chain = to_dma_fence_chain(fence); + struct dma_fence *f = chain ? chain->fence : fence; + + dma_fence_get(f); + if (!dma_fence_add_callback(f, &head->cb, dma_fence_chain_cb)) { + dma_fence_put(fence); + return true; + } + dma_fence_put(f); + } + dma_fence_put(&head->base); + return false; +} + +static bool dma_fence_chain_signaled(struct dma_fence *fence) +{ + dma_fence_chain_for_each(fence, fence) { + struct dma_fence_chain *chain = to_dma_fence_chain(fence); + struct dma_fence *f = chain ? chain->fence : fence; + + if (!dma_fence_is_signaled(f)) { + dma_fence_put(fence); + return false; + } + } + + return true; +} + +static void dma_fence_chain_release(struct dma_fence *fence) +{ + struct dma_fence_chain *chain = to_dma_fence_chain(fence); + + dma_fence_put(chain->prev); + dma_fence_put(chain->fence); + dma_fence_free(fence); +} + +const struct dma_fence_ops dma_fence_chain_ops = { + .get_driver_name = dma_fence_chain_get_driver_name, + .get_timeline_name = dma_fence_chain_get_timeline_name, + .enable_signaling = dma_fence_chain_enable_signaling, + .signaled = dma_fence_chain_signaled, + .release = dma_fence_chain_release, +}; +EXPORT_SYMBOL(dma_fence_chain_ops); + +/** + * dma_fence_chain_init - initialize a fence chain + * @chain: the chain node to initialize + * @prev: the previous fence + * @fence: the current fence + * + * Initialize a new chain node and either start a new chain or add the node to + * the existing chain of the previous fence. + */ +void dma_fence_chain_init(struct dma_fence_chain *chain, + struct dma_fence *prev, + struct dma_fence *fence, + uint64_t seqno) +{ + struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev); + uint64_t context; + + spin_lock_init(&chain->lock); + chain->prev = prev; + chain->fence = fence; + chain->prev_seqno = 0; + init_irq_work(&chain->work, dma_fence_chain_irq_work); + + /* Try to reuse the context of the previous chain node. */ + if (prev_chain && __dma_fence_is_later(seqno, prev->seqno)) { + context = prev->context; + chain->prev_seqno = prev->seqno; + } else { + context = dma_fence_context_alloc(1); + /* Make sure that we always have a valid sequence number. */ + if (prev_chain) + seqno = max(prev->seqno, seqno); + } + + dma_fence_init(&chain->base, &dma_fence_chain_ops, + &chain->lock, context, seqno); +} +EXPORT_SYMBOL(dma_fence_chain_init); diff --git a/include/linux/dma-fence-chain.h b/include/linux/dma-fence-chain.h new file mode 100644 index 000000000000..a5c2e8c6915c --- /dev/null +++ b/include/linux/dma-fence-chain.h @@ -0,0 +1,81 @@ +/* + * fence-chain: chain fences together in a timeline + * + * Copyright (C) 2018 Advanced Micro Devices, Inc. + * Authors: + * Christian König + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef __LINUX_DMA_FENCE_CHAIN_H +#define __LINUX_DMA_FENCE_CHAIN_H + +#include +#include + +/** + * struct dma_fence_chain - fence to represent an node of a fence chain + * @base: fence base class + * @lock: spinlock for fence handling + * @prev: previous fence of the chain + * @prev_seqno: original previous seqno before garbage collection + * @fence: encapsulated fence + * @cb: callback structure for signaling + * @work: irq work item for signaling + */ +struct dma_fence_chain { + struct dma_fence base; + spinlock_t lock; + struct dma_fence *prev; + u64 prev_seqno; + struct dma_fence *fence; + struct dma_fence_cb cb; + struct irq_work work; +}; + +extern const struct dma_fence_ops dma_fence_chain_ops; + +/** + * to_dma_fence_chain - cast a fence to a dma_fence_chain + * @fence: fence to cast to a dma_fence_array + * + * Returns NULL if the fence is not a dma_fence_chain, + * or the dma_fence_chain otherwise. + */ +static inline struct dma_fence_chain * +to_dma_fence_chain(struct dma_fence *fence) +{ + if (!fence || fence->ops != &dma_fence_chain_ops) + return NULL; + + return container_of(fence, struct dma_fence_chain, base); +} + +/** + * dma_fence_chain_for_each - iterate over all fences in chain + * @iter: current fence + * @head: starting point + * + * Iterate over all fences in the chain. We keep a reference to the current + * fence while inside the loop which must be dropped when breaking out. + */ +#define dma_fence_chain_for_each(iter, head) \ + for (iter = dma_fence_get(head); iter; \ + iter = dma_fence_chain_walk(head)) + +struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence); +int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t seqno); +void dma_fence_chain_init(struct dma_fence_chain *chain, + struct dma_fence *prev, + struct dma_fence *fence, + uint64_t seqno); + +#endif /* __LINUX_DMA_FENCE_CHAIN_H */ From patchwork Tue Dec 11 10:34:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723429 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 4D1DD1751 for ; Tue, 11 Dec 2018 10:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A5922A0AA for ; Tue, 11 Dec 2018 10:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E7AF2A0DC; Tue, 11 Dec 2018 10:35:16 +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 9E4B22A0AA for ; Tue, 11 Dec 2018 10:35:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C26C86E08D; Tue, 11 Dec 2018 10:35:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790044.outbound.protection.outlook.com [40.107.79.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id DABF089F45; Tue, 11 Dec 2018 10:35:12 +0000 (UTC) Received: from SN1PR12CA0096.namprd12.prod.outlook.com (2603:10b6:802:21::31) by CY1PR12MB0839.namprd12.prod.outlook.com (2a01:111:e400:59d2::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:11 +0000 Received: from BY2NAM03FT023.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::208) by SN1PR12CA0096.outlook.office365.com (2603:10b6:802:21::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.23 via Frontend Transport; Tue, 11 Dec 2018 10:35:10 +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 BY2NAM03FT023.mail.protection.outlook.com (10.152.84.226) 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:10 +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:08 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:41 +0800 Message-ID: <20181211103449.25899-2-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)(396003)(39860400002)(376002)(136003)(346002)(2980300002)(428003)(199004)(189003)(478600001)(486006)(1076002)(53936002)(105586002)(2201001)(186003)(81166006)(476003)(5660300001)(39060400002)(81156014)(23676004)(106466001)(14444005)(6666004)(5820100001)(76176011)(446003)(356004)(126002)(97736004)(575784001)(11346002)(50466002)(8676002)(26005)(2616005)(86362001)(426003)(8936002)(77096007)(50226002)(110136005)(54906003)(4326008)(66574011)(36756003)(2870700001)(336012)(2906002)(316002)(47776003)(104016004)(53416004)(305945005)(7696005)(72206003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0839; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT023; 1:6PeHA/K0vcNtj3CU8VG3BdmSCSF0ysctw9jI1TWGU3F+sY+oKcpPim6yzzdTHQP0kePOeVW3P0HIdcP1SEBQMUTFEb9bfgaFSsFyP9bYnBMfKvezjH/DDuguzynzGU+4 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f805b5af-4ac7-4d02-269d-08d65f5453c8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0839; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 3:N+g7Ou0+qwj3Uj+VheCOlPVDpWl/bjh+Wg7GsvMNhZ/M2XPK1IB7MMEwb752jVgLIF5Zqo/tPb1wggkJW4MQWzHjHVOsIFULsEbPIGEeXt0+DIEqUYUpeJoX/YPJt0hfnLWEQqgHgkEur4CZlAZIUfpzXVFptQeR6ZhPbj9iblhqHitBPtM0bV4iLJqK39hcR9jkD5beftfYgXNMtHTILelq5BGo9YZwsvzGdO+xWSd0TO0MdYT7+aBSDJsD8A07AjM+8J8Wq9JpDg0UgcccQ8FgAFZ2pyjCufrVyYOGvImvdm5u6cdbW0leVRniEdELlv+SxgqYY8kfvPGHCCilh6VLqhsN6Z7ghizl/basXWk=; 25:GMJhO191/rLx6QUDzUf4jSKIsBUvs9ehvIhVGOKlzj0T15P76uYKbvb1YIdauiotNt/q5DkFUxJTpYFRchOF/KCrlrj/yrjvLAaRY/2bAhGu818bIwMZRndBAfYBfxXkJPQ2fmNQ0N31N/hs8ZriDU4MbWhpmXrpR5aXQPhEkxAt0ZYq67UgqJtZxqSlvLoqeDeB7cfmur1QU5khLrzlLuFshXbkFX9d82s1UkLvOdppLJ2EF1kyLMHECk9vc9a8UjKfoesyuUfsQrhvyMklbI/ruZ0koDPNEdcKwuHyEvorvaGDrnIjPzPeavUkHNYER6qC4k3nNqasdTda71lfeVT61kjeLeuuP4M+Z/oSXdQ= X-MS-TrafficTypeDiagnostic: CY1PR12MB0839: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 31:4D7K7uJCsvZEW7nT8qJXkSXdQNX3jfQOHTzmpRKftmBFugTYBpxKzcM2nP8usuXjp/IkNsXWHUGpPmAXxfwJJhEELRhYsVIboj1DU5G3fOtgTmtZH7UZZ6S0NUzfGjGG8kem5E4ffr+J/VXC1JWsNX3vqHXZnPoLoLG1hOyzXBXwKDkDKhKhLjcqQXLFdb31blVZuzpaehp/OzA5W5IknQ8YeanyYTnOmnXChA7cr7Y=; 20:W5rGFOOe72/3EhOIxorNbXm/WRJ4kXa7Jd/F7uOJQU3wc2avIPo5wv1fg0s21zVFkYnBQvYKuiC+b5Jxi6gsqO3bDJpy+V9dPCAsdHSs4gmTFgKp3BbgLARs0tRgIf834zI/pwUPpsR503pIZXIRpIU8YbYH6ttvszmgr/vo5fVMzHeNliitOpNpcsr9W7FB/JezDs/aIoN7lQYV5hv0UOpaaXFrdSzSPk3clpuoTDAKxjqxIMPrU8gfg/x2QFqf8RIUPtKTZ+ManzGLgeR2aF7EkUmCW6R5WLrRwdNArhpUA55iyMfpD/dGOmby7M10VqHCc2veZgxPkYd03iHsZL7dkTg4YN0jVsOWPQ8/1OZ5VPnJgIF3wuFstrAv4jIfxE66RR/J3E3fBkErj28gwJZf6GNuGrinAcEaHW5It1sS3UFqtmeQYc9eZfSJuIIb7IhV9pZKsw8T6cpPV6AsofTBdTyc1uh5PSjnFxwkT9dz8NJrbY0jROHTHd6PaqOW X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:CY1PR12MB0839; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0839; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 4:W2I3TxU4lZirYkaVzRuBxw7t+TsBSxGO1KTuKHddv5T6upSHQqdiLMsuS6YtQ9HfHY2MP9sgmxjjswRhnp3bvjitFlOm/1C+vox+Xeg2Lgn8vw2HBxANVOOj9xLdlsq7O2oOiz6dOrsXc38uiY7Bgf0R2HgECsrZkAMNQ8COIlxQ/63nVDQl/rZDIBxcSgb5h5pCqRptdsVMPpelrnnxFr9l8HV+XeuAgIP+uNkQ5B/jMkqUwHSyqTrVfh3X6PFYiwnXV92kax7gR8lXb4aV4Q== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY1PR12MB0839=3B23=3AL0ObFgH?= =?utf-8?q?ir2sK38FVX7TIeEDVXjuXwUbRJ7+bSTvyP+hk3Mf8144u717DafkVR+7uUpLb9Dk5?= =?utf-8?q?ZE/NX9eMSJqlJObjdcsNkFONbueXzZQq1ZpEGCRtEkr6B0LM0Go8DF+rEBo66znv2?= =?utf-8?q?zxRE1ooz++RkKOcUhINnhTtk6f0/hkP+BRMOBC5LzoopNg1D861iBbejkgiHnI74+?= =?utf-8?q?EdXrAv9GRv3hxwOnT9hmTrbw14WZRbsU5u9uOev3XRrqJHa1kHK1V8M42tRZDthLA?= =?utf-8?q?fd4sBCDu3J5BZr9LyJpyq/4/xGDJtTORJwYYzYcHkc8O5Ya/qBQHehrH/mtpMWzy0?= =?utf-8?q?vqpEiIEW7zVhtZ/Co4uoxqjiA5DlsNtFkGT5nny/Ddxs1Om6rhaYj9YYg+ff5vLIc?= =?utf-8?q?yQSf6x2kmJkM9UenDpUrLayfyUVjsyrbtGxU5l+4WxgucYTaBmTipyP4ziV1w8sJR?= =?utf-8?q?PlpIO1CsHmt7JLF41ZqH/KMwBKbEZdMew3BdSui+4JNV0GJMhMY9IsGTONLuAUDqH?= =?utf-8?q?StEsqt9YLnNwTjdVA61iVzFK2pOVq/Otrc15pfWCt0zq9Af6mCnCTr8sbmwl6RcyB?= =?utf-8?q?nvYAiDH6zVosejwBr8eRYZNGHW6M+kXyOEziNnYtuegcx6dUJVsenFwD8s7rojifW?= =?utf-8?q?iGJcAjOusvHllkkV+3ppL+WRS95Nq9FixtGRCRp/sd4aWpPtJrVLYBn+5LwMpPuay?= =?utf-8?q?jeVl/SbjGyp8n2F4zDcqbGY+FRTzghiYH4pfJMJZ30SRPCa8VHiDBOTTCc6O9FRPv?= =?utf-8?q?hOlRho8/o9Wxlw97lCKGFKCOBclBrzmKjqj4QsCbYDc2Xtlst/TXpyo8W8bf+v1zD?= =?utf-8?q?oPET/qZVgQ29f0E7PzXkKqSksJ69bb4QGocXYIoXZMwtPTjcZzSl7okvVW0MrMxlo?= =?utf-8?q?bp2stAxXiEJxtWYORJncwcZ3xjdibpC9GL1QPE5vGlajCiWMl6087QNyG3elzv06I?= =?utf-8?q?Bg6FSETXpnrGz4//XwGoceNKalboe/cWUicXhav54VTumveGIrn9NWOklJfpqepX8?= =?utf-8?q?yI/vxCcUfuy8CeOy2oIFw2uojmilX9KVfKCcvt6R7FCXxsadnV7+WLFqR326msvqY?= =?utf-8?q?oxO+qYWuznWiVpOc53bOO0Gtamtc+bB6qBwLVnhTKxhfbNK5GPn2YvHbBWZ4vqsWq?= =?utf-8?q?pLnorNgxUlib7vZuEmUjoXOYuwcz3a9XWxQYBWo75trk8S+VG1spss2h/H1H+cLEs?= =?utf-8?q?XhGApUUkn7pc1/LqhrBAuohZwHGVq33Ysz9CqJ0n6JgR5gSBNtxEF6ppp7Wg=3D?= =?utf-8?q?=3D?= X-Microsoft-Antispam-Message-Info: Jde6gHrcTSi0Ki1R+OsX8bFDf/SNVVM0W5EK6Q/NxTYusX11hMHwAvMEc423QB0TSQFr0vYivbSCLeo759P1LJ3PnmF1SOkLARtoB86KdlK0LiBm6ByC7jnUbqzcKAmBDDQNBTW46G9unlK5svW3ZhIGEGg3xoOHCCyMnQTaJz3k7QJmVqENBtPiOh0DphtjqAHosWeYVUtDyYMJ/GHSdsis3UKCitGSHBRKhoEfjbflGgvhpU+n+HZEaEfsgLWPo/QJw+6M0/Nv3lBTMoiWpCqCpbon9LisuAxtFh7v7W8Axllm8Hm1kMBbci9VkG07 X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 6:VgHmq6SGN6HWR2Qe2y0Cbxqb1cQumq55Bf5RGCLfohDNNJDUec12rVZX216sdkxix8hMMS4+etK9wRCpfX+a2P4ZbCRlbwDboKJnzEFO/gyPqDDSzGcRNrVbEsRZEh4BX1SNa/EkGcNk99EFxbgA1ZkXJLvLpvsFv21yyzCy3DfuAlZnaHLm3bBdaiDg0+bCOUEm13RRQ60PCl/1lRlMwfgH0K0fNCI/9HGGu8oVm6nohNH0b0vPFeRXYAgFSTZRLqg6oqPKpa3ky4qndQOokUZfewspwoQOZD0CLQXkFxY4tb5OEQBP48ogw7L5Ra3g2LA8e/2AqReiaw8vkF/nCOUStSkueNjb6iwopck4apxVofbIjYtO8l/0gESO86oZlIDCMpf8jV62vCPoIWyhm4rGYSQ7rhCQ9+fePoErgTU7bY8wyW35aBBbar9cT5jNpufsMqBf/4HKlzS2FZxLAVQuSeQnpAftQZkU5vt90Eg=; 5:3i70kTy+XGpJhXFVSSZ7PsZT2RTb/9Z2B7QoAm+3NWyTlXhSly55IheYLNep3rO/htdmcVzMTwRUYXzIMwTnlXXJwp26zlk7uFe4GEM2Ta9oHz93Sa1My1gdknU5w50phEtYsCURB9B0IRIkkvsiamn5D+lRR08HGXTCUr5KB9M=; 7:bJYPXHIOgg2lWjEjs4E/lqMBHRsABdMMlCrb6dot9gmaNweFoHFyn078Ha0jC3qbbpUgQkXHJgclblEpsSv4UyYFGQQBUM3bHPk0/+947+R+VwKensl4thZhPEpBgamJsdyeVrmyM5IAw+Ddruqe4A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 20:o/aFvDwscqWjhipwIk/hsxtvkaJycWeVN6cuwimDUWgW2nbOAjWwY5cBY9vrmpbIsshXYKz1F4FO8C1qx9xuJW8SSlDAYgmnsvQbY411Qpz6+hWc8p+1Phu41KrQx3f63JUA7W1zfIXqYrZU9yIlwHXsgJv1HmVfksU9s0FKMrV61ogjqZO3zt7cHLcUcXQMMrU5Pp8RVI9DKHAdHcF4KcpzinqGwkcqElrAodLr9K5jc2cn2/0uskgRNsEZ6CZj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:10.4990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f805b5af-4ac7-4d02-269d-08d65f5453c8 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: CY1PR12MB0839 Subject: [Intel-gfx] [PATCH 02/10] drm/syncobj: remove drm_syncobj_cb and cleanup 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 This completes "drm/syncobj: Drop add/remove_callback from driver interface" and cleans up the implementation a bit. Signed-off-by: Christian König --- drivers/gpu/drm/drm_syncobj.c | 91 ++++++++++++----------------------- include/drm/drm_syncobj.h | 21 -------- 2 files changed, 30 insertions(+), 82 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index db30a0e89db8..e19525af0cce 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -56,6 +56,16 @@ #include "drm_internal.h" #include +struct syncobj_wait_entry { + struct list_head node; + struct task_struct *task; + struct dma_fence *fence; + struct dma_fence_cb fence_cb; +}; + +static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait); + /** * drm_syncobj_find - lookup and reference a sync object. * @file_private: drm file private pointer @@ -82,58 +92,33 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, } EXPORT_SYMBOL(drm_syncobj_find); -static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) +static void drm_syncobj_fence_add_wait(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait) { - cb->func = func; - list_add_tail(&cb->node, &syncobj->cb_list); -} - -static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, - struct dma_fence **fence, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) -{ - int ret; - - *fence = drm_syncobj_fence_get(syncobj); - if (*fence) - return 1; + if (wait->fence) + return; spin_lock(&syncobj->lock); /* We've already tried once to get a fence and failed. Now that we * have the lock, try one more time just to be sure we don't add a * callback when a fence has already been set. */ - if (syncobj->fence) { - *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, - lockdep_is_held(&syncobj->lock))); - ret = 1; - } else { - *fence = NULL; - drm_syncobj_add_callback_locked(syncobj, cb, func); - ret = 0; - } + if (syncobj->fence) + wait->fence = dma_fence_get( + rcu_dereference_protected(syncobj->fence, 1)); + else + list_add_tail(&wait->node, &syncobj->cb_list); spin_unlock(&syncobj->lock); - - return ret; } -void drm_syncobj_add_callback(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) +static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait) { - spin_lock(&syncobj->lock); - drm_syncobj_add_callback_locked(syncobj, cb, func); - spin_unlock(&syncobj->lock); -} + if (!wait->node.next) + return; -void drm_syncobj_remove_callback(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb) -{ spin_lock(&syncobj->lock); - list_del_init(&cb->node); + list_del_init(&wait->node); spin_unlock(&syncobj->lock); } @@ -148,7 +133,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence) { struct dma_fence *old_fence; - struct drm_syncobj_cb *cur, *tmp; + struct syncobj_wait_entry *cur, *tmp; if (fence) dma_fence_get(fence); @@ -162,7 +147,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, if (fence != old_fence) { list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { list_del_init(&cur->node); - cur->func(syncobj, cur); + syncobj_wait_syncobj_func(syncobj, cur); } } @@ -608,13 +593,6 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, &args->handle); } -struct syncobj_wait_entry { - struct task_struct *task; - struct dma_fence *fence; - struct dma_fence_cb fence_cb; - struct drm_syncobj_cb syncobj_cb; -}; - static void syncobj_wait_fence_func(struct dma_fence *fence, struct dma_fence_cb *cb) { @@ -625,11 +603,8 @@ static void syncobj_wait_fence_func(struct dma_fence *fence, } static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb) + struct syncobj_wait_entry *wait) { - struct syncobj_wait_entry *wait = - container_of(cb, struct syncobj_wait_entry, syncobj_cb); - /* This happens inside the syncobj lock */ wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, lockdep_is_held(&syncobj->lock))); @@ -688,12 +663,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, */ if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { - for (i = 0; i < count; ++i) { - drm_syncobj_fence_get_or_add_callback(syncobjs[i], - &entries[i].fence, - &entries[i].syncobj_cb, - syncobj_wait_syncobj_func); - } + for (i = 0; i < count; ++i) + drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]); } do { @@ -742,9 +713,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, cleanup_entries: for (i = 0; i < count; ++i) { - if (entries[i].syncobj_cb.func) - drm_syncobj_remove_callback(syncobjs[i], - &entries[i].syncobj_cb); + drm_syncobj_remove_wait(syncobjs[i], &entries[i]); if (entries[i].fence_cb.func) dma_fence_remove_callback(entries[i].fence, &entries[i].fence_cb); diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index b1fe921f8e8f..7c6ed845c70d 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -28,8 +28,6 @@ #include "linux/dma-fence.h" -struct drm_syncobj_cb; - /** * struct drm_syncobj - sync object. * @@ -62,25 +60,6 @@ struct drm_syncobj { struct file *file; }; -typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb); - -/** - * struct drm_syncobj_cb - callback for drm_syncobj_add_callback - * @node: used by drm_syncob_add_callback to append this struct to - * &drm_syncobj.cb_list - * @func: drm_syncobj_func_t to call - * - * This struct will be initialized by drm_syncobj_add_callback, additional - * data can be passed along by embedding drm_syncobj_cb in another struct. - * The callback will get called the next time drm_syncobj_replace_fence is - * called. - */ -struct drm_syncobj_cb { - struct list_head node; - drm_syncobj_func_t func; -}; - void drm_syncobj_free(struct kref *kref); /** 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+RHzg2OqLhssRP48jrb1nRDFb874Wd6VHOSnpGDnMt7S1F30OLTCob0ObNNHpfHh+vUvEO59cgEwtyH79UKTxK6BeggexVRyPYuoLQKBG8MicudOWCj/9T+GoJ0Wxm5UUof6dAkLNXiSgnCVcJ2EjP+aDrVNUVmkzOEangDO7+d9nzPvt1k6vC0JXFsVyBdbkdpIwj15UTCdlzJB8a7+xnK6W6QjNiiuFK05lFf9QPd0UVcHqZEyxRW69c/ph7wP7gMWs16+Kv++8783nmWPTkOnXUD3CBLDTMQ4CGcVzojns58ZtjWSTgoX86r0= X-MS-TrafficTypeDiagnostic: SN1PR12MB0847: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0847; 31:s+GqYvGoy2PSWcjmRZNU2KTIg/hRoOxvbVsXWfpmESNVQ+rfNyqwZbCpgr8nyQsNRiSe3WQ4tmcy3drMrSKCKokblqBGjiDAhURnD6I6TTMzAFCL+G609d4oemMf5YZgBkZjF0Rp10pesQUD9VCAMYh37HeSuR8m77JJ3HlhkLflRCcKtyO0vcxGPbDqivc/HNyVIuOJhwVU4p+DFhuEUFHi0ElLOGzgbZNAFQImh8E=; 20:oCvSRq0QDOfbk0/h2OvV1tdCz54WXPNWxl7fInp62X3wTAtBnJ1KyxS063rdTFOLgjSWiLcDMHZgYsN8aifpAqPoHCDKLGSDxoAuP4jOXOhSNUsDRPn7h7BxHF9OXzvG7/IBB8s4rIkkXTcAPr1X+H1QVrozaajn2apjxVyafKhLEPpOL+oNxmDbzAk5+bb1Y/2va+yNj9N9STS/O3/f4Of9X6iV6AftK4NkCpB9jkhVhj2mvinnBhTDltROqTEGcxzn258JKynWcqNQFJy8mXiMSOlOyp9wiY03voAWk2xZ3iTseKv14YOhwEGPkAC6IBVqFqmdePWlolJNWhDAyzpZtMtqn+XBz0Io41F2zMm3B5XKAd3N0DTUeid+SENilws5lIPHdO58ti/EBq4VetGgrzTHXbu0RMoUG1xCBxsFCWJj8vISfpCW5MS0r9NlOqtqeuPu6lzH1QleblZ58DbCk8VZRB8sYZx3hktHyhrVNqW6TnrHan3kIZ3GKfb5 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+tYE9jrsDo2iXamTjbkuaQmDBFWMv0AtP3wdrnwmZT73g3T70rk9YIuZsbZr?= =?utf-8?q?XExD+FWidsu7xdWGo+arUDPBce0NtuhJAjy3vD2qM6vmEQh3iI0OghQ1EGX9emQ06?= =?utf-8?q?vQq/Kz507wJirW/hknHkLsBdF/jwMnDtz/C+jjwgF2bK1pPhUomYoPcuNGdmu2UpJ?= =?utf-8?q?0xZezo8MHtubW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XMPtvtWK9fhg== 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, From patchwork Tue Dec 11 10:34:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723437 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 BA17E1751 for ; Tue, 11 Dec 2018 10:35:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A690E2A0AA for ; Tue, 11 Dec 2018 10:35:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A4492A0D7; Tue, 11 Dec 2018 10:35:37 +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 A681F2A0DC for ; Tue, 11 Dec 2018 10:35:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8C0B6E090; Tue, 11 Dec 2018 10:35:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680079.outbound.protection.outlook.com [40.107.68.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id F13336E090; Tue, 11 Dec 2018 10:35:33 +0000 (UTC) Received: from MWHPR12CA0050.namprd12.prod.outlook.com (2603:10b6:300:103::12) by BY2PR12MB0055.namprd12.prod.outlook.com (2a01:111:e400:2c80::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.18; Tue, 11 Dec 2018 10:35:30 +0000 Received: from BY2NAM03FT045.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::208) by MWHPR12CA0050.outlook.office365.com (2603:10b6:300:103::12) 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:30 +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 BY2NAM03FT045.mail.protection.outlook.com (10.152.85.113) 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:29 +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:27 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:43 +0800 Message-ID: <20181211103449.25899-4-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)(376002)(396003)(346002)(39860400002)(2980300002)(428003)(199004)(189003)(105586002)(77096007)(26005)(6346003)(426003)(336012)(126002)(2616005)(476003)(11346002)(446003)(106466001)(186003)(76176011)(7696005)(23676004)(97736004)(81166006)(53416004)(2870700001)(81156014)(8676002)(316002)(110136005)(54906003)(5660300001)(50466002)(72206003)(478600001)(68736007)(5820100001)(47776003)(36756003)(8936002)(53936002)(4744004)(356004)(104016004)(2906002)(6666004)(2201001)(14444005)(50226002)(66574011)(4326008)(1076002)(305945005)(486006)(86362001)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0055; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT045; 1:2T6Y8u3y73m/9IIQT2THVo7aEiy7OxXVEZFBm9VuKGOW+38/weHETg/6/D0bElpK5cM8p1Cu3wVwfrtxjAElzBRj18TmuwzTGKxCn5VDFRsQfog/8qMr5w30W5D3J7rl X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b095f3ea-587e-40c6-1529-08d65f545f2a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BY2PR12MB0055; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0055; 3:JYGOxNBq/lvNZWAQiZR8mmnL/pKBTiF4X7iHmOvjjhkwdrOX+Vow6ywvWuaHUqLup9YJHifMI51MBdGGyrNA4nc+8JHgfn9X0nqYSrlkwMN9AAq8MrXJ/nRh5MKygrwvrujpwY50kXpK1eUhy1ieQM3//WGmoC5qhwwAMUa3o1Ys7jSdujYl2YYFDO9P2viuW0U+b879c37vD5KpQNp/r6mDusWZ62T3l4HGTnmGFGjcz+6pmPb1zNdzcry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Yv2SBdCwIizzp6vyBWGroPK7kLdl4KyB/QkLV/sjT3v340L7qS4a0VojdLQvaawG7seL0hWMZzGizkE0arf+0SdB2ierduwfXWLlWS5qHJwx+jPXKKE0IlliJ6qY5BibSktTfJ8iv4M1sdsPW5Netv5ikvWmt8tTcQe2CSHbiy57RYMeWcmPC8TRUNMzWvWJOEgKbgkBTgndUpEvIuD7yVaDOBT7i9SxbmGlzcZcb X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(93006095)(93003095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:BY2PR12MB0055; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0055; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0055; 4:5icJ8aEq9X0BW4lXVEzcnOP9nFg+gyBwgGwZ4c069cJM8exwrnkdlgXBuCsp49zyfhl6QTs1nybAvYQCniMTUCZQxA3rf9EUh/qwFNlsPXdrKYVzqtkv/nRL8otuXluWFnm8gpzJapfhcTCC2N81DxhRqZHJC4h4YV2fjOg3kh2XClWpEeIReEgIpPVnefg1ksD73NUZB3zRELVMNUuFv5+z+4oPVTolmziC6Jtd673h1UYXyqva/LcbCmjwMRy8B1S7AAvf4VSS7K2M/TVF4w== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBY2PR12MB0055=3B23=3AvvDt4T2?= =?utf-8?q?O8KCUaHv4SboYxNKymXwP0NjBrWXZPUX0PJzCWgZ2yZ2ZS75sEFfzrR4LzbK+BNTv?= =?utf-8?q?QOQ6A4lNzCGVU7vncMgoosOSNXwevlQ3ZPWBoRgYDsn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IAYRkqqAqnv/yjmQ0lpRUESxey7KaZMarZPDKEfWYkXAMkhSkA5tBNLfsFM7inwxReLY3uq7eQu0THxlcAZUuiFvd4gwqBu2yjs+YFj9UZRVsxe2T/gsBHxwTNTpEqcmA6NxE6q49TANRDQ8=; 5:u+rB3ARRvBWMCN7G5cvBhmWaq04SoozyrX0jkWePCJVA9lWNB1SQGXbia/y6BJWZiD5q+G/jaV1v69r3kdvhi+GgI1VpulLFT9mEKgawTl/vgGt8Q1iqBJJu9fz7m14PYUESzQ7MfW0VMlXNmh5PUgRqlxfCeUG4ykWIQy4XzCY=; 7:5CKv16VithLWVJWM0yw3jrwKthu4PP5Lp6j/5TbjTF8pq2609eExVCGAknw8BvQrLGQweQeeCScxV0bqvtrpLxhDPsFkeDhA6f6PcrcNnAKwUxGmkcZHiU4l3YJ5x2f4uJgNh6ewpCqfuyDHJrSDqA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0055; 20:8Bla1uhQr5S0FupIvHF2q4FAB9weynISJ769YJ2wfx0xt8Q6EQPt8iWFMODoLwnVZsP7wuU+cfHSHIfDbkpGqtexboE+54sVYka+oXJEx8cqtwEYTFP6Rrs6Opg3CW65nPgonGODwbSuFmL4vQbK2RDsXP+hZ6XJSG9C16kcLzl2i8h2rxUjPmvimXoQoAabjDoL5nBC/qi/0ZZcvDpXRS1vyN3OfpccZrd1/Vg1nLRjt0G0lTJWWhWztjqfuFFV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:29.6113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b095f3ea-587e-40c6-1529-08d65f545f2a 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: BY2PR12MB0055 Subject: [Intel-gfx] [PATCH 04/10] drm/syncobj: add support for timeline point wait v8 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: Chunming Zhou , Daniel Rakos , Bas Nieuwenhuizen , Dave Airlie , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP points array is one-to-one match with syncobjs array. v2: add seperate ioctl for timeline point wait, otherwise break uapi. v3: userspace can specify two kinds waits:: a. Wait for time point to be completed. b. and wait for time point to become available v4: rebase v5: add comment for xxx_WAIT_AVAILABLE v6: rebase and rework on new container v7: drop _WAIT_COMPLETED, it is the default anyway v8: correctly handle garbage collected fences Signed-off-by: Chunming Zhou Signed-off-by: Christian König Cc: Daniel Rakos Cc: Jason Ekstrand Cc: Bas Nieuwenhuizen Cc: Dave Airlie Cc: Chris Wilson --- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 153 ++++++++++++++++++++++++++------- include/uapi/drm/drm.h | 15 ++++ 4 files changed, 143 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index c7a7d7ce5d1c..18b41e10195c 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -178,6 +178,8 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private); int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 94bd872d56c4..a9a17ed35cc4 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -675,6 +675,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 2b8a744fbbb6..532d7d3c98cd 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -61,6 +61,7 @@ struct syncobj_wait_entry { struct task_struct *task; struct dma_fence *fence; struct dma_fence_cb fence_cb; + u64 point; }; static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, @@ -95,6 +96,8 @@ EXPORT_SYMBOL(drm_syncobj_find); static void drm_syncobj_fence_add_wait(struct drm_syncobj *syncobj, struct syncobj_wait_entry *wait) { + struct dma_fence *fence; + if (wait->fence) return; @@ -103,11 +106,15 @@ static void drm_syncobj_fence_add_wait(struct drm_syncobj *syncobj, * have the lock, try one more time just to be sure we don't add a * callback when a fence has already been set. */ - if (syncobj->fence) - wait->fence = dma_fence_get( - rcu_dereference_protected(syncobj->fence, 1)); - else + fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 1)); + if (!fence || dma_fence_chain_find_seqno(&fence, wait->point)) { + dma_fence_put(fence); list_add_tail(&wait->node, &syncobj->cb_list); + } else if (!fence) { + wait->fence = dma_fence_get_stub(); + } else { + wait->fence = fence; + } spin_unlock(&syncobj->lock); } @@ -147,10 +154,8 @@ void drm_syncobj_add_point(struct drm_syncobj *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); + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) syncobj_wait_syncobj_func(syncobj, cur); - } spin_unlock(&syncobj->lock); /* Walk the chain once to trigger garbage collection */ @@ -182,10 +187,8 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, rcu_assign_pointer(syncobj->fence, fence); if (fence != old_fence) { - list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { - list_del_init(&cur->node); + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) syncobj_wait_syncobj_func(syncobj, cur); - } } spin_unlock(&syncobj->lock); @@ -642,13 +645,27 @@ static void syncobj_wait_fence_func(struct dma_fence *fence, static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, struct syncobj_wait_entry *wait) { + struct dma_fence *fence; + /* This happens inside the syncobj lock */ - wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, - lockdep_is_held(&syncobj->lock))); + fence = rcu_dereference_protected(syncobj->fence, + lockdep_is_held(&syncobj->lock)); + dma_fence_get(fence); + if (!fence || dma_fence_chain_find_seqno(&fence, wait->point)) { + dma_fence_put(fence); + return; + } else if (!fence) { + wait->fence = dma_fence_get_stub(); + } else { + wait->fence = fence; + } + wake_up_process(wait->task); + list_del_init(&wait->node); } static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, + void __user *user_points, uint32_t count, uint32_t flags, signed long timeout, @@ -656,12 +673,27 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, { struct syncobj_wait_entry *entries; struct dma_fence *fence; + uint64_t *points; uint32_t signaled_count, i; - entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); - if (!entries) + points = kmalloc_array(count, sizeof(*points), GFP_KERNEL); + if (points == NULL) return -ENOMEM; + if (!user_points) { + memset(points, 0, count * sizeof(uint64_t)); + + } else if (copy_from_user(points, user_points, + sizeof(uint64_t) * count)) { + timeout = -EFAULT; + goto err_free_points; + } + + entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); + if (!entries) { + timeout = -ENOMEM; + goto err_free_points; + } /* Walk the list of sync objects and initialize entries. We do * this up-front so that we can properly return -EINVAL if there is * a syncobj with a missing fence and then never have the chance of @@ -669,9 +701,13 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, */ signaled_count = 0; for (i = 0; i < count; ++i) { + struct dma_fence *fence; + entries[i].task = current; - entries[i].fence = drm_syncobj_fence_get(syncobjs[i]); - if (!entries[i].fence) { + entries[i].point = points[i]; + fence = drm_syncobj_fence_get(syncobjs[i]); + if (!fence || dma_fence_chain_find_seqno(&fence, points[i])) { + dma_fence_put(fence); if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue; } else { @@ -680,7 +716,13 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, } } - if (dma_fence_is_signaled(entries[i].fence)) { + if (fence) + entries[i].fence = fence; + else + entries[i].fence = dma_fence_get_stub(); + + if ((flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE) || + dma_fence_is_signaled(entries[i].fence)) { if (signaled_count == 0 && idx) *idx = i; signaled_count++; @@ -713,7 +755,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (!fence) continue; - if (dma_fence_is_signaled(fence) || + if ((flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE) || + dma_fence_is_signaled(fence) || (!entries[i].fence_cb.func && dma_fence_add_callback(fence, &entries[i].fence_cb, @@ -758,6 +801,9 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, } kfree(entries); +err_free_points: + kfree(points); + return timeout; } @@ -796,19 +842,33 @@ static signed long drm_timeout_abs_to_jiffies(int64_t timeout_nsec) static int drm_syncobj_array_wait(struct drm_device *dev, struct drm_file *file_private, struct drm_syncobj_wait *wait, - struct drm_syncobj **syncobjs) + struct drm_syncobj_timeline_wait *timeline_wait, + struct drm_syncobj **syncobjs, bool timeline) { - signed long timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); + signed long timeout = 0; uint32_t first = ~0; - timeout = drm_syncobj_array_wait_timeout(syncobjs, - wait->count_handles, - wait->flags, - timeout, &first); - if (timeout < 0) - return timeout; - - wait->first_signaled = first; + if (!timeline) { + timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); + timeout = drm_syncobj_array_wait_timeout(syncobjs, + NULL, + wait->count_handles, + wait->flags, + timeout, &first); + if (timeout < 0) + return timeout; + wait->first_signaled = first; + } else { + timeout = drm_timeout_abs_to_jiffies(timeline_wait->timeout_nsec); + timeout = drm_syncobj_array_wait_timeout(syncobjs, + u64_to_user_ptr(timeline_wait->points), + timeline_wait->count_handles, + timeline_wait->flags, + timeout, &first); + if (timeout < 0) + return timeout; + timeline_wait->first_signaled = first; + } return 0; } @@ -894,13 +954,48 @@ drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, return ret; ret = drm_syncobj_array_wait(dev, file_private, - args, syncobjs); + args, NULL, syncobjs, false); drm_syncobj_array_free(syncobjs, args->count_handles); return ret; } +int +drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_wait *args = data; + struct drm_syncobj **syncobjs; + int ret = 0; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL | + DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT | + DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + ret = drm_syncobj_array_wait(dev, file_private, + NULL, args, syncobjs, true); + + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} + + int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 300f336633f2..0092111d002c 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -737,6 +737,7 @@ struct drm_syncobj_handle { #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ @@ -747,6 +748,19 @@ struct drm_syncobj_wait { __u32 pad; }; +struct drm_syncobj_timeline_wait { + __u64 handles; + /* wait on specific timeline point for every handles*/ + __u64 points; + /* absolute timeout */ + __s64 timeout_nsec; + __u32 count_handles; + __u32 flags; + __u32 first_signaled; /* only valid when not waiting all */ + __u32 pad; +}; + + struct drm_syncobj_array { __u64 handles; __u32 count_handles; @@ -909,6 +923,7 @@ extern "C" { #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. From patchwork Tue Dec 11 10:34:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723443 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 2DDC21751 for ; Tue, 11 Dec 2018 10:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E0742A0AA for ; Tue, 11 Dec 2018 10:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11C982A0DC; Tue, 11 Dec 2018 10:35:47 +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=unavailable 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 A754E2A0AA for ; Tue, 11 Dec 2018 10:35:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A3846E0A4; Tue, 11 Dec 2018 10:35:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700084.outbound.protection.outlook.com [40.107.70.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 059136E09E; Tue, 11 Dec 2018 10:35:43 +0000 (UTC) Received: from MWHPR12CA0049.namprd12.prod.outlook.com (2603:10b6:300:103::11) by BN7PR12MB2626.namprd12.prod.outlook.com (2603:10b6:408:29::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.20; Tue, 11 Dec 2018 10:35:40 +0000 Received: from BY2NAM03FT045.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::209) by MWHPR12CA0049.outlook.office365.com (2603:10b6:300:103::11) 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:39 +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 BY2NAM03FT045.mail.protection.outlook.com (10.152.85.113) 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:39 +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:37 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:44 +0800 Message-ID: <20181211103449.25899-5-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)(376002)(346002)(39860400002)(396003)(2980300002)(428003)(199004)(189003)(446003)(23676004)(2616005)(14444005)(77096007)(126002)(66574011)(47776003)(186003)(5820100001)(7696005)(76176011)(68736007)(11346002)(486006)(1076002)(53936002)(6666004)(26005)(476003)(4326008)(105586002)(53416004)(106466001)(104016004)(305945005)(8936002)(336012)(426003)(97736004)(5660300001)(36756003)(81156014)(2870700001)(81166006)(2906002)(356004)(86362001)(478600001)(50466002)(8676002)(54906003)(72206003)(110136005)(2201001)(316002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR12MB2626; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT045; 1:6ETpTmGeibsPJJvBjPvpJDEApez+NskhMmfcBTSkqF/wm03HChdMQrf7dNNhzfMiRF0B7/lzhkotYPKUFqK6jf+UcQ7VnkRU1WMMmMUW7fVAvAEMd6ihBy+iI9mQRXoS X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 954e2063-0ebb-48a2-2907-08d65f5464ca X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BN7PR12MB2626; X-Microsoft-Exchange-Diagnostics: 1; BN7PR12MB2626; 3:5OYVSEjSmyM69L8iO/hsLec7z8nVPLnnY/vxKcLHIJ7EGp8z2w8YcEhTB7fbZZ+le0FJ1VuK/SmXPmIMJWedT0b/gkRgK3KzrJnG1lPadhU1iBjDE5Yj4SrHLvAyD/3Lftkod6onOyefha02GbH12++tMbqVDyHBIdPuMDFZ6fZRgaFQeF8l+U8eqPIOr19eeNX8TYvNv0ffUT62fHPiu1e9rsQ6bEvXHAkNYBwUS8cWKuTPYQRq3OZ/3B5tAr5M+wdVmyWzOG+dhXBGoQcAxrass+DC+jecL1a1/eSQAi6BJuyYT0vxtkNr+Cv/Z0ZcB0brGtPdjC9mRMpMH9cBbfsNdZQTaxe9HozQSo7DNSo=; 25:cHr4bCwUG5ds5E5Ufgs3IKG3U0V1fR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U2FgfS/QD8whJ7wsjqa5FBC55VE6hT+Y/cOFA+9dIJmguoKbTZKSDKLOrGrg 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)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:BN7PR12MB2626; BCL:0; PCL:0; RULEID:; SRVR:BN7PR12MB2626; X-Microsoft-Exchange-Diagnostics: 1; BN7PR12MB2626; 4:zjAnYX7sejhKTpvuOR/3QVhFkzmLvSWducIyl2AdoToTGzL/gYXNYLLKM5TFZNN8N8l/yna6v/T3S6sLQn2EyYMMUy5rSp3GdKlq4PzKep2X2uPku9WDxEk6B5Pce3NEZfy/6SzvzJ+OSO+J+NlUdP+p02FMmgBcPnGIiZ6hbLheJA5303aWMIbPj5ZZLmh5C5LctojT89iMmjxXvneltMX/4tt2aj5y9JTwsp0+uA2BuyyBjVUviEPtRHiJMoL78X5BPN76a2gp+5nhIb2atg== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBN7PR12MB2626=3B23=3A4LOLBEa?= =?utf-8?q?MzamZYJZpL0ojp1szpkDBLbgFsHsQF+bBs3VPRsRcShbxUTCcVxv+ulH9CQ71QHI8?= =?utf-8?q?bQqQpq3NsnsdvUL2BvB5AE3q7zl7QCHEyOBoYoFDjGnucOEfJoMQ38QlvtFfWJ9ce?= =?utf-8?q?fkDcHCUdBOI6dognMZyDjfqWRUNJdUjctpea1KmdW8aUeF7Q9j+SfhK19imNuVdkV?= =?utf-8?q?+iGZk+4xKXxZpjVuHC9a6WSq2ufuHdSc76zhRnqn78fZdC+gQZt1y8ndmFCB4uVk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+s5temEsIyBfff/KkURAt/oVSI1VhEBKMP2eX/Kzt1C01R25QZ6Pp6i0zvfE/DEeSv1jA=; 7:8b5s37yUhGVblpiJMOimB0l+N7HBjROjJhX6MorEA3Zt/WZ8YJfOmJaMVVQ9LbyO8U4P+K9YLP/mtKOP/N+rEeS1T0yI2eE66UWSu3a1a7B1hUlJACQUmybxU62mvFJKdVmbOiSt9Bd8nqC4Td8tGg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR12MB2626; 20:XeMkJZgh8xBNKPtiEyxQZDUWfwgRIlcQkAAXoRKsEbyP6AxGD1l51Hh13bLuyq2Sl70KJqjBfnbLruvfDzc+UerD1vHkO7ZOe9M6V5Atjsay/x+Q5tspz8goyJa6yRYhmvZ58gsZzhDY6G5fbf1VWzRa2v9Ln1/jrZlRbasBWheC6SutzSKZNLFXcSkiuzpicS45qFBuZiJJ+isbMs4dNUccqSm1ok2kGdqeF9QcM7plLVOJijDwA9PB+JA/yiFw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:39.0490 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 954e2063-0ebb-48a2-2907-08d65f5464ca 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: BN7PR12MB2626 Subject: [Intel-gfx] [PATCH 05/10] drm/syncobj: add timeline payload query ioctl v4 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: Chunming Zhou , Daniel Rakos , Bas Nieuwenhuizen , Dave Airlie , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP user mode can query timeline payload. v2: check return value of copy_to_user v3: handle querying entry by entry v4: rebase on new chain container, simplify interface Signed-off-by: Chunming Zhou Cc: Daniel Rakos Cc: Jason Ekstrand Cc: Bas Nieuwenhuizen Cc: Dave Airlie Cc: Christian König Cc: Chris Wilson --- drivers/gpu/drm/drm_internal.h | 2 ++ drivers/gpu/drm/drm_ioctl.c | 2 ++ drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 10 ++++++++ 4 files changed, 57 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 18b41e10195c..dab4d5936441 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -184,6 +184,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private); /* drm_framebuffer.c */ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index a9a17ed35cc4..7578ef6dc1d1 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -681,6 +681,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, drm_crtc_queue_sequence_ioctl, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, DRM_MASTER|DRM_UNLOCKED), diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 532d7d3c98cd..76ce13dafc4d 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -1061,3 +1061,46 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; } + +int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_array *args = data; + struct drm_syncobj **syncobjs; + uint64_t __user *points = u64_to_user_ptr(args->points); + uint32_t i; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->pad != 0) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + for (i = 0; i < args->count_handles; i++) { + struct dma_fence_chain *chain; + struct dma_fence *fence; + uint64_t point; + + fence = drm_syncobj_fence_get(syncobjs[i]); + chain = to_dma_fence_chain(fence); + point = chain ? fence->seqno : 0; + ret = copy_to_user(&points[i], &point, sizeof(uint64_t)); + ret = ret ? -EFAULT : 0; + if (ret) + break; + } + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 0092111d002c..b2c36f2b2599 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -767,6 +767,14 @@ struct drm_syncobj_array { __u32 pad; }; +struct drm_syncobj_timeline_array { + __u64 handles; + __u64 points; + __u32 count_handles; + __u32 pad; +}; + + /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ @@ -924,6 +932,8 @@ extern "C" { #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) +#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) + /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. From patchwork Tue Dec 11 10:34:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723445 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 1F7881869 for ; Tue, 11 Dec 2018 10:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EEEE2A0AA for ; Tue, 11 Dec 2018 10:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02FEF2A0DC; Tue, 11 Dec 2018 10:35:53 +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 ACADB2A0AA for ; Tue, 11 Dec 2018 10:35:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9B616E0AE; Tue, 11 Dec 2018 10:35:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740071.outbound.protection.outlook.com [40.107.74.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 168526E0A3; Tue, 11 Dec 2018 10:35:50 +0000 (UTC) Received: from BN6PR1201CA0017.namprd12.prod.outlook.com (2603:10b6:405:4c::27) by DM6PR12MB2635.namprd12.prod.outlook.com (2603:10b6:5:4a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.23; Tue, 11 Dec 2018 10:35:47 +0000 Received: from BY2NAM03FT004.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by BN6PR1201CA0017.outlook.office365.com (2603:10b6:405:4c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.18 via Frontend Transport; Tue, 11 Dec 2018 10:35:47 +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 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.1425.16 via Frontend Transport; Tue, 11 Dec 2018 10:35:46 +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:45 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:45 +0800 Message-ID: <20181211103449.25899-6-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)(396003)(346002)(376002)(136003)(39860400002)(2980300002)(428003)(189003)(199004)(81166006)(2616005)(336012)(106466001)(7696005)(476003)(81156014)(126002)(77096007)(11346002)(53416004)(53936002)(5820100001)(446003)(186003)(105586002)(47776003)(68736007)(50226002)(8936002)(97736004)(39060400002)(4326008)(23676004)(26005)(8676002)(426003)(486006)(305945005)(72206003)(478600001)(2870700001)(2201001)(2906002)(104016004)(76176011)(356004)(50466002)(66574011)(5660300001)(316002)(1076002)(86362001)(14444005)(36756003)(110136005)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2635; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT004; 1:UhjOzItRiJuhKZ4iKa4Eh9vjvy/AWu0dBkezNV8FgkohFSl0suWC8ufaCtaNib0wg3FownrFkhyioSAOIiOuaul3uno6IwmMncWN1bDysb87UJ5GALWlSROYm0TiHgen X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48273570-947e-46ed-ad53-08d65f546978 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:DM6PR12MB2635; X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 3:HpBvLEE/Blt1d8Z4RvraY7MYOj9HRlsSFNHz1lCLXY5ERhLYCs+evat/JLQi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czbKlSd716SWt8ozlpXXlPnhp6IDoRfVxZhohi8hT31aXhhqi42e25Wb+i6AY3YxweKklVUrYAOGbcBcFQMia2guVlXMKtCyeiIgQ+Ohn3fYcQrj7RwfV35jehi/rJp/UJpDFXbb2yPgcPDK0O4M92qo2ilT7psdyKUCdO5Ik0zBMwtwbnN63Y7iLAX76PXb/D6P+QkY70dWCYfopV15X1NIOmpfOlux0VVxrzBaOZT3oXtzg61FaCCNwlB1RsbKFYQKERCG4b78yqYqwfJFkPCgtL5OPDScrq9miS9SCPzQ0v7sYCbFWpomcBe2TshpwpmtDmww+0Qv398MtgikQbPUsJE/XppJWQ/g7RhYWIRG/CCAqyoPus5cUJ9pI6UTMmKSzvADV3jLJah68 X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(93006095)(93003095)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DM6PR12MB2635; BCL:0; PCL:0; RULEID:; SRVR:DM6PR12MB2635; X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 4:I6TSEaS1PjZ7IYF1+R8xfR87X2ch4DOhEFvWQCANSED19VFOBd1Pb+7suym++54lLmdZdto3qMzEQMlySzOkwVFhTpP3SD7mALyDSD8+f5HXvnv82cIwAiCOIk8755V1Dp5A7SG9wXoIp4h5c1v4jmAX97gyyUPKRTDXcgBKJUSAW+N1FsTfPrQHIfJ/uh6r8P6YJUrRgAeNEIMcl+jeLKYqBTRrsE9IZ3UtiERIyVUhNS3SC2JVfZsLZCVFRyUN+THd89dcAnHCyGnDZwR85g== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?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MEPIAE7NQnIP9sMQHRgYVaSoKe96Zs4m13H9KDJ4Q6fFKxKS/XUdCKgsNJQ8h+A0YCthG1FXsfyy9hONigJm1N5EB+8e3kePo/+x8T17iCE/m15SZbp8KQkkFQLB5D5lJVccWyreCzOrxeWiWYgFZrIm5zae3N0vQfAkc+YR/AZ85E2YrhPb26zN3f0Kx7L5YRhfZitajFRcg==; 5:JnqrQ4W1q4qDNVTRtkQldsG5OcGPAvJ416ogf25f9CuRjZsA/3+z3HL8dQNk3NRTuKtT0qGmCDii4DibCXdbCd8rR33/b4OOb9fkIA45sUfiiNYM6D4LuOOEQNMidjw52wNA//0vpQ4uqLAJ5h7/xZ+MKhD43kVnKuBrReMMt1k=; 7:Qs/H0nNBDuemOQU4pOnNAdCoDB/1kdEpxLcBpHpT5gGe28BP+ec2FF573ewU7IMkbwpBEMnDcY/9VGfn8apQX3w9Z87X+aW9Ex8QjIH3rrRahJtnA8QgoOapb18mHoc2CLgxwXiV4WrQICrCaetHfQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 20:IKJH9Viq0FcDxfZhWdvsFSlf0ygwLoGrKWmtu8+7aCCbbzjPTCXZKd6H9qPQZjp3QwswNiGTECD1PdBE+zfxVR+cPu5HVuf6jtfSO0F7qubhdvLp7bdv+PraucRoRDoBTQluwCUleVvIEHDD7DpKbA7AOdUu/hm5R0a0RpbnYAdQEZlaA9XdEPqJO0vP1BjOPgpX8xte+FHMKv63LH45Fi5DLMvb7pdGKxYaiAVLoHN4wQhQlGxL2bY2iqapoVb5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:46.9036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48273570-947e-46ed-ad53-08d65f546978 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: DM6PR12MB2635 Subject: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence 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 Implement finding the right timeline point in drm_syncobj_find_fence. v2: return -EINVAL when the point is not submitted yet. v3: fix reference counting bug, add flags handling as well Signed-off-by: Christian König --- drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 76ce13dafc4d..d964b348ecba 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private, struct dma_fence **fence) { struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle); - int ret = 0; + struct syncobj_wait_entry wait; + int ret; if (!syncobj) return -ENOENT; *fence = drm_syncobj_fence_get(syncobj); - if (!*fence) { + drm_syncobj_put(syncobj); + + if (*fence) { + ret = dma_fence_chain_find_seqno(fence, point); + if (!ret) + return 0; + dma_fence_put(*fence); + } else { ret = -EINVAL; } - drm_syncobj_put(syncobj); + + if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)) + return ret; + + memset(&wait, 0, sizeof(wait)); + wait.task = current; + wait.point = point; + drm_syncobj_fence_add_wait(syncobj, &wait); + + do { + set_current_state(TASK_INTERRUPTIBLE); + if (wait.fence) { + ret = 0; + break; + } + + if (signal_pending(current)) { + ret = -ERESTARTSYS; + break; + } + + schedule(); + } while (1); + + __set_current_state(TASK_RUNNING); + *fence = wait.fence; + + if (wait.node.next) + drm_syncobj_remove_wait(syncobj, &wait); + return ret; } EXPORT_SYMBOL(drm_syncobj_find_fence); From patchwork Tue Dec 11 10:34:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723451 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 E27F41869 for ; Tue, 11 Dec 2018 10:36:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D14222A0AA for ; Tue, 11 Dec 2018 10:36:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4F6E2A0DC; Tue, 11 Dec 2018 10:36:03 +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=unavailable 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 3E7182A0AA for ; Tue, 11 Dec 2018 10:36:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD2BD6E0B3; Tue, 11 Dec 2018 10:36:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740048.outbound.protection.outlook.com [40.107.74.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 06DAA6E0A3; Tue, 11 Dec 2018 10:36:00 +0000 (UTC) Received: from SN1PR12CA0096.namprd12.prod.outlook.com (2603:10b6:802:21::31) by DM6PR12MB2635.namprd12.prod.outlook.com (2603:10b6:5:4a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.23; Tue, 11 Dec 2018 10:35:57 +0000 Received: from BY2NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::202) by SN1PR12CA0096.outlook.office365.com (2603:10b6:802:21::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.23 via Frontend Transport; Tue, 11 Dec 2018 10:35:57 +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 BY2NAM03FT011.mail.protection.outlook.com (10.152.84.233) 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:56 +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:55 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:46 +0800 Message-ID: <20181211103449.25899-7-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)(396003)(346002)(376002)(136003)(39860400002)(2980300002)(428003)(189003)(199004)(81166006)(2616005)(336012)(106466001)(7696005)(476003)(81156014)(126002)(77096007)(11346002)(53416004)(53936002)(5820100001)(446003)(186003)(105586002)(47776003)(68736007)(50226002)(8936002)(97736004)(4326008)(23676004)(26005)(8676002)(426003)(486006)(305945005)(72206003)(478600001)(2870700001)(2201001)(2906002)(104016004)(76176011)(356004)(50466002)(66574011)(6666004)(5660300001)(316002)(1076002)(86362001)(14444005)(36756003)(110136005)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2635; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT011; 1:HRV0F+JW9VlvxfPBoKDkMnaV6wqNBnYuQmylG1lsn3YjjNrOUyLLKFGnX94EOPlfRuRJkmhS/2j/EU+k7eR1pi35QEPqnMCLG1Y0ia4j+NKyvgfXNOi54vOF6bTM4pHw X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d54fa203-e304-4fd2-b625-08d65f546f80 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:DM6PR12MB2635; X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 3:oaya8re3LvRKBMVwuhxDuiUNiQCsT7V83eWZTNEN25GdoBHlwn79VrPaBBvqvpNDkp1MFYSF2yMlQ3xzC+mlihbXdHUrMKp9DL7uepDchUUXUHaPySM/zGmHE4ihN5ZXrXVk9Prf1wmQqZdG+smoidRWQgHcFgt2e2mXKNmRW8i0YKDnlOBeBVFHzfgT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T2pCCdhCSWoj7caXSCu0fgpqp3NhutDfjwMiBL16lfClUrdr9g8kEDvy5LLSFMSMrT6Ah+xRR/duF5+hv1YhNvq+DmfkOowLq0Sn6/BTfp5+49dY6M723FGjUnge44yCuErLa8EAWkObg0LLQVYwTgEyRhJRNccGdmRIox4T9cecE+8uk4kD6zSZ0fkPTCZdoBHhOFWyatc98UaCBz24UxW1yAvCbGVBTGQBp5qRClgw1jfcYx7tCe8ol9cnOwQHxHWd+ufPxRMOGvTWw9wcRFmQygHl73JRcqsl X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(93006095)(93003095)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DM6PR12MB2635; BCL:0; PCL:0; RULEID:; SRVR:DM6PR12MB2635; X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 4:65dOc7XeZqOtPBck1cCRYN31P5vUTczM5IwOeUdYJSOT81ai9cSGbwKMO2P4YFDct2C2Myumw06hGvtGe8mMpDVdqJaRXiq7TFE56bdNenegLESfWxR3IVQvq7KtQWBx9DotH+g49jU5QivC5htONEAIZ99leMaYHwAvVGRoQ+r2W7kkMcWAwmdjB32/9p2c+Vnz5uRJFNX20JSlm9L9t8C+BTZySI5b+ORVXUUbCIyVWtPjwQzPQO87y91OGHfLJKqYQkJqy3him6EnvdKe3Q== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM6PR12MB2635=3B23=3A6XidqTh?= =?utf-8?q?3ai7zShwqIbfJjxjsXFrLS5UUOkvirMTARFXw3f4twzXyRghuYtyM1T6gKhuawywU?= =?utf-8?q?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FZnYJiNUM1Lc7tP8eiKXZ/eb4i0Sec8+bYnnCjxRUbPT8AOyDwNJROITqYxnkkySXTRWPh8TNBh3keyTnDM2bD+wmFvkI+A==; 5:qYYFU8ORByN1Lfrk03zzW84WqBwRwi9qLxNbL8EbtPCt8v7Pz4mBMSssp/AUWRoidYwdbKHpQ35ZiW+PRp0Nz7BnMHR5nkt4gWJLRtNz7jGMmjbR7VEeHwHHb3TrNfoqlg6XZ3HVpLCy/keM9qkwQ4E8zU7LkjWaPKhNZ7vIQDs=; 7:2+zrulUXT519A1T36oH2otc8sxXdNJGQFeYKBJFhDnX/VAnamcaYdtDcVXPXHOlC7MeKsMys9fChpZqX/iXPSoXBfrtzdT5MwMJhjKhDkli7a0mNPTh4/IOpvjTfS2po/u0XOo7sFUgRPUsronLhYA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB2635; 20:DMZQ42+5Y7aOJqr4x/+Se2K+3dx45cqKGhnDV1RhTsO106PiDzcybskOmMcXLjoyY4ur2t99AoiU5vMkr7LgM4ec2JVSYNSbNI1YYW4uTxSNRXArp8IE1Z6GFnXVVgvF09U8FF0bi80KaBd5NJlplnr1AsZfGVrR0SoRuITxpKWWDttPFMZWLpo4evhJEAxj7EFTJ8dVMeaiH88Sf70i2Rp1tvSswKix6Q/GRXjMjHyvKo78DvzspTm/OC/1G2Bk X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:56.9601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d54fa203-e304-4fd2-b625-08d65f546f80 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: DM6PR12MB2635 Subject: [Intel-gfx] [PATCH 07/10] drm/amdgpu: add timeline support in amdgpu CS 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: Chunming Zhou , Daniel Rakos , Bas Nieuwenhuizen , Dave Airlie , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP syncobj wait/signal operation is appending in command submission. v2: separate to two kinds in/out_deps functions Signed-off-by: Chunming Zhou Cc: Daniel Rakos Cc: Jason Ekstrand Cc: Bas Nieuwenhuizen Cc: Dave Airlie Cc: Christian König Cc: Chris Wilson --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 147 +++++++++++++++++++++---- include/uapi/drm/amdgpu_drm.h | 8 ++ 3 files changed, 140 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 42f882c633ee..f9160ea1396a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -545,6 +545,12 @@ struct amdgpu_cs_chunk { void *kdata; }; +struct amdgpu_cs_post_dep { + struct drm_syncobj *syncobj; + struct dma_fence_chain *chain; + u64 point; +}; + struct amdgpu_cs_parser { struct amdgpu_device *adev; struct drm_file *filp; @@ -574,8 +580,8 @@ struct amdgpu_cs_parser { /* user fence */ struct amdgpu_bo_list_entry uf_entry; - unsigned num_post_dep_syncobjs; - struct drm_syncobj **post_dep_syncobjs; + unsigned num_post_deps; + struct amdgpu_cs_post_dep *post_deps; }; static inline u32 amdgpu_get_ib_value(struct amdgpu_cs_parser *p, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index dc54e9efd910..580f1ea27157 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -213,6 +213,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs case AMDGPU_CHUNK_ID_DEPENDENCIES: case AMDGPU_CHUNK_ID_SYNCOBJ_IN: case AMDGPU_CHUNK_ID_SYNCOBJ_OUT: + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT: + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL: break; default: @@ -792,9 +794,11 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, ttm_eu_backoff_reservation(&parser->ticket, &parser->validated); - for (i = 0; i < parser->num_post_dep_syncobjs; i++) - drm_syncobj_put(parser->post_dep_syncobjs[i]); - kfree(parser->post_dep_syncobjs); + for (i = 0; i < parser->num_post_deps; i++) { + drm_syncobj_put(parser->post_deps[i].syncobj); + kfree(parser->post_deps[i].chain); + } + kfree(parser->post_deps); dma_fence_put(parser->fence); @@ -1100,13 +1104,18 @@ static int amdgpu_cs_process_fence_dep(struct amdgpu_cs_parser *p, } static int amdgpu_syncobj_lookup_and_add_to_sync(struct amdgpu_cs_parser *p, - uint32_t handle) + uint32_t handle, u64 point, + u64 flags) { - int r; struct dma_fence *fence; - r = drm_syncobj_find_fence(p->filp, handle, 0, 0, &fence); - if (r) + int r; + + r = drm_syncobj_find_fence(p->filp, handle, point, flags, &fence); + if (r) { + DRM_ERROR("syncobj %u failed to find fence @ %llu (%d)!\n", + handle, point, r); return r; + } r = amdgpu_sync_fence(p->adev, &p->job->sync, fence, true); dma_fence_put(fence); @@ -1117,46 +1126,115 @@ static int amdgpu_syncobj_lookup_and_add_to_sync(struct amdgpu_cs_parser *p, static int amdgpu_cs_process_syncobj_in_dep(struct amdgpu_cs_parser *p, struct amdgpu_cs_chunk *chunk) { + struct drm_amdgpu_cs_chunk_sem *deps; unsigned num_deps; int i, r; - struct drm_amdgpu_cs_chunk_sem *deps; deps = (struct drm_amdgpu_cs_chunk_sem *)chunk->kdata; num_deps = chunk->length_dw * 4 / sizeof(struct drm_amdgpu_cs_chunk_sem); + for (i = 0; i < num_deps; ++i) { + r = amdgpu_syncobj_lookup_and_add_to_sync(p, deps[i].handle, + 0, 0); + if (r) + return r; + } + + return 0; +} + +static int amdgpu_cs_process_syncobj_timeline_in_dep(struct amdgpu_cs_parser *p, + struct amdgpu_cs_chunk *chunk) +{ + struct drm_amdgpu_cs_chunk_syncobj *syncobj_deps; + unsigned num_deps; + int i, r; + + syncobj_deps = (struct drm_amdgpu_cs_chunk_syncobj *)chunk->kdata; + num_deps = chunk->length_dw * 4 / + sizeof(struct drm_amdgpu_cs_chunk_syncobj); for (i = 0; i < num_deps; ++i) { - r = amdgpu_syncobj_lookup_and_add_to_sync(p, deps[i].handle); + r = amdgpu_syncobj_lookup_and_add_to_sync(p, + syncobj_deps[i].handle, + syncobj_deps[i].point, + syncobj_deps[i].flags); if (r) return r; } + return 0; } static int amdgpu_cs_process_syncobj_out_dep(struct amdgpu_cs_parser *p, struct amdgpu_cs_chunk *chunk) { + struct drm_amdgpu_cs_chunk_sem *deps; unsigned num_deps; int i; - struct drm_amdgpu_cs_chunk_sem *deps; + deps = (struct drm_amdgpu_cs_chunk_sem *)chunk->kdata; num_deps = chunk->length_dw * 4 / sizeof(struct drm_amdgpu_cs_chunk_sem); - p->post_dep_syncobjs = kmalloc_array(num_deps, - sizeof(struct drm_syncobj *), - GFP_KERNEL); - p->num_post_dep_syncobjs = 0; + p->post_deps = kmalloc_array(num_deps, sizeof(*p->post_deps), + GFP_KERNEL); + p->num_post_deps = 0; + + if (!p->post_deps) + return -ENOMEM; + + + for (i = 0; i < num_deps; ++i) { + p->post_deps[i].syncobj = + drm_syncobj_find(p->filp, deps[i].handle); + if (!p->post_deps[i].syncobj) + return -EINVAL; + p->post_deps[i].chain = NULL; + p->post_deps[i].point = 0; + p->num_post_deps++; + } + + return 0; +} + + +static int amdgpu_cs_process_syncobj_timeline_out_dep(struct amdgpu_cs_parser *p, + struct amdgpu_cs_chunk + *chunk) +{ + struct drm_amdgpu_cs_chunk_syncobj *syncobj_deps; + unsigned num_deps; + int i; + + syncobj_deps = (struct drm_amdgpu_cs_chunk_syncobj *)chunk->kdata; + num_deps = chunk->length_dw * 4 / + sizeof(struct drm_amdgpu_cs_chunk_syncobj); + + p->post_deps = kmalloc_array(num_deps, sizeof(*p->post_deps), + GFP_KERNEL); + p->num_post_deps = 0; - if (!p->post_dep_syncobjs) + if (!p->post_deps) return -ENOMEM; for (i = 0; i < num_deps; ++i) { - p->post_dep_syncobjs[i] = drm_syncobj_find(p->filp, deps[i].handle); - if (!p->post_dep_syncobjs[i]) + struct amdgpu_cs_post_dep *dep = &p->post_deps[i]; + + dep->chain = kmalloc(sizeof(*dep->chain), GFP_KERNEL); + if (!dep->chain) + return -ENOMEM; + + dep->syncobj = drm_syncobj_find(p->filp, + syncobj_deps[i].handle); + if (!dep->syncobj) { + kfree(dep->chain); return -EINVAL; - p->num_post_dep_syncobjs++; + } + dep->point = syncobj_deps[i].point; + p->num_post_deps++; } + return 0; } @@ -1170,18 +1248,32 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, chunk = &p->chunks[i]; - if (chunk->chunk_id == AMDGPU_CHUNK_ID_DEPENDENCIES) { + switch (chunk->chunk_id) { + case AMDGPU_CHUNK_ID_DEPENDENCIES: r = amdgpu_cs_process_fence_dep(p, chunk); if (r) return r; - } else if (chunk->chunk_id == AMDGPU_CHUNK_ID_SYNCOBJ_IN) { + break; + case AMDGPU_CHUNK_ID_SYNCOBJ_IN: r = amdgpu_cs_process_syncobj_in_dep(p, chunk); if (r) return r; - } else if (chunk->chunk_id == AMDGPU_CHUNK_ID_SYNCOBJ_OUT) { + break; + case AMDGPU_CHUNK_ID_SYNCOBJ_OUT: r = amdgpu_cs_process_syncobj_out_dep(p, chunk); if (r) return r; + break; + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT: + r = amdgpu_cs_process_syncobj_timeline_in_dep(p, chunk); + if (r) + return r; + break; + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL: + r = amdgpu_cs_process_syncobj_timeline_out_dep(p, chunk); + if (r) + return r; + break; } } @@ -1192,8 +1284,17 @@ static void amdgpu_cs_post_dependencies(struct amdgpu_cs_parser *p) { int i; - for (i = 0; i < p->num_post_dep_syncobjs; ++i) - drm_syncobj_replace_fence(p->post_dep_syncobjs[i], p->fence); + for (i = 0; i < p->num_post_deps; ++i) { + if (p->post_deps[i].chain) { + drm_syncobj_add_point(p->post_deps[i].syncobj, + p->post_deps[i].chain, + p->fence, p->post_deps[i].point); + p->post_deps[i].chain = NULL; + } else { + drm_syncobj_replace_fence(p->post_deps[i].syncobj, + p->fence); + } + } } static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index be84e43c1e19..997222bc1afe 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -523,6 +523,8 @@ struct drm_amdgpu_gem_va { #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x07 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x08 struct drm_amdgpu_cs_chunk { __u32 chunk_id; @@ -598,6 +600,12 @@ struct drm_amdgpu_cs_chunk_sem { __u32 handle; }; +struct drm_amdgpu_cs_chunk_syncobj { + __u32 handle; + __u32 flags; + __u64 point; +}; + #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2 From patchwork Tue Dec 11 10:34:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723455 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 353621751 for ; Tue, 11 Dec 2018 10:36:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2594C2A0AA for ; Tue, 11 Dec 2018 10:36:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1985D2A0DC; Tue, 11 Dec 2018 10:36:09 +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=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 9CBD22A0AA for ; Tue, 11 Dec 2018 10:36:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CF3F6E0C0; Tue, 11 Dec 2018 10:36:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790053.outbound.protection.outlook.com [40.107.79.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12ED86E0BC; Tue, 11 Dec 2018 10:36:04 +0000 (UTC) Received: from MWHPR1201CA0022.namprd12.prod.outlook.com (2603:10b6:301:4a::32) by DM2PR12MB0064.namprd12.prod.outlook.com (2a01:111:e400:3c10::17) 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:36:00 +0000 Received: from BY2NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::201) by MWHPR1201CA0022.outlook.office365.com (2603:10b6:301:4a::32) 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:36:00 +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 BY2NAM03FT006.mail.protection.outlook.com (10.152.84.100) 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:59 +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:58 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:47 +0800 Message-ID: <20181211103449.25899-8-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)(396003)(39860400002)(346002)(376002)(2980300002)(428003)(189003)(199004)(76176011)(1076002)(81156014)(104016004)(86362001)(16586007)(316002)(110136005)(36756003)(478600001)(106466001)(105586002)(2906002)(47776003)(7696005)(53416004)(72206003)(305945005)(8676002)(53936002)(97736004)(5660300001)(4326008)(426003)(450100002)(50226002)(336012)(51416003)(2616005)(446003)(486006)(126002)(68736007)(14444005)(11346002)(476003)(2201001)(26005)(77096007)(186003)(6666004)(81166006)(356004)(8936002)(48376002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0064; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT006; 1:VbZpLCDze7w6hN3HrUSCNRVq1AzT3xxh4N8IrTANiPFaZKuJQffE7efOxIg2BfSZSzX0pZeKDUwWbMovtBOHdmATs0PXmOrQSRq7SUijVQs2vvIQIQG64hE3kDLUp9NC X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ac517b1-7f6a-437f-a36d-08d65f547143 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0064; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0064; 3:6Bkf/53GrL0caPKlG4MzXuVMJn0ehFGTqrKU+VLcrR7D3QNOV9p7sgQDxxuvLylaaSW38paKintCIaJu/wCgwbUYKbgPJaUkAZnfZoJ/duqUvdw+hloK9hFq1BDpGwJ/Yus6bmSzGWXghsVO9QkHkmGlvUjg5RccJXhVWTgWtv4ttssiWDHmL0VgPtAR6it+cP1n8VR2qhmf/7QfYLQ2w8jhlFE6RW7WwPYeI9K7ndMPTLf3cIN/JcjJr0hb6zYBszVsKNz6Vp8q5NtQv5TC94ytqdfStLSrO6hIturV8/uxJcG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p9y2ohRIETeu4LWnUprOGgcwCB5vWEF3mP2BMa7G4TYeQ1SQNUfxWpmjJ7Rheby+KvYxtNkEvBeSSSKzgE62/OjPGxII4iZX4w6or+9fV7e9DrSqiJ3ZTeCyHrGHHAIwpAGKbhaq6/k4eTtvai2XEY5p2y86FAR0K8Qj50lX/mif 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)(10201501046)(3231455)(999002)(944501520)(52105112)(3002001)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:DM2PR12MB0064; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0064; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0064; 4:YEpgoEV780/nEpqMd8pGIaswcSDeAudky5ZV4qzy8BdkQ2VuwtpOB5maCT/eqAtwQILgjXP5h1Jht0qPP8LBwsFs6FwNh3svTqTLFjDkDiU/JWncJlfpVXyxqRc6YyJ15H/MzAkRvvnGAE4XSchiXXEbgjayJkiPKO5nyDiz0aLilR5MsyLoiAEOpezNzkSeo2pXQZBR4PoLbUIogteqh4FPpFrelkii7kzC+3w7ibPGQclpVS+7Kv48HbBaOOR+KV8uatnEBTD3aliFS0+1nw== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0064; 23:KLPVZvqv+/DH+ArPNz6R8rC5404zdLeLLznBJyoKl?= Cc1HpSI4KZLViK2rYHQ3XkiaQx1sOwLMhk1W9nJm8RGobljWGbtKSMR/pMdnayb7sX29I+GTG4BJsSa/quejijWwt3+mz4QbSfJdO9yRNhb3TK/iAQJcID2GARfqPI0oR1zA19rBtL2YRGSsmcf1Vy9Q44iMPpdFILZ95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90/npo5LDpulXE4l3XvzOH6ZdF0VhWce4OO7xNJgTarezab8ak+tg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0064; 20:s3Q2X3C3A+zEVf/zbfyuA1MjcIc7uPe6V4lMq/KzisR+yKkR3+Mdmapey2U09Uuzm9Ac6r4vqqYnW4YxSJqT3sK2m6h4KSeiASijdyMAKBKid6aIZ+86fBxxMqz+GbnSopcPodXYK/iXXIFW1+zBw4Wd3Qud+l48dCZcAFNyD4Naco7ecdPDERPI6wf08SdD0EbJ2Bb/rvPONdeejH7wfxkHObCHiG65UUF6vZah4jwDx1QvMOKlm/qsWauK+GR8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:59.9622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac517b1-7f6a-437f-a36d-08d65f547143 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: DM2PR12MB0064 Subject: [Intel-gfx] [PATCH 08/10] drm/syncobj: add transition iotcls between binary and timeline 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: Chunming Zhou Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP we need to import/export timeline point. v2: unify to one transfer ioctl Signed-off-by: Chunming Zhou --- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 74 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 10 +++++ 4 files changed, 88 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index dab4d5936441..06c2adc4950e 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -176,6 +176,8 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private); int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 7578ef6dc1d1..e9d4bed12783 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -673,6 +673,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, drm_syncobj_fd_to_handle_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TRANSFER, drm_syncobj_transfer_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl, diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index d964b348ecba..3bba86c8160d 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -670,6 +670,80 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, &args->handle); } +static int drm_syncobj_transfer_to_timeline(struct drm_file *file_private, + struct drm_syncobj_transfer *args) +{ + struct drm_syncobj *timeline_syncobj = NULL; + struct dma_fence *fence; + struct dma_fence_chain *chain; + int ret; + + timeline_syncobj = drm_syncobj_find(file_private, args->dst_handle); + if (!timeline_syncobj) { + return -ENOENT; + } + ret = drm_syncobj_find_fence(file_private, args->src_handle, + args->src_point, args->flags, + &fence); + if (ret) + goto err; + chain = kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL); + if (!chain) { + ret = -ENOMEM; + goto err1; + } + drm_syncobj_add_point(timeline_syncobj, chain, fence, args->dst_point); +err1: + dma_fence_put(fence); +err: + drm_syncobj_put(timeline_syncobj); + + return ret; +} + +static int +drm_syncobj_transfer_to_binary(struct drm_file *file_private, + struct drm_syncobj_transfer *args) +{ + struct drm_syncobj *binary_syncobj = NULL; + struct dma_fence *fence; + int ret; + + binary_syncobj = drm_syncobj_find(file_private, args->dst_handle); + if (!binary_syncobj) + return -ENOENT; + ret = drm_syncobj_find_fence(file_private, args->src_handle, + args->src_point, args->flags, &fence); + if (ret) + goto err; + drm_syncobj_replace_fence(binary_syncobj, fence); + dma_fence_put(fence); +err: + drm_syncobj_put(binary_syncobj); + + return ret; +} +int +drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_transfer *args = data; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->pad) + return -EINVAL; + + if (args->dst_point) + ret = drm_syncobj_transfer_to_timeline(file_private, args); + else + ret = drm_syncobj_transfer_to_binary(file_private, args); + + return ret; +} + static void syncobj_wait_fence_func(struct dma_fence *fence, struct dma_fence_cb *cb) { diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index b2c36f2b2599..4c1e2e6579fa 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -735,6 +735,15 @@ struct drm_syncobj_handle { __u32 pad; }; +struct drm_syncobj_transfer { + __u32 src_handle; + __u32 dst_handle; + __u64 src_point; + __u64 dst_point; + __u32 flags; + __u32 pad; +}; + #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) @@ -933,6 +942,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) +#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) /** * Device specific ioctls should only be in their respective headers From patchwork Tue Dec 11 10:34:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723457 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 AD7F51869 for ; Tue, 11 Dec 2018 10:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C41D2A0AA for ; Tue, 11 Dec 2018 10:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 905AF2A0DC; Tue, 11 Dec 2018 10:36: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=BAD_ENC_HEADER,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 265132A0AA for ; Tue, 11 Dec 2018 10:36:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 757F76E0C1; Tue, 11 Dec 2018 10:36:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-eopbgr810048.outbound.protection.outlook.com [40.107.81.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71E686E0C1; Tue, 11 Dec 2018 10:36:06 +0000 (UTC) Received: from MWHPR12CA0037.namprd12.prod.outlook.com (10.172.49.23) by DM3PR12MB0842.namprd12.prod.outlook.com (10.164.7.28) 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:36:04 +0000 Received: from BY2NAM03FT064.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by MWHPR12CA0037.outlook.office365.com (2603:10b6:301:2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.19 via Frontend Transport; Tue, 11 Dec 2018 10:36:03 +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 BY2NAM03FT064.mail.protection.outlook.com (10.152.85.143) 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:36:03 +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:36:01 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:48 +0800 Message-ID: <20181211103449.25899-9-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)(346002)(396003)(39860400002)(376002)(136003)(2980300002)(428003)(199004)(189003)(14444005)(8936002)(104016004)(105586002)(446003)(11346002)(106466001)(305945005)(316002)(126002)(2616005)(486006)(476003)(72206003)(426003)(2201001)(47776003)(478600001)(186003)(68736007)(86362001)(336012)(16586007)(97736004)(1076002)(110136005)(50226002)(450100002)(77096007)(26005)(48376002)(53936002)(76176011)(50466002)(2906002)(5660300001)(356004)(6666004)(53416004)(36756003)(81166006)(8676002)(81156014)(4326008)(7696005)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0842; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT064; 1:ozkBuDC6GDuEnA38kQLpjvPYI77U1q4W4Jge6d5yDi9Mk+5dRNXvHyRFmDyYKaW9L100IBrPdzVbuLQ74uXFsoCblDAHnyYQHjiippAlTdqVpT977sLGy6QkHXoeYu1K X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9aab105d-0403-4b01-ab58-08d65f54733a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:DM3PR12MB0842; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0842; 3:UCnH6emplOT1QeEPjeAhZDzKBsaMtMdaAa9HrAYRGYIF1kdZftTk9gYOF4Tk/7HGeehEH8Cp4c2MAgtSB4uG5sce2sI70eauSEzG1wDzdUgo5SddXpoKAPEDAKWkiKMhIhKWsPH0J6M28ictQDdlAaoATNlcy5cuxPvnW0OSXjS8npmKIu9fs7WFsNkcKcf5vHKeCm1gAw66YKr2zCFrZEoxSOtkKuBZ2xEAflSsTebRNYsnkRrlcqHlfaZjXdAFgj1eUNOifY+lUtAjQnaJq3SKFX5zLbnrj3YZ3r/SmEFSGFmENVnhQKghyk4b4hB4YFDovOaVrUZ0su5fGQ4oGC1ASIWnYjBH2Q9URT2r4KI=; 25:YVsIUkrvLHZczJkKULwsFouAzUX800owNPp0UWE8lUf+TI3UcJt2+1XixFLcg0ujmBPXwh2sB0JHCxgQjN2mlLBfIm+wCQ+iKnDppKcWUy3rQaKdhDccI7uTNLFQOVAiaOM8fCDh2E5FVISm7/2lJ2wlwlb5i25WA2SzflYYVzbOC+KPWOCLFMnAPyGvORSbkPXMx4aF3ULm/nnfOo63CiQQVikAlPSTUK4jFVYnFtsNgze843wmaUlPQur9PZASO0Zh02tvH/ehIj2dSe3YlmakRy5fyN2LMg+I6dBU2mU0sodIE0ehZ1saerYx+PQiv9YKmAOQfcxBkSgkFSk3TitJ0OpmWxsEVSBwqqjZES0= X-MS-TrafficTypeDiagnostic: DM3PR12MB0842: X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0842; 31:1jel5ARED+J85gBDfCpPVRaM8dpm5uML7/sUGhXGyFdnVEg3e4imylFTTwFYJG6N6AI8Zj0rzhXKCcyx5nufVaobWLOA34SkmgjTC5dMDxCVrW9VqkPUieEm+MVedRF8EriAbNTIM53uGs0hKy/KoWaLSySsdhD5LZdX0Zy4Rkxyja+rhEswV+Hg/3Qo9LDcy0dMrapzg/O4M5WZJqKimwijWf3i51udRdlW5CpuOGw=; 20:JLOk1MnCxhiI9eBMsuzj6cAvueOpEcQeFKCsWFKGoOL6NgDOLKvhLdBZNZuaHmw9JpbhOrJG/NTajCIdvJ1gVvolqZT8oxVJX5DT8/8WAd206H6vUSNJqyj/vGx5yTBq+3Y/O3GsDSS9gm/DS3lTFxWOHvEsfWMLQnH1TltwlwXruZj5cG8wNvYMLD+2eirMmdR2VUcaanxNOze6X+tmK0+bc3RIw2MqhMX25dirYkfhABylJ7tHlCnQ/WAwKP+zn9KkP1aBjyoyAYhJ84XEb6hgFAvhPIsqvVtxkmTxlzQ+8H7chmNbITCm7y9dITq/0ZcvapLpJR3Yeve+y+6ZVZfheNLx0zix/vM7QjP4+od7nuYP0MBd+KmWLHFlmDzyUsuJuEQbw+Mo5bBP4mRNna83d0wHsUNaLWasqXrrX0LFjvYWLMJTaVBZ9DeP0i50fHvYuOAliQ5vgWFBufEpBQr9lDrXm7pDtL5GsM5YN/dXi3V9Q9hn9HtwGGzIirmD X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:DM3PR12MB0842; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0842; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0842; 4:wenOsY8vWINPLOITQ6pXYkxH9cLprpGbAcr3L+WQrdUqGtaC7Bvvj/3dNqZBx4n+enRl/8cE7ncVOnozjWUAKwZIO5l2/LTWL33BS6+pw2a1O557RYiusQDzQwKV2iNMX4oBe9McXLek5aumP4GMFXAoI8UpiGRPgyvnC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ON6rrLj0j+Zs3m0DzjXAKz8jtLFoBQ7iyc2gls7HqKtKijJ3cQHxgp18/EwM6Hmo67olxS+720WsaHpawCKR7ye5+3QOIdymghDml1gWV7SnO2nVqDR6EvKRW7EY9w=; 5:cSNXomFB1fRRAqzVIrqjVIbzKrO4vRpxTAi4V+BZNgbSkDK/VGFTCeheVpkPda0v8louGqXLXArYRRVh9O0iB6rpHF3uYFFTccGxtDOx40Qw8aSRb6snlOhERJ+ZQc5uVAS6MGhhu7UqJEulUvDIqT4ZAkrXBKuZO0OlRGiG+lw=; 7:Tx/+FvbX0AdIKPBlFBlQS+DfARL9QnEQXECw5wfH6/Dyd6PCnDyNCPPAYPM0kUKnCQlh4Hmoualz5Xiyt8xcggdMDBRJrLONu4KNUDOVlAfOQyC2bQNhsXSmmCNKklyWSVkOEESwTMVqEMWxA5ok7w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0842; 20:Cgz0hN2U3W7cOYdJU7w1xXt5AbQnuYHXHq5/glblTak/ydtzVFIkJQwRoA2hUCSJfSH+LD7ofpNSveu+Yg+7T/E6CGB47oBICgKULEKw80tuWkasT6d3AKdyEBH81xS6tY5IVzQS0HdedqUQFANSLuTZacPuu7XmGW00snWqBrtFHZ7C1wR1JtwWRRmvy+t7GsIiWgTihePE/fkEpfisIRN+r7tDs8ZKYJntV2fFVhBR6W6JAXu+rc0YspAASx5v X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:36:03.0401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9aab105d-0403-4b01-ab58-08d65f54733a 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: DM3PR12MB0842 Subject: [Intel-gfx] [PATCH 09/10] drm/syncobj: add timeline signal ioctl for syncobj 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: Chunming Zhou Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP v2: individually allocate chain array, since chain node is free independently. Signed-off-by: Chunming Zhou --- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 81 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 1 + 4 files changed, 86 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 06c2adc4950e..d7a19bd89cb2 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -186,6 +186,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private); int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index e9d4bed12783..a50dc62dc87b 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -683,6 +683,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED), diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 3bba86c8160d..961f6d343564 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -1173,6 +1173,87 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; } +int +drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_array *args = data; + struct drm_syncobj **syncobjs; + struct dma_fence_chain **chains; + uint64_t *points; + uint32_t i, j, timeline_count = 0; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -EOPNOTSUPP; + + if (args->pad != 0) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + points = kmalloc_array(args->count_handles, sizeof(*points), + GFP_KERNEL); + if (!points) { + ret = -ENOMEM; + goto out; + } + if (!u64_to_user_ptr(args->points)) { + memset(points, 0, args->count_handles * sizeof(uint64_t)); + } else if (copy_from_user(points, u64_to_user_ptr(args->points), + sizeof(uint64_t) * args->count_handles)) { + ret = -EFAULT; + goto err_points; + } + + + for (i = 0; i < args->count_handles; i++) { + if (points[i]) + timeline_count++; + } + chains = kmalloc_array(timeline_count, sizeof(void *), GFP_KERNEL); + if (!chains) { + ret = -ENOMEM; + goto err_points; + } + for (i = 0; i < timeline_count; i++) { + chains[i] = kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL); + if (!chains[i]) { + for (j = 0; j < i; j++) + kfree(chains[j]); + ret = -ENOMEM; + goto err_chains; + } + } + + for (i = 0, j = 0; i < args->count_handles; i++) { + if (points[i]) { + struct dma_fence *fence = dma_fence_get_stub(); + + drm_syncobj_add_point(syncobjs[i], chains[j++], + fence, points[i]); + dma_fence_put(fence); + } else + drm_syncobj_assign_null_handle(syncobjs[i]); + } +err_chains: + kfree(chains); +err_points: + kfree(points); +out: + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} + int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private) { diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 4c1e2e6579fa..fe00b74268eb 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -943,6 +943,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) /** * Device specific ioctls should only be in their respective headers From patchwork Tue Dec 11 10:34:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723461 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 D883B1751 for ; Tue, 11 Dec 2018 10:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8B1B2A0AA for ; Tue, 11 Dec 2018 10:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCBF92A0DC; Tue, 11 Dec 2018 10:36:15 +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=BAD_ENC_HEADER,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 793522A0D7 for ; Tue, 11 Dec 2018 10:36:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5E2D6E0C6; Tue, 11 Dec 2018 10:36:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680041.outbound.protection.outlook.com [40.107.68.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92AE76E0BE; Tue, 11 Dec 2018 10:36:12 +0000 (UTC) Received: from MWHPR1201CA0009.namprd12.prod.outlook.com (2603:10b6:301:4a::19) by DM2PR12MB0061.namprd12.prod.outlook.com (2a01:111:e400:3c11::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.19; Tue, 11 Dec 2018 10:36:06 +0000 Received: from BY2NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by MWHPR1201CA0009.outlook.office365.com (2603:10b6:301:4a::19) 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:36:06 +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 BY2NAM03FT006.mail.protection.outlook.com (10.152.84.100) 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:36:05 +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:36:04 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:49 +0800 Message-ID: <20181211103449.25899-10-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)(346002)(136003)(376002)(396003)(39860400002)(2980300002)(428003)(189003)(199004)(476003)(126002)(2616005)(486006)(356004)(6666004)(50466002)(48376002)(72206003)(478600001)(14444005)(4326008)(86362001)(50226002)(450100002)(8936002)(68736007)(446003)(11346002)(426003)(2201001)(81166006)(81156014)(8676002)(77096007)(26005)(106466001)(105586002)(1076002)(53936002)(336012)(5660300001)(47776003)(186003)(53416004)(36756003)(2906002)(316002)(16586007)(51416003)(7696005)(104016004)(97736004)(110136005)(305945005)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0061; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT006; 1:wTSIcxGNmWPaSSf0nvRxToJrmYULOIlsZR0HxyUfBkmeLQXnnH7OVtp2BY9rMc8C1rNFEg+nbTzDy4q3PMB81/hB0gJeXv3bJlNl+MeBa+333urqFBtBx3Lc373bzlP2 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f45bda21-3325-4ffa-813a-08d65f5474c6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:DM2PR12MB0061; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0061; 3:eNsUn0g6GOU7DTw5uhalXyjGTO1VGBAnzcjZQabJDK1qfcAUafG3p3j37Xe4GL3dsln9wn320J798Qx9f0iYkYP197VLhvOvg+PR4DlJsq44v3OBNeMqZIxkW2lj5XqczjUN9C12shkYznuV3FMwNz03bKecC4Mq3gbXoa2Vn1ZdqYhhHavXTZ6mTySliwvlhVLC6JhH5Ew5HsA2aOScSyQAKvn2y7hdTMHo2TlNgU6RdWVulVrJjZu85jUGArr32QjLbkWilYTYFdQO8GzUfE2BSD36sW8WEf9+M7WcNXEpuSjmRarPyMK5m+nca6/LSh12z4CV2sx2hV2/tnBAgNMNtsN8k43IwtZ3urNDzTA=; 25:lkyX6DiFIi+U+dYxmBR/2Ri2300IATGiK98Dh/f79xuos5ecXb78KznuA+LzuMEO5GNYUtrrOTjjEehruYa8QHMykjvFhmQSetyEGxWZhRL7W+IOw5zZ7VKcwqHv85LyhbxQAqnxvVnoCsxKfcmY+/dUH0sXz8GTmC9yFEq3BPDcQJnEaSXGCwldfBeHYLWkSrBu08iJuquF9M27r/019GSnN5SQLoOPOcNzrZlVAsbc3yyXgyZDthwhBGBPFV5zdrWuC2BTVo/PHEtwqfusZ46xc5Qvq8/D+oaaDdfKtkc3bb3mqnw13C+/SMkATmNcBaT52GvtQKkm1TI4m0H8a28+MfuhaeOlhlBq+ggJGm0= X-MS-TrafficTypeDiagnostic: DM2PR12MB0061: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0061; 31:nWsQ62ilpVZz73F8whR9v4pIflzEk6tdRKibXm0dyer2txNhXhE4KgFKhDYeKtKSywC/uY4rSroFb5nYAEwFY0RMX9lIIx8FX6r0kcl+ovzXdqij0PibJ5WNFI3V8KAWoA8cGy7BSsVqi9kTT9SvHvGnF9fV1bYlj+0KoZoWSL6st5EmPcWyo5jSuHvC8/SDT3G1OhRmN0SAT4uhE4eheD2ddGjvB6VElYHZNgTA1r0=; 20:6nlB98uhE7+tQ22SY6x0FAg1L0fdKE1DOySGebqVV/xjfxj6haTeajjdP1injlj7MQ6O6yytXyLATmKqpJ+zmB+53uVAftDfvuAq51yDCgo0Dbh3t1+9NukCZcDGKQ7/EIYRJ5xFU1V1Wdf3PDoY+UzYTyHy1YfJT9+xOqiPJt8bD4WEe+RAxB+WgIxlr80Z65I1LWYPktBlu/LaiDfFLwpda09+BVTiO+eVfNfiFRuozn+OPGDoUfhm8gmizbBhIg4nJEkqlUeqHDOScO6mI2VMrxj1xgJd0pt8IxPXYKf44bm5t6Un6BY9cAIHbpwTWuNO4eeuN6i0Bp4AhChs1rXimIZnV6DCJ07lcwUnPunFeJzJ/UuoTfDEz8MU9hbClOwsq772fR55syF+JYNhz+wW1FIuHGKhpNllpdrYjBb2hq/YLuQtJz+r1V6zFXxjy72uFVZmxocwMiDNClnYYm41yf70LDdpCEY+UkvQ8Q6oThzMQtlZdfC94BPHRA/b X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(10201501046)(3002001)(3231472)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DM2PR12MB0061; BC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GNLZZYJMBTeegjURk/YzkEbGofs0Le7Bpn6SiE4fI27lauvOwuXWoKZHoAalgGYzYSqqswWfVkhf7lPd5ynT/Ab6unoEUeNysCXN3Z0SKYqxcPS1rHEcynNSB6S7b0iK8Q8mRb3S4bbXc1qQCW3tiyIZv775HymB7l72o4Fe3o7StRhSuzqHU/yVYMviFQzlikmOAPKq7cVl1m5G3ra50YpXQ9tnqDZ3rdSSM0YhEFBjWnIjvEvYS63Uq14Akk0qlaVrDX7XJc6sEaFCZhSHygc/fFTWYRwX4fgfgofYLcYhAtiowT/0Nz5Mb7exiQJxdniHR70PEPkW/6oUTl1O51gy15CfnRyH8Iuqc9aEfRc0z6NAPbLWWNeM8Y=; 5:FWadhQrtdFZzfSMlXrFfaqNVWRI9sOBdxSQKNXMsbYuwKKY4Vbg5shWKbdZIB+QDbumrkoNbUF7GgRJw5wb3J429MP/xjEKbkhul9N9JLaHShA+gejqT/l4dOkYzjh1nHBj7hq0QQdIDesassnLGAUrclwI0+RMPBgWt+Cr7Yo8=; 7:lxl733npwyIQijgSt933SCv6BfmW5djkvd9801ob7OrkFn/1Vz2E/OjJWLgLKHzLPaJpHeJ/XQPELlmXiAYgOBtwUF1WTCc6MGw/IMkF0anon1NM/6OD4iHrLDH+/75QPUQDVjZEkSukvZKWH2aiQQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0061; 20:vvujs0H1YkA46v0TXBbNf/vCY66KOnHoEe2Fhvc13oTJKB60W2ZKOWg8bRMJzklGomhUp0F7Y8WckSRBBvZYAX9by5F88NratJ8boLWFSaeV6F9cn/1YmihZd65EbaCkKJg5pTkWXXjdrGQE+tC4IRIEgAx3zcFM5/n/UQpkdk+vWgPty5hNJVdoRvJfSHZbyUOKhUndPi2gn3uUY+85wakpwbLCUBZspzgYQIwIkWvtgM6hOo8/dv72MzM+1PKz X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:36:05.8530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f45bda21-3325-4ffa-813a-08d65f5474c6 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: DM2PR12MB0061 Subject: [Intel-gfx] [PATCH 10/10] drm/amdgpu: update version for timeline syncobj support in amdgpu 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: Chunming Zhou Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 8de55f7f1a3a..cafafdb1d03f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -71,9 +71,10 @@ * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk). * - 3.26.0 - GFX9: Process AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE. * - 3.27.0 - Add new chunk to to AMDGPU_CS to enable BO_LIST creation. + * - 3.28.0 - Add syncobj timeline support to AMDGPU_CS. */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 27 +#define KMS_DRIVER_MINOR 28 #define KMS_DRIVER_PATCHLEVEL 0 int amdgpu_vram_limit = 0;