From patchwork Tue Sep 12 20:43:09 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: 9950087 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 2402E602C9 for ; Tue, 12 Sep 2017 20:43:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15D69290C0 for ; Tue, 12 Sep 2017 20:43:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AB67290C2; Tue, 12 Sep 2017 20:43:30 +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 94017290C0 for ; Tue, 12 Sep 2017 20:43:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D46CF89C86; Tue, 12 Sep 2017 20:43:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5BB189C86; Tue, 12 Sep 2017 20:43:27 +0000 (UTC) Received: by mail-wr0-x22f.google.com with SMTP id m18so25029996wrm.2; Tue, 12 Sep 2017 13:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=XmVT9ftr7H/3Y4NgXbUSHEWZnXL+hTU6Mg+9gfIG6Zs=; b=Fb//yYfwgXkFqbQgtpvp15wlXA9mYuQynBWYHWaK8a1DuC5/4j3/Y10PWHBR5v4aPM /9m9lkEwgcr2BkmpFeW9/eCDryu2qgjof1qt6SL1Q4YDlxEEMuWzrENbsBETIBaaV8x+ x4OAwDgqOfD5w5/kJomb+4xHK7/H011bw4GzNBy9RNUlZTQq9YZNm26K/ufSDwQTgeRY vudLJ5elJS7gzXpiaIPJ2nuSQTfO3BdpTsIJf3MknZEkNTOlxXS6Hix1dSOcnpoCaQx2 tz8F6HYCsRTUU+Mjbcswyk4qzGPx4gFqY4mXaCT+WqA4+eZpiGnrrO7eHfbQu30N6+Nw HR9A== 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:mime-version :content-transfer-encoding; bh=XmVT9ftr7H/3Y4NgXbUSHEWZnXL+hTU6Mg+9gfIG6Zs=; b=QYL68Wtr/6eXsqRW4D8qGY7cjPrx+RAxsqn4cXPHKLhYfxJ1+GK/OCqW9nU0jDv5J8 jLIy7rzRmkOH+WR+VbqzXVXtmZfCFC+6vH4rj9zZBgVDCUkdiunLEd+yKMa5Cq+Rwdjo GJYyhA6Rkllr/i/+q4QfMrAGB0XVpG+9MfQ1AV1Gc+X6ku/eQoBWUzL9LUoEM0BjdTe3 Ay56Jdo21ovn8eTkwO1drCxM9rM85oWneLumx9l9u58yMGaPG9FGtIpXFvd2CW4ecWi+ wS7woHzKPX07OqAUe1fieXnM92FR7ujpFgynp2qaM/tB0uZZqikU0xZeo6ZuOMJ53MZY 0gxQ== X-Gm-Message-State: AHPjjUgUgcdpec2MkgtO1e0xfQd0XoQsrTHh6/V7PHYq5zgPi3PLNA4/ Y40tNzmrOULvq9gh X-Google-Smtp-Source: ADKCNb5zd2rLXERqmcgavEtd7eqzBRs6Mx4Iiyn0Ev+W0aoR+4IghwQSvM5wUdYtwAe0mzUWf5rPnQ== X-Received: by 10.223.164.22 with SMTP id d22mr13887312wra.7.1505249006226; Tue, 12 Sep 2017 13:43:26 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Sep 2017 13:43:25 -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 1/4] amdgpu: add sync_file import and export functions Date: Tue, 12 Sep 2017 22:43:09 +0200 Message-Id: <1505248992-1898-1-git-send-email-maraeo@gmail.com> X-Mailer: git-send-email 2.7.4 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 | 30 ++++++++++++++++++++++++++++++ amdgpu/amdgpu_cs.c | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index 238b1aa..b44b9b6 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1383,6 +1383,36 @@ int amdgpu_cs_import_syncobj(amdgpu_device_handle dev, uint32_t *syncobj); /** + * Export kernel sync object to a sync_file. + * + * \param dev - \c [in] device handle + * \param syncobj - \c [in] sync object handle + * \param sync_file_fd - \c [out] sync_file file descriptor. + * + * \return 0 on success\n + * <0 - Negative POSIX Error code + * + */ +int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev, + uint32_t syncobj, + int *sync_file_fd); + +/** + * Import kernel sync object from a sync_file. + * + * \param dev - \c [in] device handle + * \param syncobj - \c [in] sync object handle + * \param sync_file_fd - \c [in] sync_file file descriptor. + * + * \return 0 on success\n + * <0 - Negative POSIX Error code + * + */ +int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev, + uint32_t syncobj, + int sync_file_fd); + +/** * Submit raw command submission to kernel * * \param dev - \c [in] device handle diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index dfba875..4a05536 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -635,6 +635,26 @@ int amdgpu_cs_import_syncobj(amdgpu_device_handle dev, return drmSyncobjFDToHandle(dev->fd, shared_fd, handle); } +int amdgpu_cs_syncobj_export_sync_file(amdgpu_device_handle dev, + uint32_t syncobj, + int *sync_file_fd) +{ + if (NULL == dev) + return -EINVAL; + + return drmSyncobjExportSyncFile(dev->fd, syncobj, sync_file_fd); +} + +int amdgpu_cs_syncobj_import_sync_file(amdgpu_device_handle dev, + uint32_t syncobj, + int sync_file_fd) +{ + if (NULL == dev) + return -EINVAL; + + return drmSyncobjImportSyncFile(dev->fd, syncobj, sync_file_fd); +} + int amdgpu_cs_submit_raw(amdgpu_device_handle dev, amdgpu_context_handle context, amdgpu_bo_list_handle bo_list_handle,