From patchwork Tue Jan 12 21:23:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFyZWsgT2zFocOhaw==?= X-Patchwork-Id: 8021041 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F732BEEE5 for ; Tue, 12 Jan 2016 21:24:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2E6620414 for ; Tue, 12 Jan 2016 21:24:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E029120416 for ; Tue, 12 Jan 2016 21:24:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A5A972138; Tue, 12 Jan 2016 13:24:13 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD41472136 for ; Tue, 12 Jan 2016 13:24:10 -0800 (PST) Received: by mail-wm0-f65.google.com with SMTP id u188so33404325wmu.0 for ; Tue, 12 Jan 2016 13:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=d9i3/cAz9p+XE+QBbu+jyjLvw8QgpFjn1qocccqQpcA=; b=Gd/9fAzwzbsCJZIQhQKyB0D6ebmCotwXpxsYoZj3ao+TxN83x3DNxnh+AhwscfGjjy yuQEUvrdi2y0w+929vje3OMO/GI/B2MFbKp1eyEFvMxy9Krvgo9ddVwNo0OHfxAlGLdU 6cUCk3LmRsdbNgvIZSPJyhnCy5CSfggYUFvuoBMLQxQ6coOwpeU38UUpZx58/g5YJfio qWTcc84DYk9A41ldPOTc587QYB581S7bOE5xySDtwiG/UKalprbuRECpSybGjC3f1Nzn aVHk3bbU4+eXrs+4sat9JG2uOt/LNOZzz6yzWjYMSJVn3FALzJdPbXFDpyJGQBxdav9i j1Iw== X-Received: by 10.194.246.37 with SMTP id xt5mr63667117wjc.7.1452633849425; Tue, 12 Jan 2016 13:24:09 -0800 (PST) Received: from heaven.amd.com (ip-89-103-110-3.net.upcbroadband.cz. [89.103.110.3]) by smtp.gmail.com with ESMTPSA id n5sm19291001wmf.3.2016.01.12.13.24.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jan 2016 13:24:08 -0800 (PST) From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 09/10] amdgpu: cs_wait_fences now can return the first signaled fence index Date: Tue, 12 Jan 2016 22:23:55 +0100 Message-Id: <1452633836-26855-10-git-send-email-maraeo@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452633836-26855-1-git-send-email-maraeo@gmail.com> References: <1452633836-26855-1-git-send-email-maraeo@gmail.com> 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "monk.liu" Signed-off-by: monk.liu --- amdgpu/amdgpu.h | 3 ++- amdgpu/amdgpu_cs.c | 12 +++++++++--- include/drm/amdgpu_drm.h | 3 ++- tests/amdgpu/basic_tests.c | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index 8822a0c..d4be7fc 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -916,6 +916,7 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_fence *fence, * otherwise, wait at least one fence * \param timeout_ns - \c [in] The timeout to wait, in nanoseconds * \param status - \c [out] '1' for signaled, '0' for timeout + * \param first - \c [out] the index of the first signaled fence from @fences * * \return 0 on success * <0 - Negative POSIX Error code @@ -927,7 +928,7 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences, uint32_t fence_count, bool wait_all, uint64_t timeout_ns, - uint32_t *status); + uint32_t *status, uint32_t *first); /* * Query / Info API diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index d033f8e..5c7a3a3 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -439,7 +439,8 @@ static int amdgpu_ioctl_wait_fences(struct amdgpu_cs_fence *fences, uint32_t fence_count, bool wait_all, uint64_t timeout_ns, - uint32_t *status) + uint32_t *status, + uint32_t *first) { struct drm_amdgpu_fence *drm_fences; amdgpu_device_handle dev = fences[0].context->dev; @@ -467,6 +468,10 @@ static int amdgpu_ioctl_wait_fences(struct amdgpu_cs_fence *fences, return -errno; *status = args.out.status; + + if (first) + *first = args.out.first_signaled; + return 0; } @@ -474,7 +479,8 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences, uint32_t fence_count, bool wait_all, uint64_t timeout_ns, - uint32_t *status) + uint32_t *status, + uint32_t *first) { uint32_t ioctl_status = 0; uint32_t i; @@ -499,7 +505,7 @@ int amdgpu_cs_wait_fences(struct amdgpu_cs_fence *fences, *status = 0; r = amdgpu_ioctl_wait_fences(fences, fence_count, wait_all, timeout_ns, - &ioctl_status); + &ioctl_status, first); if (!r) *status = ioctl_status; diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h index 2cbea72..194e1f9 100644 --- a/include/drm/amdgpu_drm.h +++ b/include/drm/amdgpu_drm.h @@ -316,7 +316,8 @@ struct drm_amdgpu_wait_fences_in { }; struct drm_amdgpu_wait_fences_out { - uint64_t status; + uint32_t status; + uint32_t first_signaled; }; union drm_amdgpu_wait_fences { diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c index 56db935..47cd1db 100644 --- a/tests/amdgpu/basic_tests.c +++ b/tests/amdgpu/basic_tests.c @@ -974,7 +974,7 @@ static void amdgpu_command_submission_multi_fence_wait_all(bool wait_all) r = amdgpu_cs_wait_fences(fence_status, ib_cs_num, wait_all, AMDGPU_TIMEOUT_INFINITE, - &expired); + &expired, NULL); CU_ASSERT_EQUAL(r, 0); r = amdgpu_bo_unmap_and_free(ib_result_handle, va_handle,