From patchwork Fri Aug 25 17:52:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9922603 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 37594600C5 for ; Fri, 25 Aug 2017 17:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2529328429 for ; Fri, 25 Aug 2017 17:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 192ED2843B; Fri, 25 Aug 2017 17:54:03 +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_SIGNED, 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 900AB28429 for ; Fri, 25 Aug 2017 17:54:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 093CD6E8F4; Fri, 25 Aug 2017 17:52:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E7046E8EB for ; Fri, 25 Aug 2017 17:52:51 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id t3so643540pgt.5 for ; Fri, 25 Aug 2017 10:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s0F5J0NgTpBo3z4d/eMoTUyE1VJZg+YZpIVXWClZJv0=; b=uCLjGs+pMLLQHdRxpy0DuyPzrfpAHnPMkN76SIpmGygKzE6dCEHmrf0DxbScSYfO2i uJ1eFGtrow0kpGUaJKWTtbSiJSalQ6szui3AIDD7aqB/pwXjcm1AFe9FVurdWz9Nl95O 0BuFC80UPt+n+uPbvaIU4WAtlaxIuZyWjJ1Ram8Mi50kqBc2TpkOVzmf9jHV9yXfCFnc inz6NbrmfMU4/Q6a574nqfV1PRyIYj/uo5P0nLk1ZNcAcxPoKegoedLyBVoFhobg5Jmf rJAnNvaeLs/62LI0mLDb7nC766p/qqIAh1pb0RCxRYkvUPFNNr1Ce0TH9oegP7Wl6LGz d8HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s0F5J0NgTpBo3z4d/eMoTUyE1VJZg+YZpIVXWClZJv0=; b=ech+bc8bTfMERksehmFxYvXJr1TLvRjv2STNNwUZbnfWU6Dp+ZJNFHS1q66ebV8ByQ 8pBAziVKMwUyB/ieMpkOvAw2dMwq1pMvjVgL+EuhH3gKlxx0kdUUav1U1MBLH1RhklHg zkphmQcOFEwb+lvGBXY409TH64mDuJqKVU9g9uHNM3s+9wiKK3+cfK+/qscYcaHAWtKp 5X1BT/ub93QmfJf8/McgCyrOFhbWMG3KQESQLWKbalxAiUr7xpXl3biOuKtRBA5Z4ZLK dgpBQ1PhKdf7KcK8LrASJoJpr4hmcwenwdeOcZUkQLjjQA2Z89hUCdf99I9knVVey5BP yjtQ== X-Gm-Message-State: AHYfb5i6UxmOEnv1nhsuxRPTNkJ/ZIGqjFFGt57SxWHhWMATXR9VJ2e9 He+M4gK/5vDg3NgpP/zM2Q== X-Received: by 10.99.94.65 with SMTP id s62mr3005686pgb.15.1503683570223; Fri, 25 Aug 2017 10:52:50 -0700 (PDT) Received: from omlet.jlekstrand.net (static-50-43-41-117.bvtn.or.frontiernet.net. [50.43.41.117]) by smtp.gmail.com with ESMTPSA id z8sm11024919pgs.25.2017.08.25.10.52.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Aug 2017 10:52:49 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: dri-devel@lists.freedesktop.org Subject: [PATCH 09/10] drm/syncobj: Add a reset ioctl (v2) Date: Fri, 25 Aug 2017 10:52:27 -0700 Message-Id: <1503683548-23548-9-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1503683548-23548-1-git-send-email-jason.ekstrand@intel.com> References: <1503683548-23548-1-git-send-email-jason.ekstrand@intel.com> MIME-Version: 1.0 Cc: Jason Ekstrand , Jason Ekstrand 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 This just resets the dma_fence to NULL so it looks like it's never been signaled. This will be useful once we add the new wait API for allowing wait on "submit and signal" behavior. v2: - Take an array of sync objects (Dave Airlie) Signed-off-by: Jason Ekstrand Reviewed-by: Christian König (v1) --- drivers/gpu/drm/drm_internal.h | 2 ++ drivers/gpu/drm/drm_ioctl.c | 2 ++ drivers/gpu/drm/drm_syncobj.c | 30 ++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 7 +++++++ 4 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 534e5ac..83f1615 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -169,3 +169,5 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private); diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index b4f4434..16c5d51 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -659,6 +659,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), }; #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 15e74ca..57f8b6c 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -885,3 +885,33 @@ drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, return ret; } + +int +drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_array *args = data; + struct drm_syncobj **syncobjs; + uint32_t i; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + for (i = 0; i < args->count_handles; i++) + drm_syncobj_replace_fence(syncobjs[i], NULL); + + drm_syncobj_array_free(syncobjs, args->count_handles); + + return 0; +} diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 4c74659..b037fdf 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -731,6 +731,12 @@ struct drm_syncobj_wait { __u32 pad; }; +struct drm_syncobj_array { + __u64 handles; + __u32 count_handles; + __u32 pad; +}; + #if defined(__cplusplus) } #endif @@ -854,6 +860,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) +#define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) /** * Device specific ioctls should only be in their respective headers