From patchwork Tue Mar 12 03:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10848557 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 B4BF01515 for ; Tue, 12 Mar 2019 03:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A01DD291A9 for ; Tue, 12 Mar 2019 03:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 943F3294BD; Tue, 12 Mar 2019 03:11:58 +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 ED2D3291A9 for ; Tue, 12 Mar 2019 03:11:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF27F89D9B; Tue, 12 Mar 2019 03:11:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720052.outbound.protection.outlook.com [40.107.72.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B77189854; Tue, 12 Mar 2019 03:11:55 +0000 (UTC) Received: from BN4PR12CA0006.namprd12.prod.outlook.com (2603:10b6:403:2::16) by DM6PR12MB3465.namprd12.prod.outlook.com (2603:10b6:5:3b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Tue, 12 Mar 2019 03:11:53 +0000 Received: from DM3NAM03FT055.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by BN4PR12CA0006.outlook.office365.com (2603:10b6:403:2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 12 Mar 2019 03:11:52 +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 DM3NAM03FT055.mail.protection.outlook.com (10.152.83.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.19 via Frontend Transport; Tue, 12 Mar 2019 03:11:51 +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; Mon, 11 Mar 2019 22:11:49 -0500 From: Chunming Zhou To: , , , , Subject: [PATCH 6/9] drm/amdgpu: add timeline support in amdgpu CS v3 Date: Tue, 12 Mar 2019 11:10:46 +0800 Message-ID: <20190312031049.23647-6-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190312031049.23647-1-david1.zhou@amd.com> References: <20190312031049.23647-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)(39860400002)(376002)(396003)(136003)(346002)(2980300002)(428003)(189003)(199004)(5820100001)(47776003)(5660300002)(77096007)(68736007)(97736004)(50466002)(104016004)(356004)(53936002)(81156014)(2870700001)(26005)(50226002)(6666004)(23676004)(8676002)(11346002)(81166006)(2906002)(305945005)(476003)(126002)(7696005)(486006)(446003)(478600001)(36756003)(2201001)(2616005)(336012)(426003)(186003)(4326008)(86362001)(6636002)(76176011)(72206003)(1076003)(105586002)(66574012)(54906003)(110136005)(316002)(53416004)(14444005)(8936002)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3465; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf844b70-9343-424e-e5f2-08d6a698797d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060); SRVR:DM6PR12MB3465; X-MS-TrafficTypeDiagnostic: DM6PR12MB3465: X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB3465; 20:ZvhCm0ZhQSxBuhDa1/x8t0Qgj9NL0l/0dJ+OxRQGT4r8kIVhhIrqpcQJfhKYKVAKLRo6tL0nQ1pOsWeF6SJQKZyvuZTN8CD+31gTM+oq2gnO1PN/YypKXc1frg8rC4Oy3kc2M8XgMerlpG4BDy1aUTmichFvA6ADDUzesy5zbD6Ly9bwJkel2fT+RtahzPDw1Q/Zmj0UtKzP55lwGJU0rsIRi7K97I9AbUO6DWU6yEZaHj+jIqcdhzaw0scqXsHKyAam6tBkNBOMdXK+ckYJOWJx/JHPsOZ1q81C2tcbkabwDpaUhcVvuGSrQd1BftDuEsdAvIxpqKPw5oU/tdB+p2qCasR1Sta6sJrev4xqePowwV8Zcud924S5KA0+23HB2no0wI8Y8zuda1pRaZ3erVJZ98pkS9SKIqphRfpyYddJdrns/4dVqw9NbR1/ser6P9yrg/Q+nRhnj7tMG4/0K56keRNwUGsp/XYT248xI2tjOJYjz0VEsMXcTOBQXr9u X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09749A275C X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDM6PR12MB3465=3B23=3AjMrabUJ?= =?utf-8?q?iT8A7Gfc7HwTy/kVziouNMzLe75w5o87xygzrGL9IWzGAAUdMNx/x2X5NTE4ijLTE?= =?utf-8?q?jXuf/jD1wPsxPhIGP20TK4yNYEz6SswTaLLxQDjwQ11gPg4MY3s3gMUcX9n0yYwfd?= =?utf-8?q?3u317YGfuNr/RlgtNHqhMdimMbvF+6HCfAI/RW97KvkzrFh3QRtbXPq7BuXxjJip3?= =?utf-8?q?iWYIq1F+FvCVhEpsNm6QBcU7obfSmdmdlHceYqxOCaIdybLLm9pPxxbLEpwfq9LAt?= =?utf-8?q?CnYIEklbWaILHRVu0lv9GSldK79wdmF2oG53bMt479o5iTk35sAavl/HKziOMMuU/?= =?utf-8?q?JyH125JWdiTkAun6I0b4GNCduOjPWozL7CR44uLop/TpimcPAGoqXAHQsTTgA5H43?= =?utf-8?q?jgHQup3bF0A7POtuyfGbAo8TZx0qRolrs50zg3cor0sfDxH4vpDT7lRecM/hPgUBX?= =?utf-8?q?xcKv6M8CDu6dUzEtRMglBz42wgaRecpboxm1YxoV7o4n6iefVCJIXQsTeEINcUSNu?= =?utf-8?q?1lbO7Qlkiz0MPNT6ET2SqPdwahOjhe17qR2jul+I4XXixbFB3luEgSI5DaphZImCZ?= =?utf-8?q?29gWTkgiJw/kpidcAf/zID7/h071jeDXTl+CV1iONZX2kCvk35Etnqu2QR8yucH/w?= =?utf-8?q?4K89e/CrQPl1JVj62NL8KExBEBsKBePZnNYxUNPBIEwJw9rS63TveZg9Z1xGznb86?= =?utf-8?q?57YLOc8J3M5eQpNCnjSyMLuOu3dYW1jkMQAErqmuCDkLII1UI1dOKWJbBRp057Htw?= =?utf-8?q?ZPQLuW/8KQal8F2TJ0a9L2KQ3Jq4+eTpjq7JZJw6fqJMxoKKarRZ2mf4j1oC4+IxY?= =?utf-8?q?k0Q8sti9ded/V8XQOdGp6IzInDALJuL5JFJH3WdQGF4yRVr0EPgHdmJ8DZg/BnEPW?= =?utf-8?q?cWzly6p7VrWwRdFNKUWNiq2WIb0b0Hct8cWL/QIaEMtkH10hzUAYXBY05UJEHCcnP?= =?utf-8?q?JfVMmaC8TYuM9aA06JsPwGTh8oY3WrK9TiZY9zT+gTQ9gb4CiXUr5uAE/JSzoJ9SF?= =?utf-8?q?TgunXNkAxlgdcsoWG54zhH9Xk2gsIUPYbH0De8Kit+EVuKNbpeoIoVmXOO1t2ZTxQ?= =?utf-8?q?6QobK4L4L2wT/7wBJONysv4NTy2abL7vBtIcy3AIJvnXpw2I5LvbaWHQXnKmkf44d?= =?utf-8?q?9pfQfjl/JFwQ5CGXVcDl0fDhxdlDCmJ7ehkOi92vPdO5fDu96wZpM8UuHUzwpRxRt?= =?utf-8?q?hFn67VBrPjFHR33RI/8yw2gLzVXIHltsYiOU62?= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: SttP3GqS1TD3wBfKXDkvPOIq842wRa2I0lylLb/d2mWa2xKYga/p0MZqcu6fxKUPIzqTnSQdjpW5xK4w1yqwisJU0D/FuSlwvdXyLcb/P5nsV6qlYXAloojuW6+ftahXvlTPc50soRnqQ6d13t7o5HsdxKAUTkYliPWE5cV09fxESFCVgTjpWbxQs1jXM46Epc9kd9Gd1T4z9Lz+BVMl/HjqHCGieesYYLjv5XVMiBxNdIhsXCv/XDazbdDbzmcOnhVZFyyPT4AOeoWcNWL45Fd0gWiyjC6Edv9Np7A0+n/aJX5ZJvfRZR2Gdk/Nmey0hZm1f5AIgon2cIoZ/p99jVC83ySrb85430HYwgc00BGCpLxM70yNGqBs+QC/xNB6QjSeKTjnIjXf2LbCkLvIHg6Bj+ZF3JJu9jREfUw/oWs= X-Microsoft-Exchange-Diagnostics: 1; DM6PR12MB3465; 20:xg5+AmDEgwCXh4bPil1II1zDeQVjr7C92e831mZWMq0rPKhk49Cp/scDPaTpY2BQ+PawgZjcCgC6lmlurEAntRKtqE783u0M8L3MQ7f9mqibOnmiI6a/Rf3G5Ny/EffXUDoJ2ObEFBpIykZiXxropvX0yA2VFxYeap/OzXPZbvcKt7JcTDKyUojyVsW0vnny16v8NV/91JwnbKY1U9VHmwDVKZzFMGvY/EjNMDhE4b7bHAb/t+BmBOAKAhjF0nrc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2019 03:11:51.9302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf844b70-9343-424e-e5f2-08d6a698797d 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: DM6PR12MB3465 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uQM95N1NWpwUilIME/MJxQlAmSPtOIb84PXp4DrA4ho=; b=TkPP/xetfQTHKDuOHjMZHxEzNemVF5VbGngX1rMYzoc3HsAZrXYRFEYgFkjshQZ0BakFhjJWJGJgWC8GUm1OMGNAe9HyBJIfzFJgHgDZ8Z8GNZr0URcDfLap/rcThmUa4qaVRs2JIfRJ9eJEzW7OduqY+tsWdeQW69rMxtqfL2s= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; basnieuwenhuizen.nl; dkim=none (message not signed) header.d=none;basnieuwenhuizen.nl; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Rakos , Dave Airlie , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP syncobj wait/signal operation is appending in command submission. v2: separate to two kinds in/out_deps functions v3: fix checking for timeline syncobj 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 | 152 +++++++++++++++++++++---- include/uapi/drm/amdgpu_drm.h | 8 ++ 3 files changed, 144 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 8d0d7f3dd5fb..deec2c796253 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -433,6 +433,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; @@ -462,8 +468,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 52a5e4fdc95b..2f6239b6be6f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -215,6 +215,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs case AMDGPU_CHUNK_ID_SYNCOBJ_IN: case AMDGPU_CHUNK_ID_SYNCOBJ_OUT: case AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES: + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT: + case AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL: break; default: @@ -804,9 +806,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); @@ -1117,13 +1121,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); @@ -1134,46 +1143,118 @@ 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_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]) + p->post_deps[i].syncobj = + drm_syncobj_find(p->filp, deps[i].handle); + if (!p->post_deps[i].syncobj) return -EINVAL; - p->num_post_dep_syncobjs++; + 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_deps) + return -ENOMEM; + + for (i = 0; i < num_deps; ++i) { + struct amdgpu_cs_post_dep *dep = &p->post_deps[i]; + + dep->chain = NULL; + if (syncobj_deps[i].point) { + 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; + } + dep->point = syncobj_deps[i].point; + p->num_post_deps++; + } + return 0; } @@ -1187,19 +1268,33 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, chunk = &p->chunks[i]; - if (chunk->chunk_id == AMDGPU_CHUNK_ID_DEPENDENCIES || - chunk->chunk_id == AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES) { + switch (chunk->chunk_id) { + case AMDGPU_CHUNK_ID_DEPENDENCIES: + case AMDGPU_CHUNK_ID_SCHEDULED_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; } } @@ -1210,8 +1305,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 && p->post_deps[i].point) { + 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 4a53f6cfa034..e928760c4c1a 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -525,6 +525,8 @@ struct drm_amdgpu_gem_va { #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06 #define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09 struct drm_amdgpu_cs_chunk { __u32 chunk_id; @@ -605,6 +607,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