From patchwork Thu Jul 25 07:52:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 11058133 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 9F96F112C for ; Thu, 25 Jul 2019 07:52:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9247F284A3 for ; Thu, 25 Jul 2019 07:52:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8589228987; Thu, 25 Jul 2019 07:52:51 +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 7DAB528647 for ; Thu, 25 Jul 2019 07:52:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7175B6E685; Thu, 25 Jul 2019 07:52:48 +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-eopbgr800041.outbound.protection.outlook.com [40.107.80.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 29C3C6E685 for ; Thu, 25 Jul 2019 07:52:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y+KISeOS/Y286bQxlHOmwhul5sQm/eImYthjRkdq/anLNUp5tC8HwIPL9Ha2ELr+sm4WUWfnirCev9Y3tjhAPOR3hXtXGMTbbZ8da1ikdWo4/IajmuWn755Tpnh0f4xyarAFLXrvAHqNbPY18HjkXZ9uNNqWOKQPLNAI+sLioTadjXEC93sRBzNBBG/DbmeOdi6xjTkXq5CkyMAJXqV6fffMntrPeduoJakjUINAoAFj3xMSGAOtZFH5OSYy9tHqc8bwBiNe1yVwlKRC4rv4hz2rs+Z8hbPczRl8JDI8zrMSZUemscRgHwYCXUHlOxRE+/VIV6HmnJ00eMtHmACRZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BZl622LdEcOELHCgf4gkJHTl4milZTlFy03+hqGnSiI=; b=kTLmKqPfFJOKIHu2Dgy7ajQMu0kiwj9609QT9InqsRp0NHpN2Hk/duNMAALYbQzTdVLtp5ZWPTuY9DUbAkMldVsY051vIheGRFmFCiJ7Wl4erxTXCCxHMhDVQLhBUeOjAMBzSon1BVmVyBzdqbhKhiNyVa2GNWTqnyTX2x4GUrq513FWe2IX8ns7kslqtSst2m7/tlyh0pLVjUvESxcw4LxsAvKwB7HVH9yzQBvEpor3vGNgEoDQq4K2YIBBXoV+xqHhJGgTEaFpk1fcj3ALjCNI3qPBiGrbQbJlvJxSk14bb6hWxhsEpT01HHAz19dyYeEFJxOVTxEp5JYsfpnI6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com;dmarc=permerror action=none header.from=amd.com;dkim=none (message not signed);arc=none Received: from DM5PR12CA0057.namprd12.prod.outlook.com (2603:10b6:3:103::19) by BN6PR12MB1571.namprd12.prod.outlook.com (2603:10b6:405:4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.16; Thu, 25 Jul 2019 07:52:45 +0000 Received: from DM3NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0057.outlook.office365.com (2603:10b6:3:103::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.16 via Frontend Transport; Thu, 25 Jul 2019 07:52:45 +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 DM3NAM03FT011.mail.protection.outlook.com (10.152.82.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2115.10 via Frontend Transport; Thu, 25 Jul 2019 07:52:44 +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; Thu, 25 Jul 2019 02:52:43 -0500 From: Chunming Zhou To: Subject: [PATCH libdrm] libdrm: wrap new flexible syncobj query interface v2 Date: Thu, 25 Jul 2019 15:52:36 +0800 Message-ID: <20190725075236.21226-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)(4636009)(39860400002)(396003)(376002)(136003)(346002)(2980300002)(428003)(199004)(189003)(81166006)(5660300002)(81156014)(54906003)(316002)(4326008)(1076003)(14444005)(2351001)(50226002)(2870700001)(305945005)(53416004)(53936002)(50466002)(2906002)(126002)(8936002)(8676002)(66574012)(186003)(2616005)(476003)(7696005)(336012)(6916009)(70586007)(70206006)(486006)(6666004)(426003)(478600001)(47776003)(5820100001)(86362001)(26005)(356004)(36756003)(23676004)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1571; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3d55829-e429-4ff2-4466-08d710d51433 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BN6PR12MB1571; X-MS-TrafficTypeDiagnostic: BN6PR12MB1571: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:199; X-Forefront-PRVS: 0109D382B0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: cBqW0fbhvA4UnjUOdK41cQsd4Sk+BA82MkYdUU6ddsJG01pmvMvmw3jz6zUTsQnxGJ4UZWWqIfnixiMbYWT9N4Ef07RdFZZB+I1bVzB7kAbAfJPsz05AMBHgiY4cMIT1zqYj7CfZSrbCMso49hnjACZDKcF+GUWDKnl0S63HLdxjeB2GnddsdZ0sE32+m/JMiELP5StgKG4ZerN6WZUd0EXA3+onvhYsOyBiwumxLWIjCXw5zxOkjFxs4fAa47XXFbPOJ7P7Y3iDJl+z0zVtBLUUmMMMHufZ1dXhpDX9EHw7uq64hfiv6w26fROV+0T/28yRv4Tbw34izvLc4E9IpY91IGak2PTcbkitBgvbT0+0zM737bYgDPhbfxL5t2qCKIu5wSXkah+qUemIWudtvvJKNnwOmUnNN6O5C/luwgU= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2019 07:52:44.7164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3d55829-e429-4ff2-4466-08d710d51433 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: BN6PR12MB1571 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BZl622LdEcOELHCgf4gkJHTl4milZTlFy03+hqGnSiI=; b=wMc2ixtgIdZPvL+TT7foAlzTlrPsjtR6xPToklr8Zy126qHJnJhXV8+Yn1G+9k5jBjEqdZPOb2TAGp+wCR+JEDSz30AT2WVyadIqCI1U+WSmri97ByOJoklTMxFh1mEbPANImV/Ru5TO3V94JbiPEJyHuYcdZ6rwA2yYBykw7xs= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP v2: nit-picks fix Signed-off-by: Chunming Zhou Cc: Lionel Landwerlin Cc: Christian König --- amdgpu/amdgpu-symbol-check | 1 + amdgpu/amdgpu.h | 18 ++++++++++++++++++ amdgpu/amdgpu_cs.c | 10 ++++++++++ include/drm/drm.h | 3 ++- xf86drm.c | 15 +++++++++++++++ xf86drm.h | 2 ++ 6 files changed, 48 insertions(+), 1 deletion(-) diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 274b4c6d..597a99b2 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -56,6 +56,7 @@ amdgpu_cs_syncobj_export_sync_file2 amdgpu_cs_syncobj_import_sync_file amdgpu_cs_syncobj_import_sync_file2 amdgpu_cs_syncobj_query +amdgpu_cs_syncobj_query2 amdgpu_cs_syncobj_reset amdgpu_cs_syncobj_signal amdgpu_cs_syncobj_timeline_signal diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index 9d9b0832..19f74bd6 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1591,6 +1591,24 @@ int amdgpu_cs_syncobj_timeline_wait(amdgpu_device_handle dev, int amdgpu_cs_syncobj_query(amdgpu_device_handle dev, uint32_t *handles, uint64_t *points, unsigned num_handles); +/** + * Query sync objects last signaled or submitted point. + * + * \param dev - \c [in] self-explanatory + * \param handles - \c [in] array of sync object handles + * \param points - \c [out] array of sync points returned, which presents + * syncobj payload. + * \param num_handles - \c [in] self-explanatory + * \param flags - \c [in] a bitmask of DRM_SYNCOBJ_QUERY_FLAGS_* + * + * \return 0 on success\n + * -ETIME - Timeout + * <0 - Negative POSIX Error code + * + */ +int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev, + uint32_t *handles, uint64_t *points, + unsigned num_handles, uint32_t flags); /** * Export kernel sync object to shareable fd. diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 977fa3cf..feb2aec8 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -721,6 +721,16 @@ drm_public int amdgpu_cs_syncobj_query(amdgpu_device_handle dev, return drmSyncobjQuery(dev->fd, handles, points, num_handles); } +drm_public int amdgpu_cs_syncobj_query2(amdgpu_device_handle dev, + uint32_t *handles, uint64_t *points, + unsigned num_handles, uint32_t flags) +{ + if (NULL == dev) + return -EINVAL; + + return drmSyncobjQuery2(dev->fd, handles, points, num_handles, flags); +} + drm_public int amdgpu_cs_export_syncobj(amdgpu_device_handle dev, uint32_t handle, int *shared_fd) diff --git a/include/drm/drm.h b/include/drm/drm.h index 532787bf..af37a80b 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -771,11 +771,12 @@ struct drm_syncobj_array { __u32 pad; }; +#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */ struct drm_syncobj_timeline_array { __u64 handles; __u64 points; __u32 count_handles; - __u32 pad; + __u32 flags; }; diff --git a/xf86drm.c b/xf86drm.c index 953fc762..28a61264 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4314,6 +4314,21 @@ drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, return 0; } +drm_public int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points, + uint32_t handle_count, uint32_t flags) +{ + struct drm_syncobj_timeline_array args; + + memclear(args); + args.handles = (uintptr_t)handles; + args.points = (uintptr_t)points; + args.count_handles = handle_count; + args.flags = flags; + + return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args); +} + + drm_public int drmSyncobjTransfer(int fd, uint32_t dst_handle, uint64_t dst_point, uint32_t src_handle, uint64_t src_point, diff --git a/xf86drm.h b/xf86drm.h index 3fb1d1ca..55ceaed9 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -884,6 +884,8 @@ extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points, uint32_t *first_signaled); extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, uint32_t handle_count); +extern int drmSyncobjQuery2(int fd, uint32_t *handles, uint64_t *points, + uint32_t handle_count, uint32_t flags); extern int drmSyncobjTransfer(int fd, uint32_t dst_handle, uint64_t dst_point, uint32_t src_handle, uint64_t src_point,