From patchwork Wed Jul 24 08:01:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 11056237 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 5F74813AC for ; Wed, 24 Jul 2019 08:02:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5328E28683 for ; Wed, 24 Jul 2019 08:02:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46A4F2876C; Wed, 24 Jul 2019 08:02:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3BA328683 for ; Wed, 24 Jul 2019 08:02:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE58A6E48C; Wed, 24 Jul 2019 08:02:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820077.outbound.protection.outlook.com [40.107.82.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id D02F06E48C for ; Wed, 24 Jul 2019 08:02:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LfOQYhV53TAMz1FFXScCFo3zPoIOOOZTXaVMXCmvjIDhXcUc4UQTozL/69VwjvzaxaisSUrsQDRA/Lrku7D16TcDYTgJVgN0os8upz/hZvI6nV1yR1WqtYHer+3OOp8CPt//I8f5vkxLY6ULJ1ZuY2UYWi9vBoBaQXjDzpjDZL/O0Sa2g8/e7XAzgm5UJNypAYIQ+9uG8TFqSO/MYGmss3p+rGUiTufMOQrtjMD26dcT/o35ekPH5arn1cyJfu9Me/TCRjF30KUWI76RWZoXgwTkX3CldEe26V89R8SycG8PEKa1GBWIU820+L/VsjmEdteeiwi/llifyWCOVbNXKw== 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=Ckf0VPOn4ruoTvihxBmncx+KHdw6szUKg0b4dbZWACo=; b=MDGyQRJFq3R9Yqdx6K4yabYeWl5LoM89G/xKYQMIHCIMhIa8cwVTRTUk7NlrRKWeZp+ZAI6ufg+kyag+0QN32nT8SujnEjw/XOdKNqsGGauKny6cbjliJ3t2KPbJwsP3YYl1CVYAv8aUq6nh7pGT+AnlU1YjNuwt2974K6Thfuj1ZyXYikGaeSds2HEgFz4uULFjNI+i1MTL1zM/khB7muJfDV/VqoSsr4klCOHbKBK3NU9DbEXEY3EOjheAda73bg2enjS68aeOAhqYid6YWrM9iW7KCaNmWx4mvB+FJmP9rvOS/DL4A84SGDfiyfPXD5AFd/b57qCSMyHB8GjHwA== 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 DM3PR12CA0076.namprd12.prod.outlook.com (2603:10b6:0:57::20) by BN6PR12MB1572.namprd12.prod.outlook.com (2603:10b6:405:3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.16; Wed, 24 Jul 2019 08:02:12 +0000 Received: from DM3NAM03FT018.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM3PR12CA0076.outlook.office365.com (2603:10b6:0:57::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Wed, 24 Jul 2019 08:02:11 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT018.mail.protection.outlook.com (10.152.82.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Wed, 24 Jul 2019 08:02:11 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Wed, 24 Jul 2019 03:02:09 -0500 From: Chunming Zhou To: Subject: [PATCH libdrm] libdrm: wrap new flexible syncobj query interface Date: Wed, 24 Jul 2019 16:01:58 +0800 Message-ID: <20190724080158.13878-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)(376002)(396003)(39860400002)(136003)(346002)(2980300002)(428003)(199004)(189003)(478600001)(6666004)(26005)(316002)(53416004)(356004)(186003)(8676002)(54906003)(305945005)(336012)(486006)(70586007)(6916009)(70206006)(5820100001)(2616005)(4326008)(86362001)(81156014)(476003)(81166006)(126002)(2351001)(2906002)(23676004)(426003)(47776003)(1076003)(7696005)(50226002)(66574012)(2870700001)(36756003)(8936002)(53936002)(68736007)(50466002)(14444005)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1572; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d9681730-d3aa-40fc-6d37-08d7100d3b99 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BN6PR12MB1572; X-MS-TrafficTypeDiagnostic: BN6PR12MB1572: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:199; X-Forefront-PRVS: 0108A997B2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: /zchNKfCeMDi4u1m5Wa2tcMz4r6FwLpHPogoFnAQdzFEEH68YgFJ0D3ZAwKpx8/CTJdcqiIJ6a0ps0dwDy27HZNqTntsUAUDSJf+A3/wTcMCW4JgKSz3FFH7EwPc/HhB8ix5MgovskOimqa8AbFkz6wjd5KrZESf00lb3FyD0F+1CQ8or59CiI3LA2P2ZRMgdn75aCPeZKrIDS5jvk5K1kx8T99PdCK7RZk/QFLk4OU7H7wfNG9ywtCpatJeiPmGz5uyEDeDZbNagRac2g5VAKywv7ONy5U10VBBpoT19TZEl5XOITCqGn6FklS6DvfbK56PNBwCdWHTytbWZCxzt5OexjfkR9zStPO2bu2uenHf/ZLP+4MxSc8DnEqwavnYUmymwRiHdPgZUu03tlAZK2z402M0cobDJMTq/DxnCA0= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2019 08:02:11.2901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9681730-d3aa-40fc-6d37-08d7100d3b99 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1572 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=Ckf0VPOn4ruoTvihxBmncx+KHdw6szUKg0b4dbZWACo=; b=ijZ0EdWuOCz+YElNWjNGM0tEb0Lh1dq2lpFADB0UMv1ER1WpbZ3gUpuAc1aZ5FJtiR5Gb25mPUL9qo68D9yy/RdbLjwOuxBZdmZ8eUuuOoJZOawvdu9ONQTWz+v0yyp0bByV82ib6Feua0erYPyAIsTaTeZp6wOVzkqdhVt3TNI= 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 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 | 19 +++++++++++++++++++ xf86drm.h | 2 ++ 6 files changed, 52 insertions(+), 1 deletion(-) diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 274b4c6d..3bc1a9f1 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_query1 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..ce7e2bbb 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 payloads. + * + * \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_query1(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..e2287fa0 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_query1(amdgpu_device_handle dev, + uint32_t *handles, uint64_t *points, + unsigned num_handles, uint32_t flags) +{ + if (NULL == dev) + return -EINVAL; + + return drmSyncobjQuery1(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..fb7d5cc5 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4314,6 +4314,25 @@ drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, return 0; } +drm_public int drmSyncobjQuery1(int fd, uint32_t *handles, uint64_t *points, + uint32_t handle_count, uint32_t flags) +{ + struct drm_syncobj_timeline_array args; + int ret; + + memclear(args); + args.handles = (uintptr_t)handles; + args.points = (uintptr_t)points; + args.count_handles = handle_count; + args.flags = flags; + + ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args); + if (ret) + return ret; + return 0; +} + + 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..29c1df6d 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 drmSyncobjQuery1(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,