From patchwork Tue Sep 12 20:43:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWFyZWsgT2zFocOhaw==?= X-Patchwork-Id: 9950091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4099602C9 for ; Tue, 12 Sep 2017 20:43:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6624290C0 for ; Tue, 12 Sep 2017 20:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B55F290C2; Tue, 12 Sep 2017 20:43:33 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 5F354290C0 for ; Tue, 12 Sep 2017 20:43:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6630B6E716; Tue, 12 Sep 2017 20:43:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x22b.google.com (mail-wr0-x22b.google.com [IPv6:2a00:1450:400c:c0c::22b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FF9A6E70C; Tue, 12 Sep 2017 20:43:30 +0000 (UTC) Received: by mail-wr0-x22b.google.com with SMTP id o42so24997428wrb.3; Tue, 12 Sep 2017 13:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xRHFmRmbOU9PurK9hT8zoL/EhJ89Y8uM3+/N6wGCD/A=; b=HEJuqnlN4YotwiFkSSjODa7LXMBX/jg+htVmUs/Ql90K/a+biKwfY9+21XPibnvBAx HJGBIgUIv8s4Ek421PURQdlKxEnJ39lBM3PP3RpVj9RfpA5diQLx7m+qXkYM0vZb4tTM kvGr/nWOcrfPzNvLWWZ8VOsiFz84F3a6x5mExmSxqOUKA4Xv1jigXXXr2ro7VXSacVmL QgJHx3WcIYFlv2zHlKTDWLD5ZfSGHFHCxHqnAHsArPhGS7jcSgvqEeZyrEB9fSwAWZVj roH6RijxUPoqoNE3+BxdiSlZY4GFjc8yogCbCykroyP3G9sVOnYVKuCX0wXcfD3X5Zjs +LUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xRHFmRmbOU9PurK9hT8zoL/EhJ89Y8uM3+/N6wGCD/A=; b=CU7vikICDN1YNc/MIrt70YHjfVRwiqE/qDEwYXZGFycqaxLnbIp2S9+w+8SCIbc6mb nb723El12TIHE8zXtf8GURMmXkXG11VLCtoFosbHqw+CYo02hws66/kvSVbbfN7/+X5n I6/YhiCKHo3e7lNIWr5SyfX0s6J4HKGrdku0vIBu3EVcKifRAEyuvNKLcrwANYff+anH FFgkupcN2g+4GikPunO2OJ2Ek2tILB+0265SgUPiL9pZ0iML+VB+4PiKevq0xE9hC0WR a+ps7ysTrqBakNRzKQC0+fy71blxYiLP3/t7gX2DMEX5uKp8X7abeGYuxovBikt/YbSV /eFw== X-Gm-Message-State: AHPjjUjWACv188vQYIbjbZc5T8YLC/KtaTXRvu+nVBSXwr/VVyhXJTMt PYApWmYAjlIBbPes X-Google-Smtp-Source: ADKCNb5lABAD6TkeTmwn/5TuAJ4kQV0/6TPswpQU3qjbAVyEukkapsBCkSQ+M3XcPxD0AHL90bliyw== X-Received: by 10.223.139.211 with SMTP id w19mr12896320wra.199.1505249008370; Tue, 12 Sep 2017 13:43:28 -0700 (PDT) Received: from localhost.localdomain (ip-78-102-146-217.net.upcbroadband.cz. [78.102.146.217]) by smtp.gmail.com with ESMTPSA id d9sm8216141wrd.37.2017.09.12.13.43.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Sep 2017 13:43:27 -0700 (PDT) From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH libdrm 3/4] amdgpu: add amdgpu_cs_syncobj_wait Date: Tue, 12 Sep 2017 22:43:11 +0200 Message-Id: <1505248992-1898-3-git-send-email-maraeo@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505248992-1898-1-git-send-email-maraeo@gmail.com> References: <1505248992-1898-1-git-send-email-maraeo@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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 From: Marek Olšák --- amdgpu/amdgpu.h | 20 ++++++++++++++++++++ amdgpu/amdgpu_cs.c | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index b44b9b6..979acfc 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1354,6 +1354,26 @@ int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev, uint32_t syncobj); /** + * Wait for one or all sync objects to signal. + * + * \param dev - \c [in] self-explanatory + * \param handles - \c [in] array of sync object handles + * \param num_handles - \c [in] self-explanatory + * \param timeout_nsec - \c [in] self-explanatory + * \param flags - \c [in] a bitmask of DRM_SYNCOBJ_WAIT_FLAGS_* + * \param first_signaled - \c [in] self-explanatory + * + * \return 0 on success\n + * -ETIME - Timeout + * <0 - Negative POSIX Error code + * + */ +int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev, + uint32_t *handles, unsigned num_handles, + int64_t timeout_nsec, unsigned flags, + uint32_t *first_signaled); + +/** * Export kernel sync object to shareable fd. * * \param dev - \c [in] device handle diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 4a05536..2cde7bf 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -615,6 +615,18 @@ int amdgpu_cs_destroy_syncobj(amdgpu_device_handle dev, return drmSyncobjDestroy(dev->fd, handle); } +int amdgpu_cs_syncobj_wait(amdgpu_device_handle dev, + uint32_t *handles, unsigned num_handles, + int64_t timeout_nsec, unsigned flags, + uint32_t *first_signaled) +{ + if (NULL == dev) + return -EINVAL; + + return drmSyncobjWait(dev->fd, handles, num_handles, timeout_nsec, + flags, first_signaled); +} + int amdgpu_cs_export_syncobj(amdgpu_device_handle dev, uint32_t handle, int *shared_fd)