From patchwork Tue Aug 8 22:46:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9889175 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 BA1DE601EB for ; Tue, 8 Aug 2017 22:47:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD0A028951 for ; Tue, 8 Aug 2017 22:47:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E83328A2C; Tue, 8 Aug 2017 22:47:16 +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 9F50228A22 for ; Tue, 8 Aug 2017 22:47:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D11B26E276; Tue, 8 Aug 2017 22:46:42 +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 7B4A66E275 for ; Tue, 8 Aug 2017 22:46:41 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id y129so4261948pgy.3 for ; Tue, 08 Aug 2017 15:46:41 -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; bh=mAHYpiY5ymwjFnSIXyQo6UQwuq7iqJ5L+x9ld026Ppc=; b=erIJIuNiic/ClrzcMikw4HelTq+MxxrLt5jzDuB5a6FclH15q+SifvTsPqqDxg7X7e HMJRc31c95zsVjImqPyo4y29tsv1SWBCM7Kfe2kRWFJ7Dw3JeaxWwv5TpuMNq69FO8/+ 32R+VwCe5xarr2C6sC37P9mwUeFXewLNe8GRR0fH0Kppio3Wb32B9YrfF3YJaxZ+hXmK 6RciccxyxvTj5ffGdyl+s4ehKpcuuMlrGS4KDSVfAxUBgpF8eCoJxgomfZ5wOT7CD6a5 HWXTD6EClUN5ut7vkz9ql/RYO/QnzI9bOU0BI3WT85M+4hmDb9fBoqEbSu6o0YzMtD5p muDw== 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; bh=mAHYpiY5ymwjFnSIXyQo6UQwuq7iqJ5L+x9ld026Ppc=; b=ia+nYhzHR5hXFkrPz8hYoswIM94IaTp9vUIVZe/CvIO+IIN0Btq/GmAHCvsBctByVC naRhWKXM4wD25euLVFJ+eGNtT9xwyRu3kWmMzKPWJqcZQEuUERhNf435sblLmHMaGl8q SXXkXT9bAZvJVcnF2VqcYqFKmtpzWIac+UIdV2pZGHZvBhee6A60tH4maQA2PtBOT9sD BirEP7DZIPz+eA47ZeTpuh+mVrFMfzqMRwSz1qewnE65qZ611emXf+jyQkhIlYSB1hHO lb0TK77rq/h4uITrOZEM6T1DxmH5k7yNbOHug8gKM6YpEVqUU3N4LPihmgQ0PogUw1bw iXzw== X-Gm-Message-State: AHYfb5hZoN8PhPI/5D6UGfnGKlpNg9vAr4HwJ7YIJRqJf26GzIpqjFKy sb4ywnARvkmkc14DnO1low== X-Received: by 10.99.115.4 with SMTP id o4mr5780410pgc.114.1502232400767; Tue, 08 Aug 2017 15:46:40 -0700 (PDT) Received: from omlet.jf.intel.com ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id l24sm56129pfi.99.2017.08.08.15.46.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Aug 2017 15:46:39 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/9] drm/syncobj: Add a reset ioctl Date: Tue, 8 Aug 2017 15:46:07 -0700 Message-Id: <1502232369-19753-8-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1502232369-19753-1-git-send-email-jason.ekstrand@intel.com> References: <1502232369-19753-1-git-send-email-jason.ekstrand@intel.com> 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: , MIME-Version: 1.0 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. Signed-off-by: Jason Ekstrand --- drivers/gpu/drm/drm_internal.h | 2 ++ drivers/gpu/drm/drm_ioctl.c | 2 ++ drivers/gpu/drm/drm_syncobj.c | 24 ++++++++++++++++++++++++ include/uapi/drm/drm.h | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index f3c4e57..6e8bc4d 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -165,3 +165,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 310f3ec..1acf6ac 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 2f14e38..25807f5 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -613,3 +613,27 @@ 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_reset *args = data; + struct drm_syncobj *syncobj; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -ENODEV; + + if (args->flags != 0) + return -EINVAL; + + syncobj = drm_syncobj_find(file_private, args->handle); + if (!syncobj) + return -ENOENT; + + drm_syncobj_replace_fence(syncobj, NULL); + + drm_syncobj_put(syncobj); + + return 0; +} diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 0757c1a..4b301b4 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -729,6 +729,11 @@ struct drm_syncobj_wait { __u32 pad; }; +struct drm_syncobj_reset { + __u32 handle; + __u32 flags; +}; + #if defined(__cplusplus) } #endif @@ -852,6 +857,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_reset) /** * Device specific ioctls should only be in their respective headers