From patchwork Tue Apr 9 09:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10890793 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 E795A1800 for ; Tue, 9 Apr 2019 09:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4E1B2888C for ; Tue, 9 Apr 2019 09:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C93CF28898; Tue, 9 Apr 2019 09:05:10 +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 7CB5C2888C for ; Tue, 9 Apr 2019 09:05:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FDF0891DD; Tue, 9 Apr 2019 09:05:09 +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-eopbgr700071.outbound.protection.outlook.com [40.107.70.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5AF61891DC; Tue, 9 Apr 2019 09:05:08 +0000 (UTC) Received: from DM6PR12CA0016.namprd12.prod.outlook.com (10.255.77.29) by BYAPR12MB3462.namprd12.prod.outlook.com (20.178.196.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.21; Tue, 9 Apr 2019 09:05:06 +0000 Received: from BY2NAM03FT058.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by DM6PR12CA0016.outlook.office365.com (2603:10b6:5:1c0::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16 via Frontend Transport; Tue, 9 Apr 2019 09:05:06 +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 BY2NAM03FT058.mail.protection.outlook.com (10.152.85.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16 via Frontend Transport; Tue, 9 Apr 2019 09:05:05 +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; Tue, 9 Apr 2019 04:04:53 -0500 From: Chunming Zhou To: , , , Subject: [PATCH libdrm 3/8] add timeline wait/query ioctl v2 Date: Tue, 9 Apr 2019 17:04:32 +0800 Message-ID: <20190409090437.3485-3-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190409090437.3485-1-david1.zhou@amd.com> References: <20190409090437.3485-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)(136003)(39860400002)(396003)(346002)(376002)(2980300002)(428003)(199004)(189003)(316002)(51416003)(2906002)(4326008)(186003)(97736004)(8936002)(77096007)(446003)(11346002)(2616005)(426003)(336012)(7696005)(26005)(476003)(126002)(486006)(53936002)(110136005)(50226002)(305945005)(5660300002)(16586007)(53416004)(47776003)(8676002)(81166006)(81156014)(106466001)(68736007)(76176011)(36756003)(72206003)(478600001)(104016004)(86362001)(48376002)(50466002)(1076003)(356004)(2201001)(6666004)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3462; 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: 74855a87-4c52-4469-0775-08d6bcca7572 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328); SRVR:BYAPR12MB3462; X-MS-TrafficTypeDiagnostic: BYAPR12MB3462: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 000227DA0C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: VALvOYrRWSh7aLobBrjkvfPtXdNxPO6gqXuB3PrBZhs5w2tCg6OElAZnckN7FlRrbbRM+29Vwbjb3aqAq+tdfJhrORp5Ws+B7R9rA6PiLFARbMZA734VS5ECU+3fCzWzRuRIOJvZ2R5K7qyBZpgxQt4DR+h+V/TTYs0UcFWnPHsR+lMje3yMHVH5p/pV9xSarF58tpcls5dRHSW5SP6ltkFQtGBhgQ4B9RLKRLrA5kL27jx7N3e0CfPqlWJluIrPZMdgZaTTvxoBI2yo8625u21Y35SAQJg6eX5EfHmFoLRU+t3wfh0aZyZm1R5O2zj9GuJxytiCUNSeww9pj+lYEdYqdFN9oCc7gHSckkWtGADSu/sR+ewNLfDOpLi6HsYntqnd92dGdG7ViC6s8tQIzEs97NZBWqM/h8Bg0/kDcBc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2019 09:05:05.6404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74855a87-4c52-4469-0775-08d6bcca7572 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: BYAPR12MB3462 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hi9YB2YCO3a2OJOFLsP9Hc3VHFoazbc3rWNpGR2VRFs=; b=EvFS3Ny4ZRES5lXrexHS/Q4uAwUXC1Y46PZEpGc+mjzDPAWRFdVkAhVoQM2THpC08KUB4ordTuLXaWDWMFmXqF7vUblQts4a9zd4KjqohKGGr9m5gj5x4NLLPTfmf2TIH5GZiO8TgTrdVy32wsNbF4q2iMu8BayoBS+fOYvL8dc= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP v2: drop export/import Signed-off-by: Chunming Zhou --- xf86drm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ xf86drm.h | 6 ++++++ 2 files changed, 50 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index 18ad7c58..66e0c985 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4279,3 +4279,47 @@ drm_public int drmSyncobjSignal(int fd, const uint32_t *handles, ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &args); return ret; } + +drm_public int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points, + unsigned num_handles, + int64_t timeout_nsec, unsigned flags, + uint32_t *first_signaled) +{ + struct drm_syncobj_timeline_wait args; + int ret; + + memclear(args); + args.handles = (uintptr_t)handles; + args.points = (uint64_t)(uintptr_t)points; + args.timeout_nsec = timeout_nsec; + args.count_handles = num_handles; + args.flags = flags; + + ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, &args); + if (ret < 0) + return -errno; + + if (first_signaled) + *first_signaled = args.first_signaled; + return ret; +} + + +drm_public int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, + uint32_t handle_count) +{ + struct drm_syncobj_timeline_array args; + int ret; + + memclear(args); + args.handles = (uintptr_t)handles; + args.points = (uint64_t)(uintptr_t)points; + args.count_handles = handle_count; + + ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_QUERY, &args); + if (ret) + return ret; + return 0; +} + + diff --git a/xf86drm.h b/xf86drm.h index 887ecc76..60c7a84f 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -876,6 +876,12 @@ extern int drmSyncobjWait(int fd, uint32_t *handles, unsigned num_handles, uint32_t *first_signaled); extern int drmSyncobjReset(int fd, const uint32_t *handles, uint32_t handle_count); extern int drmSyncobjSignal(int fd, const uint32_t *handles, uint32_t handle_count); +extern int drmSyncobjTimelineWait(int fd, uint32_t *handles, uint64_t *points, + unsigned num_handles, + int64_t timeout_nsec, unsigned flags, + uint32_t *first_signaled); +extern int drmSyncobjQuery(int fd, uint32_t *handles, uint64_t *points, + uint32_t handle_count); #if defined(__cplusplus) }