From patchwork Mon Oct 15 08:55: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: 10641339 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 877E215E2 for ; Mon, 15 Oct 2018 08:56:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7479629615 for ; Mon, 15 Oct 2018 08:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68D5B29618; Mon, 15 Oct 2018 08:56: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=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 F112B29615 for ; Mon, 15 Oct 2018 08:56:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AC4C89D02; Mon, 15 Oct 2018 08:56:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0089.outbound.protection.outlook.com [104.47.41.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 573A389A1A; Mon, 15 Oct 2018 08:56:02 +0000 (UTC) Received: from MWHPR1201CA0021.namprd12.prod.outlook.com (2603:10b6:301:4a::31) by CY1PR12MB0426.namprd12.prod.outlook.com (2a01:111:e400:5191::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Mon, 15 Oct 2018 08:56:00 +0000 Received: from CO1NAM03FT039.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by MWHPR1201CA0021.outlook.office365.com (2603:10b6:301:4a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21 via Frontend Transport; Mon, 15 Oct 2018 08:56: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 CO1NAM03FT039.mail.protection.outlook.com (10.152.81.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:55: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; Mon, 15 Oct 2018 03:55:58 -0500 From: Chunming Zhou To: Subject: [PATCH 1/7] drm: add flags to drm_syncobj_find_fence Date: Mon, 15 Oct 2018 16:55:47 +0800 Message-ID: <20181015085553.30656-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)(376002)(39860400002)(136003)(396003)(2980300002)(428003)(199004)(189003)(77096007)(26005)(104016004)(336012)(316002)(53416004)(16586007)(97736004)(426003)(8676002)(476003)(81156014)(81166006)(486006)(126002)(186003)(2616005)(8936002)(4326008)(305945005)(450100002)(478600001)(47776003)(6916009)(2906002)(54906003)(53936002)(7696005)(51416003)(36756003)(106466001)(48376002)(50466002)(5660300001)(50226002)(1076002)(356004)(6666004)(2351001)(86362001)(68736007)(105586002)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0426; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT039; 1:pgqn3AnDZJkaG0oJILpqEa8kOlCHF1jkhZotpwgdK+G0SVaW3QvEREzQTZ8TQP1HjqMEiEUqz4SoT7DiXzeV+KoIFm4N1GBeL7UYXmut27T0gziApnTYXycKjx0d5ByD X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38793464-2be6-4203-9cf3-08d6327c0757 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0426; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0426; 3:yAay7z2Juo+fZPD5idpLjj3vW5WkIdxtwec8+YpdATYbihmJKXmJD0ZvUp3MfynDGnSecL2aJnEekkSmcyNph9uILXcVL4kz3TfAxHXvvtE1Zd0Zg/gOLe0zNEWnzziqdEBwHTT03SFnshebFwP36JHRmhXrw5LMoIbAcY6wCsw9oB4GYW60leKPN1rUR49ffV6P3Illkw0Owe5GBCqTQggYOFFiWAdc+sdsuaAo1Vz5wQm+KNkXmGZDNCX+/7J61FDQJqef4Fr8nhkDBAf/ufqepcUhMCZLgTutRJyVarz6QmpeM54ZiIDjvA6FKVOsBe8F4QPPL7CrLEjBeHn9dkbriPkqAVUenBCC0JJnGQE=; 25:lkqDSBE8a5MdTvglU3WOwk+GGOMGLyCMrwvHlBOxkQs3TqEA/oDzsD+jMQm3eElUoFtwP8zOU/qGevh/1ZB54AMGRjYNN4hi0+maiquc1bsQ4tsrTYOJhADpJflxIb4QUH7wUuAkf6SMwG30o4eAehmOwiCFkknrBBWOgCNvJKAfTk6Vut28sh672lEre/9yAXZ8NQAh3EenN2wgHqeR+TwsohQG1qrEoIXlfTt0gfyLPQl3GH0wqgkzsQF4a+O+R+kxjtoa2GaLpZBjmtjL2xPE5EBOOMrdSCSbr09CsFBezKBSR9T0zfUsiDslGIGVcDT98OEVFOYNst7XqlCFCA== X-MS-TrafficTypeDiagnostic: CY1PR12MB0426: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0426; 31:+hp/OHnCmjtr/eOPQ49CbHU74MFB+0HcU5wHIiry8khyjgg1oFirAVcMD0bl4vhfSEOrXNMCeemdn2K0V5BqrREEqEIVIt7QQ2QPj+sJ/zXCmuqfSwqZJ1N8pH5T/yr4/SQW8RY3wDc9G/bQVCSHgnS2/NbwGDauFW3GCbV6XtQuLezkcxSuUJxpGRuSpQ/r/1ORNhQKOAZ76NflhxJWIy7wnW/Wunk7L3dE6zoiUbM=; 20:ZaVeeIBuQsQdxezlvVeHS1iJZiDFYAGcYzL8VArkIR3pg12NYHxC8dXSy4Sg5IJ1xitLQ417K+RbTWH0W3ypfubOSPVtyNPQfgY1oqotVsv4M3rjJYe6tjcmJmJHWpEU5xONQFsM52aDxYcYt5ZzLditjDKQ7mCVNgSrGtNnDZet7VYHwxsoqgDs3xqzQO3zNzKIw42EpMhpkC/WJMUM6aBuy4wZey+UGHMFSiLS9fUg2m9NoYhsWAvG5ETNxytJT1gGbTuRp5kknzi+mgqsgfzc3Kxh4mPbV61T8P2eduUGPXlBbtx7GPi51Bablqne4kKE1wkOvgLgV4RPzAHESOsoLTS2vrAu8QUv+0CTTJWDRChE1reQBC8m5sP8ecoaaKH6yjg0o2nRRMk6mv9lAjvany79MAFSST961yXrfcYvt6BzWGULqTnb+d0udN2NSHmHlcTZYU2SR7657x5KWo3W8mWVtSGGVfPnj6S+8ZwJI7BlDOiLqxOcesu3Cc8V X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991067); SRVR:CY1PR12MB0426; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0426; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0426; 4:7aKvju+/a24VvASdoKe2s8M84CoDzkUAsnnWZenXCu9YieIFw75Rqy4/2FUyWxfpy4BCwpaL1O8fFBXho8oKdawFMIGHARu3wdX2B5HGiyUlks/vzssmVPlhELQb6/RgQWux6yzPO7H0ZDAk7abEbxKhVvyWpEBtx1bL/sWDvK0Rf+dEg14Pa5rLF8zDvaUkNORl8k9PtpCQkAnBHcSbJYWwtiHi/pWbgWL6Sq9OXsEskqm4RQk4nNBEsx0eS7wblK+altSgCqwnFopqH3JpMCDJ/exCxjFo9UVFHIbiIlLMO30qTrkqDn6JSGITbp5L X-Forefront-PRVS: 0826B2F01B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0426; 23:cTLrbZYYNzZHz0uuTt3TESbQkzSBEf4iHLhZp8jiH?= teFKG07o1yg26IHDuN99QSoAjxuI9/eDDYmrAhMLuOf3MFnO1MfGrRk5zfSuff8wcEppD01CpNbfy+6ZOr7/S/tK5MAydkqnnRgV8Q1Pewz3/A/l5aNxjx8cd84GpKWBS/zZO8yy54ZP4/XMW/E9x+xzNc3MuA+G17Shu3ZiVl/0hlPm2HmK0AwwWcz9o6jXSRiGfsrjwEkOsv1bhBLtYPB4xE9pwIwIrr66eO+N1r2aQdpubW3Ofbt8BHW7Bki2V11ukcGsYXnoV7DxIzb8JTA2Neo6fodbGRWIrM+i4FAB76leZPMQR2Q+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EMLUgL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0426; 20:GuBaeKpUxDMiufMUSNXfSJSnPCSUdTWRatlTZa+RNwcjvYYwllwErVRjyjrIv7ajVN54FPMo1ID/n3g+fMZ/u88krVBHcQB7AzZ1/oCln78WOLoiil1+XB+ddVkSvsUzRQ2OIhJjLVrAZEVxHTw4AZS+TBg3iSX06X1ufgb2TziPuYYANA8Yc1v8jrZhGYhq+zmR53o7Jk5pZdvvLJ+EGGLe0JfaYC1mOHfdKAELQUOXTHrQUg2EN+LmfWsFvlT9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:55:59.7832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38793464-2be6-4203-9cf3-08d6327c0757 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: CY1PR12MB0426 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: amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP flags can be used by driver to decide whether need to block wait submission. Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/drm_syncobj.c | 4 ++-- drivers/gpu/drm/v3d/v3d_gem.c | 4 ++-- drivers/gpu/drm/vc4/vc4_gem.c | 2 +- include/drm/drm_syncobj.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index d9d2ede96490..412fac238575 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1102,7 +1102,7 @@ static int amdgpu_syncobj_lookup_and_add_to_sync(struct amdgpu_cs_parser *p, { int r; struct dma_fence *fence; - r = drm_syncobj_find_fence(p->filp, handle, 0, &fence); + r = drm_syncobj_find_fence(p->filp, handle, 0, 0, &fence); if (r) return r; diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index e9ce623d049e..f796c9fc3858 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -235,7 +235,7 @@ static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj) * dma_fence_put(). */ int drm_syncobj_find_fence(struct drm_file *file_private, - u32 handle, u64 point, + u32 handle, u64 point, u64 flags, struct dma_fence **fence) { struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle); @@ -506,7 +506,7 @@ static int drm_syncobj_export_sync_file(struct drm_file *file_private, if (fd < 0) return fd; - ret = drm_syncobj_find_fence(file_private, handle, 0, &fence); + ret = drm_syncobj_find_fence(file_private, handle, 0, 0, &fence); if (ret) goto err_put_fd; diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c index 70c54774400b..97477879d3d4 100644 --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c @@ -521,12 +521,12 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, kref_init(&exec->refcount); ret = drm_syncobj_find_fence(file_priv, args->in_sync_bcl, - 0, &exec->bin.in_fence); + 0, 0, &exec->bin.in_fence); if (ret == -EINVAL) goto fail; ret = drm_syncobj_find_fence(file_priv, args->in_sync_rcl, - 0, &exec->render.in_fence); + 0, 0, &exec->render.in_fence); if (ret == -EINVAL) goto fail; diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 5b22e996af6c..251198194c38 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -1173,7 +1173,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, if (args->in_sync) { ret = drm_syncobj_find_fence(file_priv, args->in_sync, - 0, &in_fence); + 0, 0, &in_fence); if (ret) goto fail; diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 425432b85a87..2eda44def639 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -134,7 +134,7 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, u64 point, struct dma_fence *fence); int drm_syncobj_find_fence(struct drm_file *file_private, - u32 handle, u64 point, + u32 handle, u64 point, u64 flags, struct dma_fence **fence); void drm_syncobj_free(struct kref *kref); int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, From patchwork Mon Oct 15 08:55:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10641341 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 47D68925 for ; Mon, 15 Oct 2018 08:56:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CF929616 for ; Mon, 15 Oct 2018 08:56:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28A222961A; Mon, 15 Oct 2018 08:56: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 0C9CE29616 for ; Mon, 15 Oct 2018 08:56:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C51528923A; Mon, 15 Oct 2018 08:56:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on062e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe49::62e]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA41A8923A; Mon, 15 Oct 2018 08:56:32 +0000 (UTC) Received: from DM3PR12CA0050.namprd12.prod.outlook.com (2603:10b6:0:56::18) by BY2PR12MB0615.namprd12.prod.outlook.com (2a01:111:e400:52e0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Mon, 15 Oct 2018 08:56:28 +0000 Received: from CO1NAM03FT063.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by DM3PR12CA0050.outlook.office365.com (2603:10b6:0:56::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24 via Frontend Transport; Mon, 15 Oct 2018 08:56:28 +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 CO1NAM03FT063.mail.protection.outlook.com (10.152.81.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:56:27 +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, 15 Oct 2018 03:56:25 -0500 From: Chunming Zhou To: Subject: [PATCH 2/7] drm: add syncobj timeline support v8 Date: Mon, 15 Oct 2018 16:55:48 +0800 Message-ID: <20181015085553.30656-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-1-david1.zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(136003)(346002)(396003)(2980300002)(428003)(199004)(189003)(47776003)(36756003)(77096007)(8676002)(6916009)(7696005)(81156014)(23676004)(81166006)(6346003)(426003)(336012)(446003)(305945005)(68736007)(8936002)(11346002)(76176011)(26005)(53936002)(2906002)(356004)(86362001)(2616005)(53416004)(126002)(104016004)(5820100001)(50226002)(54906003)(476003)(1076002)(72206003)(5660300001)(486006)(2870700001)(186003)(478600001)(4744004)(14444005)(97736004)(4326008)(2351001)(316002)(6666004)(106466001)(105586002)(66574009)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0615; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT063; 1:GzVmHE0ylR75KTnjD84BCcdzdYemaQZcTAjBw5ddUBNP6Jjj4bGPvKbLXiEsxgJOOqCy8kGacfPxifww/Oesw2o877gus9jous0OHA1n/2ewyKlev7UpRYey8WVuwZGL X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3128268c-761a-47d5-5710-08d6327c1806 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:BY2PR12MB0615; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0615; 3:5C4JxHpNxgLeIkOIyTySeXgj72Db6kyj4rvTm3XA6+IrKzTzaM3kd42HLQppFdePzEVYeWMkRPduMGjfYsmKgi/46KYdvCKOjrDGzLnwrSdMHNup7BOPovn9RAyWoooJ6uf7ijHpagIKYDiy/pXG8pkktdP13O8MoSmXhKIh/cuY3usOE2EFASi5TUN3Ub+deL6NeZyU3M8gquoVs1V6417WMX0l28lME4kXSArBS8UT8zIsgI2PbAWcWhvWPzxvyMaLSkeknxV1A1/b0xo72QsCqD+TYvgt8ER/4UxttW82yUAmCfhfIuPeEvI8uIy9yfRjYj4AB12JPLY03B/TruwtYHmGwVPukLBMTJ9Adgw=; 25:4GBJ1m1Hza4Z7QoVpjnTV0M8ig19Psv59bYRQHsef94bBgrrwg8hrTBH9O2TYItjGfieuz4p8yGZg7BEbZs5u39X/pq2d+eMKJd8MgcIF4fLcUCOCDEkR5VPcM93J7fkuSG98KdlOAcGUoswWWymiPUlkrppiy76dfWrJq3rrsN4yqvUvqHaQdwMcEhduwpbbg43kqWcILv3LwMy1/aW7Ik1LJDS+Fi7AOgtNyX/ujq2SUbUiloKQ53w2zIZhygjXCRhCIXcW3SQaKjfml1Pc55LmInqvhI0G0Ks5ceSIKCOmygVwrtnov8S1cVEVl2OfuVd+c+KIgFJcjnbbU1vSg== X-MS-TrafficTypeDiagnostic: BY2PR12MB0615: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0615; 31:/RvVfhuLjktyzRAu3RITPivLttQUuMnDLZYmIjVA+lJe7JkaVxmTpDP0Fkv4JXALjfSMDRwZHer/IHLctNGrPNs/vuYkKlD+EV6BMihWEuijhzowFK9XgAchZ12Go8FtANQHJEIOxr2p0uTefRuBon+Zh+DwBySeYHc6RvdeovZ9h85rW8pNAnnKDdp50DrVv6UCq/MhcyHjdWRMYmcAJTWmUhoaIAH9e+VVn5FFdM0=; 20:TFL7p20E5Tl/dIzS2Em3loAIwTRXHHqfKeub/K7aosuhl/XVytSKC7BbLOJmTOEqeoR4w18Ko5jkANa+wVnt+5e3xj/kury6/1YH9IQRvn9QVyDJtjMTY4lcupdxv3gjNppMN1DaU/ySAQzQStUDAoqivha/m+3g3RWg1RM9RJEo5TZkxDJF+Ziy9gSwKyaT1ycEuswXgRerAXclHrMzdAVcHD0g7OQJ4vieOoMaJ4eKU7etJMkgSW8rU71+thps8jRNSf9sHnwYQNPJpUY8t84XsZgcKdb0nS9ukXDnlDPaYqtTkcZF37YVPscAuAERdr7qnJSjpmaivUqAnJo0jz5w1b2vdKwk99W2VEwwsBVQxEt8OAaWZSPfUYpNc7imQWARV0nzjOASHDWq1hDf8GVSkH+U+FdJD4wiy03HyZ8oRj/LR89B3HoL4raE7l25VQcNjQ2mKez3r3XBboOegfTZ6BVydOGO7gpsm8QjA5t8Ppvqw9JGO4jmlIxy9LPP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(767451399110)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:BY2PR12MB0615; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0615; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0615; 4:kZzepqMA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UM4lHjun4tlvVobe/V77H3VXFrRNXLaBcGw1/ubintUUyN2lcN0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0615; 20:cLiZlx75dgZDOXgVwQbdbNigLbMg+EYZFQpK6FhrldBQiF31iH3ErfO63f1Yx3liqZ+/3NR9jH31GOiFFQ6/nncmnJI1i6we47ioAR0+DJDUlcnir+aFDzVXSFUI7Y8uGPsaYWhuf5ZVF3lB8BndOCV3l2QWIJBfEaBkkjU/s5Rn+ckOkYyv7bpxY4iJ+i4M6lxfcN770GtA+R0UqP0vy8wNksS8w8jNp+d10GGmVBNQNOfCAXtKC4T5tQ2G2lQi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:56:27.6937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3128268c-761a-47d5-5710-08d6327c1806 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: BY2PR12MB0615 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: amd-gfx@lists.freedesktop.org, Daniel Rakos , Dave Airlie , Christian Konig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch is for VK_KHR_timeline_semaphore extension, semaphore is called syncobj in kernel side: This extension introduces a new type of syncobj that has an integer payload identifying a point in a timeline. Such timeline syncobjs support the following operations: * CPU query - A host operation that allows querying the payload of the timeline syncobj. * CPU wait - A host operation that allows a blocking wait for a timeline syncobj to reach a specified value. * Device wait - A device operation that allows waiting for a timeline syncobj to reach a specified value. * Device signal - A device operation that allows advancing the timeline syncobj to a specified value. v1: Since it's a timeline, that means the front time point(PT) always is signaled before the late PT. a. signal PT design: Signal PT fence N depends on PT[N-1] fence and signal opertion fence, when PT[N] fence is signaled, the timeline will increase to value of PT[N]. b. wait PT design: Wait PT fence is signaled by reaching timeline point value, when timeline is increasing, will compare wait PTs value with new timeline value, if PT value is lower than timeline value, then wait PT will be signaled, otherwise keep in list. syncobj wait operation can wait on any point of timeline, so need a RB tree to order them. And wait PT could ahead of signal PT, we need a sumission fence to perform that. v2: 1. remove unused DRM_SYNCOBJ_CREATE_TYPE_NORMAL. (Christian) 2. move unexposed denitions to .c file. (Daniel Vetter) 3. split up the change to drm_syncobj_find_fence() in a separate patch. (Christian) 4. split up the change to drm_syncobj_replace_fence() in a separate patch. 5. drop the submission_fence implementation and instead use wait_event() for that. (Christian) 6. WARN_ON(point != 0) for NORMAL type syncobj case. (Daniel Vetter) v3: 1. replace normal syncobj with timeline implemenation. (Vetter and Christian) a. normal syncobj signal op will create a signal PT to tail of signal pt list. b. normal syncobj wait op will create a wait pt with last signal point, and this wait PT is only signaled by related signal point PT. 2. many bug fix and clean up 3. stub fence moving is moved to other patch. v4: 1. fix RB tree loop with while(node=rb_first(...)). (Christian) 2. fix syncobj lifecycle. (Christian) 3. only enable_signaling when there is wait_pt. (Christian) 4. fix timeline path issues. 5. write a timeline test in libdrm v5: (Christian) 1. semaphore is called syncobj in kernel side. 2. don't need 'timeline' characters in some function name. 3. keep syncobj cb. v6: (Christian) 1. merge syncobj_timeline to syncobj structure. 2. simplify some check sentences. 3. some misc change. 4. fix CTS failed issue. v7: (Christian) 1. error handling when creating signal pt. 2. remove timeline naming in func. 3. export flags in find_fence. 4. allow reset timeline. v8: 1. use wait_event_interruptible without timeout 2. rename _TYPE_INDIVIDUAL to _TYPE_BINARY individual syncobj is tested by ./deqp-vk -n dEQP-VK*semaphore* timeline syncobj is tested by ./amdgpu_test -s 9 Signed-off-by: Chunming Zhou Cc: Christian Konig Cc: Dave Airlie Cc: Daniel Rakos Cc: Daniel Vetter Reviewed-by: Christian König Acked-by: Daniel Vetter --- drivers/gpu/drm/drm_syncobj.c | 287 ++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- include/drm/drm_syncobj.h | 65 ++--- include/uapi/drm/drm.h | 1 + 4 files changed, 281 insertions(+), 74 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index f796c9fc3858..67472bd77c83 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -56,6 +56,9 @@ #include "drm_internal.h" #include +/* merge normal syncobj to timeline syncobj, the point interval is 1 */ +#define DRM_SYNCOBJ_BINARY_POINT 1 + struct drm_syncobj_stub_fence { struct dma_fence base; spinlock_t lock; @@ -82,6 +85,11 @@ static const struct dma_fence_ops drm_syncobj_stub_fence_ops = { .release = drm_syncobj_stub_fence_release, }; +struct drm_syncobj_signal_pt { + struct dma_fence_array *base; + u64 value; + struct list_head list; +}; /** * drm_syncobj_find - lookup and reference a sync object. @@ -124,8 +132,8 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, { int ret; - *fence = drm_syncobj_fence_get(syncobj); - if (*fence) + ret = drm_syncobj_search_fence(syncobj, 0, 0, fence); + if (!ret) return 1; spin_lock(&syncobj->lock); @@ -133,10 +141,12 @@ static int drm_syncobj_fence_get_or_add_callback(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) { - *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, - lockdep_is_held(&syncobj->lock))); - ret = 1; + if (!list_empty(&syncobj->signal_pt_list)) { + spin_unlock(&syncobj->lock); + drm_syncobj_search_fence(syncobj, 0, 0, fence); + if (*fence) + return 1; + spin_lock(&syncobj->lock); } else { *fence = NULL; drm_syncobj_add_callback_locked(syncobj, cb, func); @@ -164,6 +174,159 @@ void drm_syncobj_remove_callback(struct drm_syncobj *syncobj, spin_unlock(&syncobj->lock); } +static void drm_syncobj_init(struct drm_syncobj *syncobj) +{ + spin_lock(&syncobj->lock); + syncobj->timeline_context = dma_fence_context_alloc(1); + syncobj->timeline = 0; + syncobj->signal_point = 0; + init_waitqueue_head(&syncobj->wq); + + INIT_LIST_HEAD(&syncobj->signal_pt_list); + spin_unlock(&syncobj->lock); +} + +static void drm_syncobj_fini(struct drm_syncobj *syncobj) +{ + struct drm_syncobj_signal_pt *signal_pt = NULL, *tmp; + + spin_lock(&syncobj->lock); + list_for_each_entry_safe(signal_pt, tmp, + &syncobj->signal_pt_list, list) { + list_del(&signal_pt->list); + dma_fence_put(&signal_pt->base->base); + kfree(signal_pt); + } + spin_unlock(&syncobj->lock); +} + +static struct dma_fence +*drm_syncobj_find_signal_pt_for_point(struct drm_syncobj *syncobj, + uint64_t point) +{ + struct drm_syncobj_signal_pt *signal_pt; + + if ((syncobj->type == DRM_SYNCOBJ_TYPE_TIMELINE) && + (point <= syncobj->timeline)) { + struct drm_syncobj_stub_fence *fence = + kzalloc(sizeof(struct drm_syncobj_stub_fence), + GFP_KERNEL); + + if (!fence) + return NULL; + spin_lock_init(&fence->lock); + dma_fence_init(&fence->base, + &drm_syncobj_stub_fence_ops, + &fence->lock, + syncobj->timeline_context, + point); + + dma_fence_signal(&fence->base); + return &fence->base; + } + + list_for_each_entry(signal_pt, &syncobj->signal_pt_list, list) { + if (point > signal_pt->value) + continue; + if ((syncobj->type == DRM_SYNCOBJ_TYPE_BINARY) && + (point != signal_pt->value)) + continue; + return dma_fence_get(&signal_pt->base->base); + } + return NULL; +} + +static int drm_syncobj_create_signal_pt(struct drm_syncobj *syncobj, + struct dma_fence *fence, + u64 point) +{ + struct drm_syncobj_signal_pt *signal_pt = + kzalloc(sizeof(struct drm_syncobj_signal_pt), GFP_KERNEL); + struct drm_syncobj_signal_pt *tail_pt; + struct dma_fence **fences; + int num_fences = 0; + int ret = 0, i; + + if (!signal_pt) + return -ENOMEM; + if (!fence) + goto out; + + fences = kmalloc_array(sizeof(void *), 2, GFP_KERNEL); + if (!fences) { + ret = -ENOMEM; + goto out; + } + fences[num_fences++] = dma_fence_get(fence); + /* timeline syncobj must take this dependency */ + if (syncobj->type == DRM_SYNCOBJ_TYPE_TIMELINE) { + spin_lock(&syncobj->lock); + if (!list_empty(&syncobj->signal_pt_list)) { + tail_pt = list_last_entry(&syncobj->signal_pt_list, + struct drm_syncobj_signal_pt, list); + fences[num_fences++] = dma_fence_get(&tail_pt->base->base); + } + spin_unlock(&syncobj->lock); + } + signal_pt->base = dma_fence_array_create(num_fences, fences, + syncobj->timeline_context, + point, false); + if (!signal_pt->base) { + ret = -ENOMEM; + goto fail; + } + + spin_lock(&syncobj->lock); + if (syncobj->signal_point >= point) { + DRM_WARN("A later signal is ready!"); + spin_unlock(&syncobj->lock); + goto exist; + } + signal_pt->value = point; + list_add_tail(&signal_pt->list, &syncobj->signal_pt_list); + syncobj->signal_point = point; + spin_unlock(&syncobj->lock); + wake_up_all(&syncobj->wq); + + return 0; +exist: + dma_fence_put(&signal_pt->base->base); +fail: + for (i = 0; i < num_fences; i++) + dma_fence_put(fences[i]); + kfree(fences); +out: + kfree(signal_pt); + return ret; +} + +static void drm_syncobj_garbage_collection(struct drm_syncobj *syncobj) +{ + struct drm_syncobj_signal_pt *signal_pt, *tmp, *tail_pt; + + spin_lock(&syncobj->lock); + tail_pt = list_last_entry(&syncobj->signal_pt_list, + struct drm_syncobj_signal_pt, + list); + list_for_each_entry_safe(signal_pt, tmp, + &syncobj->signal_pt_list, list) { + if (syncobj->type == DRM_SYNCOBJ_TYPE_BINARY && + signal_pt == tail_pt) + continue; + if (dma_fence_is_signaled(&signal_pt->base->base)) { + syncobj->timeline = signal_pt->value; + list_del(&signal_pt->list); + dma_fence_put(&signal_pt->base->base); + kfree(signal_pt); + } else { + /*signal_pt is in order in list, from small to big, so + * the later must not be signal either */ + break; + } + } + + spin_unlock(&syncobj->lock); +} /** * drm_syncobj_replace_fence - replace fence in a sync object. * @syncobj: Sync object to replace fence in @@ -176,28 +339,29 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, u64 point, struct dma_fence *fence) { - struct dma_fence *old_fence; - struct drm_syncobj_cb *cur, *tmp; - - if (fence) - dma_fence_get(fence); - - spin_lock(&syncobj->lock); - - old_fence = rcu_dereference_protected(syncobj->fence, - lockdep_is_held(&syncobj->lock)); - rcu_assign_pointer(syncobj->fence, fence); + u64 pt_value = point; + + drm_syncobj_garbage_collection(syncobj); + if (syncobj->type == DRM_SYNCOBJ_TYPE_BINARY) { + if (!fence) { + drm_syncobj_fini(syncobj); + drm_syncobj_init(syncobj); + return; + } + pt_value = syncobj->signal_point + + DRM_SYNCOBJ_BINARY_POINT; + } + drm_syncobj_create_signal_pt(syncobj, fence, pt_value); + if (fence) { + struct drm_syncobj_cb *cur, *tmp; - if (fence != old_fence) { + spin_lock(&syncobj->lock); list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { list_del_init(&cur->node); cur->func(syncobj, cur); } + spin_unlock(&syncobj->lock); } - - spin_unlock(&syncobj->lock); - - dma_fence_put(old_fence); } EXPORT_SYMBOL(drm_syncobj_replace_fence); @@ -220,6 +384,46 @@ static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj) return 0; } +static int +drm_syncobj_point_get(struct drm_syncobj *syncobj, u64 point, u64 flags, + struct dma_fence **fence) +{ + int ret = 0; + + if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { + ret = wait_event_interruptible(syncobj->wq, + point <= syncobj->signal_point); + if (ret < 0) + return ret; + } + spin_lock(&syncobj->lock); + *fence = drm_syncobj_find_signal_pt_for_point(syncobj, point); + if (!*fence) + ret = -EINVAL; + spin_unlock(&syncobj->lock); + return ret; +} + +int drm_syncobj_search_fence(struct drm_syncobj *syncobj, u64 point, + u64 flags, struct dma_fence **fence) +{ + u64 pt_value = point; + + if (!syncobj) + return -ENOENT; + + drm_syncobj_garbage_collection(syncobj); + if (syncobj->type == DRM_SYNCOBJ_TYPE_BINARY) { + /*BINARY syncobj always wait on last pt */ + pt_value = syncobj->signal_point; + + if (pt_value == 0) + pt_value += DRM_SYNCOBJ_BINARY_POINT; + } + return drm_syncobj_point_get(syncobj, pt_value, flags, fence); +} +EXPORT_SYMBOL(drm_syncobj_search_fence); + /** * drm_syncobj_find_fence - lookup and reference the fence in a sync object * @file_private: drm file private pointer @@ -228,7 +432,7 @@ static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj) * @fence: out parameter for the fence * * This is just a convenience function that combines drm_syncobj_find() and - * drm_syncobj_fence_get(). + * drm_syncobj_lookup_fence(). * * Returns 0 on success or a negative error value on failure. On success @fence * contains a reference to the fence, which must be released by calling @@ -239,15 +443,9 @@ 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; - - if (!syncobj) - return -ENOENT; + int ret; - *fence = drm_syncobj_fence_get(syncobj); - if (!*fence) { - ret = -EINVAL; - } + ret = drm_syncobj_search_fence(syncobj, point, flags, fence); drm_syncobj_put(syncobj); return ret; } @@ -264,7 +462,7 @@ void drm_syncobj_free(struct kref *kref) struct drm_syncobj *syncobj = container_of(kref, struct drm_syncobj, refcount); - drm_syncobj_replace_fence(syncobj, 0, NULL); + drm_syncobj_fini(syncobj); kfree(syncobj); } EXPORT_SYMBOL(drm_syncobj_free); @@ -294,6 +492,11 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, kref_init(&syncobj->refcount); INIT_LIST_HEAD(&syncobj->cb_list); spin_lock_init(&syncobj->lock); + if (flags & DRM_SYNCOBJ_CREATE_TYPE_TIMELINE) + syncobj->type = DRM_SYNCOBJ_TYPE_TIMELINE; + else + syncobj->type = DRM_SYNCOBJ_TYPE_BINARY; + drm_syncobj_init(syncobj); if (flags & DRM_SYNCOBJ_CREATE_SIGNALED) { ret = drm_syncobj_assign_null_handle(syncobj); @@ -576,7 +779,8 @@ drm_syncobj_create_ioctl(struct drm_device *dev, void *data, return -ENODEV; /* no valid flags yet */ - if (args->flags & ~DRM_SYNCOBJ_CREATE_SIGNALED) + if (args->flags & ~(DRM_SYNCOBJ_CREATE_SIGNALED | + DRM_SYNCOBJ_CREATE_TYPE_TIMELINE)) return -EINVAL; return drm_syncobj_create_as_handle(file_private, @@ -669,9 +873,8 @@ static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, 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))); + drm_syncobj_search_fence(syncobj, 0, 0, &wait->fence); + wake_up_process(wait->task); } @@ -698,7 +901,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, signaled_count = 0; for (i = 0; i < count; ++i) { entries[i].task = current; - entries[i].fence = drm_syncobj_fence_get(syncobjs[i]); + ret = drm_syncobj_search_fence(syncobjs[i], 0, 0, + &entries[i].fence); if (!entries[i].fence) { if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue; @@ -970,12 +1174,13 @@ drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, if (ret < 0) return ret; - for (i = 0; i < args->count_handles; i++) - drm_syncobj_replace_fence(syncobjs[i], 0, NULL); - + for (i = 0; i < args->count_handles; i++) { + drm_syncobj_fini(syncobjs[i]); + drm_syncobj_init(syncobjs[i]); + } drm_syncobj_array_free(syncobjs, args->count_handles); - return 0; + return ret; } int diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 0a8d2d64f380..8a8d21b24119 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -2137,7 +2137,7 @@ await_fence_array(struct i915_execbuffer *eb, if (!(flags & I915_EXEC_FENCE_WAIT)) continue; - fence = drm_syncobj_fence_get(syncobj); + drm_syncobj_search_fence(syncobj, 0, 0, &fence); if (!fence) return -EINVAL; diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 2eda44def639..85b36d4e53ee 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -30,6 +30,11 @@ struct drm_syncobj_cb; +enum drm_syncobj_type { + DRM_SYNCOBJ_TYPE_BINARY, + DRM_SYNCOBJ_TYPE_TIMELINE +}; + /** * struct drm_syncobj - sync object. * @@ -41,19 +46,36 @@ struct drm_syncobj { */ struct kref refcount; /** - * @fence: - * NULL or a pointer to the fence bound to this object. - * - * This field should not be used directly. Use drm_syncobj_fence_get() - * and drm_syncobj_replace_fence() instead. + * @type: indicate syncobj type + */ + enum drm_syncobj_type type; + /** + * @wq: wait signal operation work queue + */ + wait_queue_head_t wq; + /** + * @timeline_context: fence context used by timeline */ - struct dma_fence __rcu *fence; + u64 timeline_context; /** - * @cb_list: List of callbacks to call when the &fence gets replaced. + * @timeline: syncobj timeline value, which indicates point is signaled. */ + u64 timeline; + /** + * @signal_point: which indicates the latest signaler point. + */ + u64 signal_point; + /** + * @signal_pt_list: signaler point list. + */ + struct list_head signal_pt_list; + + /** + * @cb_list: List of callbacks to call when the &fence gets replaced. + */ struct list_head cb_list; /** - * @lock: Protects &cb_list and write-locks &fence. + * @lock: Protects syncobj list and write-locks &fence. */ spinlock_t lock; /** @@ -68,7 +90,7 @@ typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj, /** * 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 + * &drm_syncobj.cb_list * @func: drm_syncobj_func_t to call * * This struct will be initialized by drm_syncobj_add_callback, additional @@ -106,29 +128,6 @@ drm_syncobj_put(struct drm_syncobj *obj) kref_put(&obj->refcount, drm_syncobj_free); } -/** - * drm_syncobj_fence_get - get a reference to a fence in a sync object - * @syncobj: sync object. - * - * This acquires additional reference to &drm_syncobj.fence contained in @obj, - * if not NULL. It is illegal to call this without already holding a reference. - * No locks required. - * - * Returns: - * Either the fence of @obj or NULL if there's none. - */ -static inline struct dma_fence * -drm_syncobj_fence_get(struct drm_syncobj *syncobj) -{ - struct dma_fence *fence; - - rcu_read_lock(); - fence = dma_fence_get_rcu_safe(&syncobj->fence); - rcu_read_unlock(); - - return fence; -} - struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, u32 handle); void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, u64 point, @@ -142,5 +141,7 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, int drm_syncobj_get_handle(struct drm_file *file_private, struct drm_syncobj *syncobj, u32 *handle); int drm_syncobj_get_fd(struct drm_syncobj *syncobj, int *p_fd); +int drm_syncobj_search_fence(struct drm_syncobj *syncobj, u64 point, u64 flags, + struct dma_fence **fence); #endif diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 300f336633f2..cebdb2541eb7 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -717,6 +717,7 @@ struct drm_prime_handle { struct drm_syncobj_create { __u32 handle; #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) +#define DRM_SYNCOBJ_CREATE_TYPE_TIMELINE (1 << 1) __u32 flags; }; From patchwork Mon Oct 15 08:55: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: 10641343 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 CE1A3925 for ; Mon, 15 Oct 2018 08:57:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC47029616 for ; Mon, 15 Oct 2018 08:57:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B04A82961A; Mon, 15 Oct 2018 08:57:04 +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 5A13729616 for ; Mon, 15 Oct 2018 08:57:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04F9F89D2F; Mon, 15 Oct 2018 08:57:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0048.outbound.protection.outlook.com [104.47.37.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC6FD89D2F; Mon, 15 Oct 2018 08:57:00 +0000 (UTC) Received: from BN4PR12CA0019.namprd12.prod.outlook.com (2603:10b6:403:2::29) by SN1PR12MB0751.namprd12.prod.outlook.com (2a01:111:e400:c45b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Mon, 15 Oct 2018 08:56:58 +0000 Received: from CO1NAM03FT028.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by BN4PR12CA0019.outlook.office365.com (2603:10b6:403:2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22 via Frontend Transport; Mon, 15 Oct 2018 08:56: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 CO1NAM03FT028.mail.protection.outlook.com (10.152.80.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:56:57 +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, 15 Oct 2018 03:56:55 -0500 From: Chunming Zhou To: Subject: [PATCH 3/7] drm: add support of syncobj timeline point wait v2 Date: Mon, 15 Oct 2018 16:55:49 +0800 Message-ID: <20181015085553.30656-3-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-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)(376002)(39860400002)(346002)(136003)(2980300002)(428003)(189003)(199004)(53416004)(105586002)(81166006)(106466001)(81156014)(8936002)(8676002)(50466002)(50226002)(48376002)(36756003)(47776003)(14444005)(16586007)(6916009)(104016004)(4744004)(53936002)(2351001)(5660300001)(316002)(68736007)(2906002)(450100002)(54906003)(4326008)(7696005)(51416003)(76176011)(1076002)(478600001)(486006)(305945005)(72206003)(426003)(6666004)(77096007)(356004)(97736004)(336012)(126002)(446003)(86362001)(11346002)(2616005)(186003)(476003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0751; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT028; 1:gqtDsJteandmKKFq3P4I8oaNjV0Cwx+Ujha6klMQoP3LXSycrtrr4TAsJDf/H/VWoLktZd79lhZNVTTmpsqR26lWi0wVSiHwvzRTSd0ALA/U7J4uHOpN0xTCUoPpPryQ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0d63a4b-4bbe-4859-2b67-08d6327c299d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:SN1PR12MB0751; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0751; 3:agJB89nirNrP3TVd2DoAS4sahjeZmI+yEMI3ISd2FoYFmDP7TCFDaR66V+kk7HqxAWkVYnmhki6BagJTBKdI65w2SfCVx5Jn4niExE98ayO2Vf5wg3BOAZXcIr4E+7XgiJCW/gfp6Rcd2M0H314Th34277NMjqTkacnQN00VFr8seSsyP8/7Tg9O2P232cvuFScL3BczEnAUBp3Mfvz+xZPmnLThdaGTLmDQbLqn3m+bdhr4WO8UhlgD29ZSarqQUS90qkHZt36wX0RKb/0PduiDX1+wVfqwX1dJGYIe2BKSwelnAuZCsjmbxbHD6vx9Ii+LO+swLgCM48aTb/GlhE39bRPpKV0ltT4zxbT+3wg=; 25:s4A/+V0kg2aWA0JRTxkpFj9iEzJTMQ/PaqOfabRMSb2BtbWgd0BtMWS/lDhAIUuYstTfzG4JJWVXnW+x1de3N8rzDnXpJZMuBX7tHV8zj0nQnHNd2YZ8pvrKb3mevRI6pBHNHkabDWinqRpn8tnYAyEzBqA4XMnPlkltylnXQZ7ojbdAzp8YCKn0o4FnChV+aBPftK0BbepDG4M7BPRf4SrrHlG9pLVUdhqjL7aBbRjaMQXYaOAWdWZF5fXKZAYoKxBg9pGWYERS+7mOyrhc9WBYGML3tPcP/4hK1oH/AjeYS8tm30VYVg6I3EKmnie9zW2X4vJulZPkNLjQnqZOv6VN0z645TT0QguoU/DHKRQ= X-MS-TrafficTypeDiagnostic: SN1PR12MB0751: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0751; 31:sALxS6CucsmHiJ/ng9UHTEdG+PrkjoFkgqk3xOTPdFiFCOOwf3UM1YqI4nbDVXhUtuaT4x+TQlXrI9ibeihWEcGfuPX+1+vX5LNy8Kxc4A1V5X6DgQmMwD4P5Cuh7f5EMmEFQVe6FHdgDj+3+MjZEgzPgP7maWmK/jER68LDxIoJdpKa5RttzhaMnVWH2XZ7ijXYVJ6xhBgpm5vYVP+amjs7ft4zkVQKApfM9wxyVZ0=; 20:FXDCGLSdPfB1gOT2cU1ofRX7mtVCk8YV5KoVJikGN7feDEWngA7yqhItrfyWhv6hC5N+Yr6lYSZ0sI1ooZsOzjICDAd6ydrTvGY0Ci4zVcIG06h1a2x+aGWTXE50gPVyQEFpuC8k/u8BziluXFhUHhYPssBqVwLzKIBrdcMQZ5KyC/1sf3S7FT6m1MmMpMSzzG4fZAzmksb5e3iZOyX1e94HI/tAyZczLkP/UtlzCFMxm7N/Fti9b6a2k9DrU4Jv6HYKkvZ0kKuMV3PJsWAyXsCV8Ep6GFzIQbkKMc+hm5igg3uJPC77sjGnvi13HtnyjpuvWXV8DNUVLUlwwWgETYQciNcHp0IdAqGKoKfi3Cm71EZcPJDhV2gWdpumpqJexWo0x+VPCCwwTc7h5dxAHqP/jQnhG8/NqxGg+kWf25a+BxZAlbhekAhg8rTZwaBij9QqqdPn0HDXScoqsbRCUxPkNKCRPL+8U2j7mQAEXoS43c8XcYO1Q5KqAPSM+vxz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:SN1PR12MB0751; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0751; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0751; 4:1ftE61f/qyFGSRFoksIk3MzelZ9qfbonmRQaLd5UxA1j7WVjvoHa0tu8uNy0h8wVan9OCj4MaNAQEuxeOHU/gLNNDYHMazi2xBLTZhOK3TpoGdTeTm/JdMaDp0uSJtheUD1pcZlwyI0PRDdioLYPVLt/dVtn+CP1mFX/4fRXPzW4mIvzTQHIJaNohFRYYC+T5agE/9O4EACm3gq4MzEPxp2YzzwlvurI2Zy6MXDOEDa3/UCL8iVchWBpAVwcaoOEK3q6l0qc50rTs3H8MrS6W7f4icoPw6rW6PQC/WrV7mc4hNpumRRuC66K3NuKdaQX X-Forefront-PRVS: 0826B2F01B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0751; 23:n+4YzWRJan5OFihRbIr2KHMPnGOEoZlPemvMy1qLP?= iI7/3Yj5I5Yi9iQxM9YHlCN6O7lZAhSoZ6rWMCfBnsslYcbdCwtQWv8i0yLXKZ01JZT3N33TM7pm65D1srkVxBsJ/2NskfTjxSv62Bb8YvqwqTDYM/fna5vmgiTaiDo+S2AFQzM86kd+BNSdkIwHVB9bJWqqQBvjfBR5M3aqFCGK/555qVnzIKMcnQ8ma3EMQcke/2V49SOuITahUfWInPHh7fnAmmb6GIAQ1Vqy73JkFEldvRXdXfwTubf4DuILwzXSipvsNkfKH31pFHWzAl3d7qc4JVyye40e+z1O2p68zGQWsFdcYekr5b2u6Eoz6l5Zon4WJUKbN4tR+ImiZ4t3/A96s4Zmwd2GaKD1MxTGkbHzFjHRgHRN5JZ7B+uxkrpRQWXfEvVIuAm5wZs1wC3h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U5Y1JcF+bMLtWr6uKxk2VVX+f3nGN+3XONqPYPOgRjsGqC58UChtGNQN83vEA/pfm79fQJB6BQLDPz3FkfBCIKpO+XHNMP98/mMqLxLGXJFs= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0751; 6:3T5xDgKwmhxs1Mr0jjqYuVe1LB7yo/yXVs775Gh3O/iS2BLySK91p0eTjkiIyR1MD9VkrvYfT1ZRnfWIx3l5yr+AmhNDjaQx8bR96gZB8JweAsEKspxvlGsvytG5YcShI07YuWgXihEZN1DmSur4oLXMZrnhAU/OURADWjESo3VDUzSixF9/eAP/JMphXR3NMYEMVoMasKv7xfw7h24Zr+kY33/ApUChmv6EoDFsTqUN8nzc39R6lMc+/0PaNMDRnqjoz8iN7k5jwfcAxgeachyA1sucQjoLKg8+mAirSirTMF22VZxGJGJ5GrlIPHhtg7d+D1K/wwcc00VsrRxvYbvZmd3gXPXYIAwaTA0J6ihgMHwvGybh+lP8hVR8au48UlvYOF5Btq0Io4CBfg87xEiL4LiXXgRzoE+fnX5C/MyAyj32wrHUluHOOHZjNyrjwnIg6Fse22L7YwB9tIj65g==; 5:d5q300MDtARG4eyW3xiXzrublvrz8IbT5v4MheJsiSrVINADtTGqBjwT/5VKHZFThgRJeW9s9016W0UKOcy4Ed4ZlpNL4umdCTeribnAVsRFUkV97hsku+w8Ev95juqoYG6pS2EKordrdf0Xj3BvtQeZT1u//pKZZ8CJ1Z1X3LM=; 7:Rz69vAgVFK5JhKb2xnM4p/48Kwu5URa16cXxAfutRGQWruDO+YL3eygzkeEwG8x2CJ1ZGHHkZmmeTlURNYEo4PADhBjhxIooZOFhUanoaSppDCBwlsVnHWM0dWsinArXSGQuRVUcjJtjdPP5FAJswP1/wJ9ST9ytf+9bABO6MrozaWyz6FUHrz8Nmz/SL5emoOz1lRShoLUP54pbUdQOImw1tzg3nyWf4IyEbyArcl97BfCOjO+klk6xPnvkk9pg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0751; 20:DKmOM1NQVOwSpaQOC3gWCcBJwtq9ZfPKSJBVhaFW/9rq8K5TSMufwimJ273JrDK/H1rSAQ85Ap8re/P6mIRzVrprBiVPpUaYNYFGe8LnWQcTiS0R7viQ7VKtGI0K/T5i7h5IMPZZf1TvhBUbbW2vaQmrTEu1/shG2OO34DKpZWI8sUO8zCAWUt6WbHfZYWQ5DmqVdO9Ftf9pq7/u/C0baEGUJkFsnOXoRZ98JON3D+Fk9rthtDAIYimUUbZavq6h X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:56:57.2034 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0d63a4b-4bbe-4859-2b67-08d6327c299d 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: SN1PR12MB0751 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: amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 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 | 118 ++++++++++++++++++++++++++++----- include/uapi/drm/drm.h | 18 +++++ 4 files changed, 124 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 0c4eb4a9ab31..566d44e3c782 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -183,6 +183,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 6b4a633b4240..c0891614f516 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -669,6 +669,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 67472bd77c83..f3f11ac2ef28 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -126,13 +126,14 @@ static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj, } static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, + u64 point, struct dma_fence **fence, struct drm_syncobj_cb *cb, drm_syncobj_func_t func) { int ret; - ret = drm_syncobj_search_fence(syncobj, 0, 0, fence); + ret = drm_syncobj_search_fence(syncobj, point, 0, fence); if (!ret) return 1; @@ -143,7 +144,7 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, */ if (!list_empty(&syncobj->signal_pt_list)) { spin_unlock(&syncobj->lock); - drm_syncobj_search_fence(syncobj, 0, 0, fence); + drm_syncobj_search_fence(syncobj, point, 0, fence); if (*fence) return 1; spin_lock(&syncobj->lock); @@ -354,13 +355,17 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, drm_syncobj_create_signal_pt(syncobj, fence, pt_value); if (fence) { struct drm_syncobj_cb *cur, *tmp; + struct list_head cb_list; + + INIT_LIST_HEAD(&cb_list); spin_lock(&syncobj->lock); - list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_splice_init(&syncobj->cb_list, &cb_list); + spin_unlock(&syncobj->lock); + list_for_each_entry_safe(cur, tmp, &cb_list, node) { list_del_init(&cur->node); cur->func(syncobj, cur); } - spin_unlock(&syncobj->lock); } } EXPORT_SYMBOL(drm_syncobj_replace_fence); @@ -856,6 +861,7 @@ struct syncobj_wait_entry { struct dma_fence *fence; struct dma_fence_cb fence_cb; struct drm_syncobj_cb syncobj_cb; + u64 point; }; static void syncobj_wait_fence_func(struct dma_fence *fence, @@ -873,12 +879,13 @@ static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, struct syncobj_wait_entry *wait = container_of(cb, struct syncobj_wait_entry, syncobj_cb); - drm_syncobj_search_fence(syncobj, 0, 0, &wait->fence); + drm_syncobj_search_fence(syncobj, wait->point, 0, &wait->fence); wake_up_process(wait->task); } 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, @@ -886,13 +893,38 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, { struct syncobj_wait_entry *entries; struct dma_fence *fence; + uint64_t *points; signed long ret; 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)) { + ret = -EFAULT; + goto err_free_points; + } + + + if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE) { + struct dma_fence *fence; + for (i = 0; i < count; ++i) { + ret = drm_syncobj_search_fence(syncobjs[i], points[i], + DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, + &fence); + if (ret) + goto err_free_points; + } + goto err_free_points; + } + entries = kcalloc(count, sizeof(*entries), GFP_KERNEL); + if (!entries) { + ret = -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 @@ -901,7 +933,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, signaled_count = 0; for (i = 0; i < count; ++i) { entries[i].task = current; - ret = drm_syncobj_search_fence(syncobjs[i], 0, 0, + entries[i].point = points[i]; + ret = drm_syncobj_search_fence(syncobjs[i], points[i], 0, &entries[i].fence); if (!entries[i].fence) { if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { @@ -940,6 +973,7 @@ 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].point, &entries[i].fence, &entries[i].syncobj_cb, syncobj_wait_syncobj_func); @@ -1003,6 +1037,9 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, } kfree(entries); +err_free_points: + kfree(points); + return ret; } @@ -1041,20 +1078,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; signed long ret = 0; uint32_t first = ~0; - ret = drm_syncobj_array_wait_timeout(syncobjs, - wait->count_handles, - wait->flags, - timeout, &first); + if (!timeline) { + timeout = drm_timeout_abs_to_jiffies(wait->timeout_nsec); + ret = drm_syncobj_array_wait_timeout(syncobjs, + NULL, + wait->count_handles, + wait->flags, + timeout, &first); + wait->first_signaled = first; + } else { + timeout = drm_timeout_abs_to_jiffies(timeline_wait->timeout_nsec); + ret = drm_syncobj_array_wait_timeout(syncobjs, + u64_to_user_ptr(timeline_wait->points), + timeline_wait->count_handles, + timeline_wait->flags, + timeout, &first); + timeline_wait->first_signaled = first; + } if (ret < 0) return ret; - wait->first_signaled = first; if (ret == 0) return -ETIME; return 0; @@ -1142,13 +1192,49 @@ 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_COMPLETED | + 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 cebdb2541eb7..c8bc1414753d 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -738,6 +738,10 @@ struct drm_syncobj_handle { #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) +/* wait for time point to be completed */ +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_COMPLETED (1 << 2) +/* wait for time point to become available */ +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 3) struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ @@ -748,6 +752,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; @@ -910,6 +927,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 Mon Oct 15 08:55:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10641345 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 D213B15E2 for ; Mon, 15 Oct 2018 08:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C092A29615 for ; Mon, 15 Oct 2018 08:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B484029618; Mon, 15 Oct 2018 08:57:18 +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 9C9BF29615 for ; Mon, 15 Oct 2018 08:57:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8740989DBF; Mon, 15 Oct 2018 08:57:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0068.outbound.protection.outlook.com [104.47.34.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id E2AAE89A1A; Mon, 15 Oct 2018 08:57:13 +0000 (UTC) Received: from DM3PR12CA0050.namprd12.prod.outlook.com (2603:10b6:0:56::18) by CY1PR12MB0620.namprd12.prod.outlook.com (2a01:111:e400:c43c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Mon, 15 Oct 2018 08:57:12 +0000 Received: from CO1NAM03FT063.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by DM3PR12CA0050.outlook.office365.com (2603:10b6:0:56::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24 via Frontend Transport; Mon, 15 Oct 2018 08:57:12 +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 CO1NAM03FT063.mail.protection.outlook.com (10.152.81.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:57:11 +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, 15 Oct 2018 03:57:09 -0500 From: Chunming Zhou To: Subject: [PATCH 4/7] drm: add timeline syncobj payload query ioctl v2 Date: Mon, 15 Oct 2018 16:55:50 +0800 Message-ID: <20181015085553.30656-4-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-1-david1.zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(346002)(136003)(39860400002)(396003)(2980300002)(428003)(189003)(199004)(77096007)(26005)(305945005)(106466001)(2351001)(4326008)(478600001)(450100002)(14444005)(6916009)(105586002)(47776003)(72206003)(5660300001)(426003)(336012)(53416004)(446003)(11346002)(6666004)(356004)(97736004)(53936002)(104016004)(186003)(16586007)(54906003)(81156014)(50466002)(8676002)(81166006)(86362001)(68736007)(126002)(476003)(2906002)(486006)(51416003)(76176011)(316002)(48376002)(8936002)(7696005)(50226002)(36756003)(2616005)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0620; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT063; 1:8OjIDwelI9Th4OU990zCoosFnuC59qp/ZaEl71AQSCjRtzTs7WTzQ2taFGdqH1h5O01O0JPesVrdPfeCeH+2mIHTzPH4CQyBbZ5nvrEoIKGHuB2SV187rHCgw3iY7l8i X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbb961ad-6215-48f9-01c2-08d6327c322d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0620; 3:qx8mU4SJMICu6VopJrJWhKie8nthyIPvtSkWTAMm5UEvvarIgGGROEXEHu9F0KDvYNUHN3qm9R26NVJwv3ev2mZ3f0ZgjK1EvgGq9LuBgkLeNiXJgdjJeg1doqiuxUa0QlVM3bPZxrTeU/5WieDlfEgBqlvrNeYga8A3zsGU5GZgS7eC+aL9yW3tVBjtrULnoT5z4rEPnR3ddn4zGj0BzlVxoDTY0VxuB4SvD+bdQRNmRoBT1H3nJFJu04xvg14w4WXZh03chlWjfwPLQVRFqM6FD8LraXXNOpFtgKRYnM8N65ghNkgDsumZwdMCobMCRYafJDv7NkHGTIPBWNeJT23XvzV7bn9KTY5DPShLAvM=; 25:hukFmrT+6u5/0KLqI3Slzklnyysf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wkPXScxnkl9Hk+m3Yw8FN0IgO9ruux6ThjVqEyEFFmJUIKBs3ry59qgWD7supIZoV8clzT3irb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(201708071742011)(7699051); SRVR:CY1PR12MB0620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0620; 4:aWuikUNaJd8xCeKxLVY2ZJNHvSTtC/XQO55/Vzb2zYijBy9fJauMvrI6e0AZGW7HpLLwlR24sbt08lShaJ8M1zthc+IAiayf9zhVGW5AskUT0BZBBTZV/676NlRHvAx8hYX+NhGIg1+RgJ/2iuOH5SlOE+JRONBxS7L2d4FSP0xvs7kr85hRF3IgReqHTIZyGcCMtZjKTgh8KJZOr3hg1nUND2v/Bk27YyClMDutjczj6m6SrHUWjj5S6O6IkPDD5TiHz9qohOENQB5HKcAHu0dmx5gfFDGDu8nmELIhFkfO/iWWrHDO0rpmGh5KuS8n X-Forefront-PRVS: 0826B2F01B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0620; 23:2E+nRex0DFAm5XtGHJ/wV4wKegdvv+iSEGkyZ7RFI?= 7Zgg/RQA/SdoxICo/NdLh2gPYGhyvyYUzu8GINeOX0ERtpCGsvPBpMzRhee8BKKjzxUwF7wvg7T7uRT6mIdnhJrqJaotm+a4S801b6fc02FHLqOKPBb8WtUQKawAuEZlu7Mm+TbEeCww8q+OUI+3h0jyWEOoNiAxR8+DWdRnXiwNhsJojBvyqb4eGsPdYlU825q91+zgJjl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LYA0f9D/cVLkqFc9+/xc1UEWVPRYdNuxLvAWRbZzSqPUghJ058voCtlEuPFCBSZr5Tv/LRzcK6fuvO5fMzF/N3SQNKzm6nuGGshOHyhF3Z/vfMJFLrYgx3SKlgKYxR5pFvHYGOPgODx1UlLfIJ01nePb7YVsCtraj5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0620; 20:De48/Pwhj8VmHEMZMw8OCF0xeOpgVi1iGVBPWtRrNDD1KdqyU30nFZiwIKztejDobiJKyQ4Vr0vNa99TWFwMiXnbxrJbROvguctGDM4ao5Ki6h1DK2fz/fLElXFQmSQZ10JCgJFKd+8Uk2e9wkGpHoliBWVifu1uG/I/glqj7IaL9h06zhuA2Z7zHWy7EqyeK+Io1PiVKvqDkN5++zsGzRsjB3eAvBsEGgP1fLK0Ii8wQ4dixWmH5h1nKoemyzqv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:57:11.6616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbb961ad-6215-48f9-01c2-08d6327c322d 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: CY1PR12MB0620 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: amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP user mode can query timeline payload. v2: check return value of copy_to_user 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 | 52 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 11 +++++++ 4 files changed, 67 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 566d44e3c782..9c4826411a3c 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -189,6 +189,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 c0891614f516..c3c0617e6372 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_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 f3f11ac2ef28..17124d40532f 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -1304,3 +1304,55 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; } + +static void drm_syncobj_timeline_query_payload(struct drm_syncobj *syncobj, + uint64_t *point) +{ + if (syncobj->type != DRM_SYNCOBJ_TYPE_TIMELINE) { + DRM_ERROR("Normal syncobj cann't be queried!"); + *point = 0; + return; + } + *point = syncobj->signal_point; +} + +int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_query *args = data; + struct drm_syncobj **syncobjs; + uint64_t *points; + uint32_t i; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + 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 == NULL) { + ret = -ENOMEM; + goto out; + } + for (i = 0; i < args->count_handles; i++) + drm_syncobj_timeline_query_payload(syncobjs[i], &points[i]); + ret = copy_to_user(u64_to_user_ptr(args->points), points, + sizeof(uint64_t) * args->count_handles) ? -EFAULT : 0; + + kfree(points); +out: + 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 c8bc1414753d..23c4979d8a1c 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -771,6 +771,15 @@ struct drm_syncobj_array { __u32 pad; }; +struct drm_syncobj_timeline_query { + __u64 handles; + /* points are timeline syncobjs payloads returned by query ioctl */ + __u64 points; + __u32 count_handles; + __u32 pad; +}; + + /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ @@ -928,6 +937,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_query) + /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. From patchwork Mon Oct 15 08:55:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10641351 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 A5E3115E2 for ; Mon, 15 Oct 2018 08:57:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 946B829616 for ; Mon, 15 Oct 2018 08:57:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 890862961A; Mon, 15 Oct 2018 08:57:38 +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 08D1729616 for ; Mon, 15 Oct 2018 08:57:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 017FD89DDD; Mon, 15 Oct 2018 08:57:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700081.outbound.protection.outlook.com [40.107.70.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0A7A89DD5; Mon, 15 Oct 2018 08:57:34 +0000 (UTC) Received: from BN6PR1201CA0009.namprd12.prod.outlook.com (2603:10b6:405:4c::19) by BY2PR12MB0613.namprd12.prod.outlook.com (2a01:111:e400:52df::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Mon, 15 Oct 2018 08:57:33 +0000 Received: from CO1NAM03FT044.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by BN6PR1201CA0009.outlook.office365.com (2603:10b6:405:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21 via Frontend Transport; Mon, 15 Oct 2018 08:57:32 +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 CO1NAM03FT044.mail.protection.outlook.com (10.152.81.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:57:31 +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, 15 Oct 2018 03:57:29 -0500 From: Chunming Zhou To: Subject: [PATCH 5/7] drm: add timeline support for syncobj export/import Date: Mon, 15 Oct 2018 16:55:51 +0800 Message-ID: <20181015085553.30656-5-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-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)(136003)(396003)(376002)(346002)(2980300002)(428003)(189003)(199004)(6666004)(126002)(105586002)(86362001)(1076002)(48376002)(53936002)(106466001)(446003)(14444005)(426003)(77096007)(476003)(186003)(2616005)(356004)(486006)(26005)(336012)(51416003)(2351001)(478600001)(11346002)(7696005)(76176011)(72206003)(16586007)(2906002)(4326008)(47776003)(450100002)(54906003)(81156014)(97736004)(6916009)(104016004)(5660300001)(305945005)(50466002)(53416004)(68736007)(36756003)(316002)(50226002)(8676002)(8936002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0613; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT044; 1:x+ISSwzMGQPUfkDVBqeV/OGwTI+QNE26H+cNwhnKZnfDpQtCmPD3t0Dz1FdFccydqLH/fwEGNJoNT6CYjHKzzOCqdfhyOF2583eASDZAjIjMr/1eoiGkq/XFFRdMJQis X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77a74e01-1abc-4502-0c28-08d6327c3dcf X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BY2PR12MB0613; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0613; 3:Q7hh6jsdfyaLobwLtWEWo/kVm45x+IvhyK56KowQKogb3gLHJmfNYYEO1uUYJrE3tet6alctXFvP2mG/esEHu0QNhpmIVLY+WKdUXtYwAYaXZgQ3wmh6lyVxjcFX/V7Y889Nws4V1sN5OAq61uA8WDGaYmwIUepW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AH/H87fn2YBjWbngXf497+zBqwT97FJyHCDeTMzHJLseSbAtUIbEvMiPMhwHuMlU83bwh0J6Ig+wS+mvqJ6hn3mV8H6UmYaXAwmB15hSRIhdrU8mCeDTpE0GXLRynKdlM65U0LFZpFjdfaklYpegp6wPY3EBjto4/C75zhMuNXBDr5Etuv4nl4mXNPw/QB5pYhr0VRLGtqhGBY1ptt4jpqijLkNCXVPseW8UTMsXmMvwo9c4efvGryUlRXXMZPg6m44PATJzDSBXY+z3jjRNtoLfByYxxNQiUwYnBmk/pfyXl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:BY2PR12MB0613; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0613; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0613; 4:mOg3WnteUOkmNJ0w40qpkWD7UeAzgpBXJ9goTmJePwjEjL55s5lxljIvVzb4mts086ADUXxxVF7UiBFGjdoamOroO4lKdhzAoHiISevdTuvmsyubhBc//9H/jnZWpODKwQwi9+B99v9eTQw0LUq2jDa8P3HyWpJb8UCJhfGkghIHh2p87pKeN77r40oNHMOQc2D6FTIXpO2JY3GRukdUIfj+KpK0IbVzEQe8Jb8M4IF89AwOF6XHAWfxBBxkbPe2pr8grsbt1oh6BryOnTlAeZ17idl4oFWeHiwFjrsvPvbLIYUk4nNlWnPo8jp19pSk X-Forefront-PRVS: 0826B2F01B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0613; 23:PEx/IUxMcbM45W93NkDu3uSmr6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8TFkWgyESfCOIwKf7jUs/NF/K2OF04ryI/gkVcTtHIn8paIW4a2+LceYRcdAdDiVfCnF2zBuxZNSKbsaO69Pfv0ZeH2cFwxPPXjF4LzTb8IyUe2WUMqFphBQkN5IHR6Yi/+SMZTxInPk=; 7:vv1wyyV+a6UY3q/6KHU9RNE8oS1qTJhLl040gFfUv9jpR2/gYPNfaj81SYHmZ0k9640/g6stckVLCK1sNpGHJueUNPN0naxiBi02ADGwNBCqnc2u2zwV/MwG0z9sokccoP/7HcNt76+GwkmnQvI60fH1QGfF6KQl/2xymK4aBF+ja83+dHt5s6B5VmS4c0apuK42oarnoqNMSS+AkQf4iuM3wR7o+QBBRuP6AGu+vN3yLK+W6AaPuKQ9yIdapwRc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0613; 20:LRlJN1EdCGLoqVBcW5VlimWiMtSH3nr6AARv58WYdlf9HFa2XXRQt9PTQTaSchJQ+kPQHdgEvIlujh3HQFFozqIQBFX/YEcH4vLpnqCwBO3g/WfkUbNC9zBOToIjalMZ5NvmK/3SDgoKxvURp6PCYbPG3fG/MTlK1xlv6S/bc0k0TEzVNFujiz6cDxa7Hc8ZCPJzWInGvAifQPXu4Zft/xlhzWdv5SgIHzQm9ot0e6bUkJz66fSOQaj5a+E9+XW1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:57:31.1628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77a74e01-1abc-4502-0c28-08d6327c3dcf 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: BY2PR12MB0613 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: amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP user space can specify timeline point fence to export/import. Signed-off-by: Chunming Zhou --- drivers/gpu/drm/drm_internal.h | 4 ++ drivers/gpu/drm/drm_ioctl.c | 4 ++ drivers/gpu/drm/drm_syncobj.c | 76 ++++++++++++++++++++++++++++++---- include/uapi/drm/drm.h | 11 +++++ 4 files changed, 88 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 9c4826411a3c..5ad6cbdb68ab 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -181,6 +181,10 @@ 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_handle_to_fd_ioctl2(struct drm_device *dev, void *data, + struct drm_file *file_private); +int drm_syncobj_fd_to_handle_ioctl2(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 c3c0617e6372..b80c2c28aee0 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -667,6 +667,10 @@ 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_HANDLE_TO_FD2, drm_syncobj_handle_to_fd_ioctl2, + DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE2, drm_syncobj_fd_to_handle_ioctl2, + 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 17124d40532f..aed492570d85 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -683,7 +683,7 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private, } static int drm_syncobj_import_sync_file_fence(struct drm_file *file_private, - int fd, int handle) + int fd, int handle, uint64_t point) { struct dma_fence *fence = sync_file_get_fence(fd); struct drm_syncobj *syncobj; @@ -697,14 +697,14 @@ static int drm_syncobj_import_sync_file_fence(struct drm_file *file_private, return -ENOENT; } - drm_syncobj_replace_fence(syncobj, 0, fence); + drm_syncobj_replace_fence(syncobj, point, fence); dma_fence_put(fence); drm_syncobj_put(syncobj); return 0; } static int drm_syncobj_export_sync_file(struct drm_file *file_private, - int handle, int *p_fd) + int handle, uint64_t point, int *p_fd) { int ret; struct dma_fence *fence; @@ -714,7 +714,7 @@ static int drm_syncobj_export_sync_file(struct drm_file *file_private, if (fd < 0) return fd; - ret = drm_syncobj_find_fence(file_private, handle, 0, 0, &fence); + ret = drm_syncobj_find_fence(file_private, handle, point, 0, &fence); if (ret) goto err_put_fd; @@ -823,9 +823,14 @@ drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data, args->flags != DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) return -EINVAL; - if (args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) + if (args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) { + struct drm_syncobj *syncobj = drm_syncobj_find(file_private, + args->handle); + if (!syncobj || syncobj->type != DRM_SYNCOBJ_TYPE_BINARY) + return -EINVAL; return drm_syncobj_export_sync_file(file_private, args->handle, - &args->fd); + 0, &args->fd); + } return drm_syncobj_handle_to_fd(file_private, args->handle, &args->fd); @@ -837,6 +842,61 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, { struct drm_syncobj_handle *args = data; + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->pad) + return -EINVAL; + + if (args->flags != 0 && + args->flags != DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE) + return -EINVAL; + + if (args->flags & DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE) { + struct drm_syncobj *syncobj = drm_syncobj_find(file_private, + args->handle); + if (!syncobj || syncobj->type != DRM_SYNCOBJ_TYPE_BINARY) + return -EINVAL; + return drm_syncobj_import_sync_file_fence(file_private, + args->fd, + args->handle, + 0); + } + + return drm_syncobj_fd_to_handle(file_private, args->fd, + &args->handle); +} + +int +drm_syncobj_handle_to_fd_ioctl2(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_handle2 *args = data; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->pad) + return -EINVAL; + + if (args->flags != 0 && + args->flags != DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) + return -EINVAL; + + if (args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) + return drm_syncobj_export_sync_file(file_private, args->handle, + args->point, &args->fd); + + return drm_syncobj_handle_to_fd(file_private, args->handle, + &args->fd); +} + +int +drm_syncobj_fd_to_handle_ioctl2(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_handle2 *args = data; + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) return -ENODEV; @@ -850,12 +910,14 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, if (args->flags & DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE) return drm_syncobj_import_sync_file_fence(file_private, args->fd, - args->handle); + args->handle, + args->point); return drm_syncobj_fd_to_handle(file_private, args->fd, &args->handle); } + struct syncobj_wait_entry { struct task_struct *task; struct dma_fence *fence; diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 23c4979d8a1c..da5df2a42fc3 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -735,6 +735,15 @@ struct drm_syncobj_handle { __s32 fd; __u32 pad; }; +struct drm_syncobj_handle2 { + __u32 handle; + __u32 flags; + __u64 point; + + __s32 fd; + __u32 pad; +}; + #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) @@ -938,6 +947,8 @@ 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_query) +#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD2 DRM_IOWR(0xCC, struct drm_syncobj_handle2) +#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE2 DRM_IOWR(0xCD, struct drm_syncobj_handle2) /** * Device specific ioctls should only be in their respective headers From patchwork Mon Oct 15 08:55:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10641353 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 E1F8615E2 for ; Mon, 15 Oct 2018 08:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECEC2961A for ; Mon, 15 Oct 2018 08:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C328F29624; Mon, 15 Oct 2018 08:58:01 +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 398AC29622 for ; Mon, 15 Oct 2018 08:58:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E89E889D5E; Mon, 15 Oct 2018 08:57:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0070.outbound.protection.outlook.com [104.47.38.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9367289C60; Mon, 15 Oct 2018 08:57:58 +0000 (UTC) Received: from BN6PR1201CA0016.namprd12.prod.outlook.com (2603:10b6:405:4c::26) by DM3PR12MB0746.namprd12.prod.outlook.com (2a01:111:e400:5984::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.26; Mon, 15 Oct 2018 08:57:56 +0000 Received: from CO1NAM03FT044.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by BN6PR1201CA0016.outlook.office365.com (2603:10b6:405:4c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23 via Frontend Transport; Mon, 15 Oct 2018 08:57:56 +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 CO1NAM03FT044.mail.protection.outlook.com (10.152.81.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:57:55 +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, 15 Oct 2018 03:57:51 -0500 From: Chunming Zhou To: Subject: [PATCH 6/7] drm/amdgpu: add timeline support in amdgpu CS v2 Date: Mon, 15 Oct 2018 16:55:52 +0800 Message-ID: <20181015085553.30656-6-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-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)(396003)(346002)(136003)(376002)(2980300002)(428003)(199004)(189003)(68736007)(4326008)(450100002)(5660300001)(72206003)(478600001)(2906002)(426003)(126002)(356004)(48376002)(476003)(11346002)(336012)(36756003)(2616005)(86362001)(486006)(50466002)(446003)(305945005)(104016004)(1076002)(81166006)(81156014)(8936002)(16586007)(2351001)(105586002)(50226002)(53416004)(6916009)(77096007)(47776003)(26005)(186003)(14444005)(53936002)(54906003)(316002)(106466001)(8676002)(76176011)(7696005)(51416003)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0746; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT044; 1:G2Vz5G0BXPbqc6EbVjYEJbrQumDp1ceW8Rv4rR0UVAy95kCOSRUcXebRPzAavTr7Gg+1bWKIu1fFWvu5m7uMy/j/1Ah27KKDED93bSmeQRP66imuqA1l8F7R5Zr3omUw X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05d86b5a-dd58-48e8-164e-08d6327c4c92 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:DM3PR12MB0746; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0746; 3:1V/JnX6vr8bt+IAKbjdhqdUHWqyHzCSe17XJYQ1fQVhoSZgKv88fUeA6/7pIsRyCO+yqhTvC6LYo3evqZbSGH0GDUyniDUqG84FDQubzQ+D9Mt5BHgvwjif0aVRcywcw1qaxACJXAE8L89u8PnPQf7kwC/YeU2ovWXA6g0zZKWhGBB6pF4Vu12J24dn19nrkAPFB4PVod04kTFV+gAgdv0V8HLP6+5vJrrIyTvSD4s7t/d0gldBiwho9RuHsbUGJI+zUcnywGExiPiXli2meYW3AyViGpBl+BbkkRXvrJda83HabNPA+bxmzXL9LmJgNipuqfgUnCRyfjurOJOuwUrpEYtdEEk12mfWopEC/qhg=; 25:N1pMVvwKPETYO1Qkyj+42c36hfyVr89o29Xo5nwdvGkriWFxl3+8Y71gLiHhRPHVDvszwbG0qeO1N/gtGmgfKV/yPTLyzWijUvF7D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oft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93003095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991067); SRVR:DM3PR12MB0746; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0746; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0746; 4:u8P8WaUQzk8ICFuKMVSJB0wKcbGTEqvI2+8ga98EqMBOUqEVMlWBc3wzekAyH+9gn5Z/nb/ykixYChJsqIncPkKdRHw0u1CHk7Bu479oNkTjqr/OJDzMQQV2WiGHSN/8VOGQzOKIdYyS0za+ZNhkAS8qSuAGDCqWeRmgz+96pTuO8HxS8EUMFkzlKLhJUTXQYuMkteREqqYsk6uZ2HMQGOhsXiF+Uqgk0bU6y5qrS35Ibmt/c+fakNEmvmKvd10Jm8YM9+jZ92bVVeigTNqWdFMSgZw5KkY6FubMlp+e0ZoeyUc0SDaReHj4874akx8S X-Forefront-PRVS: 0826B2F01B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0746; 23:Yy5FtF3oMIcToXFdj2FpDczMu8W92a4T9Pe0ffIE4?= es9lu6L8Nw9Oalc/iCvyYVRmtGBGozZUSPVkXOfcED0ZtVzFqcJDUFiawoJCqB3UjOOBVimFgD1rda7P+xncoTOkONy2swRlovVuwKK4lRwGn8y2N/Vb9qqJLUe6pkvbiRo5qONVzzbl++TQDiFT3iwW15uicQlqxusnFE1PIH2RBjmh2i98GXlxwyLIU5j0XmLrl29416YHMh64Bp7mB04HibQoteZybZKG1588+NpVG4ybqnkgif7z91yRQYoNXXABUSEIYrAgh4uylRwoOhlDhwd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JURx/zYEq4bTix4iMFmqeGh5aipzspNQ8Wz57eN9ceuR1I2zp5O90oAfi1TkdskZGYatmxvlBJTj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0746; 20:+W1LnvGa6VaV2kgY1lbdgE+vF5iusr0EYws3oN05zCr+gKHWTP8rfD/ZID213gOu5rdihy7WmRiMM5MXJnOthHEOxZS89lXavg5XHNr5otDZSScP4bDOqG8e9ELvoStTIgFZSm6nFB7Rlf8kS6JsidTJj5NbiVXdnoa4fGgknlklCQUHeKsjx8GfGpk4GabJpmITMIIdpCyUM6MRI5OtIWzt1LlD3BGTORQEtNJquJcasgeKDzLTp8AOuNwVltsu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:57:55.9448 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05d86b5a-dd58-48e8-164e-08d6327c4c92 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: DM3PR12MB0746 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: amd-gfx@lists.freedesktop.org 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 Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 111 +++++++++++++++++++++---- include/uapi/drm/amdgpu_drm.h | 9 ++ 3 files changed, 112 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 447c4c7a36d6..6e4a3db56833 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -975,6 +975,11 @@ struct amdgpu_cs_chunk { void *kdata; }; +struct amdgpu_cs_syncobj_post_dep { + struct drm_syncobj *post_dep_syncobj; + u64 point; +}; + struct amdgpu_cs_parser { struct amdgpu_device *adev; struct drm_file *filp; @@ -1003,9 +1008,8 @@ struct amdgpu_cs_parser { /* user fence */ struct amdgpu_bo_list_entry uf_entry; - + struct amdgpu_cs_syncobj_post_dep *post_dep_syncobjs; unsigned num_post_dep_syncobjs; - struct drm_syncobj **post_dep_syncobjs; }; 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 412fac238575..7429e7941f4c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -204,6 +204,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: @@ -783,7 +785,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, &parser->validated); for (i = 0; i < parser->num_post_dep_syncobjs; i++) - drm_syncobj_put(parser->post_dep_syncobjs[i]); + drm_syncobj_put(parser->post_dep_syncobjs[i].post_dep_syncobj); kfree(parser->post_dep_syncobjs); dma_fence_put(parser->fence); @@ -1098,13 +1100,17 @@ 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) + + r = drm_syncobj_find_fence(p->filp, handle, point, flags, &fence); + if (r) { + DRM_ERROR("syncobj %u failed to find fence!\n", handle); return r; + } r = amdgpu_sync_fence(p->adev, &p->job->sync, fence, true); dma_fence_put(fence); @@ -1115,46 +1121,108 @@ 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 *), + sizeof(struct amdgpu_cs_syncobj_post_dep), GFP_KERNEL); p->num_post_dep_syncobjs = 0; if (!p->post_dep_syncobjs) 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_dep_syncobjs[i].post_dep_syncobj = + drm_syncobj_find(p->filp, deps[i].handle); + if (!p->post_dep_syncobjs[i].post_dep_syncobj) return -EINVAL; + p->post_dep_syncobjs[i].point = 0; p->num_post_dep_syncobjs++; } + + 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_dep_syncobjs = kmalloc_array(num_deps, + sizeof(struct amdgpu_cs_syncobj_post_dep), + GFP_KERNEL); + p->num_post_dep_syncobjs = 0; + + if (!p->post_dep_syncobjs) + return -ENOMEM; + + for (i = 0; i < num_deps; ++i) { + p->post_dep_syncobjs[i].post_dep_syncobj = + drm_syncobj_find(p->filp, syncobj_deps[i].handle); + if (!p->post_dep_syncobjs[i].post_dep_syncobj) + return -EINVAL; + p->post_dep_syncobjs[i].point = syncobj_deps[i].point; + p->num_post_dep_syncobjs++; + } + return 0; } @@ -1168,18 +1236,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; } } @@ -1191,7 +1273,8 @@ 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], 0, p->fence); + drm_syncobj_replace_fence(p->post_dep_syncobjs[i].post_dep_syncobj, + p->post_dep_syncobjs[i].point, 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 1ceec56de015..44a34a77f986 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -517,6 +517,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; @@ -592,6 +594,13 @@ 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 Mon Oct 15 08:55:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10641355 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 E06EF925 for ; Mon, 15 Oct 2018 08:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB78B29618 for ; Mon, 15 Oct 2018 08:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB13D29622; Mon, 15 Oct 2018 08:58:13 +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 77F7329618 for ; Mon, 15 Oct 2018 08:58:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F2D889DD3; Mon, 15 Oct 2018 08:58:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730088.outbound.protection.outlook.com [40.107.73.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 291DD89DD3; Mon, 15 Oct 2018 08:58:11 +0000 (UTC) Received: from SN1PR12CA0063.namprd12.prod.outlook.com (2603:10b6:802:20::34) by SN1PR12MB0431.namprd12.prod.outlook.com (2a01:111:e400:5865::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Mon, 15 Oct 2018 08:58:09 +0000 Received: from CO1NAM03FT030.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::205) by SN1PR12CA0063.outlook.office365.com (2603:10b6:802:20::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23 via Frontend Transport; Mon, 15 Oct 2018 08:58:09 +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 CO1NAM03FT030.mail.protection.outlook.com (10.152.80.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1250.12 via Frontend Transport; Mon, 15 Oct 2018 08:58:08 +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, 15 Oct 2018 03:58:07 -0500 From: Chunming Zhou To: Subject: [PATCH 7/7] drm/amdgpu: update version for timeline syncobj support in amdgpu Date: Mon, 15 Oct 2018 16:55:53 +0800 Message-ID: <20181015085553.30656-7-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181015085553.30656-1-david1.zhou@amd.com> References: <20181015085553.30656-1-david1.zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(136003)(39860400002)(396003)(346002)(2980300002)(428003)(199004)(189003)(16586007)(6916009)(81156014)(478600001)(11346002)(316002)(446003)(476003)(2616005)(81166006)(97736004)(76176011)(51416003)(7696005)(50466002)(126002)(426003)(2351001)(48376002)(53416004)(8676002)(486006)(72206003)(104016004)(105586002)(106466001)(36756003)(5660300001)(54906003)(8936002)(450100002)(47776003)(4326008)(14444005)(336012)(186003)(53936002)(86362001)(77096007)(68736007)(50226002)(1076002)(2906002)(26005)(356004)(6666004)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0431; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT030; 1:4/Biyevx8ONtayJGj8WzW2fOQhnQn2l1VMtUL2D/26va4ht4dfY0MQKA706QghBc/UYoun+YdIwLif98SgTqbf9qh+wRVyzTPx+7oAuFlMBtSG/cmBKeJYISNQz1NWUA X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28586ea5-745f-4d0a-dbe7-08d6327c5441 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:SN1PR12MB0431; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0431; 3:IhUBXLXYq0MqgFDH+X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A/LXItnG3twAFQ98F9d0yBCPPRV6e6pDYpUL2guN1oYWi8BghhopFHEAJ8eLrlNJsoqKwljthncG13S32QG/CT5zx+iLrK3YaX+Lh0PqlSlMOgSR+sY+3tm+2bMGARumxTvvfXsS3JL6PloipO9L/AosEHxu2IoXG4zF9KUVYq8SFdBAOF9EwrQfwXtmy0PDmKHQD36NyRgQ5zYQmHR6WMNZ7kRz8p9tQopA1tcggKnUCMO1SUqO3VInomdxhl9kOLqqyd6g8t22llW+4ccQvLb6gJNneDug9yXWE9YgknlfmFZ5ODASEy1EyFtuJ5v07D/ZqzFYZKUqE+PHVxbJnftLM9voAyBVLSfyzE2DSDTLbxFeUY/ztYIbjRPP6k78jh/E21sawHw4uZjULMKEfHVffOnbjkPb1fWcMzDkyv4doOR4cwxXW7D+EFLEhHY2cghJGIWZr4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051); SRVR:SN1PR12MB0431; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0431; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0431; 4:JODSUBsZNF/ZmKAswkB6XzlUmVCV5ke9E3Mm7rf2FYiISDKyts71I7MevjlDfkuI2/wcbFyLf/eA0F/rNFXfYLI9bCzg7F8a7A1IfQGbDYx+FR3UxUNW8fUttFCK4Vj1q1blyuMPhqvjObqoLZNaVdS9Nz/D0Rk9w9gpvA48XqkTOdF8cZkVVSlKGouW7YQii8XtYVDW08z0/cnWsA9mkMJnFoqB0/KraCeLTIvQlX9wpKzKgDTnJv1Ol+Z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RKj3lLRZvPo8Q0YLV0AzTPtHlyKauQm8Ai9T8sqH2D6CeCh6WUpotXsVOdYuaMtGLDMZ0KXIex4K2od075ia5xdXAk1h98atL7Op6ULgoXkuSkmKFnULOdD3A==; 5:a2A1dmoLYT9o9pVmiR29BqZYlamZ9cqMl9Yk3JC1HBCSAtxqFLJbwcCTgnjCi7HGhjcCi/K2EeKtP2X6jWsrsJ2vryRC8ERnCCqJVeGrXDbsQX10acX1cGZ6PSzIH4fVvbgKLZy1COk5yMDwHhAyL8/qdsr1Oh+AWfIovxxRx3E=; 7:WqMgzL4e5yXEXOGxRUxsIhbWLfOELvFPS/qGTyJ+jX18Sx3p33MuIq83U0EwAv2zqbhyhhhOkCZOuBpYXHs+K3Odf9jEC+NS8S/2TX8haFqKsLHzC6i68A7RKgQw3XoQ5mDcGgEZZGysSimp8NhtdvfhB1Z9By8GFEPni78MPt23JqppPti7irtGACTRPvw6sA+o55wW2bH8tFmppwadNoAs78T2L8FYOS7DscklcNytz+Hhza3GIzYP41/4dHIE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0431; 20:ogFuTj4dHF9vs2PgHWtVZjhAkz/aEnAVGUNkwDhu3G6x24gj0UeMSIP7sQdFGbWHAHpsdfZnwu7EgqnSXBxfw1eG0DbNyobITJlfhlI/880VKhG0ANv0hlK8Rz6yFk7Tx71JNvCQMTPPVnUGXKKwHesc8Mnh6obD7AhFW5zyoGULOS/TpS+CLujjLHo2+SLdeOo2OZcH/0WgRRbCduUTJAz5G1/fOApv4GCfUKBo6BSD43bYRZVkckFM0bWY5z8f X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 08:58:08.8408 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28586ea5-745f-4d0a-dbe7-08d6327c5441 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: SN1PR12MB0431 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: amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 6870909da926..58cba492ba55 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -70,9 +70,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;