From patchwork Thu Nov 3 17:41:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9411279 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 8845460585 for ; Thu, 3 Nov 2016 17:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 803652AE52 for ; Thu, 3 Nov 2016 17:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 754892AE54; Thu, 3 Nov 2016 17:41:28 +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=-0.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB,T_DKIM_INVALID autolearn=no 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 42B612AE52 for ; Thu, 3 Nov 2016 17:41:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D14E89E2B; Thu, 3 Nov 2016 17:41:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi0-x243.google.com (mail-oi0-x243.google.com [IPv6:2607:f8b0:4003:c06::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26F1289D6C; Thu, 3 Nov 2016 17:41:24 +0000 (UTC) Received: by mail-oi0-x243.google.com with SMTP id v84so7897555oie.2; Thu, 03 Nov 2016 10:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hlLbElLeW2peLV8YBBDs4gDdAwJy4a5zZ+GGoJ6Ktag=; b=Oh+CUZjJR5AqoBFmxVETC6x+3Rud9pIijUOE2XQRml86HJuK4A1Lwc+ycbI4XUngxg JGVCKx4SIHr8RZvpdVvjC+WTE8XGh+yZpbqG+22HyIt4EK7X4aGl+FBOrjdY+d/m9hFp 84cW78CV1P8eQOCO8dLTAgHcgbwj/Yac+Gk/vfWNU3NWUHL8fWx3m8vTxUEBjmCz++h+ QrzRYmkAF3K75BZ5OTEvJpS2of6MSrEbg2YI6s0IpdKXfpM9VY/SRqIapscx8N1SPdXN 1/OFs9XQiLkAUUvyJPkTVCEnhN0btm7+hlWBY17vPAFH65Z0YpE1+KkwxtDN90Gg3OE8 /7PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hlLbElLeW2peLV8YBBDs4gDdAwJy4a5zZ+GGoJ6Ktag=; b=I98r0JQk5Hj7YVDIrcA/HY4hm6sNGQir0doBvmLGzgy3BrSXQ6Gr7A1o5H7mLqB7sb HPorxMTjBKS5ItpyBdou1xmRH/9Xn2kMUdq5ML21bKHyE7LNSz9fwa34QVF9/88NtkBS JA9F7fD3nKSR/TX4GoNhPv0xb8N6ry/2HUZQoVBSdCVwnL6C4Hp7e6zNDJVCe/9in7kj ZYDw+GdTRmPzm/LVfWVeoyMgg1pRNHgCmK6k2utaIdOGyOccFbR8z9782JpJUy41ugIt OvBOgaK8zlLvr7HkKUmx5KlKJTAbrS+8XFaZk0fuoyLbGIt0+1EJGNSm66ATRQjmFsCe 6Qrg== X-Gm-Message-State: ABUngveI1H4J7zwflPJ4QXBO6u6czGZAW9WkaWPBRvAY4qb74KoemuGswV9/NVytZtoFhQ== X-Received: by 10.36.95.2 with SMTP id r2mr5982277itb.48.1478194883472; Thu, 03 Nov 2016 10:41:23 -0700 (PDT) Received: from cm.amd.com ([165.204.55.251]) by smtp.gmail.com with ESMTPSA id r67sm3162726ioi.9.2016.11.03.10.41.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Nov 2016 10:41:23 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/amdgpu: return first signaled fence index in status parameter Date: Thu, 3 Nov 2016 13:41:11 -0400 Message-Id: <1478194871-29766-3-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1478194871-29766-1-git-send-email-alexander.deucher@amd.com> References: <1478194871-29766-1-git-send-email-alexander.deucher@amd.com> Cc: Alex Deucher , "monk.liu" 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-Virus-Scanned: ClamAV using ClamSMTP From: "monk.liu" Return the index of the first signaled fence in the fences ioctl. This information is useful in some APIs like Vulkan. Signed-off-by: monk.liu Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 2 +- include/uapi/drm/amdgpu_drm.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index f0c3c356..f748162 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1216,6 +1216,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, { unsigned long timeout = amdgpu_gem_timeout(wait->in.timeout_ns); uint32_t fence_count = wait->in.fence_count; + uint32_t first = ~0; struct fence **array; unsigned i; long r; @@ -1241,13 +1242,14 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, } } - r = fence_wait_any_timeout(array, fence_count, true, timeout); + r = fence_wait_any_timeout(array, fence_count, true, timeout, &first); if (r < 0) goto err_free_fence_array; out: memset(wait, 0, sizeof(*wait)); wait->out.status = (r > 0); + wait->out.first_signaled = first; /* set return value 0 to indicate success */ r = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index d8af37a..ed50d77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -361,7 +361,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, if (count) { spin_unlock(&sa_manager->wq.lock); t = fence_wait_any_timeout(fences, count, false, - MAX_SCHEDULE_TIMEOUT); + MAX_SCHEDULE_TIMEOUT, NULL); for (i = 0; i < count; ++i) fence_put(fences[i]); diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index b726095..bca630c 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -328,7 +328,8 @@ struct drm_amdgpu_wait_fences_in { }; struct drm_amdgpu_wait_fences_out { - __u64 status; + __u32 status; + __u32 first_signaled; }; union drm_amdgpu_wait_fences {