From patchwork Mon Aug 28 21:10: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: 9926161 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 C066E603B4 for ; Mon, 28 Aug 2017 21:11:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B13F7287D4 for ; Mon, 28 Aug 2017 21:11:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1C2A287C8; Mon, 28 Aug 2017 21:11:05 +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 74606287CB for ; Mon, 28 Aug 2017 21:11:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C211D6E315; Mon, 28 Aug 2017 21:10:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34F996E313 for ; Mon, 28 Aug 2017 21:10:32 +0000 (UTC) Received: by mail-pg0-x242.google.com with SMTP id r133so1193471pgr.2 for ; Mon, 28 Aug 2017 14:10:32 -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:mime-version :content-transfer-encoding; bh=lLl1hnQSAe1L3iYlGilShfahfG12fggy7A3VyZ9LKMg=; b=MJd3EGc1sBbepbuNVzwJcD1roX5RLvb/OahBlytBEU5SI5CRidIwQSxU7ypKakaocy wutv07db1JI25+W7nfhxxE7OlevGCWxN2GxZ6NI4yU/oO2FhIRviM7rsHaJ8MA0bLG9R ewDAjafVfHK354cBW0gAvJWrtWLvqXF9+j4HZ1WfK3Ek+HgJ1RGgHP3DlKJq3353Yp0w AJLjaFI/xCkCZ/UfO/Pn4eIQiMi2WBhfov7jLE0hOXgFiixs2Wdsse6mtKzBwmyNvscu 6nso8nqlw9JNAAUkhJq2xNBQtfU2JVXkO6zEnGvIZ4h8cv80Ll9iezbdvZTcL+PqUyYI KOTw== 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:mime-version :content-transfer-encoding; bh=lLl1hnQSAe1L3iYlGilShfahfG12fggy7A3VyZ9LKMg=; b=LD4NGla8U+9TX41zawae18GTBMTRBjR5yqwHFgVpwcYO1cX2hXxb9s/3GfY8NL8fxz ZRA2b2fX3WDkFu475h4htxyLAkUb7Ht4TBSXJlUNW3xsqHoJnK8t8GK0M+wEq39XW0nZ 7hsHIcGT57zQHiglQA7/5fQLTH0zn4t0JPCmlY+jKye037SkQAjuLngVTdUAlnmnCs7f LXvFsH0zB3ErQXyzNprptDhPisBNWC8uD4jOn4sBd8kTiryudWT/+sDRF4O03ncKDUzr LpfTNoHcdEiNFbhiEaACq45xxqv2zpoayqdC6eiF14MYRfSp4GzyQjK/mwEXoXFaeE4t W9zA== X-Gm-Message-State: AHYfb5jHxXP5nmjMr8OSw7bDTpVroMRUYlUwPLo2bi8D7p1XpG1ebLQI wgiMlhQz+MZcPoAHvPjgPQ== X-Received: by 10.99.120.13 with SMTP id t13mr1804683pgc.250.1503954631333; Mon, 28 Aug 2017 14:10:31 -0700 (PDT) Received: from omlet.ak.intel.com ([134.134.139.78]) by smtp.gmail.com with ESMTPSA id c24sm2176668pfd.182.2017.08.28.14.10.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Aug 2017 14:10:30 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/syncobj: Add a reset ioctl (v3) Date: Mon, 28 Aug 2017 14:10:27 -0700 Message-Id: <1503954628-26426-1-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf 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) v3: - Throw -EINVAL if pad != 0 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 | 33 +++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 7 +++++++ 4 files changed, 44 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..40d2ad2 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -885,3 +885,36 @@ 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->pad != 0) + return -EINVAL; + + 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