From patchwork Tue May 7 11:33:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10932821 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 C23F9112C for ; Tue, 7 May 2019 11:34:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AECC52864A for ; Tue, 7 May 2019 11:34:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0B4628927; Tue, 7 May 2019 11:34: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=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 54D1F2864A for ; Tue, 7 May 2019 11:34:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3D656E7A7; Tue, 7 May 2019 11:34:11 +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-cys01nam02on060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::60e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 351026E7A7 for ; Tue, 7 May 2019 11:34:10 +0000 (UTC) Received: from DM5PR12CA0004.namprd12.prod.outlook.com (2603:10b6:4:1::14) by MWHPR12MB1151.namprd12.prod.outlook.com (2603:10b6:300:e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.10; Tue, 7 May 2019 11:34:08 +0000 Received: from DM3NAM03FT020.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by DM5PR12CA0004.outlook.office365.com (2603:10b6:4:1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.10 via Frontend Transport; Tue, 7 May 2019 11:34:08 +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 DM3NAM03FT020.mail.protection.outlook.com (10.152.82.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.11 via Frontend Transport; Tue, 7 May 2019 11:34:07 +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, 7 May 2019 06:34:06 -0500 From: Chunming Zhou To: Subject: [PATCH libdrm 2/7] add timeline wait/query ioctl v2 Date: Tue, 7 May 2019 19:33:54 +0800 Message-ID: <20190507113359.16387-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190507113359.16387-1-david1.zhou@amd.com> References: <20190507113359.16387-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)(346002)(376002)(136003)(39860400002)(2980300002)(428003)(189003)(199004)(2906002)(446003)(426003)(70586007)(8676002)(81156014)(81166006)(8936002)(186003)(336012)(6916009)(77096007)(86362001)(305945005)(126002)(486006)(476003)(11346002)(5660300002)(47776003)(68736007)(2616005)(26005)(4326008)(53936002)(7696005)(51416003)(70206006)(1076003)(50226002)(50466002)(48376002)(356004)(16586007)(54906003)(53416004)(72206003)(478600001)(6666004)(316002)(2351001)(76176011)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1151; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b95cfb5-c24d-43bd-2cf2-08d6d2dfeafd X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328); SRVR:MWHPR12MB1151; X-MS-TrafficTypeDiagnostic: MWHPR12MB1151: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-Forefront-PRVS: 0030839EEE X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: QqIcuYRvhBn4GKW8ejMbBUE7+ml0xuaTBuWvr/n7HhuUF0rocrzC7dGNoXq6fPfv9p8OzsMjmlEWI9RuEaLSHEH97OcaOE9/+tEtwOA4c6TF8+Mj6q2yWHY8pgqYxHrFs9NrOjdfb3l4ts3fmxNRZVOzcdgaq2oCD6UCR+d4mTHxd0pY1mmJD5N0zqRSS9goamFLmiJgQzv9UOnvnrBTT2v6lICVhSYAdfRrfV+cOXJWhpqEGBjbyeFhqBOvIgBgOK2sMgth4f85F2oHqghoYLXEzrNUYByRJWRckh1P44l+qduqHSZyJ5OuIW00EJ+tUTIbLjR+SyZT7vXYQyf4u74q7lnIMuJi3LhHkcsT6ulZXyFZXVsOXz+1hHKeKXuU/CLPxoF9TYap1U2FxvFeexXHImu9ZKbWEBi/CGxm9kc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2019 11:34:07.9292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b95cfb5-c24d-43bd-2cf2-08d6d2dfeafd 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: MWHPR12MB1151 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=5d8B3nMVB0v27E14kiUaB5Wt6/1rDeMUy/KwWwTfiIk=; b=YU7VCzfgjCRIZcZdscCcqRwcdJ4DXsv6SGNgtlr+nx0UQDt/hXaw3x0SieL0DC3ganhkS7BGkzf0w78Zp+hXeKrVp+8Byvl5xbQyFStv2VuudIg7iN1eAv/5ZwquXyJdZ3m8KMaMByTfclucYEpv/x7PjKe+/QgBEiF8spQOzjo= 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: Christian.Koenig@amd.com 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 2c19376b..17e3d880 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -4256,3 +4256,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) }