From patchwork Wed Aug 16 04:13:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9902867 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 3DED6603FB for ; Wed, 16 Aug 2017 04:14:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32F3F28982 for ; Wed, 16 Aug 2017 04:14:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2597128985; Wed, 16 Aug 2017 04:14:49 +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 439C528967 for ; Wed, 16 Aug 2017 04:14:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B984A6E1D5; Wed, 16 Aug 2017 04:14:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6B916E3AF for ; Wed, 16 Aug 2017 04:14:12 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id t86so274137pfe.1 for ; Tue, 15 Aug 2017 21:14:12 -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=RVDbEgQYjYXR/Vbijyrrfcxv6LJQFrAwl/wO0gR8ojY=; b=PoFftxlQ0wVuPubAR72otEZxtZFHxiC8+W7E+h1TdZHZawICJB+Lnp08fZFKAjKsmC YaUx1HZauiOYep6V8i/SqmOsRUXok/oDZhhDD1mkRyhy71FGnPT8XxpvaGR/Sgs/Rihy g6XuR3lo6FvF6afgLdIkRB1of4JmDZC/5CNAmNm6DKeSghdr1YL8CU2S5tI5SyJnvhTu noVv3OHoaOfdi2DDMVNqtSgeSWdO06JHUahgPcvjo/liZ06no0V0qcRgSgF0DQi1e0mt nHD0jCKRwQ+RJl4lGKgadgO2Nhule8znvSnIR9KaDTPQYTRrbqrP5L3ei1c1N7SmERO0 hWzQ== 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=RVDbEgQYjYXR/Vbijyrrfcxv6LJQFrAwl/wO0gR8ojY=; b=PBTljlKh9xcKddRk557SHyRQTNZym5KQ6pI41tXdq3JOuQ87CmMX0v+l93TjIVbmL2 6kjxVgrcSsON/hVsloXVeL4zR9kov0ZkARgh/sZho2iSwU0aAPIqkzGg0wjfWSAY9vd6 +aXA2qdIdUdiZn4GL3giApizbNWjhCGrczovzedj68iooFgzswlL2GxVMKMFZpe9/iyV jLJj0KJtWiJ9WnflHQeGkAY1oywzdF4dpuJB6YXDwZFChxT9uhLX46cjZhpb7bmmjvbQ q1+gUHlR5cv2GaU/m/+DJOYgmFcTWPZSMQo9NKTIW8Onl9idbwLNzUKf6XUOWhwEj+0K itRg== X-Gm-Message-State: AHYfb5i6hOLYsdXtdN5t+H9Op4IQso9CME6Z2+LqAbTYIVDbxG0SgKmW HTAQY2rdGuB501Q15wOS9w== X-Received: by 10.98.62.28 with SMTP id l28mr423426pfa.14.1502856852110; Tue, 15 Aug 2017 21:14:12 -0700 (PDT) Received: from omlet.jf.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id f88sm19684595pff.74.2017.08.15.21.14.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2017 21:14:11 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/7] drm/syncobj: Add a reset ioctl Date: Tue, 15 Aug 2017 21:13:53 -0700 Message-Id: <1502856835-9433-6-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1502856835-9433-1-git-send-email-jason.ekstrand@intel.com> References: <1502856835-9433-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. Signed-off-by: Jason Ekstrand Reviewed-by: Christian König --- 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 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 2ab0ff90..4185483 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 4e8563c..755af5f 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -589,3 +589,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