From patchwork Thu Jul 25 08:11:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 11058193 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 8A38F13B1 for ; Thu, 25 Jul 2019 08:11:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B56C287FE for ; Thu, 25 Jul 2019 08:11:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED4B2881D; Thu, 25 Jul 2019 08:11:26 +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 03A1F287FE for ; Thu, 25 Jul 2019 08:11:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5CAE6E68F; Thu, 25 Jul 2019 08:11:24 +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-cys01nam02on060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::60d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D0106E68F for ; Thu, 25 Jul 2019 08:11:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFnQkovf6zJSsrVGsi+2reCExJCchBx0K8KGAxB4ZmA9C8K9PiyVuOJ9Mx+SLT9EZQkyM558OLPnV/jdXNyqTH1WcHuVztOA/7HSMg6r150cjgucdnYNw1J0OGKOqpv/ITqzscoQPGYERKfrpLTl6aDNErGGMBIVEyAX1zeNes2RfB/a4i9CAc03T6DKLST7eKEulAOCbiZ9al9Hoo+J34sQlGWr884VOMbG4KTBM9LpYOkyZQfigWeQMe648NL7gO/1+sthOmBfus/j+5hW8f3/U1S29uqoQWfXu78nWWCzCHbgmf/VbM0JecKn2AQ6oWwx4AZxaM47HsgFElQZPw== 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=9DkI9+35MPoc2GhXaDEQLzffwvnWettkE/S8u8oBvB8=; b=dZKGy6EU1B2p99XifN3NwZL+e9nKYiVRYf8UwtuKp5tFzMql1HtZr3aKbSzqHuAilWchgx/ExpAwxoKZwfrGMULbYr+M8geWZGMMqqrVHxydKJY0KF+46WTYULXDYTk6aOg8v8exYakmfk8q5E2xyiZdM6VPMXSOUtsURUFWa1tZbE0J5cMLwVuqA87RQo3Xwsgb9aLy4PJ7FntpHscXcd9vpUiWGh14TY0TWwcpOaoqRnScpITluDpmWEFzNplOujjGpBPktBqHuGBLl4+YRyJ7Hp7jycEnPdbRkEiDJQuCPmHPZq/fnslLtlQfFle9ZZ7nMt67AdZ7XvPToalvCA== 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 DM3PR12CA0112.namprd12.prod.outlook.com (2603:10b6:0:55::32) by DM5PR1201MB2489.namprd12.prod.outlook.com (2603:10b6:3:e2::22) 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 08:11:21 +0000 Received: from BY2NAM03FT059.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::206) by DM3PR12CA0112.outlook.office365.com (2603:10b6:0:55::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.15 via Frontend Transport; Thu, 25 Jul 2019 08:11:21 +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 BY2NAM03FT059.mail.protection.outlook.com (10.152.85.111) 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 08:11:20 +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 03:11:19 -0500 From: Chunming Zhou To: Subject: [PATCH libdrm] libdrm: wrap new flexible syncobj query interface v2 Date: Thu, 25 Jul 2019 16:11:11 +0800 Message-ID: <20190725081111.21568-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)(136003)(396003)(346002)(376002)(2980300002)(428003)(199004)(189003)(68736007)(36756003)(2351001)(81156014)(53936002)(70206006)(6666004)(356004)(4326008)(70586007)(486006)(50466002)(81166006)(14444005)(2906002)(8936002)(53416004)(7696005)(478600001)(186003)(336012)(66574012)(23676004)(50226002)(1076003)(305945005)(5660300002)(8676002)(26005)(426003)(126002)(6916009)(316002)(2870700001)(2616005)(86362001)(54906003)(5820100001)(47776003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB2489; 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: 7b04d370-3cb7-45dd-4e6b-08d710d7ad54 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:DM5PR1201MB2489; X-MS-TrafficTypeDiagnostic: DM5PR1201MB2489: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:383; X-Forefront-PRVS: 0109D382B0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: Q5M5FLnwebuCkPb2K66ia6aQQZ8l2ePn4HKfV+mRFlAGAU/3a77O91e2BeN0plsG/ZK1ncvUtSrRMlrSTn1QoxHVSkVAWHnqwzaYH7uUyvasXORHfrfISeNASUVUmNlG8tm4ndTYyP1cWv+2lA1evvb2CRx3s+7qbTGKCqGfbb9krSZlFmlqlaZadvWLYcdBUatpgm+natI5zh6VRL97qUvLZxAW636aUtXkuBrC4S+40N8nn40Vdh5IMSP7ce9cc88Jf+B+xohOI3vhkYConHx5iw0X9koviNHzd6/v6kaQkril9CzxQJw6ytqktyT8Vt1cf4E1cmP1WYPQPvIVwqRcQzaG9svB5SepGQCOlx9P8mZnq4L18gJ8ywZowXRjk3aht4Q16eMX9HIOcz7vlsne+pW0EB2B6l/8w6dU7tM= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2019 08:11:20.6519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b04d370-3cb7-45dd-4e6b-08d710d7ad54 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: DM5PR1201MB2489 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=9DkI9+35MPoc2GhXaDEQLzffwvnWettkE/S8u8oBvB8=; b=vFLKohUiVigMPfLXzt2ZMtV7+aRBHuUC/Z2ChiC6N229HOOZysS+FBxNAZ61Xuyxh9PNSNauQJVuHAIm3dAKDQFNkg6flfYo8MCPJmuNvz/02aYPSb2oa/GRaQwRuILGSJ9QwqA3MPPVeyEQT4aE0G0co1qaIDeRmEhK7KVVrHQ= 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 Reviewed-by: Christian König For the xf86drm.[ch] part : Reviewed-by: Lionel Landwerlin --- 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..01e2b2c8 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 (!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,